diff --git a/drivers/net/wireless/realtek/rtl8852ce/Makefile b/drivers/net/wireless/realtek/rtl8852ce/Makefile index bccc7c48..6cdd263f 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/Makefile +++ b/drivers/net/wireless/realtek/rtl8852ce/Makefile @@ -14,9 +14,6 @@ EXTRA_CFLAGS += -Wno-unused-label #EXTRA_CFLAGS += -Wno-unused-function EXTRA_CFLAGS += -Wno-unused #EXTRA_CFLAGS += -Wno-uninitialized -EXTRA_CFLAGS += -Wno-missing-prototypes -EXTRA_CFLAGS += -Wno-missing-declarations -EXTRA_CFLAGS += -Wno-enum-conversion ############ ANDROID COMMON KERNEL ############ # clang @@ -38,8 +35,7 @@ ifeq ($(GCC_VER_49),1) EXTRA_CFLAGS += -Wno-date-time # Fix compile error && warning on gcc 4.9 and later endif -SOURCETREE = $(srctree.nvidia-oot)/drivers/net/wireless/realtek/rtl8852ce -EXTRA_CFLAGS += -I$(SOURCETREE)/include +EXTRA_CFLAGS += -I$(src)/include EXTRA_LDFLAGS += --strip-debug @@ -89,6 +85,7 @@ CONFIG_RTW_REGDB = rtk_8852CE_M.2_2230-67-52 ########################## Initial Channel Plan ########################## # XX: unspecified CONFIG_RTW_COUNTRY_CODE = XX +CONFIG_RTW_EXTRA_ALPHA2 = US # 0xFFFF: unspecified CONFIG_RTW_CHPLAN = 0xFFFF # 0xFFFF: unspecified @@ -97,10 +94,11 @@ CONFIG_RTW_CHPLAN_6G = 0xFFFF ########################## 802.11d (country IE slave) ########################## CONFIG_80211D = y # 0: disable, 1: enable, 2: enable when INIT/USER set world wide mode -CONFIG_RTW_COUNTRY_IE_SLAVE_EN_MODE = 0 +CONFIG_RTW_COUNTRY_IE_SLAVE_EN_MODE = 2 # BIT0: deprecated BIT # BIT1: consider all environment BSSs, otherwise associated BSSs only -CONFIG_RTW_COUNTRY_IE_SLAVE_FLAGS = 0x00 +# BIT2: consider all environment BSSs with majority selection (implys BIT1) +CONFIG_RTW_COUNTRY_IE_SLAVE_FLAGS = 0x04 ########################## EDCCA for regulatory ########################## # NORMAL: Without regulatory consideration @@ -231,11 +229,16 @@ CONFIG_MP_VHT_HW_TX_MODE = n ###################### ROAMING ##################################### CONFIG_LAYER2_ROAMING = y #bit0: ROAM_ON_EXPIRED, #bit1: ROAM_ON_RESUME, #bit2: ROAM_ACTIVE -CONFIG_ROAMING_FLAG = 0x3 +#bit3: ROAM_QUICK_SCAN +#bit4: ROAM_ACTIVE_INTERVAL_EXTENSION +#bit5: ROAM_BTM_IGNORE_DELTA +#bit6: ROAM_ACTIVE_IGNORE_CHK (Debug) +CONFIG_ROAMING_FLAG = 0x3f +# 2:2G, 5:5G, 6:6G, 52:5G-2G, 526:5G-2G-6G, 562:5G-6G-2G, ... +CONFIG_ROAM_SCAN_ORDER = 526 ###################### Platform Related ####################### -CONFIG_PLATFORM_TEGRA = y -CONFIG_PLATFORM_I386_PC = n +CONFIG_PLATFORM_I386_PC = y CONFIG_PLATFORM_RTL8198D = n CONFIG_PLATFORM_ANDROID_X86 = n CONFIG_PLATFORM_ANDROID_INTEL_X86 = n @@ -384,7 +387,7 @@ ifeq ($(CONFIG_RTW_FSM), y) EXTRA_CFLAGS += -DCONFIG_RTW_FSM #EXTRA_CFLAGS += -DCONFIG_RTW_FSM_XXX EXTRA_CFLAGS += -DCONFIG_RTW_FSM_RRM -#EXTRA_CFLAGS += -DCONFIG_RTW_FSM_BTM +EXTRA_CFLAGS += -DCONFIG_RTW_FSM_BTM endif ifeq ($(CONFIG_PHL_FSM), y) @@ -517,6 +520,9 @@ endif ifneq ($(CONFIG_RTW_COUNTRY_CODE), XX) EXTRA_CFLAGS += -DCONFIG_RTW_COUNTRY_CODE=\"$(CONFIG_RTW_COUNTRY_CODE)\" endif +ifneq ($(CONFIG_RTW_EXTRA_ALPHA2), XX) +EXTRA_CFLAGS += -DCONFIG_RTW_EXTRA_ALPHA2=\"$(CONFIG_RTW_EXTRA_ALPHA2)\" +endif ifneq ($(CONFIG_RTW_CHPLAN), 0xFFFF) EXTRA_CFLAGS += -DCONFIG_RTW_CHPLAN=$(CONFIG_RTW_CHPLAN) endif @@ -596,6 +602,7 @@ endif ifeq ($(CONFIG_LAYER2_ROAMING), y) EXTRA_CFLAGS += -DCONFIG_LAYER2_ROAMING -DCONFIG_ROAMING_FLAG=$(CONFIG_ROAMING_FLAG) + EXTRA_CFLAGS += -DCONFIG_ROAM_SCAN_ORDER=$(CONFIG_ROAM_SCAN_ORDER) endif ifeq ($(CONFIG_PNO_SUPPORT), y) @@ -761,22 +768,12 @@ ifeq ($(CONFIG_DBG_AX_CAM), y) EXTRA_CFLAGS += -DCONFIG_DBG_AX_CAM endif -ifeq ($(CONFIG_PLATFORM_TEGRA), y) -ARCH = arm64 -KVER := $(shell uname -r) -KSRC := /lib/modules/$(KVER)/build -EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT -EXTRA_CFLAGS += -Wno-error=date-time -MODULE_NAME = rtl8852ce -endif - ifeq ($(CONFIG_I386_BUILD_VERIFY), y) EXTRA_CFLAGS += -DCONFIG_I386_BUILD_VERIFY endif ifeq ($(CONFIG_RTW_MBO), y) -EXTRA_CFLAGS += -DCONFIG_RTW_MBO -DCONFIG_RTW_WNM -DCONFIG_RTW_BTM_ROAM +EXTRA_CFLAGS += -DCONFIG_RTW_MBO -DCONFIG_RTW_WNM -DCONFIG_RTW_BTM_ROAM -DCONFIG_RTW_ROAM_STOP_NETIF_QUEUE #EXTRA_CFLAGS += -DCONFIG_RTW_80211K EXTRA_CFLAGS += -DCONFIG_RTW_80211R EXTRA_CFLAGS += -DRTW_FT_DBG=0 -DRTW_WNM_DBG=0 -DRTW_MBO_DBG=0 @@ -787,18 +784,8 @@ endif include $(wildcard $(DRV_PATH)/platform/*.mk) # Import platform specific compile options -EXTRA_CFLAGS += -I$(SOURCETREE)/platform +EXTRA_CFLAGS += -I$(src)/platform #_PLATFORM_FILES := platform/platform_ops.o -ifeq ($(CONFIG_PCI_HCI), y) -EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS -_PLATFORM_FILES := platform/platform_linux_pc_pci.o -OBJS += $(_PLATFORM_FILES) -# Core Config -CONFIG_MSG_NUM = 128 -EXTRA_CFLAGS += -DCONFIG_MSG_NUM=$(CONFIG_MSG_NUM) -#EXTRA_CFLAGS += -DCONFIG_TX_SKB_ORPHAN -endif -_PLATFORM_FILES += platform/platform_ops.o OBJS += $(_PLATFORM_FILES) ########### CUSTOMER ################################ @@ -818,7 +805,7 @@ endif ifneq ($(KERNELRELEASE),) ########### COMMON ################################# -include $(SOURCETREE)/common.mk +include $(src)/common.mk EXTRA_CFLAGS += -DPHL_PLATFORM_LINUX EXTRA_CFLAGS += -DCONFIG_PHL_ARCH @@ -839,10 +826,11 @@ ifeq ($(DIRTY_FOR_WORK), y) EXTRA_CFLAGS += -DDIRTY_FOR_WORK endif -include $(SOURCETREE)/phl/phl.mk +include $(src)/phl/phl.mk -obj-m := $(MODULE_NAME).o +obj-$(CONFIG_RTL8852CE) := $(MODULE_NAME).o +obj-$(CONFIG_RTL8852CE) := $(MODULE_NAME).o $(MODULE_NAME)-y = $(OBJS) ############# MEMORY MANAGMENT ############# diff --git a/drivers/net/wireless/realtek/rtl8852ce/common.mk b/drivers/net/wireless/realtek/rtl8852ce/common.mk index f6eb419e..b5cf5649 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/common.mk +++ b/drivers/net/wireless/realtek/rtl8852ce/common.mk @@ -99,7 +99,7 @@ _CORE_FILES := core/rtw_fsm.o \ _CORE_FILES += core/rtw_phl.o \ core/rtw_phl_cmd.o -EXTRA_CFLAGS += -I$(SOURCETREE)/core/crypto +EXTRA_CFLAGS += -I$(src)/core/crypto _CORE_FILES += core/crypto/aes-internal.o \ core/crypto/aes-internal-enc.o \ core/crypto/aes-gcm.o \ diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/def_module_country_chplan.h b/drivers/net/wireless/realtek/rtl8852ce/core/def_module_country_chplan.h deleted file mode 100644 index b993d9e4..00000000 --- a/drivers/net/wireless/realtek/rtl8852ce/core/def_module_country_chplan.h +++ /dev/null @@ -1,1519 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2022 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_MODULE_RTL8821AE_HMC_M2 BIT0 /* RTL8821AE(HMC + M.2) */ -#define RTW_MODULE_RTL8821AU BIT1 /* RTL8821AU */ -#define RTW_MODULE_RTL8812AENF_NGFF BIT2 /* RTL8812AENF(8812AE+8761)_NGFF */ -#define RTW_MODULE_RTL8812AEBT_HMC BIT3 /* RTL8812AEBT(8812AE+8761)_HMC */ -#define RTW_MODULE_RTL8188EE_HMC_M2 BIT4 /* RTL8188EE(HMC + M.2) */ -#define RTW_MODULE_RTL8723BE_HMC_M2 BIT5 /* RTL8723BE(HMC + M.2) */ -#define RTW_MODULE_RTL8723BS_NGFF1216 BIT6 /* RTL8723BS(NGFF1216) */ -#define RTW_MODULE_RTL8192EEBT_HMC_M2 BIT7 /* RTL8192EEBT(8192EE+8761AU)_(HMC + M.2) */ -#define RTW_MODULE_RTL8723DE_NGFF1630 BIT8 /* RTL8723DE(NGFF1630) */ -#define RTW_MODULE_RTL8822BE BIT9 /* RTL8822BE */ -#define RTW_MODULE_RTL8821CE BIT10 /* RTL8821CE */ -#define RTW_MODULE_RTL8822CE BIT11 /* RTL8822CE */ - -#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8821AE_HMC_M2) /* 2013 certify */ -static const struct country_chplan RTL8821AE_HMC_M2_country_chplan_map[] = { - COUNTRY_CHPLAN_ENT("AE", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AN", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AR", 0x61, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AU", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BH", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BO", 0x73, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BR", 0x62, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BW", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CA", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CI", 0x42, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CL", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CN", 0x51, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CO", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CR", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DO", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DZ", 0x00, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EC", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EG", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ES", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GT", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HK", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HN", 0x32, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ID", 0x3D, 0x00, DEF , 0, 0, 1), - COUNTRY_CHPLAN_ENT("IE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IL", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IN", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JM", 0x32, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JO", 0x49, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JP", 0x27, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KE", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KR", 0x28, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LV", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MA", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MC", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ME", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MX", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MY", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NG", 0x75, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NI", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NZ", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("OM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PA", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PE", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PH", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PK", 0x51, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PR", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PY", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("QA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RU", 0x59, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SN", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SV", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TH", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TN", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TT", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TW", 0x39, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UA", 0x36, 0x00, DEF , 0, 0, 1), - COUNTRY_CHPLAN_ENT("UG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("US", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UY", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VE", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VN", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZW", 0x26, 0x00, DEF , 0, 1, 1), -}; -#endif - -#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8821AU) /* 2014 certify */ -static const struct country_chplan RTL8821AU_country_chplan_map[] = { - COUNTRY_CHPLAN_ENT("AE", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AR", 0x61, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AU", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CA", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CN", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ES", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HK", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ID", 0x3D, 0x00, DEF , 0, 0, 1), - COUNTRY_CHPLAN_ENT("IE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JO", 0x49, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JP", 0x27, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KR", 0x28, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LV", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MC", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NZ", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RU", 0x59, 0x00, DEF , 0, 0, 1), - COUNTRY_CHPLAN_ENT("SA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TW", 0x39, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UA", 0x36, 0x00, DEF , 0, 0, 1), - COUNTRY_CHPLAN_ENT("US", 0x34, 0x00, DEF , 0, 1, 1), -}; -#endif - -#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8812AENF_NGFF) /* 2014 certify */ -static const struct country_chplan RTL8812AENF_NGFF_country_chplan_map[] = { - COUNTRY_CHPLAN_ENT("JP", 0x27, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TW", 0x39, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("US", 0x34, 0x00, DEF , 0, 1, 1), -}; -#endif - -#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8812AEBT_HMC) /* 2013 certify */ -static const struct country_chplan RTL8812AEBT_HMC_country_chplan_map[] = { - COUNTRY_CHPLAN_ENT("AE", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AU", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CA", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CN", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ES", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HK", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JO", 0x49, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JP", 0x27, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KE", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KR", 0x28, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LV", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MC", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NG", 0x75, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NZ", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("OM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("QA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RU", 0x59, 0x00, DEF , 0, 0, 1), - COUNTRY_CHPLAN_ENT("SA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TW", 0x39, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UA", 0x36, 0x00, DEF , 0, 0, 1), - COUNTRY_CHPLAN_ENT("US", 0x34, 0x00, DEF , 0, 1, 1), -}; -#endif - -#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8188EE_HMC_M2) /* 2012 certify */ -static const struct country_chplan RTL8188EE_HMC_M2_country_chplan_map[] = { - COUNTRY_CHPLAN_ENT("AE", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AN", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AR", 0x61, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AU", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AW", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BB", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BF", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BH", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BJ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BN", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BO", 0x73, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BR", 0x62, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BW", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CA", 0x20, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CF", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CI", 0x42, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CL", 0x2D, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CN", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CO", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CR", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CV", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DO", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DZ", 0x00, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EC", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EG", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ES", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ET", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GD", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GN", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GQ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GT", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HK", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HN", 0x32, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HT", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ID", 0x5D, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IL", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IN", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JM", 0x32, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JO", 0x49, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JP", 0x27, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KE", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KR", 0x28, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LV", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MA", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MC", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ME", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ML", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MX", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MY", 0x63, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NG", 0x75, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NI", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NP", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NZ", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("OM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PA", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PE", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PH", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PK", 0x51, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PR", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PY", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("QA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RU", 0x59, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SC", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SN", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SV", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TH", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TN", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TT", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TW", 0x39, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("US", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UY", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UZ", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VC", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VE", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VN", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZW", 0x26, 0x00, DEF , 0, 1, 1), -}; -#endif - -#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8723BE_HMC_M2) /* 2013 certify */ -static const struct country_chplan RTL8723BE_HMC_M2_country_chplan_map[] = { - COUNTRY_CHPLAN_ENT("AE", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AN", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AO", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AR", 0x61, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AU", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AW", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BF", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BH", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BJ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BO", 0x73, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BR", 0x62, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BS", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BW", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CA", 0x20, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CF", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CI", 0x42, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CL", 0x2D, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CN", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CO", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CR", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CV", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DO", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DZ", 0x00, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EC", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EG", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ES", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ET", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GD", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GQ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GT", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HK", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HN", 0x32, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ID", 0x5D, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IL", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IN", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JM", 0x32, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JO", 0x49, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JP", 0x27, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KE", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KR", 0x28, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LV", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MA", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MC", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ME", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ML", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MX", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MY", 0x63, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NG", 0x75, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NI", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NP", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NZ", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("OM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PA", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PE", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PH", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PK", 0x51, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PR", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PY", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("QA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RU", 0x59, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SN", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SV", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TH", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TN", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TT", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TW", 0x39, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("US", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UY", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UZ", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VE", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VN", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZW", 0x26, 0x00, DEF , 0, 1, 1), -}; -#endif - -#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8723BS_NGFF1216) /* 2014 certify */ -static const struct country_chplan RTL8723BS_NGFF1216_country_chplan_map[] = { - COUNTRY_CHPLAN_ENT("AE", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AN", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AO", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AR", 0x61, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AU", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BB", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BH", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BO", 0x73, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BR", 0x62, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BW", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CA", 0x20, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CI", 0x42, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CL", 0x2D, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CN", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CO", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CR", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DO", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DZ", 0x00, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EC", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EG", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ES", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GT", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HK", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HN", 0x32, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HT", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ID", 0x5D, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IL", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IN", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JM", 0x32, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JO", 0x49, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JP", 0x27, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KE", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KR", 0x28, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LV", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MA", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MC", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ME", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MQ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MX", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MY", 0x63, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NG", 0x75, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NI", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NP", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NZ", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("OM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PA", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PE", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PH", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PK", 0x51, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PR", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PY", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("QA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RU", 0x59, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SN", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SV", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TH", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TJ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TN", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TT", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TW", 0x39, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("US", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UY", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UZ", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VE", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VN", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("YE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZW", 0x26, 0x00, DEF , 0, 1, 1), -}; -#endif - -#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8192EEBT_HMC_M2) /* 2013 certify */ -static const struct country_chplan RTL8192EEBT_HMC_M2_country_chplan_map[] = { - COUNTRY_CHPLAN_ENT("AE", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AN", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AO", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AR", 0x61, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AU", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AW", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BF", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BH", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BJ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BO", 0x73, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BR", 0x62, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BW", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CA", 0x20, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CF", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CI", 0x42, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CL", 0x2D, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CN", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CO", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CR", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CV", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DJ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DO", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DZ", 0x00, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EC", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EG", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EH", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ES", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ET", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GD", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GF", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GQ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GT", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HK", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HN", 0x32, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ID", 0x5D, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IL", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IN", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JM", 0x32, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JO", 0x49, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JP", 0x27, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KE", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KR", 0x28, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LV", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MA", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MC", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ME", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ML", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MX", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MY", 0x63, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NG", 0x75, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NI", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NP", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NZ", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("OM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PA", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PE", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PH", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PK", 0x51, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PR", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PY", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("QA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RU", 0x59, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SC", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SN", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ST", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SV", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TF", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TH", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TN", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TT", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TW", 0x39, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("US", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UY", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UZ", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VE", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VN", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("YT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZW", 0x26, 0x00, DEF , 0, 1, 1), -}; -#endif - -#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8723DE_NGFF1630) /* 2016 certify */ -static const struct country_chplan RTL8723DE_NGFF1630_country_chplan_map[] = { - COUNTRY_CHPLAN_ENT("AE", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AN", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AR", 0x61, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AU", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BH", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BO", 0x73, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BR", 0x62, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CA", 0x2A, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CI", 0x42, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CL", 0x2D, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CN", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CO", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CR", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DO", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DZ", 0x00, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EC", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EG", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ES", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GT", 0x61, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HK", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HN", 0x32, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ID", 0x5D, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IL", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IN", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JM", 0x32, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JO", 0x49, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JP", 0x27, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KE", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KR", 0x28, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LV", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MA", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MC", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ME", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MX", 0x34, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MY", 0x63, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NG", 0x75, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NI", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NZ", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("OM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PA", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PE", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PH", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PK", 0x51, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PR", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PY", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("QA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RU", 0x59, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SN", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SV", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TH", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TN", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TT", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TW", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("US", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UY", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VE", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VN", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZW", 0x26, 0x00, DEF , 0, 1, 1), -}; -#endif - -#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8822BE) /* 2016 certify */ -static const struct country_chplan RTL8822BE_country_chplan_map[] = { - COUNTRY_CHPLAN_ENT("AE", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AN", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AO", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AR", 0x61, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AU", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BB", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BF", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BH", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BJ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BM", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BN", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BO", 0x73, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BR", 0x62, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BS", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BW", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CA", 0x2B, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CF", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CI", 0x42, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CL", 0x2D, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CN", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CO", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CR", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CV", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DJ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DO", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DZ", 0x00, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EC", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EG", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EH", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ES", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FJ", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GN", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GP", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GQ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GT", 0x61, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GU", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HK", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HN", 0x32, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HT", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ID", 0x3D, 0x00, DEF , 0, 0, 1), - COUNTRY_CHPLAN_ENT("IE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IL", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IN", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JM", 0x32, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JO", 0x49, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JP", 0x27, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KE", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KR", 0x28, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LV", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MA", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MC", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ME", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ML", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MO", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MQ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MX", 0x4D, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MY", 0x63, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NG", 0x75, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NI", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NP", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NZ", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("OM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PA", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PE", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PH", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PK", 0x51, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PR", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PY", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("QA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RU", 0x59, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SC", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SN", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ST", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SV", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TF", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TH", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TJ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TN", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TT", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TW", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UA", 0x35, 0x00, UKRAINE, 0, 1, 1), - COUNTRY_CHPLAN_ENT("UG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("US", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UY", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UZ", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VE", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VN", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("YT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZW", 0x26, 0x00, DEF , 0, 1, 1), -}; -#endif - -#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8821CE) /* 2016 certify */ -static const struct country_chplan RTL8821CE_country_chplan_map[] = { - COUNTRY_CHPLAN_ENT("AE", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AN", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AO", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AR", 0x61, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AU", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BB", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BF", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BH", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BJ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BM", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BN", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BO", 0x73, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BR", 0x62, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BS", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BW", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CA", 0x2B, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CF", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CI", 0x42, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CL", 0x2D, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CN", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CO", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CR", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CV", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DJ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DO", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DZ", 0x00, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EC", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EG", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EH", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ES", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ET", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FJ", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GN", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GP", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GQ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GT", 0x61, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GU", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HK", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HN", 0x32, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HT", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ID", 0x3D, 0x00, DEF , 0, 0, 1), - COUNTRY_CHPLAN_ENT("IE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IL", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IN", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JM", 0x32, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JO", 0x49, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JP", 0x27, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KE", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KR", 0x28, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LV", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MA", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MC", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ME", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ML", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MO", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MQ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MX", 0x4D, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MY", 0x63, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NG", 0x75, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NI", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NP", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NZ", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("OM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PA", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PE", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PH", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PK", 0x51, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PR", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PY", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("QA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RU", 0x59, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SC", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SN", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ST", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SV", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TF", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TH", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TJ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TN", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TW", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UA", 0x35, 0x00, UKRAINE, 0, 1, 1), - COUNTRY_CHPLAN_ENT("UG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("US", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UY", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UZ", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VE", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VN", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("YT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZW", 0x26, 0x00, DEF , 0, 1, 1), -}; -#endif - -#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8822CE) /* 2018 certify */ -static const struct country_chplan RTL8822CE_country_chplan_map[] = { - COUNTRY_CHPLAN_ENT("AE", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AN", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AO", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AR", 0x61, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AU", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AW", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("AZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BB", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BF", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BH", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BJ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BM", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BN", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BO", 0x73, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BR", 0x62, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BS", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BW", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("BY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CA", 0x2B, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CF", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CI", 0x42, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CL", 0x2D, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CN", 0x48, 0x00, CN , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CO", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CR", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CV", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CY", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("CZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DJ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DO", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("DZ", 0x00, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EC", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EG", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("EH", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ES", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ET", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FJ", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("FR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GN", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GP", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GQ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GT", 0x61, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GU", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("GW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HK", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HN", 0x32, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HT", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("HU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IL", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IN", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("IT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JM", 0x32, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JO", 0x49, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("JP", 0x27, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KE", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KH", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KR", 0x4B, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("KZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LB", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("LV", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MA", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MC", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ME", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ML", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MO", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MQ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MU", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MW", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MX", 0x4D, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MY", 0x63, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("MZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NA", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NG", 0x75, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NI", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NP", 0x48, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("NZ", 0x45, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("OM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PA", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PE", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PH", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PK", 0x51, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PR", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("PY", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("QA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RO", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RS", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("RU", 0x59, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SC", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SE", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SG", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SI", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SK", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SL", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SN", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ST", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SV", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("SZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TD", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TF", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TH", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TJ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TN", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TR", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TW", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("TZ", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UA", 0x35, 0x00, UKRAINE, 0, 1, 1), - COUNTRY_CHPLAN_ENT("UG", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("US", 0x76, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UY", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("UZ", 0x47, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VE", 0x30, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("VN", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("YT", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZA", 0x35, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZM", 0x26, 0x00, DEF , 0, 1, 1), - COUNTRY_CHPLAN_ENT("ZW", 0x26, 0x00, DEF , 0, 1, 1), -}; -#endif - -/** - * rtw_def_module_country_chplan_map - - * @hal_map: returned map - * @return: size of map - */ -static u16 rtw_def_module_country_chplan_map(const struct country_chplan **hal_map) -{ - u16 hal_map_sz = 0; - - /* TODO: runtime selection for multi driver */ -#if (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8821AE_HMC_M2) - *hal_map = RTL8821AE_HMC_M2_country_chplan_map; - hal_map_sz = sizeof(RTL8821AE_HMC_M2_country_chplan_map) / sizeof(struct country_chplan); -#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8821AU) - *hal_map = RTL8821AU_country_chplan_map; - hal_map_sz = sizeof(RTL8821AU_country_chplan_map) / sizeof(struct country_chplan); -#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8812AENF_NGFF) - *hal_map = RTL8812AENF_NGFF_country_chplan_map; - hal_map_sz = sizeof(RTL8812AENF_NGFF_country_chplan_map) / sizeof(struct country_chplan); -#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8812AEBT_HMC) - *hal_map = RTL8812AEBT_HMC_country_chplan_map; - hal_map_sz = sizeof(RTL8812AEBT_HMC_country_chplan_map) / sizeof(struct country_chplan); -#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8188EE_HMC_M2) - *hal_map = RTL8188EE_HMC_M2_country_chplan_map; - hal_map_sz = sizeof(RTL8188EE_HMC_M2_country_chplan_map) / sizeof(struct country_chplan); -#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8723BE_HMC_M2) - *hal_map = RTL8723BE_HMC_M2_country_chplan_map; - hal_map_sz = sizeof(RTL8723BE_HMC_M2_country_chplan_map) / sizeof(struct country_chplan); -#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8723BS_NGFF1216) - *hal_map = RTL8723BS_NGFF1216_country_chplan_map; - hal_map_sz = sizeof(RTL8723BS_NGFF1216_country_chplan_map) / sizeof(struct country_chplan); -#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8192EEBT_HMC_M2) - *hal_map = RTL8192EEBT_HMC_M2_country_chplan_map; - hal_map_sz = sizeof(RTL8192EEBT_HMC_M2_country_chplan_map) / sizeof(struct country_chplan); -#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8723DE_NGFF1630) - *hal_map = RTL8723DE_NGFF1630_country_chplan_map; - hal_map_sz = sizeof(RTL8723DE_NGFF1630_country_chplan_map) / sizeof(struct country_chplan); -#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8822BE) - *hal_map = RTL8822BE_country_chplan_map; - hal_map_sz = sizeof(RTL8822BE_country_chplan_map) / sizeof(struct country_chplan); -#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8821CE) - *hal_map = RTL8821CE_country_chplan_map; - hal_map_sz = sizeof(RTL8821CE_country_chplan_map) / sizeof(struct country_chplan); -#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8822CE) - *hal_map = RTL8822CE_country_chplan_map; - hal_map_sz = sizeof(RTL8822CE_country_chplan_map) / sizeof(struct country_chplan); -#endif - - return hal_map_sz; -} diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/mesh/rtw_mesh.c b/drivers/net/wireless/realtek/rtl8852ce/core/mesh/rtw_mesh.c index e8243bca..c213adb8 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/mesh/rtw_mesh.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/mesh/rtw_mesh.c @@ -212,7 +212,7 @@ int rtw_bss_is_candidate_mesh_peer(_adapter *adapter, WLAN_BSSID_EX *target, u8 if (!ch) { /* off-channel, check target with our hardcode capability */ - if (target->Configuration.DSConfig > 14) + if (BSS_EX_OP_BAND(target) != BAND_ON_24G) match = rtw_is_basic_rate_ofdm(target->SupportedRates[i]); else match = rtw_is_basic_rate_mix(target->SupportedRates[i]); diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb.h b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb.h new file mode 100644 index 00000000..dad4bf2b --- /dev/null +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb.h @@ -0,0 +1,117 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2024 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 __RTW_REGDB_H__ +#define __RTW_REGDB_H__ + +#define CHPLAN_VER_STR_BUF_LEN 64 + +struct rtw_regdb_ops { + bool (*init)(void); + void (*deinit)(void); + + u8 (*get_default_regd_2g)(u8 id); +#if CONFIG_IEEE80211_BAND_5GHZ + u8 (*get_default_regd_5g)(u8 id); +#endif + bool (*is_domain_code_valid)(u8 id); + bool (*domain_get_ch)(u8 id, u32 ch, u8 *flags); +#if CONFIG_IEEE80211_BAND_6GHZ + u8 (*get_default_regd_6g)(u8 id); + bool (*is_domain_code_6g_valid)(u8 id); + bool (*domain_6g_get_ch)(u8 id, u32 ch, u8 *flags); +#endif + + bool (*get_chplan_from_alpha2)(const char *alpha2, struct country_chplan *ent); + +#ifdef CONFIG_RTW_CHPLAN_DEV + void (*dump_chplan_test)(void *sel); +#endif + void (*get_ver_str)(char *buf, size_t buf_len); +}; + +extern const struct rtw_regdb_ops regdb_ops; + +#if CONFIG_IEEE80211_BAND_5GHZ +#define __REGDB_OPS_ASSIGN_5GHZ(_get_default_regd_5g) \ + .get_default_regd_5g = _get_default_regd_5g, + +#define __REGDB_OPS_5GHZ_ASSERT \ + regdb_ops.get_default_regd_5g +#else +#define __REGDB_OPS_ASSIGN_5GHZ(_get_default_regd_5g) +#define __REGDB_OPS_5GHZ_ASSERT 1 +#endif + +#if CONFIG_IEEE80211_BAND_6GHZ +#define __REGDB_OPS_ASSIGN_6GHZ(_get_default_regd_6g, _is_domain_code_6g_valid, _domain_6g_get_ch) \ + .get_default_regd_6g = _get_default_regd_6g, \ + .is_domain_code_6g_valid = _is_domain_code_6g_valid, \ + .domain_6g_get_ch = _domain_6g_get_ch, + +#define __REGDB_OPS_6GHZ_ASSERT \ + (regdb_ops.get_default_regd_6g && \ + regdb_ops.is_domain_code_6g_valid && \ + regdb_ops.domain_6g_get_ch) +#else +#define __REGDB_OPS_ASSIGN_6GHZ(_get_default_regd_6g, _is_domain_code_6g_valid, _domain_6g_get_ch) +#define __REGDB_OPS_6GHZ_ASSERT 1 +#endif + +#ifdef CONFIG_RTW_CHPLAN_DEV +#define __REGDB_OPS_ASSIGN_TEST(_dump_chplan_test) \ + .dump_chplan_test = _dump_chplan_test, +#else +#define __REGDB_OPS_ASSIGN_TEST(_dump_chplan_test) +#endif + +#define DECL_REGDB_OPS( \ + _init, \ + _deinit, \ + _get_default_regd_2g, \ + _get_default_regd_5g, \ + _is_domain_code_valid, \ + _domain_get_ch, \ + _get_default_regd_6g, \ + _is_domain_code_6g_valid, \ + _domain_6g_get_ch, \ + _get_chplan_from_alpha2, \ + _dump_chplan_test, \ + _get_ver_str) \ +const struct rtw_regdb_ops regdb_ops = { \ + .init = _init, \ + .deinit = _deinit, \ + .get_default_regd_2g = _get_default_regd_2g, \ + __REGDB_OPS_ASSIGN_5GHZ(_get_default_regd_5g) \ + .is_domain_code_valid = _is_domain_code_valid, \ + .domain_get_ch = _domain_get_ch, \ + __REGDB_OPS_ASSIGN_6GHZ(_get_default_regd_6g, _is_domain_code_6g_valid, _domain_6g_get_ch) \ + __REGDB_OPS_ASSIGN_TEST(_dump_chplan_test) \ + .get_chplan_from_alpha2 = _get_chplan_from_alpha2, \ + .get_ver_str = _get_ver_str, \ +}; \ +void assert_regdb_ops(void); \ +void assert_regdb_ops(void) \ +{ \ + BUILD_BUG_ON(!regdb_ops.get_default_regd_2g); \ + BUILD_BUG_ON(!__REGDB_OPS_5GHZ_ASSERT); \ + BUILD_BUG_ON(!regdb_ops.is_domain_code_valid);\ + BUILD_BUG_ON(!regdb_ops.domain_get_ch); \ + BUILD_BUG_ON(!__REGDB_OPS_6GHZ_ASSERT); \ + BUILD_BUG_ON(!regdb_ops.get_chplan_from_alpha2); \ + BUILD_BUG_ON(!regdb_ops.get_ver_str); \ +} + +#endif /* __RTW_REGDB_H__ */ diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_phl_wrapper.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_phl_wrapper.c index c2056c59..21d9f3ec 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_phl_wrapper.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_phl_wrapper.c @@ -15,6 +15,7 @@ #define _RTW_REGDB_PHL_C_ #include +#include "rtw_regdb.h" static enum rtw_regd phl_regulation_to_regd(enum REGULATION reg) { @@ -180,22 +181,18 @@ static void phl_regdb_get_ver_str(char *buf, size_t buf_len) snprintf(buf, buf_len, "%d-%d", rtw_phl_get_regu_chplan_ver(), rtw_phl_get_regu_country_ver()); } -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = phl_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = phl_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = phl_regdb_is_domain_code_valid, - .domain_get_ch = phl_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = phl_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = phl_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = phl_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = phl_regdb_get_chplan_from_alpha2, - - .get_ver_str = phl_regdb_get_ver_str, -}; +DECL_REGDB_OPS( + NULL, /* _init */ + NULL, /* _deinit */ + phl_regdb_get_default_regd_2g, /* _get_default_regd_2g */ + phl_regdb_get_default_regd_5g, /* _get_default_regd_5g */ + phl_regdb_is_domain_code_valid, /* _is_domain_code_valid */ + phl_regdb_domain_get_ch, /* _domain_get_ch */ + phl_regdb_get_default_regd_6g, /* _get_default_regd_6g */ + phl_regdb_is_domain_code_6g_valid, /* _is_domain_code_6g_valid */ + phl_regdb_domain_6g_get_ch, /* _domain_6g_get_ch */ + phl_regdb_get_chplan_from_alpha2, /* _get_chplan_from_alpha2 */ + NULL, /* _dump_chplan_test */ + phl_regdb_get_ver_str /* _get_ver_str */ +) diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_58-31.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_58-31.c index 1165cf75..7550b4c0 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_58-31.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_58-31.c @@ -15,48 +15,14 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" +#define RTW_MODULE_NAME "" #define RTW_DOMAIN_MAP_VER "58" #define RTW_DOMAIN_MAP_M_VER "" #define RTW_COUNTRY_MAP_VER "31" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -134,94 +100,77 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -333,92 +282,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 36), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -434,25 +297,16 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -461,56 +315,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x04] = CHPLAN_6G_ENT(FCC , 04), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -755,154 +559,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s-%s%s", RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_59-32.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_59-32.c index 33f7dbb9..a75dc344 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_59-32.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_59-32.c @@ -15,48 +15,14 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" +#define RTW_MODULE_NAME "" #define RTW_DOMAIN_MAP_VER "59" #define RTW_DOMAIN_MAP_M_VER "" #define RTW_COUNTRY_MAP_VER "32" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -134,94 +100,77 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -335,92 +284,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 36), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -437,26 +300,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -470,56 +324,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x09] = CHPLAN_6G_ENT(KCC , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -764,154 +568,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s-%s%s", RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_60-32.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_60-32.c index dc9d40d0..7520994b 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_60-32.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_60-32.c @@ -15,48 +15,14 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" +#define RTW_MODULE_NAME "" #define RTW_DOMAIN_MAP_VER "60" #define RTW_DOMAIN_MAP_M_VER "" #define RTW_COUNTRY_MAP_VER "32" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -135,95 +101,78 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -338,92 +287,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 36), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -440,26 +303,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -473,56 +327,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x09] = CHPLAN_6G_ENT(KCC , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -767,154 +571,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s-%s%s", RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_60-34.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_60-34.c index 70bb2658..0a0cd869 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_60-34.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_60-34.c @@ -15,48 +15,14 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" +#define RTW_MODULE_NAME "" #define RTW_DOMAIN_MAP_VER "60" #define RTW_DOMAIN_MAP_M_VER "" #define RTW_COUNTRY_MAP_VER "34" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -135,95 +101,78 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -338,92 +287,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 36), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -440,26 +303,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -473,56 +327,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x09] = CHPLAN_6G_ENT(KCC , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -767,154 +571,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s-%s%s", RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_61-34.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_61-34.c index 18e21fac..44a58c21 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_61-34.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_61-34.c @@ -15,48 +15,14 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" +#define RTW_MODULE_NAME "" #define RTW_DOMAIN_MAP_VER "61" #define RTW_DOMAIN_MAP_M_VER "" #define RTW_COUNTRY_MAP_VER "34" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -136,96 +102,79 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_55 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), + /* RTW_CHD_5G_55 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -341,92 +290,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 55), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -443,26 +306,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -476,56 +330,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x09] = CHPLAN_6G_ENT(KCC , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -770,154 +574,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s-%s%s", RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_62-35.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_62-35.c index 02bf9ce4..30e8d856 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_62-35.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_62-35.c @@ -15,48 +15,14 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" +#define RTW_MODULE_NAME "" #define RTW_DOMAIN_MAP_VER "62" #define RTW_DOMAIN_MAP_M_VER "" #define RTW_COUNTRY_MAP_VER "35" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -136,96 +102,79 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_55 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), + /* RTW_CHD_5G_55 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -341,92 +290,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 55), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -443,26 +306,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -477,56 +331,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x1B] = CHPLAN_6G_ENT(ACMA , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -771,154 +575,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s-%s%s", RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-36.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-36.c index 69eb60ff..ca12bdf7 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-36.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-36.c @@ -15,48 +15,14 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" +#define RTW_MODULE_NAME "" #define RTW_DOMAIN_MAP_VER "63" #define RTW_DOMAIN_MAP_M_VER "" #define RTW_COUNTRY_MAP_VER "36" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -136,96 +102,79 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_55 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), + /* RTW_CHD_5G_55 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -341,92 +290,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 55), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -443,26 +306,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -478,56 +332,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x1C] = CHPLAN_6G_ENT(MKK , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -772,154 +576,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s-%s%s", RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-37.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-37.c index 3c639385..dad085ed 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-37.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-37.c @@ -15,48 +15,14 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" +#define RTW_MODULE_NAME "" #define RTW_DOMAIN_MAP_VER "63" #define RTW_DOMAIN_MAP_M_VER "" #define RTW_COUNTRY_MAP_VER "37" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -136,96 +102,79 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_55 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), + /* RTW_CHD_5G_55 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -341,92 +290,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 55), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -443,26 +306,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -478,56 +332,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x1C] = CHPLAN_6G_ENT(MKK , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -772,154 +576,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s-%s%s", RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-38.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-38.c index 412dfbb8..bb95e7ea 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-38.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-38.c @@ -15,48 +15,14 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" +#define RTW_MODULE_NAME "" #define RTW_DOMAIN_MAP_VER "63" #define RTW_DOMAIN_MAP_M_VER "" #define RTW_COUNTRY_MAP_VER "38" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -136,96 +102,79 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_55 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), + /* RTW_CHD_5G_55 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -341,92 +290,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 55), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -443,26 +306,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -478,56 +332,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x1C] = CHPLAN_6G_ENT(MKK , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -772,154 +576,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s-%s%s", RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-39.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-39.c index 6a53cea9..3f02c0bb 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-39.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-39.c @@ -15,48 +15,14 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" +#define RTW_MODULE_NAME "" #define RTW_DOMAIN_MAP_VER "63" #define RTW_DOMAIN_MAP_M_VER "" #define RTW_COUNTRY_MAP_VER "39" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -136,96 +102,79 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_55 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), + /* RTW_CHD_5G_55 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -341,92 +290,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 55), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -443,26 +306,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -478,56 +332,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x1C] = CHPLAN_6G_ENT(MKK , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -772,154 +576,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s-%s%s", RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-40.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-40.c index 2692c47f..399c0b3e 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-40.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_63-40.c @@ -15,48 +15,14 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" +#define RTW_MODULE_NAME "" #define RTW_DOMAIN_MAP_VER "63" #define RTW_DOMAIN_MAP_M_VER "" #define RTW_COUNTRY_MAP_VER "40" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -136,96 +102,79 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_55 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), + /* RTW_CHD_5G_55 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -341,92 +290,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 55), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -443,26 +306,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -478,56 +332,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x1C] = CHPLAN_6G_ENT(MKK , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -772,154 +576,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s-%s%s", RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_64-40.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_64-40.c index ec505725..a699187c 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_64-40.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_64-40.c @@ -15,48 +15,14 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" +#define RTW_MODULE_NAME "" #define RTW_DOMAIN_MAP_VER "64" #define RTW_DOMAIN_MAP_M_VER "" #define RTW_COUNTRY_MAP_VER "40" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -138,98 +104,81 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_55 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_57 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_58 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), + /* RTW_CHD_5G_55 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_57 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_58 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -347,92 +296,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 55), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -449,26 +312,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -484,56 +338,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x1C] = CHPLAN_6G_ENT(MKK , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -778,154 +582,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s-%s%s", RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_64-41.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_64-41.c index e587eabe..ab5fce7d 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_64-41.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_64-41.c @@ -15,48 +15,14 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" +#define RTW_MODULE_NAME "" #define RTW_DOMAIN_MAP_VER "64" #define RTW_DOMAIN_MAP_M_VER "" #define RTW_COUNTRY_MAP_VER "41" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -138,98 +104,81 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_55 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_57 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_58 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), + /* RTW_CHD_5G_55 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_57 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_58 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -347,92 +296,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 55), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -449,26 +312,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -484,56 +338,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x1C] = CHPLAN_6G_ENT(MKK , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -778,154 +582,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s-%s%s", RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_64-42.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_64-42.c index 0ae7da23..549405b8 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_64-42.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_64-42.c @@ -15,48 +15,14 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" +#define RTW_MODULE_NAME "" #define RTW_DOMAIN_MAP_VER "64" #define RTW_DOMAIN_MAP_M_VER "" #define RTW_COUNTRY_MAP_VER "42" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -138,98 +104,81 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_55 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_57 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_58 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), + /* RTW_CHD_5G_55 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_57 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_58 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -347,92 +296,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 55), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -449,26 +312,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -484,56 +338,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x1C] = CHPLAN_6G_ENT(MKK , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -778,154 +582,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s-%s%s", RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_65-44.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_65-44.c index dc297793..cc78c439 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_65-44.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_65-44.c @@ -15,48 +15,14 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" +#define RTW_MODULE_NAME "" #define RTW_DOMAIN_MAP_VER "65" #define RTW_DOMAIN_MAP_M_VER "" #define RTW_COUNTRY_MAP_VER "44" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -139,99 +105,82 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_55 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_56 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_57 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_58 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), + /* RTW_CHD_5G_55 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_56 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_57 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_58 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -350,92 +299,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 55), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -452,26 +315,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -487,56 +341,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x1C] = CHPLAN_6G_ENT(MKK , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -781,154 +585,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s-%s%s", RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_66-45.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_66-45.c index a19d533a..57241296 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_66-45.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_66-45.c @@ -15,48 +15,14 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" +#define RTW_MODULE_NAME "" #define RTW_DOMAIN_MAP_VER "66" #define RTW_DOMAIN_MAP_M_VER "" #define RTW_COUNTRY_MAP_VER "45" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -140,100 +106,83 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_55 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_56 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_57 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_58 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_59 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), + /* RTW_CHD_5G_55 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_56 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_57 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_58 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_59 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -353,92 +302,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 55), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -455,26 +318,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -490,56 +344,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x1C] = CHPLAN_6G_ENT(MKK , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -784,154 +588,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s-%s%s", RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_67-46.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_67-46.c index ea415f9c..7ea08997 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_67-46.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_67-46.c @@ -15,6 +15,7 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" #define RTW_MODULE_NAME "" #define RTW_DOMAIN_MAP_VER "67" @@ -22,42 +23,6 @@ #define RTW_COUNTRY_MAP_VER "46" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -143,102 +108,85 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_55 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_56 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_57 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_58 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_59 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_60 */ CH_LIST_ENT(26, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_61 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), + /* RTW_CHD_5G_55 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_56 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_57 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_58 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_59 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_60 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_61 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -360,92 +308,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 55), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -462,26 +324,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -497,56 +350,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x1C] = CHPLAN_6G_ENT(MKK , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -791,157 +594,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x06, DEF , 1, 1, 1, 1, _IV), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s" - "%s%s-%s%s" - , RTW_MODULE_NAME, strlen(RTW_MODULE_NAME) ? "-" : "" - , RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_68-47.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_68-47.c index a8c2c006..ab2be74d 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_68-47.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_68-47.c @@ -15,6 +15,7 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" #define RTW_MODULE_NAME "" #define RTW_DOMAIN_MAP_VER "68" @@ -22,42 +23,6 @@ #define RTW_COUNTRY_MAP_VER "47" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -143,102 +108,85 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_55 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_56 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_57 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_58 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_59 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_60 */ CH_LIST_ENT(26, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_61 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), + /* RTW_CHD_5G_55 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_56 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_57 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_58 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_59 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_60 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_61 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -362,92 +310,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 55), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -464,26 +326,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -499,56 +352,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x1C] = CHPLAN_6G_ENT(MKK , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -793,157 +596,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x06, DEF , 1, 1, 1, 1, _IV), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s" - "%s%s-%s%s" - , RTW_MODULE_NAME, strlen(RTW_MODULE_NAME) ? "-" : "" - , RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_8851BE_M.2_2230-67-3.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_8851BE_M.2_2230-67-3.c index d9f82618..c2122547 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_8851BE_M.2_2230-67-3.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_8851BE_M.2_2230-67-3.c @@ -15,6 +15,7 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" #define RTW_MODULE_NAME "8851BE_M.2_2230" #define RTW_DOMAIN_MAP_VER "67" @@ -22,42 +23,6 @@ #define RTW_COUNTRY_MAP_VER "3" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -143,102 +108,85 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_55 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_56 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_57 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_58 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_59 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_60 */ CH_LIST_ENT(26, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_61 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), + /* RTW_CHD_5G_55 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_56 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_57 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_58 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_59 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_60 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_61 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -360,92 +308,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 55), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -462,26 +324,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -497,56 +350,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x1C] = CHPLAN_6G_ENT(MKK , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -791,157 +594,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s" - "%s%s-%s%s" - , RTW_MODULE_NAME, strlen(RTW_MODULE_NAME) ? "-" : "" - , RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_8852BE_M.2_2230-67-48.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_8852BE_M.2_2230-67-48.c index 14066898..ec7b698c 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_8852BE_M.2_2230-67-48.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_8852BE_M.2_2230-67-48.c @@ -15,6 +15,7 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" #define RTW_MODULE_NAME "8852BE_M.2_2230" #define RTW_DOMAIN_MAP_VER "67" @@ -22,42 +23,6 @@ #define RTW_COUNTRY_MAP_VER "48" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -143,102 +108,85 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_55 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_56 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_57 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_58 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_59 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_60 */ CH_LIST_ENT(26, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_61 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), + /* RTW_CHD_5G_55 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_56 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_57 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_58 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_59 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_60 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_61 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -360,92 +308,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 55), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -462,26 +324,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -497,56 +350,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x1C] = CHPLAN_6G_ENT(MKK , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -791,157 +594,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s" - "%s%s-%s%s" - , RTW_MODULE_NAME, strlen(RTW_MODULE_NAME) ? "-" : "" - , RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_8852CE_M.2_2230-67-51.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_8852CE_M.2_2230-67-51.c index e73c0ed1..b322f48f 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_8852CE_M.2_2230-67-51.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_8852CE_M.2_2230-67-51.c @@ -15,6 +15,7 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" #define RTW_MODULE_NAME "8852CE_M.2_2230" #define RTW_DOMAIN_MAP_VER "67" @@ -22,42 +23,6 @@ #define RTW_COUNTRY_MAP_VER "51" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -143,102 +108,85 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_55 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_56 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_57 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_58 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_59 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_60 */ CH_LIST_ENT(26, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_61 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), + /* RTW_CHD_5G_55 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_56 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_57 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_58 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_59 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_60 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_61 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -360,92 +308,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 55), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -462,26 +324,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -497,56 +350,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x1C] = CHPLAN_6G_ENT(MKK , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -791,157 +594,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1, 1, ___), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s" - "%s%s-%s%s" - , RTW_MODULE_NAME, strlen(RTW_MODULE_NAME) ? "-" : "" - , RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_8852CE_M.2_2230-67-52.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_8852CE_M.2_2230-67-52.c index 741c83e8..614a13e3 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_8852CE_M.2_2230-67-52.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_8852CE_M.2_2230-67-52.c @@ -15,6 +15,7 @@ #define _RTW_REGDB_RTK_C_ #include +#include "rtw_regdb_rtk_common.h" #define RTW_MODULE_NAME "8852CE_M.2_2230" #define RTW_DOMAIN_MAP_VER "67" @@ -22,42 +23,6 @@ #define RTW_COUNTRY_MAP_VER "52" #define RTW_COUNTRY_MAP_M_VER "" -#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) -#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) -#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) -#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) - -#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) -#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) -#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) -#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) - -struct ch_list_t { - u8 *len_ch_attr; -}; - -#define CLA_2G_12_14_PASSIVE BIT0 - -#define CLA_5G_B1_PASSIVE BIT0 -#define CLA_5G_B2_PASSIVE BIT1 -#define CLA_5G_B3_PASSIVE BIT2 -#define CLA_5G_B4_PASSIVE BIT3 -#define CLA_5G_B2_DFS BIT4 -#define CLA_5G_B3_DFS BIT5 -#define CLA_5G_B4_DFS BIT6 - -#define CLA_6G_B1_PASSIVE BIT0 -#define CLA_6G_B2_PASSIVE BIT1 -#define CLA_6G_B3_PASSIVE BIT2 -#define CLA_6G_B4_PASSIVE BIT3 - -#define CH_LIST_ENT(_len, arg...) \ - {.len_ch_attr = (u8[_len + 2]) {_len, ##arg}, } - -#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) -#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) -#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) - enum rtw_chd_2g { RTW_CHD_2G_INVALID = 0, @@ -143,102 +108,85 @@ enum rtw_chd_5g { RTW_CHD_5G_NULL = RTW_CHD_5G_00, }; -static const struct ch_list_t rtw_channel_def_2g[] = { - /* RTW_CHD_2G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_2G_01 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), - /* RTW_CHD_2G_02 */ CH_LIST_ENT(13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_03 */ CH_LIST_ENT(11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), - /* RTW_CHD_2G_04 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), - /* RTW_CHD_2G_05 */ CH_LIST_ENT(4, 10, 11, 12, 13, 0), - /* RTW_CHD_2G_06 */ CH_LIST_ENT(14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), +static const CH_LIST_2G_T rtw_channel_def_2g[] = { + /* RTW_CHD_2G_INVALID */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_00 */ CH_LIST_ENT_2G(0), + /* RTW_CHD_2G_01 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, CLA_2G_12_14_PASSIVE), + /* RTW_CHD_2G_02 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0), + /* RTW_CHD_2G_03 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0), + /* RTW_CHD_2G_04 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0), + /* RTW_CHD_2G_05 */ CH_LIST_ENT_2G(10, 11, 12, 13, 0), + /* RTW_CHD_2G_06 */ CH_LIST_ENT_2G(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, CLA_2G_12_14_PASSIVE), }; #if CONFIG_IEEE80211_BAND_5GHZ -static const struct ch_list_t rtw_channel_def_5g[] = { - /* RTW_CHD_5G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_5G_01 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_02 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_03 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_04 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_05 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_06 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_07 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_08 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), - /* RTW_CHD_5G_09 */ CH_LIST_ENT(5, 149, 153, 157, 161, 165, 0), - /* RTW_CHD_5G_10 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), - /* RTW_CHD_5G_11 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_12 */ CH_LIST_ENT(16, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_13 */ CH_LIST_ENT(8, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_14 */ CH_LIST_ENT(4, 36, 40, 44, 48, 0), - /* RTW_CHD_5G_15 */ CH_LIST_ENT(4, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_16 */ CH_LIST_ENT(11, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), - /* RTW_CHD_5G_17 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_18 */ CH_LIST_ENT(17, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_19 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_20 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_21 */ CH_LIST_ENT(11, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_22 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_23 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_24 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_25 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_26 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_27 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_28 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_29 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_30 */ CH_LIST_ENT(9, 36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_31 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_32 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_33 */ CH_LIST_ENT(22, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_34 */ CH_LIST_ENT(13, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), - /* RTW_CHD_5G_35 */ CH_LIST_ENT(8, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), - /* RTW_CHD_5G_36 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_37 */ CH_LIST_ENT(8, 36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_38 */ CH_LIST_ENT(16, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_39 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), - /* RTW_CHD_5G_40 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_41 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_42 */ CH_LIST_ENT(24, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_43 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_44 */ CH_LIST_ENT(21, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_45 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_46 */ CH_LIST_ENT(12, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), - /* RTW_CHD_5G_47 */ CH_LIST_ENT(19, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), - /* RTW_CHD_5G_48 */ CH_LIST_ENT(20, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_49 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_50 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_51 */ CH_LIST_ENT(13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_52 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_53 */ CH_LIST_ENT(17, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_54 */ CH_LIST_ENT(8, 36, 40, 44, 48, 149, 153, 157, 161, 0), - /* RTW_CHD_5G_55 */ CH_LIST_ENT(28, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_56 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_57 */ CH_LIST_ENT(25, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_58 */ CH_LIST_ENT(16, 36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), - /* RTW_CHD_5G_59 */ CH_LIST_ENT(9, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), - /* RTW_CHD_5G_60 */ CH_LIST_ENT(26, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), - /* RTW_CHD_5G_61 */ CH_LIST_ENT(23, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), +static const CH_LIST_5G_T rtw_channel_def_5g[] = { + /* RTW_CHD_5G_INVALID */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_00 */ CH_LIST_ENT_5G(0), + /* RTW_CHD_5G_01 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_02 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_03 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_04 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_05 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_06 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_07 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_08 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_DFS), + /* RTW_CHD_5G_09 */ CH_LIST_ENT_5G(149, 153, 157, 161, 165, 0), + /* RTW_CHD_5G_10 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B2_DFS), + /* RTW_CHD_5G_11 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_12 */ CH_LIST_ENT_5G(56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_13 */ CH_LIST_ENT_5G(56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_14 */ CH_LIST_ENT_5G(36, 40, 44, 48, 0), + /* RTW_CHD_5G_15 */ CH_LIST_ENT_5G(149, 153, 157, 161, 0), + /* RTW_CHD_5G_16 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 0), + /* RTW_CHD_5G_17 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_18 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_19 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_20 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_21 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_22 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_23 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_24 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_25 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_26 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_27 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_28 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_29 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_30 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_31 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_32 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_33 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_34 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B3_DFS), + /* RTW_CHD_5G_35 */ CH_LIST_ENT_5G(100, 104, 108, 112, 116, 132, 136, 140, CLA_5G_B3_DFS), + /* RTW_CHD_5G_36 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_37 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_38 */ CH_LIST_ENT_5G(52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_39 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_DFS), + /* RTW_CHD_5G_40 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_41 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_42 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_43 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_44 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_45 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_46 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, CLA_5G_B2_PASSIVE), + /* RTW_CHD_5G_47 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE), + /* RTW_CHD_5G_48 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_49 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_50 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_51 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_52 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_53 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 149, 153, 157, 161, 165, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_54 */ CH_LIST_ENT_5G(36, 40, 44, 48, 149, 153, 157, 161, 0), + /* RTW_CHD_5G_55 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B2_DFS | CLA_5G_B3_PASSIVE | CLA_5G_B3_DFS | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_56 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_57 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_58 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 132, 136, 140, 149, 153, 157, 161, 165, CLA_5G_B1_PASSIVE | CLA_5G_B2_PASSIVE | CLA_5G_B3_PASSIVE | CLA_5G_B4_PASSIVE), + /* RTW_CHD_5G_59 */ CH_LIST_ENT_5G(52, 56, 60, 64, 149, 153, 157, 161, 165, CLA_5G_B2_DFS), + /* RTW_CHD_5G_60 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), + /* RTW_CHD_5G_61 */ CH_LIST_ENT_5G(36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 149, 153, 157, 161, 165, 169, 173, CLA_5G_B2_DFS | CLA_5G_B3_DFS), }; #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -struct chplan_ent_t { - u8 regd_2g; /* value of enum rtw_regd */ - u8 chd_2g; -#if CONFIG_IEEE80211_BAND_5GHZ - u8 regd_5g; /* value of enum rtw_regd */ - u8 chd_5g; -#endif -}; - -#if CONFIG_IEEE80211_BAND_5GHZ -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} -#else -#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} -#endif - -#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) - static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x00] = CHPLAN_ENT(ETSI , 02, ETSI , 49), [0x01] = CHPLAN_ENT(ETSI , 02, ETSI , 50), @@ -360,92 +308,6 @@ static const struct chplan_ent_t RTW_ChannelPlanMap[] = { [0x7F] = CHPLAN_ENT(WW , 01, WW , 55), }; -static const int RTW_ChannelPlanMap_size = sizeof(RTW_ChannelPlanMap) / sizeof(RTW_ChannelPlanMap[0]); - -static u8 rtk_regdb_get_default_regd_2g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_2g; - return RTW_REGD_NA; -} - -#if CONFIG_IEEE80211_BAND_5GHZ -static u8 rtk_regdb_get_default_regd_5g(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) - return RTW_ChannelPlanMap[id].regd_5g; - return RTW_REGD_NA; -} -#endif - -static bool rtk_regdb_is_domain_code_valid(u8 id) -{ - if (id < RTW_ChannelPlanMap_size) { - const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; - - if (chplan_map->chd_2g != RTW_CHD_2G_INVALID - #if CONFIG_IEEE80211_BAND_5GHZ - && chplan_map->chd_5g != RTW_CHD_5G_INVALID - #endif - ) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - - if (flags) - *flags = 0; - -#if CONFIG_IEEE80211_BAND_5GHZ - if (ch > 14) { - u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_5g[chd_5g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) { - if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) { - if (flags) { - if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - - if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) - || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) - || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) - *flags |= RTW_CHF_DFS; - } - return true; - } - } - } else -#endif /* CONFIG_IEEE80211_BAND_5GHZ */ - { - u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_2g[chd_2g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) { - if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) { - if (flags) { - if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - } - - return false; -} - #if CONFIG_IEEE80211_BAND_6GHZ enum rtw_chd_6g { RTW_CHD_6G_INVALID = 0, @@ -462,26 +324,17 @@ enum rtw_chd_6g { RTW_CHD_6G_NULL = RTW_CHD_6G_00, }; -static const struct ch_list_t rtw_channel_def_6g[] = { - /* RTW_CHD_6G_INVALID */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_00 */ CH_LIST_ENT(0, 0), - /* RTW_CHD_6G_01 */ CH_LIST_ENT(24, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), - /* RTW_CHD_6G_02 */ CH_LIST_ENT(6, 97, 101, 105, 109, 113, 117, 0), - /* RTW_CHD_6G_03 */ CH_LIST_ENT(18, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), - /* RTW_CHD_6G_04 */ CH_LIST_ENT(11, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), - /* RTW_CHD_6G_05 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), - /* RTW_CHD_6G_06 */ CH_LIST_ENT(59, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), +static const CH_LIST_6G_T rtw_channel_def_6g[] = { + /* RTW_CHD_6G_INVALID */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_00 */ CH_LIST_ENT_6G(0), + /* RTW_CHD_6G_01 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 0), + /* RTW_CHD_6G_02 */ CH_LIST_ENT_6G(97, 101, 105, 109, 113, 117, 0), + /* RTW_CHD_6G_03 */ CH_LIST_ENT_6G(121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 0), + /* RTW_CHD_6G_04 */ CH_LIST_ENT_6G(193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), + /* RTW_CHD_6G_05 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, CLA_6G_B1_PASSIVE | CLA_6G_B2_PASSIVE | CLA_6G_B3_PASSIVE | CLA_6G_B4_PASSIVE), + /* RTW_CHD_6G_06 */ CH_LIST_ENT_6G(1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 0), }; -struct chplan_6g_ent_t { - u8 regd; /* value of enum rtw_regd */ - u8 chd; -}; - -#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} - -#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) - static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x00] = CHPLAN_6G_ENT(NA , 00), [0x01] = CHPLAN_6G_ENT(FCC , 01), @@ -497,56 +350,6 @@ static const struct chplan_6g_ent_t rtw_chplan_6g_map[] = { [0x1C] = CHPLAN_6G_ENT(MKK , 01), [0x7F] = CHPLAN_6G_ENT(WW , 05), }; - -static const int rtw_chplan_6g_map_size = sizeof(rtw_chplan_6g_map) / sizeof(rtw_chplan_6g_map[0]); - -static u8 rtk_regdb_get_default_regd_6g(u8 id) -{ - if (id < rtw_chplan_6g_map_size) - return rtw_chplan_6g_map[id].regd; - return RTW_REGD_NA; -} - -static bool rtk_regdb_is_domain_code_6g_valid(u8 id) -{ - if (id < rtw_chplan_6g_map_size) { - const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; - - if (chplan_map->chd != RTW_CHD_6G_INVALID) - return true; - } - - return false; -} - -static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) -{ - u8 index, attrib; - u8 chd_6g; - - if (flags) - *flags = 0; - - chd_6g = rtw_chplan_6g_map[id].chd; - - attrib = CH_LIST_ATTRIB(rtw_channel_def_6g[chd_6g]); - - for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) { - if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) { - if (flags) { - if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ - || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ - || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ - || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ - ) - *flags |= RTW_CHF_NO_IR; - } - return true; - } - } - - return false; -} #endif /* CONFIG_IEEE80211_BAND_6GHZ */ static const struct country_chplan country_chplan_map[] = { @@ -791,157 +594,5 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x5E, 0x00, DEF , 1, 1, 1, 1, ___), /* Zimbabwe */ }; -static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) -{ - const struct country_chplan *map = country_chplan_map; - u16 map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); - int i; - - for (i = 0; i < map_sz; i++) { - if (strncmp(alpha2, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } - return false; -} - -#ifdef CONFIG_RTW_DEBUG -static void rtk_regdb_dump_chplan_test(void *sel) -{ - int i, j; - - /* check 2G CHD redundent */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = RTW_CHD_2G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); - } - } - - /* check 2G CHD invalid channel */ - for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { - if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) - RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); - } - } - -#if CONFIG_IEEE80211_BAND_5GHZ - /* check 5G CHD redundent */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = RTW_CHD_5G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); - } - } - - /* check 5G CHD invalid channel */ - for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { - if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) - RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); - } - } -#endif - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check 6G CHD redundent */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = RTW_CHD_6G_00; j < i; j++) { - if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) - && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) - RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); - } - } - - /* check 6G CHD invalid channel */ - for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { - for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { - if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) - RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); - } - } -#endif - - /* check chplan 2G_5G redundent */ - for (i = 0; i < RTW_ChannelPlanMap_size; i++) { - if (!rtw_is_channel_plan_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_valid(j)) - continue; - if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); - } - } - -#if CONFIG_IEEE80211_BAND_6GHZ - /* check chplan 6G redundent */ - for (i = 0; i < rtw_chplan_6g_map_size; i++) { - if (!rtw_is_channel_plan_6g_valid(i)) - continue; - for (j = 0; j < i; j++) { - if (!rtw_is_channel_plan_6g_valid(j)) - continue; - if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) - RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); - } - } -#endif - - - /* check country invalid chplan/chplan_6g */ -{ - struct country_chplan ent; - u8 code[2]; - - for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { - for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { - if (!rtw_get_chplan_from_country(code, &ent)) - continue; - if (!rtw_is_channel_plan_valid(ent.domain_code)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); - #if CONFIG_IEEE80211_BAND_6GHZ - if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) - RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); - #endif - } - } -} -} -#endif /* CONFIG_RTW_DEBUG */ - -static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) -{ - snprintf(buf, buf_len, "%s%s" - "%s%s-%s%s" - , RTW_MODULE_NAME, strlen(RTW_MODULE_NAME) ? "-" : "" - , RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); -} - -struct rtw_regdb_ops regdb_ops = { - .get_default_regd_2g = rtk_regdb_get_default_regd_2g, -#if CONFIG_IEEE80211_BAND_5GHZ - .get_default_regd_5g = rtk_regdb_get_default_regd_5g, -#endif - .is_domain_code_valid = rtk_regdb_is_domain_code_valid, - .domain_get_ch = rtk_regdb_domain_get_ch, - -#if CONFIG_IEEE80211_BAND_6GHZ - .get_default_regd_6g = rtk_regdb_get_default_regd_6g, - .is_domain_code_6g_valid = rtk_regdb_is_domain_code_6g_valid, - .domain_6g_get_ch = rtk_regdb_domain_6g_get_ch, -#endif - - .get_chplan_from_alpha2 = rtk_regdb_get_chplan_from_alpha2, - -#ifdef CONFIG_RTW_DEBUG - .dump_chplan_test = rtk_regdb_dump_chplan_test, -#endif - .get_ver_str = rtk_regdb_get_ver_str, -}; +#include "rtw_regdb_rtk_common.c" diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_common.c b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_common.c new file mode 100644 index 00000000..c7df6c42 --- /dev/null +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_common.c @@ -0,0 +1,386 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2024 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_REGDB_RTK_COMMON_C_ + +#include "rtw_regdb.h" + +static u8 rtk_regdb_get_default_regd_2g(u8 id) +{ + if (id < ARRAY_SIZE(RTW_ChannelPlanMap)) + return RTW_ChannelPlanMap[id].regd_2g; + return RTW_REGD_NA; +} + +#if CONFIG_IEEE80211_BAND_5GHZ +static u8 rtk_regdb_get_default_regd_5g(u8 id) +{ + if (id < ARRAY_SIZE(RTW_ChannelPlanMap)) + return RTW_ChannelPlanMap[id].regd_5g; + return RTW_REGD_NA; +} +#endif + +static bool rtk_regdb_is_domain_code_valid(u8 id) +{ + if (id < ARRAY_SIZE(RTW_ChannelPlanMap)) { + const struct chplan_ent_t *chplan_map = &RTW_ChannelPlanMap[id]; + + if (chplan_map->chd_2g != RTW_CHD_2G_INVALID + #if CONFIG_IEEE80211_BAND_5GHZ + && chplan_map->chd_5g != RTW_CHD_5G_INVALID + #endif + ) + return true; + } + + return false; +} + +static bool rtk_regdb_domain_get_ch(u8 id, u32 ch, u8 *flags) +{ +#if CONFIG_IEEE80211_BAND_5GHZ + if (ch > 14) { + u8 chd_5g = RTW_ChannelPlanMap[id].chd_5g; + #if !CH_MAP_5G + u8 index; + + for (index = 0; index < CH_LIST_LEN(rtw_channel_def_5g[chd_5g]); index++) + if (CH_LIST_CH(rtw_channel_def_5g[chd_5g], index) == ch) + goto chk_flags_5g; + #else + if (CH_TO_CHM_5G(ch) & rtw_channel_def_5g[chd_5g].ch_map) + goto chk_flags_5g; + #endif + return false; + +chk_flags_5g: + if (flags) { + u8 attrib = CH_LIST_ATTRIB_5G(rtw_channel_def_5g[chd_5g]); + + *flags = 0; + + if ((rtw_is_5g_band1(ch) && (attrib & CLA_5G_B1_PASSIVE)) /* band1 passive */ + || (rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_PASSIVE)) /* band2 passive */ + || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_PASSIVE)) /* band3 passive */ + || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_PASSIVE)) /* band4 passive */ + ) + *flags |= RTW_CHF_NO_IR; + + if ((rtw_is_5g_band2(ch) && (attrib & CLA_5G_B2_DFS)) + || (rtw_is_5g_band3(ch) && (attrib & CLA_5G_B3_DFS)) + || (rtw_is_5g_band4(ch) && (attrib & CLA_5G_B4_DFS))) + *flags |= RTW_CHF_DFS; + } + } else +#endif /* CONFIG_IEEE80211_BAND_5GHZ */ + { + u8 chd_2g = RTW_ChannelPlanMap[id].chd_2g; + #if !CH_MAP_2G + u8 index; + + for (index = 0; index < CH_LIST_LEN(rtw_channel_def_2g[chd_2g]); index++) + if (CH_LIST_CH(rtw_channel_def_2g[chd_2g], index) == ch) + goto chk_flags_2g; + #else + if (CH_TO_CHM_2G(ch) & rtw_channel_def_2g[chd_2g].ch_map) + goto chk_flags_2g; + #endif + return false; + +chk_flags_2g: + if (flags) { + u8 attrib = CH_LIST_ATTRIB_2G(rtw_channel_def_2g[chd_2g]); + + *flags = 0; + + if (ch >= 12 && ch <= 14 && (attrib & CLA_2G_12_14_PASSIVE)) + *flags |= RTW_CHF_NO_IR; + } + } + + return true; +} + +#if CONFIG_IEEE80211_BAND_6GHZ +static u8 rtk_regdb_get_default_regd_6g(u8 id) +{ + if (id < ARRAY_SIZE(rtw_chplan_6g_map)) + return rtw_chplan_6g_map[id].regd; + return RTW_REGD_NA; +} + +static bool rtk_regdb_is_domain_code_6g_valid(u8 id) +{ + if (id < ARRAY_SIZE(rtw_chplan_6g_map)) { + const struct chplan_6g_ent_t *chplan_map = &rtw_chplan_6g_map[id]; + + if (chplan_map->chd != RTW_CHD_6G_INVALID) + return true; + } + + return false; +} + +static bool rtk_regdb_domain_6g_get_ch(u8 id, u32 ch, u8 *flags) +{ + u8 chd_6g = rtw_chplan_6g_map[id].chd; +#if !CH_MAP_6G + u8 index; + + for (index = 0; index < CH_LIST_LEN(rtw_channel_def_6g[chd_6g]); index++) + if (CH_LIST_CH(rtw_channel_def_6g[chd_6g], index) == ch) + goto chk_flags; +#else + if (CH_TO_CHM_6G(ch) & rtw_channel_def_6g[chd_6g].ch_map) + goto chk_flags; +#endif + return false; + +chk_flags: + if (flags) { + u8 attrib = CH_LIST_ATTRIB_6G(rtw_channel_def_6g[chd_6g]); + + *flags = 0; + + if ((rtw_is_6g_band1(ch) && (attrib & CLA_6G_B1_PASSIVE)) /* band1 passive */ + || (rtw_is_6g_band2(ch) && (attrib & CLA_6G_B2_PASSIVE)) /* band2 passive */ + || (rtw_is_6g_band3(ch) && (attrib & CLA_6G_B3_PASSIVE)) /* band3 passive */ + || (rtw_is_6g_band4(ch) && (attrib & CLA_6G_B4_PASSIVE)) /* band4 passive */ + ) + *flags |= RTW_CHF_NO_IR; + } + + return true; +} +#endif /* CONFIG_IEEE80211_BAND_6GHZ */ + +#if CC_2D_OFFSET +static_assert(ARRAY_SIZE(country_chplan_map) <= U8_MAX); +#define CC_2D_NO_FOUND U8_MAX +static u8 cc_2d_offset[26][26]; + +static void build_cc_2d_offset(void) +{ + const struct country_chplan *map = country_chplan_map; + u8 code[2]; + u8 i; + + _rtw_memset(cc_2d_offset, CC_2D_NO_FOUND, sizeof(cc_2d_offset)); + + for (i = 0; i < ARRAY_SIZE(country_chplan_map); i++) { + code[0] = map[i].alpha2[0] - 'A'; + code[1] = map[i].alpha2[1] - 'A'; + if (code[0] >= 26 || code[1] >= 26) { + RTW_WARN("%s \"%c%c\" is not valid alpha2\n" + , __func__, map[i].alpha2[0], map[i].alpha2[1]); + continue; + } + if (cc_2d_offset[code[0]][code[1]] != CC_2D_NO_FOUND) + RTW_WARN("%s \"%c%c\" has redundent entry\n" + , __func__, map[i].alpha2[0], map[i].alpha2[1]); + cc_2d_offset[code[0]][code[1]] = i; + } +} +#endif + +static bool rtk_regdb_get_chplan_from_alpha2(const char *alpha2, struct country_chplan *ent) +{ +#if CC_2D_OFFSET + u8 code[2] = {alpha2[0] - 'A', alpha2[1] - 'A'}; + u8 offset; + + if (code[0] >= 26 || code[1] >= 26) + return false; + + offset = cc_2d_offset[code[0]][code[1]]; + + if (offset == CC_2D_NO_FOUND) + return false; + + if (ent) + _rtw_memcpy(ent, &country_chplan_map[cc_2d_offset[code[0]][code[1]]], sizeof(*ent)); + return true; +#else + const struct country_chplan *map = country_chplan_map; + int i; + + for (i = 0; i < ARRAY_SIZE(country_chplan_map); i++) { + if (alpha2[0] == map[i].alpha2[0] && alpha2[1] == map[i].alpha2[1]) { + if (ent) + _rtw_memcpy(ent, &map[i], sizeof(*ent)); + return true; + } + } + return false; +#endif +} + +#ifdef CONFIG_RTW_CHPLAN_DEV +static void rtk_regdb_dump_chplan_test(void *sel) +{ + int i, j; + + /* check 2G CHD redundent */ + for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { + for (j = RTW_CHD_2G_00; j < i; j++) { + #if CH_MAP_2G + if (_rtw_memcmp(&rtw_channel_def_2g[i], &rtw_channel_def_2g[j], sizeof(rtw_channel_def_2g[i]))) + #else + if (CH_LIST_LEN(rtw_channel_def_2g[i]) == CH_LIST_LEN(rtw_channel_def_2g[j]) + && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_2g[i], 0), &CH_LIST_CH(rtw_channel_def_2g[j], 0), CH_LIST_LEN(rtw_channel_def_2g[i]) + 1) == _TRUE) + #endif + RTW_PRINT_SEL(sel, "2G chd:%u and %u is the same\n", i, j); + } + } + + #if !CH_MAP_2G + /* check 2G CHD invalid channel */ + for (i = RTW_CHD_2G_00; i < RTW_CHD_2G_MAX; i++) { + for (j = 0; j < CH_LIST_LEN(rtw_channel_def_2g[i]); j++) { + if (rtw_bch2freq(BAND_ON_24G, CH_LIST_CH(rtw_channel_def_2g[i], j)) == 0) + RTW_PRINT_SEL(sel, "2G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_2g[i], j), i, j); + } + } + #endif + +#if CONFIG_IEEE80211_BAND_5GHZ + /* check 5G CHD redundent */ + for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { + for (j = RTW_CHD_5G_00; j < i; j++) { + #if CH_MAP_5G + if (_rtw_memcmp(&rtw_channel_def_5g[i], &rtw_channel_def_5g[j], sizeof(rtw_channel_def_5g[i]))) + #else + if (CH_LIST_LEN(rtw_channel_def_5g[i]) == CH_LIST_LEN(rtw_channel_def_5g[j]) + && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_5g[i], 0), &CH_LIST_CH(rtw_channel_def_5g[j], 0), CH_LIST_LEN(rtw_channel_def_5g[i]) + 1) == _TRUE) + #endif + RTW_PRINT_SEL(sel, "5G chd:%u and %u is the same\n", i, j); + } + } + + #if !CH_MAP_5G + /* check 5G CHD invalid channel */ + for (i = RTW_CHD_5G_00; i < RTW_CHD_5G_MAX; i++) { + for (j = 0; j < CH_LIST_LEN(rtw_channel_def_5g[i]); j++) { + if (rtw_bch2freq(BAND_ON_5G, CH_LIST_CH(rtw_channel_def_5g[i], j)) == 0) + RTW_PRINT_SEL(sel, "5G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_5g[i], j), i, j); + } + } + #endif +#endif + +#if CONFIG_IEEE80211_BAND_6GHZ + /* check 6G CHD redundent */ + for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { + for (j = RTW_CHD_6G_00; j < i; j++) { + #if CH_MAP_6G + if (_rtw_memcmp(&rtw_channel_def_6g[i], &rtw_channel_def_6g[j], sizeof(rtw_channel_def_6g[i]))) + #else + if (CH_LIST_LEN(rtw_channel_def_6g[i]) == CH_LIST_LEN(rtw_channel_def_6g[j]) + && _rtw_memcmp(&CH_LIST_CH(rtw_channel_def_6g[i], 0), &CH_LIST_CH(rtw_channel_def_6g[j], 0), CH_LIST_LEN(rtw_channel_def_6g[i]) + 1) == _TRUE) + #endif + RTW_PRINT_SEL(sel, "6G chd:%u and %u is the same\n", i, j); + } + } + + #if !CH_MAP_6G + /* check 6G CHD invalid channel */ + for (i = RTW_CHD_6G_00; i < RTW_CHD_6G_MAX; i++) { + for (j = 0; j < CH_LIST_LEN(rtw_channel_def_6g[i]); j++) { + if (rtw_bch2freq(BAND_ON_6G, CH_LIST_CH(rtw_channel_def_6g[i], j)) == 0) + RTW_PRINT_SEL(sel, "6G invalid ch:%u at (%d,%d)\n", CH_LIST_CH(rtw_channel_def_6g[i], j), i, j); + } + } + #endif +#endif + + /* check chplan 2G_5G redundent */ + for (i = 0; i < ARRAY_SIZE(RTW_ChannelPlanMap); i++) { + if (!rtw_is_channel_plan_valid(i)) + continue; + for (j = 0; j < i; j++) { + if (!rtw_is_channel_plan_valid(j)) + continue; + if (_rtw_memcmp(&RTW_ChannelPlanMap[i], &RTW_ChannelPlanMap[j], sizeof(RTW_ChannelPlanMap[i])) == _TRUE) + RTW_PRINT_SEL(sel, "channel plan 0x%02x and 0x%02x is the same\n", i, j); + } + } + +#if CONFIG_IEEE80211_BAND_6GHZ + /* check chplan 6G redundent */ + for (i = 0; i < ARRAY_SIZE(rtw_chplan_6g_map); i++) { + if (!rtw_is_channel_plan_6g_valid(i)) + continue; + for (j = 0; j < i; j++) { + if (!rtw_is_channel_plan_6g_valid(j)) + continue; + if (_rtw_memcmp(&rtw_chplan_6g_map[i], &rtw_chplan_6g_map[j], sizeof(rtw_chplan_6g_map[i])) == _TRUE) + RTW_PRINT_SEL(sel, "channel plan 6g 0x%02x and 0x%02x is the same\n", i, j); + } + } +#endif + + + /* check country invalid chplan/chplan_6g */ +{ + struct country_chplan ent; + u8 code[2]; + + for (code[0] = 'A'; code[0] <= 'Z'; code[0]++) { + for (code[1] = 'A'; code[1] <= 'Z'; code[1]++) { + if (!rtw_get_chplan_from_country(code, &ent)) + continue; + if (!rtw_is_channel_plan_valid(ent.domain_code)) + RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code:0x%02X\n", code[0], code[1], ent.domain_code); + #if CONFIG_IEEE80211_BAND_6GHZ + if (!rtw_is_channel_plan_6g_valid(ent.domain_code_6g)) + RTW_PRINT_SEL(sel, "country \"%c%c\" has invalid domain_code_6g:0x%02X\n", code[0], code[1], ent.domain_code_6g); + #endif + } + } +} +} +#endif /* CONFIG_RTW_CHPLAN_DEV */ + +static void rtk_regdb_get_ver_str(char *buf, size_t buf_len) +{ + snprintf(buf, buf_len, "%s%s" + "%s%s-%s%s" + , RTW_MODULE_NAME, strlen(RTW_MODULE_NAME) ? "-" : "" + , RTW_DOMAIN_MAP_VER, RTW_DOMAIN_MAP_M_VER, RTW_COUNTRY_MAP_VER, RTW_COUNTRY_MAP_M_VER); +} + +bool rtk_regdb_init(void) +{ +#if CC_2D_OFFSET + build_cc_2d_offset(); +#endif + return true; +} + +DECL_REGDB_OPS( + rtk_regdb_init, /* _init */ + NULL, /* _deinit */ + rtk_regdb_get_default_regd_2g, /* _get_default_regd_2g */ + rtk_regdb_get_default_regd_5g, /* _get_default_regd_5g */ + rtk_regdb_is_domain_code_valid, /* _is_domain_code_valid */ + rtk_regdb_domain_get_ch, /* _domain_get_ch */ + rtk_regdb_get_default_regd_6g, /* _get_default_regd_6g */ + rtk_regdb_is_domain_code_6g_valid, /* _is_domain_code_6g_valid */ + rtk_regdb_domain_6g_get_ch, /* _domain_6g_get_ch */ + rtk_regdb_get_chplan_from_alpha2, /* _get_chplan_from_alpha2 */ + rtk_regdb_dump_chplan_test, /* _dump_chplan_test */ + rtk_regdb_get_ver_str /* _get_ver_str */ +) + diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_common.h b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_common.h new file mode 100644 index 00000000..651db2e9 --- /dev/null +++ b/drivers/net/wireless/realtek/rtl8852ce/core/regdb/rtw_regdb_rtk_common.h @@ -0,0 +1,554 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2024 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 __RTW_REGDB_RTK_COMMON_H__ +#define __RTW_REGDB_RTK_COMMON_H__ + +#define rtw_is_5g_band1(ch) ((ch) >= 36 && (ch) <= 48) +#define rtw_is_5g_band2(ch) ((ch) >= 52 && (ch) <= 64) +#define rtw_is_5g_band3(ch) ((ch) >= 100 && (ch) <= 144) +#define rtw_is_5g_band4(ch) ((ch) >= 149 && (ch) <= 177) + +#define rtw_is_6g_band1(ch) ((ch) >= 1 && (ch) <= 93) +#define rtw_is_6g_band2(ch) ((ch) >= 97 && (ch) <= 117) +#define rtw_is_6g_band3(ch) ((ch) >= 121 && (ch) <= 189) +#define rtw_is_6g_band4(ch) ((ch) >= 193 && (ch) <= 237) + +#define CH_MAP_2G 1 +#define CH_MAP_5G 1 +#define CH_MAP_6G 1 +#define CC_2D_OFFSET 1 + +#define CHM_2G_0 0 +#define CHM_2G_1 BIT0 +#define CHM_2G_2 BIT1 +#define CHM_2G_3 BIT2 +#define CHM_2G_4 BIT3 +#define CHM_2G_5 BIT4 +#define CHM_2G_6 BIT5 +#define CHM_2G_7 BIT6 +#define CHM_2G_8 BIT7 +#define CHM_2G_9 BIT8 +#define CHM_2G_10 BIT9 +#define CHM_2G_11 BIT10 +#define CHM_2G_12 BIT11 +#define CHM_2G_13 BIT12 +#define CHM_2G_14 BIT13 + +#define CH_TO_CHM_2G(ch) ((ch) <= 14 ? BIT((ch) - 1) : 0) + +#define CLA_2G_12_14_PASSIVE BIT0 + +#define CHM_5G_0 0 +#define CHM_5G_36 BIT0 +#define CHM_5G_40 BIT1 +#define CHM_5G_44 BIT2 +#define CHM_5G_48 BIT3 +#define CHM_5G_52 BIT4 +#define CHM_5G_56 BIT5 +#define CHM_5G_60 BIT6 +#define CHM_5G_64 BIT7 +#define CHM_5G_100 BIT8 +#define CHM_5G_104 BIT9 +#define CHM_5G_108 BIT10 +#define CHM_5G_112 BIT11 +#define CHM_5G_116 BIT12 +#define CHM_5G_120 BIT13 +#define CHM_5G_124 BIT14 +#define CHM_5G_128 BIT15 +#define CHM_5G_132 BIT16 +#define CHM_5G_136 BIT17 +#define CHM_5G_140 BIT18 +#define CHM_5G_144 BIT19 +#define CHM_5G_149 BIT20 +#define CHM_5G_153 BIT21 +#define CHM_5G_157 BIT22 +#define CHM_5G_161 BIT23 +#define CHM_5G_165 BIT24 +#define CHM_5G_169 BIT25 +#define CHM_5G_173 BIT26 +#define CHM_5G_177 BIT27 + +#define CH_TO_CHM_5G(ch) \ + ( \ + ((ch) >= 36 && (ch) <= 64) ? (((ch) & 0x03) ? 0 : BIT(((ch) - 36) >> 2)) : \ + ((ch) >= 100 && (ch) <= 144) ? (((ch) & 0x03) ? 0 : BIT(8 + (((ch) - 100) >> 2))) : \ + ((ch) >= 149 && (ch) <= 177) ? ((((ch) - 1) & 0x03) ? 0 : BIT(20 + (((ch) - 149) >> 2))) : 0 \ + ) + +#define CLA_5G_B1_PASSIVE BIT0 +#define CLA_5G_B2_PASSIVE BIT1 +#define CLA_5G_B3_PASSIVE BIT2 +#define CLA_5G_B4_PASSIVE BIT3 +#define CLA_5G_B2_DFS BIT4 +#define CLA_5G_B3_DFS BIT5 +#define CLA_5G_B4_DFS BIT6 + +#define CHM_6G_0 0 +#define CHM_6G_1 BIT_ULL(0) +#define CHM_6G_5 BIT_ULL(1) +#define CHM_6G_9 BIT_ULL(2) +#define CHM_6G_13 BIT_ULL(3) +#define CHM_6G_17 BIT_ULL(4) +#define CHM_6G_21 BIT_ULL(5) +#define CHM_6G_25 BIT_ULL(6) +#define CHM_6G_29 BIT_ULL(7) +#define CHM_6G_33 BIT_ULL(8) +#define CHM_6G_37 BIT_ULL(9) +#define CHM_6G_41 BIT_ULL(10) +#define CHM_6G_45 BIT_ULL(11) +#define CHM_6G_49 BIT_ULL(12) +#define CHM_6G_53 BIT_ULL(13) +#define CHM_6G_57 BIT_ULL(14) +#define CHM_6G_61 BIT_ULL(15) +#define CHM_6G_65 BIT_ULL(16) +#define CHM_6G_69 BIT_ULL(17) +#define CHM_6G_73 BIT_ULL(18) +#define CHM_6G_77 BIT_ULL(19) +#define CHM_6G_81 BIT_ULL(20) +#define CHM_6G_85 BIT_ULL(21) +#define CHM_6G_89 BIT_ULL(22) +#define CHM_6G_93 BIT_ULL(23) +#define CHM_6G_97 BIT_ULL(24) +#define CHM_6G_101 BIT_ULL(25) +#define CHM_6G_105 BIT_ULL(26) +#define CHM_6G_109 BIT_ULL(27) +#define CHM_6G_113 BIT_ULL(28) +#define CHM_6G_117 BIT_ULL(29) +#define CHM_6G_121 BIT_ULL(30) +#define CHM_6G_125 BIT_ULL(31) +#define CHM_6G_129 BIT_ULL(32) +#define CHM_6G_133 BIT_ULL(33) +#define CHM_6G_137 BIT_ULL(34) +#define CHM_6G_141 BIT_ULL(35) +#define CHM_6G_145 BIT_ULL(36) +#define CHM_6G_149 BIT_ULL(37) +#define CHM_6G_153 BIT_ULL(38) +#define CHM_6G_157 BIT_ULL(39) +#define CHM_6G_161 BIT_ULL(40) +#define CHM_6G_165 BIT_ULL(41) +#define CHM_6G_169 BIT_ULL(42) +#define CHM_6G_173 BIT_ULL(43) +#define CHM_6G_177 BIT_ULL(44) +#define CHM_6G_181 BIT_ULL(45) +#define CHM_6G_185 BIT_ULL(46) +#define CHM_6G_189 BIT_ULL(47) +#define CHM_6G_193 BIT_ULL(48) +#define CHM_6G_197 BIT_ULL(49) +#define CHM_6G_201 BIT_ULL(50) +#define CHM_6G_205 BIT_ULL(51) +#define CHM_6G_209 BIT_ULL(52) +#define CHM_6G_213 BIT_ULL(53) +#define CHM_6G_217 BIT_ULL(54) +#define CHM_6G_221 BIT_ULL(55) +#define CHM_6G_225 BIT_ULL(56) +#define CHM_6G_229 BIT_ULL(57) +#define CHM_6G_233 BIT_ULL(58) +#define CHM_6G_237 BIT_ULL(59) +#define CHM_6G_241 BIT_ULL(60) +#define CHM_6G_245 BIT_ULL(61) +#define CHM_6G_249 BIT_ULL(62) +#define CHM_6G_253 BIT_ULL(63) + +#define CH_TO_CHM_6G(ch) ((((ch) - 1) & 0x03) ? 0 : BIT(((ch) - 1) >> 2)) + +#define CLA_6G_B1_PASSIVE BIT0 +#define CLA_6G_B2_PASSIVE BIT1 +#define CLA_6G_B3_PASSIVE BIT2 +#define CLA_6G_B4_PASSIVE BIT3 + +struct ch_list_2g_t { + u16 ch_map:14; + u16 attr:1; +}; + +struct ch_list_5g_t { + u32 ch_map:28; + u32 attr:7; +}; + +struct ch_list_6g_t { + u64 ch_map; + u8 attr; +}; + +#define CH_LIST_ENT_2G_ARGC_15( \ + c01, c02, c03, c04, c05, c06, c07, c08, c09, c10, \ + c11, c12, c13, c14, a) \ + { \ + .attr = a, .ch_map = \ + CHM_2G_##c01 | CHM_2G_##c02 | CHM_2G_##c03 | CHM_2G_##c04 | CHM_2G_##c05 | \ + CHM_2G_##c06 | CHM_2G_##c07 | CHM_2G_##c08 | CHM_2G_##c09 | CHM_2G_##c10 | \ + CHM_2G_##c11 | CHM_2G_##c12 | CHM_2G_##c13 | CHM_2G_##c14 \ + } +#define CH_LIST_ENT_2G_ARGC_14(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, a) CH_LIST_ENT_2G_ARGC_15(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, 0, a) +#define CH_LIST_ENT_2G_ARGC_13(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, a) CH_LIST_ENT_2G_ARGC_15(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, 0, 0, a) +#define CH_LIST_ENT_2G_ARGC_12(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, a) CH_LIST_ENT_2G_ARGC_15(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, 0, 0, 0, a) +#define CH_LIST_ENT_2G_ARGC_11(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, a) CH_LIST_ENT_2G_ARGC_15(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, 0, 0, 0, 0, a) +#define CH_LIST_ENT_2G_ARGC_10(c1, c2, c3, c4, c5, c6, c7, c8, c9, a) CH_LIST_ENT_2G_ARGC_15(c1, c2, c3, c4, c5, c6, c7, c8, c9, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_2G_ARGC_09(c1, c2, c3, c4, c5, c6, c7, c8, a) CH_LIST_ENT_2G_ARGC_15(c1, c2, c3, c4, c5, c6, c7, c8, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_2G_ARGC_08(c1, c2, c3, c4, c5, c6, c7, a) CH_LIST_ENT_2G_ARGC_15(c1, c2, c3, c4, c5, c6, c7, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_2G_ARGC_07(c1, c2, c3, c4, c5, c6, a) CH_LIST_ENT_2G_ARGC_15(c1, c2, c3, c4, c5, c6, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_2G_ARGC_06(c1, c2, c3, c4, c5, a) CH_LIST_ENT_2G_ARGC_15(c1, c2, c3, c4, c5, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_2G_ARGC_05(c1, c2, c3, c4, a) CH_LIST_ENT_2G_ARGC_15(c1, c2, c3, c4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_2G_ARGC_04(c1, c2, c3, a) CH_LIST_ENT_2G_ARGC_15(c1, c2, c3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_2G_ARGC_03(c1, c2, a) CH_LIST_ENT_2G_ARGC_15(c1, c2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_2G_ARGC_02(c1, a) CH_LIST_ENT_2G_ARGC_15(c1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_2G_ARGC_01(a) CH_LIST_ENT_2G_ARGC_15( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) + +#define __CH_LIST_ENT_2G_HDL( \ + a15, a14, a13, a12, a11, \ + a10, a09, a08, a07, a06, a05, a04, a03, a02, a01, \ + hdl, ...) hdl + +#define __CH_LIST_ENT_2G(...) \ + __CH_LIST_ENT_2G_HDL(__VA_ARGS__, \ + CH_LIST_ENT_2G_ARGC_15, CH_LIST_ENT_2G_ARGC_14, CH_LIST_ENT_2G_ARGC_13, CH_LIST_ENT_2G_ARGC_12, CH_LIST_ENT_2G_ARGC_11, \ + CH_LIST_ENT_2G_ARGC_10, CH_LIST_ENT_2G_ARGC_09, CH_LIST_ENT_2G_ARGC_08, CH_LIST_ENT_2G_ARGC_07, CH_LIST_ENT_2G_ARGC_06, \ + CH_LIST_ENT_2G_ARGC_05, CH_LIST_ENT_2G_ARGC_04, CH_LIST_ENT_2G_ARGC_03, CH_LIST_ENT_2G_ARGC_02, CH_LIST_ENT_2G_ARGC_01) \ + (__VA_ARGS__) + +#define CH_LIST_ENT_5G_ARGC_29( \ + c01, c02, c03, c04, c05, c06, c07, c08, c09, c10, \ + c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, \ + c21, c22, c23, c24, c25, c26, c27, c28, a) \ + { \ + .attr = a, .ch_map = \ + CHM_5G_##c01 | CHM_5G_##c02 | CHM_5G_##c03 | CHM_5G_##c04 | CHM_5G_##c05 | \ + CHM_5G_##c06 | CHM_5G_##c07 | CHM_5G_##c08 | CHM_5G_##c09 | CHM_5G_##c10 | \ + CHM_5G_##c11 | CHM_5G_##c12 | CHM_5G_##c13 | CHM_5G_##c14 | CHM_5G_##c15 | \ + CHM_5G_##c16 | CHM_5G_##c17 | CHM_5G_##c18 | CHM_5G_##c19 | CHM_5G_##c20 | \ + CHM_5G_##c21 | CHM_5G_##c22 | CHM_5G_##c23 | CHM_5G_##c24 | CHM_5G_##c25 | \ + CHM_5G_##c26 | CHM_5G_##c27 | CHM_5G_##c28 \ + } +#define CH_LIST_ENT_5G_ARGC_28(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, 0, a) +#define CH_LIST_ENT_5G_ARGC_27(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_26(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_25(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_24(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_23(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_22(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_21(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_20(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_19(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_18(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_17(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_16(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_15(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_14(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_13(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_12(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_11(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_10(c1, c2, c3, c4, c5, c6, c7, c8, c9, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_09(c1, c2, c3, c4, c5, c6, c7, c8, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_08(c1, c2, c3, c4, c5, c6, c7, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_07(c1, c2, c3, c4, c5, c6, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, c6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_06(c1, c2, c3, c4, c5, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, c5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_05(c1, c2, c3, c4, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, c4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_04(c1, c2, c3, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, c3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_03(c1, c2, a) CH_LIST_ENT_5G_ARGC_29(c1, c2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_02(c1, a) CH_LIST_ENT_5G_ARGC_29(c1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_5G_ARGC_01(a) CH_LIST_ENT_5G_ARGC_29( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) + +#define __CH_LIST_ENT_5G_HDL( \ + a29, a28, a27, a26, a25, a24, a23, a22, a21, \ + a20, a19, a18, a17, a16, a15, a14, a13, a12, a11, \ + a10, a09, a08, a07, a06, a05, a04, a03, a02, a01, \ + hdl, ...) hdl + +#define __CH_LIST_ENT_5G(...) \ + __CH_LIST_ENT_5G_HDL(__VA_ARGS__, \ + CH_LIST_ENT_5G_ARGC_29, CH_LIST_ENT_5G_ARGC_28, CH_LIST_ENT_5G_ARGC_27, CH_LIST_ENT_5G_ARGC_26, \ + CH_LIST_ENT_5G_ARGC_25, CH_LIST_ENT_5G_ARGC_24, CH_LIST_ENT_5G_ARGC_23, CH_LIST_ENT_5G_ARGC_22, CH_LIST_ENT_5G_ARGC_21, \ + CH_LIST_ENT_5G_ARGC_20, CH_LIST_ENT_5G_ARGC_19, CH_LIST_ENT_5G_ARGC_18, CH_LIST_ENT_5G_ARGC_17, CH_LIST_ENT_5G_ARGC_16, \ + CH_LIST_ENT_5G_ARGC_15, CH_LIST_ENT_5G_ARGC_14, CH_LIST_ENT_5G_ARGC_13, CH_LIST_ENT_5G_ARGC_12, CH_LIST_ENT_5G_ARGC_11, \ + CH_LIST_ENT_5G_ARGC_10, CH_LIST_ENT_5G_ARGC_09, CH_LIST_ENT_5G_ARGC_08, CH_LIST_ENT_5G_ARGC_07, CH_LIST_ENT_5G_ARGC_06, \ + CH_LIST_ENT_5G_ARGC_05, CH_LIST_ENT_5G_ARGC_04, CH_LIST_ENT_5G_ARGC_03, CH_LIST_ENT_5G_ARGC_02, CH_LIST_ENT_5G_ARGC_01) \ + (__VA_ARGS__) + +#define CH_LIST_ENT_6G_ARGC_65( \ + c01, c02, c03, c04, c05, c06, c07, c08, c09, c10, \ + c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, \ + c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, \ + c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, \ + c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, \ + c51, c52, c53, c54, c55, c56, c57, c58, c59, c60, \ + c61, c62, c63, c64, a) \ + { \ + .attr = a, .ch_map = \ + CHM_6G_##c01 | CHM_6G_##c02 | CHM_6G_##c03 | CHM_6G_##c04 | CHM_6G_##c05 | \ + CHM_6G_##c06 | CHM_6G_##c07 | CHM_6G_##c08 | CHM_6G_##c09 | CHM_6G_##c10 | \ + CHM_6G_##c11 | CHM_6G_##c12 | CHM_6G_##c13 | CHM_6G_##c14 | CHM_6G_##c15 | \ + CHM_6G_##c16 | CHM_6G_##c17 | CHM_6G_##c18 | CHM_6G_##c19 | CHM_6G_##c20 | \ + CHM_6G_##c21 | CHM_6G_##c22 | CHM_6G_##c23 | CHM_6G_##c24 | CHM_6G_##c25 | \ + CHM_6G_##c26 | CHM_6G_##c27 | CHM_6G_##c28 | CHM_6G_##c29 | CHM_6G_##c30 | \ + CHM_6G_##c31 | CHM_6G_##c32 | CHM_6G_##c33 | CHM_6G_##c34 | CHM_6G_##c35 | \ + CHM_6G_##c36 | CHM_6G_##c37 | CHM_6G_##c38 | CHM_6G_##c39 | CHM_6G_##c40 | \ + CHM_6G_##c41 | CHM_6G_##c42 | CHM_6G_##c43 | CHM_6G_##c44 | CHM_6G_##c45 | \ + CHM_6G_##c46 | CHM_6G_##c47 | CHM_6G_##c48 | CHM_6G_##c49 | CHM_6G_##c50 | \ + CHM_6G_##c51 | CHM_6G_##c52 | CHM_6G_##c53 | CHM_6G_##c54 | CHM_6G_##c55 | \ + CHM_6G_##c56 | CHM_6G_##c57 | CHM_6G_##c58 | CHM_6G_##c59 | CHM_6G_##c60 | \ + CHM_6G_##c61 | CHM_6G_##c62 | CHM_6G_##c63 | CHM_6G_##c64 \ + } +#define CH_LIST_ENT_6G_ARGC_64(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58, c59, c60, c61, c62, c63, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58, c59, c60, c61, c62, c63, 0, a) +#define CH_LIST_ENT_6G_ARGC_63(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58, c59, c60, c61, c62, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58, c59, c60, c61, c62, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_62(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58, c59, c60, c61, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58, c59, c60, c61, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_61(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58, c59, c60, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58, c59, c60, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_60(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58, c59, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58, c59, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_59(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_58(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_57(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_56(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_55(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_54(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_53(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_52(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_51(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_50(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_49(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_48(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_47(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_46(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_45(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_44(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_43(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_42(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_41(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_40(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_39(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_38(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_37(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_36(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_35(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_34(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_33(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_32(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_31(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_30(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_29(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_28(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_27(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_26(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_25(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_24(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_23(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_22(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_21(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_20(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_19(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_18(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_17(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_16(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_15(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_14(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_13(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_12(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_11(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_10(c1, c2, c3, c4, c5, c6, c7, c8, c9, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, c9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_09(c1, c2, c3, c4, c5, c6, c7, c8, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, c8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_08(c1, c2, c3, c4, c5, c6, c7, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, c7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_07(c1, c2, c3, c4, c5, c6, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, c6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_06(c1, c2, c3, c4, c5, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, c5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_05(c1, c2, c3, c4, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, c4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_04(c1, c2, c3, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, c3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_03(c1, c2, a) CH_LIST_ENT_6G_ARGC_65(c1, c2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_02(c1, a) CH_LIST_ENT_6G_ARGC_65(c1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) +#define CH_LIST_ENT_6G_ARGC_01(a) CH_LIST_ENT_6G_ARGC_65( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a) + +#define __CH_LIST_ENT_6G_HDL( \ + a65, a64, a63, a62, a61, \ + a60, a59, a58, a57, a56, a55, a54, a53, a52, a51, \ + a50, a49, a48, a47, a46, a45, a44, a43, a42, a41, \ + a40, a39, a38, a37, a36, a35, a34, a33, a32, a31, \ + a30, a29, a28, a27, a26, a25, a24, a23, a22, a21, \ + a20, a19, a18, a17, a16, a15, a14, a13, a12, a11, \ + a10, a09, a08, a07, a06, a05, a04, a03, a02, a01, \ + hdl, ...) hdl + +#define __CH_LIST_ENT_6G(...) \ + __CH_LIST_ENT_6G_HDL(__VA_ARGS__, \ + CH_LIST_ENT_6G_ARGC_65, CH_LIST_ENT_6G_ARGC_64, CH_LIST_ENT_6G_ARGC_63, CH_LIST_ENT_6G_ARGC_62, CH_LIST_ENT_6G_ARGC_61, \ + CH_LIST_ENT_6G_ARGC_60, CH_LIST_ENT_6G_ARGC_59, CH_LIST_ENT_6G_ARGC_58, CH_LIST_ENT_6G_ARGC_57, CH_LIST_ENT_6G_ARGC_56, \ + CH_LIST_ENT_6G_ARGC_55, CH_LIST_ENT_6G_ARGC_54, CH_LIST_ENT_6G_ARGC_53, CH_LIST_ENT_6G_ARGC_52, CH_LIST_ENT_6G_ARGC_51, \ + CH_LIST_ENT_6G_ARGC_50, CH_LIST_ENT_6G_ARGC_49, CH_LIST_ENT_6G_ARGC_48, CH_LIST_ENT_6G_ARGC_47, CH_LIST_ENT_6G_ARGC_46, \ + CH_LIST_ENT_6G_ARGC_45, CH_LIST_ENT_6G_ARGC_44, CH_LIST_ENT_6G_ARGC_43, CH_LIST_ENT_6G_ARGC_42, CH_LIST_ENT_6G_ARGC_41, \ + CH_LIST_ENT_6G_ARGC_40, CH_LIST_ENT_6G_ARGC_39, CH_LIST_ENT_6G_ARGC_38, CH_LIST_ENT_6G_ARGC_37, CH_LIST_ENT_6G_ARGC_36, \ + CH_LIST_ENT_6G_ARGC_35, CH_LIST_ENT_6G_ARGC_34, CH_LIST_ENT_6G_ARGC_33, CH_LIST_ENT_6G_ARGC_32, CH_LIST_ENT_6G_ARGC_31, \ + CH_LIST_ENT_6G_ARGC_30, CH_LIST_ENT_6G_ARGC_29, CH_LIST_ENT_6G_ARGC_28, CH_LIST_ENT_6G_ARGC_27, CH_LIST_ENT_6G_ARGC_26, \ + CH_LIST_ENT_6G_ARGC_25, CH_LIST_ENT_6G_ARGC_24, CH_LIST_ENT_6G_ARGC_23, CH_LIST_ENT_6G_ARGC_22, CH_LIST_ENT_6G_ARGC_21, \ + CH_LIST_ENT_6G_ARGC_20, CH_LIST_ENT_6G_ARGC_19, CH_LIST_ENT_6G_ARGC_18, CH_LIST_ENT_6G_ARGC_17, CH_LIST_ENT_6G_ARGC_16, \ + CH_LIST_ENT_6G_ARGC_15, CH_LIST_ENT_6G_ARGC_14, CH_LIST_ENT_6G_ARGC_13, CH_LIST_ENT_6G_ARGC_12, CH_LIST_ENT_6G_ARGC_11, \ + CH_LIST_ENT_6G_ARGC_10, CH_LIST_ENT_6G_ARGC_09, CH_LIST_ENT_6G_ARGC_08, CH_LIST_ENT_6G_ARGC_07, CH_LIST_ENT_6G_ARGC_06, \ + CH_LIST_ENT_6G_ARGC_05, CH_LIST_ENT_6G_ARGC_04, CH_LIST_ENT_6G_ARGC_03, CH_LIST_ENT_6G_ARGC_02, CH_LIST_ENT_6G_ARGC_01) \ + (__VA_ARGS__) + +struct ch_list_t { + u8 *len_ch_attr; +}; + +#define CH_LIST_LEN(_ch_list) (_ch_list.len_ch_attr[0]) +#define CH_LIST_CH(_ch_list, _i) (_ch_list.len_ch_attr[_i + 1]) +#define CH_LIST_ATTRIB(_ch_list) (_ch_list.len_ch_attr[CH_LIST_LEN(_ch_list) + 1]) + +#define CH_LIST_ENT_ARGC_65(arg...) {.len_ch_attr = (u8[64 + 2]) {64, ##arg}, } +#define CH_LIST_ENT_ARGC_64(arg...) {.len_ch_attr = (u8[63 + 2]) {63, ##arg}, } +#define CH_LIST_ENT_ARGC_63(arg...) {.len_ch_attr = (u8[62 + 2]) {62, ##arg}, } +#define CH_LIST_ENT_ARGC_62(arg...) {.len_ch_attr = (u8[61 + 2]) {61, ##arg}, } +#define CH_LIST_ENT_ARGC_61(arg...) {.len_ch_attr = (u8[60 + 2]) {60, ##arg}, } +#define CH_LIST_ENT_ARGC_60(arg...) {.len_ch_attr = (u8[59 + 2]) {59, ##arg}, } +#define CH_LIST_ENT_ARGC_59(arg...) {.len_ch_attr = (u8[58 + 2]) {58, ##arg}, } +#define CH_LIST_ENT_ARGC_58(arg...) {.len_ch_attr = (u8[57 + 2]) {57, ##arg}, } +#define CH_LIST_ENT_ARGC_57(arg...) {.len_ch_attr = (u8[56 + 2]) {56, ##arg}, } +#define CH_LIST_ENT_ARGC_56(arg...) {.len_ch_attr = (u8[55 + 2]) {55, ##arg}, } +#define CH_LIST_ENT_ARGC_55(arg...) {.len_ch_attr = (u8[54 + 2]) {54, ##arg}, } +#define CH_LIST_ENT_ARGC_54(arg...) {.len_ch_attr = (u8[53 + 2]) {53, ##arg}, } +#define CH_LIST_ENT_ARGC_53(arg...) {.len_ch_attr = (u8[52 + 2]) {52, ##arg}, } +#define CH_LIST_ENT_ARGC_52(arg...) {.len_ch_attr = (u8[51 + 2]) {51, ##arg}, } +#define CH_LIST_ENT_ARGC_51(arg...) {.len_ch_attr = (u8[50 + 2]) {50, ##arg}, } +#define CH_LIST_ENT_ARGC_50(arg...) {.len_ch_attr = (u8[49 + 2]) {49, ##arg}, } +#define CH_LIST_ENT_ARGC_49(arg...) {.len_ch_attr = (u8[48 + 2]) {48, ##arg}, } +#define CH_LIST_ENT_ARGC_48(arg...) {.len_ch_attr = (u8[47 + 2]) {47, ##arg}, } +#define CH_LIST_ENT_ARGC_47(arg...) {.len_ch_attr = (u8[46 + 2]) {46, ##arg}, } +#define CH_LIST_ENT_ARGC_46(arg...) {.len_ch_attr = (u8[45 + 2]) {45, ##arg}, } +#define CH_LIST_ENT_ARGC_45(arg...) {.len_ch_attr = (u8[44 + 2]) {44, ##arg}, } +#define CH_LIST_ENT_ARGC_44(arg...) {.len_ch_attr = (u8[43 + 2]) {43, ##arg}, } +#define CH_LIST_ENT_ARGC_43(arg...) {.len_ch_attr = (u8[42 + 2]) {42, ##arg}, } +#define CH_LIST_ENT_ARGC_42(arg...) {.len_ch_attr = (u8[41 + 2]) {41, ##arg}, } +#define CH_LIST_ENT_ARGC_41(arg...) {.len_ch_attr = (u8[40 + 2]) {40, ##arg}, } +#define CH_LIST_ENT_ARGC_40(arg...) {.len_ch_attr = (u8[39 + 2]) {39, ##arg}, } +#define CH_LIST_ENT_ARGC_39(arg...) {.len_ch_attr = (u8[38 + 2]) {38, ##arg}, } +#define CH_LIST_ENT_ARGC_38(arg...) {.len_ch_attr = (u8[37 + 2]) {37, ##arg}, } +#define CH_LIST_ENT_ARGC_37(arg...) {.len_ch_attr = (u8[36 + 2]) {36, ##arg}, } +#define CH_LIST_ENT_ARGC_36(arg...) {.len_ch_attr = (u8[35 + 2]) {35, ##arg}, } +#define CH_LIST_ENT_ARGC_35(arg...) {.len_ch_attr = (u8[34 + 2]) {34, ##arg}, } +#define CH_LIST_ENT_ARGC_34(arg...) {.len_ch_attr = (u8[33 + 2]) {33, ##arg}, } +#define CH_LIST_ENT_ARGC_33(arg...) {.len_ch_attr = (u8[32 + 2]) {32, ##arg}, } +#define CH_LIST_ENT_ARGC_32(arg...) {.len_ch_attr = (u8[31 + 2]) {31, ##arg}, } +#define CH_LIST_ENT_ARGC_31(arg...) {.len_ch_attr = (u8[30 + 2]) {30, ##arg}, } +#define CH_LIST_ENT_ARGC_30(arg...) {.len_ch_attr = (u8[29 + 2]) {29, ##arg}, } +#define CH_LIST_ENT_ARGC_29(arg...) {.len_ch_attr = (u8[28 + 2]) {28, ##arg}, } +#define CH_LIST_ENT_ARGC_28(arg...) {.len_ch_attr = (u8[27 + 2]) {27, ##arg}, } +#define CH_LIST_ENT_ARGC_27(arg...) {.len_ch_attr = (u8[26 + 2]) {26, ##arg}, } +#define CH_LIST_ENT_ARGC_26(arg...) {.len_ch_attr = (u8[25 + 2]) {25, ##arg}, } +#define CH_LIST_ENT_ARGC_25(arg...) {.len_ch_attr = (u8[24 + 2]) {24, ##arg}, } +#define CH_LIST_ENT_ARGC_24(arg...) {.len_ch_attr = (u8[23 + 2]) {23, ##arg}, } +#define CH_LIST_ENT_ARGC_23(arg...) {.len_ch_attr = (u8[22 + 2]) {22, ##arg}, } +#define CH_LIST_ENT_ARGC_22(arg...) {.len_ch_attr = (u8[21 + 2]) {21, ##arg}, } +#define CH_LIST_ENT_ARGC_21(arg...) {.len_ch_attr = (u8[20 + 2]) {20, ##arg}, } +#define CH_LIST_ENT_ARGC_20(arg...) {.len_ch_attr = (u8[19 + 2]) {19, ##arg}, } +#define CH_LIST_ENT_ARGC_19(arg...) {.len_ch_attr = (u8[18 + 2]) {18, ##arg}, } +#define CH_LIST_ENT_ARGC_18(arg...) {.len_ch_attr = (u8[17 + 2]) {17, ##arg}, } +#define CH_LIST_ENT_ARGC_17(arg...) {.len_ch_attr = (u8[16 + 2]) {16, ##arg}, } +#define CH_LIST_ENT_ARGC_16(arg...) {.len_ch_attr = (u8[15 + 2]) {15, ##arg}, } +#define CH_LIST_ENT_ARGC_15(arg...) {.len_ch_attr = (u8[14 + 2]) {14, ##arg}, } +#define CH_LIST_ENT_ARGC_14(arg...) {.len_ch_attr = (u8[13 + 2]) {13, ##arg}, } +#define CH_LIST_ENT_ARGC_13(arg...) {.len_ch_attr = (u8[12 + 2]) {12, ##arg}, } +#define CH_LIST_ENT_ARGC_12(arg...) {.len_ch_attr = (u8[11 + 2]) {11, ##arg}, } +#define CH_LIST_ENT_ARGC_11(arg...) {.len_ch_attr = (u8[10 + 2]) {10, ##arg}, } +#define CH_LIST_ENT_ARGC_10(arg...) {.len_ch_attr = (u8[ 9 + 2]) { 9, ##arg}, } +#define CH_LIST_ENT_ARGC_09(arg...) {.len_ch_attr = (u8[ 8 + 2]) { 8, ##arg}, } +#define CH_LIST_ENT_ARGC_08(arg...) {.len_ch_attr = (u8[ 7 + 2]) { 7, ##arg}, } +#define CH_LIST_ENT_ARGC_07(arg...) {.len_ch_attr = (u8[ 6 + 2]) { 6, ##arg}, } +#define CH_LIST_ENT_ARGC_06(arg...) {.len_ch_attr = (u8[ 5 + 2]) { 5, ##arg}, } +#define CH_LIST_ENT_ARGC_05(arg...) {.len_ch_attr = (u8[ 4 + 2]) { 4, ##arg}, } +#define CH_LIST_ENT_ARGC_04(arg...) {.len_ch_attr = (u8[ 3 + 2]) { 3, ##arg}, } +#define CH_LIST_ENT_ARGC_03(arg...) {.len_ch_attr = (u8[ 2 + 2]) { 2, ##arg}, } +#define CH_LIST_ENT_ARGC_02(arg...) {.len_ch_attr = (u8[ 1 + 2]) { 1, ##arg}, } +#define CH_LIST_ENT_ARGC_01(arg...) {.len_ch_attr = (u8[ 0 + 2]) { 0, ##arg}, } + +#define __CH_LIST_ENT_HDL( \ + a65, a64, a63, a62, a61, \ + a60, a59, a58, a57, a56, a55, a54, a53, a52, a51, \ + a50, a49, a48, a47, a46, a45, a44, a43, a42, a41, \ + a40, a39, a38, a37, a36, a35, a34, a33, a32, a31, \ + a30, a29, a28, a27, a26, a25, a24, a23, a22, a21, \ + a20, a19, a18, a17, a16, a15, a14, a13, a12, a11, \ + a10, a09, a08, a07, a06, a05, a04, a03, a02, a01, \ + hdl, ...) hdl + +#define CH_LIST_ENT(...) \ + __CH_LIST_ENT_HDL(__VA_ARGS__, \ + CH_LIST_ENT_ARGC_65, CH_LIST_ENT_ARGC_64, CH_LIST_ENT_ARGC_63, CH_LIST_ENT_ARGC_62, CH_LIST_ENT_ARGC_61, \ + CH_LIST_ENT_ARGC_60, CH_LIST_ENT_ARGC_59, CH_LIST_ENT_ARGC_58, CH_LIST_ENT_ARGC_57, CH_LIST_ENT_ARGC_56, \ + CH_LIST_ENT_ARGC_55, CH_LIST_ENT_ARGC_54, CH_LIST_ENT_ARGC_53, CH_LIST_ENT_ARGC_52, CH_LIST_ENT_ARGC_51, \ + CH_LIST_ENT_ARGC_50, CH_LIST_ENT_ARGC_49, CH_LIST_ENT_ARGC_48, CH_LIST_ENT_ARGC_47, CH_LIST_ENT_ARGC_46, \ + CH_LIST_ENT_ARGC_45, CH_LIST_ENT_ARGC_44, CH_LIST_ENT_ARGC_43, CH_LIST_ENT_ARGC_42, CH_LIST_ENT_ARGC_41, \ + CH_LIST_ENT_ARGC_40, CH_LIST_ENT_ARGC_39, CH_LIST_ENT_ARGC_38, CH_LIST_ENT_ARGC_37, CH_LIST_ENT_ARGC_36, \ + CH_LIST_ENT_ARGC_35, CH_LIST_ENT_ARGC_34, CH_LIST_ENT_ARGC_33, CH_LIST_ENT_ARGC_32, CH_LIST_ENT_ARGC_31, \ + CH_LIST_ENT_ARGC_30, CH_LIST_ENT_ARGC_29, CH_LIST_ENT_ARGC_28, CH_LIST_ENT_ARGC_27, CH_LIST_ENT_ARGC_26, \ + CH_LIST_ENT_ARGC_25, CH_LIST_ENT_ARGC_24, CH_LIST_ENT_ARGC_23, CH_LIST_ENT_ARGC_22, CH_LIST_ENT_ARGC_21, \ + CH_LIST_ENT_ARGC_20, CH_LIST_ENT_ARGC_19, CH_LIST_ENT_ARGC_18, CH_LIST_ENT_ARGC_17, CH_LIST_ENT_ARGC_16, \ + CH_LIST_ENT_ARGC_15, CH_LIST_ENT_ARGC_14, CH_LIST_ENT_ARGC_13, CH_LIST_ENT_ARGC_12, CH_LIST_ENT_ARGC_11, \ + CH_LIST_ENT_ARGC_10, CH_LIST_ENT_ARGC_09, CH_LIST_ENT_ARGC_08, CH_LIST_ENT_ARGC_07, CH_LIST_ENT_ARGC_06, \ + CH_LIST_ENT_ARGC_05, CH_LIST_ENT_ARGC_04, CH_LIST_ENT_ARGC_03, CH_LIST_ENT_ARGC_02, CH_LIST_ENT_ARGC_01) \ + (__VA_ARGS__) + +#if CH_MAP_2G +typedef struct ch_list_2g_t CH_LIST_2G_T; +#define CH_LIST_ENT_2G __CH_LIST_ENT_2G +#define CH_LIST_ATTRIB_2G(_ch_list) (_ch_list.attr) +#else +typedef struct ch_list_t CH_LIST_2G_T; +#define CH_LIST_ENT_2G CH_LIST_ENT +#define CH_LIST_ATTRIB_2G CH_LIST_ATTRIB +#endif + +#if CH_MAP_5G +typedef struct ch_list_5g_t CH_LIST_5G_T; +#define CH_LIST_ENT_5G __CH_LIST_ENT_5G +#define CH_LIST_ATTRIB_5G(_ch_list) (_ch_list.attr) +#else +typedef struct ch_list_t CH_LIST_5G_T; +#define CH_LIST_ENT_5G CH_LIST_ENT +#define CH_LIST_ATTRIB_5G CH_LIST_ATTRIB +#endif + +#if CH_MAP_6G +typedef struct ch_list_6g_t CH_LIST_6G_T; +#define CH_LIST_ENT_6G __CH_LIST_ENT_6G +#define CH_LIST_ATTRIB_6G(_ch_list) (_ch_list.attr) +#else +typedef struct ch_list_t CH_LIST_6G_T; +#define CH_LIST_ENT_6G CH_LIST_ENT +#define CH_LIST_ATTRIB_6G CH_LIST_ATTRIB +#endif + +struct chplan_ent_t { + u8 regd_2g; /* value of enum rtw_regd */ + u8 chd_2g; +#if CONFIG_IEEE80211_BAND_5GHZ + u8 regd_5g; /* value of enum rtw_regd */ + u8 chd_5g; +#endif +}; + +#if CONFIG_IEEE80211_BAND_5GHZ +#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g, .regd_5g = RTW_REGD_##_regd_5g, .chd_5g = RTW_CHD_5G_##_chd_5g} +#else +#define CHPLAN_ENT(_regd_2g, _chd_2g, _regd_5g, _chd_5g) {.regd_2g = RTW_REGD_##_regd_2g, .chd_2g = RTW_CHD_2G_##_chd_2g} +#endif + +#define CHPLAN_ENT_NOT_DEFINED CHPLAN_ENT(NA, INVALID, NA, INVALID) + +struct chplan_6g_ent_t { + u8 regd; /* value of enum rtw_regd */ + u8 chd; +}; + +#define CHPLAN_6G_ENT(_regd, _chd) {.regd = RTW_REGD_##_regd, .chd = RTW_CHD_6G_##_chd} + +#define CHPLAN_6G_ENT_NOT_DEFINED CHPLAN_6G_ENT(NA, INVALID) + +#endif /* __RTW_REGDB_RTK_COMMON_H__ */ + diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_ap.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_ap.c index 51993c15..1525d37f 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_ap.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_ap.c @@ -1516,7 +1516,7 @@ static void rtw_ap_check_scan(_adapter *padapter, struct _ADAPTER_LINK *padapter if (_TRUE == do_scan) { RTW_INFO("%s : drv scans by itself and wait_completed\n", __func__); - rtw_drv_scan_by_self(padapter, reason); + rtw_drv_scan_by_self(padapter, reason, false); rtw_scan_abort(padapter, 0); } @@ -3345,7 +3345,7 @@ static void update_bcn_htinfo_ie(_adapter *padapter, struct _ADAPTER_LINK *padap pht_info = (struct HT_info_element *)(p + 2); /* for STA Channel Width/Secondary Channel Offset*/ - if ((pmlmepriv->sw_to_20mhz == 0) && (pmlmeext->chandef.chan <= 14)) { + if ((pmlmepriv->sw_to_20mhz == 0) && (pmlmeext->chandef.band == BAND_ON_24G)) { if ((pmlmepriv->num_sta_40mhz_intolerant > 0) || (pmlmepriv->ht_20mhz_width_req == _TRUE) || (pmlmepriv->ht_intolerant_ch_reported == _TRUE) || (ATOMIC_READ(&pmlmepriv->olbc) == _TRUE)) { SET_HT_OP_ELE_2ND_CHL_OFFSET(pht_info, 0); @@ -6388,7 +6388,7 @@ void rtw_ap_set_sta_wmode(_adapter *padapter, struct sta_info *sta) } #endif - if (pcur_network->Configuration.DSConfig > 14) + if (BSS_EX_OP_BAND(pcur_network) != BAND_ON_24G) network_type |= WLAN_MD_11A; else { if ((cckratesonly_included(sta->bssrateset, sta->bssratelen)) == _TRUE) @@ -7407,6 +7407,10 @@ static enum phl_mdl_ret_code _ap_add_del_sta_req_acquired(void *dispr, void *pri struct _ADAPTER_LINK *padapter_link = GET_PRIMARY_LINK(padapter); RTW_DBG(FUNC_ADPT_FMT ": +\n", FUNC_ADPT_ARG(padapter)); + if (!check_fwstate(&padapter->mlmepriv, WIFI_ASOC_STATE)) { + RTW_ERR(FUNC_ADPT_FMT": ap is disconnected\n", FUNC_ADPT_ARG(padapter)); + return status; + } _rtw_spinlock_bh(&padapter->ap_add_del_sta_lock); if (padapter->ap_add_del_sta_cmd_state != ADD_DEL_STA_ST_REQUESTING) diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_btc.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_btc.c index 96d4146f..15a46970 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_btc.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_btc.c @@ -16,5 +16,247 @@ #include +#ifdef CONFIG_BTC_TRXSS_CHG +static u8 _rtw_btc_trxss_chg_hdl_sta(_adapter *padapter, u8 ss_chg_to, u8 hdl_tx, u8 hdl_rx) +{ + struct _ADAPTER_LINK *alink = NULL; + struct sta_info *psta = NULL; + enum wlan_mode wmode = WLAN_MD_INVALID; + u8 final_ss = 0; + + psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv)); + if (psta == NULL) { + RTW_ERR("%s: psta = NULL!\n", __func__); + return _FAIL; + } + + alink = GET_PRIMARY_LINK(padapter); + wmode = psta->phl_sta->wmode; + + if ((wmode & WLAN_MD_11AX) || (wmode & WLAN_MD_11AC)) { + final_ss = rtw_backup_and_get_final_ss(padapter, psta, ss_chg_to); + if (wmode & WLAN_MD_11AX) + rtw_he_om_ctrl_trx_ss(padapter, alink, psta, final_ss, hdl_tx); + else if (wmode & WLAN_MD_11AC) + rtw_vht_op_mode_ctrl_rx_nss(padapter, alink, psta, final_ss, hdl_tx); + } else if (wmode & WLAN_MD_11N) { + if (ss_chg_to) + rtw_ssmps_enter(padapter, psta); + else + rtw_ssmps_leave(padapter, psta); + } + + return _SUCCESS; +} + +static u8 _rtw_btc_trxss_chg_hdl_go(_adapter *padapter, u8 ss_chg_to, u8 hdl_tx, u8 hdl_rx) +{ + struct sta_priv *stapriv = NULL; + struct sta_info *sta = NULL; + u32 i, stainfo_offset; + _list *plist, *phead; + u8 chk_num = 0; + u8 chk_list[NUM_STA]; + struct _ADAPTER_LINK *a_link = GET_PRIMARY_LINK(padapter); + struct link_mlme_priv *mlmepriv = &(a_link->mlmepriv); + struct link_mlme_ext_priv *mlmeext = &(a_link->mlmeextpriv); + struct link_mlme_ext_info *mlmeinfo = &(mlmeext->mlmext_info); + WLAN_BSSID_EX *network = &(mlmeinfo->network); + struct HT_caps_element *ht_caps; + u8 *p, *ie = network->IEs; + u32 len = 0; + + if (!mlmepriv->htpriv.ht_option) + return _FAIL; + + if (!mlmeinfo->HT_caps_enable) + return _FAIL; + + stapriv = &padapter->stapriv; + _rtw_spinlock_bh(&stapriv->asoc_list_lock); + + phead = &stapriv->asoc_list; + plist = get_next(phead); + + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { + sta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); + plist = get_next(plist); + + stainfo_offset = rtw_stainfo_offset(stapriv, sta); + if (stainfo_offset_valid(stainfo_offset)) + chk_list[chk_num++] = stainfo_offset; + continue; + } + + _rtw_spinunlock_bh(&stapriv->asoc_list_lock); + + for (i = 0; i < chk_num; i++) { + sta = rtw_get_stainfo_by_offset(stapriv, chk_list[i]); + if (ss_chg_to) + rtw_ssmps_enter(padapter, sta); + else + rtw_ssmps_leave(padapter, sta); + } + + p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_CAPABILITY_IE_, &len, (network->IELength - _BEACON_IE_OFFSET_)); + if (p && len > 0) { + ht_caps = (struct HT_caps_element *)(p + 2); + RTW_INFO("%s: orig ht caps info = 0x%02x\n", __func__, ht_caps->u.HT_cap_element.HT_caps_info); + + if (ss_chg_to) + SET_HT_CAP_ELE_SM_PS(&(ht_caps->u.HT_cap_element.HT_caps_info), SM_PS_STATIC); + else + SET_HT_CAP_ELE_SM_PS(&(ht_caps->u.HT_cap_element.HT_caps_info), SM_PS_DISABLE); + + RTW_INFO("%s: modify ht caps info = 0x%02x\n", __func__, ht_caps->u.HT_cap_element.HT_caps_info); + rtw_update_beacon(padapter, a_link, _HT_CAPABILITY_IE_, NULL, _TRUE, RTW_CMDF_DIRECTLY); + } + + return _SUCCESS; +} + +static u8 _rtw_btc_trxss_chg_hdl_ap(_adapter *padapter, u8 ss_chg_to, u8 hdl_tx, u8 hdl_rx) +{ + /* to be implemented */ + + return _SUCCESS; +} + +u8 rtw_btc_trxss_chg_hdl(struct dvobj_priv *dvobj, struct phl_msg *msg, u16 evt_id) +{ + _adapter *padapter = dvobj_get_primary_adapter(dvobj); + _adapter *iface = NULL; + enum rtw_core_btc_cmd_id btc_cmd_id = RTW_CORE_BTC_CMD_MAX; + u8 i = 0; + u8 ret = _FAIL; + + if (!rtw_hw_is_mimo_support(padapter)) { + RTW_WARN("%s: skip since mimo is not supported!\n", __func__); + return _FAIL; + } + +#ifdef CONFIG_DBCC_SUPPORT + if (rtw_phl_mr_is_db(dvobj->phl)) { + RTW_WARN("%s: skip since dbcc is running!\n", __func__); + return _FAIL; + } +#endif + + if (!(GET_DEV_BTC_CAP(GET_PHL_COM(dvobj)).btc_deg_wifi_cap & BTC_DRG_WIFI_CAP_TRX1SS)) { + RTW_WARN("%s: btc trxss change isn't enabled!\n", __func__); + return _FAIL; + } + + switch (evt_id) { + case MSG_EVT_ANN_RX1SS: + btc_cmd_id = RTW_CORE_BTC_CMD_TRXSS_LMT; + break; + case MSG_EVT_ANN_RX_MAXSS: + btc_cmd_id = RTW_CORE_BTC_CMD_TRXSS_NO_LMT; + break; + default: + RTW_ERR("%s: unsupported evt_id %d!\n", __func__, evt_id); + return _FAIL; + } + + RTW_INFO("%s: evt_id = %d and macid_map[0] = 0x%08X, macid_map[1] = 0x%08X!\n", + __func__, evt_id, (u32)msg->rsvd[0].value, (u32)msg->rsvd[1].value); + + ret = rtw_core_btc_cmd(padapter, btc_cmd_id, 0); + + return ret; +} +#endif /* CONFIG_BTC_TRXSS_CHG */ + +u8 rtw_core_btc_hdl(_adapter *padapter, enum rtw_core_btc_cmd_id btc_cmd_id) +{ + struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); + _adapter *iface = NULL; + u8 i = 0; + u8 ss_chg_to = 0; + u8 ret = _SUCCESS; + + switch (btc_cmd_id) { +#ifdef CONFIG_BTC_TRXSS_CHG + case RTW_CORE_BTC_CMD_TRXSS_LMT: + case RTW_CORE_BTC_CMD_TRXSS_NO_LMT: + ss_chg_to = (btc_cmd_id == RTW_CORE_BTC_CMD_TRXSS_LMT) ? 1 : 0; + + for (i = 0; i < dvobj->iface_nums; i++) { + iface = dvobj->padapters[i]; + if (iface == NULL) + continue; + if (!rtw_is_adapter_up(iface)) + continue; + + if (is_client_associated_to_ap(iface)) { + RTW_INFO("%s: handle "ADPT_FMT" in sta mode!\n", __func__, ADPT_ARG(iface)); + ret = _rtw_btc_trxss_chg_hdl_sta(iface, ss_chg_to, _TRUE, _TRUE); + } else if (MLME_IS_GO(iface)) { + RTW_INFO("%s: handle "ADPT_FMT" in P2P-GO mode!\n", __func__, ADPT_ARG(iface)); + ret = _rtw_btc_trxss_chg_hdl_go(iface, ss_chg_to, _TRUE, _TRUE); + } else if (MLME_IS_AP(iface)) { + RTW_INFO("%s: handle "ADPT_FMT" in AP mode!\n", __func__, ADPT_ARG(iface)); + ret = _rtw_btc_trxss_chg_hdl_ap(iface, ss_chg_to, _TRUE, _TRUE); + } + } + + break; +#endif + default: + break; + } + + return ret; +} + +u8 rtw_core_btc_cmd(_adapter *padapter, enum rtw_core_btc_cmd_id btc_cmd_id, u8 flags) +{ + u8 ret = _SUCCESS; + struct cmd_obj *pcmdobj; + struct drvextra_cmd_parm *pcmd_parm; + struct cmd_priv *pcmdpriv = &adapter_to_dvobj(padapter)->cmdpriv; + struct submit_ctx sctx; + + pcmdobj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + if (pcmdobj == NULL) { + ret = _FAIL; + goto exit; + } + pcmdobj->padapter = padapter; + + pcmd_parm = (struct drvextra_cmd_parm *)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + if (pcmd_parm == NULL) { + rtw_mfree((u8 *)pcmdobj, sizeof(struct cmd_obj)); + ret = _FAIL; + goto exit; + } + + pcmd_parm->ec_id = CORE_BTC_CID; + pcmd_parm->type = (int)btc_cmd_id; + + init_h2fwcmd_w_parm_no_rsp(pcmdobj, pcmd_parm, CMD_SET_DRV_EXTRA); + + if (flags & RTW_CMDF_WAIT_ACK) { + pcmdobj->sctx = &sctx; + rtw_sctx_init(&sctx, 3000); + } + + ret = rtw_enqueue_cmd(pcmdpriv, pcmdobj); + + if (ret == _SUCCESS && (flags & RTW_CMDF_WAIT_ACK)) { + rtw_sctx_wait(&sctx, __func__); + _rtw_mutex_lock_interruptible(&pcmdpriv->sctx_mutex); + if (sctx.status == RTW_SCTX_SUBMITTED) + pcmdobj->sctx = NULL; + _rtw_mutex_unlock(&pcmdpriv->sctx_mutex); + if (sctx.status != RTW_SCTX_DONE_SUCCESS) + ret = _FAIL; + } + +exit: + return ret; +} + #endif /* CONFIG_BTC */ diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_chplan.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_chplan.c index b711570d..29aeaac3 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_chplan.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_chplan.c @@ -15,30 +15,38 @@ #define _RTW_CHPLAN_C_ #include +#include "regdb/rtw_regdb.h" -extern struct rtw_regdb_ops regdb_ops; +bool rtw_chplan_init(void) +{ + if (!regdb_ops.init || regdb_ops.init()) + return true; + + rtw_warn_on(1); + return false; +} + +void rtw_chplan_deinit(void) +{ + if (regdb_ops.deinit) + regdb_ops.deinit(); +} u8 rtw_chplan_get_default_regd_2g(u8 id) { - if (regdb_ops.get_default_regd_2g) - return regdb_ops.get_default_regd_2g(id); - return RTW_REGD_NA; + return regdb_ops.get_default_regd_2g(id); } #if CONFIG_IEEE80211_BAND_5GHZ u8 rtw_chplan_get_default_regd_5g(u8 id) { - if (regdb_ops.get_default_regd_5g) - return regdb_ops.get_default_regd_5g(id); - return RTW_REGD_NA; + return regdb_ops.get_default_regd_5g(id); } #endif bool rtw_is_channel_plan_valid(u8 id) { - if (regdb_ops.is_domain_code_valid) - return regdb_ops.is_domain_code_valid(id); - return false; + return regdb_ops.is_domain_code_valid(id); } /* @@ -50,24 +58,18 @@ bool rtw_is_channel_plan_valid(u8 id) */ static bool rtw_chplan_get_ch(u8 id, u32 ch, u8 *flags) { - if (regdb_ops.domain_get_ch) - return regdb_ops.domain_get_ch(id, ch, flags); - return false; + return regdb_ops.domain_get_ch(id, ch, flags); } #if CONFIG_IEEE80211_BAND_6GHZ u8 rtw_chplan_get_default_regd_6g(u8 id) { - if (regdb_ops.get_default_regd_6g) - return regdb_ops.get_default_regd_6g(id); - return RTW_REGD_NA; + return regdb_ops.get_default_regd_6g(id); } bool rtw_is_channel_plan_6g_valid(u8 id) { - if (regdb_ops.is_domain_code_6g_valid) - return regdb_ops.is_domain_code_6g_valid(id); - return false; + return regdb_ops.is_domain_code_6g_valid(id); } /* @@ -79,9 +81,7 @@ bool rtw_is_channel_plan_6g_valid(u8 id) */ static bool rtw_chplan_6g_get_ch(u8 id, u32 ch, u8 *flags) { - if (regdb_ops.domain_6g_get_ch) - return regdb_ops.domain_6g_get_ch(id, ch, flags); - return false; + return regdb_ops.domain_6g_get_ch(id, ch, flags); } #endif /* CONFIG_IEEE80211_BAND_6GHZ */ @@ -149,7 +149,6 @@ u8 rtw_chplan_is_bchbw_valid(u8 id, u8 id_6g, enum band_type band, u8 ch, u8 bw, u8 op_ch; u8 valid = 0; int i; - int ch_idx; u8 flags; cch = rtw_get_center_ch_by_band(band, ch, bw, offset); @@ -470,12 +469,13 @@ static void rtw_beacon_hint_expire(struct rf_ctl_t *rfctl) } const char *const _regd_inr_str[] = { - [RTW_REGD_SET_BY_INIT] = "INIT", - [RTW_REGD_SET_BY_USER] = "USER", + [RTW_REGD_SET_BY_INIT] = "INIT", + [RTW_REGD_SET_BY_USER] = "USER", [RTW_REGD_SET_BY_COUNTRY_IE] = "COUNTRY_IE", - [RTW_REGD_SET_BY_DRIVER] = "DRIVER", - [RTW_REGD_SET_BY_CORE] = "CORE", - [RTW_REGD_SET_BY_NUM] = "UNKNOWN", + [RTW_REGD_SET_BY_EXTRA] = "EXTRA", + [RTW_REGD_SET_BY_DRIVER] = "DRIVER", + [RTW_REGD_SET_BY_CORE] = "CORE", + [RTW_REGD_SET_BY_NUM] = "UNKNOWN", }; const char *const _regd_str[] = { @@ -885,7 +885,6 @@ char *rtw_get_txpwr_lmt_name_of_bands_str(char *buf, const char *name_of_band[], #define BOOL_S_DIFF (-2) #define BOOL_S_SEQ_COMPARE(result, operand) ( \ (result) == BOOL_S_NONE ? BOOL_TO_S8(operand) : \ - BOOL_TO_S8(operand) == BOOL_S_NONE ? (result) : \ (result) != BOOL_TO_S8(operand) ? BOOL_S_DIFF : (result) \ ) @@ -1148,7 +1147,6 @@ static void rtw_txpwr_apply_predefined(struct rf_ctl_t *rfctl, struct regd_req_t static void rtw_txpwr_apply_regd_req_default(struct rf_ctl_t *rfctl, struct regd_req_t *req , const char *name_of_band[], u8 *unknown_bmp) { - struct dvobj_priv *dvobj = rfctl_to_dvobj(rfctl); struct country_chplan *chplan = &req->chplan; u8 txpwr_lmt[BAND_MAX]; char buf[TXPWR_NAME_OF_BANDS_STR_LEN]; @@ -1235,10 +1233,9 @@ static void rtw_txpwr_apply_regd_req(struct rf_ctl_t *rfctl, struct regd_req_t * #else #define REG_6G_NAME_BSZ 0 #endif - struct dvobj_priv *dvobj = rfctl_to_dvobj(rfctl); struct rtw_chset *chset = &rfctl->chset; - struct country_chplan *chplan = &req->chplan; #ifdef CONFIG_REGD_SRC_FROM_OS + struct country_chplan *chplan = &req->chplan; char req_alpha2_str[3] = {chplan->alpha2[0], chplan->alpha2[1], 0}; #endif char req_6g_name_buf[REG_6G_NAME_BSZ]; @@ -1320,12 +1317,6 @@ void rtw_txpwr_update_cur_lmt_regs(struct dvobj_priv *dvobj, bool req_lock) static const struct country_chplan world_wide_chplan = COUNTRY_CHPLAN_ENT(WORLDWIDE_ALPHA2, RTW_CHPLAN_WORLDWIDE, RTW_CHPLAN_6G_WORLDWIDE, DEF, 1, 1, 1, 1, ___); -#ifdef CONFIG_CUSTOMIZED_COUNTRY_CHPLAN_MAP -#include "../platform/custom_country_chplan.h" -#elif RTW_DEF_MODULE_REGULATORY_CERT -#include "./def_module_country_chplan.h" -#endif - /* * rtw_get_chplan_worldwide - * @ent: the buf to copy country_chplan entry content @@ -1344,35 +1335,15 @@ void rtw_get_chplan_worldwide(struct country_chplan *ent) */ bool rtw_get_chplan_from_country(const char *country_code, struct country_chplan *ent) { -#if defined(CONFIG_CUSTOMIZED_COUNTRY_CHPLAN_MAP) || RTW_DEF_MODULE_REGULATORY_CERT - const struct country_chplan *map = NULL; - u16 map_sz = 0; - int i; -#endif - char code[2] = {alpha_to_upper(country_code[0]), alpha_to_upper(country_code[1])}; + char code[2]; -#if defined(CONFIG_CUSTOMIZED_COUNTRY_CHPLAN_MAP) || RTW_DEF_MODULE_REGULATORY_CERT - #ifdef CONFIG_CUSTOMIZED_COUNTRY_CHPLAN_MAP - map = CUSTOMIZED_country_chplan_map; - map_sz = sizeof(CUSTOMIZED_country_chplan_map) / sizeof(struct country_chplan); - #else - map_sz = rtw_def_module_country_chplan_map(&map); - #endif + if (!is_alpha(country_code[0]) || !is_alpha(country_code[1])) + return false; - for (i = 0; i < map_sz; i++) { - if (strncmp(code, map[i].alpha2, 2) == 0) { - if (ent) - _rtw_memcpy(ent, &map[i], sizeof(*ent)); - return true; - } - } + code[0] = alpha_to_upper(country_code[0]); + code[1] = alpha_to_upper(country_code[1]); - return false; -#else - if (regdb_ops.get_chplan_from_alpha2) - return regdb_ops.get_chplan_from_alpha2(code, ent); - return false; -#endif + return regdb_ops.get_chplan_from_alpha2(code, ent); } void rtw_chplan_ioctl_input_mapping(u16 *chplan, u16 *chplan_6g) @@ -1516,6 +1487,138 @@ static const enum rtw_env_t _reg_info_to_env[] = { #define reg_info_to_env(reg_info) (((reg_info) >= CIS_6G_REG_NUM) ? _reg_info_to_env[CIS_6G_REG_NUM] : _reg_info_to_env[(reg_info)]) #endif +static void cis_scan_stat_clr(struct cis_scan_stat_t *stat) +{ + _list *list, *head; + struct cis_scan_stat_ent *ent; + + _rtw_mutex_lock(&stat->lock); + + head = &stat->ent; + list = get_next(head); + while (!rtw_end_of_queue_search(head, list)) { + ent = LIST_CONTAINOR(list, struct cis_scan_stat_ent, list); + list = get_next(list); + rtw_list_delete(&ent->list); + rtw_mfree(ent, sizeof(*ent)); + } + + stat->ent_num = 0; + CIS_SCAN_STAT_SET_MAJORITY(stat, NULL); + + _rtw_mutex_unlock(&stat->lock); +} + +static void cis_scan_stat_add(struct cis_scan_stat_t *stat, const struct country_ie_slave_record *cisr) +{ + _list *list, *head; + struct cis_scan_stat_ent *ent, *inc; + + head = &stat->ent; + list = get_next(head); + while (!rtw_end_of_queue_search(head, list)) { + ent = LIST_CONTAINOR(list, struct cis_scan_stat_ent, list); + + if (ent->cisr.alpha2[0] == cisr->alpha2[0] && ent->cisr.alpha2[1] == cisr->alpha2[1]) { + ent->count++; + inc = ent; + goto check_order; + } + + list = get_next(list); + } + + /* not match, add new ent and insert tail */ + ent = rtw_malloc(sizeof(*ent)); + if (!ent) + return; + + _rtw_memcpy(&ent->cisr, cisr, sizeof(ent->cisr)); + ent->count = 1; + + rtw_list_insert_tail(&ent->list, head); + stat->ent_num++; + return; + +check_order: + /* keep decending by count */ + + /* search ent with count >= inc's (or search to head) */ + list = get_prev(list); + while (!rtw_end_of_queue_search(head, list)) { + ent = LIST_CONTAINOR(list, struct cis_scan_stat_ent, list); + if (ent->count >= inc->count) + break; + list = get_prev(list); + } + + if (list != get_prev(&inc->list)) { + rtw_list_delete(&inc->list); + rtw_list_insert_head(&inc->list, list); + } +} + +#if CONFIG_80211D_ENV_BSS_MAJORITY +static struct cis_scan_stat_ent *cis_scan_stat_update_majority(struct cis_scan_stat_t *stat, bool disable) +{ + _list *list, *head; + struct cis_scan_stat_ent *ent, *m = NULL; + + if (stat->ent_num == 0 || disable) + goto update; + + head = &stat->ent; + list = get_next(head); + m = LIST_CONTAINOR(list, struct cis_scan_stat_ent, list); + + /* check if not single majority */ + list = get_next(list); + if (!rtw_end_of_queue_search(head, list)) { + ent = LIST_CONTAINOR(list, struct cis_scan_stat_ent, list); + if (m->count == ent->count) + m = NULL; + } + +update: + CIS_SCAN_STAT_SET_MAJORITY(stat, m); + return CIS_SCAN_STAT_GET_MAJORITY(stat); +} +#endif + +static void cis_scan_stat_init(struct cis_scan_stat_t *stat) +{ + _rtw_init_listhead(&stat->ent); + _rtw_mutex_init(&stat->lock); + stat->ent_num = 0; + CIS_SCAN_STAT_SET_MAJORITY(stat, NULL); +} + +static void cis_scan_stat_deinit(struct cis_scan_stat_t *stat) +{ + cis_scan_stat_clr(stat); + _rtw_mutex_free(&stat->lock); +} + +static void dump_cis_scan_stat(void *sel, struct cis_scan_stat_t *stat) +{ + _list *list, *head; + struct cis_scan_stat_ent *ent; + + _rtw_mutex_lock(&stat->lock); + + head = &stat->ent; + list = get_next(head); + while (!rtw_end_of_queue_search(head, list)) { + ent = LIST_CONTAINOR(list, struct cis_scan_stat_ent, list); + list = get_next(list); + RTW_PRINT_SEL(sel, "%c"ALPHA2_FMT" %u\n" + , stat->majority == ent ? '*' : ' ' + , ALPHA2_ARG(ent->cisr.alpha2), ent->count); + } + + _rtw_mutex_unlock(&stat->lock); +} + void dump_country_ie_slave_records(void *sel, struct rf_ctl_t *rfctl, bool skip_noset) { #define CISR_TITLE_FMT "%-6s %-4s %-4s" @@ -1577,6 +1680,11 @@ void dump_country_ie_slave_records(void *sel, struct rf_ctl_t *rfctl, bool skip_ RTW_PRINT_SEL(sel, "6g_cate_map_int_link_num:%u\n", rfctl->txpwr_lmt_6g_cate_map_int_link_num); RTW_PRINT_SEL(sel, "6g_cate_map_int_all_link:0x%02x\n", rfctl->txpwr_lmt_6g_cate_map_int_all_link); #endif + + if (rfctl->cis_flags & CISF_ENV_BSS) { + RTW_PRINT_SEL(sel, "\nENV_BSS\n"); + dump_cis_scan_stat(sel, &rfctl->cis_scan_stat); + } } #if CONFIG_IEEE80211_BAND_6GHZ @@ -1722,13 +1830,6 @@ void dump_country_chplan_map(void *sel, bool regd_info) struct country_chplan ent; u8 code[2]; -#if RTW_DEF_MODULE_REGULATORY_CERT - RTW_PRINT_SEL(sel, "RTW_DEF_MODULE_REGULATORY_CERT:0x%x\n", RTW_DEF_MODULE_REGULATORY_CERT); -#endif -#ifdef CONFIG_CUSTOMIZED_COUNTRY_CHPLAN_MAP - RTW_PRINT_SEL(sel, "CONFIG_CUSTOMIZED_COUNTRY_CHPLAN_MAP\n"); -#endif - rtw_get_chplan_worldwide(&ent); dump_country_chplan(sel, &ent, regd_info); @@ -1862,20 +1963,146 @@ void dump_chplan_6g_country_list(void *sel) } #endif /* CONFIG_IEEE80211_BAND_6GHZ */ -#ifdef CONFIG_RTW_DEBUG +#ifdef CONFIG_RTW_CHPLAN_DEV +static void dump_chplan_get_ch_2g_search_test(void *sel, u8 id, u8 *ch_array, size_t ch_array_sz, bool content, u32 times) +{ + u8 flags_buf; + u8 *flags = content ? &flags_buf : NULL; + u32 round = times / ch_array_sz; + u32 i, r; + sysptime start, end; + + start = rtw_sptime_get_raw(); + + for (r = 0; r < round; r++) + for (i = 0; i < ch_array_sz; i++) + rtw_chplan_get_ch(id, ch_array[i], flags); + + end = rtw_sptime_get_raw(); + RTW_PRINT_SEL(sel, "2G_CHD times:%10u round:%10u %10lld ns\n", times, round, rtw_sptime_diff_ns(start, end)); +} + +#if CONFIG_IEEE80211_BAND_5GHZ +static void dump_chplan_get_ch_5g_search_test(void *sel, u8 id, u8 *ch_array, size_t ch_array_sz, bool content, u32 times) +{ + u8 flags_buf; + u8 *flags = content ? &flags_buf : NULL; + u32 round = times / ch_array_sz; + u32 i, r; + sysptime start, end; + + start = rtw_sptime_get_raw(); + + for (r = 0; r < round; r++) + for (i = 0; i < ch_array_sz; i++) + rtw_chplan_get_ch(id, ch_array[i], flags); + + end = rtw_sptime_get_raw(); + RTW_PRINT_SEL(sel, "5G_CHD times:%10u round:%10u %10lld ns\n", times, round, rtw_sptime_diff_ns(start, end)); +} +#endif + +#if CONFIG_IEEE80211_BAND_6GHZ +static void dump_chplan_get_ch_6g_search_test(void *sel, u8 id, u8 *ch_array, size_t ch_array_sz, bool content, u32 times) +{ + u8 flags_buf; + u8 *flags = content ? &flags_buf : NULL; + u32 round = times / ch_array_sz; + u32 i, r; + sysptime start, end; + + start = rtw_sptime_get_raw(); + + for (r = 0; r < round; r++) + for (i = 0; i < ch_array_sz; i++) + rtw_chplan_6g_get_ch(id, ch_array[i], flags); + + end = rtw_sptime_get_raw(); + RTW_PRINT_SEL(sel, "6G_CHD times:%10u round:%10u %10lld ns\n", times, round, rtw_sptime_diff_ns(start, end)); +} +#endif + +static const char alpha2_list[][2] = { + "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AN", "AO", "AQ", + "AR", "AS", "AT", "AU", "AW", "AZ", "BA", "BB", "BD", "BE", + "BF", "BG", "BH", "BI", "BJ", "BM", "BN", "BO", "BR", "BS", + "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", + "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CV", "CX", + "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", + "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", + "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", + "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", + "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", + "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", + "KE", "KG", "KH", "KI", "KM", "KN", "KR", "KW", "KY", "KZ", + "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", + "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", + "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", + "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", + "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", + "PG", "PH", "PK", "PL", "PM", "PR", "PS", "PT", "PW", "PY", + "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SE", + "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", + "ST", "SV", "SX", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", + "TK", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", + "UG", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", + "VU", "WF", "WS", "XK", "YE", "YT", "ZA", "ZM", "ZW" +}; + +static void dump_country_chplan_search_test(void *sel, const char cc_array[][2], size_t cc_array_sz, bool content, u32 times) +{ + struct country_chplan ent_buf; + struct country_chplan *ent = content ? &ent_buf : NULL; + u32 round = times / cc_array_sz; + u32 i, r; + sysptime start, end; + + start = rtw_sptime_get_raw(); + + for (r = 0; r < round; r++) + for (i = 0; i < cc_array_sz; i++) + rtw_get_chplan_from_country(cc_array[i], ent); + + end = rtw_sptime_get_raw(); + RTW_PRINT_SEL(sel, "CC_MAP times:%10u round:%10u %10lld ns\n", times, round, rtw_sptime_diff_ns(start, end)); +} + void dump_chplan_test(void *sel) { if (regdb_ops.dump_chplan_test) regdb_ops.dump_chplan_test(sel); + + dump_chplan_get_ch_2g_search_test(sel, 0x7F, center_ch_2g, ARRAY_SIZE(center_ch_2g), false, 100000); + dump_chplan_get_ch_2g_search_test(sel, 0x7F, center_ch_2g, ARRAY_SIZE(center_ch_2g), true, 100000); + dump_chplan_get_ch_2g_search_test(sel, 0x7F, center_ch_2g, 1, false, 100000); + dump_chplan_get_ch_2g_search_test(sel, 0x7F, center_ch_2g, 1, true, 100000); + +#if CONFIG_IEEE80211_BAND_5GHZ + dump_chplan_get_ch_5g_search_test(sel, 0x7F, center_ch_5g_20m, ARRAY_SIZE(center_ch_5g_20m), false, 100000); + dump_chplan_get_ch_5g_search_test(sel, 0x7F, center_ch_5g_20m, ARRAY_SIZE(center_ch_5g_20m), true, 100000); + dump_chplan_get_ch_5g_search_test(sel, 0x7F, center_ch_5g_20m, 1, false, 100000); + dump_chplan_get_ch_5g_search_test(sel, 0x7F, center_ch_5g_20m, 1, true, 100000); +#endif + +#if CONFIG_IEEE80211_BAND_6GHZ + dump_chplan_get_ch_6g_search_test(sel, 0x7F, center_ch_6g_20m, ARRAY_SIZE(center_ch_6g_20m), false, 100000); + dump_chplan_get_ch_6g_search_test(sel, 0x7F, center_ch_6g_20m, ARRAY_SIZE(center_ch_6g_20m), true, 100000); + dump_chplan_get_ch_6g_search_test(sel, 0x7F, center_ch_6g_20m, 1, false, 100000); + dump_chplan_get_ch_6g_search_test(sel, 0x7F, center_ch_6g_20m, 1, true, 100000); +#endif + + dump_country_chplan_search_test(sel, alpha2_list, ARRAY_SIZE(alpha2_list), false, 100000); + dump_country_chplan_search_test(sel, alpha2_list, ARRAY_SIZE(alpha2_list), true, 100000); + dump_country_chplan_search_test(sel, alpha2_list, 1, false, 100000); + dump_country_chplan_search_test(sel, alpha2_list, 1, true, 100000); } -#endif /* CONFIG_RTW_DEBUG */ +#endif /* CONFIG_RTW_CHPLAN_DEV */ void dump_chplan_ver(void *sel) { char buf[CHPLAN_VER_STR_BUF_LEN] = {0}; - if (regdb_ops.get_ver_str) - regdb_ops.get_ver_str(buf, CHPLAN_VER_STR_BUF_LEN); + regdb_ops.get_ver_str(buf, CHPLAN_VER_STR_BUF_LEN); RTW_PRINT_SEL(sel, "%s\n", buf); } @@ -1946,6 +2173,7 @@ void rtw_regd_req_list_free(struct rf_ctl_t *rfctl) rtw_regd_req_free(req); } rfctl->user_req = NULL; + rfctl->extra_req = NULL; rfctl->regd_req_num = 0; _rtw_mutex_unlock(&rfctl->regd_req_mutex); @@ -1953,15 +2181,22 @@ void rtw_regd_req_list_free(struct rf_ctl_t *rfctl) _rtw_mutex_free(&rfctl->regd_req_mutex); } -void rtw_regd_watchdog_hdl(struct dvobj_priv *dvobj) +bool rtw_regd_watchdog_hdl(struct dvobj_priv *dvobj) { struct rf_ctl_t *rfctl = dvobj_to_rfctl(dvobj); + bool ret = false; rtw_beacon_hint_expire(rfctl); #ifdef CONFIG_DFS_MASTER rtw_rfctl_chset_chk_non_ocp_finish(rfctl); #endif + +#ifdef CONFIG_80211D + ret = rtw_cis_scan_needed(rfctl, NULL); +#endif + + return ret; } static enum channel_width rtw_regd_adjust_linking_bw(struct rf_ctl_t *rfctl @@ -2076,6 +2311,41 @@ static void rtw_rfctl_regd_status_init_by_req(struct rf_ctl_t *rfctl, struct reg #endif } +static void rtw_rfctl_regd_status_update_by_req(struct rf_ctl_t *rfctl, struct regd_req_t *req) +{ + if (rfctl->regd_src == REGD_SRC_NUM) { + /* first applied req */ + rtw_rfctl_regd_status_init_by_req(rfctl, req); + + } else if (rfctl->regd_src == req->src || req->inr == RTW_REGD_SET_BY_EXTRA) { + struct country_chplan *chplan = &req->chplan; + + rfctl->regd_inr_bmp |= BIT(req->inr); + #if CONFIG_IEEE80211_BAND_6GHZ + rfctl->env_bmp |= BIT(req->env); + #endif + if (_rtw_memcmp(rfctl->alpha2, chplan->alpha2, 2) != _TRUE + || rfctl->domain_code != chplan->domain_code + #if CONFIG_IEEE80211_BAND_6GHZ + || rfctl->domain_code_6g != chplan->domain_code_6g + #endif + ) + SET_INTERSECTEDC_ALPHA2(rfctl->alpha2); + if (rfctl->domain_code != chplan->domain_code) + rfctl->domain_code = RTW_CHPLAN_UNSPECIFIED; + #if CONFIG_IEEE80211_BAND_6GHZ + if (rfctl->domain_code_6g != chplan->domain_code_6g) + rfctl->domain_code_6g = RTW_CHPLAN_UNSPECIFIED; + #endif + #ifdef CONFIG_CHPLAN_PROTO_EN + rfctl->proto_en &= chplan->proto_en; + #endif + } else { + RTW_WARN("%s req->src:%s != applied src:%s\n", __func__, regd_src_str(req->src), regd_src_str(rfctl->regd_src)); + rtw_warn_on(1); + } +} + #ifdef CONFIG_80211D static bool rtw_rfctl_is_init_user_req_world_wide(struct rf_ctl_t *rfctl) { @@ -2157,7 +2427,7 @@ static void rtw_rfctl_update_default_chplan_cate_6g_map(struct rf_ctl_t *rfctl, /* * Update txpwr_lmt_6g_cate_map for -* a. REGD_SRC_RTK_PRIV's INIT/USER req +* a. REGD_SRC_RTK_PRIV's INIT/USER/EXTRA req * b. REGD_SRC_OS's all req */ static void rtw_rfctl_update_regd_req_txpwr_6g_cate_map(struct rf_ctl_t *rfctl) @@ -2173,8 +2443,8 @@ static void rtw_rfctl_update_regd_req_txpwr_6g_cate_map(struct rf_ctl_t *rfctl) cur = get_next(cur); if (rfctl->regd_src == REGD_SRC_RTK_PRIV) { - /* apply txpwr lmt 6g cate map only for INIT/USER req */ - if (req->inr > RTW_REGD_SET_BY_USER) + /* apply txpwr lmt 6g cate map only for INIT/USER/EXTRA req */ + if (req->inr > RTW_REGD_SET_BY_USER && req->inr != RTW_REGD_SET_BY_EXTRA) continue; } @@ -2191,6 +2461,81 @@ static void rtw_rfctl_update_regd_req_txpwr_6g_cate_map(struct rf_ctl_t *rfctl) #endif #endif /* CONFIG_80211D */ +static bool rtw_rfctl_get_chplan_from_alpha2(struct country_chplan *ent, const char *alpha2) +{ + if (IS_ALPHA2_WORLDWIDE(alpha2) + || rtw_get_chplan_from_country(alpha2, ent) + ) { + if (IS_ALPHA2_WORLDWIDE(alpha2)) + rtw_get_chplan_worldwide(ent); + return true; + } + return false; +} + +static bool rtw_rfctl_update_extra_alpha2_req(struct rf_ctl_t *rfctl, const char *alpha2) +{ + struct country_chplan ent; + + if (rtw_rfctl_get_chplan_from_alpha2(&ent, alpha2)) { + if (!rfctl->extra_req) { + rfctl->extra_req = rtw_regd_req_alloc_with_country_chplan(&ent); + if (!rfctl->extra_req) { + rtw_warn_on(1); + return false; + } + rfctl->extra_req->src = REGD_SRC_RTK_PRIV; + rfctl->extra_req->inr = RTW_REGD_SET_BY_EXTRA; + #if CONFIG_IEEE80211_BAND_6GHZ + rfctl->extra_req->env = RTW_ENV_NUM; + #endif + rtw_regd_req_list_insert(rfctl, rfctl->extra_req); + } else { + if (rfctl->extra_req->chplan.alpha2[0] == ent.alpha2[0] + && rfctl->extra_req->chplan.alpha2[1] == ent.alpha2[1]) + return false; + rfctl->extra_req->chplan = ent; + } + + return true; + + } else if (rfctl->extra_req) { + rtw_regd_req_list_delete(rfctl, rfctl->extra_req); + rtw_regd_req_free(rfctl->extra_req); + rfctl->extra_req = NULL; + return true; + } + + return false; +} + +static bool rtw_rfctl_extra_alpha2_req_needed(struct rf_ctl_t *rfctl) +{ + if (CIS_SCAN_STAT_GET_MAJORITY(&rfctl->cis_scan_stat)) + return false; + + if (rfctl->regd_src == REGD_SRC_RTK_PRIV) { + struct regd_req_t *req, *extra_req = rfctl->extra_req; + _list *cur, *head; + + head = &rfctl->regd_req_list; + cur = get_next(head); + while ((rtw_end_of_queue_search(head, cur)) == _FALSE) { + req = LIST_CONTAINOR(cur, struct regd_req_t, list); + cur = get_next(cur); + + if (!req->applied || req->inr == RTW_REGD_SET_BY_EXTRA) + continue; + + if (IS_ALPHA2_WORLDWIDE(req->chplan.alpha2) + || (req->chplan.alpha2[0] == extra_req->chplan.alpha2[0] + && req->chplan.alpha2[1] == extra_req->chplan.alpha2[1])) + return false; + } + } + return true; +} + /* * Description: * Use hardware(efuse), driver parameter(registry) and default channel plan @@ -2267,12 +2612,8 @@ chk_sw_config: #endif if (sw_alpha2 && !IS_ALPHA2_UNSPEC(sw_alpha2)) { - if (IS_ALPHA2_WORLDWIDE(sw_alpha2) - || rtw_get_chplan_from_country(sw_alpha2, &ent) - ) { + if (rtw_rfctl_get_chplan_from_alpha2(&ent, sw_alpha2)) { /* get chplan from sw country code, by pass sw chplan setting */ - if (IS_ALPHA2_WORLDWIDE(sw_alpha2)) - rtw_get_chplan_worldwide(&ent); country_ent = &ent; chplan = ent.domain_code; #if CONFIG_IEEE80211_BAND_6GHZ @@ -2337,6 +2678,24 @@ done: rtw_regd_req_list_insert(rfctl, &rfctl->init_req); rtw_rfctl_regd_status_init_by_req(rfctl, &rfctl->init_req); + + if (!rfctl->disable_sw_chplan) { + /* handle extra_alpha2 */ + sw_alpha2 = regsty->extra_alpha2; + if (sw_alpha2 && !IS_ALPHA2_UNSPEC(sw_alpha2)) { + bool added = rtw_rfctl_update_extra_alpha2_req(rfctl, sw_alpha2); + + RTW_PRINT("%s%s extra_alpha2:\"%c%c\"\n", __func__ + , added ? "" : " unsupported" + , sw_alpha2[0], sw_alpha2[1]); + + if (added) { + rfctl->extra_req->applied = rtw_rfctl_extra_alpha2_req_needed(rfctl); + if (rfctl->extra_req->applied) + rtw_rfctl_regd_status_update_by_req(rfctl, rfctl->extra_req); + } + } + } } void rtw_rfctl_apply_init_chplan(struct rf_ctl_t *rfctl, bool req_lock) @@ -2501,6 +2860,28 @@ static void rtw_chplan_rtk_priv_req_prehdl_country_ent(struct rf_ctl_t *rfctl, s } } +#ifdef CONFIG_80211D +static u8 get_cis_scan_band_bmp(struct rf_ctl_t *rfctl, u8 band_bmp) +{ + struct rtw_chset *chset = &rfctl->chset; + u8 bmp = 0; + int i; + + for (i = 0; i < BAND_MAX; i++) + if (chset->chs_of_band[i]) + bmp |= BIT(i); + + return bmp & band_bmp; +} + +static u32 get_cis_scan_urgent_ms(u32 int_ms, u32 urgent_ms) +{ + if (int_ms && urgent_ms) + return rtw_max(int_ms, urgent_ms); + return 0; +} +#endif + static void rtw_chplan_rtk_priv_req_prehdl_confs(struct rf_ctl_t *rfctl, struct chplan_confs *confs, const char *caller) { if (confs->set_types & BIT(CHPLAN_CONFS_DIS_CH_FLAGS)) { @@ -2585,6 +2966,18 @@ static void rtw_chplan_rtk_priv_req_prehdl_confs(struct rf_ctl_t *rfctl, struct confs->set_types &= ~BIT(CHPLAN_CONFS_BCN_HINT_VALID_MS); /* setting done here */ } + if (confs->set_types & BIT(CHPLAN_CONFS_EXTRA_ALPHA2)) { + if (!rtw_rfctl_update_extra_alpha2_req(rfctl, confs->extra_alpha2)) + confs->set_types &= ~BIT(CHPLAN_CONFS_EXTRA_ALPHA2); /* setting done here */ + else { + if (rfctl->extra_req) { + RTW_INFO("%s set extra_alpha2 to "ALPHA2_FMT"\n", caller + , ALPHA2_ARG(rfctl->extra_req->chplan.alpha2)); + } else + RTW_INFO("%s clear extra_alpha2\n", caller); + } + } + #ifdef CONFIG_80211D #ifdef CONFIG_REGD_SRC_FROM_OS if (RFCTL_REGD_SRC_FROM_OS(rfctl)) { @@ -2608,6 +3001,8 @@ static void rtw_chplan_rtk_priv_req_prehdl_confs(struct rf_ctl_t *rfctl, struct } if (confs->set_types & BIT(CHPLAN_CONFS_CIS_FLAGS)) { + if (confs->cis_flags & CISF_ENV_BSS_MAJ) + confs->cis_flags |= CISF_ENV_BSS; if (confs->cis_flags & ~CISF_VALIDS) { RTW_WARN("%s cis_flags:0x%02x has undefined bits, apply valid bits only\n", caller, confs->cis_flags); confs->cis_flags &= CISF_VALIDS; @@ -2635,13 +3030,42 @@ static void rtw_chplan_rtk_priv_req_prehdl_confs(struct rf_ctl_t *rfctl, struct confs->set_types &= ~BIT(CHPLAN_CONFS_CIS_EN_IFBMP); /* setting done here */ } + if (confs->set_types & BIT(CHPLAN_CONFS_CIS_SCAN_BAND_BMP)) { + if (rfctl->cis_scan_band_bmp != confs->cis_scan_band_bmp) { + rfctl->cis_scan_band_bmp = get_cis_scan_band_bmp(rfctl, confs->cis_scan_band_bmp); + RTW_INFO("%s set cis_scan_band_bmp to 0x%02x\n", caller, rfctl->cis_scan_band_bmp); + } + confs->set_types &= ~BIT(CHPLAN_CONFS_CIS_SCAN_BAND_BMP); /* setting done here */ + } + if (confs->set_types & BIT(CHPLAN_CONFS_CIS_SCAN_INT_MS)) { if (rfctl->cis_scan_int_ms != confs->cis_scan_int_ms) { + u32 urgent_ms; + rfctl->cis_scan_int_ms = confs->cis_scan_int_ms; RTW_INFO("%s set cis_scan_int_ms to %u\n", caller, confs->cis_scan_int_ms); + + if (confs->set_types & BIT(CHPLAN_CONFS_CIS_SCAN_URGENT_MS)) + urgent_ms = get_cis_scan_urgent_ms(rfctl->cis_scan_int_ms, confs->cis_scan_urgent_ms); + else + urgent_ms = get_cis_scan_urgent_ms(rfctl->cis_scan_int_ms, rfctl->cis_scan_urgent_ms); + + if (rfctl->cis_scan_urgent_ms != urgent_ms) { + rfctl->cis_scan_urgent_ms = urgent_ms; + RTW_INFO("%s set cis_scan_urgent_ms to %u\n", caller, rfctl->cis_scan_urgent_ms); + } + confs->set_types &= ~BIT(CHPLAN_CONFS_CIS_SCAN_URGENT_MS); /* setting done here */ } confs->set_types &= ~BIT(CHPLAN_CONFS_CIS_SCAN_INT_MS); /* setting done here */ } + + if (confs->set_types & BIT(CHPLAN_CONFS_CIS_SCAN_URGENT_MS)) { + if (rfctl->cis_scan_urgent_ms != confs->cis_scan_urgent_ms) { + rfctl->cis_scan_urgent_ms = get_cis_scan_urgent_ms(rfctl->cis_scan_int_ms, confs->cis_scan_urgent_ms); + RTW_INFO("%s set cis_scan_urgent_ms to %u\n", caller, rfctl->cis_scan_urgent_ms); + } + confs->set_types &= ~BIT(CHPLAN_CONFS_CIS_SCAN_URGENT_MS); /* setting done here */ + } #endif } @@ -2752,7 +3176,6 @@ static enum cisr_match rtw_cisr_compare(struct country_ie_slave_record *a, struc #if CONFIG_IEEE80211_BAND_6GHZ static void rtw_rfctl_update_6g_cate_map_int_all_link(struct rf_ctl_t *rfctl) { - struct regd_req_t *user_req = rfctl->user_req; int i, j; u8 bmp; u8 applied_link_num; @@ -2816,7 +3239,6 @@ static bool rtw_chplan_update_per_link_cisr(struct rf_ctl_t *rfctl, u8 iface_id { struct country_ie_slave_record ori_cisr_cont[RTW_RLINK_MAX]; u8 alink_id_s, alink_id_e, alink_id; - int i, j; bool effected = false; if (cisr_alink_id < RTW_RLINK_MAX) { @@ -2954,22 +3376,55 @@ static bool rtw_regd_req_list_add_country_ie_req_from_scanned_network_cisr(_adap _list *list, *head; struct wlan_network *scanned; bool effected = false; + struct cis_scan_stat_t *stat = &rfctl->cis_scan_stat; +#if CONFIG_80211D_ENV_BSS_MAJORITY + struct cis_scan_stat_ent *majority; +#endif + + _rtw_mutex_lock(&stat->lock); _rtw_spinlock_bh(&queue->lock); + /* loop scan queue for stat */ head = get_list_head(queue); list = get_next(head); while (!rtw_end_of_queue_search(head, list)) { scanned = LIST_CONTAINOR(list, struct wlan_network, list); list = get_next(list); - if (scanned->cisr.status != COUNTRY_IE_SLAVE_APPLICABLE) + if (scanned->cisr.status == COUNTRY_IE_SLAVE_NOCOUNTRY + || scanned->cisr.status == COUNTRY_IE_SLAVE_UNKNOWN) continue; - effected |= rtw_regd_req_list_add_country_ie_req(rfctl, &scanned->cisr, false); + + cis_scan_stat_add(stat, &scanned->cisr); + } +#if CONFIG_80211D_ENV_BSS_MAJORITY + majority = cis_scan_stat_update_majority(stat, !(rfctl->cis_flags & CISF_ENV_BSS_MAJ)); + if (majority) { + /* single majority exist, follow */ + effected |= rtw_regd_req_list_add_country_ie_req(rfctl, &majority->cisr, false); + } else +#endif + { + /* follow all ENV BSS */ + head = get_list_head(queue); + list = get_next(head); + while (!rtw_end_of_queue_search(head, list)) { + scanned = LIST_CONTAINOR(list, struct wlan_network, list); + list = get_next(list); + + if (scanned->cisr.status == COUNTRY_IE_SLAVE_NOCOUNTRY + || scanned->cisr.status == COUNTRY_IE_SLAVE_UNKNOWN) + continue; + + effected |= rtw_regd_req_list_add_country_ie_req(rfctl, &scanned->cisr, false); + } } _rtw_spinunlock_bh(&queue->lock); + _rtw_mutex_unlock(&stat->lock); + return effected; } @@ -3045,12 +3500,15 @@ static bool rtw_chplan_rtk_priv_req_prehdl_country_ie(_adapter *adapter, struct } if (rfctl->regd_src == REGD_SRC_RTK_PRIV) { + cis_scan_stat_clr(&rfctl->cis_scan_stat); + rtw_regd_req_list_clear_ref_cnt_by_inr(rfctl, RTW_REGD_SET_BY_COUNTRY_IE); if (rfctl->cis_enabled) { - effected |= rtw_regd_req_list_add_country_ie_req_from_per_link_cisr(rfctl); if (rfctl->cis_flags & CISF_ENV_BSS) effected |= rtw_regd_req_list_add_country_ie_req_from_scanned_network_cisr(adapter); + if (!CIS_SCAN_STAT_GET_MAJORITY(&rfctl->cis_scan_stat)) + effected |= rtw_regd_req_list_add_country_ie_req_from_per_link_cisr(rfctl); } effected |= rtw_regd_req_list_clear_zero_ref_req_by_inr(rfctl, RTW_REGD_SET_BY_COUNTRY_IE); @@ -3242,7 +3700,6 @@ exit: static void rtw_rfctl_regd_req_sel_and_status_update(struct rf_ctl_t *rfctl) { struct regd_req_t *req; - struct country_chplan *chplan; _list *cur, *head; enum regd_src_t applied_src = REGD_SRC_NUM; enum rtw_regd_inr applied_inr = RTW_REGD_SET_BY_NUM; @@ -3253,6 +3710,8 @@ static void rtw_rfctl_regd_req_sel_and_status_update(struct rf_ctl_t *rfctl) while ((rtw_end_of_queue_search(head, cur)) == _FALSE) { req = LIST_CONTAINOR(cur, struct regd_req_t, list); cur = get_next(cur); + if (req->inr == RTW_REGD_SET_BY_EXTRA) + continue; if (applied_src == REGD_SRC_NUM || req->src > applied_src) applied_src = req->src; } @@ -3265,6 +3724,8 @@ static void rtw_rfctl_regd_req_sel_and_status_update(struct rf_ctl_t *rfctl) cur = get_next(cur); if (req->src != applied_src) continue; + if (req->inr == RTW_REGD_SET_BY_EXTRA) + continue; if (applied_inr == RTW_REGD_SET_BY_NUM || req->inr > applied_inr) applied_inr = req->inr; } @@ -3275,6 +3736,8 @@ static void rtw_rfctl_regd_req_sel_and_status_update(struct rf_ctl_t *rfctl) while ((rtw_end_of_queue_search(head, cur)) == _FALSE) { req = LIST_CONTAINOR(cur, struct regd_req_t, list); cur = get_next(cur); + if (req->inr == RTW_REGD_SET_BY_EXTRA) + continue; /* mark req with different src as not applied*/ if (applied_src != req->src) { @@ -3288,36 +3751,13 @@ static void rtw_rfctl_regd_req_sel_and_status_update(struct rf_ctl_t *rfctl) if (!req->applied) continue; - chplan = &req->chplan; - if (rfctl->regd_src == REGD_SRC_NUM) { - /* first applied req */ - rtw_rfctl_regd_status_init_by_req(rfctl, req); + rtw_rfctl_regd_status_update_by_req(rfctl, req); + } - } else if (rfctl->regd_src == req->src) { - rfctl->regd_inr_bmp |= BIT(req->inr); - #if CONFIG_IEEE80211_BAND_6GHZ - rfctl->env_bmp |= BIT(req->env); - #endif - if (_rtw_memcmp(rfctl->alpha2, chplan->alpha2, 2) != _TRUE - || rfctl->domain_code != chplan->domain_code - #if CONFIG_IEEE80211_BAND_6GHZ - || rfctl->domain_code_6g != chplan->domain_code_6g - #endif - ) - SET_INTERSECTEDC_ALPHA2(rfctl->alpha2); - if (rfctl->domain_code != chplan->domain_code) - rfctl->domain_code = RTW_CHPLAN_UNSPECIFIED; - #if CONFIG_IEEE80211_BAND_6GHZ - if (rfctl->domain_code_6g != chplan->domain_code_6g) - rfctl->domain_code_6g = RTW_CHPLAN_UNSPECIFIED; - #endif - #ifdef CONFIG_CHPLAN_PROTO_EN - rfctl->proto_en &= chplan->proto_en; - #endif - } else { - RTW_WARN("%s req->src:%s != applied src:%s\n", __func__, regd_src_str(req->src), regd_src_str(rfctl->regd_src)); - rtw_warn_on(1); - } + if (rfctl->extra_req) { + rfctl->extra_req->applied = rtw_rfctl_extra_alpha2_req_needed(rfctl); + if (rfctl->extra_req->applied) + rtw_rfctl_regd_status_update_by_req(rfctl, rfctl->extra_req); } #ifdef CONFIG_80211D @@ -3689,12 +4129,15 @@ static const char *const chplan_confs_type_str[] = { [CHPLAN_CONFS_EXCL_CHS_6G] = "excl_chs_6g", [CHPLAN_CONFS_INIT_REGD_ALWAYS_APPLY] = "init_regd_always_apply", [CHPLAN_CONFS_USER_REGD_ALWAYS_APPLY] = "user_regd_always_apply", + [CHPLAN_CONFS_EXTRA_ALPHA2] = "extra_alpha2", [CHPLAN_CONFS_BCN_HINT_VALID_MS] = "bcn_hint_valid_ms", [CHPLAN_CONFS_CIS_EN_MODE] = "cis_en_mode", [CHPLAN_CONFS_CIS_FLAGS] = "cis_flags", [CHPLAN_CONFS_CIS_EN_IFBMP] = "cis_en_ifbmp", [CHPLAN_CONFS_CIS_EN_ROLE] = "cis_en_role", + [CHPLAN_CONFS_CIS_SCAN_BAND_BMP] = "cis_scan_band_bmp", [CHPLAN_CONFS_CIS_SCAN_INT_MS] = "cis_scan_int_ms", + [CHPLAN_CONFS_CIS_SCAN_URGENT_MS] = "cis_scan_urgent_ms", }; static enum chplan_confs_type get_chplan_confs_type_from_str(const char *str, size_t str_len) @@ -3779,6 +4222,17 @@ static void rtw_parse_chplan_confs_type_arg_str(struct chplan_confs *confs, enum } } + } else if (type == CHPLAN_CONFS_EXTRA_ALPHA2) { + confs->set_types |= BIT(type); + if (strlen(str)) { + char alpha2[2]; + + if (sscanf(str, "%c%c", &alpha2[0], &alpha2[1]) == 2) { + confs->extra_alpha2[0] = alpha2[0]; + confs->extra_alpha2[1] = alpha2[1]; + } + } + #ifdef CONFIG_80211D } else if (type == CHPLAN_CONFS_CIS_EN_MODE) { if (strlen(str)) { @@ -3820,6 +4274,16 @@ static void rtw_parse_chplan_confs_type_arg_str(struct chplan_confs *confs, enum } } + } else if (type == CHPLAN_CONFS_CIS_SCAN_BAND_BMP) { + if (strlen(str)) { + u8 bmp; + + if (sscanf(str, "%hhx", &bmp) == 1) { + confs->set_types |= BIT(type); + confs->cis_scan_band_bmp = bmp; + } + } + } else if (type == CHPLAN_CONFS_CIS_SCAN_INT_MS) { if (strlen(str)) { u32 ms; @@ -3829,6 +4293,16 @@ static void rtw_parse_chplan_confs_type_arg_str(struct chplan_confs *confs, enum confs->cis_scan_int_ms = ms; } } + + } else if (type == CHPLAN_CONFS_CIS_SCAN_URGENT_MS) { + if (strlen(str)) { + u32 ms; + + if (sscanf(str, "%u", &ms) == 1) { + confs->set_types |= BIT(type); + confs->cis_scan_urgent_ms = ms; + } + } #endif /* CONFIG_80211D */ } @@ -4028,13 +4502,17 @@ u8 rtw_get_chplan_hdl(_adapter *adapter, u8 *pbuf) #endif chplan->confs.init_regd_always_apply = rfctl->init_regd_always_apply; chplan->confs.user_regd_always_apply = rfctl->user_regd_always_apply; + chplan->confs.extra_alpha2[0] = rfctl->extra_req ? rfctl->extra_req->chplan.alpha2[0] : '\0'; + chplan->confs.extra_alpha2[1] = rfctl->extra_req ? rfctl->extra_req->chplan.alpha2[1] : '\0'; chplan->confs.bcn_hint_valid_ms = rfctl->bcn_hint_valid_ms; #ifdef CONFIG_80211D chplan->confs.cis_en_mode = rfctl->cis_en_mode; chplan->confs.cis_flags = rfctl->cis_flags; chplan->confs.cis_en_role = rfctl->cis_en_role; chplan->confs.cis_en_ifbmp = rfctl->cis_en_ifbmp; + chplan->confs.cis_scan_band_bmp = rfctl->cis_scan_band_bmp; chplan->confs.cis_scan_int_ms = rfctl->cis_scan_int_ms; + chplan->confs.cis_scan_urgent_ms = rfctl->cis_scan_urgent_ms; #endif chplan->chs_len = chset->chs_len; @@ -4310,8 +4788,10 @@ void alink_process_regu_ies(struct _ADAPTER_LINK *alink, u8 *ies, uint ies_len) sint country_ie_len = 0; bool country_ie_changed; bool country_str_changed = false; + #if CONFIG_IEEE80211_BAND_6GHZ enum country_ie_slave_6g_reg_info reg_info = CIS_6G_REG_RSVD; bool reg_info_changed = false; + #endif if (rtw_iface_accept_country_ie(adapter)) { country_ie = rtw_get_ie(ies, WLAN_EID_COUNTRY, &country_ie_len, ies_len); @@ -4333,7 +4813,11 @@ void alink_process_regu_ies(struct _ADAPTER_LINK *alink, u8 *ies, uint ies_len) reg_info_changed = rfctl->recv_6g_reg_info[iface_id][alink_id] != reg_info; #endif - if (!country_ie_changed && !reg_info_changed) + if (!country_ie_changed + #if CONFIG_IEEE80211_BAND_6GHZ + && !reg_info_changed + #endif + ) return; if (country_ie_changed) { @@ -4353,7 +4837,9 @@ void alink_process_regu_ies(struct _ADAPTER_LINK *alink, u8 *ies, uint ies_len) #endif if (country_str_changed /* for now only country str is used */ + #if CONFIG_IEEE80211_BAND_6GHZ || reg_info_changed + #endif ) { RTW_INFO(FUNC_ADPT_FMT" id:%u%s%s changed\n", FUNC_ADPT_ARG(adapter), alink_id , country_str_changed ? " country_str" : "" @@ -4483,6 +4969,59 @@ exit: return ret; } +bool rtw_cis_scan_needed(struct rf_ctl_t *rfctl, bool *urgent) +{ + if (rfctl->cis_enabled && (rfctl->cis_flags & CISF_ENV_BSS) + && rfctl->cis_scan_band_bmp + && rfctl->cis_scan_int_ms + && dvobj_get_netif_up_adapter(rfctl_to_dvobj(rfctl)) + ) { + u32 pt = rtw_get_passing_time_ms(rfctl->cis_scan_last_complete_time); + + if (pt >= rfctl->cis_scan_int_ms) { + if (urgent) + *urgent = rfctl->cis_scan_urgent_ms && pt >= rfctl->cis_scan_urgent_ms; + return true; + } + } + return false; +} + +void rtw_cis_scan_idle_check(struct rf_ctl_t *rfctl) +{ + if (rtw_cis_scan_needed(rfctl, NULL)) { + _adapter *adapter = dvobj_get_netif_up_adapter(rfctl_to_dvobj(rfctl)); + struct sitesurvey_parm *parm; + + if (!adapter) + return; + + parm = rtw_malloc(sizeof(*parm)); + if (parm == NULL) + return; + + rtw_init_sitesurvey_parm(parm); + parm->reason = RTW_AUTO_SCAN_REASON_CIS_ENV_BSS; + rtw_auto_scan_ch_list_init(parm, rfctl->cis_scan_band_bmp, RTW_IEEE80211_CHAN_PASSIVE_SCAN); + + rtw_sitesurvey_cmd(adapter, parm); + + rtw_mfree(parm, sizeof(*parm)); + } +} + +void rtw_cis_scan_complete_hdl(_adapter *adapter) +{ + struct rf_ctl_t *rfctl = adapter_to_rfctl(adapter); + + if (rfctl->cis_enabled && (rfctl->cis_flags & CISF_ENV_BSS)) { + rfctl->cis_scan_last_complete_time = rtw_get_current_time(); + + /* 802.11d scan has done complete, trigger regulation selection */ + rtw_apply_scan_network_country_ie_cmd(adapter, RTW_CMDF_DIRECTLY); + } +} + void rtw_rfctl_cis_init(struct rf_ctl_t *rfctl, struct registry_priv *regsty) { #if CONFIG_IEEE80211_BAND_6GHZ @@ -4496,6 +5035,8 @@ void rtw_rfctl_cis_init(struct rf_ctl_t *rfctl, struct registry_priv *regsty) } rfctl->cis_flags = regsty->country_ie_slave_flags; + if (rfctl->cis_flags & CISF_ENV_BSS_MAJ) + rfctl->cis_flags |= CISF_ENV_BSS; if (rfctl->cis_flags & ~CISF_VALIDS) { RTW_WARN("%s cis_flags:0x%02x has undefined bits, apply valid bits only\n", __func__, rfctl->cis_flags); rfctl->cis_flags &= CISF_VALIDS; @@ -4503,7 +5044,12 @@ void rtw_rfctl_cis_init(struct rf_ctl_t *rfctl, struct registry_priv *regsty) rfctl->cis_en_role = regsty->country_ie_slave_en_role; rfctl->cis_en_ifbmp = regsty->country_ie_slave_en_ifbmp; + rfctl->cis_scan_band_bmp = get_cis_scan_band_bmp(rfctl, regsty->country_ie_slave_scan_band_bmp); rfctl->cis_scan_int_ms = regsty->country_ie_slave_scan_int_ms; + rfctl->cis_scan_urgent_ms = get_cis_scan_urgent_ms(rfctl->cis_scan_int_ms, regsty->country_ie_slave_scan_urgent_ms); + rfctl->cis_scan_last_complete_time = rtw_get_current_time() - rtw_ms_to_systime(rfctl->cis_scan_int_ms); + + cis_scan_stat_init(&rfctl->cis_scan_stat); #if CONFIG_IEEE80211_BAND_6GHZ for (i = 0; i < CONFIG_IFACE_NUMBER; i++) { @@ -4519,6 +5065,8 @@ void rtw_rfctl_cis_deinit(struct rf_ctl_t *rfctl) { int i, j; + cis_scan_stat_deinit(&rfctl->cis_scan_stat); + for (i = 0; i < CONFIG_IFACE_NUMBER; i++) for (j = 0; j < RTW_RLINK_MAX; j++) rtw_buf_free(&rfctl->recv_country_ie[i][j], &rfctl->recv_country_ie_len[i][j]); @@ -4556,13 +5104,16 @@ void dump_cur_chplan_confs(void *sel, struct rf_ctl_t *rfctl) #endif RTW_PRINT_SEL(sel, "init_regd_always_apply=%d\n", confs->init_regd_always_apply); RTW_PRINT_SEL(sel, "user_regd_always_apply=%d\n", confs->user_regd_always_apply); + RTW_PRINT_SEL(sel, "extra_alpha2="ALPHA2_FMT"\n", ALPHA2_ARG_EX(confs->extra_alpha2, ' ')); RTW_PRINT_SEL(sel, "bcn_hint_valid_ms=%u\n", confs->bcn_hint_valid_ms); #ifdef CONFIG_80211D RTW_PRINT_SEL(sel, "cis_en_mode=%u\n", confs->cis_en_mode); RTW_PRINT_SEL(sel, "cis_flags=0x%02x\n", confs->cis_flags); RTW_PRINT_SEL(sel, "cis_en_role=0x%02x\n", confs->cis_en_role); RTW_PRINT_SEL(sel, "cis_en_ifbmp=0x%02x\n", confs->cis_en_ifbmp); + RTW_PRINT_SEL(sel, "cis_scan_band_bmp=0x%02x\n", confs->cis_scan_band_bmp); RTW_PRINT_SEL(sel, "cis_scan_int_ms=%u\n", confs->cis_scan_int_ms); + RTW_PRINT_SEL(sel, "cis_scan_urgent_ms=%u\n", confs->cis_scan_urgent_ms); #endif rtw_free_get_chplan_resp(chplan); @@ -4625,7 +5176,6 @@ static void dump_chplan_edcca_modes(void *sel, struct get_chplan_resp *chplan) static void dump_addl_ch_disable_conf(void *sel, struct get_chplan_resp *chplan) { struct chplan_confs *confs = &chplan->confs; - int i; if (confs->dis_ch_flags) { char buf[RTW_CH_FLAGS_STR_LEN]; @@ -4641,10 +5191,6 @@ static void dump_addl_ch_disable_conf(void *sel, struct get_chplan_resp *chplan) } #if CONFIG_IEEE80211_BAND_6GHZ - for (i = 0; i < MAX_CHANNEL_NUM_6G; i++) - if (confs->excl_chs_6g[i] != 0) - break; - if (confs->excl_chs_6g[0] != 0) { char buf[EXCL_CHS_6G_STR_LEN]; diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_chplan.h b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_chplan.h index 0bcd88cb..6204d0d4 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_chplan.h +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_chplan.h @@ -25,6 +25,9 @@ #define RTW_CHPLAN_6G_WORLDWIDE 0x7F #define RTW_CHPLAN_6G_UNSPECIFIED 0xFF +bool rtw_chplan_init(void); +void rtw_chplan_deinit(void); + u8 rtw_chplan_get_default_regd_2g(u8 id); #if CONFIG_IEEE80211_BAND_5GHZ u8 rtw_chplan_get_default_regd_5g(u8 id); @@ -58,7 +61,8 @@ u8 rtw_process_beacon_hint(struct rf_ctl_t *rfctl, struct wlan_network *network) void rtw_beacon_hint_ch_change_notifier(struct rf_ctl_t *rfctl); #define ALPHA2_FMT "%c%c" -#define ALPHA2_ARG(a2) ((is_alpha(a2[0]) || is_decimal(a2[0])) ? a2[0] : '-'), ((is_alpha(a2[1]) || is_decimal(a2[1])) ? a2[1] : '-') +#define ALPHA2_ARG_EX(a2, c) ((is_alpha(a2[0]) || is_decimal(a2[0])) ? a2[0] : c), ((is_alpha(a2[1]) || is_decimal(a2[1])) ? a2[1] : c) +#define ALPHA2_ARG(a2) ALPHA2_ARG_EX(a2, '-') #define WORLDWIDE_ALPHA2 "00" #define UNSPEC_ALPHA2 "99" @@ -74,10 +78,11 @@ enum rtw_regd_inr { RTW_REGD_SET_BY_INIT = 0, RTW_REGD_SET_BY_USER = 1, RTW_REGD_SET_BY_COUNTRY_IE = 2, + RTW_REGD_SET_BY_EXTRA = 3, /* below is not used for REGD_SRC_RTK_PRIV */ - RTW_REGD_SET_BY_DRIVER = 3, - RTW_REGD_SET_BY_CORE = 4, + RTW_REGD_SET_BY_DRIVER = 4, + RTW_REGD_SET_BY_CORE = 5, RTW_REGD_SET_BY_NUM, }; @@ -197,7 +202,7 @@ extern const enum rtw_edcca_mode_t _rtw_regd_to_edcca_mode_6g[RTW_REGD_NUM]; extern const REGULATION_TXPWR_LMT _rtw_regd_to_txpwr_lmt[]; #define rtw_regd_to_txpwr_lmt(regd) (((regd) >= RTW_REGD_NUM) ? TXPWR_LMT_WW : _rtw_regd_to_txpwr_lmt[(regd)]) -#define REGD_INR_BMP_STR_LEN (33) +#define REGD_INR_BMP_STR_LEN (39) char *rtw_get_regd_inr_bmp_str(char *buf, u8 bmp); #define ENV_BMP_STR_LEN (11) @@ -393,10 +398,11 @@ enum country_ie_slave_en_mode { #define CIS_EN_MODE_IS_VALID(mode) ((mode) < CISEM_NUM) enum country_ie_slave_flags { - _CISF_RSVD_0 = BIT0, /* deprecated BIT0 */ - CISF_ENV_BSS = BIT1, /* if not set, consider IEs of associated BSSs only */ + _CISF_RSVD_0 = BIT0, /* deprecated BIT0 */ + CISF_ENV_BSS = BIT1, /* if set, consider IEs of all environment BSSs (not only associated BSSs) */ + CISF_ENV_BSS_MAJ = BIT2, /* if set, consider IEs of all environment BSSs with majority selection */ - CISF_VALIDS = CISF_ENV_BSS, + CISF_VALIDS = (CISF_ENV_BSS | CISF_ENV_BSS_MAJ), }; enum country_ie_slave_6g_reg_info { @@ -433,6 +439,33 @@ struct country_ie_slave_record { struct country_chplan chplan; }; +#ifndef CONFIG_80211D_ENV_BSS_MAJORITY +#define CONFIG_80211D_ENV_BSS_MAJORITY 1 +#endif + +struct cis_scan_stat_ent { + _list list; + struct country_ie_slave_record cisr; + u16 count; +}; + +struct cis_scan_stat_t { + _list ent; + u8 ent_num; +#if CONFIG_80211D_ENV_BSS_MAJORITY + struct cis_scan_stat_ent *majority; +#endif + _mutex lock; +}; + +#if CONFIG_80211D_ENV_BSS_MAJORITY +#define CIS_SCAN_STAT_GET_MAJORITY(stat) (stat)->majority +#define CIS_SCAN_STAT_SET_MAJORITY(stat, m) (stat)->majority = (m) +#else +#define CIS_SCAN_STAT_GET_MAJORITY(stat) NULL +#define CIS_SCAN_STAT_SET_MAJORITY(stat, m) +#endif + #ifdef CONFIG_80211D extern const char _rtw_env_char[]; #define rtw_env_char(e) (((e) >= RTW_ENV_NUM) ? _rtw_env_char[RTW_ENV_ANY] : _rtw_env_char[e]) @@ -449,7 +482,7 @@ void dump_chplan_country_list(void *sel); void dump_chplan_6g_id_list(void *sel); void dump_chplan_6g_country_list(void *sel); #endif -#ifdef CONFIG_RTW_DEBUG +#ifdef CONFIG_RTW_CHPLAN_DEV void dump_chplan_test(void *sel); #endif void dump_chplan_ver(void *sel); @@ -473,7 +506,7 @@ struct regd_req_t { void rtw_regd_req_list_init(struct rf_ctl_t *rfctl, struct registry_priv *regsty); void rtw_regd_req_list_free(struct rf_ctl_t *rfctl); -void rtw_regd_watchdog_hdl(struct dvobj_priv *dvobj); +bool rtw_regd_watchdog_hdl(struct dvobj_priv *dvobj); struct _ADAPTER_LINK; enum channel_width alink_adjust_linking_bw_by_regd(struct _ADAPTER_LINK *alink @@ -502,12 +535,15 @@ enum chplan_confs_type { CHPLAN_CONFS_EXCL_CHS_6G, CHPLAN_CONFS_INIT_REGD_ALWAYS_APPLY, CHPLAN_CONFS_USER_REGD_ALWAYS_APPLY, + CHPLAN_CONFS_EXTRA_ALPHA2, CHPLAN_CONFS_BCN_HINT_VALID_MS, CHPLAN_CONFS_CIS_EN_MODE, CHPLAN_CONFS_CIS_FLAGS, CHPLAN_CONFS_CIS_EN_ROLE, CHPLAN_CONFS_CIS_EN_IFBMP, + CHPLAN_CONFS_CIS_SCAN_BAND_BMP, CHPLAN_CONFS_CIS_SCAN_INT_MS, + CHPLAN_CONFS_CIS_SCAN_URGENT_MS, CHPLAN_CONFS_NUM, }; @@ -520,13 +556,16 @@ struct chplan_confs { #endif bool init_regd_always_apply; bool user_regd_always_apply; + char extra_alpha2[2]; u32 bcn_hint_valid_ms; #ifdef CONFIG_80211D u8 cis_en_mode; u8 cis_flags; u8 cis_en_role; u8 cis_en_ifbmp; + u8 cis_scan_band_bmp; u32 cis_scan_int_ms; + u32 cis_scan_urgent_ms; #endif }; @@ -614,7 +653,7 @@ struct get_chplan_resp { struct chplan_confs confs; u8 chs_len; - RT_CHANNEL_INFO chs[0]; + RT_CHANNEL_INFO chs[]; }; struct get_channel_plan_param { @@ -644,6 +683,9 @@ void process_regu_ies(_adapter *adapter, u8 *ies, uint ies_len); bool rtw_update_scanned_network_cisr(struct rf_ctl_t *rfctl, struct wlan_network *network); bool rtw_network_chk_regu_ies(struct rf_ctl_t *rfctl, struct wlan_network *network); +bool rtw_cis_scan_needed(struct rf_ctl_t *rfctl, bool *urgent); +void rtw_cis_scan_idle_check(struct rf_ctl_t *rfctl); +void rtw_cis_scan_complete_hdl(_adapter *adapter); void rtw_rfctl_cis_init(struct rf_ctl_t *rfctl, struct registry_priv *regsty); void rtw_rfctl_cis_deinit(struct rf_ctl_t *rfctl); #else @@ -659,27 +701,4 @@ void dump_cur_env(void *sel, struct rf_ctl_t *rfctl); #endif #endif /* CONFIG_PROC_DEBUG */ -#define CHPLAN_VER_STR_BUF_LEN 64 - -struct rtw_regdb_ops { - u8 (*get_default_regd_2g)(u8 id); -#if CONFIG_IEEE80211_BAND_5GHZ - u8 (*get_default_regd_5g)(u8 id); -#endif - bool (*is_domain_code_valid)(u8 id); - bool (*domain_get_ch)(u8 id, u32 ch, u8 *flags); -#if CONFIG_IEEE80211_BAND_6GHZ - u8 (*get_default_regd_6g)(u8 id); - bool (*is_domain_code_6g_valid)(u8 id); - bool (*domain_6g_get_ch)(u8 id, u32 ch, u8 *flags); -#endif - - bool (*get_chplan_from_alpha2)(const char *alpha2, struct country_chplan *ent); - -#ifdef CONFIG_RTW_DEBUG - void (*dump_chplan_test)(void *sel); -#endif - void (*get_ver_str)(char *buf, size_t buf_len); -}; - #endif /* __RTW_CHPLAN_H__ */ diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_chset.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_chset.c index 2cd409f4..4b7d1d7c 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_chset.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_chset.c @@ -119,6 +119,11 @@ RTW_FUNC_2G_5G_ONLY int rtw_chset_search_ch(const struct rtw_chset *chset, u32 c { return _rtw_chset_search_ch(chset, ch, false); } + +RTW_FUNC_2G_5G_ONLY int rtw_chset_search_ch_include_dis(const struct rtw_chset *chset, u32 ch) +{ + return _rtw_chset_search_ch(chset, ch, true); +} #endif /* @@ -150,6 +155,11 @@ int rtw_chset_search_bch(const struct rtw_chset *chset, enum band_type band, u32 return _rtw_chset_search_bch(chset, band, ch, false); } +int rtw_chset_search_bch_include_dis(const struct rtw_chset *chset, enum band_type band, u32 ch) +{ + return _rtw_chset_search_bch(chset, band, ch, true); +} + RT_CHANNEL_INFO *rtw_chset_get_chinfo_by_bch(struct rtw_chset *chset, enum band_type band, u32 ch, bool include_dis) { int i = _rtw_chset_search_bch(chset, band, ch, include_dis); diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_chset.h b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_chset.h index 1e253b07..17405ed9 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_chset.h +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_chset.h @@ -93,11 +93,13 @@ struct rtw_chset { int rtw_chset_init(struct rtw_chset *chset, u8 band_bmp); RTW_FUNC_2G_5G_ONLY int rtw_chset_search_ch(const struct rtw_chset *chset, u32 ch); +RTW_FUNC_2G_5G_ONLY int rtw_chset_search_ch_include_dis(const struct rtw_chset *chset, u32 ch); RTW_FUNC_2G_5G_ONLY u8 rtw_chset_is_chbw_valid(const struct rtw_chset *chset, u8 ch, u8 bw, u8 offset , bool allow_primary_passive, bool allow_passive); RTW_FUNC_2G_5G_ONLY void rtw_chset_sync_chbw(const struct rtw_chset *chset, u8 *req_ch, u8 *req_bw, u8 *req_offset , u8 *g_ch, u8 *g_bw, u8 *g_offset, bool allow_primary_passive, bool allow_passive); int rtw_chset_search_bch(const struct rtw_chset *chset, enum band_type band, u32 ch); +int rtw_chset_search_bch_include_dis(const struct rtw_chset *chset, enum band_type band, u32 ch); RT_CHANNEL_INFO *rtw_chset_get_chinfo_by_bch(struct rtw_chset *chset, enum band_type band, u32 ch, bool include_dis); u8 rtw_chset_is_bchbw_valid(const struct rtw_chset *chset, enum band_type band, u8 ch, u8 bw, u8 offset , bool allow_primary_passive, bool allow_passive); diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_cmd.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_cmd.c index 87a16b3b..0218e1d7 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_cmd.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_cmd.c @@ -5090,6 +5090,11 @@ u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf) issue_beacon(padapter, 0); break; #endif +#endif +#ifdef CONFIG_BTC + case CORE_BTC_CID: + ret = rtw_core_btc_hdl(padapter, (enum rtw_core_btc_cmd_id)pdrvextra_cmd->type); + break; #endif default: break; diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_debug.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_debug.c index 12e82243..3e0ba889 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_debug.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_debug.c @@ -115,7 +115,6 @@ void dump_drv_cfg(void *sel) RTW_PRINT_SEL(sel, "CONFIG_CALIBRATE_TX_POWER_TO_MAX\n"); #endif #endif - 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); @@ -1084,8 +1083,13 @@ int proc_get_roam_flags(struct seq_file *m, void *v) { struct net_device *dev = m->private; _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); + int i; + char str[4], *band = adapter->mlmepriv.roam_scan_order; - RTW_PRINT_SEL(m, "0x%02x\n", rtw_roam_flags(adapter)); + for (i = 0; i < sizeof(str); i++) + str[i] = (band[i]==BAND_ON_24G)?'2':(band[i]==BAND_ON_5G)?'5':(band[i]==BAND_ON_6G)?'6':0; + + RTW_PRINT_SEL(m, "0x%04x, order:%s\n", rtw_roam_flags(adapter), str); return 0; } @@ -1095,8 +1099,9 @@ ssize_t proc_set_roam_flags(struct file *file, const char __user *buffer, size_t struct net_device *dev = data; _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); - char tmp[32]; - u8 flags; + char tmp[32], str[8]; + int num, i = 0; + u16 flags; if (count < 1) return -EFAULT; @@ -1108,28 +1113,44 @@ ssize_t proc_set_roam_flags(struct file *file, const char __user *buffer, size_t if (buffer && !copy_from_user(tmp, buffer, count)) { - int num = sscanf(tmp, "%hhx", &flags); + num = sscanf(tmp, "%hx %d", &flags, &i); - if (num == 1) + if (num >= 1) rtw_assign_roam_flags(adapter, flags); + + if (num >= 2 && i > 0) { + sprintf(str, "%d", i); + for (i = 0; i < sizeof(adapter->mlmepriv.roam_scan_order); i++) + adapter->mlmepriv.roam_scan_order[i] = \ + (str[i]=='2') ? BAND_ON_24G: \ + (str[i]=='5') ? BAND_ON_5G: \ + (str[i]=='6') ? BAND_ON_6G:BAND_MAX; + } } - return count; - } +#ifdef PRIVATE_N int proc_get_roam_param(struct seq_file *m, void *v) { struct net_device *dev = m->private; _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); struct mlme_priv *mlme = &adapter->mlmepriv; - RTW_PRINT_SEL(m, "%12s %15s %26s %16s\n", "rssi_diff_th", "scanr_exp_ms", "scan_interval(unit:2 sec)", "rssi_threshold"); - RTW_PRINT_SEL(m, "%-15u %-13u %-27u %-11u\n" - , mlme->roam_rssi_diff_th + RTW_PRINT_SEL(m, "%14s %16s %13s %21s %13s %13s\n" + , "idle_rssi_delta" + , "busy_rssi_delta" + , "scanr_exp_ms" + , "scan_int(unit:2 sec)" + , "idle_rssi_th" + , "busy_rssi_th"); + RTW_PRINT_SEL(m, "%-16u %-16u %-13u %-21u %-13u %-13u\n" + , mlme->roam_idle_rssi_delta + , mlme->roam_busy_rssi_delta , mlme->roam_scanr_exp_ms , mlme->roam_scan_int - , mlme->roam_rssi_threshold + , mlme->roam_idle_rssi_th + , mlme->roam_busy_rssi_th ); return 0; @@ -1142,7 +1163,74 @@ ssize_t proc_set_roam_param(struct file *file, const char __user *buffer, size_t struct mlme_priv *mlme = &adapter->mlmepriv; char tmp[32]; - u8 rssi_diff_th; + u8 idle_rssi_delta; + u8 busy_rssi_delta; + u32 scanr_exp_ms; + u32 scan_int; + u8 idle_rssi_th; + u8 busy_rssi_th; + + if (count < 1) + return -EFAULT; + + if (count > sizeof(tmp)) { + rtw_warn_on(1); + return -EFAULT; + } + + if (buffer && !copy_from_user(tmp, buffer, count)) { + + int num = sscanf(tmp, "%hhu %hhu %u %u %hhu %hhu" + , &idle_rssi_delta + , &busy_rssi_delta + , &scanr_exp_ms + , &scan_int + , &idle_rssi_th + , &busy_rssi_th); + + if (num >= 1) + mlme->roam_idle_rssi_delta = idle_rssi_delta; + if (num >= 2) + mlme->roam_busy_rssi_delta = busy_rssi_delta; + if (num >= 3) + mlme->roam_scanr_exp_ms = scanr_exp_ms; + if (num >= 4) + mlme->roam_scan_int = scan_int; + if (num >= 5) + mlme->roam_idle_rssi_th = idle_rssi_th; + if (num >= 6) + mlme->roam_busy_rssi_th = busy_rssi_th; + } + + return count; + +} +#else +int proc_get_roam_param(struct seq_file *m, void *v) +{ + struct net_device *dev = m->private; + _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); + struct mlme_priv *mlme = &adapter->mlmepriv; + + RTW_PRINT_SEL(m, "%12s %15s %26s %16s\n", "rssi_diff_th", "scanr_exp_ms", "scan_interval(unit:2 sec)", "rssi_threshold"); + RTW_PRINT_SEL(m, "%-15u %-13u %-27u %-11u\n" + , mlme->roam_rssi_delta + , mlme->roam_scanr_exp_ms + , mlme->roam_scan_int + , mlme->roam_rssi_th + ); + + return 0; +} + +ssize_t proc_set_roam_param(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) +{ + struct net_device *dev = data; + _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); + struct mlme_priv *mlme = &adapter->mlmepriv; + + char tmp[32]; + u8 rssi_delta; u32 scanr_exp_ms; u32 scan_int; u8 rssi_threshold; @@ -1157,21 +1245,22 @@ ssize_t proc_set_roam_param(struct file *file, const char __user *buffer, size_t if (buffer && !copy_from_user(tmp, buffer, count)) { - int num = sscanf(tmp, "%hhu %u %u %hhu", &rssi_diff_th, &scanr_exp_ms, &scan_int, &rssi_threshold); + int num = sscanf(tmp, "%hhu %u %u %hhu", &rssi_delta, &scanr_exp_ms, &scan_int, &rssi_threshold); if (num >= 1) - mlme->roam_rssi_diff_th = rssi_diff_th; + mlme->roam_rssi_delta = rssi_delta; if (num >= 2) mlme->roam_scanr_exp_ms = scanr_exp_ms; if (num >= 3) mlme->roam_scan_int = scan_int; if (num >= 4) - mlme->roam_rssi_threshold = rssi_threshold; + mlme->roam_rssi_th = rssi_threshold; } return count; } +#endif ssize_t proc_set_roam_tgt_addr(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) { @@ -1256,8 +1345,12 @@ int proc_get_scan_param(struct seq_file *m, void *v) struct mlme_ext_priv *mlmeext = &adapter->mlmeextpriv; struct ss_res *ss = &mlmeext->sitesurvey_res; -#define SCAN_PARAM_TITLE_FMT "%10s" -#define SCAN_PARAM_VALUE_FMT "%-10u" +#define SCAN_PARAM_TITLE_FMT_2040BSS "%12s" +#define SCAN_PARAM_VALUE_FMT_2040BSS "%-12u" +#define SCAN_PARAM_TITLE_ARG_2040BSS , "scan_2040bss" +#define SCAN_PARAM_VALUE_ARG_2040BSS , ss->scan_2040bss +#define SCAN_PARAM_TITLE_FMT " %10s" +#define SCAN_PARAM_VALUE_FMT " %-10u" #define SCAN_PARAM_TITLE_ARG , "scan_ch_ms" #define SCAN_PARAM_VALUE_ARG , ss->scan_ch_ms #ifdef CONFIG_80211N_HT @@ -1284,20 +1377,24 @@ int proc_get_scan_param(struct seq_file *m, void *v) #endif RTW_PRINT_SEL(m, + SCAN_PARAM_TITLE_FMT_2040BSS SCAN_PARAM_TITLE_FMT SCAN_PARAM_TITLE_FMT_HT SCAN_PARAM_TITLE_FMT_BACKOP "\n" + SCAN_PARAM_TITLE_ARG_2040BSS SCAN_PARAM_TITLE_ARG SCAN_PARAM_TITLE_ARG_HT SCAN_PARAM_TITLE_ARG_BACKOP ); RTW_PRINT_SEL(m, + SCAN_PARAM_VALUE_FMT_2040BSS SCAN_PARAM_VALUE_FMT SCAN_PARAM_VALUE_FMT_HT SCAN_PARAM_VALUE_FMT_BACKOP "\n" + SCAN_PARAM_VALUE_ARG_2040BSS SCAN_PARAM_VALUE_ARG SCAN_PARAM_VALUE_ARG_HT SCAN_PARAM_VALUE_ARG_BACKOP @@ -1316,7 +1413,10 @@ ssize_t proc_set_scan_param(struct file *file, const char __user *buffer, size_t char tmp[32] = {0}; u16 scan_ch_ms; -#define SCAN_PARAM_INPUT_FMT "%hu" + u8 scan_2040bss; +#define SCAN_PARAM_INPUT_FMT_2040BSS "%hhu" +#define SCAN_PARAM_INPUT_ARG_2040BSS , &scan_2040bss +#define SCAN_PARAM_INPUT_FMT " %hu" #define SCAN_PARAM_INPUT_ARG , &scan_ch_ms #ifdef CONFIG_80211N_HT u8 rx_ampdu_accept; @@ -1348,14 +1448,18 @@ ssize_t proc_set_scan_param(struct file *file, const char __user *buffer, size_t if (buffer && !copy_from_user(tmp, buffer, count)) { int num = sscanf(tmp, + SCAN_PARAM_INPUT_FMT_2040BSS SCAN_PARAM_INPUT_FMT SCAN_PARAM_INPUT_FMT_HT SCAN_PARAM_INPUT_FMT_BACKOP + SCAN_PARAM_INPUT_ARG_2040BSS SCAN_PARAM_INPUT_ARG SCAN_PARAM_INPUT_ARG_HT SCAN_PARAM_INPUT_ARG_BACKOP ); + if (num-- > 0) + ss->scan_2040bss = scan_2040bss; if (num-- > 0) ss->scan_ch_ms = scan_ch_ms; #ifdef CONFIG_80211N_HT @@ -1453,7 +1557,6 @@ ssize_t proc_set_survey_info(struct file *file, const char __user *buffer, size_ acs = 1; } -#if 1 ssc_chk = rtw_sitesurvey_condition_check(padapter, _FALSE); if (ssc_chk != SS_ALLOW) goto exit; @@ -1462,45 +1565,6 @@ ssize_t proc_set_survey_info(struct file *file, const char __user *buffer, size_ RTW_INFO("scan abort!! adapter cannot use\n"); goto exit; } -#else -#ifdef CONFIG_MP_INCLUDED - if (rtw_mp_mode_check(padapter)) { - RTW_INFO("MP mode block Scan request\n"); - goto exit; - } -#endif - if (rtw_is_scan_deny(padapter)) { - RTW_INFO(FUNC_ADPT_FMT ": scan deny\n", FUNC_ADPT_ARG(padapter)); - goto exit; - } - - if (!rtw_is_adapter_up(padapter)) { - RTW_INFO("scan abort!! adapter cannot use\n"); - goto exit; - } - - if (rtw_mi_busy_traffic_check(padapter)) { - RTW_INFO("scan abort!! BusyTraffic == _TRUE\n"); - goto exit; - } - - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) && check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) { - RTW_INFO("scan abort!! AP mode process WPS\n"); - goto exit; - } - if (check_fwstate(pmlmepriv, WIFI_UNDER_SURVEY | WIFI_UNDER_LINKING) == _TRUE) { - RTW_INFO("scan abort!! fwstate=0x%x\n", pmlmepriv->fw_state); - goto exit; - } - -#ifdef CONFIG_CONCURRENT_MODE - if (rtw_mi_buddy_check_fwstate(padapter, - WIFI_UNDER_SURVEY | WIFI_UNDER_LINKING | WIFI_UNDER_WPS)) { - RTW_INFO("scan abort!! buddy_fwstate check failed\n"); - goto exit; - } -#endif -#endif if (acs) { #ifdef CONFIG_RTW_ACS @@ -1693,7 +1757,9 @@ int proc_get_ap_info(struct seq_file *m, void *v) 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->phl_sta->mac_addr)); RTW_PRINT_SEL(m, "Max Bit Rate=%u (Mbps)\n", mbps); - RTW_PRINT_SEL(m, "cur_channel=%d, cur_bwmode=%d(%s), cur_ch_offset=%d\n", pmlmeext->chandef.chan, pmlmeext->chandef.bw, ch_width_str(pmlmeext->chandef.bw), pmlmeext->chandef.offset); + RTW_PRINT_SEL(m, "cur_channel=%d-%s, cur_bwmode=%d(%s), cur_ch_offset=%d\n", + pmlmeext->chandef.chan, rtw_band_str(pmlmeext->chandef.band), + pmlmeext->chandef.bw, ch_width_str(pmlmeext->chandef.bw), pmlmeext->chandef.offset); RTW_PRINT_SEL(m, "wireless_mode=0x%x(%s), rtsen=%d, cts2slef=%d hw_rts_en=%d\n", psta->phl_sta->wmode, wl_mode, psta->rtsen, psta->cts2self, psta->hw_rts_en); /* ToDo: need API to query hal_sta->ra_info.rate_id */ @@ -3412,6 +3478,51 @@ ssize_t proc_set_tx_amsdu_rate(struct file *file, const char __user *buffer, siz return count; } #endif /* CONFIG_TX_AMSDU */ + +int proc_get_tx_max_agg_time(struct seq_file *m, void *v) +{ + struct net_device *dev = m->private; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + + if (padapter) + { + RTW_PRINT_SEL(m, "max agg time = 0x%x\n", pxmitpriv->max_agg_time); + } + + return 0; +} + +ssize_t proc_set_tx_max_agg_time(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); + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + char tmp[32]; + u16 agg_t; + + if (count < 1) + return -EFAULT; + + if (count > sizeof(tmp)) { + rtw_warn_on(1); + return -EFAULT; + } + + if (buffer && !copy_from_user(tmp, buffer, count)) { + + int num = sscanf(tmp, "%hx ", &agg_t); + + if (padapter && (num == 1)) { + RTW_INFO("max_agg_time = 0x%x\n", agg_t); + + pxmitpriv->max_agg_time = agg_t; + } + } + + return count; +} + #endif /* CONFIG_80211N_HT */ #ifdef CONFIG_80211AC_VHT diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_dfs.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_dfs.c index cfafa65f..ef80d620 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_dfs.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_dfs.c @@ -138,7 +138,6 @@ bool rtw_rfctl_overlap_radar_detect_ch(struct rf_ctl_t *rfctl, enum band_type ba bool ret = false; u8 rd_hwband; u32 hi = 0, lo = 0; - u32 r_hi = 0, r_lo = 0; if (band != BAND_ON_5G || !rfctl->radar_detect_enabled) goto exit; @@ -443,32 +442,39 @@ static bool rtw_rfctl_chset_chk_non_ocp_finish_for_bchbw(struct rf_ctl_t *rfctl, { struct rtw_chset *chset = &rfctl->chset; RT_CHANNEL_INFO *chinfo; + s8 ch_idx[8]; /* 5G non_ocp up to 160MHz */ u8 cch; u8 *op_chs; u8 op_ch_num; int i; - bool ret = 0; + bool ret = false; cch = rtw_get_center_ch_by_band(band, ch, bw, offset); if (!rtw_get_op_chs_by_bcch_bw(band, cch, bw, &op_chs, &op_ch_num)) goto exit; + if (op_ch_num > ARRAY_SIZE(ch_idx)) { + rtw_warn_on(1); + goto exit; + } + for (i = 0; i < op_ch_num; i++) { if (0) RTW_INFO("%u,%u,%u,%u - cch:%u, bw:%u, op_ch:%u\n", band, ch, bw, offset, cch, bw, *(op_chs + i)); - chinfo = rtw_chset_get_chinfo_by_bch(chset, band, *(op_chs + i), true); - if (!chinfo) + ch_idx[i] = rtw_chset_search_bch_include_dis(chset, band, *(op_chs + i)); + if (ch_idx[i] < 0) break; + chinfo = &chset->chs[ch_idx[i]]; if (CH_IS_NON_OCP_STOPPED(chinfo) || CH_IS_NON_OCP(chinfo)) break; } if (op_ch_num != 0 && i == op_ch_num) { - ret = 1; + ret = true; /* set to RTW_NON_OCP_STOPPED */ for (i = 0; i < op_ch_num; i++) { - chinfo = rtw_chset_get_chinfo_by_bch(chset, band, *(op_chs + i), true); + chinfo = &chset->chs[ch_idx[i]]; chinfo->non_ocp_end_time = RTW_NON_OCP_STOPPED; } for (i = HW_BAND_0; i < HW_BAND_MAX; i++) /* single chset shared by all hwband */ @@ -636,7 +642,6 @@ static void rtw_dfs_ch_switch_hdl(struct dvobj_priv *dvobj, u8 band_idx) _adapter *m_iface = rtw_mi_get_ap_mesh_iface_by_hwband(dvobj, band_idx); u8 ifbmp_m; u8 ifbmp_s; - u8 i; if (!m_iface) { RTW_WARN(FUNC_HWBAND_FMT" can't get ap/mesh iface\n", FUNC_HWBAND_ARG(band_idx)); diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_fsm.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_fsm.c index 866b8002..d80b8646 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_fsm.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_fsm.c @@ -925,21 +925,33 @@ void fsm_deactivate_obj(struct fsm_obj *obj) fsm_gen_msg(obj, NULL, 0, FSM_EV_DEL_OBJ); } +#if 0 bool fsm_is_alarm_off_ext(struct fsm_obj *obj, u8 id) { struct fsm_clocks *clocks = obj->clocks; struct fsm_clk *clk = &clocks->clk[id]; + bool is_clk_off; - return IS_CLK_OFF(clk); + _rtw_spinunlock_bh(&obj->fsm->clk_queue.lock); + is_clk_off = IS_CLK_OFF(clk); + _rtw_spinunlock_bh(&obj->fsm->clk_queue.lock); + + return is_clk_off; } bool fsm_is_alarm_off(struct fsm_obj *obj) { struct fsm_clocks *clocks = obj->clocks; struct fsm_clk *clk = &clocks->clk[0]; + bool is_clk_off; - return IS_CLK_OFF(clk); + _rtw_spinunlock_bh(&obj->fsm->clk_queue.lock); + is_clk_off = IS_CLK_OFF(clk); + _rtw_spinunlock_bh(&obj->fsm->clk_queue.lock); + + return is_clk_off; } +#endif static void _fsm_set_alarm(struct fsm_obj *obj, int ms, u16 event, u8 id, void *priv) @@ -981,6 +993,7 @@ static void _fsm_set_alarm(struct fsm_obj *obj, int ms, * remain time does not less than 'ms' * @id: alarm id; start from 1 */ +#if 0 void fsm_extend_alarm_ext(struct fsm_obj *obj, int ms, u8 id) { @@ -1000,6 +1013,7 @@ void fsm_extend_alarm_ext(struct fsm_obj *obj, int ms, u8 id) remain = MAX((int)rtw_fsm_time_left(clk->start, clk->end), ms); fsm_set_alarm_ext(obj, remain, clk->event, id, clk->priv); } +#endif /* For EXTERNAL application to setup alarm (expose) * @@ -1086,6 +1100,7 @@ static void _fsm_pause_alarm(struct fsm_obj *obj, u8 id) * * @obj: obj param when calling FSM framework function */ +#if 0 void fsm_pause_alarm(struct fsm_obj *obj) { _fsm_pause_alarm(obj, 0); @@ -1104,6 +1119,7 @@ void fsm_pause_alarm_ext(struct fsm_obj *obj, u8 id) } _fsm_pause_alarm(obj, id); } +#endif static void _fsm_resume_alarm(struct fsm_obj *obj, u8 id) { @@ -1122,6 +1138,7 @@ static void _fsm_resume_alarm(struct fsm_obj *obj, u8 id) * * @obj: obj param when calling FSM framework function */ +#if 0 void fsm_resume_alarm(struct fsm_obj *obj) { _fsm_resume_alarm(obj, 0); @@ -1141,6 +1158,7 @@ void fsm_resume_alarm_ext(struct fsm_obj *obj, u8 id) } _fsm_resume_alarm(obj, id); } +#endif /* For EXTERNAL application to change state (expose) * diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_fsm_rrm.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_fsm_rrm.c index dc51b5bc..a06e3d77 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_fsm_rrm.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_fsm_rrm.c @@ -34,13 +34,19 @@ #define DBG_BCN_REQ_SSID 0 #define DBG_BCN_REQ_SSID_NAME "RealKungFu" -#define RM_REQ_TIMEOUT 10000 /* 10 seconds */ -#define RM_MEAS_TIMEOUT 2000 /* 2 seconds */ +#define RM_REQ_TIMEOUT 5000 /* 5 seconds */ +#if CONFIG_IEEE80211_BAND_6GHZ +#define RM_MEAS_TIMEOUT 15000 /* 15 seconds */ +#else +#define RM_MEAS_TIMEOUT 10000 /* 10 seconds */ +#endif #define RM_REPT_SCAN_INTVL 5000 /* 5 seconds */ #define RM_REPT_POLL_INTVL 2000 /* 2 seconds */ #define RM_COND_INTVL 2000 /* 2 seconds */ #define RM_BUSY_TRAFFIC_TIMES 2 #define RM_WAIT_BUSY_TIMEOUT 2000 /* 1 seconds */ +#define RM_NB_REP_VALID_TIME 10000 /* 10 seconds */ + #define MEAS_REP_MOD_LATE BIT(0) #define MEAS_REP_MOD_INCAP BIT(1) @@ -331,6 +337,7 @@ struct rm_meas_req { u8 ch_num; u16 rand_intvl; /* units of TU */ u16 meas_dur; /* units of TU */ + u8 s_mode; u8 bssid[6]; /* for bcn_req */ @@ -403,10 +410,10 @@ struct rrm_obj { _list list; }; +static void rrm_upd_nb_ch_list(struct rrm_obj *prm, struct rrm_nb_rpt *pnb_rpt); /* * rrm sub function */ - void rrm_update_cap(u8 *frame_head, _adapter *pa, u32 pktlen, int offset) { u8 *res; @@ -631,6 +638,11 @@ static u8 rm_get_ch_set_from_bcn_req_opt(struct rrm_obj *prm, struct bcn_req_opt ap_ch_rpt = opt->ap_ch_rpt[i]; band = rtw_get_band_by_op_class(ap_ch_rpt->global_op_class); + if (band >= BAND_MAX) { + FSM_WARN(prm, "%s: skip unknown opc:%d\n", __func__, ap_ch_rpt->global_op_class); + continue; + } + if ((k + ap_ch_rpt->Len) > pch_num) { RTW_ERR("rrm: ch num exceed %d > %d\n", (k + ap_ch_rpt->Len), pch_num); return k; @@ -745,7 +757,7 @@ static u8 rrm_gen_dialog_token(_adapter *padapter) do { pmlmeinfo->dialogToken++; - } while (pmlmeinfo->dialogToken == 0); + } while (pmlmeinfo->dialogToken == 0); /* Valid range : 1-255*/ return pmlmeinfo->dialogToken; } @@ -1178,7 +1190,7 @@ static int rrm_sitesurvey(struct rrm_obj *prm) _rtw_memcpy(&parm->ssid[0], &prm->q.opt.bcn.ssid, IW_ESSID_MAX_SIZE); parm->ssid_num = 1; - parm->scan_mode = prm->q.m_mode; + parm->scan_mode = prm->q.s_mode; parm->ch_num = meas_ch_amount; parm->duration = prm->q.meas_dur; parm->scan_type = RTW_SCAN_RRM; @@ -1406,7 +1418,13 @@ static int rrm_parse_meas_req(struct rrm_obj *prm, u8 *pbody) prm->q.op_class = pbody[p++]; prm->q.ch_num = pbody[p++]; - prm->q.band = rtw_get_band_by_op_class(prm->q.op_class); + prm->q.band = (prm->q.op_class)?rtw_get_band_by_op_class(prm->q.op_class):BAND_MAX; + + if (prm->q.band >= BAND_MAX) { + FSM_WARN(prm, "%s: unknown opc:%d\n", __func__, prm->q.op_class); + return _FAIL; + } + prm->q.rand_intvl = le16_to_cpu(*(u16*)(&pbody[p])); p+=2; prm->q.meas_dur = le16_to_cpu(*(u16*)(&pbody[p])); @@ -1418,7 +1436,7 @@ static int rrm_parse_meas_req(struct rrm_obj *prm, u8 *pbody) * 1: active * 2: bcn_table */ - prm->q.m_mode = pbody[p++]; + prm->q.s_mode = pbody[p++]; /* BSSID */ _rtw_memcpy(&(prm->q.bssid), &pbody[p], 6); @@ -1491,6 +1509,13 @@ static struct rrm_obj *rtw_rrm_new_obj(_adapter *a, struct sta_info *psta, u8 di cid = rrm_cal_cid(diag_token, RM_MASTER); } + /* check redundant obj */ + prm = rtw_fsm_get_obj(fsm, cid); + if (prm) { + FSM_WARN(prm, "%s obj exist!!\n", __func__); + return NULL; + } + obj = rtw_fsm_new_obj(fsm, psta, cid, (void **)&prm, sizeof(*prm)); if (prm == NULL) { @@ -1517,6 +1542,7 @@ int rrm_recv_radio_mens_req(_adapter *padapter, sizeof(struct rtw_ieee80211_hdr_3addr)); u8 ssc_chk, diag_token = pdiag_body[2]; u8 *pmeas_body = &pdiag_body[5]; + u8 need_to_scan = 1; u16 cid; #if 0 @@ -1567,17 +1593,13 @@ int rrm_recv_radio_mens_req(_adapter *padapter, FSM_INFO(prm, "rx %s from " MAC_FMT "\n", rm_type_req_name(prm->q.m_type), MAC_ARG(obj2mac(prm))); - ssc_chk = rtw_sitesurvey_condition_check(padapter, _FALSE); - - if ((ssc_chk != SS_ALLOW) && (ssc_chk != SS_DENY_BUSY_TRAFFIC)) { - rm_set_rep_mode(prm, MEAS_REP_MOD_REFUSE); - goto fail; - } - - switch (prm->q.m_type) { case bcn_req: - switch (prm->q.m_mode) { + if (!rrm_parse_meas_req(prm, pmeas_body)) { + rm_set_rep_mode(prm, MEAS_REP_MOD_INCAP); + goto fail; + } + switch (prm->q.s_mode) { case bcn_req_passive: rm_en_cap_chk_and_set(prm, RM_BCN_PASSIVE_MEAS_CAP_EN); break; @@ -1585,6 +1607,7 @@ int rrm_recv_radio_mens_req(_adapter *padapter, rm_en_cap_chk_and_set(prm, RM_BCN_ACTIVE_MEAS_CAP_EN); break; case bcn_req_bcn_table: + need_to_scan = 0; rm_en_cap_chk_and_set(prm, RM_BCN_TABLE_MEAS_CAP_EN); break; default: @@ -1593,16 +1616,27 @@ int rrm_recv_radio_mens_req(_adapter *padapter, } break; case ch_load_req: + rrm_parse_meas_req(prm, pmeas_body); rm_en_cap_chk_and_set(prm, RM_CH_LOAD_CAP_EN); break; case noise_histo_req: + rrm_parse_meas_req(prm, pmeas_body); rm_en_cap_chk_and_set(prm, RM_NOISE_HISTO_CAP_EN); break; default: rm_set_rep_mode(prm, MEAS_REP_MOD_INCAP); goto fail; } - rrm_parse_meas_req(prm, pmeas_body); + + if (need_to_scan) { + ssc_chk = rtw_sitesurvey_condition_check(padapter, _FALSE); + + if ((ssc_chk != SS_ALLOW) && (ssc_chk != SS_DENY_BUSY_TRAFFIC)) { + rm_set_rep_mode(prm, MEAS_REP_MOD_REFUSE); + goto fail; + } + } + rtw_fsm_activate_obj(prm); return _SUCCESS; @@ -1753,30 +1787,48 @@ int rrm_recv_link_mens_rep(_adapter *padapter, FSM_TRACE(prm, "RCPI = %d\n", pmeas_body[6]); FSM_TRACE(prm, "RSNI = %d\n", pmeas_body[7]); - FSM_INFO(prm, "rx link_meas_report (" MAC_FMT ")\n", MAC_ARG(obj2mac(prm))); + FSM_INFO(prm, "rx link_meas_report (" MAC_FMT ")\n", MAC_ARG(obj2mac(prm))); rtw_fsm_gen_msg(prm, NULL, 0, RRM_EV_recv_rep); return ret; } +static void rtw_rrm_dump_nb_rpt(struct rrm_obj *prm, struct rrm_nb_rpt * nb_rpt) +{ + int i; + struct rrm_nb_list *pnb_list = nb_rpt->nb_list; -int rm_radio_mens_nb_rep(_adapter *padapter, + for (i = 0; i < nb_rpt->nb_list_num; i++) { + FSM_INFO(prm, "NB %d("MAC_FMT") bss_info=0x%08X opc=0x%02X ch:%d " + "phy_type=0x%02X pref=%d\n", i + 1, + MAC_ARG(pnb_list[i].ent.bssid), + pnb_list[i].ent.bss_info, + pnb_list[i].ent.reg_class, + pnb_list[i].ent.ch_num, + pnb_list[i].ent.phy_type, + pnb_list[i].preference); + } +} + +int rm_radio_mens_nb_rpt(_adapter *padapter, union recv_frame *precv_frame, struct sta_info *psta) { struct rrm_priv *prmpriv = &padapter->fsmpriv.rmpriv; + struct rrm_priv *rrmpriv; + struct rrm_obj *prm; u8 *pdiag_body = (u8 *)(precv_frame->u.hdr.rx_data + sizeof(struct rtw_ieee80211_hdr_3addr)); u8 *pmeas_body = &pdiag_body[3]; u32 len = precv_frame->u.hdr.len; u16 cid; - struct rrm_obj *prm; cid = rrm_cal_cid(pdiag_body[2], RM_MASTER); prm = rtw_fsm_get_obj(prmpriv->fsm, cid); if (prm == NULL) { /* not belong to us, report to upper */ rtw_cfg80211_rx_rrm_action(padapter, precv_frame); + RTW_WARN("%s() dialog token 0x%02x not found\n", __func__, pdiag_body[2]); return _TRUE; } @@ -1784,22 +1836,16 @@ int rm_radio_mens_nb_rep(_adapter *padapter, prm->p.diag_token = pdiag_body[2]; prm->p.e_id = pmeas_body[0]; - FSM_INFO(prm, "rx neighbor report (" MAC_FMT ")\n", MAC_ARG(obj2mac(prm))); + FSM_INFO(prm, "rx neighbor report (" MAC_FMT ")\n", MAC_ARG(obj2mac(prm))); - FSM_TRACE(prm, "element_id = %d\n", prm->p.e_id); - FSM_TRACE(prm, "length = %d\n", (int)pmeas_body[1]); + rrmpriv = obj2priv(prm); + rrm_parse_nb_list(&rrmpriv->nb_rpt, pdiag_body + 3, + (len - sizeof(struct rtw_ieee80211_hdr_3addr))); + rrm_sort_nb_list(&rrmpriv->nb_rpt); + rrm_upd_nb_ch_list(prm, &rrmpriv->nb_rpt); + //rtw_rrm_dump_nb_rpt(prm, &rrmpriv->nb_rpt); rtw_fsm_gen_msg(prm, NULL, 0, RRM_EV_recv_rep); - -#ifdef CONFIG_RTW_MBO -#ifdef CONFIG_LAYER2_ROAMING - if (rtw_wnm_btm_candidates_survey(padapter - ,(pdiag_body + 3) - ,(len - sizeof(struct rtw_ieee80211_hdr_3addr)) - ,_FALSE) == _FAIL) - return _FALSE; -#endif -#endif rtw_cfg80211_rx_rrm_action(padapter, precv_frame); return _TRUE; @@ -1877,7 +1923,7 @@ unsigned int rrm_on_action(_adapter *padapter, union recv_frame *precv_frame) case RM_ACT_NB_REP_RESP: //RTW_INFO("RRM: RM_ACT_NB_REP_RESP\n"); - ret = rm_radio_mens_nb_rep(padapter, precv_frame, psta); + ret = rm_radio_mens_nb_rpt(padapter, precv_frame, psta); break; default: @@ -2535,7 +2581,7 @@ int rrm_issue_nb_req(struct rrm_obj *prm) u8 sub_ie[64] = {0}; u8 *pie = &sub_ie[2]; - FSM_INFO(prm, "tx NB Req to search %s\n", + FSM_INFO(prm, "tx neighbor request to search %s\n", pmlmepriv->cur_network.network.Ssid.Ssid); val8 = strlen(prm->q.pssid); @@ -2921,6 +2967,8 @@ int rrm_issue_radio_meas_req(struct rrm_obj *prm) static int rrm_issue_meas_req(struct rrm_obj *prm) { + struct rrm_priv *rrmpriv = obj2priv(prm); + switch (prm->q.action_code) { case RM_ACT_RADIO_MEAS_REQ: switch (prm->q.m_type) { @@ -2934,7 +2982,9 @@ static int rrm_issue_meas_req(struct rrm_obj *prm) } /* meas_type */ break; case RM_ACT_NB_REP_REQ: - /* issue neighbor request */ + /* invilid NB report */ + rrmpriv->nb_rpt.last_update = 0; + /* issue NB report request */ rrm_issue_nb_req(prm); break; case RM_ACT_LINK_MEAS_REQ: @@ -3001,9 +3051,11 @@ int retrieve_radio_meas_result(struct rrm_obj *prm) #ifdef CONFIG_RTW_ACS struct dvobj_priv *dvobj = adapter_to_dvobj(obj2adp(prm)); #endif - int i, ch = -1; + int i; u8 val8; +#if 0 + int ch = -1; ch = rtw_chset_search_bch(adapter_to_chset(obj2adp(prm)), prm->q.band, prm->q.ch_num); @@ -3012,7 +3064,7 @@ int retrieve_radio_meas_result(struct rrm_obj *prm) FSM_ERR(prm, "get ch(CH:%d) fail\n", prm->q.ch_num); ch = 0; } - +#endif switch (prm->q.m_type) { case ch_load_req: #if 0 /* def CONFIG_RTW_ACS */ @@ -3193,7 +3245,6 @@ void rm_dbg_list_sta(_adapter *padapter, char *s) struct sta_priv *pstapriv = &padapter->stapriv; _list *plist, *phead; - sprintf(pstr(s), "\n"); _rtw_spinlock_bh(&pstapriv->sta_hash_lock); for (i = 0; i < NUM_STA; i++) { @@ -3434,7 +3485,7 @@ int rm_send_bcn_reqs(_adapter *padapter, u8 *sta_addr, u8 op_class, u8 ch, /* Figure 8-104 Measurement Requested format */ prm->q.category = RTW_WLAN_CATEGORY_RADIO_MEAS; prm->q.action_code = RM_ACT_RADIO_MEAS_REQ; - prm->q.m_mode = measure_mode; + prm->q.m_mode = measure_mode; /* TODO */ prm->q.m_type = bcn_req; prm->q.m_token = rrm_gen_meas_token(padapter); @@ -3442,6 +3493,10 @@ int rm_send_bcn_reqs(_adapter *padapter, u8 *sta_addr, u8 op_class, u8 ch, prm->q.ch_num = ch; prm->q.op_class = op_class; prm->q.band = rtw_get_band_by_op_class(op_class); + if (prm->q.band >= BAND_MAX) { + FSM_WARN(prm, "%s: unknow opc:%d\n", __func__, op_class); + return -4; + } prm->from_ioctl = true; if (bssid != NULL) @@ -3671,7 +3726,7 @@ int verify_bcn_req(_adapter *padapter, struct sta_info *psta) u8 req[] = {1,2,3}; u8 req_len = sizeof(req); - + /* TODO: use system OP class */ static RT_OPERATING_CLASS US[] = { /* 0, OP_CLASS_NULL */ //{ 0, 0, {}}, /* 1, OP_CLASS_1 */ {115, 4, {36, 40, 44, 48}}, @@ -3707,11 +3762,11 @@ static int rrm_idle_st_hdl(void *obj, u16 event, void *param) rrm_enqueue_rm(obj2priv(prm) ,prm, 0); + prm->p.diag_token = prm->q.diag_token; switch (prm->q.action_code) { case RM_ACT_RADIO_MEAS_REQ: /* copy attrib from meas_req to meas_rep */ prm->p.action_code = RM_ACT_RADIO_MEAS_REP; - prm->p.diag_token = prm->q.diag_token; prm->p.e_id = _MEAS_RSP_IE_; prm->p.m_token = prm->q.m_token; prm->p.m_type = prm->q.m_type; @@ -3739,7 +3794,6 @@ static int rrm_idle_st_hdl(void *obj, u16 event, void *param) FSM_DBG(prm, "Neighbor request\n"); break; case RM_ACT_LINK_MEAS_REQ: - prm->p.diag_token = prm->q.diag_token; prm->p.action_code = RM_ACT_LINK_MEAS_REP; FSM_DBG(prm, "Link meas\n"); break; @@ -3810,7 +3864,7 @@ static int rrm_do_meas_st_hdl(void *obj, u16 event, void *param) if (prm->q.action_code == RM_ACT_RADIO_MEAS_REQ) { switch (prm->q.m_type) { case bcn_req: - if (prm->q.m_mode == bcn_req_bcn_table) { + if (prm->q.s_mode == bcn_req_bcn_table) { FSM_INFO(prm, "Beacon table\n"); rrm_get_chset(prm); rtw_fsm_st_goto(prm, RRM_ST_SEND_REPORT); @@ -3949,6 +4003,7 @@ static int rrm_do_meas_st_hdl(void *obj, u16 event, void *param) static int rrm_wait_meas_st_hdl(void *obj, u16 event, void *param) { struct rrm_obj *prm = (struct rrm_obj *)obj; + _adapter *a = obj2adp(prm); switch (event) { case FSM_EV_STATE_IN: @@ -3968,6 +4023,8 @@ static int rrm_wait_meas_st_hdl(void *obj, u16 event, void *param) break; case FSM_EV_STATE_OUT: rtw_fsm_cancel_alarm(prm); + if (prm->q.action_code == RM_ACT_NB_REP_REQ) /* always make it valid */ + a->fsmpriv.rmpriv.nb_rpt.last_update = rtw_get_current_time(); break; default: break; @@ -4252,11 +4309,11 @@ static int rrm_deinit_priv_cb(void *priv) return _SUCCESS; } -u8 rm_add_nb_req(_adapter *padapter, struct sta_info *psta) +u8 rm_add_nb_req(_adapter *a, struct sta_info *psta) { struct rrm_obj *prm; - prm = rtw_rrm_new_obj(padapter, psta, 0); + prm = rtw_rrm_new_obj(a, psta, 0); if (prm == NULL) { RTW_ERR("rrm: unable to alloc rm obj for requeset\n"); @@ -4273,6 +4330,26 @@ u8 rm_add_nb_req(_adapter *padapter, struct sta_info *psta) return _SUCCESS; } +static int rrm_is_nb_valid(_adapter *a) +{ + struct rrm_nb_rpt *nb_rpt = &a->fsmpriv.rmpriv.nb_rpt; + + if (nb_rpt->last_update == 0 || + rtw_get_passing_time_ms(nb_rpt->last_update) > RM_NB_REP_VALID_TIME) + return _FAIL; + + return _SUCCESS; +} + +int rtw_rrm_get_nb_rpt(_adapter *a, struct rrm_nb_rpt * nb_rpt) +{ + memcpy(nb_rpt, &a->fsmpriv.rmpriv.nb_rpt, sizeof(struct rrm_nb_rpt)); + + if (rrm_is_nb_valid(a)) + return _SUCCESS; /* nb_rpt is valid */ + return _FAIL; /* nb_rpt is invalid */ +} + /* For EXTERNAL application to create RRM FSM */ int rtw_rrm_reg_fsm(struct fsm_priv *fsmpriv) { @@ -4291,8 +4368,8 @@ int rtw_rrm_reg_fsm(struct fsm_priv *fsmpriv) tb.deinit_priv = rrm_deinit_priv_cb; tb.dump_obj = rrm_dump_obj_cb; tb.dump_fsm = rrm_dump_fsm_cb; - tb.dbg_level = FSM_LV_TRACE; - tb.evt_level = FSM_LV_TRACE; + tb.dbg_level = FSM_LV_INFO; + tb.evt_level = FSM_LV_INFO; tb.debug = rm_debug; fsm = rtw_fsm_register_fsm(root, "rrm", &tb); @@ -4304,3 +4381,160 @@ int rtw_rrm_reg_fsm(struct fsm_priv *fsmpriv) } #endif /* CONFIG_RTW_FSM_RRM */ +/* parse neighbor report */ +u32 rrm_parse_nb_list(struct rrm_nb_rpt *pnb_rpt, u8 *ie, u32 ie_len) +{ + int i; + struct nb_rpt_hdr *pie; + struct rrm_nb_list *pnb_list = pnb_rpt->nb_list; + u8 *ptr, *pend, *op, preference; + u32 elem_len, subelem_len, op_len; + + ptr = ie; + pend = ie + ie_len; + elem_len = ie_len; + subelem_len = (u32)*(ie + 1); + + memset(pnb_rpt, 0, sizeof(struct rrm_nb_rpt)); + for (i = 0; i < RTW_MAX_NB_RPT_NUM; i++) { + if (((ptr + 7) > pend) || (elem_len < subelem_len)) + break; + + if (*ptr != RTW_WLAN_ACTION_WNM_NB_RPT_ELEM) { + RTW_INFO("WNM: end of data(0x%2x)!\n", *ptr); + break; + } + + pie = (struct nb_rpt_hdr *)ptr; + _rtw_memcpy(&pnb_list[i].ent, pie, sizeof(struct nb_rpt_hdr)); +#if 0 /* debug */ + /* TEST forse 1st ch to DFS 100 */ + if (i==0) { + pnb_list[i].ent.ch_num = 100; + pnb_list[i].ent.reg_class = 121; + } + /* TEST forse 2nd ch to DFS 104 */ + else if (i==1) { + pnb_list[i].ent.ch_num = 104; + pnb_list[i].ent.reg_class = 121; + } +#endif + op = rtw_get_ie((u8 *)(ptr + 15), + WNM_BTM_CAND_PREF_SUBEID, &op_len, (subelem_len - 15)); + + if (op && (op_len !=0)) { + preference = *(op + 2); + if (preference) /* 1-255 */ + pnb_list[i].preference = preference; + else /* 0:exclude BSS */ + pnb_list[i].preference = -1; /* exclude BSS */ + } else { + pnb_list[i].preference = 0; /* Does NOT specify preference */ + } + ptr = (u8 *)(ptr + subelem_len + 2); + elem_len -= (subelem_len + 2); + subelem_len = *(ptr + 1); + + pnb_rpt->nb_list_num++; + } + + return _SUCCESS; +} + +static void _swap(struct rrm_nb_list *pnb_list, int idx1, int idx2) +{ + struct rrm_nb_list tmp; + + if (idx1 == idx2) + return; + + memcpy(&tmp, &pnb_list[idx1], sizeof(struct rrm_nb_list)); + memcpy(&pnb_list[idx1], &pnb_list[idx2], sizeof(struct rrm_nb_list)); + memcpy(&pnb_list[idx2], &tmp, sizeof(struct rrm_nb_list)); +} + +/* sort nb list according to preference */ +void rrm_sort_nb_list(struct rrm_nb_rpt *pnb_rpt) +{ + int i, j, p, idx1, idx2, ch; + + for (i = 0; i < pnb_rpt->nb_list_num; i++) { + p = pnb_rpt->nb_list[i].preference; + idx1 = idx2 = i; + for (j = i; j < pnb_rpt->nb_list_num; j++) { + if (pnb_rpt->nb_list[j].preference > p) { + p = pnb_rpt->nb_list[j].preference; /* max */ + idx2 = j; + } + } + _swap(pnb_rpt->nb_list, idx1, idx2); + } +} + +static void rrm_upd_nb_ch_list(struct rrm_obj *prm, struct rrm_nb_rpt *pnb_rpt) +{ + struct rtw_ieee80211_channel tmp_ch[RTW_CHANNEL_SCAN_AMOUNT] = {0}; + const struct op_class_t *opc; + int i, j, tmp_ch_num = 0; + u8 ch, band, op_class, *pch; + + for (i = 0; i < pnb_rpt->nb_list_num; i++) { + ch = pnb_rpt->nb_list[i].ent.ch_num; + op_class = pnb_rpt->nb_list[i].ent.reg_class; + band = rtw_get_band_by_op_class(op_class); + + if (band >= BAND_MAX) { + FSM_WARN(prm, "%s: skip unknown opc:%d\n", __func__, op_class); + continue; + } + + if (ch == 0) { + /* get all channels in this op class */ + opc = get_global_op_class_by_id(op_class); + + if (!opc) + continue; + + pch = opc->len_ch_attr; + for (j = 0; j < pch[0]; j++) { + tmp_ch[tmp_ch_num].hw_value = pch[j+1]; + tmp_ch[tmp_ch_num].band = band; + if (++tmp_ch_num == RTW_CHANNEL_SCAN_AMOUNT) + goto full; + } + } else { + tmp_ch[tmp_ch_num].hw_value = ch; + tmp_ch[tmp_ch_num].band = band; + if (++tmp_ch_num == RTW_CHANNEL_SCAN_AMOUNT) + goto full; + } + } + +full: + /* remove redundant ch */ + for (i = 0; i < tmp_ch_num; i++) { + if (tmp_ch[i].hw_value != 0) { + for (j = i + 1; j < tmp_ch_num; j++) { + if (tmp_ch[i].hw_value == tmp_ch[j].hw_value && + tmp_ch[i].band == tmp_ch[j].band) { + tmp_ch[j].hw_value = 0; /* remove */ + } + } + } + } + + /* copy final channels to pnb_rpt */ + for (i = 0; i < tmp_ch_num; i++) { + if (tmp_ch[i].hw_value != 0) { + pnb_rpt->ch_list[pnb_rpt->ch_list_num].hw_value = tmp_ch[i].hw_value; + pnb_rpt->ch_list[pnb_rpt->ch_list_num].band = tmp_ch[i].band; + pnb_rpt->ch_list_num++; + } + } +#if 0 + for (i = 0; i < pnb_rpt->ch_list_num; i++) { + printk("%s(%d) %d/%d band = %d, ch = %d\n", __func__, __LINE__, + i, pnb_rpt->ch_list_num,pnb_rpt->ch_list[i].band, pnb_rpt->ch_list[i].hw_value); + } +#endif +} diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_fsm_wnm.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_fsm_wnm.c index 3492633b..b24dde27 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_fsm_wnm.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_fsm_wnm.c @@ -18,19 +18,22 @@ #define BTM_CONNECT_WAIT 2000 #define BTM_DISASSOC_WAIT 1000 -#ifdef CONFIG_IEEE80211_BAND_6GHZ +#if CONFIG_IEEE80211_BAND_6GHZ #define BTM_SCAN_TIMEOUT 15000 #else #define BTM_SCAN_TIMEOUT 10000 #endif #define BTM_SCAN_DENY_WAIT 500 #define BTM_FT_ACTION_TIMEOUT 1000 -#define BTM_SCAN_DWELL_TIME 30 + +#define BTM_NB_POLL_INTERVAL 10 +#define BTM_NB_POLL_TIMES 20 /* * State machine */ enum BTM_STATE_ST { BTM_ST_START, + BTM_ST_NB, BTM_ST_SCAN, BTM_ST_OTD, BTM_ST_ROAM, @@ -39,8 +42,11 @@ enum BTM_STATE_ST { }; enum BTM_EV_ID { + BTM_EV_nb_poll, BTM_EV_scan_deny_expire, BTM_EV_scan_timeout, + BTM_EV_scan_probe_req, + BTM_EV_scan_probe_req_timeout, BTM_EV_scan_found_candidate, BTM_EV_scan_opch_reported, BTM_EV_connect_timeout, @@ -51,6 +57,7 @@ enum BTM_EV_ID { }; static int btm_start_st_hdl(void *obj, u16 event, void *param); +static int btm_nb_req_st_hdl(void *obj, u16 event, void *param); static int btm_scan_st_hdl(void *obj, u16 event, void *param); static int btm_otd_st_hdl(void *obj, u16 event, void *param); static int btm_roam_st_hdl(void *obj, u16 event, void *param); @@ -59,6 +66,7 @@ static int btm_end_st_hdl(void *obj, u16 event, void *param); /* STATE table */ static struct fsm_state_ent btm_state_tbl[] = { ST_ENT(BTM_ST_START, btm_start_st_hdl), + ST_ENT(BTM_ST_NB, btm_nb_req_st_hdl), ST_ENT(BTM_ST_SCAN, btm_scan_st_hdl), ST_ENT(BTM_ST_OTD, btm_otd_st_hdl), ST_ENT(BTM_ST_ROAM, btm_roam_st_hdl), @@ -67,8 +75,11 @@ static struct fsm_state_ent btm_state_tbl[] = { /* EVENT table */ static struct fsm_event_ent btm_event_tbl[] = { + EV_DBG(BTM_EV_nb_poll), EV_DBG(BTM_EV_scan_deny_expire), EV_DBG(BTM_EV_scan_timeout), + EV_DBG(BTM_EV_scan_probe_req), + EV_DBG(BTM_EV_scan_probe_req_timeout), EV_DBG(BTM_EV_scan_found_candidate), EV_DBG(BTM_EV_scan_opch_reported), EV_DBG(BTM_EV_connect_timeout), @@ -87,8 +98,12 @@ struct btm_obj { u8 op_ch_reported; struct roam_nb_info pnb; struct wlan_network *candidate; + int nb_poll_times; int finish; + struct sitesurvey_parm parm; + struct rtw_ieee80211_channel scan_ch; + /* obj default */ struct fsm_obj *obj; struct fsm_main *fsm; @@ -98,390 +113,269 @@ struct btm_obj { /* * btm sub function */ -#if 1 -/* - * Search the @param ch in given @param ch_list - * @ch_list: the given channel list - * @ch: the given channel number - * - * return the index of channel_num in channel_set, -1 if not found - */ -int rtw_chlist_search_ch(struct rtw_ieee80211_channel *ch_list, int len, RT_CHANNEL_INFO *chs) +static void btm_dump_scan_ch(struct rtw_ieee80211_channel *ch, u32 num) { int i; + char str[128]; - if (chs->ChannelNum == 0) - return -1; + if (num == 0) + return; - for (i = 0; i < len && ch_list[i].hw_value != 0; i++) { - if (chs->ChannelNum == ch_list[i].hw_value && chs->band == ch_list[i].band) - return i; + memset(str, 0, sizeof(str)); + for (i = 0; i < num; i++) { + sprintf(str + strlen(str) ,"[%3d-%s] ", + ch[i].hw_value, rtw_band_str(ch[i].band)); + + if ((i+1)%8 == 0) { + printk("%s\n",str); + memset(str, 0, sizeof(str)); + } } - - return -1; + if (strlen(str)) + printk("%s\n",str); } -/* - * Sort scan channel as following order: - * NB list, 5G active, 5G NOIR, 6G active, 6G NOIR, 2G active, 2G NOIR - */ -static int btm_scan_ch_decision(_adapter *padapter, struct rtw_ieee80211_channel *out, - u32 out_num, struct rtw_ieee80211_channel *in, u32 in_num) +#if CONFIG_IEEE80211_BAND_6GHZ +/* save PSC channel and remove other channel */ +static int btm_scan_ch_psc(struct btm_obj *pbtm, struct rtw_ieee80211_channel *out, u32 out_num) { - int i, j, k, l, m, r, amount_ch, chs_len, sz = sizeof(struct rtw_ieee80211_channel); - int set_idx; - u8 chan; - struct rtw_chset *chset = adapter_to_chset(padapter); - RT_CHANNEL_INFO *chs; - struct registry_priv *regsty = dvobj_to_regsty(adapter_to_dvobj(padapter)); - struct rtw_ieee80211_channel *out_roam, *out2, *out2_noir, *out5, *out5_noir; -#ifdef CONFIG_IEEE80211_BAND_6GHZ - struct rtw_ieee80211_channel *out6, *out6_noir; - int p, q; -#endif - j = k = l = m = r = amount_ch = 0; - out_roam = rtw_zmalloc(sz * RTW_MAX_NB_RPT_NUM); - out2 = rtw_zmalloc(sz * MAX_CHANNEL_NUM_2G); - out2_noir = rtw_zmalloc(sz * MAX_CHANNEL_NUM_2G); - out5 = rtw_zmalloc(sz * MAX_CHANNEL_NUM_5G); - out5_noir = rtw_zmalloc(sz * MAX_CHANNEL_NUM_5G); -#ifdef CONFIG_IEEE80211_BAND_6GHZ - p = q = 0; - out6 = rtw_zmalloc(sz * MAX_CHANNEL_NUM_6G); - out6_noir = rtw_zmalloc(sz * MAX_CHANNEL_NUM_6G); -#endif - if (!out_roam || !out2 || !out2_noir || !out5 || !out5_noir -#ifdef CONFIG_IEEE80211_BAND_6GHZ - || !out6 || !out6_noir -#endif - ) { - goto exit; - } + int i, ch_num = 0; + struct rtw_ieee80211_channel *chs; - /* scan channel order NB list, 5G, 5G_NOIR, 6G, 6G_NOIR, 2G, 2G_NOIR */ - /* acquire channels from in */ - for (i = 0; i < in_num; i++) { + chs = rtw_zmalloc(sizeof(struct rtw_ieee80211_channel) * out_num); + if (!chs) + return out_num; - if (0) - RTW_INFO(FUNC_ADPT_FMT" "CHAN_FMT"\n", FUNC_ADPT_ARG(padapter), CHAN_ARG(&in[i])); + _rtw_memcpy(chs, out, sizeof(struct rtw_ieee80211_channel) * out_num); + _rtw_memset(out, 0, sizeof(struct rtw_ieee80211_channel) * out_num); - if (!in[i].hw_value || (in[i].flags & RTW_IEEE80211_CHAN_DISABLED)) + for (i = 0; i < out_num; i ++) { + if (chs[i].band != BAND_ON_6G) { + _rtw_memcpy(&out[ch_num++], &chs[i], sizeof(struct rtw_ieee80211_channel)); continue; - if (rtw_mlme_band_check(padapter, in[i].hw_value) == _FALSE) + } + + /* PSC = 16*n+5 */ + if ((chs[i].hw_value-5)%16 != 0) continue; - set_idx = rtw_chset_search_bch(chset, in[i].band, in[i].hw_value); - - if (set_idx < 0) - continue; - - if (chset->chs[set_idx].band == BAND_ON_5G) { - - /* j,k */ - if (chset->chs[set_idx].flags & (RTW_CHF_NO_IR | RTW_CHF_DFS)) { - /* 5G DFS and NO_IR */ - _rtw_memcpy(&out5_noir[k], &in[i], sz); - out5_noir[k].flags |= RTW_IEEE80211_CHAN_PASSIVE_SCAN; - k++; - } else { - /* 5G Active channel */ - _rtw_memcpy(&out5[j], &in[i], sz); - j++; - } - - } -#ifdef CONFIG_IEEE80211_BAND_6GHZ - else if (chset->chs[set_idx].band == BAND_ON_6G) { - /* p,q */ - if (chset->chs[set_idx].flags & (RTW_CHF_NO_IR | RTW_CHF_DFS)) { - /* 5G DFS and NO_IR */ - _rtw_memcpy(&out5_noir[q], &in[i], sz); - out5_noir[q].flags |= RTW_IEEE80211_CHAN_PASSIVE_SCAN; - q++; - } else { - /* 5G Active channel */ - _rtw_memcpy(&out5[p], &in[i], sz); - p++; - } - - } -#endif - else { /* 2G */ - - /* l, m */ - if (chset->chs[set_idx].flags & (RTW_CHF_NO_IR | RTW_CHF_DFS)) { - /* 2G NO_IR */ - _rtw_memcpy(&out2_noir[m], &in[i], sz); - out2_noir[m].flags |= RTW_IEEE80211_CHAN_PASSIVE_SCAN; - m++; - } else { - /* 2G Active channel */ - _rtw_memcpy(&out2[l], &in[i], sz); - l++; - } - } + /* Save PSC channel */ + _rtw_memcpy(&out[ch_num++], &chs[i], sizeof(struct rtw_ieee80211_channel)); } - - amount_ch = 0; - if (j && (RTW_MAX_NB_RPT_NUM >= (amount_ch + j))) { - _rtw_memcpy(&out_roam[amount_ch], out5, sz); - amount_ch += j; - } - - if (k && (RTW_MAX_NB_RPT_NUM >= (amount_ch + k))) { - _rtw_memcpy(&out_roam[amount_ch], out5_noir, sz); - amount_ch += k; - } - -#ifdef CONFIG_IEEE80211_BAND_6GHZ - if (p && (RTW_MAX_NB_RPT_NUM >= (amount_ch + p))) { - _rtw_memcpy(&out_roam[amount_ch], out6, sz); - amount_ch += p; - } - - if (q && (RTW_MAX_NB_RPT_NUM >= (amount_ch + q))) { - _rtw_memcpy(&out_roam[amount_ch], out6_noir, sz); - amount_ch += q; - } -#endif - if (l && (RTW_MAX_NB_RPT_NUM >= (amount_ch + l))) { - _rtw_memcpy(&out_roam[amount_ch], out2, sz); - amount_ch += l; - } - - if (m && (RTW_MAX_NB_RPT_NUM >= (amount_ch + m))) { - _rtw_memcpy(&out_roam[amount_ch], out2_noir, sz); - amount_ch += m; - } - r = amount_ch; - - /* reset */ - j = k = l = m = amount_ch = 0; - _rtw_memset(out2, 0, sz * MAX_CHANNEL_NUM_2G); - _rtw_memset(out2_noir, 0, sz * MAX_CHANNEL_NUM_2G); - _rtw_memset(out5, 0, sz * MAX_CHANNEL_NUM_5G); - _rtw_memset(out5_noir, 0, sz * MAX_CHANNEL_NUM_5G); -#ifdef CONFIG_IEEE80211_BAND_6GHZ - p = q = 0; - _rtw_memset(out6, 0, sz * MAX_CHANNEL_NUM_6G); - _rtw_memset(out6_noir, 0, sz * MAX_CHANNEL_NUM_6G); -#endif - - /* if out is empty, use channel_set as default */ - if (amount_ch == 0) { - /* 5G */ - chs = chset->chs_of_band[BAND_ON_5G]; - chs_len = chset->chs_len_of_band[BAND_ON_5G]; - - for (i = 0; i < chs_len; i++) { - chan = chs[i].ChannelNum; - if (rtw_mlme_band_check(padapter, chan) == _TRUE) { - if (rtw_mlme_ignore_chan(padapter, chan) == _TRUE) - continue; - - /* skip NB list ch */ - if (rtw_chlist_search_ch(out_roam, r, &chs[i]) != -1) - continue; - if (0) - RTW_INFO(FUNC_ADPT_FMT" ch:%u\n", FUNC_ADPT_ARG(padapter), chan); - - if (chs[i].flags & (RTW_CHF_NO_IR | RTW_CHF_DFS)) { - /* 5G NOIR */ - out5_noir[k].hw_value = chan; - out5_noir[k].band = BAND_ON_5G; - out5_noir[k].flags |= RTW_IEEE80211_CHAN_PASSIVE_SCAN; - k++; - } else { - /* 5G active */ - out5[j].hw_value = chan; - out5[j].band = BAND_ON_5G; - j++; - } - } - } - -#ifdef CONFIG_IEEE80211_BAND_6GHZ - /* 6G */ - chs = chset->chs_of_band[BAND_ON_6G]; - chs_len = chset->chs_len_of_band[BAND_ON_6G]; - - for (i = 0; i < chs_len; i++) { - chan = chs[i].ChannelNum; - if (rtw_mlme_band_check(padapter, chan) == _TRUE) { - if (rtw_mlme_ignore_chan(padapter, chan) == _TRUE) - continue; - - /* skip NB list ch */ - if (rtw_chlist_search_ch(out_roam, r, &chs[i]) != -1) - continue; - - /* only accept PCS(Preferred Scanning Channels) */ - if (chan > 229) /* latest PCS channel */ - break; - - /* PSC = 16*n+5 */ - if ((chan-5)%16) - continue; - - if (0) - RTW_INFO(FUNC_ADPT_FMT" ch:%u\n", FUNC_ADPT_ARG(padapter), chan); - - if (chs[i].flags & (RTW_CHF_NO_IR | RTW_CHF_DFS)) { - /* 6G NOIR */ - out6_noir[q].hw_value = chan; - out6_noir[q].band = BAND_ON_6G; - out6_noir[q].flags |= RTW_IEEE80211_CHAN_PASSIVE_SCAN; - q++; - } else { - /* 6G active */ - out6[p].hw_value = chan; - out6[p].band = BAND_ON_6G; - p++; - } - } - } -#endif - /* 2G */ - chs = chset->chs_of_band[BAND_ON_24G]; - chs_len = chset->chs_len_of_band[BAND_ON_24G]; - for (i = 0; i < chs_len; i++) { - - chan = chs[i].ChannelNum; - - if (rtw_mlme_band_check(padapter, chan) == _TRUE) { - if (rtw_mlme_ignore_chan(padapter, chan) == _TRUE) - continue; - - /* skip NB list ch */ - if (rtw_chlist_search_ch(out_roam, r, &chs[i]) != -1) - continue; - - if (0) - RTW_INFO(FUNC_ADPT_FMT" ch:%u\n", FUNC_ADPT_ARG(padapter), chan); - - if (chs[i].flags & (RTW_CHF_NO_IR | RTW_CHF_DFS)) { - /* 2G NOIR */ - out2_noir[m].hw_value = chan; - out2_noir[m].band = BAND_ON_24G; - out2_noir[m].flags |= RTW_IEEE80211_CHAN_PASSIVE_SCAN; - m++; - - } else { - /* 2G activate */ - out2[l].hw_value = chan; - out2[l].band = BAND_ON_24G; - l++; - } - } - } - } - amount_ch = 0; - if (r && (out_num >= (amount_ch + r))) { - _rtw_memcpy(&out[amount_ch], out_roam, sz * r); - amount_ch += r; - } - - if (j && (out_num >= (amount_ch + j))) { - _rtw_memcpy(&out[amount_ch], out5, sz * j); - amount_ch += j; - } - - if (k && (out_num >= (amount_ch + k))) { - _rtw_memcpy(&out[amount_ch], out5_noir, sz * k); - amount_ch += k; - } - -#ifdef CONFIG_IEEE80211_BAND_6GHZ - if (p && (out_num >= (amount_ch + p))) { - _rtw_memcpy(&out[amount_ch], out6, sz * p); - amount_ch += p; - } - - if (q && (out_num >= (amount_ch + q))) { - _rtw_memcpy(&out[amount_ch], out6_noir, sz * q); - amount_ch += q; - } -#endif - if (l && (out_num >= (amount_ch + l))) { - _rtw_memcpy(&out[amount_ch], out2, sz * l); - amount_ch += l; - } - - if (m && (out_num >= (amount_ch + m))) { - _rtw_memcpy(&out[amount_ch], out2_noir, sz * m); - amount_ch += m; - } -exit: - if (out_roam) rtw_mfree(out_roam, sz * RTW_MAX_NB_RPT_NUM); - if (out2) rtw_mfree(out2, sz * MAX_CHANNEL_NUM_2G); - if (out2_noir) rtw_mfree(out2_noir, sz * MAX_CHANNEL_NUM_2G); - if (out5) rtw_mfree(out5, sz * MAX_CHANNEL_NUM_5G); - if (out5_noir) rtw_mfree(out5_noir, sz * MAX_CHANNEL_NUM_5G); -#ifdef CONFIG_IEEE80211_BAND_6GHZ - if (out6) rtw_mfree(out6, sz * MAX_CHANNEL_NUM_6G); - if (out6_noir) rtw_mfree(out6_noir, sz * MAX_CHANNEL_NUM_6G); -#endif - return amount_ch; + rtw_mfree(chs, sizeof(struct rtw_ieee80211_channel) * out_num); + return ch_num; } +#endif /* CONFIG_IEEE80211_BAND_6GHZ */ + +static int btm_scan_ch_sort(struct btm_obj *pbtm, struct rtw_ieee80211_channel *out, u32 out_num, u8 remove_op) +{ + int i, j, k, l; + struct rtw_ieee80211_channel *chs; + _adapter *a = obj2adp(pbtm); + struct mlme_priv *pmlmepriv = &a->mlmepriv; + u8 *band_order = a->mlmepriv.roam_scan_order; + u16 c_ch = pmlmepriv->cur_network_scanned->network.Configuration.DSConfig; + u8 c_band = pmlmepriv->cur_network_scanned->network.Configuration.Band; + + chs = rtw_zmalloc(sizeof(struct rtw_ieee80211_channel) * out_num); + if (!chs) + return out_num; + + _rtw_memcpy(chs, out, sizeof(struct rtw_ieee80211_channel) * out_num); + _rtw_memset(out, 0, sizeof(struct rtw_ieee80211_channel) * out_num); + + k = 0; + for (i = 0; i < 3; i++) { + if (band_order[i] >= BAND_MAX) + break; + for (j = 0; j < out_num; j++) { + if (chs[j].hw_value == 0) + break; + if (chs[j].band != band_order[i]) + continue; + if (chs[j].flags & RTW_IEEE80211_CHAN_PASSIVE_SCAN) + continue; + if (remove_op && chs[j].hw_value == c_ch && chs[j].band == c_band) + continue; + + /* ACTIVE CH */ + _rtw_memcpy(&out[k++], &chs[j], sizeof(struct rtw_ieee80211_channel)); + } + + for (j = 0; j < out_num; j++) { + if (chs[j].hw_value == 0) + break; + if (chs[j].band != band_order[i]) + continue; + if (!(chs[j].flags & RTW_IEEE80211_CHAN_PASSIVE_SCAN)) + continue; + if (remove_op && chs[j].hw_value == c_ch && chs[j].band == c_band) + continue; + + /* PASSIVE CH */ + _rtw_memcpy(&out[k++], &chs[j], sizeof(struct rtw_ieee80211_channel)); + + } + } + rtw_mfree(chs, sizeof(struct rtw_ieee80211_channel) * out_num); + return k; +} + +/* extend roam channel into full scan channel */ +static int btm_roam_ch_decision(struct btm_obj *pbtm, struct rtw_ieee80211_channel *out, + u32 out_num, struct rtw_ieee80211_channel *in_ch, u32 in_num) +{ + _adapter *a = obj2adp(pbtm); + struct mlme_priv *pmlmepriv = &a->mlmepriv; + struct rtw_ieee80211_channel *roam_ch = NULL, *full_ch = NULL; + int i, j, k, roam_ch_num = 0, full_ch_num = 0, ins_op_ch = 0; + u16 c_ch = pmlmepriv->cur_network_scanned->network.Configuration.DSConfig; + u8 c_band = pmlmepriv->cur_network_scanned->network.Configuration.Band; + + /* sort original ROAM channel */ + if (in_num) { + roam_ch = rtw_zmalloc(sizeof(struct rtw_ieee80211_channel) * (in_num + ins_op_ch)); + if (!roam_ch) + goto roam_exit; + roam_ch_num = rtw_scan_ch_decision(a, roam_ch, + in_num, in_ch, in_num, 0); + + if (roam_ch_num > 1) + roam_ch_num = btm_scan_ch_sort(pbtm, roam_ch, roam_ch_num, ins_op_ch); + } + + full_ch = rtw_zmalloc(sizeof(struct rtw_ieee80211_channel) * RTW_CHANNEL_SCAN_AMOUNT); + if (!full_ch) + goto full_exit; + + /* get full channel */ + full_ch_num = rtw_scan_ch_decision(a, full_ch, + RTW_CHANNEL_SCAN_AMOUNT, NULL, 0, 0); + +#if CONFIG_IEEE80211_BAND_6GHZ + /* only accept 6G PSC channel */ + full_ch_num = btm_scan_ch_psc(pbtm, full_ch, full_ch_num); #endif + /* sort full channel */ + full_ch_num = btm_scan_ch_sort(pbtm, full_ch, full_ch_num, ins_op_ch); + + _rtw_memset(out, 0, sizeof(struct rtw_ieee80211_channel) * out_num); + + /* insert current op channel to 1'st entry */ + k = 0; + if (ins_op_ch) { + out[k].hw_value = c_ch; + out[k].band = c_band; + k++; + } + + if (roam_ch_num) { + /* combine ROAM ch and full ch */ + for (i = 0; i < roam_ch_num; i++) { + if (ins_op_ch && (roam_ch[i].hw_value == c_ch) && (roam_ch[i].band == c_band)) + goto next_roam_ch; + + _rtw_memcpy(&out[k++] ,&roam_ch[i], sizeof(struct rtw_ieee80211_channel)); +next_roam_ch: + ; /* make compile happy:label at end of compound statement */ + } + + for (i = 0; i < full_ch_num; i++) { + for (j = 0; j < (roam_ch_num + ins_op_ch); j++) { + if ((roam_ch[j].hw_value == full_ch[i].hw_value) && + (roam_ch[j].band == full_ch[i].band)) + goto next_full_ch; + } + _rtw_memcpy(&out[k++] ,&full_ch[i], sizeof(struct rtw_ieee80211_channel)); +next_full_ch: + ; /* make compile happy:label at end of compound statement */ + } + } else { + _rtw_memcpy(&out[ins_op_ch] ,full_ch, sizeof(struct rtw_ieee80211_channel) * full_ch_num); + k += full_ch_num; + } + + if (full_ch) + rtw_mfree(full_ch, sizeof(struct rtw_ieee80211_channel) * RTW_CHANNEL_SCAN_AMOUNT); +full_exit: + if (roam_ch) + rtw_mfree(roam_ch, sizeof(struct rtw_ieee80211_channel) * (in_num + ins_op_ch)); +roam_exit: + btm_dump_scan_ch(out, k); + return k; +} static void btm_nb_scan_list_set(struct btm_obj *pbtm, struct sitesurvey_parm *pparm) { - u32 i; + int i, j, sz; struct roam_nb_info *pnb = &pbtm->pnb; _adapter *a = obj2adp(pbtm); struct mlme_priv *pmlmepriv = &a->mlmepriv; + struct rtw_ieee80211_channel *chs; + /* SSID */ if (pmlmepriv->cur_network_scanned) { _rtw_memcpy(&pparm->ssid[0], &pmlmepriv->cur_network_scanned->network.Ssid, sizeof(struct _NDIS_802_11_SSID)); pparm->ssid_num = 1; } - for (i = 0; i < pnb->nb_rpt_ch_list_num; i++) { - _rtw_memcpy(pparm->nb[i].bssid, pnb->nb_rpt[i].bssid, ETH_ALEN); - pparm->nb[i].ch = pnb->nb_rpt[i].ch_num; + /* NB report specified bssid */ + for (i = 0; i < pnb->nb_rpt.nb_list_num; i++) { + _rtw_memcpy(pparm->nb[i].bssid, pnb->nb_rpt.nb_list[i].ent.bssid, ETH_ALEN); + + pparm->nb[i].ch = pnb->nb_rpt.nb_list[i].ent.ch_num; + pparm->nb[i].band = pnb->nb_rpt.ch_list[i].band; pparm->nb_num++; } - pparm->scan_mode = RTW_PHL_SCAN_ACTIVE; - pparm->duration = BTM_SCAN_DWELL_TIME; - - pparm->ch_num = (pnb->nb_rpt_ch_list_num > RTW_MAX_NB_RPT_NUM)? - (RTW_MAX_NB_RPT_NUM):(pnb->nb_rpt_ch_list_num); -#if 0 - for (i=0; ich_num; i++) { - pparm->ch[i].hw_value = pnb->nb_rpt_ch_list[i].hw_value; - pparm->ch[i].band = pnb->nb_rpt_ch_list[i].band; - } -#endif - - i = btm_scan_ch_decision(a, pparm->ch, RTW_CHANNEL_SCAN_AMOUNT, - pnb->nb_rpt_ch_list, pnb->nb_rpt_ch_list_num); - pparm->ch_num = i; + pparm->duration = ROAM_P_CH_SURVEY_TO; + pparm->ch_num = btm_roam_ch_decision(pbtm, pparm->ch, RTW_CHANNEL_SCAN_AMOUNT, + pnb->nb_rpt.ch_list, pnb->nb_rpt.ch_list_num); pnb->nb_rpt_valid = _FALSE; } static int btm_roam_scan(struct btm_obj *pbtm) { _adapter *a = obj2adp(pbtm); - struct sitesurvey_parm *parm; - u8 ret = _FAIL; + struct sitesurvey_parm *parm = &pbtm->parm; - parm = (struct sitesurvey_parm*)rtw_zmalloc(sizeof(*parm)); - - if (!parm) - return ret; - - rtw_init_sitesurvey_parm(a, parm); + rtw_init_sitesurvey_parm(parm); btm_nb_scan_list_set(pbtm, parm); parm->scan_type = RTW_SCAN_ROAM; parm->psta = obj2sta(pbtm); - ret = rtw_sitesurvey_cmd(a, parm); - rtw_mfree(parm, sizeof(*parm)); + return rtw_sitesurvey_cmd(a, parm); +} - return ret; +static int btm_issue_probe_req(struct btm_obj *pbtm) +{ + _adapter *a = obj2adp(pbtm); + struct sta_info *psta = obj2sta(pbtm); + struct _ADAPTER_LINK *al = psta->padapter_link; + NDIS_802_11_SSID *ssid; + int i, j; + + if (!pbtm->parm.ssid_num) { + issue_probereq(a, al, NULL, NULL); + return _SUCCESS; + } + + for (i = 0; i < pbtm->parm.ssid_num; i++) { + if (pbtm->parm.ssid[i].SsidLength == 0) + continue; + + ssid = &pbtm->parm.ssid[i]; + + for (j = 0; j < pbtm->parm.nb_num; j++) { + if (pbtm->scan_ch.hw_value == pbtm->parm.nb[j].ch && + pbtm->scan_ch.band == pbtm->parm.nb[j].band) + issue_probereq(a, al, ssid, pbtm->parm.nb[j].bssid); + } + issue_probereq(a, al, ssid, NULL); + } + + return _SUCCESS; } static int btm_del_obj(struct btm_obj *pbtm) @@ -505,33 +399,31 @@ static int btm_start_st_hdl(void *obj, u16 event, void *param) struct btm_obj *pbtm = (struct btm_obj *)obj; _adapter *a = obj2adp(pbtm); struct btm_priv *btmpriv = (struct btm_priv *)obj2priv(pbtm); - struct roam_nb_info *pnb = &pbtm->pnb; - u8 ssc_chk; - int i; switch (event) { case FSM_EV_STATE_IN: - pbtm->resp_reason = 1; /* unspecified reject reason */ - for (i = 0; i < pnb->last_nb_rpt_entries; i++) - FSM_INFO(pbtm, "roam list "MAC_FMT"\n", - MAC_ARG(pnb->nb_rpt[i].bssid)); - fallthrough; - case BTM_EV_scan_deny_expire: - ssc_chk = rtw_sitesurvey_condition_check(a, _FALSE); - if (ssc_chk == SS_DENY_BUSY_TRAFFIC) { - FSM_INFO(pbtm, "need to roam, don't care BusyTraffic\n"); - } else if (ssc_chk != SS_ALLOW) { - rtw_fsm_set_alarm(pbtm, BTM_SCAN_DENY_WAIT, BTM_EV_scan_deny_expire); + if (btmpriv->btm) { + FSM_ERR(pbtm, "pbtm exists\n"); + rtw_fsm_st_goto(pbtm, BTM_ST_END); return _SUCCESS; + } else { + btmpriv->btm = pbtm; } - /* Able to scan */ - rtw_fsm_st_goto(pbtm, BTM_ST_SCAN); + FSM_INFO(pbtm, "roam start, reason=0x%02x\n", pbtm->roam_reason); + + pbtm->resp_reason = 1; /* unspecified reject reason */ + if (pbtm->roam_reason & RTW_ROAM_ACTIVE && + !rtw_rrm_get_nb_rpt(a, &pbtm->pnb.nb_rpt)) /* invalid */ + rtw_fsm_st_goto(pbtm, BTM_ST_NB); + else + rtw_fsm_st_goto(pbtm, BTM_ST_SCAN); break; case FSM_EV_ABORT: - case FSM_EV_DISCONNECTED: if (pbtm->roam_reason & RTW_ROAM_BTM) rtw_wnm_issue_action(a, &pbtm->pnb, RTW_WLAN_ACTION_WNM_BTM_RSP, pbtm->resp_reason, pbtm->pnb.btm_cache.dialog_token); + fallthrough; + case FSM_EV_DISCONNECTED: /* no need to reply btm_req */ rtw_fsm_st_goto(pbtm, BTM_ST_END); break; case FSM_EV_STATE_OUT: @@ -544,6 +436,53 @@ static int btm_start_st_hdl(void *obj, u16 event, void *param) return _SUCCESS; } +static int btm_nb_req_st_hdl(void *obj, u16 event, void *param) +{ + struct btm_obj *pbtm = (struct btm_obj *)obj; + _adapter *a = obj2adp(pbtm); + int i, valid; + u8 band; + + switch (event) { + case FSM_EV_STATE_IN: + /* issue NB req */ + rm_add_nb_req(a, obj2sta(pbtm)); + + rtw_fsm_set_alarm(pbtm, BTM_NB_POLL_INTERVAL, BTM_EV_nb_poll); + pbtm->nb_poll_times = BTM_NB_POLL_TIMES; + break; + case BTM_EV_nb_poll: + if (rtw_rrm_get_nb_rpt(a, &pbtm->pnb.nb_rpt) || (--pbtm->nb_poll_times) == 0) + rtw_fsm_st_goto(pbtm, BTM_ST_SCAN); /* go ahead even there is no NB report */ + else + rtw_fsm_set_alarm(pbtm, BTM_NB_POLL_INTERVAL, BTM_EV_nb_poll); + break; + case FSM_EV_ABORT: + if (pbtm->roam_reason & RTW_ROAM_BTM) + rtw_wnm_issue_action(a, &pbtm->pnb, RTW_WLAN_ACTION_WNM_BTM_RSP, + pbtm->resp_reason, pbtm->pnb.btm_cache.dialog_token); + fallthrough; + case FSM_EV_DISCONNECTED: /* no need to reply btm_req */ + rtw_fsm_st_goto(pbtm, BTM_ST_END); + break; + case FSM_EV_STATE_OUT: + rtw_fsm_cancel_alarm(pbtm); + for (i = 0; i < pbtm->pnb.nb_rpt.nb_list_num; i++) { + band = rtw_get_band_by_op_class(pbtm->pnb.nb_rpt.nb_list[i].ent.reg_class); + FSM_INFO(pbtm, "roam list "MAC_FMT" opc:%3d, ch:%3d-%s\n", + MAC_ARG(pbtm->pnb.nb_rpt.nb_list[i].ent.bssid), + pbtm->pnb.nb_rpt.nb_list[i].ent.reg_class, + pbtm->pnb.nb_rpt.nb_list[i].ent.ch_num, + rtw_band_str(band)); + } + break; + default: + break; + } + + return _SUCCESS; +} + static int btm_scan_st_hdl(void *obj, u16 event, void *param) { struct btm_obj *pbtm = (struct btm_obj *)obj; @@ -553,9 +492,21 @@ static int btm_scan_st_hdl(void *obj, u16 event, void *param) struct wlan_network *pnetwork = NULL; struct wlan_network *cnetwork = pmlmepriv->cur_network_scanned; struct roam_nb_info *mlmepriv_pnb = &(pmlmepriv->nb_info); + WLAN_BSSID_EX *bss; + u8 ssc_chk; switch (event) { case FSM_EV_STATE_IN: + case BTM_EV_scan_deny_expire: + ssc_chk = rtw_sitesurvey_condition_check(a, _FALSE); + if (ssc_chk == SS_DENY_BUSY_TRAFFIC) { + FSM_INFO(pbtm, "need to roam, don't care BusyTraffic\n"); + } else if (ssc_chk != SS_ALLOW) { + rtw_fsm_set_alarm(pbtm, BTM_SCAN_DENY_WAIT, BTM_EV_scan_deny_expire); + return _SUCCESS; + } + + /* Able to scan */ if (!btm_roam_scan(pbtm)) { rtw_fsm_st_goto(pbtm, BTM_ST_END); return _SUCCESS; @@ -567,6 +518,13 @@ static int btm_scan_st_hdl(void *obj, u16 event, void *param) case BTM_EV_scan_opch_reported: pbtm->op_ch_reported = 1; break; + case BTM_EV_scan_probe_req: + memcpy((void *)&pbtm->scan_ch, param, sizeof(struct rtw_ieee80211_channel)); + rtw_fsm_set_alarm_ext(pbtm, 10, BTM_EV_scan_probe_req_timeout, 2, NULL); + fallthrough; + case BTM_EV_scan_probe_req_timeout: + btm_issue_probe_req(pbtm); + break; case BTM_EV_scan_found_candidate: pnetwork = (struct wlan_network *)param; @@ -602,7 +560,16 @@ static int btm_scan_st_hdl(void *obj, u16 event, void *param) case FSM_EV_SCAN_DONE: rtw_fsm_cancel_alarm(pbtm); - if (pbtm->roam_reason & RTW_ROAM_BTM) { + if (pbtm->roam_reason & RTW_ROAM_ACTIVE) { + if (pbtm->candidate) { + pmlmepriv->roam_scan_count = 0; + pmlmepriv->roam_freeze_rssi = 0; + } else { + FSM_INFO(pbtm, "Pick a candidate from scan queue\n"); + pbtm->candidate = rtw_select_roaming_candidate(pmlmepriv); + } + + } else if (pbtm->roam_reason & RTW_ROAM_BTM) { pbtm->resp_reason = rtw_wmn_btm_rsp_reason_decision(a, pnb); if (pbtm->resp_reason > 0) { @@ -610,17 +577,7 @@ static int btm_scan_st_hdl(void *obj, u16 event, void *param) rtw_fsm_st_goto(pbtm, BTM_ST_END); return _SUCCESS; } - if (!pbtm->candidate) { - FSM_INFO(pbtm, "Pick a candidate from scan queue\n"); -#ifdef DBG_WNM_UNIT_TEST - pbtm->candidate = rtw_wnm_btm_candidate_select(a, pnb); -#else - if (!rtw_mbo_wifi_logo_test(a)) - pbtm->candidate = rtw_select_roaming_candidate(pmlmepriv); - else - pbtm->candidate = rtw_wnm_btm_candidate_select(a, pnb); -#endif - } + if (pbtm->candidate) { _rtw_memcpy(pnb->roam_target_addr, (u8 *)&pbtm->candidate->network.MacAddress, @@ -631,6 +588,13 @@ static int btm_scan_st_hdl(void *obj, u16 event, void *param) _rtw_memcpy(mlmepriv_pnb->roam_target_addr, (u8 *)&pbtm->candidate->network.MacAddress, ETH_ALEN); + } else { + FSM_INFO(pbtm, "Pick a candidate from scan queue\n"); + + if (rtw_mbo_wifi_logo_test(a) || rtw_chk_roam_flags(a, RTW_ROAM_BTM_IGNORE_DELTA)) + pbtm->candidate = rtw_wnm_btm_candidate_select(a, pnb); + else + pbtm->candidate = rtw_select_roaming_candidate(pmlmepriv); } } else if (pbtm->roam_reason & RTW_ROAM_ON_RESUME) { @@ -665,6 +629,20 @@ static int btm_scan_st_hdl(void *obj, u16 event, void *param) case FSM_EV_STATE_OUT: rtw_fsm_cancel_alarm(pbtm); rtw_fsm_cancel_alarm_ext(pbtm, 1); + rtw_fsm_cancel_alarm_ext(pbtm, 2); + + if (pbtm->candidate) { + bss = &pbtm->candidate->network; + FSM_INFO(pbtm, "rtw_select_roam_candidate: %s("MAC_FMT", ch:%u-%s) rssi:%d\n", + pbtm->candidate->network.Ssid.Ssid, + MAC_ARG(bss->MacAddress), + bss->Configuration.DSConfig, + rtw_band_str(bss->Configuration.Band), + (int)bss->PhyInfo.rssi); + } else { + FSM_INFO(pbtm, "rtw_select_roam_candidate: NULL\n"); + } + if (pbtm->roam_reason & RTW_ROAM_BTM) rtw_wnm_issue_action(a, pnb, RTW_WLAN_ACTION_WNM_BTM_RSP, pbtm->resp_reason, pnb->btm_cache.dialog_token); @@ -724,11 +702,17 @@ static int btm_roam_st_hdl(void *obj, u16 event, void *param) switch (event) { case FSM_EV_STATE_IN: - RTW_INFO("roaming from %s("MAC_FMT"), length:%d\n", + FSM_INFO(pbtm, "roam from %s("MAC_FMT", ch:%d-%s) rssi:%d\n", pmlmepriv->dev_cur_network.network.Ssid.Ssid, MAC_ARG(pmlmepriv->dev_cur_network.network.MacAddress), - pmlmepriv->dev_cur_network.network.Ssid.SsidLength); + pmlmepriv->dev_cur_network.network.Configuration.DSConfig, + rtw_band_str(pmlmepriv->dev_cur_network.network.Configuration.Band), + a->recvinfo.bcn_rssi); + _rtw_memcpy(&pmlmepriv->roam_from_addr, + pmlmepriv->dev_cur_network.network.MacAddress, ETH_ALEN); + +#if 0 /* No need to wait AP disconnects us */ if (pbtm->pnb.btm_cache.req_mode & DISASSOC_IMMINENT) { /* indicates that the STA is to be disassociated * from the current AP */ @@ -737,6 +721,7 @@ static int btm_roam_st_hdl(void *obj, u16 event, void *param) } fallthrough; case BTM_EV_disassoc_timeout: +#endif if (rtw_ft_otd_roam(a)) { pmlmeinfo->disconnect_code = DISCONNECTION_BY_DRIVER_DUE_TO_FT; } else { @@ -744,13 +729,19 @@ static int btm_roam_st_hdl(void *obj, u16 event, void *param) pmlmeinfo->disconnect_code = DISCONNECTION_BY_DRIVER_DUE_TO_ROAMING; } + rtw_fsm_set_alarm(pbtm, BTM_DISASSOC_WAIT, BTM_EV_disassoc_timeout); + receive_disconnect(a, pmlmepriv->dev_cur_network.network.MacAddress , WLAN_REASON_ACTIVE_ROAM, _FALSE); break; + case BTM_EV_disassoc_timeout: case FSM_EV_DISCONNECTED: - FSM_INFO(pbtm, "roaming to %s(" MAC_FMT ")\n", + FSM_INFO(pbtm, "roam to %s("MAC_FMT", ch:%d-%s) rssi:%d\n", pbtm->candidate->network.Ssid.Ssid, - MAC_ARG(pbtm->candidate->network.MacAddress)); + MAC_ARG(pbtm->candidate->network.MacAddress), + pbtm->candidate->network.Configuration.DSConfig, + rtw_band_str(pbtm->candidate->network.Configuration.Band), + pbtm->candidate->network.PhyInfo.rssi); _rtw_memcpy(&pmlmepriv->assoc_ssid, &pmlmepriv->dev_cur_network.network.Ssid, sizeof(NDIS_802_11_SSID)); @@ -761,8 +752,15 @@ static int btm_roam_st_hdl(void *obj, u16 event, void *param) /* Start to connect */ if (!rtw_do_join(a)) { rtw_fsm_st_goto(pbtm, BTM_ST_END); + return _SUCCESS; } +#if 1 + /* finish when disconnected */ + pbtm->finish = _SUCCESS; + rtw_fsm_st_goto(pbtm, BTM_ST_END); +#else rtw_fsm_set_alarm(pbtm, BTM_CONNECT_WAIT, BTM_EV_connect_timeout); +#endif break; case FSM_EV_CONNECTED: pbtm->finish = _SUCCESS; @@ -844,12 +842,21 @@ static void btm_debug(void *obj, char input[][MAX_ARGV], u32 input_num, return; } +static u16 btm_new_cid(struct btm_priv *btmpriv) +{ + do { + btmpriv->id_seq++; + } while (btmpriv->id_seq == 0); + + return (btmpriv->id_seq << 8); +} + /* For EXTERNAL application to create a btm object * return * btm_obj: ptr to new btm object */ int rtw_btm_new_obj(_adapter *a, struct sta_info *psta, - struct roam_nb_info *pnb, u8 roam_reason) + struct roam_nb_info *pnb, u16 roam_reason) { struct btm_priv *btmpriv = &a->fsmpriv.btmpriv; struct fsm_main *fsm = btmpriv->fsm; @@ -876,6 +883,8 @@ int rtw_btm_new_obj(_adapter *a, struct sta_info *psta, if (roam_reason == RTW_ROAM_BTM) cid = pnb->btm_cache.dialog_token; + else + cid = btm_new_cid(btmpriv); obj = rtw_fsm_new_obj(fsm, psta, cid, (void **)&pbtm, sizeof(*pbtm)); @@ -889,12 +898,14 @@ int rtw_btm_new_obj(_adapter *a, struct sta_info *psta, pbtm->roam_reason = roam_reason; pbtm->finish = _FAIL; - _rtw_memcpy(&pbtm->pnb, pnb, sizeof(*pnb)); + if (roam_reason == RTW_ROAM_BTM) + _rtw_memcpy(&pbtm->pnb, pnb, sizeof(*pnb)); + else /* copy from rrm */ + rtw_rrm_get_nb_rpt(a, &pbtm->pnb.nb_rpt); /* activate it immediately */ rtw_fsm_activate_obj(pbtm); pmlmepriv->need_to_roam = _TRUE; - btmpriv->btm = pbtm; psta->btm = pbtm; return _SUCCESS; @@ -907,11 +918,25 @@ void rtw_btm_notify_action_resp(struct btm_obj *pbtm) void rtw_btm_notify_scan_found_candidate(struct btm_obj *pbtm, struct wlan_network *pnetwork) { + _adapter *a = obj2adp(pbtm); + + if (!rtw_chk_roam_flags(a, RTW_ROAM_QUICK_SCAN)) + return; + if (!pnetwork) return; rtw_fsm_gen_msg(pbtm, (void *)pnetwork, 0, BTM_EV_scan_found_candidate); } +void rtw_btm_notify_scan_probe_req(struct btm_obj *pbtm, struct phl_scan_channel *scan_ch) +{ + struct rtw_ieee80211_channel ch; + + ch.hw_value = scan_ch->channel; + ch.band = scan_ch->band; + rtw_fsm_gen_msg(pbtm, &ch, sizeof(ch), BTM_EV_scan_probe_req); +} + /* For EXTERNAL application to create RRM FSM */ int rtw_btm_reg_fsm(struct fsm_priv *fsmpriv) { diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_ft.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_ft.c index 58e60a7d..1f688cf5 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_ft.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_ft.c @@ -40,7 +40,6 @@ void rtw_ft_info_init(struct ft_roam_info *pft) | RTW_FT_BTM_ROAM #endif ; - pft->ft_updated_bcn = _FALSE; RTW_FT_INFO("%s : ft_flags=0x%02x\n", __func__, pft->ft_flags); } @@ -274,116 +273,6 @@ void rtw_ft_validate_akm_type(_adapter *padapter, RTW_FT_INFO("%s : ft_flags=0x%02x\n", __func__, pft_roam->ft_flags); } -void rtw_ft_update_bcn(_adapter *padapter, union recv_frame *precv_frame) -{ - struct _ADAPTER_LINK *padapter_link = precv_frame->u.hdr.adapter_link; - struct link_mlme_ext_priv *pmlmeext = &padapter_link->mlmeextpriv; - struct link_mlme_ext_info *pmlmeinfo = &(padapter_link->mlmeextpriv.mlmext_info); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - u8 *pframe = precv_frame->u.hdr.rx_data; - uint len = precv_frame->u.hdr.len; - WLAN_BSSID_EX *pbss; - - if (rtw_ft_chk_status(padapter,RTW_FT_ASSOCIATED_STA) - && (pmlmepriv->ft_roam.ft_updated_bcn == _FALSE)) { - pbss = (WLAN_BSSID_EX*)rtw_malloc(sizeof(WLAN_BSSID_EX)); - if (pbss) { - if (collect_bss_info( - padapter, precv_frame, pbss) == _SUCCESS) { - struct beacon_keys recv_beacon; - - /* Update adapter network info */ - rtw_update_adapter_network( - &(pmlmepriv->dev_cur_network.network), - pbss, padapter, _TRUE); - - rtw_update_network( - &(padapter_link->mlmepriv.cur_network.network), - pbss, padapter, _TRUE); - - /* Move into rtw_get_bcn_keys */ - /* rtw_get_bcn_info(&(pmlmepriv->cur_network)); */ - - /* update bcn keys */ - if (rtw_get_bcn_keys(padapter, padapter_link, pframe, len, - &recv_beacon) == _TRUE) { - - RTW_FT_INFO("%s: beacon keys ready\n", - __func__); - - _rtw_memcpy( - &padapter_link->mlmepriv.cur_beacon_keys, - &recv_beacon, - sizeof(recv_beacon)); - - if (is_hidden_ssid( - recv_beacon.ssid, - recv_beacon.ssid_len)) { - - _rtw_memcpy( - padapter_link->mlmepriv.cur_beacon_keys.ssid, - pmlmeinfo->network.Ssid.Ssid, - IW_ESSID_MAX_SIZE); - - padapter_link->mlmepriv.cur_beacon_keys.ssid_len = \ - pmlmeinfo->network.Ssid.SsidLength; - } - } else { - RTW_ERR("%s: get beacon keys failed\n", - __func__); - _rtw_memset( - &padapter_link->mlmepriv.cur_beacon_keys, - 0, sizeof(recv_beacon)); - } - #ifdef CONFIG_BCN_CNT_CONFIRM_HDL - pmlmepriv->new_beacon_cnts = 0; - #endif - } - rtw_mfree((u8*)pbss, sizeof(WLAN_BSSID_EX)); - } - - /* check the vendor of the assoc AP */ - padapter->mlmeextpriv.mlmext_info.assoc_AP_vendor = - check_assoc_AP( - pframe + sizeof(struct rtw_ieee80211_hdr_3addr), - (len - sizeof(struct rtw_ieee80211_hdr_3addr)) - ); - - /* update TSF Value */ - update_TSF(pmlmeext, pframe, len); - pmlmeext->bcn_cnt = 0; - pmlmeext->last_bcn_cnt = 0; - pmlmepriv->ft_roam.ft_updated_bcn = _TRUE; - } -} - -void rtw_ft_start_clnt_join(_adapter *padapter) -{ - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct ft_roam_info *pft_roam = &(pmlmepriv->ft_roam); - - if (rtw_ft_otd_roam(padapter)) { - pmlmeinfo->state = WIFI_FW_AUTH_SUCCESS | WIFI_FW_STATION_STATE; - pft_roam->ft_event.ies = - (pft_roam->ft_action + \ - sizeof(struct rtw_ieee80211_hdr_3addr) + 16); - pft_roam->ft_event.ies_len = - (pft_roam->ft_action_len - \ - sizeof(struct rtw_ieee80211_hdr_3addr)); - - /*Not support RIC*/ - pft_roam->ft_event.ric_ies = NULL; - pft_roam->ft_event.ric_ies_len = 0; - rtw_ft_report_evt(padapter); - return; - } - - pmlmeinfo->state = WIFI_FW_AUTH_NULL | WIFI_FW_STATION_STATE; - start_clnt_auth(padapter); -} - u8 rtw_ft_update_rsnie( _adapter *padapter, u8 bwrite, struct pkt_attrib *pattrib, u8 **pframe) @@ -709,6 +598,10 @@ void rtw_ft_link_timer_hdl(void *ctx) struct ft_roam_info *pft_roam = &(pmlmepriv->ft_roam); if (rtw_ft_chk_status(padapter, RTW_FT_REQUESTING_STA)) { + if (pmlmepriv->roam_network) { + pmlmepriv->roam_buf_pkt = _TRUE; + rtw_roam_stop_queue(padapter); + } if (pft_roam->ft_req_retry_cnt < RTW_FT_ACTION_REQ_LMT) { pft_roam->ft_req_retry_cnt++; rtw_ft_issue_action_req(padapter, @@ -750,8 +643,6 @@ void rtw_ft_roam_status_reset(_adapter *padapter) (!rtw_ft_chk_status(padapter, RTW_FT_REQUESTED_STA))) { rtw_ft_reset_status(padapter); } - - padapter->mlmepriv.ft_roam.ft_updated_bcn = _FALSE; } void rtw_ft_peer_info_init(struct sta_info *psta) diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_he.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_he.c index 0723b22a..8f848f01 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_he.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_he.c @@ -1545,7 +1545,7 @@ static int rtw_build_max_cohost_bssid_ind(_adapter *padapter, u8 *pbuf) } static int rtw_build_6g_oper_info(_adapter *padapter, struct _ADAPTER_LINK *padapter_link, - u8 *pbuf, struct rtw_chan_def *chandef) + u8 *pbuf, struct rtw_chan_def *chandef, u8 regu) { struct link_mlme_ext_priv *pmlmeext = &padapter_link->mlmeextpriv; int info_len = 5; @@ -1553,6 +1553,10 @@ static int rtw_build_6g_oper_info(_adapter *padapter, struct _ADAPTER_LINK *pada /* Set 6GHz Operation Information */ SET_HE_OP_INFO_PRIMARY_CHAN(pbuf, chandef->chan); + /* control */ + SET_HE_OP_INFO_CHAN_WIDTH(pbuf, chandef->bw); + SET_HE_OP_INFO_REGULATORY_INFO(pbuf, regu); + if (!chandef->center_freq1) SET_HE_OP_INFO_CENTER_FREQ_0(pbuf, chandef->chan); else @@ -1567,7 +1571,7 @@ static int rtw_build_6g_oper_info(_adapter *padapter, struct _ADAPTER_LINK *pada u32 rtw_build_he_operation_ie(_adapter *padapter, struct _ADAPTER_LINK *padapter_link, - u8 *pbuf, struct rtw_chan_def *chandef) + u8 *pbuf, struct rtw_chan_def *chandef, u8 regu) { struct link_mlme_priv *pmlmepriv = &padapter_link->mlmepriv; struct he_priv *phepriv = &pmlmepriv->hepriv; @@ -1602,7 +1606,7 @@ u32 rtw_build_he_operation_ie(_adapter *padapter, #if CONFIG_IEEE80211_BAND_6GHZ /* 6G Oper Info */ if (he_6g_op_present) - poper += rtw_build_6g_oper_info(padapter, padapter_link, poper, chandef); + poper += rtw_build_6g_oper_info(padapter, padapter_link, poper, chandef, regu); #endif he_oper_total_len = (poper - poper_start); @@ -1652,7 +1656,7 @@ void rtw_he_ies_attach(_adapter *padapter, struct _ADAPTER_LINK *padapter_link, pnetwork->IELength += cap_len; operation_len = rtw_build_he_operation_ie(padapter, padapter_link, pnetwork->IEs + pnetwork->IELength, - &padapter_link->mlmeextpriv.chandef); + &padapter_link->mlmeextpriv.chandef, 0); pnetwork->IELength += operation_len; pmlmepriv->hepriv.he_option = _TRUE; @@ -1801,6 +1805,7 @@ void rtw_update_he_ies(_adapter *padapter, struct _ADAPTER_LINK *padapter_link, u8 he_op_ie_len; u8 he_op_ie[255]; u8 he_op_eid_ext = WLAN_EID_EXTENSION_HE_OPERATION; + u8 *_6g_op_info, regu = 0; RTW_INFO("Don't setting HE capability/operation IE from hostap, builded by driver temporarily\n"); rtw_he_use_default_setting(padapter, padapter_link); @@ -1809,8 +1814,14 @@ void rtw_update_he_ies(_adapter *padapter, struct _ADAPTER_LINK *padapter_link, he_cap_ie_len = rtw_build_he_cap_ie(padapter, padapter_link, he_cap_ie, chandef->band); rtw_add_bcn_ie_ex(padapter, pnetwork, he_cap_eid_ext, he_cap_ie + 2, he_cap_ie_len - 2); + /* get regulatory info */ + _6g_op_info = rtw_ies_get_he_6g_op_info_ie(pnetwork->IEs + _FIXED_IE_LENGTH_, + pnetwork->IELength - _FIXED_IE_LENGTH_); + if (_6g_op_info) + regu = GET_HE_OP_INFO_REG_INFO(_6g_op_info); + rtw_remove_bcn_ie_ex(padapter, pnetwork, WLAN_EID_EXTENSION, &he_op_eid_ext, 1); - he_op_ie_len = rtw_build_he_operation_ie(padapter, padapter_link, he_op_ie, chandef); + he_op_ie_len = rtw_build_he_operation_ie(padapter, padapter_link, he_op_ie, chandef, regu); rtw_add_bcn_ie_ex(padapter, pnetwork, he_op_eid_ext, he_op_ie + 2, he_op_ie_len - 2); } @@ -1823,6 +1834,7 @@ void rtw_update_probe_rsp_he_cap_and_op(struct _ADAPTER *a, u8 *ies, sint *ies_l uint ie_len; u8 he_cap_eid_ext = WLAN_EID_EXTENSION_HE_CAPABILITY; u8 he_op_eid_ext = WLAN_EID_EXTENSION_HE_OPERATION; + u8 *_6g_op_info, regu = 0; he_cap_ie = rtw_get_ie_ex(ies, *ies_len, WLAN_EID_EXTENSION, &he_cap_eid_ext, 1, NULL, &ie_len); @@ -1835,8 +1847,13 @@ void rtw_update_probe_rsp_he_cap_and_op(struct _ADAPTER *a, u8 *ies, sint *ies_l he_op_ie = rtw_get_ie_ex(ies, *ies_len, WLAN_EID_EXTENSION, &he_op_eid_ext, 1, NULL, &ie_len); if (he_op_ie) { + /* get regulatory info */ + _6g_op_info = rtw_ies_get_he_6g_op_info_ie(ies, ie_len); + if (_6g_op_info) + regu = GET_HE_OP_INFO_REG_INFO(_6g_op_info); + cur_he_op_ie_len = rtw_build_he_operation_ie(a, a_link, - cur_he_op_ie, &a_link->mlmeextpriv.chandef); + cur_he_op_ie, &a_link->mlmeextpriv.chandef, regu); rtw_ies_update_ie_ex(ies, ies_len, 0, WLAN_EID_EXTENSION_HE_OPERATION, cur_he_op_ie, cur_he_op_ie_len); } diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_ieee80211.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_ieee80211.c index b86fd55e..513992eb 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_ieee80211.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_ieee80211.c @@ -778,7 +778,7 @@ u8 rtw_update_rate_bymode(WLAN_BSSID_EX *pbss_network, u32 mode) } network_type = WLAN_MD_11B; } else { - if (pbss_network->Configuration.DSConfig > 14) { + if (BSS_EX_OP_BAND(pbss_network) != BAND_ON_24G){ /* Remove CCK in support_rate IE */ rtw_filter_suppport_rateie(pbss_network, OFDM); network_type = WLAN_MD_11A; @@ -2121,7 +2121,7 @@ ParseRes rtw_ieee802_11_override_elems_by_mbssid( uint left = mbssid_ie_len; u8 *pos = mbssid_ie; u8 max_bssid_indicator; - int unknown = 0; + ParseRes ret = ParseOK; if (left < 3) { RTW_WARN("%s mbssid_ie_len < 3\n", __func__); @@ -2156,7 +2156,7 @@ ParseRes rtw_ieee802_11_override_elems_by_mbssid( switch (id) { case MBSSID_NONTRANSMITTED_BSSID_PROFILE_ID: if (rtw_mbssid_ntbssid_profile_match_id(pos, elen, mbssid_idx)) - _rtw_ieee802_11_parse_elems(pos, elen, elems, show_errors, false); + ret = _rtw_ieee802_11_parse_elems(pos, elen, elems, show_errors, false); break; default: break; @@ -2168,7 +2168,7 @@ ParseRes rtw_ieee802_11_override_elems_by_mbssid( if (left) return ParseFailed; - return unknown ? ParseUnknown : ParseOK; + return ret; } #endif /* CONFIG_STA_MULTIPLE_BSSID */ diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_ioctl_set.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_ioctl_set.c index 614a9c13..b0587f31 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_ioctl_set.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_ioctl_set.c @@ -96,7 +96,7 @@ u8 rtw_do_join(_adapter *padapter) pmlmepriv->to_join = _TRUE; - rtw_init_sitesurvey_parm(padapter, parm); + rtw_init_sitesurvey_parm(parm); _rtw_memcpy(&parm->ssid[0], &pmlmepriv->assoc_ssid, sizeof(NDIS_802_11_SSID)); parm->ssid_num = 1; @@ -767,24 +767,6 @@ u16 rtw_get_cur_max_rate(_adapter *adapter) return max_rate; } -/* -* rtw_set_scan_mode - -* @adapter: pointer to _adapter structure -* @scan_mode: -* -* Return _SUCCESS or _FAIL -*/ -int rtw_set_scan_mode(_adapter *adapter, enum rtw_phl_scan_type scan_mode) -{ - if (scan_mode != RTW_PHL_SCAN_ACTIVE && - scan_mode != RTW_PHL_SCAN_PASSIVE) - return _FAIL; - - adapter->mlmepriv.scan_mode = scan_mode; - - return _SUCCESS; -} - /* * rtw_set_channel_plan - * @adapter: pointer to _adapter structure @@ -795,9 +777,7 @@ int rtw_set_scan_mode(_adapter *adapter, enum rtw_phl_scan_type scan_mode) int rtw_set_channel_plan(_adapter *adapter, u8 channel_plan, u8 chplan_6g , enum rtw_env_t env, enum rtw_regd_inr inr) { - struct registry_priv *regsty = adapter_to_regsty(adapter); - - if (!REGSTY_REGD_SRC_FROM_OS(regsty)) + if (!REGSTY_REGD_SRC_FROM_OS(adapter_to_regsty(adapter))) return rtw_set_chplan_cmd(adapter, RTW_CMDF_WAIT_ACK, channel_plan, chplan_6g, env, inr); RTW_WARN("%s(): not applied\n", __func__); return _SUCCESS; @@ -823,9 +803,7 @@ int rtw_set_country(_adapter *adapter, const char *country_code #endif #if CONFIG_RTW_IOCTL_SET_COUNTRY - struct registry_priv *regsty = adapter_to_regsty(adapter); - - if (!REGSTY_REGD_SRC_FROM_OS(regsty)) + if (!REGSTY_REGD_SRC_FROM_OS(adapter_to_regsty(adapter))) return rtw_set_country_cmd(adapter, RTW_CMDF_WAIT_ACK, country_code, env, inr); #endif RTW_WARN("%s(): not applied\n", __func__); @@ -842,10 +820,8 @@ int rtw_set_country(_adapter *adapter, const char *country_code */ int rtw_set_env(_adapter *adapter, enum rtw_env_t env, enum rtw_regd_inr inr) { - struct registry_priv *regsty = adapter_to_regsty(adapter); - return rtw_set_env_cmd(adapter, RTW_CMDF_WAIT_ACK, env - , REGSTY_REGD_SRC_FROM_OS(regsty) ? REGD_SRC_OS : REGD_SRC_RTK_PRIV + , REGSTY_REGD_SRC_FROM_OS(adapter_to_regsty(adapter)) ? REGD_SRC_OS : REGD_SRC_RTK_PRIV , inr); } #endif diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_mlme.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_mlme.c index b195a5be..dc224097 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_mlme.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_mlme.c @@ -55,7 +55,9 @@ sint _rtw_init_mlme_priv(_adapter *padapter) #endif u8 *pmld_buf; struct wlan_mld_network *pmld_network; - +#ifdef CONFIG_LAYER2_ROAMING + char str[8]; +#endif /* We don't need to memset padapter->XXX to zero, because adapter is allocated by rtw_zvmalloc(). */ /* _rtw_memset((u8 *)pmlmepriv, 0, sizeof(struct mlme_priv)); */ @@ -71,7 +73,6 @@ sint _rtw_init_mlme_priv(_adapter *padapter) pmlmepriv->pscanned = NULL; init_fwstate(pmlmepriv, WIFI_STATION_STATE); pmlmepriv->dev_cur_network.network.InfrastructureMode = Ndis802_11AutoUnknown; - pmlmepriv->scan_mode = RTW_PHL_SCAN_ACTIVE; /* 1: active, 0: pasive. Maybe someday we should rename this varable to "active_mode" (Jeff) */ _rtw_spinlock_init(&(pmlmepriv->lock)); _rtw_init_queue(&(pmlmepriv->free_bss_pool)); @@ -170,23 +171,43 @@ sint _rtw_init_mlme_priv(_adapter *padapter) #endif #ifdef CONFIG_LAYER2_ROAMING -#define RTW_ROAM_SCAN_RESULT_EXP_MS (5*1000) -#define RTW_ROAM_RSSI_DIFF_TH 10 +#define RTW_ROAM_RSSI_DELTA 10 #if CONFIG_IEEE80211_BAND_6GHZ -#define RTW_ROAM_SCAN_INTERVAL (10) /* 10*(2 second)*/ +#define RTW_ROAM_SCAN_RESULT_EXP_MS (15*1000) #else -#define RTW_ROAM_SCAN_INTERVAL (5) /* 5*(2 second)*/ +#define RTW_ROAM_SCAN_RESULT_EXP_MS (10*1000) #endif -#define RTW_ROAM_RSSI_THRESHOLD 70 +#define RTW_ROAM_SCAN_INTERVAL (5) /* 5*(2 second)*/ +#define RTW_ROAM_RSSI_THRESHOLD 30 + +#define RTW_ROAM_RSSI_IDLE_TH RTW_ROAM_RSSI_THRESHOLD +#define RTW_ROAM_RSSI_BUSY_TH RTW_ROAM_RSSI_THRESHOLD + 5 + +#define RTW_ROAM_RSSI_IDLE_DELTA (RTW_ROAM_RSSI_DELTA - 5) +#define RTW_ROAM_RSSI_BUSY_DELTA RTW_ROAM_RSSI_DELTA pmlmepriv->roam_flags = CONFIG_ROAMING_FLAG; - pmlmepriv->roam_scanr_exp_ms = RTW_ROAM_SCAN_RESULT_EXP_MS; - pmlmepriv->roam_rssi_diff_th = RTW_ROAM_RSSI_DIFF_TH; pmlmepriv->roam_scan_int = RTW_ROAM_SCAN_INTERVAL; - pmlmepriv->roam_rssi_threshold = RTW_ROAM_RSSI_THRESHOLD; +#ifdef PRIVATE_N + pmlmepriv->roam_idle_rssi_th = RTW_ROAM_RSSI_IDLE_TH; + pmlmepriv->roam_busy_rssi_th = RTW_ROAM_RSSI_BUSY_TH; + + pmlmepriv->roam_idle_rssi_delta = RTW_ROAM_RSSI_IDLE_DELTA; + pmlmepriv->roam_busy_rssi_delta = RTW_ROAM_RSSI_BUSY_DELTA; +#else + pmlmepriv->roam_rssi_th = RTW_ROAM_RSSI_THRESHOLD; + pmlmepriv->roam_rssi_delta = RTW_ROAM_RSSI_DELTA; +#endif pmlmepriv->need_to_roam = _FALSE; pmlmepriv->last_roaming = rtw_get_current_time(); + _rtw_memset(pmlmepriv->roam_from_addr, 0, ETH_ALEN); + + sprintf(str,"%d", CONFIG_ROAM_SCAN_ORDER); + for (i = 0; i < sizeof(pmlmepriv->roam_scan_order); i++) + pmlmepriv->roam_scan_order[i] = + (str[i]=='2')?BAND_ON_24G:(str[i]=='5')?BAND_ON_5G:(str[i]=='6')?BAND_ON_6G:BAND_MAX; + #endif /* CONFIG_LAYER2_ROAMING */ #ifdef CONFIG_RTW_80211R @@ -2255,6 +2276,11 @@ void rtw_indicate_disconnect(_adapter *padapter, u16 reason, u8 locally_generate #ifdef CONFIG_LAYER2_ROAMING pmlmepriv->roam_network = NULL; + if (pmlmepriv->roam_buf_pkt) { + pmlmepriv->roam_buf_pkt = _FALSE; + rtw_roam_wake_queue(padapter); + } + _rtw_memset(pmlmepriv->roam_from_addr, 0, ETH_ALEN); #endif /* rtw_phl_chanctx_del(adapter_to_dvobj(padapter)->phl, padapter->phl_role, NULL); */ @@ -2694,6 +2720,9 @@ void rtw_joinbss_event_prehandle(_adapter *adapter, u8 *pbuf, u16 status) } else if (pnetwork->join_res == -4) { rtw_reset_securitypriv(adapter); pmlmepriv->join_status = status; +#ifdef CONFIG_LAYER2_ROAMING + dequeuq_roam_pkt(adapter, _TRUE); +#endif /*_set_timer(&pmlmepriv->assoc_timer, 1);*/ set_assoc_timer(pmlmepriv, 1); @@ -2720,6 +2749,9 @@ void rtw_joinbss_event_prehandle(_adapter *adapter, u8 *pbuf, u16 status) _clr_fwstate_(pmlmepriv, WIFI_UNDER_LINKING); rtw_indicate_connect(adapter); } else { +#endif +#ifdef CONFIG_LAYER2_ROAMING + dequeuq_roam_pkt(adapter, _TRUE); #endif pmlmepriv->join_status = status; /*_set_timer(&pmlmepriv->assoc_timer, 1);*/ @@ -2902,7 +2934,11 @@ static void _stadel_posthandle_sta(struct _ADAPTER *a, roam = _FALSE; } else if ((reason == WLAN_REASON_EXPIRATION_CHK) && rtw_chk_roam_flags(a, RTW_ROAM_ON_EXPIRED)) { +#ifdef CONFIG_RTW_FSM_BTM + roam = _FALSE; +#else roam = _TRUE; +#endif } else if ((reason == WLAN_REASON_ACTIVE_ROAM) && rtw_chk_roam_flags(a, RTW_ROAM_ACTIVE)) { roam = _TRUE; @@ -2913,6 +2949,9 @@ static void _stadel_posthandle_sta(struct _ADAPTER *a, && rtw_ft_chk_flags(a, RTW_FT_BTM_ROAM)) { roam = _TRUE; roam_target = mlme->roam_network; +#ifdef CONFIG_RTW_FSM_BTM + rtw_set_to_roam(a, 2); +#endif } #endif if (roam == _TRUE) { @@ -3099,7 +3138,7 @@ void rtw_join_timeout_handler(void *ctx) _rtw_spinlock_bh(&pmlmepriv->lock); #ifdef CONFIG_STA_CMD_DISPR - if (check_fwstate(pmlmepriv, WIFI_UNDER_LINKING) == _TRUE || adapter->connect_token) + if (check_fwstate(pmlmepriv, WIFI_UNDER_LINKING) == _TRUE) rtw_connect_abort(adapter); #endif /* CONFIG_STA_CMD_DISPR */ #ifdef CONFIG_LAYER2_ROAMING @@ -3159,7 +3198,7 @@ void rtw_join_timeout_handler(void *ctx) } -void rtw_mlme_reset_auto_scan_int(_adapter *adapter, u8 *reason) +static void rtw_mlme_reset_auto_scan_int(_adapter *adapter, u8 *reason, u32 *scan_int_ms) { #if defined(CONFIG_RTW_MESH) && defined(CONFIG_DFS_MASTER) #if CONFIG_RTW_MESH_OFFCH_CAND @@ -3171,6 +3210,11 @@ void rtw_mlme_reset_auto_scan_int(_adapter *adapter, u8 *reason) struct rtw_chan_def union_chdef = {0}; /* ToDo CONFIG_RTW_MLD: [currently primary link only] */ struct _ADAPTER_LINK *adapter_link = GET_PRIMARY_LINK(adapter); +#ifdef CONFIG_80211D + bool urgent; +#endif + struct mlme_ext_priv *mlmeext = &adapter->mlmeextpriv; + struct ss_res *ss = &mlmeext->sitesurvey_res; *reason = RTW_AUTO_SCAN_REASON_UNSPECIFIED; @@ -3185,6 +3229,7 @@ void rtw_mlme_reset_auto_scan_int(_adapter *adapter, u8 *reason) && is_client_associated_to_ap(adapter) == _TRUE && union_chdef.chan >= 1 && union_chdef.chan <= 14 && adapter->registrypriv.wifi_spec + && ss->scan_2040bss /* TODO: AP Connected is 40MHz capability? */ ) { interval_ms = rtw_min(interval_ms, 60 * 1000); @@ -3192,11 +3237,8 @@ void rtw_mlme_reset_auto_scan_int(_adapter *adapter, u8 *reason) } #ifdef CONFIG_80211D - if (adapter_to_rfctl(adapter)->cis_enabled - && (adapter_to_rfctl(adapter)->cis_flags & CISF_ENV_BSS) - && adapter_to_rfctl(adapter)->cis_scan_int_ms - ) { - interval_ms = rtw_min(interval_ms, adapter_to_rfctl(adapter)->cis_scan_int_ms); + if (rtw_cis_scan_needed(adapter_to_rfctl(adapter), &urgent)) { + interval_ms = rtw_min(interval_ms, urgent ? RTW_ASCAN_INT_URGENT : RTW_ASCAN_INT_ASAP); *reason |= RTW_AUTO_SCAN_REASON_CIS_ENV_BSS; } #endif @@ -3216,23 +3258,87 @@ void rtw_mlme_reset_auto_scan_int(_adapter *adapter, u8 *reason) #endif /* CONFIG_RTW_MESH */ if (interval_ms == 0xffffffff) - interval_ms = 0; + interval_ms = RTW_ASCAN_INT_NONE; - rtw_mlme_set_auto_scan_int(adapter, interval_ms); - return; + *scan_int_ms = interval_ms; } +#define DELTA(a,b) (a>b)?(a-b):(b-a) + +/* This function has 3 purposes: + * 1) check roam scan interval is reached or not + * 2) extend roam scan interval if continually fail to find roam candidate + * 3) if rssi change a lot (have a movement?) do roam scan immedinatelly + * + * roam scan extension use 10 seconds as example: + * base_steps = 3, first 3 times keep original 10 seconds interval + * double_steps = 6, following 5 times double previous interval + * 10, 10, 10, 20, 40, 80, 160, 320, 640, 640, 640 ....... + */ +static int reach_roam_interval(_adapter *padapter, u8 rssi) +{ + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + int n, times, try_count, rssi_offset, delta = 0; + int base_steps = 3; /* 10, 10, 10 sec */ + int double_steps = 6; /* 20, 40, 80, 160, 320 640 sec */ + u32 wait_sec, pass_sec; + + times = 1; + try_count = pmlmepriv->roam_scan_count; + rssi_offset = 0; + + if (!rtw_chk_roam_flags(padapter, RTW_ROAM_ACTIVE_INTERVAL_EXT)) + goto done; + + delta = wnm_roam_rssi_delta(pmlmepriv); + if (try_count >= base_steps) { + + if (try_count == base_steps && !pmlmepriv->roam_freeze_rssi) /* reference rssi for moving detection */ + pmlmepriv->roam_freeze_rssi = rssi; + + rssi_offset = (pmlmepriv->roam_freeze_rssi>0)?DELTA(rssi, pmlmepriv->roam_freeze_rssi):0; + + if ((rssi_offset > 0) && rssi_offset >= delta) { + + RTW_INFO("Do roam rssi(%d/%d/f%d), do roam\n", rssi_offset, //0,10,72 + delta, pmlmepriv->roam_freeze_rssi); + + pmlmepriv->roam_scan_count = 0; /* reset */ + pmlmepriv->roam_freeze_rssi = 0; + return _SUCCESS; /* things change, scan angain */ + } + + /* 2 to the n'th power */ + n = MIN(try_count - base_steps, double_steps - 1); + times = 2<<(n); + } +done: + wait_sec = pmlmepriv->roam_scan_int * 2 * times; + pass_sec = rtw_get_passing_time_ms(pmlmepriv->last_roaming)/1000; + + if (pmlmepriv->roam_freeze_rssi > 0) + RTW_INFO("roam try_cnt=%d, wait(%d/%d), rssi(%d/%d/f%d)\n", + try_count + 1, pass_sec, wait_sec, rssi_offset, + delta, pmlmepriv->roam_freeze_rssi); + + if (pass_sec >= wait_sec) + return _SUCCESS; + + return _FAIL; +} static void rtw_auto_scan_handler(_adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; u8 reason = RTW_AUTO_SCAN_REASON_UNSPECIFIED; + u32 scan_int_ms; #ifdef CONFIG_LAYER2_ROAMING struct recv_info *precvinfo = &padapter->recvinfo; #ifdef CONFIG_RTW_FSM_BTM struct sta_priv *pstapriv = &(padapter->stapriv); struct sta_info *psta; #endif + int avg, thd; #endif #ifdef CONFIG_80211AX_HE #ifdef CONFIG_TWT @@ -3240,7 +3346,7 @@ static void rtw_auto_scan_handler(_adapter *padapter) #endif #endif - rtw_mlme_reset_auto_scan_int(padapter, &reason); + rtw_mlme_reset_auto_scan_int(padapter, &reason, &scan_int_ms); #ifdef CONFIG_P2P if (rtw_p2p_chk_role(&padapter->wdinfo, P2P_ROLE_CLIENT) || @@ -3259,38 +3365,52 @@ static void rtw_auto_scan_handler(_adapter *padapter) goto exit; #endif #endif + if (rtw_mi_check_fwstate(padapter, WIFI_UNDER_SURVEY)) + goto exit; #ifdef CONFIG_LAYER2_ROAMING if (is_client_associated_to_ap(padapter) && rtw_chk_roam_flags(padapter, RTW_ROAM_ACTIVE)) { - RTW_INFO("avg_val = %d, need_to_roam=%d\n", precvinfo->signal_strength_data.avg_val, pmlmepriv->need_to_roam); - if (precvinfo->signal_strength_data.avg_val < pmlmepriv->roam_rssi_threshold) { + + avg = precvinfo->bcn_signal_strength; + thd = wnm_roam_rssi_th(pmlmepriv); + + if (avg == 0) + return; + + RTW_INFO("rssi = %d/%d, roam = %d\n", avg, thd, (avg < thd)?1:0); + + if (avg < thd) { pmlmepriv->need_to_roam = _TRUE; - if (rtw_get_passing_time_ms(pmlmepriv->last_roaming) >= pmlmepriv->roam_scan_int*2000) { -#if defined(CONFIG_LAYER2_ROAMING) && defined(CONFIG_RTW_80211K) - //rtw_roam_nb_discover(padapter, _FALSE); -#endif + if (reach_roam_interval(padapter, avg)) { reason = RTW_AUTO_SCAN_REASON_ROAM_ACTIVE; pmlmepriv->last_roaming = rtw_get_current_time(); + pmlmepriv->roam_scan_count++; goto do_scan; } - } else + } else { pmlmepriv->need_to_roam = _FALSE; + } } #endif - if (pmlmepriv->auto_scan_int_ms == 0 - || rtw_get_passing_time_ms(pmlmepriv->scan_start_time) < pmlmepriv->auto_scan_int_ms) + if (scan_int_ms == RTW_ASCAN_INT_NONE + || (scan_int_ms > RTW_ASCAN_INT_ASAP + && rtw_get_passing_time_ms(pmlmepriv->scan_start_time) < scan_int_ms) + ) goto exit; do_scan: #ifdef CONFIG_RTW_FSM_BTM if (pmlmepriv->need_to_roam) { psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); - if (psta) + if (psta) { rtw_btm_new_obj(padapter, psta, &pmlmepriv->nb_info, RTW_ROAM_ACTIVE); + goto exit; + } } -#else - rtw_drv_scan_by_self(padapter, reason); #endif + + rtw_drv_scan_by_self(padapter, reason, scan_int_ms == RTW_ASCAN_INT_URGENT); + exit: return; } @@ -3604,6 +3724,7 @@ void rtw_core_watchdog_sw_hdlr(void *drv_priv) { struct dvobj_priv *pdvobj = (struct dvobj_priv *)drv_priv; struct _ADAPTER *adapter = dvobj_get_primary_adapter(pdvobj); + bool cis_scan_needed; if (!adapter) goto exit; @@ -3616,10 +3737,17 @@ void rtw_core_watchdog_sw_hdlr(void *drv_priv) #endif /* SW only dynamic/periodic check even when device is idle */ - rtw_regd_watchdog_hdl(pdvobj); + cis_scan_needed = rtw_regd_watchdog_hdl(pdvobj); - if (!rtw_hw_is_init_completed(pdvobj)) + if (!rtw_hw_is_init_completed(pdvobj)) { + #ifdef CONFIG_80211D + if (cis_scan_needed) { + /* ENV BSS scan is needed when device idle (IPS-PWROFF) */ + rtw_cis_scan_idle_check(dvobj_to_rfctl(pdvobj)); + } + #endif goto exit; + } collect_traffic_statistics(adapter); collect_sta_traffic_statistics(adapter); @@ -3692,6 +3820,24 @@ exit: #endif #ifdef CONFIG_LAYER2_ROAMING +void rtw_wnm_candidate_info(struct wlan_network *pnetwork, struct wlan_network *cnetwork, u8 *reason) +{ + WLAN_BSSID_EX *bss; + + if (reason) { + RTW_INFO("candidate:%s %s("MAC_FMT", ch%3u-%s) rssi:%d dBm, age:%5d [%7s]\n", + (pnetwork == cnetwork) ? "*" : " " , + pnetwork->network.Ssid.Ssid, + MAC_ARG(pnetwork->network.MacAddress), + pnetwork->network.Configuration.DSConfig, + rtw_band_str(pnetwork->network.Configuration.Band), + (int)pnetwork->network.PhyInfo.rssi, + rtw_get_passing_time_ms(pnetwork->last_scanned), + reason + ); + } +} + /* * Select a new roaming candidate from the original @param candidate and @param competitor * @return _TRUE: candidate is updated @@ -3702,9 +3848,10 @@ int rtw_check_roaming_candidate(struct mlme_priv *mlme { int updated = _FALSE; _adapter *adapter = container_of(mlme, _adapter, mlmepriv); + struct recv_info *precvinfo = &adapter->recvinfo; struct rf_ctl_t *rfctl = adapter_to_rfctl(adapter); struct roam_nb_info *pnb = &(mlme->nb_info); - u8 *reason = NULL; + u8 *reason = NULL, delta; if (!rtw_network_chk_opch_status(rfctl, competitor)) goto exit; @@ -3740,30 +3887,31 @@ int rtw_check_roaming_candidate(struct mlme_priv *mlme } #endif #endif -#ifdef DBG_WNM_UNIT_TEST if (_rtw_memcmp(mlme->cur_network_scanned->network.MacAddress, competitor->network.MacAddress, ETH_ALEN) == _TRUE) { - printk("roam: omit Serving AP\n"); reason ="ServeAP"; goto exit; } -#else - if (rtw_get_passing_time_ms(competitor->last_scanned) >= mlme->roam_scanr_exp_ms) { - reason = "age"; - goto exit; - } - if (competitor->network.PhyInfo.rssi - - mlme->cur_network_scanned->network.PhyInfo.rssi < mlme->roam_rssi_diff_th) { - reason = "delta"; - goto exit; - } + /* for roam testing to ingore rssi/age/delta checking */ + if (!rtw_chk_roam_flags(adapter, RTW_ROAM_ACTIVE_IGNORE_CHK)) { - if (*candidate != NULL && (*candidate)->network.PhyInfo.rssi >= competitor->network.PhyInfo.rssi) { - reason = "rssi"; - goto exit; + if (rtw_get_passing_time_ms(competitor->last_scanned) >= mlme->roam_scanr_exp_ms) { + reason = "age"; + goto exit; + } + + delta = wnm_roam_rssi_delta(mlme); + if ((competitor->network.PhyInfo.rssi - precvinfo->bcn_rssi) < delta) { + reason = "delta"; + goto exit; + } + + if (*candidate != NULL && (*candidate)->network.PhyInfo.rssi >= competitor->network.PhyInfo.rssi) { + reason = "rssi"; + goto exit; + } } -#endif update: reason = "ok"; *candidate = competitor; @@ -3817,9 +3965,10 @@ struct wlan_network *rtw_select_roaming_candidate(struct mlme_priv *mlme) RTW_INFO("%s: return _FAIL(candidate == NULL)\n", __FUNCTION__); goto exit; } else { - RTW_INFO("%s: candidate: %s("MAC_FMT", ch:%u)\n", __FUNCTION__, + RTW_INFO("%s: %s("MAC_FMT", ch:%u-%s)\n", __FUNCTION__, candidate->network.Ssid.Ssid, MAC_ARG(candidate->network.MacAddress), - candidate->network.Configuration.DSConfig); + candidate->network.Configuration.DSConfig, + rtw_band_str(candidate->network.Configuration.DSConfig)); mlme->roam_network = candidate; if (_rtw_memcmp(candidate->network.MacAddress, mlme->roam_tgt_addr, ETH_ALEN) == _TRUE) @@ -3979,9 +4128,10 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv) ret = _FAIL; goto exit; } else { - RTW_INFO("%s: candidate: %s("MAC_FMT", band:%u, ch:%u)\n", __FUNCTION__, + RTW_INFO("%s: candidate: %s("MAC_FMT", ch:%u-%s)\n", __FUNCTION__, candidate->network.Ssid.Ssid, MAC_ARG(candidate->network.MacAddress), - candidate->network.Configuration.Band, candidate->network.Configuration.DSConfig); + candidate->network.Configuration.DSConfig, + rtw_band_str(candidate->network.Configuration.Band)); goto candidate_exist; } @@ -4324,51 +4474,93 @@ int rtw_cached_pmkid(_adapter *adapter, u8 *bssid) return SecIsInPMKIDList(adapter, bssid); } +int rtw_get_empty_pmkid_entry(_adapter *Adapter) +{ + struct security_priv *sec = &Adapter->securitypriv; + int i = 0, age_id = 0; + u32 age_ms = 0, tmp_ms = 0; + + do { + if (sec->PMKIDList[i].bUsed) { + tmp_ms = rtw_get_passing_time_ms(sec->PMKIDList[i].last_use); + if (age_ms < tmp_ms) { + age_ms = tmp_ms; + age_id = i; + } + i++; /* continue; */ + } else { + age_id = i; + break; + } + } while (i < NUM_PMKID_CACHE); + + return age_id; +} + +void rtw_set_pmksa(_adapter *padapter, u8 *bssid, u8 *pmkid) +{ + struct security_priv *psecuritypriv = &padapter->securitypriv; + int index; + + /* overwrite PMKID */ + index = rtw_cached_pmkid(padapter, bssid); + + if (index >= 0) { + /* BSSID is matched, the same AP => rewrite with new PMKID. */ + RTW_INFO("BSSID("MAC_FMT") exists in the PMKList.\n", MAC_ARG(bssid)); + } else { + index = rtw_get_empty_pmkid_entry(padapter); + RTW_INFO("Use the new entry index = %d for PMKID.\n", index); + + _rtw_memcpy(psecuritypriv->PMKIDList[index].Bssid, bssid, ETH_ALEN); + } + RTW_INFO(MAC_FMT" set pmkid:"KEY_FMT"\n", MAC_ARG(bssid), KEY_ARG(pmkid)); + + _rtw_memcpy(psecuritypriv->PMKIDList[index].PMKID, pmkid, WLAN_PMKID_LEN); + psecuritypriv->PMKIDList[index].bUsed = _TRUE; + psecuritypriv->PMKIDList[index].last_use = rtw_get_current_time(); +} + int rtw_pmkid_sync_rsn(_adapter *adapter, u8 *ie, uint ie_len, int i_ent) { struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct security_priv *sec = &adapter->securitypriv; struct rsne_info info; - int i; + u8 rbuf[128], *pmk_pos; + u16 val16 = cpu_to_le16(1); + int i, rlen = 0; rtw_rsne_info_parse(ie, ie_len, &info); if (info.err) { - RTW_WARN(FUNC_ADPT_FMT" rtw_rsne_info_parse error\n" - , FUNC_ADPT_ARG(adapter)); - return 0; + RTW_INFO(" rtw_rsne_info_parse fail\n"); + info.pmkid_cnt = 0; /* Do NOT refer ie's pmkid */ } - if (i_ent < 0 && info.pmkid_cnt == 0) - goto exit; - - if (i_ent >= 0 && info.pmkid_cnt == 1 && _rtw_memcmp(info.pmkid_list, sec->PMKIDList[i_ent].PMKID, 16)) { - RTW_INFO(FUNC_ADPT_FMT" has carried the same PMKID:"KEY_FMT"\n" - , FUNC_ADPT_ARG(adapter), KEY_ARG(&sec->PMKIDList[i_ent].PMKID)); + if (i_ent < 0 && info.pmkid_cnt == 0) { + RTW_INFO(MAC_FMT" pmkid not found\n", MAC_ARG(pmlmepriv->assoc_bssid)); goto exit; } - if (info.pmkid_cnt && pmlmepriv->assoc_by_bssid) { - RTW_INFO(FUNC_ADPT_FMT " update PMKID list, count:%u\n", FUNC_ADPT_ARG(adapter), info.pmkid_cnt); - for (i = 0; i < info.pmkid_cnt; i++) - RTW_INFO(" " KEY_FMT "\n", KEY_ARG(info.pmkid_list + i * 16)); + if (i_ent >= 0 && info.pmkid_cnt == 1) { + if (pmlmepriv->assoc_by_bssid) { + RTW_INFO(MAC_FMT" origin pmkid:"KEY_FMT"\n", + MAC_ARG(pmlmepriv->assoc_bssid), KEY_ARG(info.pmkid_list)); + } else { + if (info.pmkid_list) { + memcpy(info.pmkid_list, sec->PMKIDList[i_ent].PMKID, 16); + sec->PMKIDList[i_ent].last_use = rtw_get_current_time(); + } + RTW_INFO(MAC_FMT" replace pmkid:"KEY_FMT"\n", + MAC_ARG(sec->PMKIDList[i_ent].Bssid), KEY_ARG(sec->PMKIDList[i_ent].PMKID)); + } + goto exit; - /* add to pmkid catch */ - _rtw_memcpy(sec->PMKIDList[sec->PMKIDIndex].Bssid, pmlmepriv->assoc_bssid, ETH_ALEN); - _rtw_memcpy(sec->PMKIDList[sec->PMKIDIndex].PMKID, info.pmkid_list, WLAN_PMKID_LEN); + } else if (i_ent < 0 && info.pmkid_cnt == 1 && pmlmepriv->assoc_by_bssid) { + /* ADD new entry */ + rtw_set_pmksa(adapter, pmlmepriv->assoc_bssid, info.pmkid_list); - sec->PMKIDList[sec->PMKIDIndex].bUsed = _TRUE; - sec->PMKIDIndex++; - if (sec->PMKIDIndex == 16) - sec->PMKIDIndex = 0; - } else if (i_ent >= 0) { - RTW_INFO(FUNC_ADPT_FMT " remove PMKID list", FUNC_ADPT_ARG(adapter)); - /* remove pmkid catch in list */ - _rtw_memset(sec->PMKIDList[i_ent].Bssid, 0x00, ETH_ALEN); - _rtw_memset(sec->PMKIDList[i_ent].PMKID, 0x00, WLAN_PMKID_LEN); - sec->PMKIDList[i_ent].bUsed = _FALSE; } - exit: return ie_len; } @@ -5473,7 +5665,8 @@ void _rtw_roaming(_adapter *padapter, struct wlan_network *tgt_network, u8 roam_ if (0 < rtw_to_roam(padapter)) { RTW_INFO("roaming from %s("MAC_FMT"), length:%d\n", cur_network->network.Ssid.Ssid, MAC_ARG(cur_network->network.MacAddress), - cur_network->network.Ssid.SsidLength); + cur_network->network.Ssid.SsidLength); + _rtw_memcpy(&pmlmepriv->roam_from_addr, &cur_network->network.MacAddress, ETH_ALEN); _rtw_memcpy(&pmlmepriv->assoc_ssid, &cur_network->network.Ssid, sizeof(NDIS_802_11_SSID)); pmlmepriv->assoc_ch = 0; pmlmepriv->assoc_band = BAND_MAX; @@ -6232,6 +6425,10 @@ static enum phl_mdl_ret_code _connect_msg_hdlr(void* dispr, void* priv, /* ref: bottom half of rtw_joinbss_event_callback() */ rtw_mi_os_xmit_schedule(a); +#ifdef CONFIG_LAYER2_ROAMING + if (a->securitypriv.dot11PrivacyAlgrthm == _NO_PRIVACY_) + dequeuq_roam_pkt(a, _FALSE); +#endif #ifdef CONFIG_DBCC_SUPPORT if (rtw_phl_mr_is_db(adapter_to_dvobj(a)->phl)) { alink = GET_PRIMARY_LINK(a); @@ -6251,10 +6448,6 @@ static enum phl_mdl_ret_code _connect_msg_hdlr(void* dispr, void* priv, #endif/*CONFIG_DBCC_P2P_BG_LISTEN*/ #endif/*CONFIG_DBCC_SUPPORT*/ _connect_cmd_done(a); -#ifdef CONFIG_LAYER2_ROAMING - if (a->securitypriv.dot11PrivacyAlgrthm == _NO_PRIVACY_) - dequeuq_roam_pkt(a); -#endif break; case MSG_EVT_DISCONNECT_PREPARE: @@ -6807,9 +7000,9 @@ static enum phl_mdl_ret_code _disconnect_msg_hdlr(void* dispr, void* priv, /* ToDo CONFIG_RTW_MLD: [currently primary link only] ** May use other way to restore the link */ struct _ADAPTER_LINK *alink = GET_PRIMARY_LINK(a); + struct mlme_priv *pmlmepriv = &a->mlmepriv; #ifdef CONFIG_DBCC_SUPPORT struct rtw_mr_chctx_info mr_cc_info = {0}; - struct mlme_priv *pmlmepriv = &a->mlmepriv; #endif RTW_DBG(FUNC_ADPT_FMT ": + msg_id=0x%08x\n", @@ -6843,7 +7036,7 @@ static enum phl_mdl_ret_code _disconnect_msg_hdlr(void* dispr, void* priv, || rtw_mr_is_ecsa_running(a) #endif #ifdef CONFIG_RTW_80211R - || rtw_ft_chk_flags(a, RTW_FT_BTM_ROAM) + || pmlmepriv->roam_network #endif #endif ) diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_mlme_ext.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_mlme_ext.c index 4394557c..b56e4b5a 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_mlme_ext.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_mlme_ext.c @@ -240,6 +240,8 @@ int rtw_rfctl_init(struct dvobj_priv *dvobj) rtw_rfctl_get_band_and_bw_bmp(dvobj, &band_bmp, bw_bmp_of_band); + rtw_chset_init(&rfctl->chset, band_bmp); + rtw_rfctl_addl_ch_disable_conf_init(rfctl, regsty); rtw_regd_req_list_init(rfctl, regsty); @@ -254,8 +256,6 @@ int rtw_rfctl_init(struct dvobj_priv *dvobj) rtw_rfctl_dfs_init(rfctl, regsty); - rtw_chset_init(&rfctl->chset, band_bmp); - ret = rtw_rfctl_op_class_pref_init(rfctl, band_bmp, bw_bmp_of_band); #if defined(PRIVATE_R) && defined(CONFIG_ECSA_PHL) @@ -479,6 +479,7 @@ static void init_mlme_ext_priv_value(_adapter *padapter) pmlmeext->sitesurvey_res.scan_ch_ms = SURVEY_TO; pmlmeext->sitesurvey_res.rx_ampdu_accept = RX_AMPDU_ACCEPT_INVALID; pmlmeext->sitesurvey_res.rx_ampdu_size = RX_AMPDU_SIZE_INVALID; + pmlmeext->sitesurvey_res.scan_2040bss = 1; #ifdef CONFIG_SCAN_BACKOP #ifdef CONFIG_LAYER2_ROAMING if (padapter->mlmepriv.roam_flags & RTW_ROAM_ACTIVE) @@ -700,7 +701,7 @@ int rtw_init_link_mlme_ext_priv(struct _ADAPTER_LINK *padapter_link) pmlmeext->cur_wireless_mode = pregistrypriv->wireless_mode; init_link_mlme_default_rate_set(padapter_link); - if ((pmlmeext->chandef.chan > 14) || ((padapter->registrypriv.wireless_mode & WLAN_MD_11B) == 0)) + if ((pmlmeext->chandef.band != BAND_ON_24G) || ((padapter->registrypriv.wireless_mode & WLAN_MD_11B) == 0)) pmlmeext->tx_rate = IEEE80211_OFDM_RATE_6MB; else pmlmeext->tx_rate = IEEE80211_CCK_RATE_1MB; @@ -1711,6 +1712,9 @@ unsigned int OnBeacon(_adapter *padapter, union recv_frame *precv_frame) return _SUCCESS; } + if (pmlmepriv->roam_network) + RTW_INFO("%s() "MAC_FMT"\n", __func__, MAC_ARG(get_addr2_ptr(pframe))); + rtw_check_legacy_ap(padapter, padapter_link, pframe, len); if (rtw_match_bssid_ext(padapter, GetAddr3Ptr(pframe))) @@ -1755,9 +1759,6 @@ end_auth_null: if (((pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE) && (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)) { psta = rtw_get_stainfo(pstapriv, get_addr2_ptr(pframe)); if (psta != NULL) { -#ifdef CONFIG_RTW_80211R - rtw_ft_update_bcn(padapter, precv_frame); -#endif #ifdef RTW_PHL_TEST_FPGA ret = 1; #else @@ -2289,10 +2290,12 @@ unsigned int OnAuthClient(_adapter *padapter, union recv_frame *precv_frame) #ifdef CONFIG_IOCTL_CFG80211 if (GET_CFG80211_REPORT_MGMT(adapter_wdev_data(padapter), IEEE80211_STYPE_AUTH) == _TRUE) { if (rtw_sec_chk_auth_type(padapter, MLME_AUTHTYPE_SAE)) { + #if 0 if (rtw_cached_pmkid(padapter, get_my_bssid(&lmlmeinfo->network)) != -1) { RTW_INFO("SAE: PMKSA cache entry found\n"); goto normal; } + #endif if (!rtw_cfg80211_rx_mframe(padapter, precv_frame, NULL)) { offset = (GetPrivacy(pframe)) ? 4 : 0; pmlmeinfo->auth_status = le16_to_cpu(*(unsigned short *)((SIZE_PTR)pframe + \ @@ -3080,9 +3083,6 @@ report_assoc_result: report_join_res(padapter, res, status); -#if defined(CONFIG_LAYER2_ROAMING) && (defined(CONFIG_RTW_80211K) || defined(CONFIG_RTW_FSM_RRM)) - rtw_roam_nb_discover(padapter, _TRUE); -#endif return _SUCCESS; } @@ -3106,6 +3106,10 @@ unsigned int OnDeAuth(_adapter *padapter, union recv_frame *precv_frame) reason = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN)); +#ifdef CONFIG_LAYER2_ROAMING + dequeuq_roam_pkt(padapter, _TRUE); +#endif + #ifdef CONFIG_WOWLAN if (adapter_to_pwrctl(padapter)->bInSuspend == _TRUE) { pmlmeinfo->wifi_reason_code = reason; @@ -3794,10 +3798,12 @@ unsigned int OnAction_back(_adapter *padapter, union recv_frame *precv_frame) unsigned short tid, status, reason_code = 0; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct registry_priv *pregpriv = &padapter->registrypriv; u8 *pframe = precv_frame->u.hdr.rx_data; struct sta_priv *pstapriv = &padapter->stapriv; struct _ADAPTER_LINK *padapter_link = NULL; + int i; #ifdef CONFIG_80211N_HT @@ -3887,6 +3893,15 @@ unsigned int OnAction_back(_adapter *padapter, union recv_frame *precv_frame) asoc_cap->num_ampdu = asoc_cap->num_ampdu > buf_num ? buf_num : asoc_cap->num_ampdu; + if (pxmitpriv->max_agg_time != 0) { + for (i=0; i < 4; i++) { + asoc_cap->edca[i].param = + (asoc_cap->edca[i].param & 0xFFFF) | + (pxmitpriv->max_agg_time << 16); + RTW_DBG("edca[%d]: 0x%x\n", i, asoc_cap->edca[i].param); + } + } + psts = rtw_phl_cmd_cfg_ampdu(GET_PHL_INFO(adapter_to_dvobj(padapter)), padapter->phl_role, psta->phl_sta, PHL_CMD_DIRECTLY, 0); if (psts != RTW_PHL_STATUS_SUCCESS) @@ -6125,6 +6140,17 @@ int _issue_probereq(_adapter *padapter, struct _ADAPTER_LINK *padapter_link, if (alink_regu_block_tx(padapter_link)) goto exit; +#if 0 /* DEBUG */ + if (da && pssid) + RTW_INFO(FUNC_ADPT_FMT" to %s ("MAC_FMT") ch:%u\n", + FUNC_ADPT_ARG(padapter), pssid->Ssid, MAC_ARG(da), rtw_get_oper_ch(padapter, padapter_link)); + else if (pssid) + RTW_INFO(FUNC_ADPT_FMT" to %s (ff:ff:ff:ff:ff:ff) ch:%u\n", + FUNC_ADPT_ARG(padapter), pssid->Ssid, rtw_get_oper_ch(padapter, padapter_link)); + else + RTW_INFO(FUNC_ADPT_FMT" to * (ff:ff:ff:ff:ff:ff) ch:%u\n", + FUNC_ADPT_ARG(padapter), rtw_get_oper_ch(padapter, padapter_link)); +#endif pmgntframe = alloc_mgtxmitframe(pxmitpriv); if (pmgntframe == NULL) goto exit; @@ -6306,6 +6332,17 @@ int issue_probereq_ex(_adapter *padapter, struct _ADAPTER_LINK *padapter_link, if (alink_regu_block_tx(padapter_link)) goto exit; +#if 0 /* DEBUG */ + if (da && pssid) + RTW_INFO(FUNC_ADPT_FMT" to %s ("MAC_FMT") ch:%u\n", + FUNC_ADPT_ARG(padapter), pssid->Ssid, MAC_ARG(da), rtw_get_oper_ch(padapter, padapter_link)); + else if (pssid) + RTW_INFO(FUNC_ADPT_FMT" to %s (ff:ff:ff:ff:ff:ff) ch:%u\n", + FUNC_ADPT_ARG(padapter), pssid->Ssid, rtw_get_oper_ch(padapter, padapter_link)); + else + RTW_INFO(FUNC_ADPT_FMT" to * (ff:ff:ff:ff:ff:ff) ch:%u\n", + FUNC_ADPT_ARG(padapter), rtw_get_oper_ch(padapter, padapter_link)); +#endif do { ret = _issue_probereq(padapter, padapter_link, @@ -6867,14 +6904,37 @@ exit: return len; } +#ifdef DBG_ROAMING_TEST +static u8 * rtw_set_rtk_version_ie(_adapter *padapter , u8 *pframe ,uint *frlen ) { + int vender_len; + systime current_time = rtw_get_current_time(); + unsigned char vendor_info[255]; + unsigned char REALTEK_OUI[] = {0x00, 0xe0, 0x4c, 0xff}; + unsigned char *ptr; + + _rtw_memset(vendor_info,0,255); + _rtw_memcpy(vendor_info, REALTEK_OUI, 4); + ptr = vendor_info + 4; + snprintf(ptr , sizeof(vendor_info) - 4, "%s-%ld", DRIVERVERSION, current_time); + vender_len = strlen(ptr) + 4; + + RTW_INFO("version IE %s\n", ptr); + + pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, vender_len, vendor_info , frlen); + + return pframe; +} +#endif + int rtw_build_assocreq_ies(_adapter *padapter, struct _ADAPTER_LINK *padapter_link, u8 *pframe, struct pkt_attrib *pattrib, u8 is_reassoc) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct link_mlme_ext_priv *lmlmeext= &padapter_link->mlmeextpriv; struct link_mlme_ext_info *lmlmeinfo = &lmlmeext->mlmext_info; - struct link_mlme_priv *pmlmepriv = &(padapter_link->mlmepriv); + struct link_mlme_priv *plmlmepriv = &(padapter_link->mlmepriv); unsigned short val16; #if CONFIG_DFS u16 cap; @@ -6883,7 +6943,7 @@ int rtw_build_assocreq_ies(_adapter *padapter, struct _ADAPTER_LINK *padapter_li int bssrate_len = 0, sta_bssrate_len = 0; unsigned int i, j, index = 0; PNDIS_802_11_VARIABLE_IEs pIE; - u8 vs_ie_length = 0; + u8 vs_ie_length = 0, *roam_from_addr; #ifdef CONFIG_P2P struct wifidirect_info *pwdinfo = &(padapter->wdinfo); u8 p2pie[255] = { 0x00 }; @@ -6916,7 +6976,17 @@ int rtw_build_assocreq_ies(_adapter *padapter, struct _ADAPTER_LINK *padapter_li /*Construct Current AP Field for Reassoc-Req only*/ if (is_reassoc == _TRUE) { - _rtw_memcpy(pframe, get_my_bssid(&(pmlmeinfo->dev_network)), ETH_ALEN); + #ifdef CONFIG_LAYER2_ROAMING + if (pmlmepriv->roam_network && !is_zero_mac_addr(pmlmepriv->roam_from_addr)) + roam_from_addr = pmlmepriv->roam_from_addr; + else + #endif + roam_from_addr = get_my_bssid(&(pmlmeinfo->dev_network)); + _rtw_memcpy(pframe, roam_from_addr, ETH_ALEN); + + RTW_INFO(FUNC_ADPT_FMT" roam from "MAC_FMT"\n", + FUNC_ADPT_ARG(padapter), MAC_ARG(roam_from_addr)); + pframe += ETH_ALEN; pattrib->pktlen += ETH_ALEN; } @@ -6943,8 +7013,8 @@ int rtw_build_assocreq_ies(_adapter *padapter, struct _ADAPTER_LINK *padapter_li get_rate_set(padapter, padapter_link, sta_bssrate, &sta_bssrate_len); /* RTW_INFO("sta_bssrate_len=%d\n", sta_bssrate_len); */ - if (lmlmeext->chandef.chan == 14) /* for JAPAN, channel 14 can only uses B Mode(CCK) */ - sta_bssrate_len = 4; + if (lmlmeext->chandef.band == BAND_ON_24G && lmlmeext->chandef.chan == 14) + sta_bssrate_len = 4; /* for JAPAN, channel 14 can only uses B Mode(CCK) */ /* for (i = 0; i < sta_bssrate_len; i++) { */ @@ -7093,7 +7163,7 @@ int rtw_build_assocreq_ies(_adapter *padapter, struct _ADAPTER_LINK *padapter_li #ifdef CONFIG_80211N_HT case EID_HTCapability: - if (pmlmepriv->htpriv.ht_option == _TRUE) { + if (plmlmepriv->htpriv.ht_option == _TRUE) { if (!(is_ap_in_tkip(padapter_link))) { _rtw_memcpy(&(lmlmeinfo->HT_caps), pIE->data, sizeof(struct HT_caps_element)); @@ -7117,12 +7187,12 @@ int rtw_build_assocreq_ies(_adapter *padapter, struct _ADAPTER_LINK *padapter_li #ifdef CONFIG_80211AC_VHT case EID_VHTCapability: - if (pmlmepriv->vhtpriv.vht_option == _TRUE) + if (plmlmepriv->vhtpriv.vht_option == _TRUE) pframe = rtw_set_ie(pframe, EID_VHTCapability, pIE->Length, pIE->data, &(pattrib->pktlen)); break; case EID_OpModeNotification: - if (pmlmepriv->vhtpriv.vht_option == _TRUE) { + if (plmlmepriv->vhtpriv.vht_option == _TRUE) { #if 0 if (rtw_phl_mr_is_db(adapter_to_dvobj(padapter)->phl)) { u8 orig_ie_rx_nss = GET_VHT_OPERATING_MODE_FIELD_RX_NSS(pIE->data); @@ -7144,7 +7214,7 @@ int rtw_build_assocreq_ies(_adapter *padapter, struct _ADAPTER_LINK *padapter_li #ifdef CONFIG_80211AX_HE if ((pIE->data[0] == WLAN_EID_EXTENSION_HE_CAPABILITY || pIE->data[0] == WLAN_EID_EXT_HE_6G_CAP) - && (pmlmepriv->hepriv.he_option == _TRUE)) + && (plmlmepriv->hepriv.he_option == _TRUE)) pframe = rtw_set_ie(pframe, WLAN_EID_EXTENSION, pIE->Length, pIE->data, &(pattrib->pktlen)); #endif /* CONFIG_80211AX_HE */ break; @@ -7154,6 +7224,10 @@ int rtw_build_assocreq_ies(_adapter *padapter, struct _ADAPTER_LINK *padapter_li i += (pIE->Length + 2); } +#ifdef DBG_ROAMING_TEST + pframe = rtw_set_rtk_version_ie(padapter, pframe, &pattrib->pktlen); +#endif + #ifdef CONFIG_RTW_TOKEN_BASED_XMIT if (padapter->tbtx_capability == _TRUE) pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 8 , REALTEK_TBTX_IE, &(pattrib->pktlen)); @@ -8050,7 +8124,8 @@ static int issue_action_ba(_adapter *padapter, unsigned char *raddr, pframe = rtw_set_fixed_ie(pframe, 1, &(pmlmeinfo->dialogToken), &(pattrib->pktlen)); #ifdef CONFIG_80211AX_HE - if (is_supported_he(psta->phl_sta->wmode)) + /* Logo sniffer checks that ampdu length must be <= 64 */ + if (is_supported_he(psta->phl_sta->wmode) && !padapter->registrypriv.wifi_spec) num_ampdu = MAX_BA_BUFFER_SIZE_HE; else #endif @@ -8440,7 +8515,7 @@ void issue_action_BSSCoexistPacket(_adapter *padapter) p = rtw_get_ie(pbss_network->IEs + _FIXED_IE_LENGTH_, _HT_CAPABILITY_IE_, &len, pbss_network->IELength - _FIXED_IE_LENGTH_); if ((p == NULL) || (len == 0)) { /* non-HT */ - if ((pbss_network->Configuration.DSConfig <= 0) || (pbss_network->Configuration.DSConfig > 14)) + if (BSS_EX_OP_BAND(pbss_network) != BAND_ON_24G) continue; ICS[0][pbss_network->Configuration.DSConfig] = 1; @@ -9002,23 +9077,6 @@ BOOLEAN Is6GHzPreferScanChannel(u8 channel) } #endif -BOOLEAN IsLegal5GChannel( - _adapter *adapter, - u8 channel) -{ - - int i = 0; - u8 Channel_5G[45] = {36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, - 60, 62, 64, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, - 124, 126, 128, 130, 132, 134, 136, 138, 140, 149, 151, 153, 155, 157, 159, - 161, 163, 165 - }; - for (i = 0; i < sizeof(Channel_5G); i++) - if (channel == Channel_5G[i]) - return _TRUE; - return _FALSE; -} - /* collect bss info from Beacon and Probe request/response frames. */ u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSID_EX *bssid) { @@ -9498,12 +9556,9 @@ void start_clnt_join(_adapter *padapter) set_assoc_timer(&padapter->mlmepriv, (REAUTH_TO * REAUTH_LIMIT) + (REASSOC_TO * REASSOC_LIMIT) + beacon_timeout); -#ifdef CONFIG_RTW_80211R - if (rtw_ft_roam(padapter)) { - rtw_ft_start_clnt_join(padapter); - } else -#endif - { + if (padapter->mlmepriv.roam_network) { + rtw_wnm_start_clnt_join(padapter, padapter_link); + } else { rtw_sta_linking_test_set_start(); padapter->mlmeextpriv.mlmext_info.state = WIFI_FW_AUTH_NULL | WIFI_FW_STATION_STATE; } @@ -9552,11 +9607,13 @@ void start_clnt_auth(_adapter *padapter) #ifdef CONFIG_IOCTL_CFG80211 if (rtw_sec_chk_auth_type(padapter, MLME_AUTHTYPE_SAE)) { + #if 0 if (rtw_cached_pmkid(padapter, get_my_bssid(&pmlmeinfo->dev_network)) != -1) { RTW_INFO("SAE: PMKSA cache entry found\n"); padapter->securitypriv.auth_alg = WLAN_AUTH_OPEN; goto no_external_auth; } + #endif RTW_PRINT("SAE: start external auth\n"); rtw_cfg80211_external_auth_request(padapter, NULL); @@ -9576,6 +9633,7 @@ void start_clnt_assoc(_adapter *padapter) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; cancel_link_timer(pmlmeext); /*_cancel_timer_ex(&pmlmeext->link_timer);*/ @@ -9587,19 +9645,24 @@ void start_clnt_assoc(_adapter *padapter) #ifdef CONFIG_RTW_WNM || rtw_wnm_btm_reassoc_req(padapter) #endif - ) + || pmlmepriv->roam_network + ) { issue_reassocreq(padapter); - else + set_link_timer(pmlmeext, REASSOC_TO * 2); + } else #endif + { issue_assocreq(padapter); + set_link_timer(pmlmeext, REASSOC_TO); + } - set_link_timer(pmlmeext, REASSOC_TO); } unsigned int receive_disconnect(_adapter *padapter, unsigned char *MacAddr, unsigned short reason, u8 locally_generated) { - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); if (!(rtw_match_bssid_ext(padapter, MacAddr))) return _SUCCESS; @@ -9607,6 +9670,12 @@ unsigned int receive_disconnect(_adapter *padapter, unsigned char *MacAddr, unsi RTW_INFO("%s\n", __FUNCTION__); if ((pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE) { +#ifdef CONFIG_LAYER2_ROAMING + if (pmlmepriv->roam_network) { + pmlmepriv->roam_buf_pkt = _TRUE; + rtw_roam_stop_queue(padapter); + } +#endif if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) { if (report_del_sta_event(padapter, MacAddr, reason, _TRUE, locally_generated) != _FAIL) pmlmeinfo->state = WIFI_FW_NULL_STATE; @@ -9615,11 +9684,16 @@ unsigned int receive_disconnect(_adapter *padapter, unsigned char *MacAddr, unsi pmlmeinfo->state = WIFI_FW_NULL_STATE; } else RTW_INFO(FUNC_ADPT_FMT" - End to Disconnect\n", FUNC_ADPT_ARG(padapter)); + #ifdef CONFIG_RTW_80211R rtw_ft_roam_status_reset(padapter); #endif #ifdef CONFIG_RTW_WNM rtw_wnm_reset_btm_state(padapter); + padapter->mlmepriv.roam_scan_count = 0; +#endif +#ifdef CONFIG_SIGNAL_STAT_PROCESS + rtw_signal_state_reset(padapter); #endif } @@ -9777,7 +9851,7 @@ void report_survey_event(_adapter *padapter, union recv_frame *precv_frame) /* * @acs: aim to trigger channel selection */ -void report_surveydone_event(_adapter *padapter, bool acs, u8 flags) +void report_surveydone_event(_adapter *padapter, u8 reason, bool complete, bool acs, u8 flags) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; /* Currently only use the primary link to scan */ @@ -9788,9 +9862,14 @@ void report_surveydone_event(_adapter *padapter, bool acs, u8 flags) survey_done.bss_cnt = pmlmeext->sitesurvey_res.bss_cnt; survey_done.activate_ch_cnt = pmlmeext->sitesurvey_res.activate_ch_cnt; + survey_done.reason = reason; + survey_done.complete = complete; survey_done.acs = acs; - RTW_INFO("survey done event(%x) wifi band:%d for "ADPT_FMT"-HW_BAND_%d\n", - survey_done.bss_cnt, padapter->setband, ADPT_ARG(padapter), + RTW_INFO("survey done event(%x) reason:0x%x%s for "ADPT_FMT"-HW_BAND_%d\n", + survey_done.bss_cnt, + reason, + complete ? " complete" : "", + ADPT_ARG(padapter), padapter_link->wrlink->hw_band); rtw_surveydone_event_callback(padapter, (u8 *)&survey_done); } else { @@ -9833,10 +9912,15 @@ void report_surveydone_event(_adapter *padapter, bool acs, u8 flags) psurveydone_evt = (struct surveydone_event *)(pevtcmd + sizeof(struct rtw_evt_header)); psurveydone_evt->bss_cnt = pmlmeext->sitesurvey_res.bss_cnt; psurveydone_evt->activate_ch_cnt = pmlmeext->sitesurvey_res.activate_ch_cnt; + psurveydone_evt->reason = reason; + psurveydone_evt->complete = complete; psurveydone_evt->acs = acs; - RTW_INFO("survey done event(%x) wifi band:%d for "ADPT_FMT"- HW_BAND_%d\n", - psurveydone_evt->bss_cnt, padapter->setband, ADPT_ARG(padapter), + RTW_INFO("survey done event(%x) reason:0x%x%s for "ADPT_FMT"- HW_BAND_%d\n", + psurveydone_evt->bss_cnt, + reason, + complete ? " complete" : "", + ADPT_ARG(padapter), padapter_link->wrlink->hw_band); rtw_enqueue_cmd(pcmdpriv, pcmd_obj); @@ -10381,11 +10465,13 @@ void rtw_mlmeext_disconnect(_adapter *padapter) pmlmeext->txss_1ss = _FALSE; #endif +#ifndef CONFIG_RTW_FSM_BTM #ifdef CONFIG_LAYER2_ROAMING #define RTW_ROAM_DICONNECT_DELAY 20 if (pmlmepriv->roam_network) rtw_msleep_os(RTW_ROAM_DICONNECT_DELAY); #endif +#endif /* !CONFIG_RTW_FSM_BTM */ for (lidx = 0; lidx < padapter->adapter_link_num; lidx++) { padapter_link = GET_LINK(padapter, lidx); @@ -11183,6 +11269,7 @@ void link_timer_hdl(void *ctx) /* static unsigned int rx_pkt = 0; */ /* static u64 tx_cnt = 0; */ /* struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); */ + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); /* struct sta_priv *pstapriv = &padapter->stapriv; */ @@ -11256,7 +11343,7 @@ void link_timer_hdl(void *ctx) } #ifdef CONFIG_RTW_80211R - if (rtw_ft_roam(padapter)) { + if (rtw_ft_roam(padapter) || pmlmepriv->roam_network) { RTW_INFO("link_timer_hdl: reassoc timeout and try again\n"); issue_reassocreq(padapter); } else @@ -12668,7 +12755,7 @@ u8 setkey_hdl(struct _ADAPTER *a,struct _ADAPTER_LINK *alink, struct setkey_parm rtw_hw_add_key(a, sta, key->keyid, key->algorithm, keytype, key->key, spp, cmd_type, cmd_timeout); #ifdef CONFIG_LAYER2_ROAMING - dequeuq_roam_pkt(a); + dequeuq_roam_pkt(a, _FALSE); #endif exit: @@ -12718,7 +12805,7 @@ u8 setkey_hdl(struct _ADAPTER *a, u8 *pbuf) rtw_hw_add_key(a, sta, key->keyid, key->algorithm, keytype, key->key, spp, PHL_CMD_DIRECTLY, 0); #ifdef CONFIG_LAYER2_ROAMING - dequeuq_roam_pkt(a); + dequeuq_roam_pkt(a, _FALSE); #endif exit: @@ -13417,7 +13504,7 @@ u8 tdls_hdl(_adapter *padapter, unsigned char *pbuf) if (ptdls_sta->htpriv.ht_option == _TRUE) sta_band = WLAN_MD_11N; #endif - if (pmlmeext->chandef.chan > 14) + if (pmlmeext->chandef.band != BAND_ON_24G) sta_band |= WLAN_MD_11A; else { if ((cckratesonly_included(ptdls_sta->bssrateset, ptdls_sta->bssratelen)) == _TRUE) diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_mp.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_mp.c index 307800f9..235197ed 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_mp.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_mp.c @@ -811,6 +811,25 @@ void SetBandwidth(_adapter *padapter) #endif } +u8 rtw_mp_rfpath2txnss(_adapter *padapter, enum rf_path path) +{ + struct mp_priv *pmppriv = &padapter->mppriv; + u8 tx_nss = MP_NSS1; + + if (path < RF_PATH_AB) + tx_nss = MP_NSS1; + else if (path > RF_PATH_D && path < RF_PATH_ABC) + tx_nss = MP_NSS2; + else if (path > RF_PATH_CD && path < RF_PATH_ABCD) + tx_nss = MP_NSS3; + else if (path == RF_PATH_ABCD) + tx_nss = MP_NSS4; + else + RTW_ERR("not support path %d\n", path); + + return tx_nss; +} + void SetAntenna(_adapter *padapter) { mp_ant_path mp_trx_path = padapter->mppriv.antenna_trx; @@ -967,7 +986,7 @@ u16 rtw_mp_txpower_dbm(_adapter *adapter, u8 rf_path) s16 pre_pwr_refcw_idx = 0; u8 rfpath_i = 0; struct _ADAPTER_LINK *padapter_link = GET_PRIMARY_LINK(adapter); - u8 tx_nss = get_phy_tx_nss(adapter, padapter_link); + u8 tx_nss = get_phy_tx_nss(adapter, padapter_link); _rtw_memset((void *)&ptxpwr_arg, 0, sizeof(struct rtw_mp_txpwr_arg)); @@ -975,14 +994,14 @@ u16 rtw_mp_txpower_dbm(_adapter *adapter, u8 rf_path) ptxpwr_arg.is_cck = rtw_mp_is_cck_rate(pmppriv->rateidx); ptxpwr_arg.rfpath = rf_path; - if (pmppriv->tssi_mode == RTW_MP_TSSI_ON && ptxpwr_arg.txpwr > 17 * TX_POWER_BASE) { + if (pmppriv->tssi_mode == RTW_MP_TSSI_ON && ptxpwr_arg.txpwr > 17 * TX_POWER_BASE) { pmppriv->txpowerdbm = 16 * TX_POWER_BASE ; for (rfpath_i = 0 ; rfpath_i < tx_nss; rfpath_i ++) rtw_mp_txpower_dbm(adapter, rfpath_i); rtw_msleep_os(20); pmppriv->txpowerdbm = ptxpwr_arg.txpwr; - } + } rtw_mp_phl_txpower(adapter, &ptxpwr_arg, RTW_MP_TXPWR_CMD_SET_TXPWR); diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_phl.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_phl.c index 148d97eb..4ecb2241 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_phl.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_phl.c @@ -1211,6 +1211,16 @@ void core_handler_phl_msg(void *drv_priv, struct phl_msg *msg) rtw_msg_hub_power_mgnt_evt_hdlr(dvobj, evt_id, msg->inbuf, msg->inlen, &pwrpriv->rfkill_state); } break; + +case PHL_MDL_GENERAL: +#ifdef CONFIG_BTC +#ifdef CONFIG_BTC_TRXSS_CHG + if ((evt_id == MSG_EVT_ANN_RX1SS) || (evt_id == MSG_EVT_ANN_RX_MAXSS)) + rtw_btc_trxss_chg_hdl(dvobj, msg, evt_id); +#endif +#endif + break; + default: RTW_ERR("%s mdl_id :%d not support\n", __func__, mdl_id); break; @@ -1220,7 +1230,7 @@ void core_handler_phl_msg(void *drv_priv, struct phl_msg *msg) u8 rtw_core_register_phl_msg(struct dvobj_priv *dvobj) { struct phl_msg_receiver ctx = {0}; - u8 imr[] = {PHL_MDL_RX, PHL_MDL_SER, PHL_MDL_WOW, PHL_MDL_MRC, PHL_MDL_POWER_MGNT}; + u8 imr[] = {PHL_MDL_RX, PHL_MDL_SER, PHL_MDL_WOW, PHL_MDL_MRC, PHL_MDL_POWER_MGNT, PHL_MDL_GENERAL}; enum rtw_phl_status psts = RTW_PHL_STATUS_FAILURE; ctx.incoming_evt_notify = core_handler_phl_msg; @@ -4485,8 +4495,6 @@ bool rtw_dfs_hal_region_supported(struct dvobj_priv* dvobj, enum rtw_dfs_regd do void rtw_dfs_hal_update_region(struct dvobj_priv *dvobj, u8 band_idx, enum rtw_dfs_regd domain) { - struct rtw_phl_com_t *phl_com = GET_PHL_COM(dvobj); - rtw_phl_cmd_dfs_change_domain(GET_PHL_INFO(dvobj), band_idx, rtw_dfs_regd_to_phl(domain), PHL_CMD_DIRECTLY, 0); } @@ -4582,7 +4590,6 @@ bool phy_is_txpwr_user_lmt_specified(struct dvobj_priv *dvobj) */ static s8 phy_get_txpwr_user_lmt(struct dvobj_priv *dvobj, u8 ntx_idx) { - struct rf_ctl_t *rfctl = dvobj_to_rfctl(dvobj); void *phl_info = GET_PHL_INFO(dvobj); s16 total_mbm = UNSPECIFIED_MBM; s8 lmt; diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_recv.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_recv.c index 366f3a79..c7ba6945 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_recv.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_recv.c @@ -86,8 +86,10 @@ u8 rtw_init_recv_info(_adapter *adapter) #endif #ifdef CONFIG_SIGNAL_STAT_PROCESS rtw_init_timer(&recvinfo->signal_stat_timer, rtw_signal_stat_timer_hdl, adapter); + recvinfo->signal_stat_sampling_interval = 1000; /* ms */ + recvinfo->bcn_signal_strength = 0; + recvinfo->bcn_rssi = -110; - recvinfo->signal_stat_sampling_interval = 2000; /* ms */ /* recvinfo->signal_stat_converging_constant = 5000; */ /* ms */ #endif return ret; @@ -4651,110 +4653,245 @@ _recv_entry_drop: #endif #ifdef CONFIG_SIGNAL_STAT_PROCESS +#ifdef DBG_SERVING_AP_RSSI +static void _rx_dbg_bcn_rssi(struct signal_stat *signal_stat, union recv_frame *prframe) +{ + struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib; + + signal_stat->signal_raw[signal_stat->signal_raw_idx] = + pattrib->phy_info.signal_strength; + signal_stat->signal_avg[signal_stat->signal_raw_idx] = + signal_stat->avg_val; + signal_stat->signal_raw_idx = (signal_stat->signal_raw_idx + 1) % RAW_LEN; +} + +static void rtw_signal_stat_dump_row_data(struct signal_stat *signal_stat) +{ + int i, s, l; + u8 row[128]; + u8 avg[128]; + + i = signal_stat->signal_raw_idx ? (signal_stat->signal_raw_idx - 1) : RAW_LEN - 1; + + if (signal_stat->signal_raw[i] != 0) { + memset (row, 0, sizeof(row)); + memset (avg, 0, sizeof(row)); + sprintf(row, "[RAW]"); + sprintf(avg, "[AVG]"); + + s = 0; + l = signal_stat->signal_raw_idx; + if (signal_stat->signal_raw[signal_stat->signal_raw_idx] != 0) { + /* round-wrap */ + s = signal_stat->signal_raw_idx + 1; /* next one is the 1'st entry */ + l = RAW_LEN; + } + + for (i = 0; i < l; i++) { + sprintf(row + strlen(row), " %2d", signal_stat->signal_raw[(s+i)%RAW_LEN]); + sprintf(avg + strlen(avg), " %2d", signal_stat->signal_avg[(s+i)%RAW_LEN]); + + if ((i+1)%20 == 0) { + printk("%s\n", row); + printk("%s\n", avg); + memset (row, 0, sizeof(row)); + memset (avg, 0, sizeof(row)); + sprintf(row, "[RAW]"); + sprintf(avg, "[AVG]"); + } + } + + if ((i)%20 != 0) { + printk("%s\n", row); + printk("%s\n", avg); + } + + signal_stat->signal_raw_idx = 0; + memset (signal_stat->signal_raw, 0, RAW_LEN); + memset (signal_stat->signal_avg, 0, RAW_LEN); + } +} +#endif +void rtw_signal_state_reset(_adapter *adapter) +{ + struct recv_info *recvinfo = &adapter->recvinfo; + + recvinfo->signal_strength_bcn.update_req = 2; + recvinfo->signal_qual_bcn.update_req = 2; + recvinfo->bcn_signal_strength = 0; + recvinfo->bcn_rssi = -110; +#ifdef DBG_SERVING_AP_RSSI + recvinfo->signal_strength_bcn.signal_raw_idx = 0; + memset (recvinfo->signal_strength_bcn.signal_raw, 0, RAW_LEN); + memset (recvinfo->signal_strength_bcn.signal_avg, 0, RAW_LEN); +#endif +} + +static void rtw_signal_state(_adapter *adapter, bool is_bcn) +{ + struct recv_info *recvinfo = &adapter->recvinfo; + /* ToDo CONFIG_RTW_MLD: currently primary link only */ + struct _ADAPTER_LINK *adapter_link = GET_PRIMARY_LINK(adapter); + u8 *signal_strength, *signal_qual; + s8 *rssi; + u32 tmp_s, tmp_q; + u8 avg_signal_strength = 0, avg_signal_qual = 0; + u32 num_signal_strength = 0, num_signal_qual = 0; + u8 ratio_pre_stat = 0, ratio_curr_stat = 0, ratio_total = 0, ratio_profile = SIGNAL_STAT_CALC_PROFILE_0; + + if (is_bcn) { + + rssi = &recvinfo->bcn_rssi; + signal_qual = &recvinfo->bcn_signal_qual; + signal_strength = &recvinfo->bcn_signal_strength; + + if (recvinfo->signal_strength_bcn.update_req == 0) { + avg_signal_strength = recvinfo->signal_strength_bcn.avg_val; + num_signal_strength = recvinfo->signal_strength_bcn.total_num; + recvinfo->signal_strength_bcn.avg_val = 0; + recvinfo->signal_strength_bcn.total_num = 0; + /* after avg_vals are accquired, we can re-stat the signal values */ + recvinfo->signal_strength_bcn.update_req = 1; + } + if (recvinfo->signal_qual_bcn.update_req == 0) { + avg_signal_qual = recvinfo->signal_qual_bcn.avg_val; + num_signal_qual = recvinfo->signal_qual_bcn.total_num; + recvinfo->signal_qual_bcn.avg_val = 0; + recvinfo->signal_qual_bcn.total_num = 0; + /* after avg_vals are accquired, we can re-stat the signal values */ + recvinfo->signal_qual_bcn.update_req = 1; + } + + } else { + rssi = &recvinfo->rssi; + signal_qual = &recvinfo->signal_qual; + signal_strength = &recvinfo->signal_strength; + + if (recvinfo->signal_strength_data.update_req == 0) { + avg_signal_strength = recvinfo->signal_strength_data.avg_val; + num_signal_strength = recvinfo->signal_strength_data.total_num; + recvinfo->signal_strength_data.avg_val = 0; + recvinfo->signal_strength_data.total_num = 0; + /* after avg_vals are accquired, we can re-stat the signal values */ + recvinfo->signal_strength_data.update_req = 1; + } + if (recvinfo->signal_qual_data.update_req == 0) { + avg_signal_qual = recvinfo->signal_qual_data.avg_val; + num_signal_qual = recvinfo->signal_qual_data.total_num; + recvinfo->signal_qual_data.avg_val = 0; + recvinfo->signal_qual_data.total_num = 0; + /* after avg_vals are accquired, we can re-stat the signal values */ + recvinfo->signal_qual_data.update_req = 1; + } + } + + if (!is_bcn && num_signal_strength == 0) { + if (rtw_get_on_cur_ch_time(adapter) == 0 + || rtw_get_passing_time_ms(rtw_get_on_cur_ch_time(adapter)) < 2 * adapter_link->mlmeextpriv.mlmext_info.bcn_interval + ) + return; + } + + if (!is_bcn) { + if (check_fwstate(&adapter->mlmepriv, WIFI_UNDER_SURVEY) == _TRUE + || check_fwstate(&adapter->mlmepriv, WIFI_ASOC_STATE) == _FALSE + ) + return; + } + +#ifdef CONFIG_CONCURRENT_MODE + if (rtw_mi_buddy_check_fwstate(adapter, WIFI_UNDER_SURVEY) == _TRUE) + return; +#endif + +#ifdef CONFIG_MP_INCLUDED + if (adapter->registrypriv.mp_mode == 1) { + ratio_profile = SIGNAL_STAT_CALC_PROFILE_2; + } + else +#endif + if (RTW_SIGNAL_STATE_CALC_PROFILE < SIGNAL_STAT_CALC_PROFILE_MAX) + ratio_profile = RTW_SIGNAL_STATE_CALC_PROFILE; + + if (*signal_strength == 0) { + *signal_strength = avg_signal_strength; + *signal_qual = avg_signal_qual; + *rssi = (s8)rtw_phl_rssi_to_dbm(avg_signal_strength); + return; + } + + ratio_pre_stat = signal_stat_calc_profile[ratio_profile][0]; + ratio_curr_stat = signal_stat_calc_profile[ratio_profile][1]; + ratio_total = ratio_pre_stat + ratio_curr_stat; + + tmp_s = (ratio_curr_stat * avg_signal_strength + ratio_pre_stat * *signal_strength); + if (tmp_s % ratio_total) + tmp_s = tmp_s / ratio_total + 1; + else + tmp_s = tmp_s / ratio_total; + if (tmp_s > PHL_MAX_RSSI) + tmp_s = PHL_MAX_RSSI; + + tmp_q = (ratio_curr_stat * avg_signal_qual + ratio_pre_stat * *signal_qual); + if (tmp_q % ratio_total) + tmp_q = tmp_q / ratio_total + 1; + else + tmp_q = tmp_q / ratio_total; + if (tmp_q > PHL_MAX_RSSI) + tmp_q = PHL_MAX_RSSI; + + *signal_strength = tmp_s; + *signal_qual = tmp_q; + *rssi = (s8)rtw_phl_rssi_to_dbm(tmp_s); + +#if defined(DBG_RX_SIGNAL_DISPLAY_PROCESSING) && 1 + RTW_INFO(FUNC_ADPT_FMT" signal_strength:%3u, rssi:%3d, signal_qual:%3u" + ", num_signal_strength:%u, num_signal_qual:%u" + ", on_cur_ch_ms:%d" + "\n" + , FUNC_ADPT_ARG(adapter) + , *signal_strength + , *rssi + , *signal_qual + , num_signal_strength, num_signal_qual + , rtw_get_on_cur_ch_time(adapter) ? rtw_get_passing_time_ms(rtw_get_on_cur_ch_time(adapter)) : 0 + ); +#endif +} + static void rtw_signal_stat_timer_hdl(void *ctx) { _adapter *adapter = (_adapter *)ctx; struct recv_info *recvinfo = &adapter->recvinfo; - /* ToDo CONFIG_RTW_MLD: currently primary link only */ - struct _ADAPTER_LINK *adapter_link = GET_PRIMARY_LINK(adapter); +#ifdef DBG_SERVING_AP_RSSI + u8 avg = recvinfo->signal_strength_bcn.avg_val; + u8 bcn = recvinfo->bcn_signal_strength; +#endif - u32 tmp_s, tmp_q; - u8 avg_signal_strength = 0; - u8 avg_signal_qual = 0; - u32 num_signal_strength = 0; - u32 num_signal_qual = 0; - u8 ratio_pre_stat = 0, ratio_curr_stat = 0, ratio_total = 0, ratio_profile = SIGNAL_STAT_CALC_PROFILE_0; + if (!is_client_associated_to_ap(adapter)) + return; + + /* beacon */ + rtw_signal_state(adapter, _TRUE); + + /* data + beacon */ + rtw_signal_state(adapter, _FALSE); if (recvinfo->is_signal_dbg) { - /* update the user specific value, signal_strength_dbg, to signal_strength, rssi */ recvinfo->signal_strength = recvinfo->signal_strength_dbg; recvinfo->rssi = (s8)rtw_phl_rssi_to_dbm((u8)recvinfo->signal_strength_dbg); - } else { - - if (recvinfo->signal_strength_data.update_req == 0) { /* update_req is clear, means we got rx */ - avg_signal_strength = recvinfo->signal_strength_data.avg_val; - num_signal_strength = recvinfo->signal_strength_data.total_num; - /* after avg_vals are accquired, we can re-stat the signal values */ - recvinfo->signal_strength_data.update_req = 1; - } - - if (recvinfo->signal_qual_data.update_req == 0) { /* update_req is clear, means we got rx */ - avg_signal_qual = recvinfo->signal_qual_data.avg_val; - num_signal_qual = recvinfo->signal_qual_data.total_num; - /* after avg_vals are accquired, we can re-stat the signal values */ - recvinfo->signal_qual_data.update_req = 1; - } - - if (num_signal_strength == 0) { - if (rtw_get_on_cur_ch_time(adapter) == 0 - || rtw_get_passing_time_ms(rtw_get_on_cur_ch_time(adapter)) < 2 * adapter_link->mlmeextpriv.mlmext_info.bcn_interval - ) - goto set_timer; - } - - if (check_fwstate(&adapter->mlmepriv, WIFI_UNDER_SURVEY) == _TRUE - || check_fwstate(&adapter->mlmepriv, WIFI_ASOC_STATE) == _FALSE - ) - goto set_timer; - -#ifdef CONFIG_CONCURRENT_MODE - if (rtw_mi_buddy_check_fwstate(adapter, WIFI_UNDER_SURVEY) == _TRUE) - goto set_timer; -#endif - -#ifdef CONFIG_MP_INCLUDED - if (adapter->registrypriv.mp_mode == 1) { - ratio_profile = SIGNAL_STAT_CALC_PROFILE_2; - } - else -#endif - if (RTW_SIGNAL_STATE_CALC_PROFILE < SIGNAL_STAT_CALC_PROFILE_MAX) - ratio_profile = RTW_SIGNAL_STATE_CALC_PROFILE; - - ratio_pre_stat = signal_stat_calc_profile[ratio_profile][0]; - ratio_curr_stat = signal_stat_calc_profile[ratio_profile][1]; - ratio_total = ratio_pre_stat + ratio_curr_stat; - - /* update value of signal_strength, rssi, signal_qual */ - tmp_s = (ratio_curr_stat * avg_signal_strength + ratio_pre_stat * recvinfo->signal_strength); - if (tmp_s % ratio_total) - tmp_s = tmp_s / ratio_total + 1; - else - tmp_s = tmp_s / ratio_total; - if (tmp_s > PHL_MAX_RSSI) - tmp_s = PHL_MAX_RSSI; - - tmp_q = (ratio_curr_stat * avg_signal_qual + ratio_pre_stat * recvinfo->signal_qual); - if (tmp_q % ratio_total) - tmp_q = tmp_q / ratio_total + 1; - else - tmp_q = tmp_q / ratio_total; - if (tmp_q > PHL_MAX_RSSI) - tmp_q = PHL_MAX_RSSI; - - recvinfo->signal_strength = tmp_s; - recvinfo->rssi = (s8)rtw_phl_rssi_to_dbm(tmp_s); - recvinfo->signal_qual = tmp_q; - -#if defined(DBG_RX_SIGNAL_DISPLAY_PROCESSING) && 1 - RTW_INFO(FUNC_ADPT_FMT" signal_strength:%3u, rssi:%3d, signal_qual:%3u" - ", num_signal_strength:%u, num_signal_qual:%u" - ", on_cur_ch_ms:%d" - "\n" - , FUNC_ADPT_ARG(adapter) - , recvinfo->signal_strength - , recvinfo->rssi - , recvinfo->signal_qual - , num_signal_strength, num_signal_qual - , rtw_get_on_cur_ch_time(adapter) ? rtw_get_passing_time_ms(rtw_get_on_cur_ch_time(adapter)) : 0 - ); -#endif } -set_timer: +#ifdef DBG_SERVING_AP_RSSI + rtw_signal_stat_dump_row_data(&recvinfo->signal_strength_bcn); + if (bcn) + RTW_INFO("%d + %d --> %d\n", bcn, avg, recvinfo->bcn_signal_strength); + else + RTW_INFO("-- + %d --> %d\n", avg, recvinfo->bcn_signal_strength); +#endif rtw_set_signal_stat_timer(recvinfo); - } + #endif/*CONFIG_SIGNAL_STAT_PROCESS*/ /* @@ -5267,11 +5404,10 @@ void core_update_recvframe_mdata(union recv_frame *prframe, struct rtw_recv_pkt } #ifdef RTW_WKARD_CORE_RSSI_V1 -static inline void _rx_process_ss_sq(_adapter *padapter, union recv_frame *prframe) +static inline void _rx_process_ss_sq(_adapter *padapter, union recv_frame *prframe, + struct signal_stat *ss, struct signal_stat *sq) { struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib; - struct signal_stat *ss = &padapter->recvinfo.signal_strength_data; - struct signal_stat *sq = &padapter->recvinfo.signal_qual_data; if (ss->update_req) { ss->total_num = 0; @@ -5294,7 +5430,7 @@ static inline void _rx_process_ss_sq(_adapter *padapter, union recv_frame *prfra sq->avg_val = sq->total_val / sq->total_num; } -/*#define DBG_RECV_INFO*/ +/* #define DBG_RECV_INFO */ void rx_process_phy_info(union recv_frame *precvframe) { _adapter *padapter = precvframe->u.hdr.adapter; @@ -5348,7 +5484,7 @@ void rx_process_phy_info(union recv_frame *precvframe) is_packet_match_bssid = (!IsFrameTypeCtrl(wlanhdr)) && (!pattrib->icv_err) && (!pattrib->crc_err) - && ((!MLME_IS_MESH(padapter) && _rtw_memcmp(get_hdr_bssid(wlanhdr), get_bssid(&padapter->mlmepriv), ETH_ALEN)) + && ((!MLME_IS_MESH(padapter) && _rtw_memcmp(get_hdr_bssid(wlanhdr), get_mbssid(&padapter->mlmepriv), ETH_ALEN)) || (MLME_IS_MESH(padapter) && psta)); /*is_to_self = (!pattrib->icv_err) && (!pattrib->crc_err) @@ -5383,7 +5519,7 @@ void rx_process_phy_info(union recv_frame *precvframe) RTW_INFO("hdr_bssid:"MAC_FMT" my_bssid:"MAC_FMT"\n", MAC_ARG(get_hdr_bssid(wlanhdr)), - MAC_ARG(get_bssid(&padapter->mlmepriv))); + MAC_ARG(get_mbssid(&padapter->mlmepriv))); RTW_INFO("ra:"MAC_FMT" my_addr:"MAC_FMT"\n", MAC_ARG(ra), @@ -5400,8 +5536,20 @@ void rx_process_phy_info(union recv_frame *precvframe) rx_process_dframe_raw_data(precvframe); #endif } - if (phy_info->is_valid) - _rx_process_ss_sq(padapter, precvframe);/*signal_strength & signal_quality*/ + if (phy_info->is_valid) { + _rx_process_ss_sq(padapter, precvframe, + &precvinfo->signal_strength_data, + &precvinfo->signal_qual_data); + + if (is_packet_beacon) { + _rx_process_ss_sq(padapter, precvframe, + &precvinfo->signal_strength_bcn, + &precvinfo->signal_qual_bcn); +#ifdef DBG_SERVING_AP_RSSI + _rx_dbg_bcn_rssi(&precvinfo->signal_strength_bcn, precvframe); +#endif + } + } } else if (is_packet_to_self || is_packet_beacon) { if (psta) { precvframe->u.hdr.psta = psta; @@ -5409,8 +5557,20 @@ void rx_process_phy_info(union recv_frame *precvframe) rx_process_dframe_raw_data(precvframe); #endif } - if (phy_info->is_valid) - _rx_process_ss_sq(padapter, precvframe);/*signal_strength & signal_quality*/ + if (phy_info->is_valid) { + _rx_process_ss_sq(padapter, precvframe, + &precvinfo->signal_strength_data, + &precvinfo->signal_qual_data); + + if (is_packet_beacon) { + _rx_process_ss_sq(padapter, precvframe, + &precvinfo->signal_strength_bcn, + &precvinfo->signal_qual_bcn); +#ifdef DBG_SERVING_AP_RSSI + _rx_dbg_bcn_rssi(&precvinfo->signal_strength_bcn, precvframe); +#endif + } + } } } #ifdef CONFIG_MP_INCLUDED @@ -5421,18 +5581,30 @@ void rx_process_phy_info(union recv_frame *precvframe) RTW_INFO("in MP Rx is_packet_beacon\n"); if (psta) precvframe->u.hdr.psta = psta; - _rx_process_ss_sq(padapter, precvframe); + _rx_process_ss_sq(padapter, precvframe, + &precvinfo->signal_strength_data, + &precvinfo->signal_qual_data); } } else { if (psta) precvframe->u.hdr.psta = psta; - _rx_process_ss_sq(padapter, precvframe); + _rx_process_ss_sq(padapter, precvframe, + &precvinfo->signal_strength_data, + &precvinfo->signal_qual_data); + } + + if (is_packet_beacon) { + _rx_process_ss_sq(padapter, precvframe, + &precvinfo->signal_strength_bcn, + &precvinfo->signal_qual_bcn); +#ifdef DBG_SERVING_AP_RSSI + _rx_dbg_bcn_rssi(&precvinfo->signal_strength_bcn, precvframe); +#endif } } #endif } - /*#define DBG_PHY_INFO*/ void core_update_recvframe_phyinfo(union recv_frame *prframe, struct rtw_recv_pkt *rx_req) { diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_rf.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_rf.c index bcc0fa2d..3646ef1c 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_rf.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_rf.c @@ -890,14 +890,14 @@ static u8 rtw_get_center_ch_6g(u8 ch, u8 bw, u8 offset) }; u8 cch = ch; - if (bw < CHANNEL_WIDTH_20 || bw > CHANNEL_WIDTH_160) { + if (bw == CHANNEL_WIDTH_20 || bw == CHANNEL_WIDTH_10 || bw == CHANNEL_WIDTH_5) + goto exit; + + if (bw > CHANNEL_WIDTH_160) { rtw_warn_on(1); goto exit; } - if (bw == CHANNEL_WIDTH_20) - goto exit; - cch = (((ch - 1) >> shift[bw]) << shift[bw]) + start[bw]; exit: @@ -1295,6 +1295,38 @@ const u8 _opc_bw_to_ch_width[OPC_BW_NUM] = { /* 802.11-2020, 802.11ax-2021 Table E-4, partial */ const struct op_class_t global_op_class[] = { + /* United state : begin */ + OP_CLASS_ENT(1, BAND_ON_5G, OPC_BW20, 4, 36, 40, 44, 48), /* 115 */ + OP_CLASS_ENT(2, BAND_ON_5G, OPC_BW20, 4, 52, 56, 60, 64), /* 118 */ + OP_CLASS_ENT(3, BAND_ON_5G, OPC_BW20, 4, 149, 153, 157, 161), /* 124 */ + OP_CLASS_ENT(4, BAND_ON_5G, OPC_BW20, 12, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144), /* 121 */ + OP_CLASS_ENT(5, BAND_ON_5G, OPC_BW20, 8, 149, 153, 157, 161, 165, 169, 173, 177), /* 125 */ + /* 6, 103 */ + /* 7, 103 */ + /* 8, 102 */ + /* 9, 102 */ + /* 10, 101 */ + /* 11, 101 */ + OP_CLASS_ENT(12, BAND_ON_24G, OPC_BW20, 13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13), /* 81 */ + /* 13, 94 */ + /* 14, 95 */ + /* 15, 96 */ +#if CONFIG_IEEE80211_BAND_5GHZ + OP_CLASS_ENT(22, BAND_ON_5G, OPC_BW40PLUS, 2, 36, 44), /* 116 */ + OP_CLASS_ENT(23, BAND_ON_5G, OPC_BW40PLUS, 2, 52, 60), /* 119 */ + OP_CLASS_ENT(24, BAND_ON_5G, OPC_BW40PLUS, 6, 100, 108, 116, 124, 132, 140), /* 122 */ + OP_CLASS_ENT(25, BAND_ON_5G, OPC_BW40PLUS, 4, 149, 157, 165, 173), /* 126 */ + OP_CLASS_ENT(26, BAND_ON_5G, OPC_BW40PLUS, 4, 149, 157, 165, 173), /* 126 */ + OP_CLASS_ENT(27, BAND_ON_5G, OPC_BW40MINUS, 2, 40, 48), /* 117 */ + OP_CLASS_ENT(28, BAND_ON_5G, OPC_BW40MINUS, 2, 56, 64), /* 120 */ + OP_CLASS_ENT(29, BAND_ON_5G, OPC_BW40MINUS, 6, 104, 112, 120, 128, 136, 144), /* 123 */ + OP_CLASS_ENT(30, BAND_ON_5G, OPC_BW40MINUS, 4, 153, 161, 169, 177), /* 127 */ + OP_CLASS_ENT(31, BAND_ON_5G, OPC_BW40MINUS, 4, 153, 161, 169, 177), /* 127 */ +#endif + OP_CLASS_ENT(32, BAND_ON_24G, OPC_BW40PLUS, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9), /* 83 */ + OP_CLASS_ENT(33, BAND_ON_24G, OPC_BW40MINUS, 9, 5, 6, 7, 8, 9, 10, 11, 12, 13), /* 84 */ + /* United state : end */ + /* 2G ch1~13, 20M */ OP_CLASS_ENT(81, BAND_ON_24G, OPC_BW20, 13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13), /* 2G ch14, 20M */ @@ -1618,7 +1650,6 @@ u8 rtw_get_bw_offset_by_op_class_ch(u8 gid, u8 ch, u8 *bw, u8 *offset) { const struct op_class_t *opc; u8 valid = 0; - int i; opc = get_global_op_class_by_id(gid); if (!opc) @@ -1941,7 +1972,6 @@ void op_class_pref_apply_regulatory(struct rf_ctl_t *rfctl, u8 reason) static void dump_opc_pref_single(void *sel, struct op_class_pref_t *opc_pref, bool show_snon_ocp, bool show_no_ir, bool detail) { u8 i; - u8 ch_num = 0; if (!show_snon_ocp && !opc_pref->op_ch_num) return; diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_scan.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_scan.c index 236ca988..5e5d6e81 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_scan.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_scan.c @@ -15,12 +15,50 @@ #include /*rtw_mlme.c*/ -void rtw_init_sitesurvey_parm(_adapter *padapter, struct sitesurvey_parm *pparm) +void rtw_init_sitesurvey_parm(struct sitesurvey_parm *pparm) { - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - _rtw_memset(pparm, 0, sizeof(struct sitesurvey_parm)); - pparm->scan_mode = pmlmepriv->scan_mode; + pparm->scan_mode = RTW_PHL_SCAN_ACTIVE; +} + +void rtw_auto_scan_ch_list_init(struct sitesurvey_parm *parm, u8 band_bmp, u8 flags) +{ + u8 ch_num = 0; + int band, i; + u8 (*center_chs_num)(u8); + u8 (*center_chs)(u8, u8); + u8 cch_num; + + for (band = 0; band < BAND_MAX; band++) { + if (!(band_bmp & band_to_band_cap(band))) + continue; + + center_chs_num = center_chs_num_of_band[band]; + center_chs = center_chs_of_band[band]; + if (!center_chs_num || !center_chs) + continue; + + cch_num = center_chs_num(CHANNEL_WIDTH_20); + for (i = 0; i < cch_num; i++) { + parm->ch[ch_num].band = band; + parm->ch[ch_num].hw_value = center_chs(CHANNEL_WIDTH_20, i); + parm->ch[ch_num].flags = flags; + ch_num++; + } + } + + parm->ch_num = ch_num; +} + +static void rtw_auto_scan_ch_list_set_flags(struct sitesurvey_parm *parm, u8 band_bmp, u8 flags) +{ + int i; + + for (i = 0; i < parm->ch_num; i++) { + if (BIT(parm->ch[i].band) & band_bmp) + parm->ch[i].flags = flags; + } + } #ifdef CONFIG_SET_SCAN_DENY_TIMER @@ -53,16 +91,21 @@ void rtw_set_scan_deny(_adapter *adapter, u32 ms) } #endif -void rtw_drv_scan_by_self(_adapter *padapter, u8 reason) +void rtw_drv_scan_by_self(_adapter *padapter, u8 reason, bool urgent) { struct sitesurvey_parm *parm = NULL; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; int i; -#if 1 u8 ssc_chk; + if (!rtw_is_adapter_up(padapter)) + goto exit; + ssc_chk = rtw_sitesurvey_condition_check(padapter, _FALSE); - if( ssc_chk == SS_DENY_BUSY_TRAFFIC) { + if (ssc_chk == SS_DENY_BUSY_TRAFFIC) { + if (urgent) + ; /* auto scan by urgent case, ignore busy traffic */ + else #ifdef CONFIG_LAYER2_ROAMING if (rtw_chk_roam_flags(padapter, RTW_ROAM_ACTIVE) && pmlmepriv->need_to_roam == _TRUE) { RTW_INFO(FUNC_ADPT_FMT" need to roam, don't care BusyTraffic\n", FUNC_ADPT_ARG(padapter)); @@ -76,72 +119,45 @@ void rtw_drv_scan_by_self(_adapter *padapter, u8 reason) goto exit; } - if (!rtw_is_adapter_up(padapter)) - goto exit; -#else - if (rtw_is_scan_deny(padapter)) - goto exit; - - if (!rtw_is_adapter_up(padapter)) - goto exit; - - if (rtw_mi_busy_traffic_check(padapter)) { -#ifdef CONFIG_LAYER2_ROAMING - if (rtw_chk_roam_flags(padapter, RTW_ROAM_ACTIVE) && pmlmepriv->need_to_roam == _TRUE) { - RTW_INFO("need to roam, don't care BusyTraffic\n"); - } else -#endif - { - RTW_INFO(FUNC_ADPT_FMT" exit BusyTraffic\n", FUNC_ADPT_ARG(padapter)); - goto exit; - } - } - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) && check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) { - RTW_INFO(FUNC_ADPT_FMT" WIFI_AP_STATE && WIFI_UNDER_WPS\n", FUNC_ADPT_ARG(padapter)); - goto exit; - } - if (check_fwstate(pmlmepriv, (WIFI_UNDER_SURVEY | WIFI_UNDER_LINKING)) == _TRUE) { - RTW_INFO(FUNC_ADPT_FMT" WIFI_UNDER_SURVEY|WIFI_UNDER_LINKING\n", FUNC_ADPT_ARG(padapter)); - goto exit; - } - -#ifdef CONFIG_CONCURRENT_MODE - if (rtw_mi_buddy_check_fwstate(padapter, (WIFI_UNDER_SURVEY | WIFI_UNDER_LINKING | WIFI_UNDER_WPS))) { - RTW_INFO(FUNC_ADPT_FMT", but buddy_intf is under scanning or linking or wps_phase\n", FUNC_ADPT_ARG(padapter)); - goto exit; - } -#endif -#endif - RTW_INFO(FUNC_ADPT_FMT" reason:0x%02x\n", FUNC_ADPT_ARG(padapter), reason); parm = rtw_malloc(sizeof(*parm)); if (parm == NULL) goto exit; - rtw_init_sitesurvey_parm(padapter, parm); - /* only for 20/40 BSS */ - if (reason == RTW_AUTO_SCAN_REASON_2040_BSS) { - for (i=0;i<14;i++) { - parm->ch[i].hw_value = i + 1; - parm->ch[i].flags = RTW_IEEE80211_CHAN_PASSIVE_SCAN; - } - parm->ch_num = 14; - rtw_sitesurvey_cmd(padapter, parm); - goto exit; - } + rtw_init_sitesurvey_parm(parm); + parm->reason = reason; #ifdef CONFIG_RTW_MBO #if defined(CONFIG_RTW_WNM) || defined(CONFIG_RTW_80211K) || defined(CONFIG_RTW_FSM_RRM) if ((reason == RTW_AUTO_SCAN_REASON_ROAM) && (rtw_roam_nb_scan_list_set(padapter, parm))) { - rtw_sitesurvey_cmd(padapter, parm); - goto exit; + goto scan; } #endif #endif - rtw_sitesurvey_cmd(padapter, NULL); + /* + * reasons below can merge scan + * init channels of all band disabled + */ + rtw_auto_scan_ch_list_init(parm, 0xFF, RTW_IEEE80211_CHAN_DISABLED); + + if (reason & RTW_AUTO_SCAN_REASON_2040_BSS) { + rtw_auto_scan_ch_list_set_flags(parm, BIT(BAND_ON_24G) + , RTW_IEEE80211_CHAN_PASSIVE_SCAN); + } + +#ifdef CONFIG_80211D + if (reason & RTW_AUTO_SCAN_REASON_CIS_ENV_BSS) { + rtw_auto_scan_ch_list_set_flags(parm + , adapter_to_rfctl(padapter)->cis_scan_band_bmp + , RTW_IEEE80211_CHAN_PASSIVE_SCAN); + } +#endif + +scan: + rtw_sitesurvey_cmd(padapter, parm); exit: if (parm) rtw_mfree(parm, sizeof(*parm)); @@ -1255,6 +1271,8 @@ void add_mbssid_network(_adapter *padapter, WLAN_BSSID_EX *ref_bss) u8 mbssid_index; u8 copy_ie_offset; u32 copy_ie_len = 0; + struct wlan_network *pnetwork = NULL; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); mbssid_ie = rtw_get_ie(ref_bss->IEs + _BEACON_IE_OFFSET_ , WLAN_EID_MULTIPLE_BSSID @@ -1329,6 +1347,7 @@ void add_mbssid_network(_adapter *padapter, WLAN_BSSID_EX *ref_bss) rtw_gen_new_bssid(ref_bss->MacAddress, max_bssid_indicator , mbssid_index, pbss->MacAddress); pbss->mbssid_index = mbssid_index; + _rtw_memcpy(pbss->mbsMacAddress, ref_bss->MacAddress, ETH_ALEN); break; default: break; @@ -1338,7 +1357,16 @@ void add_mbssid_network(_adapter *padapter, WLAN_BSSID_EX *ref_bss) /*RTW_INFO("%s, j=%d\n", __func__, j);*/ } pbss->is_mbssid = _TRUE; - add_network(padapter, pbss); + pnetwork = add_network(padapter, pbss); +#ifdef CONFIG_RTW_FSM_BTM + if (padapter->fsmpriv.btmpriv.btm && pnetwork) { + /* check SSID */ + if ((pbss->Ssid.SsidLength == pmlmepriv->dev_cur_network.network.Ssid.SsidLength) && + _rtw_memcmp(pbss->Ssid.Ssid, pmlmepriv->dev_cur_network.network.Ssid.Ssid, + pbss->Ssid.SsidLength)) + rtw_btm_notify_scan_found_candidate(padapter->fsmpriv.btmpriv.btm, pnetwork); + } +#endif rtw_mfree((u8 *)pbss, sizeof(WLAN_BSSID_EX)); break; case MBSSID_VENDOR_SPECIFIC_ID: @@ -1456,6 +1484,10 @@ void rtw_surveydone_event_callback(_adapter *adapter, u8 *pbuf) _rtw_spinunlock_bh(&pmlmepriv->lock); _rtw_spinlock_bh(&pmlmepriv->lock); + + if (adapter_to_pwrctl(adapter)->bInSuspend == _TRUE) + goto done; + #ifdef CONFIG_SIGNAL_STAT_PROCESS rtw_set_signal_stat_timer(&adapter->recvinfo); #endif @@ -1516,7 +1548,7 @@ void rtw_surveydone_event_callback(_adapter *adapter, u8 *pbuf) scan_parm = rtw_malloc(sizeof(*scan_parm)); if (scan_parm) { - rtw_init_sitesurvey_parm(adapter, scan_parm); + rtw_init_sitesurvey_parm(scan_parm); _rtw_memcpy(&scan_parm->ssid[0], &pmlmepriv->assoc_ssid, sizeof(NDIS_802_11_SSID)); scan_parm->ssid_num = 1; } @@ -1567,6 +1599,7 @@ void rtw_surveydone_event_callback(_adapter *adapter, u8 *pbuf) } #endif /* CONFIG_RTW_FSM_BTM */ +done: RTW_INFO("scan complete in %dms\n",rtw_get_passing_time_ms(pmlmepriv->scan_start_time)); _rtw_spinunlock_bh(&pmlmepriv->lock); @@ -1595,9 +1628,8 @@ void rtw_surveydone_event_callback(_adapter *adapter, u8 *pbuf) rtw_beacon_hint_ch_change_notifier(adapter_to_rfctl(adapter)); #ifdef CONFIG_80211D - if (adapter_to_rfctl(adapter)->cis_enabled - && (adapter_to_rfctl(adapter)->cis_flags & CISF_ENV_BSS)) - rtw_apply_scan_network_country_ie_cmd(adapter, RTW_CMDF_DIRECTLY); + if (parm->complete &&(parm->reason & RTW_AUTO_SCAN_REASON_CIS_ENV_BSS)) + rtw_cis_scan_complete_hdl(adapter); #endif #ifdef CONFIG_RTW_MESH @@ -1874,11 +1906,11 @@ static u8 rtw_scan_sparse(_adapter *adapter, struct rtw_ieee80211_channel *ch, u return ret_num; } -static int rtw_scan_ch_decision(_adapter *padapter, struct rtw_ieee80211_channel *out, - u32 out_num, struct rtw_ieee80211_channel *in, u32 in_num, bool no_sparse) +static int _rtw_scan_ch_decision(_adapter *padapter, struct rtw_ieee80211_channel *out, + u32 out_num, struct rtw_ieee80211_channel *in, u32 in_num, bool include_dis, bool no_sparse) { int i, j; - int set_idx; + RT_CHANNEL_INFO *chinfo; u8 chan; struct rtw_chset *chset = adapter_to_chset(padapter); struct registry_priv *regsty = dvobj_to_regsty(adapter_to_dvobj(padapter)); @@ -1898,9 +1930,9 @@ static int rtw_scan_ch_decision(_adapter *padapter, struct rtw_ieee80211_channel if (rtw_mlme_band_check(padapter, in[i].hw_value) == _FALSE) continue; - set_idx = rtw_chset_search_bch(chset, in[i].band, in[i].hw_value); + chinfo = rtw_chset_get_chinfo_by_bch(chset, in[i].band, in[i].hw_value, include_dis); - if (set_idx >= 0) { + if (chinfo) { if (j >= out_num) { RTW_PRINT(FUNC_ADPT_FMT" out_num:%u not enough\n", FUNC_ADPT_ARG(padapter), out_num); @@ -1909,7 +1941,7 @@ static int rtw_scan_ch_decision(_adapter *padapter, struct rtw_ieee80211_channel _rtw_memcpy(&out[j], &in[i], sizeof(struct rtw_ieee80211_channel)); - if (chset->chs[set_idx].flags & (RTW_CHF_NO_IR | RTW_CHF_DFS)) + if (chinfo->flags & (RTW_CHF_NO_IR | RTW_CHF_DFS)) out[j].flags |= RTW_IEEE80211_CHAN_PASSIVE_SCAN; j++; @@ -1921,7 +1953,7 @@ static int rtw_scan_ch_decision(_adapter *padapter, struct rtw_ieee80211_channel /* if out is empty, use chset as default */ if (j == 0) { for (i = 0; i < chset->chs_len; i++) { - if (chset->chs[i].flags & RTW_CHF_DIS) + if (!include_dis && chset->chs[i].flags & RTW_CHF_DIS) continue; chan = chset->chs[i].ChannelNum; if (rtw_mlme_band_check(padapter, chan) == _TRUE) { @@ -1958,6 +1990,19 @@ static int rtw_scan_ch_decision(_adapter *padapter, struct rtw_ieee80211_channel return j; } + +int rtw_scan_ch_decision(_adapter *padapter, struct rtw_ieee80211_channel *out, + u32 out_num, struct rtw_ieee80211_channel *in, u32 in_num, bool no_sparse) +{ + return _rtw_scan_ch_decision(padapter, out, out_num, in, in_num, false, no_sparse); +} + +int rtw_scan_ch_dec(_adapter *padapter, struct rtw_ieee80211_channel *out, + u32 out_num, struct rtw_ieee80211_channel *in, u32 in_num, bool include_dis, bool no_sparse) +{ + return _rtw_scan_ch_decision(padapter, out, out_num, in, in_num, include_dis, no_sparse); +} + #ifdef CONFIG_SCAN_BACKOP u8 rtw_scan_backop_decision(_adapter *adapter) { @@ -2029,10 +2074,6 @@ struct scan_priv { #endif #ifdef CONFIG_RTW_FSM struct sta_info *psta; -#if defined(CONFIG_RTW_FSM_RRM) || defined(CONFIG_RTW_FSM_BTM) - u8 nb_num; - struct nb_bssid nb[RTW_MAX_NB_RPT_NUM]; -#endif #endif /* CONFIG_RTW_FSMCONFIG_RTW_FSM */ #if CONFIG_IEEE80211_BAND_6GHZ @@ -2041,6 +2082,7 @@ struct scan_priv { bool split_scan_6ghz; /* indicate if current scan is second scan for 6GHz */ #endif #endif + u8 reason; }; #ifdef CONFIG_CMD_SCAN @@ -2262,7 +2304,10 @@ static int scan_complete_cb(void *priv, struct rtw_phl_scan_param *param) #endif /* CONFIG_IEEE80211_BAND_6GHZ */ mlmeext_set_scan_state(pmlmeext, SCAN_DISABLE); - report_surveydone_event(padapter, acs, RTW_CMDF_DIRECTLY); + report_surveydone_event(padapter, + scan_priv->reason, + param->result == SCAN_REQ_COMPLETE, + acs, RTW_CMDF_DIRECTLY); issue_action_BSSCoexistPacket(padapter); issue_action_BSSCoexistPacket(padapter); @@ -2374,7 +2419,10 @@ static int scan_ch_ready_cb(void *priv, struct rtw_phl_scan_param *param, u8 sct _adapter *padapter = scan_priv->padapter; struct phl_scan_channel *scan_ch = param->sctrl[sctrl_idx].scan_ch; - RTW_INFO("%s: band=%d, ch=%d\n", __func__, scan_ch->band, scan_ch->channel); + RTW_INFO("scan_ch %s:%3d:%c (%3dms) %s\n", + scan_ch->band==BAND_ON_24G?"2G":scan_ch->band==BAND_ON_5G?"5G":"6G", + scan_ch->channel, scan_ch->scan_mode==BACKOP_MODE?'A':scan_ch->type?'A':'P', + scan_ch->duration, scan_ch->scan_mode==BACKOP_MODE?"OP":""); return 0; } @@ -2500,9 +2548,9 @@ static int scan_complete_wnm_cb(void *priv, struct rtw_phl_scan_param *param) ret = _SUCCESS; _exit: - RTW_INFO(FUNC_ADPT_FMT" %d ms to scan %d channels (%x)\n", - FUNC_ADPT_ARG(padapter), param->total_scan_time, - param->ch_num, pmlmeext->sitesurvey_res.bss_cnt); + RTW_INFO(FUNC_ADPT_FMT" %d/%d ms to scan %d/%d channels(%x)\n", + FUNC_ADPT_ARG(padapter), param->total_scan_time, param->max_scan_time, + param->done_num, param->ch_num, pmlmeext->sitesurvey_res.bss_cnt); _rtw_scan_abort_check(padapter, __func__); rtw_fsm_notify_scan_done(&padapter->fsmpriv, scan_priv->psta); @@ -2519,10 +2567,9 @@ static int scan_issue_pbreq_wnm_cb(void *priv, struct rtw_phl_scan_param *param, _adapter *padapter = spriv->padapter; struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); struct rtw_wifi_role_t *wrole = param->sctrl[sctrl_idx].wrole; - NDIS_802_11_SSID ssid; - int i, j; /* ToDo CONFIG_RTW_MLD: [currently primary link only] */ struct _ADAPTER_LINK *padapter_link = NULL; + struct phl_scan_channel *scan_ch = param->sctrl[sctrl_idx].scan_ch; if (wrole == NULL) { rtw_warn_on(1); @@ -2534,25 +2581,7 @@ static int scan_issue_pbreq_wnm_cb(void *priv, struct rtw_phl_scan_param *param, return 0; padapter_link = GET_PRIMARY_LINK(padapter); - - if (!param->ssid_num) { - issue_probereq(padapter, padapter_link, NULL, NULL); - return 0; - } - - for (i = 0; i < param->ssid_num; i++) { - if (param->ssid[i].ssid_len == 0) - continue; - - ssid.SsidLength = param->ssid[i].ssid_len; - _rtw_memcpy(ssid.Ssid, ¶m->ssid[i].ssid, ssid.SsidLength); - - for (j = 0; j < spriv->nb_num; j++) { - if (param->ch->channel == spriv->nb[j].ch) - issue_probereq(padapter, padapter_link, &ssid, spriv->nb[j].bssid); - } - issue_probereq(padapter, padapter_link, &ssid, NULL); - } + rtw_btm_notify_scan_probe_req(padapter->fsmpriv.btmpriv.btm, scan_ch); return 0; } @@ -2672,7 +2701,13 @@ static void scan_channel_list_filled(_adapter *padapter, phl_ch[i].type = RTW_PHL_SCAN_PASSIVE; } else { phl_ch[i].type = RTW_PHL_SCAN_ACTIVE; - phl_ch[i].duration = ACTIVE_CH_SURVEY_TO; + if (param->scan_type == RTW_SCAN_ROAM) { + if (phl_ch[i].band != BAND_ON_6G) + phl_ch[i].duration = ROAM_A_CH_SURVEY_TO; + } else { + if (phl_ch[i].band != BAND_ON_6G) + phl_ch[i].duration = ACTIVE_CH_SURVEY_TO; + } } } phl_param->ch_num = param->ch_num; @@ -2691,17 +2726,16 @@ u8 rtw_sitesurvey_cmd(_adapter *padapter, struct sitesurvey_parm *pparm) struct mlme_ext_priv *mlmeext = &padapter->mlmeextpriv; struct ss_res *ss = &mlmeext->sitesurvey_res; struct rtw_chset *chset = adapter_to_chset(padapter); -#if defined(CONFIG_RTW_80211K) || defined(CONFIG_RTW_FSM_RRM) || defined(CONFIG_RTW_FSM_BTM) || (CONFIG_IEEE80211_BAND_6GHZ && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))) struct scan_priv *scan_priv = NULL; -#endif + int j; if (pparm == NULL) { - tmp_parm = rtw_zmalloc(sizeof(struct sitesurvey_parm)); + tmp_parm = rtw_malloc(sizeof(struct sitesurvey_parm)); if (tmp_parm == NULL) { RTW_ERR("%s alloc tmp_parm fail\n", __func__); goto _err_exit; } - rtw_init_sitesurvey_parm(padapter, tmp_parm); + rtw_init_sitesurvey_parm(tmp_parm); pparm = tmp_parm; } @@ -2710,9 +2744,10 @@ u8 rtw_sitesurvey_cmd(_adapter *padapter, struct sitesurvey_parm *pparm) sizeof(struct rtw_ieee80211_channel) * pparm->ch_num); /* modify ch list according to chanel plan */ - pparm->ch_num = rtw_scan_ch_decision(padapter, - pparm->ch, RTW_CHANNEL_SCAN_AMOUNT, - ch, pparm->ch_num, pparm->acs); + pparm->ch_num = rtw_scan_ch_dec(padapter + , pparm->ch, RTW_CHANNEL_SCAN_AMOUNT, ch, pparm->ch_num + , pparm->reason & RTW_AUTO_SCAN_REASON_CIS_ENV_BSS + , pparm->acs || pparm->reason); if (pparm->duration == 0) pparm->duration = ss->scan_ch_ms; /* ms */ @@ -2724,6 +2759,8 @@ u8 rtw_sitesurvey_cmd(_adapter *padapter, struct sitesurvey_parm *pparm) goto _err_param; } + scan_priv = (struct scan_priv *)phl_param->priv; + /* STEP_1 transfer to rtw channel list to phl channel list */ scan_channel_list_filled(padapter, phl_param, pparm); @@ -2761,6 +2798,8 @@ u8 rtw_sitesurvey_cmd(_adapter *padapter, struct sitesurvey_parm *pparm) phl_param->opt = SCAN_CMD_OPT_DB; #endif + scan_priv->reason = pparm->reason; + /* STEP_3 set ops according to scan_type */ switch (pparm->scan_type) { #ifdef CONFIG_P2P @@ -2773,16 +2812,29 @@ u8 rtw_sitesurvey_cmd(_adapter *padapter, struct sitesurvey_parm *pparm) case RTW_SCAN_ROAM: phl_param->ops = &scan_ops_wnm_cb; - scan_priv = (struct scan_priv *)phl_param->priv; scan_priv->psta = pparm->psta; - memcpy(scan_priv->nb, pparm->nb, sizeof(struct nb_bssid) * RTW_MAX_NB_RPT_NUM); - scan_priv->nb_num = pparm->nb_num; - + #ifdef PRIVATE_N + for (i=0;inb_num;i++) { + for (j=0;jch_num;j++) { + if (phl_param->ch[j].band == pparm->nb[i].band && + phl_param->ch[j].channel == pparm->nb[i].ch) { + phl_param->ch[j].type = RTW_PHL_SCAN_ACTIVE; + break; + } + } + } + #endif #ifdef CONFIG_SCAN_BACKOP if (rtw_scan_backop_decision(padapter)) { +#if 1 + phl_param->back_op.ch_dur_ms = ROAM_P_CH_SURVEY_TO; + phl_param->back_op.mode = SCAN_BKOP_TIMER; + phl_param->back_op.off_ch_dur_ms = ROAM_P_CH_SURVEY_TO; +#else phl_param->back_op.ch_dur_ms = ss->backop_ms; phl_param->back_op.mode = SCAN_BKOP_CNT; phl_param->back_op.ch_intv = ss->scan_cnt_max; +#endif } else #endif /* CONFIG_SCAN_BACKOP */ { @@ -2793,7 +2845,6 @@ u8 rtw_sitesurvey_cmd(_adapter *padapter, struct sitesurvey_parm *pparm) #ifdef CONFIG_RTW_80211K case RTW_SCAN_RRM: phl_param->ops = &scan_ops_rrm_cb; - scan_priv = (struct scan_priv *)phl_param->priv; scan_priv->rrm_token = pparm->rrm_token; ss->token = pparm->rrm_token; break; @@ -2801,7 +2852,6 @@ u8 rtw_sitesurvey_cmd(_adapter *padapter, struct sitesurvey_parm *pparm) #ifdef CONFIG_RTW_FSM_RRM case RTW_SCAN_RRM: phl_param->ops = &scan_ops_rrm_cb; - scan_priv = (struct scan_priv *)phl_param->priv; scan_priv->psta = pparm->psta; break; #endif @@ -2823,7 +2873,6 @@ u8 rtw_sitesurvey_cmd(_adapter *padapter, struct sitesurvey_parm *pparm) #if CONFIG_IEEE80211_BAND_6GHZ #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) - scan_priv = (struct scan_priv *)phl_param->priv; scan_priv->pending_6ghz_scan = pparm->pending_6ghz_scan; scan_priv->split_scan_6ghz = pparm->split_scan_6ghz; #endif @@ -2841,7 +2890,7 @@ u8 rtw_sitesurvey_cmd(_adapter *padapter, struct sitesurvey_parm *pparm) } phl_param->max_scan_time = rtw_scan_timeout_decision(padapter, phl_param, pparm->duration); - #ifdef PRIVATE_R + #if defined(PRIVATE_R) || defined(PRIVATE_N) phl_param->max_scan_time += 10000; #endif @@ -3360,6 +3409,7 @@ u8 rtw_phl_remain_on_ch_cmd(_adapter *padapter, struct rtw_phl_scan_param *phl_param = NULL; struct scan_priv *scan_priv = NULL; u16 remain_ch; + enum band_type remain_band; u8 chan_num; u8 res = _FAIL; struct rtw_chan_def u_chdef = {0}; @@ -3368,6 +3418,7 @@ u8 rtw_phl_remain_on_ch_cmd(_adapter *padapter, /* prepare remain channel - check channel */ remain_ch = (u16)rtw_freq2ch(ch->center_freq); + remain_band = nl80211_band_to_rtw_band(ch->band); if (roch_stay_in_cur_chan(padapter) == _TRUE) { if (rtw_phl_mr_get_chandef(dvobj->phl, padapter->phl_role, padapter_link->wrlink, &u_chdef) @@ -3376,8 +3427,9 @@ u8 rtw_phl_remain_on_ch_cmd(_adapter *padapter, rtw_warn_on(1); } remain_ch = u_chdef.chan; - RTW_INFO(FUNC_ADPT_FMT" stay in union ch:%d\n", - FUNC_ADPT_ARG(padapter), remain_ch); + remain_band = u_chdef.band; + RTW_INFO(FUNC_ADPT_FMT" stay in union ch:%d, band:%d\n", + FUNC_ADPT_ARG(padapter), remain_ch, remain_band); } chan_num = 1; @@ -3400,7 +3452,7 @@ u8 rtw_phl_remain_on_ch_cmd(_adapter *padapter, /* fill phl param - chan */ phl_param->ch->channel = remain_ch; phl_param->ch->bw = CHANNEL_WIDTH_20; - phl_param->ch->band = nl80211_band_to_rtw_band(ch->band); + phl_param->ch->band = remain_band; phl_param->ch->duration = duration; phl_param->ch->scan_mode = P2P_LISTEN_MODE; phl_param->ch_num = chan_num; diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_tdls.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_tdls.c index d3ee5464..ed9e1fde 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_tdls.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_tdls.c @@ -862,7 +862,7 @@ u8 *rtw_tdls_set_he_operation(_adapter *padapter, u8 *pframe, struct pkt_attrib u32 ie_len = 0; ie_len = rtw_build_he_operation_ie(padapter, pattrib->adapter_link, - pframe, &pattrib->adapter_link->mlmeextpriv.chandef); + pframe, &pattrib->adapter_link->mlmeextpriv.chandef, 0); pattrib->pktlen += ie_len; return pframe + ie_len; diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_wlan_util.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_wlan_util.c index 39f85196..1661640d 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_wlan_util.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_wlan_util.c @@ -287,7 +287,7 @@ unsigned int ratetbl2rateset(_adapter *padapter, struct _ADAPTER_LINK *padapter_ for (i = 0; i < NumRates; i++) { rate = pmlmeext->datarate[i]; - if (rtw_get_oper_ch(padapter, padapter_link) > 14 && rate < _6M_RATE_) /*5G no support CCK rate*/ + if (rtw_get_oper_band(padapter, padapter_link) != BAND_ON_24G && rate < _6M_RATE_) /* non 2G no support CCK rate*/ continue; switch (rate) { @@ -2563,8 +2563,8 @@ void update_tx_basic_rate(_adapter *padapter, struct _ADAPTER_LINK *padapter_lin _rtw_memset(supported_rates, 0, NDIS_802_11_LENGTH_RATES_EX); - /* clear B mod if current channel is in 5G band, avoid tx cck rate in 5G band. */ - if (pmlmeext->chandef.chan > 14) + /* clear B mod if current channel is in non 2G band, avoid tx cck rate in non 2G band. */ + if (pmlmeext->chandef.band != BAND_ON_24G) wirelessmode &= ~(WLAN_MD_11B); if ((wirelessmode & WLAN_MD_11B) && (wirelessmode == WLAN_MD_11B)) @@ -3221,6 +3221,22 @@ _adapter *dvobj_get_unregisterd_adapter(struct dvobj_priv *dvobj) return adapter; } +_adapter *dvobj_get_netif_up_adapter(struct dvobj_priv *dvobj) +{ + _adapter *adapter = NULL; + int i; + + for (i = 0; i < dvobj->iface_nums; i++) { + if (dvobj->padapters[i]->netif_up) + break; + } + + if (i < dvobj->iface_nums) + adapter = dvobj->padapters[i]; + + return adapter; +} + _adapter *dvobj_get_adapter_by_addr(struct dvobj_priv *dvobj, u8 *addr) { _adapter *adapter = NULL; diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_wnm.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_wnm.c index 87cbfd9d..a03400b0 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_wnm.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_wnm.c @@ -41,20 +41,6 @@ static u8 wnm_non_pref_ch_oui[] = {0x50, 0x6F, 0x9A, 0x2}; #define rtw_wnm_get_non_pref_ch_oui(p) ((u8 *)(p) + 2) -void rtw_wnm_candidate_info(struct wlan_network *pnetwork, struct wlan_network *cnetwork, u8 *reason) -{ - if (reason) - RTW_INFO("candidate:%s %s("MAC_FMT", ch%3u) rssi:%d dBm, age:%5d [%7s]\n", - (pnetwork == cnetwork) ? "*" : " " , - pnetwork->network.Ssid.Ssid, - MAC_ARG(pnetwork->network.MacAddress), - pnetwork->network.Configuration.DSConfig, - (int)pnetwork->network.PhyInfo.rssi, - rtw_get_passing_time_ms(pnetwork->last_scanned), - reason - ); -} - static void rtw_wmn_btm_cache_update( _adapter *padapter, struct btm_req_hdr *phdr) { @@ -154,11 +140,11 @@ u8 rtw_wmn_btm_rsp_reason_decision(_adapter *padapter, struct roam_nb_info *pnb) } if (recvinfo->signal_strength_data.avg_val >= - pmlmepriv->roam_rssi_threshold) { + wnm_roam_rssi_th(pmlmepriv)) { reason = 1; RTW_INFO("WNM : Reject - under high roam rssi(%u, %u) \n", recvinfo->signal_strength_data.avg_val, - pmlmepriv->roam_rssi_threshold); + wnm_roam_rssi_th(pmlmepriv)); goto candidate_remove; } @@ -275,7 +261,7 @@ void rtw_wnm_roam_scan_hdl(void *ctx) RTW_WNM_INFO("%s : enable roaming\n", __func__); } - rtw_drv_scan_by_self(padapter, RTW_AUTO_SCAN_REASON_ROAM); + rtw_drv_scan_by_self(padapter, RTW_AUTO_SCAN_REASON_ROAM, false); #endif } @@ -369,7 +355,7 @@ void rtw_wnm_process_btm_req(_adapter *padapter, #ifndef PRIVATE_R /* MBO must respond to 11v BTM Requests from the AP with a Reject. */ - if (pnb->nb_rpt_ch_list_num == 0) + if (pnb->nb_rpt.ch_list_num == 0) #endif /* PRIVATE_R */ goto done; @@ -389,7 +375,7 @@ done: /* for wifi-test; AP2 could power-off when BTM-req received */ if ((reason > 0) && (rtw_mbo_wifi_logo_test(padapter))) { _rtw_memcpy(pnb->roam_target_addr, - pnb->nb_rpt[0].bssid, ETH_ALEN); + pnb->nb_rpt.nb_list[0].ent.bssid, ETH_ALEN); RTW_WNM_INFO("%s : used report 0 as roam_target_addr" "(reason=%u)\n", __func__, reason); reason = 0; @@ -424,6 +410,7 @@ void rtw_wnm_reset_btm_cache(_adapter *padapter) rtw_wnm_reset_btm_candidate(pnb); _rtw_memset(pcache, 0, sizeof(struct btm_rpt_cache)); + _rtw_memset(pmlmepriv->roam_from_addr, 0, ETH_ALEN); pcache->validity_time = wnm_defualt_validity_time; pcache->disassoc_time= wnm_default_disassoc_time; @@ -440,13 +427,13 @@ void rtw_wnm_reset_btm_state(_adapter *padapter) { struct roam_nb_info *pnb = &(padapter->mlmepriv.nb_info); - pnb->last_nb_rpt_entries = 0; + pnb->nb_rpt.nb_list_num = 0; pnb->nb_rpt_is_same = _TRUE; pnb->nb_rpt_valid = _FALSE; - pnb->nb_rpt_ch_list_num = 0; + pnb->nb_rpt.ch_list_num = 0; pnb->disassoc_waiting = -1; _rtw_memset(&pnb->nb_rpt, 0, sizeof(pnb->nb_rpt)); - _rtw_memset(&pnb->nb_rpt_ch_list, 0, sizeof(pnb->nb_rpt_ch_list)); + _rtw_memset(&pnb->nb_rpt.ch_list, 0, sizeof(pnb->nb_rpt.ch_list)); rtw_wnm_reset_btm_cache(padapter); } @@ -861,13 +848,13 @@ void rtw_roam_nb_info_init(_adapter *padapter) struct btm_rpt_cache *pcache = &(pnb->btm_cache); _rtw_memset(&pnb->nb_rpt, 0, sizeof(pnb->nb_rpt)); - _rtw_memset(&pnb->nb_rpt_ch_list, 0, sizeof(pnb->nb_rpt_ch_list)); + _rtw_memset(&pnb->nb_rpt.ch_list, 0, sizeof(pnb->nb_rpt.ch_list)); _rtw_memset(&pnb->roam_target_addr, 0, ETH_ALEN); pnb->nb_rpt_valid = _FALSE; - pnb->nb_rpt_ch_list_num = 0; + pnb->nb_rpt.ch_list_num = 0; pnb->preference_en = _FALSE; pnb->nb_rpt_is_same = _TRUE; - pnb->last_nb_rpt_entries = 0; + pnb->nb_rpt.nb_list_num = 0; pnb->disassoc_waiting = -1; #ifdef CONFIG_RTW_WNM pnb->features = 0; @@ -903,7 +890,7 @@ u8 rtw_roam_nb_scan_list_set( if (!pmlmepriv->need_to_roam) return ret; - if ((!pmlmepriv->nb_info.nb_rpt_valid) || (!pnb->nb_rpt_ch_list_num)) + if ((!pmlmepriv->nb_info.nb_rpt_valid) || (!pnb->nb_rpt.ch_list_num)) return ret; if (!pparm) @@ -912,9 +899,9 @@ u8 rtw_roam_nb_scan_list_set( if (rtw_roam_busy_scan(padapter, pnb)) { pparm->ch_num = 1; pparm->ch[pmlmepriv->ch_cnt].hw_value = - pnb->nb_rpt_ch_list[pmlmepriv->ch_cnt].hw_value; + pnb->nb_rpt.ch_list[pmlmepriv->ch_cnt].hw_value; pparm->ch[pmlmepriv->ch_cnt].band = - pnb->nb_rpt_ch_list[pmlmepriv->ch_cnt].band; + pnb->nb_rpt.ch_list[pmlmepriv->ch_cnt].band; ret = _TRUE; RTW_WNM_INFO("%s: ch_cnt=%u, (%u)hw_value=%u\n", @@ -923,19 +910,19 @@ u8 rtw_roam_nb_scan_list_set( pmlmepriv->ch_cnt++; - if (pmlmepriv->ch_cnt == pnb->nb_rpt_ch_list_num) { + if (pmlmepriv->ch_cnt == pnb->nb_rpt.ch_list_num) { pmlmepriv->nb_info.nb_rpt_valid = _FALSE; pmlmepriv->ch_cnt = 0; } goto set_bssid_list; } - pparm->ch_num = (pnb->nb_rpt_ch_list_num > RTW_MAX_NB_RPT_NUM)? - (RTW_MAX_NB_RPT_NUM):(pnb->nb_rpt_ch_list_num); + pparm->ch_num = (pnb->nb_rpt.ch_list_num > RTW_MAX_NB_RPT_NUM)? + (RTW_MAX_NB_RPT_NUM):(pnb->nb_rpt.ch_list_num); for (i=0; ich_num; i++) { - pparm->ch[i].hw_value = pnb->nb_rpt_ch_list[i].hw_value; + pparm->ch[i].hw_value = pnb->nb_rpt.ch_list[i].hw_value; pparm->ch[i].flags = RTW_IEEE80211_CHAN_PASSIVE_SCAN; - pparm->ch[i].band = pnb->nb_rpt_ch_list[i].band; + pparm->ch[i].band = pnb->nb_rpt.ch_list[i].band; } pmlmepriv->nb_info.nb_rpt_valid = _FALSE; @@ -1008,10 +995,10 @@ static u8 rtw_wnm_nb_elem_parsing( pcandidate->nb_rpt.phy_type, pcandidate->preference); } else { - if (_rtw_memcmp(&pnb->nb_rpt[i], pie, + if (_rtw_memcmp(&pnb->nb_rpt.nb_list[i].ent, pie, sizeof(struct nb_rpt_hdr)) == _FALSE) *nb_rpt_is_same = _FALSE; - _rtw_memcpy(&pnb->nb_rpt[i], pie, + _rtw_memcpy(&pnb->nb_rpt.nb_list[i].ent, pie, sizeof(struct nb_rpt_hdr)); } nb_rpt_entries++; @@ -1075,46 +1062,45 @@ static void rtw_wnm_nb_info_update( if (!pnb) return; - pnb->nb_rpt_ch_list_num = 0; + pnb->nb_rpt.ch_list_num = 0; for (i=0; inb_rpt[i], &pcand->nb_rpt, + if (_rtw_memcmp(&pnb->nb_rpt.nb_list[i].ent, &pcand->nb_rpt, sizeof(struct nb_rpt_hdr)) == _FALSE) *nb_rpt_is_same = _FALSE; - _rtw_memcpy(&pnb->nb_rpt[i], &pcand->nb_rpt, + _rtw_memcpy(&pnb->nb_rpt.nb_list[i].ent, &pcand->nb_rpt, sizeof(struct nb_rpt_hdr)); } RTW_WNM_INFO("WNM: bssid(" MAC_FMT ") , bss_info(0x%04X), reg_class(0x%02X)," " ch_num(%d), phy_type(0x%02X)\n", - MAC_ARG(pnb->nb_rpt[i].bssid), pnb->nb_rpt[i].bss_info, - pnb->nb_rpt[i].reg_class, pnb->nb_rpt[i].ch_num, - pnb->nb_rpt[i].phy_type); + MAC_ARG(pnb->nb_rpt.nb_list[i].ent.bssid), pnb->nb_rpt[i].bss_info, + pnb->nb_rpt.nb_list[i].ent.reg_class, pnb->nb_rpt[i].ch_num, + pnb->nb_rpt.nb_list[i].ent.phy_type); - if (pnb->nb_rpt[i].ch_num == 0) + if (pnb->nb_rpt.nb_list[i].ent.ch_num == 0) continue; for (j=0; jnb_rpt[i].ch_num == - pnb->nb_rpt_ch_list[j].hw_value) { + if (pnb->nb_rpt.nb_list[i].ent.ch_num == + pnb->nb_rpt.ch_list[j].hw_value) { is_found = _TRUE; break; } } if (!is_found) { - pnb->nb_rpt_ch_list[pnb->nb_rpt_ch_list_num].hw_value =\ - pnb->nb_rpt[i].ch_num; - pnb->nb_rpt_ch_list[pnb->nb_rpt_ch_list_num].band = - rtw_get_band_by_op_class(pnb->nb_rpt[i].reg_class); + pnb->nb_rpt.ch_list[pnb->nb_rpt.ch_list_num].hw_value =\ + pnb->nb_rpt.nb_list[i].ent.ch_num; + pnb->nb_rpt.ch_list[pnb->nb_rpt.ch_list_num].band = + rtw_get_band_by_op_class(pnb->nb_rpt.nb_list[i].ent.reg_class); /* error handling */ - if (pnb->nb_rpt_ch_list[pnb->nb_rpt_ch_list_num].band == BAND_MAX) - pnb->nb_rpt_ch_list[pnb->nb_rpt_ch_list_num].band = BAND_ON_24G; - - pnb->nb_rpt_ch_list_num++; + if (pnb->nb_rpt.ch_list[pnb->nb_rpt.ch_list_num].band == BAND_MAX) + pnb->nb_rpt.ch_list[pnb->nb_rpt.ch_list_num].band = BAND_ON_24G; + pnb->nb_rpt.ch_list_num++; } } } @@ -1123,12 +1109,13 @@ struct wlan_network * rtw_wnm_btm_candidate_check(_adapter *padapter, struct roam_nb_info *pnb, struct wlan_network *pnetwork) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct recv_info *precvinfo = &padapter->recvinfo; struct wlan_network *cnetwork = pmlmepriv->cur_network_scanned; - int i, preference = 0; + int i, preference = 0, delta; s8 rssi; - for (i = 0; i < pnb->last_nb_rpt_entries; i++) { - if ((_rtw_memcmp(pnb->nb_rpt[i].bssid,\ + for (i = 0; i < pnb->nb_rpt.nb_list_num; i++) { + if ((_rtw_memcmp(pnb->nb_rpt.nb_list[i].ent.bssid,\ padapter->mlmepriv.dev_cur_network.network.MacAddress, ETH_ALEN))) { /* pnb has self entry */ preference = 1; @@ -1140,22 +1127,22 @@ struct wlan_network * rtw_wnm_btm_candidate_check(_adapter *padapter, continue; } -#ifndef DBG_WNM_UNIT_TEST - /* check RSSI */ - if (!rtw_mbo_wifi_logo_test(padapter)) { - rssi = pnetwork->network.PhyInfo.rssi - cnetwork->network.PhyInfo.rssi; - if (rssi < pmlmepriv->roam_rssi_diff_th) { + if (!rtw_mbo_wifi_logo_test(padapter) && + !rtw_chk_roam_flags(padapter, RTW_ROAM_BTM_IGNORE_DELTA)) { + /* check RSSI */ + rssi = pnetwork->network.PhyInfo.rssi - precvinfo->bcn_rssi; + delta = wnm_roam_rssi_delta(pmlmepriv); + if (rssi < delta) { rtw_wnm_candidate_info(pnetwork, cnetwork, "delta"); continue; } } -#endif - if (_rtw_memcmp(pnb->nb_rpt[i].bssid, + if (_rtw_memcmp(pnb->nb_rpt.nb_list[i].ent.bssid, pnetwork->network.MacAddress, ETH_ALEN) == _TRUE) { - _rtw_memcpy(pnb->roam_target_addr, pnb->nb_rpt[i].bssid, ETH_ALEN); + _rtw_memcpy(pnb->roam_target_addr, pnb->nb_rpt.nb_list[i].ent.bssid, ETH_ALEN); - /* Only accept 1'st entry(highest preference) */ + /* Only accept 1'st entry(highest preference) */ //TODO if (pnb->preference_en && i != preference) { rtw_wnm_candidate_info(pnetwork, cnetwork, "!prefer"); break; @@ -1180,20 +1167,16 @@ struct wlan_network * rtw_wnm_btm_candidate_select(_adapter *padapter, struct ro ignore_currrent = _TRUE; #endif - for (i = 0; i < pnb->last_nb_rpt_entries; i++) { - if (ignore_currrent && - (_rtw_memcmp(pnb->nb_rpt[i].bssid,\ - padapter->mlmepriv.dev_cur_network.network.MacAddress, - ETH_ALEN))) { - RTW_WNM_INFO("WNM: ignore candidate "MAC_FMT - " for it's connected(%u)!\n", - MAC_ARG(pnb->nb_rpt[i].bssid), i); + for (i = 0; i < pnb->nb_rpt.nb_list_num; i++) { + if (ignore_currrent && (_rtw_memcmp(pnb->nb_rpt.nb_list[i].ent.bssid,\ + padapter->mlmepriv.dev_cur_network.network.MacAddress, ETH_ALEN))) { + RTW_INFO("WNM: ignore candidate "MAC_FMT " for it's connected(%u)!\n", + MAC_ARG(pnb->nb_rpt.nb_list[i].ent.bssid), i); continue; } - pnetwork = rtw_find_network( - &(pmlmepriv->scanned_queue), - pnb->nb_rpt[i].bssid); + pnetwork = rtw_find_network(&(pmlmepriv->scanned_queue), + pnb->nb_rpt.nb_list[i].ent.bssid); if (pnetwork) { bfound = _TRUE; @@ -1203,7 +1186,7 @@ struct wlan_network * rtw_wnm_btm_candidate_select(_adapter *padapter, struct ro if (bfound) { _rtw_memcpy(pnb->roam_target_addr, - pnb->nb_rpt[i].bssid, ETH_ALEN); + pnb->nb_rpt.nb_list[i].ent.bssid, ETH_ALEN); RTW_INFO("WNM: select btm entry(%d) -" " %s("MAC_FMT", ch:%u) rssi:%d\n" , i @@ -1234,7 +1217,7 @@ u32 rtw_wnm_btm_candidates_survey( } /*clean the status set last time*/ - _rtw_memset(&pnb->nb_rpt_ch_list, 0, sizeof(pnb->nb_rpt_ch_list)); + _rtw_memset(&pnb->nb_rpt.ch_list, 0, sizeof(pnb->nb_rpt.ch_list)); pnb->nb_rpt_valid = _FALSE; if (!rtw_wnm_nb_elem_parsing( pframe, elem_len, from_btm, @@ -1254,15 +1237,15 @@ u32 rtw_wnm_btm_candidates_survey( } RTW_WNM_INFO("nb_rpt_is_same = %d, nb_rpt_entries = %d," - " last_nb_rpt_entries = %d\n", + " nb_list_num = %d\n", nb_rpt_is_same, nb_rpt_entries, - pnb->last_nb_rpt_entries); + pnb->nb_rpt.nb_list_num); if ((nb_rpt_is_same == _TRUE) && - (nb_rpt_entries == pnb->last_nb_rpt_entries)) { + (nb_rpt_entries == pnb->nb_rpt.nb_list_num)) { pnb->nb_rpt_is_same = _TRUE; } else { pnb->nb_rpt_is_same = _FALSE; - pnb->last_nb_rpt_entries = nb_rpt_entries; + pnb->nb_rpt.nb_list_num = nb_rpt_entries; } pnb->nb_rpt_valid = _TRUE; ret = _SUCCESS; @@ -1502,5 +1485,41 @@ void rtw_wnm_process_notification_req( RTW_WLAN_ACTION_WNM_NOTIF_RSP, 0, dialog); } + +void rtw_wnm_start_clnt_join(_adapter *padapter, struct _ADAPTER_LINK *al) +{ + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); +#ifdef CONFIG_RTW_80211R + struct ft_roam_info *pft_roam = &(pmlmepriv->ft_roam); + + if (rtw_ft_otd_roam(padapter)) { + pmlmeinfo->state = WIFI_FW_AUTH_SUCCESS | WIFI_FW_STATION_STATE; + pft_roam->ft_event.ies = + (pft_roam->ft_action + \ + sizeof(struct rtw_ieee80211_hdr_3addr) + 16); + pft_roam->ft_event.ies_len = + (pft_roam->ft_action_len - \ + sizeof(struct rtw_ieee80211_hdr_3addr)); + + /*Not support RIC*/ + pft_roam->ft_event.ric_ies = NULL; + pft_roam->ft_event.ric_ies_len = 0; + rtw_ft_report_evt(padapter); + return; + } +#endif + /* update beacon_key */ + if (pmlmepriv->roam_network->bcn_keys_valid) + _rtw_memcpy(&al->mlmepriv.cur_beacon_keys, + &pmlmepriv->roam_network->bcn_keys, sizeof(struct beacon_keys)); + else + RTW_WARN("WNM : invalid beacon key!!\n"); + + pmlmeinfo->state = WIFI_FW_AUTH_NULL | WIFI_FW_STATION_STATE; + start_clnt_auth(padapter); +} + #endif /*defined(CONFIG_RTW_WNM) || defined(CONFIG_RTW_80211K) || defined(CONFIG_RTW_FSM_RRM)*/ diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_xmit.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_xmit.c index 034416ce..b0327c1d 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_xmit.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_xmit.c @@ -325,7 +325,9 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, _adapter *padapter) /* init xframe_ext queue, the same count as extbuf */ _rtw_init_queue(&pxmitpriv->free_xframe_ext_queue); #ifdef CONFIG_LAYER2_ROAMING +#ifndef CONFIG_RTW_ROAM_STOP_NETIF_QUEUE _rtw_init_queue(&pxmitpriv->rpkt_queue); +#endif #endif pxmitpriv->xframe_ext_alloc_addr = rtw_zvmalloc(NR_XMITFRAME_EXT * sizeof(struct xmit_frame) + 4); @@ -457,6 +459,8 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, _adapter *padapter) rtw_alloc_hwxmits(padapter); rtw_init_hwxmits(pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry); + pxmitpriv->max_agg_time = 0xA5; /* Default set to max. 5.28msec */ + for (i = 0; i < 4; i++) pxmitpriv->wmm_para_seq[i] = i; @@ -666,8 +670,10 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv) rtw_free_hwxmits(padapter); #ifdef CONFIG_LAYER2_ROAMING +#ifndef CONFIG_RTW_ROAM_STOP_NETIF_QUEUE _rtw_spinlock_free(&pxmitpriv->rpkt_queue.lock); #endif +#endif #ifdef RTW_PHL_TX free_txring(padapter); @@ -6236,6 +6242,7 @@ s32 rtw_xmit(_adapter *padapter, struct sk_buff **ppkt, u16 os_qid) static u32 drop_cnt = 0; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct xmit_frame *pxmitframe = NULL; + struct sk_buff *skb = (struct sk_buff *)(*ppkt); s32 res; DBG_COUNTER(padapter->tx_logs.core_tx); @@ -6249,6 +6256,11 @@ s32 rtw_xmit(_adapter *padapter, struct sk_buff **ppkt, u16 os_qid) if (start == 0) start = rtw_get_current_time(); + if (skb->protocol == htons(0x888e)) + pxmitframe = rtw_alloc_xmitframe_ext(pxmitpriv); + else + pxmitframe = rtw_alloc_xmitframe(pxmitpriv, os_qid); + pxmitframe = rtw_alloc_xmitframe(pxmitpriv, os_qid); if (rtw_get_passing_time_ms(start) > 2000) { @@ -7385,7 +7397,7 @@ static enum rtw_data_rate _rate_drv2phl(struct sta_info *sta, u8 rate) void dbg_dump_txreq_mdata(struct rtw_t_meta_data *mdata, const char *func) { -#ifdef DBG_DUMP_TX_COUNTER +#if defined(DBG_DUMP_TX_COUNTER) || defined(TXSC_DBG_DUMP_SPEC_PKT) if (1) { RTW_PRINT("[%s]\n", func); @@ -7449,8 +7461,8 @@ void dbg_dump_txreq_mdata(struct rtw_t_meta_data *mdata, const char *func) RTW_PRINT_DUMP("iv", mdata->iv, 6); /* mlo */ - RTW_PRINT("is_mld_sw_en: %d\n", mdata->is_mld_sw_en); - RTW_PRINT("is_mld: %d\n", mdata->is_mld); + //RTW_PRINT("is_mld_sw_en: %d\n", mdata->is_mld_sw_en); + //RTW_PRINT("is_mld: %d\n", mdata->is_mld); /* misc */ RTW_PRINT("no_ack: %d\n", mdata->no_ack); @@ -7530,11 +7542,11 @@ void dbg_dump_txreq_mdata(struct rtw_t_meta_data *mdata, const char *func) RTW_PRINT("raw: %d\n", mdata->raw); RTW_PRINT("sw_define: %d\n", mdata->sw_define); RTW_PRINT("sw_tx_ok: %d\n", mdata->sw_tx_ok); - RTW_PRINT("sr_en: %d\n", mdata->sr_en); - RTW_PRINT("sr_rate: %d\n", mdata->sr_rate); + //RTW_PRINT("sr_en: %d\n", mdata->sr_en); + //RTW_PRINT("sr_rate: %d\n", mdata->sr_rate); /* info section end */ } -#endif /*DBG_DUMP_TX_COUNTER*/ +#endif } void fill_txreq_mdata(_adapter *padapter, struct xmit_frame *pxframe) @@ -7699,10 +7711,11 @@ void fill_txreq_mdata(_adapter *padapter, struct xmit_frame *pxframe) mdata->userate_sel = 1; mdata->f_rate = _rate_mrate2phl(pxframe->attrib.rate); } else { - /* low rate for EAPOL/ARP/DHCP */ - if ((pxframe->attrib.ether_type == 0x888e) || + /* low rate for EAPOL/ARP/DHCP under normal mode */ + if (((pxframe->attrib.ether_type == 0x888e) || (pxframe->attrib.ether_type == 0x0806) || - (pxframe->attrib.dhcp_pkt == 1)) { + (pxframe->attrib.dhcp_pkt == 1)) && + !padapter->registrypriv.wifi_spec) { mdata->userate_sel = 1; if (IS_CCK_RATE(padapter_link->mlmeextpriv.tx_rate)) @@ -8446,9 +8459,14 @@ s32 rtw_core_tx(_adapter *padapter, struct sk_buff **pskb, struct sta_info *psta u8 status; #endif #ifdef CONFIG_CORE_TXSC - struct txsc_pkt_entry txsc_pkt = {0}; - - u8 icmp_wrk = 0; + u8 is_txsc_pkt = 0; + struct txsc_pkt_entry txsc_pkt = { .step = TXSC_NONE }; +#define CONFIG_CORE_TXSC_ONLY_TCP_UDP +#ifdef CONFIG_CORE_TXSC_ONLY_TCP_UDP + struct ethhdr *ethh; + struct iphdr *iph; + struct udphdr *udph; +#else #define PARSE_ICMP_V3 #ifdef PARSE_ICMP_V1 struct pkt_file pktfile; @@ -8457,22 +8475,47 @@ s32 rtw_core_tx(_adapter *padapter, struct sk_buff **pskb, struct sta_info *psta u8 *pktptr; struct ethhdr *etherhdr; #else + struct ethhdr *ethh; struct iphdr *iph; + struct udphdr *udph; struct icmphdr *icmph; #endif -#define PARSE_ICMP_TIMEX -#ifdef PARSE_ICMP_TIME +#endif /* CONFIG_CORE_TXSC_ONLY_TCP_UDP */ +//#define IS_TXSC_PARSE_TIME +#ifdef IS_TXSC_PARSE_TIME sysptime start, end; #endif - if (MLME_STATE(padapter) & WIFI_AP_STATE) { + if ((MLME_STATE(padapter) & WIFI_AP_STATE) || padapter->registrypriv.wifi_spec) { /* use slow path */ } else { -#ifdef PARSE_ICMP_TIME +#ifdef IS_TXSC_PARSE_TIME start = rtw_sptime_get_raw(); #endif - +#ifdef CONFIG_CORE_TXSC_ONLY_TCP_UDP + // Extract the ETH header + ethh = eth_hdr(*pskb); + if (ethh && ntohs(ethh->h_proto) == ETH_P_IP) { + // Extract the IP header + iph = ip_hdr(*pskb); + if (iph) { + if (iph->protocol == IPPROTO_TCP) + is_txsc_pkt = 1; + else if (iph->protocol == IPPROTO_UDP) { + udph = udp_hdr(*pskb); + /* 67 : UDP BOOTP server, 68 : UDP BOOTP client */ + if (udph && ((ntohs(udph->source) == 68 && ntohs(udph->dest) == 67) || + (ntohs(udph->source) == 67 && ntohs(udph->dest) == 68))) + /* no fast path if special packet */ + ; + else + is_txsc_pkt = 1; + } + } + } +#else + is_txsc_pkt = 1; #ifdef PARSE_ICMP_V1 _rtw_open_pktfile(*pskb, &pktfile); _rtw_pktfile_read(&pktfile, (u8 *)ðerhdr, ETH_HLEN); @@ -8488,10 +8531,8 @@ s32 rtw_core_tx(_adapter *padapter, struct sk_buff **pskb, struct sta_info *psta u8 icmp[16]; /* seq = icmp[6]*256 + icmp[7] */ _rtw_pktfile_read(&pktfile, icmp, 16); // ICMP Type: 3 (Destination unreachable) & Code: 3 (Port unreachable) - if (3 == icmp[0] && 3 == icmp[1]) { - icmp_wrk = 1; - txsc_pkt.step = TXSC_NONE; - } + if (3 == icmp[0] && 3 == icmp[1]) + is_txsc_pkt = 0; } } #elif defined(PARSE_ICMP_V2) @@ -8507,34 +8548,45 @@ s32 rtw_core_tx(_adapter *padapter, struct sk_buff **pskb, struct sta_info *psta if (GET_IPV4_PROTOCOL(ip) == 0x01) { /* ICMP */ u8 *icmp = pktptr; /* seq = icmp[6]*256 + icmp[7] */ - if (3 == icmp[0] && 3 == icmp[1]) { - icmp_wrk = 1; - txsc_pkt.step = TXSC_NONE; - } + if (3 == icmp[0] && 3 == icmp[1]) + is_txsc_pkt = 0; } } #else - // Extract the IP header - iph = ip_hdr(*pskb); - if (iph && iph->protocol == IPPROTO_ICMP) { - icmph = icmp_hdr(*pskb); - if (icmph && icmph->type == ICMP_DEST_UNREACH && - icmph->code == ICMP_PORT_UNREACH) { - icmp_wrk = 1; - txsc_pkt.step = TXSC_NONE; + // Extract the ETH header + ethh = eth_hdr(*pskb); + if (ethh && ntohs(ethh->h_proto) == ETH_P_IP) { + // Extract the IP header + iph = ip_hdr(*pskb); + if (iph && iph->protocol == IPPROTO_ICMP) { + icmph = icmp_hdr(*pskb); + if (icmph && icmph->type == ICMP_DEST_UNREACH && + icmph->code == ICMP_PORT_UNREACH) + is_txsc_pkt = 0; + } else if (iph && iph->protocol == IPPROTO_UDP) { + udph = udp_hdr(*pskb); + if (udph && ((ntohs(udph->source) == 68 && ntohs(udph->dest) == 67) + || (ntohs(udph->source) == 67 && ntohs(udph->dest) == 68))) + is_txsc_pkt = 0; } - } + } else + is_txsc_pkt = 0; // for ARP/EAPOL fix rate #endif +#endif /* CONFIG_CORE_TXSC_ONLY_TCP_UDP */ -#ifdef PARSE_ICMP_TIME +#ifdef IS_TXSC_PARSE_TIME end = rtw_sptime_get_raw(); RTW_INFO_LMT("%s: pass_t=%lld\n", __func__, rtw_sptime_diff_ns(start,end)); #endif - - if (0 == icmp_wrk) { - if ( (txsc_get_sc_cached_entry(padapter, *pskb, &txsc_pkt) == _SUCCESS) ) - goto core_txsc; + #ifdef TXSC_DBG_DUMP_SPEC_PKT + if (0 == txsc_pkt.is_spec_pkt) { + #endif + if (likely(is_txsc_pkt)) + if ( (txsc_get_sc_cached_entry(padapter, *pskb, &txsc_pkt) == _SUCCESS) ) + goto core_txsc; + #ifdef TXSC_DBG_DUMP_SPEC_PKT } + #endif } #endif @@ -8589,7 +8641,9 @@ s32 rtw_core_tx(_adapter *padapter, struct sk_buff **pskb, struct sta_info *psta } #endif /* defined(CONFIG_AP_MODE) */ #ifdef CONFIG_LAYER2_ROAMING - if ((padapter->mlmepriv.roam_network) && ((*pskb)->protocol != htons(0x888e))) { /* eapol never enqueue.*/ +#ifndef CONFIG_RTW_ROAM_STOP_NETIF_QUEUE + if ((padapter->mlmepriv.roam_buf_pkt) && + ((*pskb)->protocol != htons(0x888e))) { /* never enqueue eapol */ pxframe->pkt = *pskb; rtw_list_delete(&pxframe->list); _rtw_spinlock_bh(&pxmitpriv->rpkt_queue.lock); @@ -8598,25 +8652,56 @@ s32 rtw_core_tx(_adapter *padapter, struct sk_buff **pskb, struct sta_info *psta return SUCCESS; } #endif +#endif #ifdef CONFIG_CORE_TXSC - if ((MLME_STATE(padapter) & WIFI_AP_STATE) || icmp_wrk) - res = core_tx_per_packet(padapter, pxframe, pskb, psta); - else + if (likely(is_txsc_pkt)) res = core_tx_per_packet_sc(padapter, pxframe, pskb, psta, &txsc_pkt); + else + res = core_tx_per_packet(padapter, pxframe, pskb, psta); #else res = core_tx_per_packet(padapter, pxframe, pskb, psta); #endif if (res == FAIL) return FAIL; - + #ifdef CONFIG_CORE_TXSC // TXSC WRK - if (NULL == pxframe->phl_txreq || icmp_wrk || (MLME_STATE(padapter) & WIFI_AP_STATE)) + if (pxframe->phl_txreq == NULL) { + RTW_WARN_LMT("%s: phl_txreq is null\n", __func__); + return SUCCESS; + } + + if (is_txsc_pkt == 0) return SUCCESS; - txsc_add_sc_cache_entry(padapter, pxframe, &txsc_pkt); +#ifdef TXSC_DBG_DUMP_SPEC_PKT + if (1 == txsc_pkt.is_spec_pkt) { + struct rtw_xmit_req *txreq_ori = (struct rtw_xmit_req *) pxframe->ptxreq_buf->txreq; + struct rtw_pkt_buf_list *pkt_list_ori = (struct rtw_pkt_buf_list *)txreq_ori->pkt_list; +#ifdef TXSC_DBG_COPY_ORI_WLHDR_MDATA + memcpy(txsc_pkt.wlhdr_ori, pkt_list_ori->vir_addr, pkt_list_ori->length); + txsc_pkt.wlhdr_ori_len = pkt_list_ori->length; + + memcpy(&txsc_pkt.mdata_ori, &pxframe->phl_txreq->mdata, sizeof(struct rtw_t_meta_data)); +#endif + /* for tx debug */ + dbg_dump_txreq_mdata(&pxframe->phl_txreq->mdata, __func__); + _print_txreq_pklist(NULL, pxframe->phl_txreq, *pskb, __func__); + + pxframe->pkt = NULL; + core_tx_free_xmitframe(padapter, pxframe); + pxframe = NULL; + + if (txsc_get_sc_cached_entry(padapter, *pskb, &txsc_pkt) != _SUCCESS) + return SUCCESS; + } else { + txsc_add_sc_cache_entry(padapter, pxframe, &txsc_pkt); + } +#else + txsc_add_sc_cache_entry(padapter, pxframe, &txsc_pkt); +#endif core_txsc: #ifdef CONFIG_TXSC_AMSDU @@ -9625,25 +9710,41 @@ exit: #ifdef CONFIG_LAYER2_ROAMING /* dequeuq + xmit the cache skb during the roam procedure */ -void dequeuq_roam_pkt(_adapter *padapter) +void dequeuq_roam_pkt(_adapter *padapter, bool drop) { struct xmit_frame *rframe; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); _list *plist = NULL, *phead = NULL; + int i = 0; - if (padapter->mlmepriv.roam_network) { - padapter->mlmepriv.roam_network = NULL; - _rtw_spinlock_bh(&pxmitpriv->rpkt_queue.lock); - phead = get_list_head(&pxmitpriv->rpkt_queue); - plist = get_next(phead); - while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { - rframe = LIST_CONTAINOR(plist, struct xmit_frame, list); - plist = get_next(plist); - rtw_list_delete(&rframe->list); - core_tx_per_packet(padapter, rframe, &rframe->pkt, NULL); - } - _rtw_spinunlock_bh(&pxmitpriv->rpkt_queue.lock); + padapter->mlmepriv.roam_network = NULL; + if (pmlmepriv->roam_buf_pkt) { + padapter->mlmepriv.roam_buf_pkt = _FALSE; + rtw_roam_wake_queue(padapter); } + _rtw_memset(pmlmepriv->roam_from_addr, 0, ETH_ALEN); +#ifndef CONFIG_RTW_ROAM_STOP_NETIF_QUEUE + _rtw_spinlock_bh(&pxmitpriv->rpkt_queue.lock); + phead = get_list_head(&pxmitpriv->rpkt_queue); + plist = get_next(phead); + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { + rframe = LIST_CONTAINOR(plist, struct xmit_frame, list); + plist = get_next(plist); + rtw_list_delete(&rframe->list); + i++; + if (drop) { + if (rframe->pkt == NULL) + rtw_os_pkt_complete(padapter, rframe->pkt); + core_tx_free_xmitframe(padapter, rframe); + continue; + } + core_tx_per_packet(padapter, rframe, &rframe->pkt, NULL); + } + _rtw_spinunlock_bh(&pxmitpriv->rpkt_queue.lock); + + RTW_INFO("%s %d roam_buf_pkts\n", drop?"drop":"send", i); +#endif } #endif diff --git a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_xmit_shortcut.c b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_xmit_shortcut.c index ddc4d7bc..c0c85272 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/core/rtw_xmit_shortcut.c +++ b/drivers/net/wireless/realtek/rtl8852ce/core/rtw_xmit_shortcut.c @@ -22,8 +22,9 @@ void _print_txreq_pklist(struct xmit_frame *pxframe, struct rtw_xmit_req *ptxreq struct rtw_pkt_buf_list *pkt_list = NULL; struct rtw_xmit_req *txreq = NULL; u8 pkt_cnt = 0, i; - +#ifndef TXSC_DBG_DUMP_SPEC_PKT if (DBG_PRINT_TXREQ_ONCE == 1) { +#endif RTW_PRINT("%s\n", func); RTW_PRINT("[%s] pxframe=%p txreq=%p\n", func, pxframe, ptxreq); @@ -47,7 +48,9 @@ void _print_txreq_pklist(struct xmit_frame *pxframe, struct rtw_xmit_req *ptxreq pkt_list++; } DBG_PRINT_TXREQ_ONCE = 0; +#ifndef TXSC_DBG_DUMP_SPEC_PKT } +#endif } #ifdef CONFIG_TXSC_AMSDU @@ -1104,7 +1107,12 @@ u8 txsc_apply_sc_cached_entry(_adapter *padapter, struct txsc_pkt_entry *txsc_pk #endif /* fill_txreq_mdata */ - _rtw_memcpy(&txreq->mdata, mdata, sizeof(txreq->mdata)); +#ifdef TXSC_DBG_COPY_ORI_WLHDR_MDATA + if (txsc_pkt->is_spec_pkt) { + _rtw_memcpy(&txreq->mdata, &txsc_pkt->mdata_ori, sizeof(txreq->mdata)); + } else +#endif + _rtw_memcpy(&txreq->mdata, mdata, sizeof(txreq->mdata)); /* Update TID from IP header */ /* priority = *(xmit_skb[0]->data + ETH_HLEN + 1); */ @@ -1143,28 +1151,34 @@ u8 txsc_apply_sc_cached_entry(_adapter *padapter, struct txsc_pkt_entry *txsc_pk #endif wlhdr_copy_len = txsc_wlhdr_len; - if (txreq->mdata.sec_hw_enc) { - if (padapter->dvobj->phl_com->dev_cap.sec_cap.hw_form_hdr && - mdata->sec_type != RTW_ENC_WAPI && mdata->hw_sec_iv == 0) { - txreq->mdata.sec_keyid = psta->key_idx; - /* Fill PN of IV */ - for (i = 0; i < 6; i++) - txreq->mdata.iv[i] = (psta->dot11txpn.val >> 8 * i) & 0xff; - _txsc_update_sec_iv(padapter, psta, txreq); - RTW_DBG("%s: keyid=%d, iv=" PN_FMT "\n", __func__, - txreq->mdata.sec_keyid, PN_ARG(txreq->mdata.iv)); - } - else { - //RTW_INFO("%s udpate iv, psta->iv_len : %d, psta->dot11txpn : %d\n", __func__, psta->iv_len, psta->dot11txpn); - //RTW_PRINT_DUMP("[before upadte iv]", ptxsc_wlhdr, wlhdr_copy_len); - _txsc_update_sec_iv(padapter, psta, txreq); - offset = wlhdr_copy_len - psta->iv_len - RTW_SZ_LLC; - _rtw_memcpy((hdr + offset), psta->iv, psta->iv_len); - //RTW_INFO("%s offset : %d\n", __func__, offset); - //RTW_PRINT_DUMP("[IV]", psta->iv, psta->iv_len); - //RTW_PRINT_DUMP("[after upadte iv]", pkt_list0->vir_addr, wlhdr_copy_len); +#ifdef TXSC_DBG_COPY_ORI_WLHDR_MDATA + if (!txsc_pkt->is_spec_pkt) { +#endif + if (txreq->mdata.sec_hw_enc) { + if (padapter->dvobj->phl_com->dev_cap.sec_cap.hw_form_hdr && + mdata->sec_type != RTW_ENC_WAPI && mdata->hw_sec_iv == 0) { + txreq->mdata.sec_keyid = psta->key_idx; + /* Fill PN of IV */ + for (i = 0; i < 6; i++) + txreq->mdata.iv[i] = (psta->dot11txpn.val >> 8 * i) & 0xff; + _txsc_update_sec_iv(padapter, psta, txreq); + RTW_DBG("%s: keyid=%d, iv=" PN_FMT "\n", __func__, + txreq->mdata.sec_keyid, PN_ARG(txreq->mdata.iv)); + } + else { + //RTW_INFO("%s udpate iv, psta->iv_len : %d, psta->dot11txpn : %d\n", __func__, psta->iv_len, psta->dot11txpn); + //RTW_PRINT_DUMP("[before upadte iv]", ptxsc_wlhdr, wlhdr_copy_len); + _txsc_update_sec_iv(padapter, psta, txreq); + offset = wlhdr_copy_len - psta->iv_len - RTW_SZ_LLC; + _rtw_memcpy((hdr + offset), psta->iv, psta->iv_len); + //RTW_INFO("%s offset : %d\n", __func__, offset); + //RTW_PRINT_DUMP("[IV]", psta->iv, psta->iv_len); + //RTW_PRINT_DUMP("[after upadte iv]", pkt_list0->vir_addr, wlhdr_copy_len); + } } +#ifdef TXSC_DBG_COPY_ORI_WLHDR_MDATA } +#endif /* WLAN header from cache */ #ifdef USE_ONE_WLHDR @@ -1191,9 +1205,19 @@ u8 txsc_apply_sc_cached_entry(_adapter *padapter, struct txsc_pkt_entry *txsc_pk } else #endif /* USE_PREV_WLHDR_BUF */ { + #ifdef TXSC_DBG_COPY_ORI_WLHDR_MDATA + if (txsc_pkt->is_spec_pkt) { + wlhdr_copy_len = txsc_pkt->wlhdr_ori_len; + SetSeqNum(txsc_pkt->wlhdr_ori, txsc_pkt->mdata_ori.sw_seq); + _rtw_memcpy(head, txsc_pkt->wlhdr_ori, wlhdr_copy_len); + } else + #endif _rtw_memcpy(head, ptxsc_wlhdr, wlhdr_copy_len); } + qc = (u16 *)(head + WLAN_HDR_A3_LEN); + SetPriority(qc, priority); + /* fill wlhdr in pkt_list[0] */ pkt_list->vir_addr = head; pkt_list->length = wlhdr_copy_len; diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/autoconf.h b/drivers/net/wireless/realtek/rtl8852ce/include/autoconf.h index dbe1e893..936cbaeb 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/autoconf.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/autoconf.h @@ -335,6 +335,12 @@ * Software feature Related Config */ #define CONFIG_SCAN_BACKOP_STA +#define PRIVATE_N + +#ifdef PRIVATE_N +/* scan 2G & 5G only */ +#define CONFIG_RTW_COUNTRY_IE_SLAVE_SCAN_BAND_BMP 0x03 +#endif /* @@ -401,7 +407,8 @@ /* #define DBG_RX_SIGNAL_DISPLAY_PROCESSING */ /* #define DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED "jeff-ap" */ -/* #define DBG_ROAMING_TEST */ +#define DBG_ROAMING_TEST +/* #define DBG_SERVING_AP_RSSI */ /* #define DBG_HAL_INIT_PROFILING */ @@ -528,18 +535,24 @@ #endif #endif -#define CONFIG_CORE_TXSC -#define CONFIG_PHL_TXSC +/* #define CONFIG_CORE_TXSC */ +/* #define CONFIG_PHL_TXSC */ #ifdef CONFIG_CORE_TXSC +//#define TXSC_DBG_DUMP_SPEC_PKT +#ifdef TXSC_DBG_DUMP_SPEC_PKT +//#define TXSC_DBG_COPY_ORI_WLHDR_MDATA +#endif //#define USE_ONE_WLHDR //#define CONFIG_RTW_TXSC_USE_HW_SEQ #ifdef CONFIG_TX_AMSDU #undef CONFIG_TX_AMSDU_SW_MODE #undef CONFIG_RTW_TX_AMSDU_USE_WQ +#ifndef TXSC_DBG_DUMP_SPEC_PKT #define CONFIG_TXSC_AMSDU #endif #endif +#endif #ifdef CONFIG_PHL_TXSC #define CONFIG_HW_SEC_IV diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/drv_conf.h b/drivers/net/wireless/realtek/rtl8852ce/include/drv_conf.h index 049e5112..9910964d 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/drv_conf.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/drv_conf.h @@ -324,6 +324,10 @@ #define CONFIG_RTW_DIS_CH_FLAGS NULL #endif +#ifndef CONFIG_RTW_EXTRA_ALPHA2 +#define CONFIG_RTW_EXTRA_ALPHA2 NULL +#endif + #ifndef CONFIG_RTW_BCN_HINT_VALID_MS #define CONFIG_RTW_BCN_HINT_VALID_MS (60 * 1000) #endif @@ -348,8 +352,16 @@ #define CONFIG_RTW_COUNTRY_IE_SLAVE_EN_IFBMP 0xFF /* all iface */ #endif +#ifndef CONFIG_RTW_COUNTRY_IE_SLAVE_SCAN_BAND_BMP +#define CONFIG_RTW_COUNTRY_IE_SLAVE_SCAN_BAND_BMP 0xFF /* all band */ +#endif + #ifndef CONFIG_RTW_COUNTRY_IE_SLAVE_SCAN_INT_MS -#define CONFIG_RTW_COUNTRY_IE_SLAVE_SCAN_INT_MS (60 * 1000) +#define CONFIG_RTW_COUNTRY_IE_SLAVE_SCAN_INT_MS (50 * 60 * 1000) +#endif + +#ifndef CONFIG_RTW_COUNTRY_IE_SLAVE_SCAN_URGENT_MS +#define CONFIG_RTW_COUNTRY_IE_SLAVE_SCAN_URGENT_MS (55 * 60 * 1000) #endif #define CONFIG_IEEE80211_BAND_5GHZ 1 @@ -440,21 +452,6 @@ #define CONFIG_COUNTRY_CHPLAN_EDCCA_OVERRIDE 0 #endif -#ifndef RTW_DEF_MODULE_REGULATORY_CERT - #define RTW_DEF_MODULE_REGULATORY_CERT 0 -#endif - -#if RTW_DEF_MODULE_REGULATORY_CERT - #ifdef CONFIG_REGD_SRC_FROM_OS - #error "CONFIG_REGD_SRC_FROM_OS is not supported when enable RTW_DEF_MODULE_REGULATORY_CERT" - #endif - /* force enable TX power by rate and TX power limit */ - #undef CONFIG_TXPWR_BY_RATE_EN - #undef CONFIG_TXPWR_LIMIT_EN - #define CONFIG_TXPWR_BY_RATE_EN 1 - #define CONFIG_TXPWR_LIMIT_EN 1 -#endif - #if !CONFIG_TXPWR_LIMIT && CONFIG_TXPWR_LIMIT_EN #undef CONFIG_TXPWR_LIMIT #define CONFIG_TXPWR_LIMIT 1 @@ -805,6 +802,10 @@ power down etc.) in last time, we can unmark this flag to avoid some unpredictab #endif #endif +#ifdef CONFIG_BTC +//#define CONFIG_BTC_TRXSS_CHG +#endif + /* * Work around Config */ diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/drv_types.h b/drivers/net/wireless/realtek/rtl8852ce/include/drv_types.h index 55595b1a..82478b97 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/drv_types.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/drv_types.h @@ -84,6 +84,7 @@ struct _ADAPTER_LINK; #include "platform_ops.h" #include "rtw_scan.h" +#include #ifdef CONFIG_RTW_80211R #include #endif @@ -173,9 +174,6 @@ struct _ADAPTER_LINK; #include #include -#ifdef CONFIG_RTW_FSM -#include -#endif #define SPEC_DEV_ID_NONE BIT(0) #define SPEC_DEV_ID_DISABLE_HT BIT(1) @@ -376,6 +374,7 @@ struct registry_priv { enum rtw_env_t env; #endif u8 dis_ch_flags; + char extra_alpha2[2]; u32 bcn_hint_valid_ms; u8 full_ch_in_p2p_handshake; /* 0: reply only softap channel, 1: reply full channel list*/ @@ -411,7 +410,9 @@ struct registry_priv { u8 country_ie_slave_flags; u8 country_ie_slave_en_role; u8 country_ie_slave_en_ifbmp; + u8 country_ie_slave_scan_band_bmp; u32 country_ie_slave_scan_int_ms; + u32 country_ie_slave_scan_urgent_ms; #endif u8 ifname[16]; @@ -986,6 +987,7 @@ struct rf_ctl_t { bool user_regd_always_apply; struct regd_req_t init_req; struct regd_req_t *user_req; + struct regd_req_t *extra_req; u32 bcn_hint_valid_ms; /* the length of time beacon hint continue */ @@ -995,7 +997,9 @@ struct rf_ctl_t { u8 cis_en_role; /* per link cis enable role, see COUNTRY_IE_SLAVE_EN_ROLE_XXX, used when CISF_ENV_BSS is not set */ u8 cis_en_ifbmp; /* per link cis enable iface bitmap, used when CISF_ENV_BSS is not set */ - u32 cis_scan_int_ms; /* 0 means no env BSS scan triggerred by driver self, used when CISF_ENV_BSS is set */ + u8 cis_scan_band_bmp; /* the band bitmap to do env BSS scan triggered by driver self, used when CISF_ENV_BSS is set */ + u32 cis_scan_int_ms; /* the interval in ms of env BSS scan triggered by driver self, used when CISF_ENV_BSS is set */ + u32 cis_scan_urgent_ms; /* time in ms when env BSS scan is not completed for, urgent env BSS scan will be triggered */ bool init_user_req_is_ww; bool cis_enabled; /* enable status */ @@ -1010,6 +1014,10 @@ struct rf_ctl_t { #endif struct country_ie_slave_record cisr[CONFIG_IFACE_NUMBER][RTW_RLINK_MAX]; + /* env BSS scan status */ + systime cis_scan_last_complete_time; /* last ENV_BSS scan complete time */ + struct cis_scan_stat_t cis_scan_stat; /* env BSS scan result statistics data */ + #if CONFIG_IEEE80211_BAND_6GHZ u8 default_chplan_cate_6g_map; /* bitmap of CHPLAN_6G_CATE_XXX */ @@ -1459,6 +1467,7 @@ static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj) #endif _adapter *dvobj_get_unregisterd_adapter(struct dvobj_priv *dvobj); +_adapter *dvobj_get_netif_up_adapter(struct dvobj_priv *dvobj); _adapter *dvobj_get_adapter_by_addr(struct dvobj_priv *dvobj, u8 *addr); #define dvobj_get_primary_adapter(dvobj) ((dvobj)->padapters[IFACE_ID0]) diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/osdep_service.h b/drivers/net/wireless/realtek/rtl8852ce/include/osdep_service.h index 2c5a9853..775cdd06 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/osdep_service.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/osdep_service.h @@ -99,7 +99,7 @@ #endif extern int RTW_STATUS_CODE(int error_code); -extern u16 rtw_warn_on_cnt; +extern ATOMIC_T rtw_warn_on_cnt; #ifndef RTK_DMP_PLATFORM #define CONFIG_USE_VMALLOC diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/osdep_service_linux.h b/drivers/net/wireless/realtek/rtl8852ce/include/osdep_service_linux.h index 64edbcef..6e1d38eb 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/osdep_service_linux.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/osdep_service_linux.h @@ -468,6 +468,12 @@ __inline static _list *get_next(_list *list) { return list->next; } + +__inline static _list *get_prev(_list *list) +{ + return list->prev; +} + __inline static _list *get_list_head(_queue *queue) { return &(queue->queue); @@ -1169,7 +1175,7 @@ static inline void rtw_dump_stack(void) do { \ if (condition) { \ WARN_ON(1); \ - ATOMIC_INC((ATOMIC_T *)&rtw_warn_on_cnt); \ + ATOMIC_INC(&rtw_warn_on_cnt); \ } \ } while (0) diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_btc.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_btc.h index e44eba45..983dea1c 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_btc.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_btc.h @@ -17,6 +17,19 @@ #ifndef __RTW_BTC_H__ #define __RTW_BTC_H__ +enum rtw_core_btc_cmd_id { + RTW_CORE_BTC_CMD_TRXSS_LMT, + RTW_CORE_BTC_CMD_TRXSS_NO_LMT, + RTW_CORE_BTC_CMD_MAX +}; + +u8 rtw_core_btc_hdl(_adapter *padapter, enum rtw_core_btc_cmd_id btc_cmd_id); +u8 rtw_core_btc_cmd(_adapter *padapter, enum rtw_core_btc_cmd_id btc_cmd_id, u8 flags); + +#ifdef CONFIG_BTC_TRXSS_CHG +u8 rtw_btc_trxss_chg_hdl(struct dvobj_priv *dvobj, struct phl_msg *msg, u16 evt_id); +#endif + #endif /* __RTW_BTC_H__ */ #endif /* CONFIG_BTC */ diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_cmd.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_cmd.h index 67d129db..ec95b3d1 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_cmd.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_cmd.h @@ -195,6 +195,9 @@ enum rtw_drvextra_cmd_id { #ifdef CONFIG_P2P HIDE_SSID_WK_CID, #endif +#endif +#ifdef CONFIG_BTC + CORE_BTC_CID, #endif MAX_WK_CID }; diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_debug.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_debug.h index 434ff467..a5a18064 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_debug.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_debug.h @@ -565,6 +565,8 @@ ssize_t proc_set_tx_amsdu(struct file *file, const char __user *buffer, size_t c int proc_get_tx_amsdu_rate(struct seq_file *m, void *v); ssize_t proc_set_tx_amsdu_rate(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data); #endif +int proc_get_tx_max_agg_time(struct seq_file *m, void *v); +ssize_t proc_set_tx_max_agg_time(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data); #endif /* CONFIG_80211N_HT */ #ifdef CONFIG_80211AC_VHT diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_event.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_event.h index 4991cd5d..1009c74d 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_event.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_event.h @@ -33,6 +33,8 @@ bss_cnt indicates the number of bss that has been reported. struct surveydone_event { unsigned int bss_cnt; u8 activate_ch_cnt; + u8 reason; + bool complete; /* scan done w/o aborting */ bool acs; /* aim to trigger channel selection */ }; diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_fsm.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_fsm.h index 47d46245..f1b4fd91 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_fsm.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_fsm.h @@ -19,6 +19,7 @@ #include "rtw_fsm_rrm.h" /* rrm_priv */ #include "rtw_fsm_wnm.h" /* btm_priv */ +#ifdef CONFIG_RTW_FSM u8 fsm_post_event_hdl(_adapter *padapter, u8 *pbuf); /* #define RTW_DEBUG_FSM */ @@ -335,4 +336,5 @@ _adapter *fsm_to_adapter(struct fsm_main *fsm); #undef FSM_EV_MSG #define FSM_EV_MSG(fsm, level, fmt, ...) #endif /* CONFIG_PHL_WPP */ +#endif /* CONFIG_RTW_FSM */ #endif /* __PHL_FSM_H__ */ diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_fsm_rrm.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_fsm_rrm.h index e923fd84..ea6430f5 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_fsm_rrm.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_fsm_rrm.h @@ -15,6 +15,36 @@ #ifndef __RTW_FSM_RRM_H__ #define __RTW_FSM_RRM_H__ +/* for external reference */ +/*IEEE Std 80211k Figure 7-95b Neighbor Report element format*/ +struct nb_rpt_hdr { + u8 id; /*0x34: Neighbor Report Element ID*/ + u8 len; + u8 bssid[ETH_ALEN]; + u32 bss_info; + u8 reg_class; + u8 ch_num; + u8 phy_type; +}; + +struct rrm_nb_list { + struct nb_rpt_hdr ent; + + /* -1 : exclude, 0:wo/preference, + * 1-255 : preference, 255 indicates the most preferred BSS + */ + int preference; +}; + +struct rrm_nb_rpt { + struct rrm_nb_list nb_list[RTW_MAX_NB_RPT_NUM]; + struct rtw_ieee80211_channel ch_list[RTW_CHANNEL_SCAN_AMOUNT]; + u8 nb_list_num; + u8 ch_list_num; + + systime last_update; +}; + #ifdef CONFIG_RTW_FSM_RRM u8 rm_post_event_hdl(_adapter *padapter, u8 *pbuf); @@ -25,12 +55,15 @@ struct rrm_obj; struct rrm_priv { u8 enable; - _queue rm_queue; + _queue rm_queue; /* active rrm obj */ u8 rm_en_cap_def[5]; u8 rm_en_cap_assoc[5]; u8 meas_token; + /* NB report */ + struct rrm_nb_rpt nb_rpt; + struct fsm_main *fsm; /* rm debug */ void *prm_sel; @@ -45,6 +78,9 @@ unsigned int rrm_on_action(_adapter *a, union recv_frame *precv_frame); void rrm_update_cap(u8 *frame_head, _adapter *pa, u32 pktlen, int offset); void RM_IE_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE); +int rtw_rrm_get_nb_rpt(_adapter *a, struct rrm_nb_rpt * nb_rpt); +u32 rrm_parse_nb_list(struct rrm_nb_rpt *pnb_rpt, u8 *ie, u32 ie_len); +void rrm_sort_nb_list(struct rrm_nb_rpt *pnb_rpt); #endif /* CONFIG_RTW_FSM_RRM */ #endif /* __RTW_FSM_RRM_H__ */ diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_fsm_wnm.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_fsm_wnm.h index cbe01dee..cf4c6b9f 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_fsm_wnm.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_fsm_wnm.h @@ -18,19 +18,23 @@ #ifdef CONFIG_RTW_FSM_BTM struct fsm_priv; struct btm_obj; +struct roam_nb_info; /* Header file for application to invoke btm service */ struct btm_priv { struct fsm_main *fsm; struct btm_obj *btm; + + u8 id_seq; }; int rtw_btm_reg_fsm(struct fsm_priv *fsmpriv); int rtw_btm_new_obj(_adapter *a, struct sta_info *psta, - struct roam_nb_info *pnb, u8 roam_reason); + struct roam_nb_info *pnb, u16 roam_reason); void rtw_btm_notify_action_resp(struct btm_obj *pbtm); void rtw_btm_notify_scan_done(void *obj); void rtw_btm_notify_scan_found_candidate(struct btm_obj *pbtm, struct wlan_network *pnetwork); +void rtw_btm_notify_scan_probe_req(struct btm_obj *pbtm, struct phl_scan_channel *scan_ch); #endif /* CONFIG_RTW_FSM_BTM */ #endif /* __RTW_BTM_FSM_H__ */ diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_ft.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_ft.h index b8e31d7b..80402d16 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_ft.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_ft.h @@ -125,7 +125,6 @@ struct ft_roam_info { u8 ft_flags; u32 ft_status; u32 ft_req_retry_cnt; - bool ft_updated_bcn; }; struct rtw_sta_ft_info_t { @@ -156,8 +155,6 @@ void rtw_ft_validate_akm_type(_adapter *padapter, void rtw_ft_update_bcn(_adapter *padapter, union recv_frame *precv_frame); -void rtw_ft_start_clnt_join(_adapter *padapter); - u8 rtw_ft_update_rsnie( _adapter *padapter, u8 bwrite, struct pkt_attrib *pattrib, u8 **pframe); diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_he.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_he.h index eb1d9617..ddc3f591 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_he.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_he.h @@ -719,9 +719,9 @@ SET_BITS_TO_LE_1BYTE((_pEleStart), 0, 8, _val) #define SET_HE_OP_INFO_CHAN_WIDTH(_pEleStart, _val) \ SET_BITS_TO_LE_1BYTE((_pEleStart) + 1, 0, 2, _val) -#define SET_HE_OP_INFO_DUPL_BCN(_pEleStart) \ +#define SET_HE_OP_INFO_DUPL_BCN(_pEleStart, _val) \ SET_BITS_TO_LE_1BYTE((_pEleStart) + 1, 2, 1, _val) -#define SET_HE_OP_INFO_REGULATORY_INFO(_pEleStart) \ +#define SET_HE_OP_INFO_REGULATORY_INFO(_pEleStart, _val) \ SET_BITS_TO_LE_1BYTE((_pEleStart) + 1, 3, 3, _val) #define SET_HE_OP_INFO_CENTER_FREQ_0(_pEleStart, _val) \ @@ -1088,7 +1088,8 @@ void HE_mu_edca_handler(_adapter *padapter, struct _ADAPTER_LINK *padapter_link, void HE_6g_bandcap_handler(_adapter *padapter, struct _ADAPTER_LINK *padapter_link, PNDIS_802_11_VARIABLE_IEs pIE); u32 rtw_build_he_cap_ie(_adapter *padapter, struct _ADAPTER_LINK *padapter_link, u8 *pbuf, enum band_type band); -u32 rtw_build_he_operation_ie(_adapter *padapter, struct _ADAPTER_LINK *padapter_link, u8 *pbuf, struct rtw_chan_def *chandef); +u32 rtw_build_he_operation_ie(_adapter *padapter, struct _ADAPTER_LINK *padapter_link, + u8 *pbuf, struct rtw_chan_def *chandef, u8 regu); struct protocol_cap_t; struct phy_cap_t; diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_ioctl_set.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_ioctl_set.h index 71e10ae7..d599f301 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_ioctl_set.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_ioctl_set.h @@ -28,7 +28,6 @@ u8 rtw_validate_bssid(const u8 *bssid); u8 rtw_validate_ssid(NDIS_802_11_SSID *ssid); u16 rtw_get_cur_max_rate(_adapter *adapter); -int rtw_set_scan_mode(_adapter *adapter, enum rtw_phl_scan_type scan_mode); int rtw_set_channel_plan(_adapter *adapter, u8 channel_plan, u8 chplan_6g , enum rtw_env_t env, enum rtw_regd_inr inr); int rtw_set_country(_adapter *adapter, const char *country_code diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_mlme.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_mlme.h index d62816be..1ef669c5 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_mlme.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_mlme.h @@ -236,6 +236,7 @@ enum mlme_auth_type { #define WIFI_FREQUENCY_BAND_2GHZ 2 #define rtw_band_valid(band) ((band) <= WIFI_FREQUENCY_BAND_2GHZ) +#define rtw_band_str(band) (band==BAND_ON_6G)?"6G":(band==BAND_ON_5G)?"5G":(band==BAND_ON_24G)?"2G":"unknown" enum SCAN_RESULT_TYPE { SCAN_RESULT_P2P_ONLY = 0, /* Will return all the P2P devices. */ @@ -450,7 +451,11 @@ enum { RTW_ROAM_ON_EXPIRED = BIT0, RTW_ROAM_ON_RESUME = BIT1, RTW_ROAM_ACTIVE = BIT2, - RTW_ROAM_BTM = BIT3, + RTW_ROAM_QUICK_SCAN = BIT3, + RTW_ROAM_ACTIVE_INTERVAL_EXT = BIT4, + RTW_ROAM_BTM_IGNORE_DELTA = BIT5, + RTW_ROAM_ACTIVE_IGNORE_CHK = BIT6, + RTW_ROAM_BTM = BIT7 }; #define UNASOC_STA_SRC_RX_BMC 0 @@ -606,16 +611,28 @@ struct mlme_priv { u8 to_join; /* flag */ u16 join_status; #ifdef CONFIG_LAYER2_ROAMING + u8 roam_scan_order[4]; u8 to_roam; /* roaming trying times */ struct wlan_network *roam_network; /* the target of active roam */ - u8 roam_flags; - u8 roam_rssi_diff_th; /* rssi difference threshold for active scan candidate selection */ + u16 roam_flags; +#ifdef PRIVATE_N + u8 roam_idle_rssi_delta; /* idle rssi delta for active scan candidate selection */ + u8 roam_busy_rssi_delta; /* busy rssi delta for active scan candidate selection */ + u8 roam_idle_rssi_th; + u8 roam_busy_rssi_th; +#else + u8 roam_rssi_delta; /* rssi delta for active scan candidate selection */ + u8 roam_rssi_th; +#endif u32 roam_scan_int; /* scan interval for active roam (Unit:2 second)*/ u32 roam_scanr_exp_ms; /* scan result expire time in ms for roam */ u8 roam_tgt_addr[ETH_ALEN]; /* request to roam to speicific target without other consideration */ - u8 roam_rssi_threshold; + u8 roam_from_addr[ETH_ALEN]; + u8 roam_scan_count; + u8 roam_freeze_rssi; systime last_roaming; bool need_to_roam; + bool roam_buf_pkt; #endif u32 defs_lmt_sta; @@ -656,8 +673,6 @@ struct mlme_priv { /* uint wireless_mode; no used, remove it */ - u32 auto_scan_int_ms; - _timer assoc_timer; uint assoc_by_bssid; @@ -702,7 +717,6 @@ struct mlme_priv { RT_LINK_DETECT_T LinkDetectInfo; u8 acm_mask; /* for wmm acm mask */ - enum rtw_phl_scan_type scan_mode; /* active: 1, passive: 0 */ u8 *wps_probe_req_ie; u32 wps_probe_req_ie_len; @@ -826,11 +840,6 @@ struct mlme_priv { #endif }; -#define rtw_mlme_set_auto_scan_int(adapter, ms) \ - do { \ - adapter->mlmepriv.auto_scan_int_ms = ms; \ - } while (0) - #define set_assoc_timer(mlme, ms) \ do { \ /*RTW_INFO("%s set_assoc_timer(%p, %d)\n", __FUNCTION__, (mlme), (ms));*/ \ @@ -850,7 +859,10 @@ struct mlme_priv { #define RTW_AUTO_SCAN_REASON_MESH_OFFCH_CAND BIT4 #define RTW_AUTO_SCAN_REASON_CIS_ENV_BSS BIT5 -void rtw_mlme_reset_auto_scan_int(_adapter *adapter, u8 *reason); +/* special auto scan interval values */ +#define RTW_ASCAN_INT_NONE 0 /* don't do auto scan */ +#define RTW_ASCAN_INT_URGENT 1 /* will ignore busy status */ +#define RTW_ASCAN_INT_ASAP 2 /* will blocked by busy status */ #ifdef CONFIG_AP_MODE @@ -902,6 +914,17 @@ __inline static u8 *get_link_bssid(struct link_mlme_priv *pmlmepriv) return pmlmepriv->cur_network.network.MacAddress; } +__inline static u8 *get_mbssid(struct mlme_priv *pmlmepriv) +{ + +#ifdef CONFIG_STA_MULTIPLE_BSSID + if (pmlmepriv->dev_cur_network.network.is_mbssid) + return pmlmepriv->dev_cur_network.network.mbsMacAddress; + else +#endif + return pmlmepriv->dev_cur_network.network.MacAddress; +} + __inline static u8 *get_bssid(struct mlme_priv *pmlmepriv) { /* if sta_mode:pmlmepriv->cur_network.network.MacAddress=> bssid */ @@ -1011,6 +1034,7 @@ u32 rtw_join_abort_timeout(_adapter *adapter, u32 timeout_ms); int rtw_cached_pmkid(_adapter *adapter, u8 *bssid); int rtw_pmkid_sync_rsn(_adapter *adapter, u8 *ie, uint ie_len, int i_ent); +void rtw_set_pmksa(_adapter *padapter, u8 *bssid, u8 *pmkid); extern int rtw_restruct_sec_ie(_adapter *adapter, u8 *out_ie); extern int rtw_restruct_wmm_ie(_adapter *adapter, struct _ADAPTER_LINK *adapter_link, @@ -1135,6 +1159,7 @@ void rtw_set_to_roam(_adapter *adapter, u8 to_roam); u8 rtw_dec_to_roam(_adapter *adapter); u8 rtw_to_roam(_adapter *adapter); struct wlan_network *rtw_select_roaming_candidate(struct mlme_priv *pmlmepriv); +void rtw_wnm_candidate_info(struct wlan_network *pnetwork, struct wlan_network *cnetwork, u8 *reason); int rtw_check_roaming_candidate(struct mlme_priv *mlme, struct wlan_network **candidate, struct wlan_network *competitor); #else diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_mlme_ext.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_mlme_ext.h index 9a6d1d55..0d6ae4da 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_mlme_ext.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_mlme_ext.h @@ -24,9 +24,16 @@ #define SURVEY_TO (100) #endif /*SURVEY_TO*/ #define ACTIVE_CH_SURVEY_TO (50) +#define ROAM_A_CH_SURVEY_TO (20) +#define ROAM_P_CH_SURVEY_TO (120) +#ifdef PRIVATE_N #define REAUTH_TO (300) /* (50) */ #define REASSOC_TO (300) /* (50) */ +#else +#define REAUTH_TO (240) +#define REASSOC_TO (240) +#endif /* #define DISCONNECT_TO (3000) */ #define ADDBA_TO (2000) @@ -553,7 +560,6 @@ unsigned int decide_wait_for_beacon_timeout(unsigned int bcn_interval); #if CONFIG_IEEE80211_BAND_6GHZ BOOLEAN Is6GHzPreferScanChannel(u8 channel); #endif -BOOLEAN IsLegal5GChannel(_adapter *adapter, u8 channel); u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSID_EX *bssid); void rtw_update_adapter_network(WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src, _adapter *padapter, bool update_ie); @@ -681,7 +687,7 @@ bool rtw_tim_map_anyone_be_set_exclude_aid0(_adapter *padapter, const u8 *map); u32 report_join_res(_adapter *padapter, int aid_res, u16 status); void report_survey_event(_adapter *padapter, union recv_frame *precv_frame); -void report_surveydone_event(_adapter *padapter, bool acs, u8 flags); +void report_surveydone_event(_adapter *padapter, u8 reason, bool complete, bool acs, u8 flags); u32 report_del_sta_event(_adapter *padapter, unsigned char *MacAddr, unsigned short reason, bool enqueue, u8 locally_generated); void report_add_sta_event(_adapter *padapter, unsigned char *MacAddr); void report_wmm_edca_update(_adapter *padapter); diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_mp.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_mp.h index 24583982..3e02b478 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_mp.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_mp.h @@ -1059,7 +1059,9 @@ struct rtw_mp_config_arg { u8 ant_sw; u8 hci_speed; struct rtw_gpio_config_arg gpio_cfg; +#ifdef CONFIG_POWER_SAVE struct rtw_pwr_config_arg pwr_cfg; +#endif }; struct rtw_mp_tx_arg { @@ -1433,6 +1435,7 @@ int rtw_mp_txpoweridx(_adapter *adapter); u16 rtw_mp_txpower_dbm(_adapter *adapter, u8 rf_path); u16 rtw_mp_get_pwrtab_dbm(_adapter *adapter, u8 rfpath); +u8 rtw_mp_rfpath2txnss(_adapter *padapter, enum rf_path path); void SetAntenna(_adapter *adapter); void SetDataRate(_adapter *adapter); s32 SetThermalMeter(_adapter *adapter, u8 target_ther); diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_recv.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_recv.h index d7baa4a2..b201f6c4 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_recv.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_recv.h @@ -100,6 +100,13 @@ struct signal_stat { u8 avg_val; /* avg of valid elements */ u32 total_num; /* num of valid elements */ u32 total_val; /* sum of valid elements */ + +#ifdef DBG_SERVING_AP_RSSI +#define RAW_LEN 64 + u8 signal_raw_idx; + u8 signal_raw[RAW_LEN]; + u8 signal_avg[RAW_LEN]; +#endif }; /*TODO get phyinfo from PHL PPDU status - RTW_WKARD_CORE_RSSI_V1*/ @@ -308,7 +315,6 @@ struct recv_info { u8 signal_qual; s8 rssi; /* rtw_phl_rssi_to_dbm(ptarget_wlan->network.PhyInfo.SignalStrength); */ - #ifdef CONFIG_SIGNAL_STAT_PROCESS _timer signal_stat_timer; u32 signal_stat_sampling_interval; @@ -318,6 +324,11 @@ struct recv_info { struct signal_stat signal_qual_data; struct signal_stat signal_strength_data; + u8 bcn_signal_strength; + u8 bcn_signal_qual; + s8 bcn_rssi; + struct signal_stat signal_qual_bcn; + struct signal_stat signal_strength_bcn; u16 sink_udpport, pre_rtp_rxseq, cur_rtp_rxseq; @@ -657,3 +668,6 @@ void count_rx_stats(_adapter *padapter, union recv_frame *prframe, struct sta_in u8 rtw_init_lite_recv_resource(struct dvobj_priv *dvobj); void rtw_free_lite_recv_resource(struct dvobj_priv *dvobj); #endif +#ifdef CONFIG_SIGNAL_STAT_PROCESS +void rtw_signal_state_reset(_adapter *adapter); +#endif diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_scan.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_scan.h index c93e799c..b9a1334b 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_scan.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_scan.h @@ -16,12 +16,16 @@ #define __RTW_SCAN_H_ /*rtw_mlme.h*/ -void rtw_drv_scan_by_self(_adapter *padapter, u8 reason); +void rtw_drv_scan_by_self(_adapter *padapter, u8 reason, bool urgent); void rtw_scan_abort_no_wait(_adapter *adapter); u32 rtw_scan_abort(_adapter *adapter, u32 timeout_ms); void rtw_survey_event_callback(_adapter *adapter, u8 *pbuf); void rtw_surveydone_event_callback(_adapter *adapter, u8 *pbuf); +int rtw_scan_ch_decision(_adapter *padapter, struct rtw_ieee80211_channel *out, + u32 out_num, struct rtw_ieee80211_channel *in, u32 in_num, bool no_sparse); +int rtw_scan_ch_dec(_adapter *padapter, struct rtw_ieee80211_channel *out, + u32 out_num, struct rtw_ieee80211_channel *in, u32 in_num, bool include_dis, bool no_sparse); enum { SS_DENY_MP_MODE, @@ -239,6 +243,8 @@ struct ss_res { u8 bw; /* 0: use default */ bool acs; /* aim to trigger channel selection when scan done */ + + bool scan_2040bss; /* 1: use default */ }; enum rtw_scan_type { @@ -251,6 +257,7 @@ enum rtw_scan_type { #define RTW_MAX_NB_RPT_NUM 8 #if defined(CONFIG_RTW_FSM_RRM) || defined(CONFIG_RTW_FSM_BTM) struct nb_bssid{ + u8 band; u8 ch; u8 bssid[ETH_ALEN]; }; @@ -269,6 +276,7 @@ struct sitesurvey_parm { u8 bw; /* 0: use default */ bool acs; /* aim to trigger channel selection when scan done */ + u8 reason; enum rtw_scan_type scan_type; #ifdef CONFIG_RTW_FSM @@ -288,7 +296,8 @@ struct sitesurvey_parm { #endif }; -void rtw_init_sitesurvey_parm(_adapter *padapter, struct sitesurvey_parm *pparm); +void rtw_init_sitesurvey_parm(struct sitesurvey_parm *pparm); +void rtw_auto_scan_ch_list_init(struct sitesurvey_parm *parm, u8 band_bmp, u8 flags); u8 rtw_sitesurvey_cmd(_adapter *padapter, struct sitesurvey_parm *pparm); #ifndef CONFIG_CMD_SCAN u32 rtw_site_survey_fsm(_adapter *padapter, struct cmd_obj *pcmd); diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_security.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_security.h index 543fa8b0..b1ad2821 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_security.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_security.h @@ -134,9 +134,7 @@ typedef struct _RT_PMKID_LIST { u8 bUsed; u8 Bssid[6]; u8 PMKID[16]; - u8 SsidBuf[33]; - u8 *ssid_octet; - u16 ssid_length; + systime last_use; } RT_PMKID_LIST, *PRT_PMKID_LIST; struct link_security_priv { diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_version.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_version.h index 8ee40e3c..2df9d7cf 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_version.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_version.h @@ -1 +1 @@ -#define DRIVERVERSION "v1.19.16.1-0-g1fe335ba1.20240815_PC" +#define DRIVERVERSION "v1.19.16_nv-126-g455ab52c9.20241107_Certified_Module" diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_wnm.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_wnm.h index 6f3d9727..bef1fa5f 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_wnm.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_wnm.h @@ -22,7 +22,7 @@ #define rtw_roam_busy_scan(a, nb) \ (((a)->mlmepriv.LinkDetectInfo.bBusyTraffic == _TRUE) && \ - (((a)->mlmepriv.ch_cnt) < ((nb)->nb_rpt_ch_list_num))) + (((a)->mlmepriv.ch_cnt) < ((nb)->nb_rpt.ch_list_num))) #define rtw_wnm_btm_preference_cap(b) \ (b->preference_en == _TRUE) @@ -66,6 +66,16 @@ #define RTW_WLAN_ACTION_WNM_NB_RPT_ELEM 0x34 +#ifdef PRIVATE_N +#define wnm_roam_rssi_th(m) \ + m->LinkDetectInfo.bBusyTraffic?m->roam_busy_rssi_th:m->roam_idle_rssi_th +#define wnm_roam_rssi_delta(m) \ + m->LinkDetectInfo.bBusyTraffic?m->roam_busy_rssi_delta:m->roam_idle_rssi_delta +#else +#define wnm_roam_rssi_th(m) m->roam_rssi_th +#define wnm_roam_rssi_delta(m) m->roam_rssi_delta +#endif + enum rtw_ieee80211_wnm_actioncode { RTW_WLAN_ACTION_WNM_BTM_QUERY = 6, RTW_WLAN_ACTION_WNM_BTM_REQ = 7, @@ -74,17 +84,6 @@ enum rtw_ieee80211_wnm_actioncode { RTW_WLAN_ACTION_WNM_NOTIF_RSP = 27, }; -/*IEEE Std 80211k Figure 7-95b Neighbor Report element format*/ -struct nb_rpt_hdr { - u8 id; /*0x34: Neighbor Report Element ID*/ - u8 len; - u8 bssid[ETH_ALEN]; - u32 bss_info; - u8 reg_class; - u8 ch_num; - u8 phy_type; -}; - /*IEEE Std 80211v, Figure 7-9 BSS Termination Duration subelement field format */ struct btm_term_duration { u8 id; @@ -150,14 +149,12 @@ enum rtw_btm_req_mod { }; struct roam_nb_info { - struct nb_rpt_hdr nb_rpt[RTW_MAX_NB_RPT_NUM]; - struct rtw_ieee80211_channel nb_rpt_ch_list[RTW_MAX_NB_RPT_NUM]; + struct rrm_nb_rpt nb_rpt; + struct btm_rpt_cache btm_cache; bool nb_rpt_valid; - u8 nb_rpt_ch_list_num; u8 preference_en; u8 roam_target_addr[ETH_ALEN]; - u32 last_nb_rpt_entries; u8 nb_rpt_is_same; s8 disassoc_waiting; _timer roam_scan_timer; @@ -166,8 +163,6 @@ struct roam_nb_info { u32 features; }; -void rtw_wnm_candidate_info(struct wlan_network *pnetwork, struct wlan_network *cnetwork, u8 *reason); - u8 rtw_wnm_btm_reassoc_req(_adapter *padapter); void rtw_wnm_roam_scan_hdl(void *ctx); @@ -219,6 +214,8 @@ struct wlan_network *rtw_wnm_btm_candidate_select( struct wlan_network * rtw_wnm_btm_candidate_check(_adapter *padapter, struct roam_nb_info *pnb, struct wlan_network *pnetwork); +void rtw_wnm_start_clnt_join(_adapter *padapter, struct _ADAPTER_LINK *al); + //u8 rtw_wmn_btm_rsp_reason_decision(_adapter *padapter, u8* req_mode); u8 rtw_wmn_btm_rsp_reason_decision(_adapter *padapter, struct roam_nb_info *pnb); #endif /* __RTW_WNM_H_ */ diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_xmit.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_xmit.h index 5443a1b2..477d223c 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_xmit.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_xmit.h @@ -977,7 +977,9 @@ struct xmit_priv { _timer tx_poll_timer; #endif #ifdef CONFIG_LAYER2_ROAMING +#ifndef CONFIG_RTW_ROAM_STOP_NETIF_QUEUE _queue rpkt_queue; +#endif #endif _lock lock_sctx; #ifdef CONFIG_CORE_TXSC @@ -1002,6 +1004,8 @@ struct xmit_priv { u64 cnt_txsc_amsdu_timeout_fail[4]; #endif /* CONFIG_TXSC_AMSDU */ #endif /* CONFIG_CORE_TXSC */ + + u16 max_agg_time; }; #if 0 /*CONFIG_CORE_XMITBUF*/ @@ -1190,7 +1194,7 @@ void rtw_set_xmit_block(_adapter *padapter, enum XMIT_BLOCK_REASON reason); void rtw_clr_xmit_block(_adapter *padapter, enum XMIT_BLOCK_REASON reason); bool rtw_is_xmit_blocked(_adapter *padapter); #ifdef CONFIG_LAYER2_ROAMING -void dequeuq_roam_pkt(_adapter *padapter); +void dequeuq_roam_pkt(_adapter *padapter, bool drop); #endif /* include after declaring struct xmit_buf, in order to avoid warning */ #include diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_xmit_shortcut.h b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_xmit_shortcut.h index 31234fe7..ba27ffe4 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/rtw_xmit_shortcut.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/rtw_xmit_shortcut.h @@ -18,11 +18,11 @@ #ifdef CONFIG_CORE_TXSC //#define USE_ONE_WLHDR /* do not use one hdr when use sw amsdu in txsc */ /* TBD, open this when hw_hde_conv ready */ - +/* #ifndef USE_ONE_WLHDR #define USE_PREV_WLHDR_BUF #endif - +*/ #define CORE_TXSC_ENTRY_NUM 8 #define CORE_TXSC_WLHDR_SIZE (WLHDR_SIZE + SNAP_SIZE + 2 + _AES_IV_LEN_) #define CORE_TXSC_DEBUG_BUF_SIZE (sizeof(struct rtw_xmit_req) + sizeof(struct rtw_pkt_buf_list)*2) @@ -83,6 +83,12 @@ struct txsc_pkt_entry { bool amsdu; bool is_amsdu_timeout; #endif +#ifdef TXSC_DBG_COPY_ORI_WLHDR_MDATA + bool is_spec_pkt; + struct rtw_t_meta_data mdata_ori; + u8 wlhdr_ori[CORE_TXSC_WLHDR_SIZE]; + u8 wlhdr_ori_len; +#endif }; struct txsc_entry { diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/wlan_bssdef.h b/drivers/net/wireless/realtek/rtl8852ce/include/wlan_bssdef.h index a214a0ce..6564008b 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/wlan_bssdef.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/wlan_bssdef.h @@ -248,6 +248,7 @@ typedef struct _WLAN_BSSID_EX { #ifdef CONFIG_STA_MULTIPLE_BSSID u8 is_mbssid; u8 mbssid_index; + NDIS_802_11_MAC_ADDRESS mbsMacAddress; #endif u32 IELength; u8 IEs[MAX_IE_SZ]; /* (timestamp, beacon interval, and capability information) */ @@ -321,7 +322,7 @@ enum UAPSD_MAX_SP { /* john */ -#define NUM_PRE_AUTH_KEY 16 +#define NUM_PRE_AUTH_KEY 64 #define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY #endif /* #ifndef WLAN_BSSDEF_H_ */ diff --git a/drivers/net/wireless/realtek/rtl8852ce/include/xmit_osdep.h b/drivers/net/wireless/realtek/rtl8852ce/include/xmit_osdep.h index 1a5b3917..36a71cba 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/include/xmit_osdep.h +++ b/drivers/net/wireless/realtek/rtl8852ce/include/xmit_osdep.h @@ -92,6 +92,9 @@ extern sint rtw_endofpktfile(struct pkt_file *pfile); extern void rtw_os_pkt_complete(_adapter *padapter, struct sk_buff *pkt); extern void rtw_os_xmit_complete(_adapter *padapter, struct xmit_frame *pxframe); +void rtw_roam_stop_queue(_adapter *padapter); +void rtw_roam_wake_queue(_adapter *padapter); + void rtw_os_check_wakup_queue(_adapter *padapter, u16 os_qid); bool rtw_os_check_stop_queue(_adapter *padapter, u16 os_qid); void rtw_os_wake_queue_at_free_stainfo(_adapter *padapter, int *qcnt_freed); diff --git a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_cfg80211.c b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_cfg80211.c index 817d7706..dd03b12d 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_cfg80211.c +++ b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_cfg80211.c @@ -141,6 +141,13 @@ static const struct wiphy_wowlan_support wowlan_stub = { }; #endif +static void rtw_cfg80211_set_wakeup(struct wiphy *wiphy, bool enabled) +{ + struct device *dev = wiphy_to_dev(wiphy); + RTW_INFO("%s: trigger_set_wakeup = %d\n", __func__, enabled); + device_set_wakeup_enable(dev, enabled); +} + static const struct ieee80211_rate rtw_rates[] = { RATETAB_ENT(10, 0x1, 0), RATETAB_ENT(20, 0x2, 0), @@ -3094,8 +3101,31 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(_adapter *padapter, char *buf, in } +static u8 rtw_cfg80211_scan_via_auto_scan(_adapter *adapter, struct cfg80211_scan_request *request) +{ + struct rtw_wdev_priv *wdev_priv; + u8 ret = _FALSE; + + if (rtw_is_adapter_up(adapter) == _FALSE) + goto exit; + + if (!MLME_IS_SCAN(adapter)) + goto exit; + + wdev_priv = adapter_wdev_data(adapter); + _rtw_spinlock_bh(&wdev_priv->scan_req_lock); + if (!wdev_priv->scan_request) { /* auto scan */ + wdev_priv->scan_request = request; + ret = _TRUE; + } + _rtw_spinunlock_bh(&wdev_priv->scan_req_lock); + +exit: + return ret; +} + #ifdef CONFIG_CONCURRENT_MODE -u8 rtw_cfg80211_scan_via_buddy(_adapter *padapter, struct cfg80211_scan_request *request) +static u8 rtw_cfg80211_scan_via_buddy(_adapter *padapter, struct cfg80211_scan_request *request) { int i; u8 ret = _FALSE; @@ -3212,7 +3242,7 @@ int rtw_cfg80211_split_scan_6ghz(_adapter *padapter) /* second scan of two part return -ENOMEM; } - rtw_init_sitesurvey_parm(padapter, parm); + rtw_init_sitesurvey_parm(parm); parm->scan_6ghz_only = true; parm->split_scan_6ghz = true; @@ -3378,7 +3408,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy goto exit; } - rtw_init_sitesurvey_parm(padapter, parm); + rtw_init_sitesurvey_parm(parm); #ifdef CONFIG_RTW_SCAN_RAND #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) @@ -3451,8 +3481,6 @@ bypass_p2p_chk: case SS_DENY_BLOCK_SCAN : case SS_DENY_SELF_AP_UNDER_WPS : case SS_DENY_SELF_AP_UNDER_LINKING : - case SS_DENY_SELF_AP_UNDER_SURVEY : - case SS_DENY_SELF_STA_UNDER_SURVEY : #ifdef CONFIG_CONCURRENT_MODE case SS_DENY_BUDDY_UNDER_LINK_WPS : #endif @@ -3475,16 +3503,17 @@ bypass_p2p_chk: ret = -EBUSY; goto check_need_indicate_scan_done; + case SS_DENY_SELF_AP_UNDER_SURVEY: + case SS_DENY_SELF_STA_UNDER_SURVEY: + if (rtw_cfg80211_scan_via_auto_scan(padapter, request) == _FALSE) + need_indicate_scan_done = _TRUE; + goto check_need_indicate_scan_done; + #ifdef CONFIG_CONCURRENT_MODE - case SS_DENY_BUDDY_UNDER_SURVEY : - { - bool scan_via_buddy = rtw_cfg80211_scan_via_buddy(padapter, request); - - if (scan_via_buddy == _FALSE) - need_indicate_scan_done = _TRUE; - - goto check_need_indicate_scan_done; - } + case SS_DENY_BUDDY_UNDER_SURVEY: + if (rtw_cfg80211_scan_via_buddy(padapter, request) == _FALSE) + need_indicate_scan_done = _TRUE; + goto check_need_indicate_scan_done; #endif default : @@ -4729,41 +4758,6 @@ static int cfg80211_rtw_set_power_mgmt(struct wiphy *wiphy, return 0; } -static void _rtw_set_pmksa(struct net_device *ndev, - u8 *bssid, u8 *pmkid) -{ - _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); - struct security_priv *psecuritypriv = &padapter->securitypriv; - u8 index, blInserted = _FALSE; - - /* overwrite PMKID */ - for (index = 0 ; index < NUM_PMKID_CACHE; index++) { - if (_rtw_memcmp(psecuritypriv->PMKIDList[index].Bssid, bssid, ETH_ALEN) == _TRUE) { - /* BSSID is matched, the same AP => rewrite with new PMKID. */ - RTW_INFO("BSSID("MAC_FMT") exists in the PMKList.\n", MAC_ARG(bssid)); - - _rtw_memcpy(psecuritypriv->PMKIDList[index].PMKID, pmkid, WLAN_PMKID_LEN); - psecuritypriv->PMKIDList[index].bUsed = _TRUE; - blInserted = _TRUE; - break; - } - } - - if (!blInserted) { - /* Find a new entry */ - RTW_INFO("Use the new entry index = %d for this PMKID.\n", - psecuritypriv->PMKIDIndex); - - _rtw_memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].Bssid, bssid, ETH_ALEN); - _rtw_memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].PMKID, pmkid, WLAN_PMKID_LEN); - - psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].bUsed = _TRUE; - psecuritypriv->PMKIDIndex++ ; - if (psecuritypriv->PMKIDIndex == 16) - psecuritypriv->PMKIDIndex = 0; - } -} - static int cfg80211_rtw_set_pmksa(struct wiphy *wiphy, struct net_device *ndev, struct cfg80211_pmksa *pmksa) @@ -4775,13 +4769,13 @@ static int cfg80211_rtw_set_pmksa(struct wiphy *wiphy, u8 strZeroMacAddress[ETH_ALEN] = { 0x00 }; bool sae_auth = rtw_sec_chk_auth_type(padapter, MLME_AUTHTYPE_SAE); - RTW_INFO(FUNC_NDEV_FMT" "MAC_FMT" "KEY_FMT"\n", FUNC_NDEV_ARG(ndev) + RTW_INFO(FUNC_NDEV_FMT" "MAC_FMT" "KEY_FMT" pmkid\n", FUNC_NDEV_ARG(ndev) , MAC_ARG(pmksa->bssid), KEY_ARG(pmksa->pmkid)); if (_rtw_memcmp((u8 *)pmksa->bssid, strZeroMacAddress, ETH_ALEN) == _TRUE) return -EINVAL; - _rtw_set_pmksa(ndev, (u8 *)pmksa->bssid, (u8 *)pmksa->pmkid); + rtw_set_pmksa(padapter, (u8 *)pmksa->bssid, (u8 *)pmksa->pmkid); if (sae_auth && (psecuritypriv->extauth_status == WLAN_STATUS_SUCCESS)) { @@ -4800,7 +4794,7 @@ static int cfg80211_rtw_del_pmksa(struct wiphy *wiphy, _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); struct security_priv *psecuritypriv = &padapter->securitypriv; - RTW_INFO(FUNC_NDEV_FMT" "MAC_FMT" "KEY_FMT"\n", FUNC_NDEV_ARG(ndev) + RTW_INFO(FUNC_NDEV_FMT" "MAC_FMT" "KEY_FMT" pmkid\n", FUNC_NDEV_ARG(ndev) , MAC_ARG(pmksa->bssid), KEY_ARG(pmksa->pmkid)); for (index = 0 ; index < NUM_PMKID_CACHE; index++) { @@ -8946,7 +8940,7 @@ u8 *rtw_cfg80211_construct_mesh_beacon_ies(struct wiphy *wiphy, _adapter *adapte goto exit; #if defined(CONFIG_80211AC_VHT) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) - vht = ht && rtw_chdef->chan > 14 && rtw_chdef->bw >= CHANNEL_WIDTH_80; /* VHT40/VHT20? */ + vht = ht && rtw_chdef->band != BAND_ON_24G && rtw_chdef->bw >= CHANNEL_WIDTH_80; /* VHT40/VHT20? */ #endif RTW_INFO(FUNC_ADPT_FMT" => ch:%u,%u,%u, ht:%u, vht:%u\n" @@ -9680,7 +9674,7 @@ int cfg80211_rtw_resume(struct wiphy *wiphy) { rtw_cfg80211_disconnected(padapter->rtw_wdev, 0, NULL, 0, 1, GFP_ATOMIC); - rtw_init_sitesurvey_parm(padapter, &parm); + rtw_init_sitesurvey_parm(&parm); for (i=0;inum_of_networks && i < RTW_SSID_SCAN_AMOUNT; i++) { len = wow_nlo->ssidlen[i]; _rtw_memcpy(&parm.ssid[i].Ssid, wow_nlo->ssid[i], len); @@ -10963,7 +10957,7 @@ void rtw_cfg80211_external_auth_status(struct wiphy *wiphy, struct net_device *d /* ToDo: Kernel v5.1 pmkid is pointer */ /* RTW_INFO_DUMP("PMKID:", params->pmkid, PMKID_LEN); */ - _rtw_set_pmksa(dev, params->bssid, params->pmkid); + rtw_set_pmksa(padapter, params->bssid, params->pmkid); _rtw_spinlock_bh(&psta->lock); if ((psta->auth_len != 0) && (psta->pauth_frame != NULL)) { @@ -11253,6 +11247,9 @@ struct cfg80211_ops rtw_cfg80211_ops = { .channel_switch = cfg80211_rtw_channel_switch, #endif #endif /* #ifdef CONFIG_AP_MODE */ +#ifdef CONFIG_WOWLAN + .set_wakeup = rtw_cfg80211_set_wakeup, +#endif /* CONFIG_WOWLAN */ }; struct wiphy *rtw_wiphy_alloc(_adapter *padapter, struct device *dev) diff --git a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_cfg80211.h b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_cfg80211.h index 75e284cf..de5dab73 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_cfg80211.h +++ b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_cfg80211.h @@ -309,7 +309,7 @@ struct rtw_wiphy_data { #define rtw_wiphy_priv(wiphy) ((struct rtw_wiphy_data *)wiphy_priv(wiphy)) #define wiphy_to_dvobj(wiphy) (((struct rtw_wiphy_data *)wiphy_priv(wiphy))->dvobj) #define wiphy_to_adapter(wiphy) (dvobj_get_primary_adapter(wiphy_to_dvobj(wiphy))) - +#define wiphy_to_dev(wiphy) (dvobj_to_dev(wiphy_to_dvobj(wiphy))) #if defined(RTW_DEDICATED_P2P_DEVICE) #define wiphy_to_pd_wdev(wiphy) (rtw_wiphy_priv(wiphy)->pd_wdev) @@ -361,7 +361,6 @@ void rtw_cfg80211_indicate_scan_done(_adapter *adapter, bool aborted); u32 rtw_cfg80211_wait_scan_req_empty(_adapter *adapter, u32 timeout_ms); #ifdef CONFIG_CONCURRENT_MODE -u8 rtw_cfg80211_scan_via_buddy(_adapter *padapter, struct cfg80211_scan_request *request); void rtw_cfg80211_indicate_scan_done_for_buddy(_adapter *padapter, bool bscan_aborted); #endif diff --git a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_efuse.c b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_efuse.c index 0eb5543c..e3948004 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_efuse.c +++ b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_efuse.c @@ -344,6 +344,11 @@ u8 rtw_efuse_map_write(_adapter * adapter, u16 addr, u16 cnts, u8 *data, u8 efus efuse_arg = rtw_zmalloc(sizeof(struct rtw_efuse_phl_arg)); + if (efuse_arg == NULL) { + status = _FAIL; + goto exit; + } + if (efuse_type == RTW_EFUSE_WIFI) err = rtw_efuse_get_map_size(adapter, &size, RTW_EFUSE_CMD_WIFI_GET_LOG_SIZE); else if (efuse_type == RTW_EFUSE_BT) diff --git a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_linux.c b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_linux.c index b1b810b1..6c27fee8 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_linux.c +++ b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_linux.c @@ -1862,7 +1862,6 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, RTW_INFO("DBG_IOCTL %s:%d\n", __FUNCTION__, __LINE__); #endif -#if 1 ssc_chk = rtw_sitesurvey_condition_check(padapter, _FALSE); #ifdef CONFIG_DOSCAN_IN_BUSYTRAFFIC @@ -1891,54 +1890,6 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, ret = -1; goto exit; } -#else - -#ifdef CONFIG_MP_INCLUDED - if (rtw_mp_mode_check(padapter)) { - RTW_INFO("MP mode block Scan request\n"); - ret = -EPERM; - goto exit; - } -#endif - if (rtw_is_scan_deny(padapter)) { - indicate_wx_scan_complete_event(padapter); - goto exit; - } - - if (!rtw_is_adapter_up(padapter)) { - ret = -1; - goto exit; - } - -#ifndef CONFIG_DOSCAN_IN_BUSYTRAFFIC - /* When Busy Traffic, driver do not site survey. So driver return success. */ - /* wpa_supplicant will not issue SIOCSIWSCAN cmd again after scan timeout. */ - /* modify by thomas 2011-02-22. */ - if (rtw_mi_busy_traffic_check(padapter)) { - indicate_wx_scan_complete_event(padapter); - goto exit; - } -#endif - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) && check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) { - RTW_INFO("AP mode process WPS\n"); - indicate_wx_scan_complete_event(padapter); - goto exit; - } - - if (check_fwstate(pmlmepriv, WIFI_UNDER_SURVEY | WIFI_UNDER_LINKING) == _TRUE) { - indicate_wx_scan_complete_event(padapter); - goto exit; - } - -#ifdef CONFIG_CONCURRENT_MODE - if (rtw_mi_buddy_check_fwstate(padapter, - WIFI_UNDER_SURVEY | WIFI_UNDER_LINKING | WIFI_UNDER_WPS)) { - - indicate_wx_scan_complete_event(padapter); - goto exit; - } -#endif -#endif parm = rtw_malloc(sizeof(*parm)); if (parm == NULL) { @@ -1953,7 +1904,7 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { int len = min((int)req->essid_len, IW_ESSID_MAX_SIZE); - rtw_init_sitesurvey_parm(padapter, parm); + rtw_init_sitesurvey_parm(parm); _rtw_memcpy(&parm->ssid[0].Ssid, &req->essid, len); parm->ssid[0].SsidLength = len; parm->ssid_num = 1; @@ -1978,7 +1929,7 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, int ssid_index = 0; /* RTW_INFO("%s COMBO_SCAN header is recognized\n", __FUNCTION__); */ - rtw_init_sitesurvey_parm(padapter, parm); + rtw_init_sitesurvey_parm(parm); while (len >= 1) { section = *(pos++); @@ -5001,16 +4952,6 @@ static int rtw_wx_set_priv(struct net_device *dev, case ANDROID_WIFI_CMD_MACADDR: sprintf(ext, "MACADDR = " MAC_FMT, MAC_ARG(dev->dev_addr)); break; - case ANDROID_WIFI_CMD_SCAN_ACTIVE: { - /* rtw_set_scan_mode(padapter, SCAN_ACTIVE); */ - sprintf(ext, "OK"); - } - break; - case ANDROID_WIFI_CMD_SCAN_PASSIVE: { - /* rtw_set_scan_mode(padapter, SCAN_PASSIVE); */ - sprintf(ext, "OK"); - } - break; case ANDROID_WIFI_CMD_COUNTRY: { char country_code[10]; diff --git a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_mp.c b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_mp.c index 50286ef2..c385aeec 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_mp.c +++ b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/ioctl_mp.c @@ -694,10 +694,13 @@ int rtw_mp_txpower_index(struct net_device *dev, _adapter *padapter = rtw_netdev_priv(dev); char input[RTW_IWD_MAX_LEN]; u32 rfpath = 0 ; - u32 txpower_inx = 0, tarpowerdbm = 0; + u32 txpower_inx = 0; + int tarpowerdbm = 0; char *pextra = extra; u8 rf_type = GET_HAL_RFPATH(adapter_to_dvobj(padapter)); struct _ADAPTER_LINK *adapter_link = GET_PRIMARY_LINK(padapter); + struct mp_priv *pmp_priv = (struct mp_priv *)&padapter->mppriv; + u8 tx_nss = rtw_mp_rfpath2txnss(padapter, pmp_priv->curr_rfpath); if (rtw_do_mp_iwdata_len_chk(__func__, (wrqu->length + 1))) return -EFAULT; @@ -715,12 +718,11 @@ int rtw_mp_txpower_index(struct net_device *dev, rfpath = rtw_atoi(input); #ifndef CONFIG_80211AX_HE txpower_inx = mpt_ProQueryCalTxPower(padapter, rfpath); - + pextra += sprintf(pextra, " %d\n\t\t", txpower_inx); #else - pextra += sprintf(pextra, " %d\n", txpower_inx); - tarpowerdbm = mpt_get_tx_power_finalabs_val(padapter, rfpath); + tarpowerdbm = mpt_get_tx_power_finalabs_val(padapter, tx_nss); if (tarpowerdbm > 0) { - pextra += sprintf(pextra, "\t\t dBm:%d.%d", + pextra += sprintf(pextra, "dBm:%d.%d", (tarpowerdbm / TX_POWER_BASE), rtw_mpt_raw2dec_dbm(tarpowerdbm)); padapter->mppriv.txpowerdbm = tarpowerdbm; rtw_mp_txpower_dbm(padapter, rfpath); @@ -730,38 +732,23 @@ int rtw_mp_txpower_index(struct net_device *dev, } else { u8 rfpath_i = 0; u8 tx_nss = get_phy_tx_nss(padapter, adapter_link); -#ifndef CONFIG_80211AX_HE - txpower_inx = mpt_ProQueryCalTxPower(padapter, 0); - pextra += sprintf(pextra, "patha=%d", txpower_inx); - if (rf_type > RF_1T2R) { - txpower_inx = mpt_ProQueryCalTxPower(padapter, 1); - pextra += sprintf(pextra, ",pathb=%d", txpower_inx); - } - if (rf_type > RF_2T4R) { - txpower_inx = mpt_ProQueryCalTxPower(padapter, 2); - pextra += sprintf(pextra, ",pathc=%d", txpower_inx); - } - if (rf_type > RF_3T4R) { - txpower_inx = mpt_ProQueryCalTxPower(padapter, 3); - pextra += sprintf(pextra, ",pathd=%d", txpower_inx); - } -#endif - tarpowerdbm = mpt_get_tx_power_finalabs_val(padapter, 0); - pextra += sprintf(pextra, "\n\t\t\tpatha dBm:%d.%d", + + tarpowerdbm = mpt_get_tx_power_finalabs_val(padapter, MP_NSS1); + pextra += sprintf(pextra, "\n\t\t\t 1SS dBm:%d.%d", (tarpowerdbm / TX_POWER_BASE), rtw_mpt_raw2dec_dbm(tarpowerdbm)); if (rf_type > RF_1T2R) { - tarpowerdbm = mpt_get_tx_power_finalabs_val(padapter, 1); - pextra += sprintf(pextra, ",pathb dBm:%d.%d", + tarpowerdbm = mpt_get_tx_power_finalabs_val(padapter, MP_NSS2); + pextra += sprintf(pextra, ",2SS dBm:%d.%d", (tarpowerdbm / TX_POWER_BASE), rtw_mpt_raw2dec_dbm(tarpowerdbm)); } if (rf_type > RF_2T4R) { - tarpowerdbm = mpt_get_tx_power_finalabs_val(padapter, 2); - pextra += sprintf(pextra, ",pathc dBm:%d.%d", + tarpowerdbm = mpt_get_tx_power_finalabs_val(padapter, MP_NSS3); + pextra += sprintf(pextra, ",3SS dBm:%d.%d", (tarpowerdbm / TX_POWER_BASE), rtw_mpt_raw2dec_dbm(tarpowerdbm)); } if (rf_type > RF_3T4R) { - tarpowerdbm = mpt_get_tx_power_finalabs_val(padapter, 3); - pextra += sprintf(pextra, ",pathd dBm:%d.%d", + tarpowerdbm = mpt_get_tx_power_finalabs_val(padapter, MP_NSS4); + pextra += sprintf(pextra, ",4SS dBm:%d.%d", (tarpowerdbm / TX_POWER_BASE), rtw_mpt_raw2dec_dbm(tarpowerdbm)); } padapter->mppriv.txpowerdbm = tarpowerdbm; @@ -917,7 +904,8 @@ int rtw_mp_ant_tx(struct net_device *dev, SetAntenna(padapter); if(registry_par->mp_mode == 1) { - pwr_dbm = mpt_get_tx_power_finalabs_val(padapter, pmppriv->curr_rfpath); + u8 tx_nss = rtw_mp_rfpath2txnss(padapter, pmppriv->curr_rfpath); + pwr_dbm = mpt_get_tx_power_finalabs_val(padapter, tx_nss); if ( pwr_dbm > 0) { padapter->mppriv.txpowerdbm = pwr_dbm; pextra += sprintf(pextra, "read pwr dbm:%d.%d", diff --git a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/os_intfs.c b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/os_intfs.c index 274e8393..8d15e740 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/os_intfs.c +++ b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/os_intfs.c @@ -184,6 +184,9 @@ static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb if (pmlmepriv->acm_mask != 0) skb->priority = qos_acm(pmlmepriv->acm_mask, skb->priority); + if (skb->protocol == htons(0x888e)) + return 4; + return rtw_1d_to_queue[skb->priority]; } #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) */ @@ -1212,8 +1215,10 @@ static void devobj_decide_init_chplan(struct dvobj_priv *dvobj) /* * treat {0xFF, 0xFF} as unspecified */ +#if 0 /* TODO: alpha2 from dev_cap(efuse) */ if (alpha2 && strncmp(alpha2, "\xFF\xFF", 2) == 0) alpha2 = NULL; +#endif #ifdef CONFIG_FORCE_SW_CHANNEL_PLAN disable_sw_chplan = _FALSE; @@ -2405,6 +2410,10 @@ int netdev_open(struct net_device *pnetdev) ret = _netdev_open(pnetdev); _rtw_mutex_unlock(&(adapter_to_dvobj(padapter)->hw_init_mutex)); +#ifdef CONFIG_80211D + if (ret == 0) + rtw_cis_scan_idle_check(adapter_to_rfctl(padapter)); +#endif #ifdef CONFIG_AUTO_AP_MODE if (padapter->iface_id == IFACE_ID2) diff --git a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/pci_intf.c b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/pci_intf.c index 197b6542..d78d63d4 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/pci_intf.c +++ b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/pci_intf.c @@ -685,9 +685,6 @@ static int rtw_pci_suspend(struct pci_dev *pdev, pm_message_t state) goto exit; } -#ifdef CONFIG_WOWLAN - device_set_wakeup_enable(&pdev->dev, true); -#endif pci_disable_device(pdev); #ifdef CONFIG_WOWLAN @@ -747,10 +744,6 @@ static int rtw_pci_resume(struct pci_dev *pdev) } #endif -#ifdef CONFIG_WOWLAN - device_set_wakeup_enable(&pdev->dev, false); -#endif - if (pwrpriv->wowlan_mode || pwrpriv->wowlan_ap_mode) { rtw_resume_lock_suspend(); err = rtw_resume_process(padapter); @@ -1124,6 +1117,7 @@ static int __init rtw_drv_entry(void) pci_drvpriv.drv_registered = _TRUE; rtw_suspend_lock_init(); + rtw_chplan_init(); rtw_drv_proc_init(); rtw_nlrtw_init(); rtw_ndev_notifier_register(); @@ -1143,6 +1137,7 @@ static int __init rtw_drv_entry(void) if (ret != 0) { pci_drvpriv.drv_registered = _FALSE; rtw_suspend_lock_uninit(); + rtw_chplan_deinit(); rtw_drv_proc_deinit(); rtw_nlrtw_deinit(); rtw_ndev_notifier_unregister(); @@ -1174,6 +1169,7 @@ static void __exit rtw_drv_halt(void) platform_wifi_power_off(); rtw_suspend_lock_uninit(); + rtw_chplan_deinit(); rtw_drv_proc_deinit(); rtw_nlrtw_deinit(); rtw_ndev_notifier_unregister(); diff --git a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/rtw_android.c b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/rtw_android.c index 7011373a..149233f6 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/rtw_android.c +++ b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/rtw_android.c @@ -484,13 +484,6 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) /* bytes_written = wl_android_wifi_off(net); */ break; - case ANDROID_WIFI_CMD_SCAN_ACTIVE: - /* rtw_set_scan_mode((_adapter *)rtw_netdev_priv(net), SCAN_ACTIVE); */ - break; - case ANDROID_WIFI_CMD_SCAN_PASSIVE: - /* rtw_set_scan_mode((_adapter *)rtw_netdev_priv(net), SCAN_PASSIVE); */ - break; - case ANDROID_WIFI_CMD_RSSI: bytes_written = rtw_android_get_rssi(net, command, priv_cmd.total_len); break; diff --git a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/rtw_cfg.c b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/rtw_cfg.c index 091f49ef..480005f1 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/rtw_cfg.c +++ b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/rtw_cfg.c @@ -355,6 +355,10 @@ char *rtw_dis_ch_flags = CONFIG_RTW_DIS_CH_FLAGS; module_param(rtw_dis_ch_flags, charp, 0644); MODULE_PARM_DESC(rtw_dis_ch_flags, "The flags with which channel is to be disabled"); +char *rtw_extra_alpha2 = CONFIG_RTW_EXTRA_ALPHA2; +module_param(rtw_extra_alpha2, charp, 0644); +MODULE_PARM_DESC(rtw_extra_alpha2, "The extra alpha2 country code which will always apply"); + static uint rtw_bcn_hint_valid_ms = CONFIG_RTW_BCN_HINT_VALID_MS; module_param(rtw_bcn_hint_valid_ms, uint, 0644); MODULE_PARM_DESC(rtw_bcn_hint_valid_ms, "The length of time beacon hint continue"); @@ -382,7 +386,8 @@ static uint rtw_country_ie_slave_flags = CONFIG_RTW_COUNTRY_IE_SLAVE_FLAGS; module_param(rtw_country_ie_slave_flags, uint, 0644); MODULE_PARM_DESC(rtw_country_ie_slave_flags, "802.11d country IE slave flags:" " BIT0: deprecated BIT" - ", BIT1: consider all environment BSSs, otherwise associated BSSs only"); + ", BIT1: consider all environment BSSs, otherwise associated BSSs only" + ", BIT2: consider all environment BSSs with majority selection (implys BIT1)"); static uint rtw_country_ie_slave_en_role = CONFIG_RTW_COUNTRY_IE_SLAVE_EN_ROLE; module_param(rtw_country_ie_slave_en_role, uint, 0644); @@ -392,10 +397,19 @@ static uint rtw_country_ie_slave_en_ifbmp = CONFIG_RTW_COUNTRY_IE_SLAVE_EN_IFBMP module_param(rtw_country_ie_slave_en_ifbmp, uint, 0644); MODULE_PARM_DESC(rtw_country_ie_slave_en_ifbmp, "802.11d country IE slave enable iface bitmap"); +static uint rtw_country_ie_slave_scan_band_bmp = CONFIG_RTW_COUNTRY_IE_SLAVE_SCAN_BAND_BMP; +module_param(rtw_country_ie_slave_scan_band_bmp, uint, 0644); +MODULE_PARM_DESC(rtw_country_ie_slave_scan_band_bmp, "802.11d country IE slave auto scan band bitmap. BIT0:2G, BIT1:5G, BIT2:6G"); + static uint rtw_country_ie_slave_scan_int_ms = CONFIG_RTW_COUNTRY_IE_SLAVE_SCAN_INT_MS; module_param(rtw_country_ie_slave_scan_int_ms, uint, 0644); MODULE_PARM_DESC(rtw_country_ie_slave_scan_int_ms, "802.11d country IE slave auto scan interval in ms to find environment BSSs." - " 0: no environment BSS auto scan triggered by driver self"); + " 0: no auto scan"); + +static uint rtw_country_ie_slave_scan_urgent_ms = CONFIG_RTW_COUNTRY_IE_SLAVE_SCAN_URGENT_MS; +module_param(rtw_country_ie_slave_scan_urgent_ms, uint, 0644); +MODULE_PARM_DESC(rtw_country_ie_slave_scan_urgent_ms, "time in ms when 802.11d country IE slave auto scan is not completed for, urgent scan will be triggered." + " 0: no urgent scan"); #endif /*if concurrent softap + p2p(GO) is needed, this param lets p2p response full channel list. @@ -418,6 +432,13 @@ MODULE_PARM_DESC(rtw_ant_num, "Antenna number setting, 0:by efuse"); int rtw_bt_iso = 2;/* 0:Low, 1:High, 2:From Efuse */ int rtw_bt_sco = 3;/* 0:Idle, 1:None-SCO, 2:SCO, 3:From Counter, 4.Busy, 5.OtherBusy */ int rtw_bt_ampdu = 1 ; /* 0:Disable BT control A-MPDU, 1:Enable BT control A-MPDU. */ + +#ifdef CONFIG_BTC_TRXSS_CHG +int rtw_btc_trxss_chg = 1; +module_param(rtw_btc_trxss_chg, int, 0644); +MODULE_PARM_DESC(rtw_btc_trxss_chg, "Tx/Rx SS change triggered by BTC"); +#endif + #endif /* CONFIG_BTC */ int rtw_AcceptAddbaReq = _TRUE;/* 0:Reject AP's Add BA req, 1:Accept AP's Add BA req. */ @@ -630,7 +651,7 @@ MODULE_PARM_DESC(rtw_adaptor_info_caching_file_path, "The path of adapter info c #endif /* CONFIG_ADAPTOR_INFO_CACHING_FILE */ #ifdef CONFIG_LAYER2_ROAMING -uint rtw_max_roaming_times = 2; +uint rtw_max_roaming_times = 1; module_param(rtw_max_roaming_times, uint, 0644); MODULE_PARM_DESC(rtw_max_roaming_times, "The max roaming times to try"); #endif /* CONFIG_LAYER2_ROAMING */ @@ -1133,19 +1154,31 @@ static inline void rtw_regsty_load_chplan(struct registry_priv *regsty) #endif } -static inline void rtw_regsty_load_alpha2(struct registry_priv *regsty) +static void _rtw_regsty_load_alpha2(const char *in, char *out, const char *tag) { - if (!rtw_country_code || strlen(rtw_country_code) != 2 - || (!IS_ALPHA2_WORLDWIDE(rtw_country_code) - && (is_alpha(rtw_country_code[0]) == _FALSE - || is_alpha(rtw_country_code[1]) == _FALSE) + if (!in || strlen(in) != 2 + || (!IS_ALPHA2_WORLDWIDE(in) + && (is_alpha(in[0]) == _FALSE + || is_alpha(in[1]) == _FALSE) ) ) { - if (rtw_country_code && rtw_country_code[0] != '\0') - RTW_ERR("%s discard rtw_country_code not in alpha2 or \"%s\"\n", __func__, WORLDWIDE_ALPHA2); - SET_UNSPEC_ALPHA2(regsty->alpha2); - } else - _rtw_memcpy(regsty->alpha2, rtw_country_code, 2); + if (in && in[0] != '\0') + RTW_ERR("%s discard %s not in alpha2 or \"%s\"\n", __func__, tag, WORLDWIDE_ALPHA2); + SET_UNSPEC_ALPHA2(out); + } else { + if (IS_ALPHA2_WORLDWIDE(in)) + _rtw_memcpy(out, WORLDWIDE_ALPHA2, 2); + else { + out[0] = alpha_to_upper(in[0]); + out[1] = alpha_to_upper(in[1]); + } + } +} + +static void rtw_regsty_load_alpha2(struct registry_priv *regsty) +{ + _rtw_regsty_load_alpha2(rtw_country_code, regsty->alpha2, "rtw_country_code"); + _rtw_regsty_load_alpha2(rtw_extra_alpha2, regsty->extra_alpha2, "rtw_extra_alpha2"); } static void rtw_regsty_load_addl_ch_disable_conf(struct registry_priv *regsty) @@ -1202,13 +1235,15 @@ static inline void rtw_regsty_load_env_settings(struct registry_priv *regsty) } #ifdef CONFIG_80211D -inline void rtw_regsty_load_country_ie_slave_settings(struct registry_priv *regsty) +static inline void rtw_regsty_load_country_ie_slave_settings(struct registry_priv *regsty) { regsty->country_ie_slave_en_mode = rtw_country_ie_slave_en_mode; regsty->country_ie_slave_flags = rtw_country_ie_slave_flags; regsty->country_ie_slave_en_role = rtw_country_ie_slave_en_role; regsty->country_ie_slave_en_ifbmp = rtw_country_ie_slave_en_ifbmp; + regsty->country_ie_slave_scan_band_bmp = rtw_country_ie_slave_scan_band_bmp; regsty->country_ie_slave_scan_int_ms = rtw_country_ie_slave_scan_int_ms; + regsty->country_ie_slave_scan_urgent_ms = rtw_country_ie_slave_scan_urgent_ms; } #endif @@ -1522,6 +1557,10 @@ void rtw_core_update_default_setting (struct dvobj_priv *dvobj) #ifdef CONFIG_BTC phl_com->dev_sw_cap.btc_mode = BTC_MODE_NORMAL; +#ifdef CONFIG_BTC_TRXSS_CHG + if (rtw_btc_trxss_chg) + GET_DEV_SW_BTC_CAP(phl_com).btc_deg_wifi_cap |= BTC_DRG_WIFI_CAP_TRX1SS; +#endif #else phl_com->dev_sw_cap.btc_mode = BTC_MODE_WL; #endif diff --git a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/rtw_proc.c b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/rtw_proc.c index 29204961..266234b8 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/rtw_proc.c +++ b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/rtw_proc.c @@ -226,7 +226,7 @@ static int proc_get_chplan_6g_country_list(struct seq_file *m, void *v) } #endif -#ifdef CONFIG_RTW_DEBUG +#ifdef CONFIG_RTW_CHPLAN_DEV static int proc_get_chplan_test(struct seq_file *m, void *v) { dump_chplan_test(m); @@ -279,7 +279,7 @@ const struct rtw_proc_hdl drv_proc_hdls[] = { RTW_PROC_HDL_SSEQ("chplan_6g_id_list", proc_get_chplan_6g_id_list, NULL), RTW_PROC_HDL_SSEQ("chplan_6g_country_list", proc_get_chplan_6g_country_list, NULL), #endif -#ifdef CONFIG_RTW_DEBUG +#ifdef CONFIG_RTW_CHPLAN_DEV RTW_PROC_HDL_SSEQ("chplan_test", proc_get_chplan_test, NULL), #endif RTW_PROC_HDL_SSEQ("chplan_ver", proc_get_chplan_ver, NULL), @@ -1922,8 +1922,6 @@ static int proc_get_cap_spt_op_class_ch(struct seq_file *m, void *v) static ssize_t proc_set_cap_spt_op_class_ch(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[32]; if (count < 1) @@ -1956,8 +1954,6 @@ static int proc_get_reg_spt_op_class_ch(struct seq_file *m, void *v) static ssize_t proc_set_reg_spt_op_class_ch(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[32]; if (count < 1) @@ -1990,8 +1986,6 @@ static int proc_get_cur_spt_op_class_ch(struct seq_file *m, void *v) static ssize_t proc_set_cur_spt_op_class_ch(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[32]; if (count < 1) @@ -3225,9 +3219,6 @@ static int proc_get_tx_power_ext_info(struct seq_file *m, void *v) static ssize_t proc_set_tx_power_ext_info(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) { - struct net_device *dev = data; - _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); - char tmp[32] = {0}; char cmd[16] = {0}; @@ -3244,6 +3235,9 @@ static ssize_t proc_set_tx_power_ext_info(struct file *file, const char __user * return count; #if 0 /* TODO */ + struct net_device *dev = data; + _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); + #ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE phy_free_filebuf_mask(adapter, LOAD_BB_PG_PARA_FILE | LOAD_RF_TXPWR_LMT_PARA_FILE); #endif @@ -5605,6 +5599,7 @@ const struct rtw_proc_hdl adapter_proc_hdls[] = { RTW_PROC_HDL_SSEQ("tx_amsdu", proc_get_tx_amsdu, proc_set_tx_amsdu), RTW_PROC_HDL_SSEQ("tx_amsdu_rate", proc_get_tx_amsdu_rate, proc_set_tx_amsdu_rate), #endif + RTW_PROC_HDL_SSEQ("tx_max_agg_time", proc_get_tx_max_agg_time, proc_set_tx_max_agg_time), #ifdef CONFIG_CORE_TXSC RTW_PROC_HDL_SSEQ("txsc", proc_get_txsc, proc_set_txsc), #ifdef CONFIG_TXSC_AMSDU @@ -6503,7 +6498,7 @@ static int proc_get_self_diag_info(struct seq_file *m, void *v) RTW_PRINT_SEL(m, "get passing time from last get self_diag_info (%d ms)\n\n", rtw_get_passing_time_ms(last_time)); last_time = rtw_get_current_time(); - RTW_PRINT_SEL(m, "driver warn on count = %d \n\n", rtw_warn_on_cnt); + RTW_PRINT_SEL(m, "driver warn on count = %u \n\n", ATOMIC_READ(&rtw_warn_on_cnt)); #ifdef CONFIG_USB_HCI RTW_PRINT_SEL(m, "%s%17s, %s\n", "Driver RX:", "Last count", "Current count"); @@ -6622,12 +6617,12 @@ static ssize_t proc_set_self_diag_info(struct file *file, const char __user *buf } else if (strcmp(type, "reset_drv_counter") == 0) { if (val == '1') { - rtw_warn_on_cnt = 0; + ATOMIC_SET(&rtw_warn_on_cnt, 0); #ifdef CONFIG_USB_HCI _rtw_memset(&(dvobj->usb_data.trx_stats), 0, sizeof(struct trx_stats)); #endif } - RTW_INFO("driver_warn_on_cnt : %u\n", rtw_warn_on_cnt); + RTW_INFO("driver_warn_on_cnt : %u\n", ATOMIC_READ(&rtw_warn_on_cnt)); } return count; diff --git a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/wifi_regd.c b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/wifi_regd.c index 2f18844e..afac356b 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/wifi_regd.c +++ b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/wifi_regd.c @@ -244,8 +244,10 @@ static struct ieee80211_reg_rule rtw_get_ieee80211_reg_rule(struct get_chplan_re ) rule.flags |= NL80211_RRF_AUTO_BW; + #if 0 /* TODO: limit to 20MHz */ if (regd_max_bw < 40) rule.flags |= NL80211_RRF_NO_HT40; + #endif if (regd_max_bw < 80) rule.flags |= NL80211_RRF_NO_80MHZ; if (regd_max_bw < 160) @@ -369,8 +371,6 @@ static void rtw_regd_disable_no_20mhz_chs(struct wiphy *wiphy) continue; for (j = 0; j < sband->n_channels; j++) { ch = &sband->channels[j]; - if (!ch) - continue; if (ch->flags & IEEE80211_CHAN_NO_20MHZ) { RTW_INFO(FUNC_WIPHY_FMT" disable band:%d ch:%u w/o 20MHz\n", FUNC_WIPHY_ARG(wiphy), ch->band, ch->hw_value); ch->flags = IEEE80211_CHAN_DISABLED; @@ -777,7 +777,6 @@ static void dump_requlatory_request(void *sel, struct regulatory_request *reques static void rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) { struct dvobj_priv *dvobj = wiphy_to_dvobj(wiphy); - struct registry_priv *regsty = dvobj_to_regsty(dvobj); enum rtw_regd_inr inr; #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) @@ -794,7 +793,7 @@ static void rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *req inr = nl80211_reg_initiator_to_rtw_regd_inr(request->initiator); #ifdef CONFIG_REGD_SRC_FROM_OS - if (REGSTY_REGD_SRC_FROM_OS(regsty)) { + if (REGSTY_REGD_SRC_FROM_OS(dvobj_to_regsty(dvobj))) { enum rtw_dfs_regd dfs_region = RTW_DFS_REGD_NONE; enum rtw_env_t env = RTW_ENV_NUM; diff --git a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/xmit_linux.c b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/xmit_linux.c index 2064f6d9..09506ff3 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/xmit_linux.c +++ b/drivers/net/wireless/realtek/rtl8852ce/os_dep/linux/xmit_linux.c @@ -254,11 +254,18 @@ static inline bool rtw_os_need_wake_queue(_adapter *padapter, u16 os_qid) { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); if (padapter->registrypriv.wifi_spec) { - if (pxmitpriv->hwxmits[os_qid].accnt < WMM_XMIT_THRESHOLD) + if (os_qid < 4 && pxmitpriv->hwxmits[os_qid].accnt < WMM_XMIT_THRESHOLD) + return _TRUE; + else if (os_qid == 4) /* EAPOL */ return _TRUE; } else { +#ifdef CONFIG_RTW_ROAM_STOP_NETIF_QUEUE + if (os_qid < 5 && pmlmepriv->roam_buf_pkt) + return _FALSE; +#endif return _TRUE; } return _FALSE; @@ -273,14 +280,18 @@ static inline bool rtw_os_need_stop_queue(_adapter *padapter, u16 os_qid) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) if (padapter->registrypriv.wifi_spec) { /* No free space for Tx, tx_worker is too slow */ - if (pxmitpriv->hwxmits[os_qid].accnt > WMM_XMIT_THRESHOLD) + if ((os_qid < 4) && (pxmitpriv->hwxmits[os_qid].accnt > WMM_XMIT_THRESHOLD)) + return _TRUE; + else if ((os_qid == 4) && (pxmitpriv->free_xframe_ext_cnt == 0)) /* EAPOL */ return _TRUE; } else { - if (pxmitpriv->free_xmitframe_cnt <= 4) + if ((os_qid < 4) && (pxmitpriv->free_xmitframe_cnt <= 4)) /* VO VI BE BK */ + return _TRUE; + else if ((os_qid == 4) && (pxmitpriv->free_xframe_ext_cnt == 0)) /* EAPOL */ return _TRUE; } #else - if (pxmitpriv->free_xmitframe_cnt <= 4) + if (pxmitpriv->free_xmitframe_cnt < 4) return _TRUE; #endif return _FALSE; @@ -379,6 +390,28 @@ bool rtw_os_check_stop_queue(_adapter *padapter, u16 os_qid) return busy; } +void rtw_roam_stop_queue(_adapter *padapter) +{ +#ifdef CONFIG_RTW_ROAM_STOP_NETIF_QUEUE + int i; + + RTW_INFO("%s\n",__func__); + for (i = 0;i < 4; i++) /* exclude eapol queue(id 4) */ + netif_stop_subqueue(padapter->pnetdev, i); +#endif +} + +void rtw_roam_wake_queue(_adapter *padapter) +{ +#ifdef CONFIG_RTW_ROAM_STOP_NETIF_QUEUE + int i; + + RTW_INFO("%s\n",__func__); + for (i = 0;i < 5; i++) + rtw_os_check_wakup_queue(padapter, i); +#endif +} + void rtw_os_wake_queue_at_free_stainfo(_adapter *padapter, int *qcnt_freed) { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) @@ -604,7 +637,7 @@ int rtw_os_tx(struct sk_buff *pkt, _nic_hdl pnetdev) if ((rtw_os_is_adapter_ready(padapter, pkt) == _FALSE) #ifdef CONFIG_LAYER2_ROAMING - && (!padapter->mlmepriv.roam_network) + && (!padapter->mlmepriv.roam_buf_pkt) #endif ) goto drop_packet; diff --git a/drivers/net/wireless/realtek/rtl8852ce/os_dep/osdep_service_linux.c b/drivers/net/wireless/realtek/rtl8852ce/os_dep/osdep_service_linux.c index 4d4c5dad..e5bb5a4b 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/os_dep/osdep_service_linux.c +++ b/drivers/net/wireless/realtek/rtl8852ce/os_dep/osdep_service_linux.c @@ -994,7 +994,7 @@ struct net_device *rtw_alloc_etherdev_with_old_priv(int sizeof_priv, void *old_p struct rtw_netdev_priv_indicator *pnpi; #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) - pnetdev = alloc_etherdev_mq(sizeof(struct rtw_netdev_priv_indicator), 4); + pnetdev = alloc_etherdev_mq(sizeof(struct rtw_netdev_priv_indicator), 5); #else pnetdev = alloc_etherdev(sizeof(struct rtw_netdev_priv_indicator)); #endif @@ -1091,5 +1091,5 @@ void rtw_wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked) wiphy_rfkill_set_hw_state(wiphy, blocked); } -u16 rtw_warn_on_cnt; +ATOMIC_T rtw_warn_on_cnt; diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/btc.mk b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/btc.mk index cd107811..918b129f 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/btc.mk +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/btc.mk @@ -7,10 +7,10 @@ ifeq ($(CONFIG_PHL_ARCH), y) phl_path := phl/$(HAL) -phl_path_d1 := $(SOURCETREE)/phl/$(HAL) +phl_path_d1 := $(src)/phl/$(HAL) else phl_path := $(HAL) -phl_path_d1 := $(SOURCETREE)/$(HAL) +phl_path_d1 := $(src)/$(HAL) endif # Base directory diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/btc_8852c/btc_8852c.c b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/btc_8852c/btc_8852c.c index e207f18c..f66a5a5c 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/btc_8852c/btc_8852c.c +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/btc_8852c/btc_8852c.c @@ -169,11 +169,32 @@ const struct btc_chip chip_8852c = { btc_8852c_rf_dl }; +u8 _8852c_get_rf_path(struct btc_t *btc, u8 antnum) +{ + u8 ret; + + switch (antnum) { + default: + case 1: + ret = btc->mdinfo.ant.single_pos; + break; + case 2: + ret = RF_PATH_AB; + break; + case 3: + ret = RF_PATH_ABC; + break; + } + return ret; +} + void _8852c_rfe_type(struct btc_t *btc) { struct rtw_phl_com_t *p = btc->phl; struct rtw_hal_com_t *h = btc->hal; struct btc_module *module = &btc->mdinfo; + struct btc_dm *dm = &btc->dm; + u8 tx_path_pos, rx_path_pos; PHL_TRACE(COMP_PHL_BTC, _PHL_DEBUG_, "[BTC], %s !! \n", __FUNCTION__); @@ -182,19 +203,20 @@ void _8852c_rfe_type(struct btc_t *btc) module->kt_ver = h->cv; module->bt_solo = 0; module->switch_type = BTC_SWITCH_INTERNAL; - module->wa_type = 0; + module->wa_type |= BTC_WA_INIT_SCAN; + dm->wl_trx_nss_en = 0; module->ant.type = BTC_ANT_SHARED; module->ant.num = 2; module->ant.isolation = 10; module->ant.diversity = 0; /* WL 1-stream+1-Ant is located at 0:s0(path-A) or 1:s1(path-B) */ - module->ant.single_pos = RF_PATH_A; + module->ant.single_pos = RF_PATH_B; module->ant.btg_pos = RF_PATH_B; - module->ant.stream_cnt = 2; + module->ant.stream_cnt = (p->phy_cap[0].txss << 4) + p->phy_cap[0].rxss; if (module->rfe_type == 0) { - btc->dm.error |= BTC_DMERR_RFE_TYPE0; + dm->error |= BTC_DMERR_RFE_TYPE0; return; } @@ -207,7 +229,12 @@ void _8852c_rfe_type(struct btc_t *btc) } else { module->ant.type = BTC_ANT_SHARED; module->bt_pos = BTC_BT_BTG; + dm->wl_trx_nss_en = 1; } + dm->wl_trx_nss_en &= !!(GET_DEV_BTC_CAP(p).btc_deg_wifi_cap & BTC_DRG_WIFI_CAP_TRX1SS); + tx_path_pos = _8852c_get_rf_path(btc, btc->phl->phy_cap[0].tx_path_num); + rx_path_pos = _8852c_get_rf_path(btc, btc->phl->phy_cap[0].rx_path_num); + module->ant.path_pos = (tx_path_pos << 4) + rx_path_pos; } void _8852c_get_reg_status(struct btc_t *btc, u8 type, void *status) @@ -458,8 +485,10 @@ void _8852c_wl_pri(struct btc_t *btc, u8 map, bool state) void _8852c_init_cfg(struct btc_t *btc) { struct rtw_hal_com_t *h = btc->hal; - struct btc_ant_info *ant = &btc->mdinfo.ant; + struct btc_module *module = &btc->mdinfo; + struct btc_ant_info *ant = &module->ant; struct btc_dm *dm = &btc->dm; + struct btc_wl_trx_nss_para *trx_nss = &dm->wl_trx_nss; u32 path, type, path_min, path_max; PHL_INFO("[BTC], %s !! \n", __FUNCTION__); @@ -477,7 +506,7 @@ void _8852c_init_cfg(struct btc_t *btc) _8852c_wl_pri(btc, BTC_PRI_MASK_TX_TRIG, true); /* for 1-Ant && 1-ss case: only 1-path */ - if (ant->stream_cnt == 1) { + if (ant->stream_cnt == 0x11) { path_min = ant->single_pos; path_max = path_min; } else { @@ -492,25 +521,28 @@ void _8852c_init_cfg(struct btc_t *btc) /* set rf gnt-debug off when init*/ if (dm->btc_initing) - _btc_io_w(btc, type, R_BTC_RF_BTG_CTRL, bMASKRF, 0x0, false); - + _btc_io_w(btc, type, R_BTC_RF_BTG_CTRL, + bMASKRF, 0x0, false); /* set DEBUG_LUT_RFMODE_MASK = 1 to start trx-mask-setup */ _btc_io_w(btc, type, R_BTC_RF_LUT_EN, bMASKRF, BIT(17), false); - /* if GNT_WL=0 && BT=SS_group --> WL Tx/Rx = THRU */ - _8852c_wl_trx_mask(btc, type, BTC_BT_SS_GROUP, 0x5ff); - - /* if GNT_WL=0 && BT=Rx_group --> WL-Rx = THRU + WL-Tx = MASK */ - _8852c_wl_trx_mask(btc, type, BTC_BT_RX_GROUP, 0x5df); - - /* if GNT_WL = 0 && BT = Tx_group --> - * Shared-Ant && BTG-path:WL mask(0x55f), others:WL THRU(0x5ff) - */ - if (ant->type == BTC_ANT_SHARED && ant->btg_pos == path) - _8852c_wl_trx_mask(btc, type, BTC_BT_TX_GROUP, 0x55f); - else + /* For 1T2R/1T1R at BTG, mask all WL Tx */ + if (module->bt_pos == BTC_BT_BTG && ant->btg_pos == path) { + if (trx_nss->tx_limit) { + _8852c_wl_trx_mask(btc, type, BTC_BT_SS_GROUP, 0x5dd); + _8852c_wl_trx_mask(btc, type, BTC_BT_TX_GROUP, 0x55d); + _8852c_wl_trx_mask(btc, type, BTC_BT_RX_GROUP, 0x5dd); + } else { + _8852c_wl_trx_mask(btc, type, BTC_BT_SS_GROUP, 0x5ff); + _8852c_wl_trx_mask(btc, type, BTC_BT_TX_GROUP, 0x55f); + _8852c_wl_trx_mask(btc, type, BTC_BT_RX_GROUP, 0x5df); + } + } else { + _8852c_wl_trx_mask(btc, type, BTC_BT_SS_GROUP, 0x5ff); _8852c_wl_trx_mask(btc, type, BTC_BT_TX_GROUP, 0x5ff); + _8852c_wl_trx_mask(btc, type, BTC_BT_RX_GROUP, 0x5df); + } /* set DEBUG_LUT_RFMODE_MASK = 0 to stop trx-mask-setup */ _btc_io_w(btc, type, R_BTC_RF_LUT_EN, bMASKRF, 0, false); diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/hal_btc.c b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/hal_btc.c index f821c104..7149c693 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/hal_btc.c +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/hal_btc.c @@ -65,6 +65,10 @@ static const u8 btc_ap_tpl [][3] = { {0x8C, 0x21, 0x0a}, {0x64, 0x66, 0xb3}, {0xbc, 0x46, 0x99} }; +static const u8 btc_hiduty_hid_name [][3] = { + {0x57, 0x69, 0x72}, {0x44, 0x75, 0x61}, {0x58, 0x62, 0x6f} +}; + #ifdef BTC_FDDT_TRAIN_SUPPORT static const struct btc_fddt_cell cell_ul_bt0[4][5] = { {{0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {-2,8,10,4}, {-5,5,10,4}}, @@ -701,6 +705,30 @@ u8 _get_wl_role_idx(struct btc_t *btc, u8 role) return rid; /*cation: return BTC_WL_MAX_ROLE_NUMBER if role not found */ } +bool _chk_bt_hiduty_dev(struct btc_t *btc) +{ + struct btc_cx *cx = &btc->cx; + struct btc_bt_info *bt = &cx->bt; + + if (bt->link_info.status.map.connect && + ((cx->cnt_bt[BTC_BCNT_LOPRI_TX] + cx->cnt_bt[BTC_BCNT_LOPRI_RX]) > + BTC_BT_HID_HIGHDUTY_THS)) { + if (!bt->link_info.status.map.inq_pag) + bt->hiduty_dev = true; + } else { + bt->hiduty_dev = false; + } + + if (bt->hiduty_dev != bt->hiduty_dev_last) { + bt->hiduty_dev_last = bt->hiduty_dev; + PHL_TRACE(COMP_PHL_BTC, _PHL_DEBUG_, + "[BTC] %s(): High duty hid connection %s! \n", + __func__, bt->hiduty_dev ? "Connected" : "Disconnected"); + return true; + } + return false; +} + void _set_wl_req_mac(struct btc_t *btc, u8 mac_id) { struct btc_wl_info *wl = &btc->cx.wl; @@ -789,6 +817,7 @@ static void _update_wl_info(struct btc_t *btc, u8 rid, enum link_state reason) struct btc_wl_active_role *act_role = NULL; struct rtw_hal_com_t *h = btc->hal; struct rtw_chan_def cid_ch[BTC_WL_MAX_ROLE_NUMBER]; + u8 client_cnt_last[BTC_WL_MAX_ROLE_NUMBER] = {0}; u8 i, j, cnt = 0, mac_id = HW_PHY_0, specific_ap = 0; u8 cnt_2g = 0, cnt_5g = 0, mode = BTC_WLINK_NOLINK; @@ -796,8 +825,11 @@ static void _update_wl_info(struct btc_t *btc, u8 rid, enum link_state reason) u8 cid_role[BTC_WL_MAX_ROLE_NUMBER] = {0}; u8 dbcc_2g_phy = HW_PHY_0, phy_now = 0, phy_dbcc; u32 noa_duration = 0, sz = sizeof(struct rtw_chan_def); - bool b2g = false, b5g = false, client_joined = false; - wl->legacy_mode = false; + bool client_joined = false, client_inc_2g = false; + bool b2g = false, b5g = false; + + for (i = 0; i < BTC_WL_MAX_ROLE_NUMBER; i++) + client_cnt_last[i] = wl_rinfo->active_role[i].client_cnt; hal_mem_set(h, wl_rinfo, 0, sizeof(struct btc_wl_role_info)); hal_mem_set(h, wl_dinfo, 0, sizeof(struct btc_wl_dbcc_info)); @@ -860,10 +892,17 @@ static void _update_wl_info(struct btc_t *btc, u8 rid, enum link_state reason) phy_now = act_role->phy; /* only if client connect for p2p-Go/AP */ - if ((wl_linfo[i].role == PHL_RTYPE_P2P_GO || - wl_linfo[i].role == PHL_RTYPE_AP) && - wl_linfo[i].client_cnt > 1) - client_joined = true; + if (wl_linfo[i].role == PHL_RTYPE_P2P_GO || + wl_linfo[i].role == PHL_RTYPE_AP) { + if (wl_linfo[i].client_cnt > 1) + client_joined = true; + if (client_cnt_last[i] < wl_linfo[i].client_cnt && + wl_linfo[i].chdef.band == BAND_ON_24G) + client_inc_2g = true; + act_role->client_cnt = (u8)wl_linfo[i].client_cnt; + } else { + act_role->client_cnt = 0; + } /* only one noa-role exist */ if (act_role->noa && act_role->noa_dur > 0) { @@ -911,6 +950,8 @@ static void _update_wl_info(struct btc_t *btc, u8 rid, enum link_state reason) wl_linfo[i].mode == WLAN_MD_11G || wl_linfo[i].mode == WLAN_MD_11BG ) wl->legacy_mode = true; + else if (wl_linfo[i].mode & WLAN_MD_11AX) + wl->he_mode = true; cnt_2g++; b2g = true; @@ -923,6 +964,7 @@ static void _update_wl_info(struct btc_t *btc, u8 rid, enum link_state reason) } wl_rinfo->connect_cnt = cnt; + wl->client_cnt_inc_2g = (u8)client_inc_2g; /* Be careful to change the following sequence!! */ if (cnt == 0) { @@ -1658,6 +1700,9 @@ static void _update_bt_info(struct btc_t *btc, u8 *buf, u32 len) return; } + if (_chk_bt_hiduty_dev(btc)) + bt_link_change = true; + hal_mem_cpy(h, bt->raw_info, buf, BTC_BTINFO_MAX); PHL_TRACE(COMP_PHL_BTC, _PHL_DEBUG_, @@ -1689,6 +1734,7 @@ static void _update_bt_info(struct btc_t *btc, u8 *buf, u32 len) b->profile_cnt.now += (u8)pan->exist; b->profile_cnt.now += (u8)leaudio->bis_cnt; b->profile_cnt.now += (u8)leaudio->cis_cnt; + b->profile_cnt.now += (u8)bt->hiduty_dev; btc->dm.trx_info.bt_profile = (btinfo.val & 0xf0) >>4; /* ======= parse raw info low-Byte3 ======= */ @@ -1850,11 +1896,9 @@ static void _query_bt_dev(struct btc_t *btc) _query_bt_dev_info(btc, BTC_DEV_HID_BINFO, h); _query_bt_dev_info(btc, BTC_DEV_HID_VINFO, h); } - hid->query_timer = 0; hid->devinfo_query = 1; } - if (hid->query_timer < 15) hid->query_timer++; } @@ -1955,7 +1999,8 @@ static void _update_bt_dev_info(struct btc_t *btc, u8 *buf, u32 len) continue; hid->links[i].vendor_id = src->data[1]; - break; + hal_mem_cpy(h, hid->links[i].name, src->data+2, + sizeof(hid->links[i].name)); } break; case BTC_DEV_HID_DNAME: @@ -2102,6 +2147,7 @@ static void _ntfy_role_info(struct btc_t *btc, u8 rid, wl->role_info.link_mode_chg = 0; wl->pta_reg_mac_chg = 0; + wl->client_cnt_inc_2g = 0; } static void _ntfy_radio_state(struct btc_t *btc, u8 rf_state) @@ -2311,9 +2357,6 @@ static void _ntfy_wl_sta(struct btc_t *btc, struct rtw_stats *phl_stats, link_cnt++; -#if BTC_BB_TX_1SS_LIMIT - linfo->tx_1ss_limit = sta[i]->hal_sta->ra_info.ra_nss_limit; -#endif /* ===== Refresh Tx/Rx Rate information (by role) ===== */ last_rx_rate = linfo->rx_rate; diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/hal_btc.h b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/hal_btc.h index c6613c6f..a7958bb3 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/hal_btc.h +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/hal_btc.h @@ -129,7 +129,7 @@ #define BTC_BB_PRE_AGC_FWCTRL 2 #define BTC_BB_PRE_AGC_NOTFOUND 3 -#define BTC_BB_TX_1SS_LIMIT 0 /* if halbb support rtw_hal_btc_cfg_tx_1ss */ +#define BTC_BB_TX_1SS_LIMIT 1 /* if halbb support rtw_hal_btc_cfg_tx_1ss */ #define BTC_AP_BLIST 0 /* Sporton AP issue*/ @@ -190,6 +190,9 @@ struct btc_t; /* mailbox 0x45 BT device info related */ #define BTC_DEV_LINK_MAX 4 +#define BTC_BT_HID_HIGHDUTY_THS 1000 +#define BTC_DEV_HID_NAME 3 +#define BTC_DEV_HID_MTK 0x46 #define _write_cx_reg(btc, offset, val) \ rtw_hal_mac_coex_reg_write(btc->hal, offset, val) @@ -459,6 +462,7 @@ enum btc_dbg_str_type { BTC_STR_RPTMATCH, BTC_STR_H2CERROR, BTC_STR_VENDORID, + BTC_STR_PATH, BTC_STR_MAX }; @@ -1044,7 +1048,9 @@ enum btc_wa_type { BTC_WA_5G_HI_CH_RX = BIT(0), BTC_WA_NULL_AP = BIT(1), BTC_WA_HFP_ZB = BIT(2), /* HFP PTA req bit4 define issue */ - BTC_WA_HFP_LAG = BIT(3) /*52BT WL break BT Rx lag issue*/ + BTC_WA_HFP_LAG = BIT(3), /*52BT WL break BT Rx lag issue*/ + BTC_WA_INIT_SCAN = BIT(4), /*52A/C/D init scan move to wl slot WA*/ + BTC_WA_CO_RX = BIT(5) /* 52B high rate co-rx issue */ }; struct btc_wl_tx_limit_para { @@ -1054,6 +1060,15 @@ struct btc_wl_tx_limit_para { u16 tx_retry; }; +struct btc_wl_trx_nss_para { + u8 tx_limit; + u8 rx_limit; + u8 tx_ss; + u8 rx_ss; + u8 tx_path; + u8 rx_path; +}; + struct btc_rf_trx_para { u32 wl_tx_power; /* absolute Tx power (dBm), 1's complement -5->0x85 */ u32 wl_rx_gain; /* rx gain table index (TBD.) */ @@ -1104,6 +1119,8 @@ struct btc_bt_link_hid { bool type; bool role; bool sniff; + + u8 name[BTC_DEV_HID_NAME]; }; struct btc_bt_link_a2dp { @@ -1353,7 +1370,7 @@ struct btc_wl_active_role { /* struct size must be n*4 bytes */ u8 ch; u8 noa_dur; /* ms */ - u8 rsvd1; + u8 client_cnt; u8 rsvd2; }; @@ -1554,8 +1571,10 @@ struct btc_bt_info { u32 lna_constrain: 3; u32 scan_info_update: 1; u32 fw_ver_mismatch: 1; + u32 hiduty_dev: 1; + u32 hiduty_dev_last: 1; - u32 rsvd: 16; + u32 rsvd: 14; }; struct btc_bt_mb_devinfo { @@ -1632,7 +1651,8 @@ struct btc_wl_info { u8 is_5g_hi_channel: 1; u8 busy_to_idle: 1; u8 legacy_mode: 1; - u8 rsvd: 2; + u8 he_mode: 1; + u8 client_cnt_inc_2g: 1; /* client count increase for 2G AP/P2P */ u8 coex_mode; @@ -1649,8 +1669,8 @@ struct btc_ant_info { u8 diversity; /* only for wifi use 1-antenna */ u8 btg_pos; /* btg-circuit at 0:S0/1:S1/others:all */ - u8 stream_cnt; /* spatial_stream count */ - u8 rsvd; + u8 stream_cnt; /* spatial_stream count: Tx[7:4], Rx[3:0] */ + u8 path_pos; /* path pos: Tx[7:4], Rx[3:0] */ }; struct btc_module { @@ -1787,6 +1807,7 @@ struct btc_dm { struct btc_init_info init_info; /* pass to wl_fw if offload */ struct btc_rf_trx_para rf_trx_para; struct btc_wl_tx_limit_para wl_tx_limit; + struct btc_wl_trx_nss_para wl_trx_nss; struct btc_wl_scc_ctrl wl_scc; struct btc_dm_step dm_step; @@ -1827,7 +1848,8 @@ struct btc_dm { u32 rx_err_rpt_en: 1; u32 wl_btg_rx_rb: 2; /* 0x10980 reg state from reg-moniter read-back */ u32 tpl_ap: 1; - u32 rsvd2: 3; + u32 wl_trx_nss_en: 1; /* xTxR switch to 1T1R */ + u32 rsvd2: 2; u8 wl_pre_agc: 2; u8 wl_lna2: 1; diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/halbtc_action.c b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/halbtc_action.c index 0f15d81a..40ec868c 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/halbtc_action.c +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/halbtc_action.c @@ -672,21 +672,18 @@ static void _set_halmac_tx_limit(struct btc_t *btc) return; if (btc->dm.freerun || btc->ctrl.igno_bt || b->profile_cnt.now == 0 || - mode == BTC_WLINK_5G || mode == BTC_WLINK_NOLINK) { + mode == BTC_WLINK_5G || mode == BTC_WLINK_NOLINK || + dm->wl_trx_nss.tx_limit) { enable = 0; tx_time = BTC_MAX_TX_TIME_DEF; tx_1ss_limit = 0; } else if (hfp->exist || hid->exist) { enable = 1; tx_time = BTC_MAX_TX_TIME_L3; - - if (wl_rinfo->p2p_2g) - tx_1ss_limit = 1; } if (dm->wl_tx_limit.en == enable && dm->wl_tx_limit.tx_time == tx_time && - dm->wl_tx_limit.tx_1ss == tx_1ss_limit && !wl_rinfo->link_mode_chg) return; @@ -713,16 +710,126 @@ static void _set_halmac_tx_limit(struct btc_t *btc) tx_time = plink->tx_time; rtw_hal_mac_set_tx_time(h, 1, resume, id, tx_time); - -#if BTC_BB_TX_1SS_LIMIT - if (tx_1ss_limit != plink->tx_1ss_limit) - rtw_hal_btc_cfg_tx_1ss(h, btc->phl, i, tx_1ss_limit); -#endif } dm->wl_tx_limit.en = enable; dm->wl_tx_limit.tx_time = tx_time; - dm->wl_tx_limit.tx_1ss = tx_1ss_limit; +} + +static void _set_trx_nss(struct btc_t *btc) +{ + struct btc_wl_trx_nss_para *trx_nss = &btc->dm.wl_trx_nss; + struct btc_dm *dm = &btc->dm; + struct btc_wl_info *wl = &btc->cx.wl; + struct btc_bt_info *bt = &btc->cx.bt; + struct btc_wl_role_info *wl_rinfo = &wl->role_info; + struct btc_bt_link_info *b = &bt->link_info; + struct btc_bt_hfp_desc *hfp = &b->hfp_desc; + struct btc_bt_hid_desc *hid = &b->hid_desc; + struct btc_bt_a2dp_desc *a2dp = &b->a2dp_desc; + struct btc_bt_leaudio_desc *le_audio = &b->leaudio_desc; + struct btc_chip_ops *ops = btc->chip->ops; + u8 tx_en = 0, tx_re = 0, rx_en = 0, rx_re = 0; + u8 tx_limit = 0, rx_limit = 0; + u8 tx_ss, rx_ss, tx_path, rx_path; + u8 tx_ss_ori, rx_ss_ori, tx_path_ori, rx_path_ori; + + /* tx/rx_limit = 1 ----> 1ss + * tx/rx_limit = 0 ----> default + */ + + if (btc->ctrl.manual || + wl->status.map.dbccing || + !dm->wl_trx_nss_en) + return; + + if (wl_rinfo->link_mode == BTC_WLINK_NOLINK || + wl_rinfo->link_mode == BTC_WLINK_5G || + wl_rinfo->dbcc_en) { + tx_limit = 0; + rx_limit = 0; + } else if (bt->hiduty_dev) { + tx_limit = 1; + rx_limit = 1; + } else if (le_audio->bis_cnt) { + tx_limit = 1; + rx_limit = 1; + } else if (le_audio->cis_cnt && + (btc->mdinfo.wa_type & BTC_WA_CO_RX)) { + if (wl->he_mode) { + tx_limit = 1; + rx_limit = 1; + } + } else if (a2dp->exist && a2dp->sink) { + tx_limit = 1; + rx_limit = 1; + } else if (wl_rinfo->link_mode == BTC_WLINK_2G_AP || + wl_rinfo->link_mode == BTC_WLINK_2G_GO) { + if (b->profile_cnt.now) { + tx_limit = 1; + rx_limit = 1; + } + } else if (hid->exist || hfp->exist) { + if (wl_rinfo->p2p_2g) { + tx_limit = 1; + rx_limit = 0; + } + } + + if (trx_nss->tx_limit == tx_limit && + trx_nss->rx_limit == rx_limit && + !wl->client_cnt_inc_2g) + return; + + tx_ss_ori = (btc->mdinfo.ant.stream_cnt & 0xf0) >> 4; + rx_ss_ori = btc->mdinfo.ant.stream_cnt & 0xf; + tx_path_ori = (btc->mdinfo.ant.path_pos & 0xf0) >> 4; + rx_path_ori = btc->mdinfo.ant.path_pos & 0xf; + + if (tx_ss_ori == 2 && tx_limit) { + tx_en = 1; + tx_re = 0; + tx_ss = 1; + tx_path = RF_PATH_A; + } else { + tx_en = 0; + tx_re = 1; + tx_ss = tx_ss_ori; + tx_path = tx_path_ori; + } + + if (rx_ss_ori == 2 && rx_limit) { + rx_en = 1; + rx_re = 0; + rx_ss = 1; + rx_path = RF_PATH_A; + } else { + rx_en = 0; + rx_re = 1; + rx_ss = rx_ss_ori; + rx_path = rx_path_ori; + } + + rtw_hal_btc_cfg_1ss(btc->hal, btc->phl, BAND_ON_24G, + tx_en, rx_en, tx_re, rx_re); + rtw_hal_btc_cfg_trx_path(btc->hal, tx_path, tx_ss, rx_path, rx_ss); + + trx_nss->tx_limit = tx_limit; + trx_nss->rx_limit = rx_limit; + trx_nss->tx_ss = tx_ss; + trx_nss->rx_ss = rx_ss; + trx_nss->tx_path = tx_path; + trx_nss->rx_path = rx_path; + + /* if enable MIMO-PS (to 1T1R), change ant shared-type */ + if (dm->wl_trx_nss.tx_limit && + dm->wl_trx_nss.rx_limit) + btc->mdinfo.ant.type = BTC_ANT_DEDICATED; + else + btc->mdinfo.ant.type = BTC_ANT_SHARED; + + if (ops && ops->init_cfg) + ops->init_cfg(btc); } void _set_fddt_ctrl(struct btc_t *btc, bool force_exec) @@ -894,13 +1001,13 @@ static void _set_policy(struct btc_t *btc, u16 policy_type, const char* action) _tdma_cpy(t, &t_def[CXTD_OFF_EXT]); /* To avoid wl-s0 tx break by hid/hfp tx */ - if (hid->exist || hfp->exist) { - if (p->phy_cap[0].tx_path_num == 1 && - p->phy_cap[0].rx_path_num == 1 && - btc->mdinfo.ant.type == BTC_ANT_SHARED && + if (btc->cx.bt.hiduty_dev || hid->exist || hfp->exist) { + if (dm->wl_trx_nss.tx_limit) + tbl_w1 = cxtbl[16]; + else if (btc->mdinfo.ant.type == BTC_ANT_SHARED && (wl_rinfo->role_map & BIT(PHL_RTYPE_P2P_GO))) tbl_w1 = cxtbl[22]; - else if (p->phy_cap[0].tx_path_num == 1 && + else if (btc->mdinfo.ant.type == BTC_ANT_SHARED && p->phy_cap[0].rx_path_num == 1 && btc->mdinfo.ant.type == BTC_ANT_SHARED && (wl_rinfo->role_map & BIT(PHL_RTYPE_P2P_GC))) @@ -1718,12 +1825,13 @@ static void _action_bt_hid(struct btc_t *btc) struct btc_bt_info *bt = &btc->cx.bt; struct btc_bt_hid_desc *hid = &bt->link_info.hid_desc; struct btc_bt_a2dp_desc *a2dp = &bt->link_info.a2dp_desc; + struct btc_dm *dm = &btc->dm; u16 policy_type = BTC_CXP_OFF_BT; if (btc->mdinfo.ant.type == BTC_ANT_SHARED) { /* shared-antenna */ if (wl->status.map._4way) { policy_type = BTC_CXP_OFF_WL; - } else if (a2dp->active) { + } else if (a2dp->active || bt->hiduty_dev) { btc->dm.slot_dur[CXST_W1] = 80; btc->dm.slot_dur[CXST_B1] = 20; policy_type = BTC_CXP_PFIX_TDW1B1; @@ -2085,6 +2193,9 @@ void _action_common(struct btc_t *btc) struct btc_bt_info *bt = &btc->cx.bt; u32 bt_rom_code_id = 0, bt_fw_ver = 0; +#if BTC_BB_TX_1SS_LIMIT + _set_trx_nss(btc); +#endif _set_halbb_btg_ctrl(btc); _set_halbb_preagc_ctrl(btc); _set_halmac_tx_limit(btc); @@ -2139,7 +2250,7 @@ void _action_wl_2g_sta(struct btc_t *btc) if (bt_linfo->hfp_desc.exist) profile_map |= BTC_BT_HFP; - if (bt_linfo->hid_desc.exist) + if (bt_linfo->hid_desc.exist || bt->hiduty_dev) profile_map |= BTC_BT_HID; if (bt_linfo->a2dp_desc.exist) diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/halbtc_dbg_cmd.c b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/halbtc_dbg_cmd.c index 781ce9be..8ccebb98 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/halbtc_dbg_cmd.c +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/halbtc_dbg_cmd.c @@ -353,12 +353,14 @@ static void _show_wl_info(struct btc_t *btc, u32 *used, char input[][MAX_ARGV], s_1ant = md->ant.single_pos? "(s1)" : "(s0)"; - CLI_PRT("\n\r %-15s : tx[num:%d/ss:%d%s%s], rx[num:%d/ss:%d%s%s]", + CLI_PRT("\n\r %-15s : tx[num:%d/ss:%d%s%s/path:%s], rx[num:%d/ss:%d%s%s/path:%s]", "[ant_stream]", p->phy_cap[0].tx_path_num, p->phy_cap[0].txss, (p->phy_cap[0].txss != 1? "" : s_1ant), s_tx, + id_to_str(BTC_STR_PATH, (u32)(md->ant.path_pos & 0xf0)>> 4), p->phy_cap[0].rx_path_num, p->phy_cap[0].rxss, - (p->phy_cap[0].rxss != 1? "" : s_1ant), s_rx); + (p->phy_cap[0].rxss != 1? "" : s_1ant), s_rx, + id_to_str(BTC_STR_PATH, (u32)md->ant.path_pos & 0xf)); if (wl->role_info.dbcc_en) CLI_PRT(", tx1[num:%d/ss:%d], rx1[num:%d/ss:%d]", @@ -503,8 +505,9 @@ static void _show_bt_info(struct btc_t *btc, u32 *used, char input[][MAX_ARGV], CLI_PRT("igno_wl:%d, mailbox_avl:%d, rfk_state:0x%x", bt->igno_wl, bt->mbx_avl, bt->rfk_info.val); - CLI_PRT("\n\r %-15s : profile:%s%s%s%s%s%s", "[profile]", + CLI_PRT("\n\r %-15s : profile:%s%s%s%s%s%s%s", "[profile]", ((bt_linfo->profile_cnt.now == 0) ? "None," : ""), + (bt->hiduty_dev ? "Hi-Duty-Dev," : ""), (bt_linfo->hfp_desc.exist? "HFP," : ""), (bt_linfo->hid_desc.exist? "HID," : ""), (bt_linfo->a2dp_desc.exist? @@ -641,6 +644,7 @@ static void _show_dm_info(struct btc_t *btc, u32 *used, char input[][MAX_ARGV], struct btc_bt_psd_dm *bp = &btc->bt_psd_dm; struct btc_aiso_val *av = &bp->aiso_val; struct btc_ant_info *ant = &btc->mdinfo.ant; + struct btc_module *md = &btc->mdinfo; u8 cnt, aiso_cur, aiso_ori = ant->isolation; if (!(dm->coex_info_map & BTC_COEX_INFO_DM)) @@ -670,11 +674,17 @@ static void _show_dm_info(struct btc_t *btc, u32 *used, char input[][MAX_ARGV], #endif CLI_PRT("\n\r %-15s : wl_tx_limit[en:%d/max_t:%dus]," - " bt_slot_req:[%d/%d], bt_stbc_req:%d, ofld[scan:%d/", + " wl_trx_1ss[tx:%d/path:%s/rx:%d/path:%s]," + " bt_slot_req:[%d/%d], bt_stbc_req:%d, wa_type:0x%x," + " ofld[scan:%d/", "[dm_drv_ctrl]", dm->wl_tx_limit.en, dm->wl_tx_limit.tx_time, + dm->wl_trx_nss.tx_ss, + id_to_str(BTC_STR_PATH, (u32)dm->wl_trx_nss.tx_path), + dm->wl_trx_nss.rx_ss, + id_to_str(BTC_STR_PATH, (u32)dm->wl_trx_nss.rx_path), btc->bt_req_len[HW_PHY_0], btc->bt_req_len[HW_PHY_1], - btc->bt_req_stbc, btc->hal->scanofld_en); + btc->bt_req_stbc, md->wa_type, btc->hal->scanofld_en); #ifdef BTC_CONFIG_FW_IO_OFLD_SUPPORT CLI_PRT("/io:%d", hal_btc_check_io_ofld(btc)); diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/halbtc_def.c b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/halbtc_def.c index 28377341..3652ecfd 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/halbtc_def.c +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/btc/halbtc_def.c @@ -86,6 +86,8 @@ case SET_##src: return #src #define case_vendorid(src) \ case BTC_VID_##src: return #src +#define case_path(src) \ + case RF_PATH_##src: return #src const char *id_to_str(u8 type, u32 id) { @@ -767,6 +769,25 @@ const char *id_to_str(u8 type, u32 id) case_vendorid(DELL); } break; + case BTC_STR_PATH: + switch(id) { + case_path(A); + case_path(B); + case_path(C); + case_path(D); + case_path(AB); + case_path(AC); + case_path(AD); + case_path(BC); + case_path(BD); + case_path(CD); + case_path(ABC); + case_path(ABD); + case_path(ACD); + case_path(BCD); + case_path(ABCD); + } + break; } return "Undefine"; diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal.mk b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal.mk index 073d84e0..8660c88d 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal.mk +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal.mk @@ -2,10 +2,10 @@ ifeq ($(CONFIG_PHL_ARCH), y) phl_path := phl/ -phl_path_d1 := $(SOURCETREE)/phl/$(HAL) +phl_path_d1 := $(src)/phl/$(HAL) else phl_path := -phl_path_d1 := $(SOURCETREE)/$(HAL) +phl_path_d1 := $(src)/$(HAL) endif _HAL_FILES := $(phl_path)$(HAL)/hal_api_mac.o \ diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_api_bb.c b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_api_bb.c index 6a59fc5e..308e4d6c 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_api_bb.c +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_api_bb.c @@ -503,7 +503,7 @@ rtw_hal_bb_ra_deregister(struct hal_info_t *hal_info, { if (!rtw_halbb_ra_deregistered(hal_info->bb, sta)) PHL_ERR("rtw_halbb_ra_deregistered failed\n"); - + sta->hal_sta->ra_info.ra_nss_limit = 0; sta->hal_sta->ra_info.ra_registered = false; return RTW_HAL_STATUS_SUCCESS; } @@ -547,6 +547,143 @@ exit: return hal_sts; } +#ifdef CONFIG_BTCOEX +/* + * Origin 2T2R + * tx_en, rx_en, tx_res, rx_res + * 1 1 0 0 2T2R >> 1T1R + * 0 0 1 1 1T1R >> 2T2R + * 1 0 0 0 2T2R >> 1T2R + * 0 0 1 0 1T2R >> 2T2R + */ +enum rtw_hal_status rtw_hal_btc_cfg_1ss(struct rtw_hal_com_t *hal_c, + struct rtw_phl_com_t *phl_c, enum band_type band, + bool tx_en, bool rx_en, bool tx_res, bool rx_res) +{ + enum rtw_hal_status hsts = RTW_HAL_STATUS_FAILURE; + enum rtw_phl_status psts = RTW_PHL_STATUS_FAILURE; + struct hal_info_t *hal_i = (struct hal_info_t *)hal_c->hal_priv; + void *drv = halcom_to_drvpriv(hal_c); + struct rtw_wifi_role_t *wr = NULL; + struct rtw_wifi_role_link_t *rlk = NULL; + struct phl_queue *sta_queue = NULL; + struct rtw_phl_stainfo_t *sta = NULL; + struct rtw_phl_stainfo_t **sta_todo = NULL; + size_t sta_todo_len = 0; + size_t i; + int sta_qlen = 0; + u8 ra_nss_lim, ridx = 0, lidx = 0, map_idx = 0; + u32 macid_map[2] = {0}; + u16 bit_num = (u16)(sizeof(macid_map) * 8); + struct phl_msg msg = {0}; + enum phl_msg_evt_id evt = MSG_EVT_NONE; + + PHL_WARN("%s: Interferential ch-band(%d), tx_en(%d), rx_en(%d), tx_res(%d), rx_res(%d)\n", + __FUNCTION__, band, tx_en, rx_en, tx_res, rx_res); + if (!(GET_DEV_BTC_CAP(phl_c).btc_deg_wifi_cap & BTC_DRG_WIFI_CAP_TRX1SS)) { + PHL_ERR("%s: Don't support, btc_deg_wifi_cap(0x%x)\n", + __FUNCTION__, GET_DEV_BTC_CAP(phl_c).btc_deg_wifi_cap); + goto exit; + } + if ((tx_en && tx_res) || (rx_en && rx_res)) { + PHL_ERR("%s: error para\n", __FUNCTION__); + goto exit; + } + if (tx_en && !tx_res) + ra_nss_lim = 1; + else + ra_nss_lim = 0; + for (ridx = 0; ridx < MAX_WIFI_ROLE_NUMBER; ridx++) { + wr = &(phl_c->wifi_roles[ridx]); + if (false == wr->active || MLME_LINKED != wr->mstate) + continue; + if (!rtw_phl_role_is_ap_category(wr) && + !rtw_phl_role_is_client_category(wr)) + continue; + for (lidx = 0; lidx < RTW_RLINK_MAX; lidx++) { + rlk = &(wr->rlink[lidx]); + if (MLME_LINKED != rlk->mstate) + continue; + if (band != rlk->chandef.band) + continue; + sta_queue = &rlk->assoc_sta_queue; + sta_todo = NULL; + sta_todo_len = 0; + /* collect the sta list */ + _os_spinlock(drv, &sta_queue->lock, _bh, NULL); + sta_qlen = sta_queue->cnt; + sta_todo = (struct rtw_phl_stainfo_t **) + _os_kmem_alloc(drv, sta_qlen * sizeof(struct rtw_phl_stainfo_t *)); + if (!sta_todo) { + PHL_ERR("%s: failed to alloc sta_todo\n", __FUNCTION__); + hsts = RTW_HAL_STATUS_RESOURCE; + _os_spinunlock(drv, &sta_queue->lock, _bh, NULL); + goto exit; + } + phl_list_for_loop(sta, struct rtw_phl_stainfo_t, + &sta_queue->queue, list) { + if (sta) { + sta_todo[sta_todo_len++] = sta; + if (sta->macid < bit_num) { + map_idx = (u8)(sta->macid / 32); + macid_map[map_idx] |= BIT(sta->macid % 32); + } else { + PHL_ERR("%s: macid(%d) > macid_map\n", + __FUNCTION__, sta->macid); + } + } + } + _os_spinunlock(drv, &sta_queue->lock, _bh, NULL); + if (!tx_en && !tx_res) + goto _next_loop; /* no need to cfg tx */ + for (i = 0; i < sta_todo_len; i++) { + sta = sta_todo[i]; + sta->hal_sta->ra_info.ra_nss_limit = ra_nss_lim; + hsts = rtw_hal_bb_ra_update(hal_i, sta); + if (RTW_HAL_STATUS_SUCCESS != hsts) { + PHL_ERR("%s: macid(%d), Fail to cfg ra_nss_limit(%d)\n", + __FUNCTION__, sta->macid, ra_nss_lim); + } else { + PHL_WARN("%s: macid(%d), succee to cfg ra_nss_limit(%d)\n", + __FUNCTION__, sta->macid, ra_nss_lim); + } + } + _next_loop: + _os_kmem_free(drv, sta_todo, sta_qlen * sizeof(struct rtw_phl_stainfo_t *)); + } + } + if (!rx_en && !rx_res) + goto exit; /* no need to cfg rx */ + if (rx_en && !rx_res) + evt = MSG_EVT_ANN_RX1SS; + else if (!rx_en && rx_res) + evt = MSG_EVT_ANN_RX_MAXSS; + else + goto exit; + msg.rsvd[0].value = macid_map[0]; /* macid 0~31 */ + msg.rsvd[1].value = macid_map[1]; /* macid 32~63 */ + SET_MSG_MDL_ID_FIELD(msg.msg_id, PHL_MDL_GENERAL); + SET_MSG_EVT_ID_FIELD(msg.msg_id, evt); + PHL_WARN("%s: macid map(0x%08x-%08x) need to announce rx nss to %d\n", + __FUNCTION__, (u32)msg.rsvd[1].value, (u32)msg.rsvd[0].value, evt); + psts = rtw_phl_msg_hub_hal_send(phl_c, NULL, &msg); + if (RTW_PHL_STATUS_SUCCESS != psts) { + PHL_ERR("%s: Send msg fail\n", __FUNCTION__); + hsts = RTW_HAL_STATUS_FAILURE; + } else { + PHL_WARN("%s: Send msg ok\n", __FUNCTION__); + } +exit: + return hsts; +} + +enum rtw_hal_status rtw_hal_btc_cfg_trx_path(struct rtw_hal_com_t *hal_c, + enum rf_path tx, u8 tx_nss, enum rf_path rx, u8 rx_nss) +{ + return rtw_hal_bb_trx_path_cfg(hal_c->hal_priv, tx, tx_nss, rx, rx_nss); +} +#endif /* CONFIG_BTCOEX */ + enum rtw_hal_status rtw_hal_bb_query_txsts_rpt(struct hal_info_t *hal_info, u16 macid0, u16 macid1) @@ -1475,7 +1612,7 @@ rtw_hal_bb_parse_phy_sts(void *hal, rxdesc.macid_su = (u8)mdata->macid; rxdesc.user_num = hal_ppdu->usr_num; rxdesc.is_to_self = (true == sniffer_mode) ? 1 : ((mdata->a1_match == true) ? 1 : 0); - if (RTW_IS_ASOC_REQ_PKT(ppdu_info->sts_ent[band][mdata->ppdu_cnt].frame_type)) + if (RTW_IS_ASOC_REQ_PKT(ppdu_info->sts_ent[band][mdata->ppdu_cnt].frame_type) || RTW_IS_BEACON_OR_PROBE_RESP_PKT(ppdu_info->sts_ent[band][mdata->ppdu_cnt].frame_type)) rxdesc.is_to_self = true; rxdesc.phy_idx = (mdata->bb_sel == 0) ? HW_PHY_0 : HW_PHY_1; diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_api_drv.h b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_api_drv.h index 0281fa8c..1d0bc815 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_api_drv.h +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_api_drv.h @@ -24,6 +24,13 @@ u32 rtw_hal_mac_set_grant_act(struct rtw_hal_com_t *hal_com, u8 *value); u32 rtw_hal_mac_set_grant(struct rtw_hal_com_t *hal_com, u8 *value); u32 rtw_hal_mac_get_grant(struct rtw_hal_com_t *hal_com, u8 *value); u32 rtw_hal_mac_set_polluted(struct rtw_hal_com_t *hal_com, u8 band, u8 tx_val, u8 rx_val); +enum rtw_hal_status rtw_hal_btc_cfg_1ss(struct rtw_hal_com_t *hal_c, + struct rtw_phl_com_t *phl_c, enum band_type band, + bool tx_en, bool rx_en, bool tx_res, bool rx_res); + +enum rtw_hal_status rtw_hal_btc_cfg_trx_path(struct rtw_hal_com_t *hal_c, + enum rf_path tx, u8 tx_nss, enum rf_path rx, u8 rx_nss); + u32 rtw_hal_mac_set_tx_time(struct rtw_hal_com_t *hal_com, u8 is_btc, u8 is_resume, u8 macid, u32 tx_time); u32 rtw_hal_mac_get_tx_time(struct rtw_hal_com_t *hal_com, u8 macid, u32 *tx_time); diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_cap.c b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_cap.c index b1578cdc..9b87022e 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_cap.c +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_cap.c @@ -247,6 +247,16 @@ static void _hal_ps_final_cap_decision(struct rtw_phl_com_t *phl_com, rtw_hal_ps_fw_cap_decision(phl_com, false); } +#ifdef CONFIG_BTCOEX +static void _hal_btc_final_cap_decision(struct rtw_phl_com_t *phl_com) +{ + struct btc_cap_info *btc_sw_cap = &GET_DEV_SW_BTC_CAP(phl_com); + struct btc_cap_info *btc_dev_cap = &GET_DEV_BTC_CAP(phl_com); + + btc_dev_cap->btc_deg_wifi_cap = btc_sw_cap->btc_deg_wifi_cap; +} +#endif /* CONFIG_BTCOEX */ + static void _hal_edcca_final_cap_decision(struct rtw_phl_com_t *phl_com, struct rtw_hal_com_t *hal_com) { @@ -457,7 +467,12 @@ void rtw_hal_final_cap_decision(struct rtw_phl_com_t *phl_com, void *hal) dev_cap->xcap = dev_hw_cap->xcap; dev_cap->domain = dev_hw_cap->domain; dev_cap->domain_6g = dev_hw_cap->domain_6g; + + /* btc related */ dev_cap->btc_mode = dev_sw_cap->btc_mode; +#ifdef CONFIG_BTCOEX + _hal_btc_final_cap_decision(phl_com); +#endif /* CONFIG_BTCOEX */ #ifdef CONFIG_PCI_HCI _hal_bus_final_cap_decision(phl_com, hal_com); diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_def.h b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_def.h index 7ce73d67..ceca686d 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_def.h +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_def.h @@ -665,6 +665,7 @@ struct rtw_ra_sta_info { /* u8 drv_ractrl; */ /* Ctrl */ + u8 ra_nss_limit; /* 0: no limitation, otherwise, limit to tx nss pkt*/ bool dis_ra; /*move from rtw_hal_stainfo_t*/ bool ra_registered;/*move from rtw_hal_stainfo_t*/ u64 ra_mask;/*move from rtw_hal_stainfo_t*/ /*drv decide by specific req*/ diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_sta.c b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_sta.c index 04ad7c7f..9cf13e60 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_sta.c +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/hal_sta.c @@ -336,6 +336,8 @@ rtw_hal_upd_ampdu_cctrl_info(void *hal, struct rtw_phl_stainfo_t *sta) struct hal_info_t *hal_info = (struct hal_info_t *)hal; enum rtw_hal_status sts = RTW_HAL_STATUS_FAILURE; struct rtw_hal_mac_ax_cctl_info cctrl, cctl_info_mask; + u16 max_txop = 0, cur_txop = 0; + u8 i = 0; _os_mem_set(hal_to_drvpriv(hal_info), &cctrl, 0, sizeof(struct rtw_hal_mac_ax_cctl_info)); _os_mem_set(hal_to_drvpriv(hal_info), &cctl_info_mask, 0, sizeof(struct rtw_hal_mac_ax_cctl_info)); @@ -343,9 +345,27 @@ rtw_hal_upd_ampdu_cctrl_info(void *hal, struct rtw_phl_stainfo_t *sta) if (NULL == sta) goto out; + for (i = 0; i < 4; i++) { + cur_txop = (u16)(sta->asoc_cap.edca[i].param >> 16); + if (cur_txop > max_txop) { + max_txop = cur_txop; + } + } + if (max_txop > 0xFF00) { + PHL_WARN("%s max txop = 0x%x, > HW define \n", __func__, max_txop); + } + else + PHL_INFO("[LOGO_DBG]: %s max txop = 0x%x\n", __func__, max_txop); + + cctrl.ampdu_time_sel = 1; + cctl_info_mask.ampdu_time_sel = 1; + cctrl.max_agg_num_sel = 1; cctl_info_mask.max_agg_num_sel = 1; + cctrl.ampdu_max_time = (max_txop >> 4) - 1; + cctl_info_mask.ampdu_max_time = 0xF; + cctrl.max_agg_num = sta->asoc_cap.num_ampdu - 1; cctl_info_mask.max_agg_num = 0xFF; @@ -394,13 +414,26 @@ rtw_hal_cfg_tx_ampdu(void *hal, struct rtw_phl_stainfo_t *sta) { struct hal_info_t *hal_info = (struct hal_info_t *)hal; enum rtw_hal_status hsts = RTW_HAL_STATUS_FAILURE; + u16 max_txop = 0, cur_txop = 0; + u8 i = 0; + + for (i = 0; i < 4; i++) { + cur_txop = (u16)(sta->asoc_cap.edca[i].param >> 16); + if (cur_txop > max_txop) { + max_txop = cur_txop; + } + } + if (max_txop > 0xFF00) { + PHL_WARN("%s max txop = 0x%x, > HW define \n", __func__, max_txop); + } + PHL_INFO("[LOGO_DBG]: %s max txop = 0x%x\n", __func__, max_txop); /* update ampdu configuration */ if (256 >= sta->asoc_cap.num_ampdu) { hsts = rtw_hal_mac_set_hw_ampdu_cfg(hal_info, sta->rlink->hw_band, sta->asoc_cap.num_ampdu, - 0xA5); + (u8)max_txop); } else { PHL_WARN("%s not consider this case : num_ampdu(%u), please check \n", __func__, sta->asoc_cap.num_ampdu); diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/mac/mac.mk b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/mac/mac.mk index ad635a48..6342c487 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/mac/mac.mk +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/mac/mac.mk @@ -7,10 +7,10 @@ HAL = hal_g6 ifeq ($(CONFIG_PHL_ARCH), y) phl_path := phl/hal_g6 -phl_path_d1 := $(SOURCETREE)/phl/$(HAL) +phl_path_d1 := $(src)/phl/$(HAL) else phl_path := hal_g6 -phl_path_d1 := $(SOURCETREE)/$(HAL) +phl_path_d1 := $(src)/$(HAL) endif # Base directory diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/bb/bb.mk b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/bb/bb.mk index 02785e87..a1273e96 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/bb/bb.mk +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/bb/bb.mk @@ -7,10 +7,10 @@ ifeq ($(CONFIG_PHL_ARCH), y) phl_path := phl/$(HAL) -phl_path_d1 := $(SOURCETREE)/phl/$(HAL) +phl_path_d1 := $(src)/phl/$(HAL) else phl_path := $(HAL) -phl_path_d1 := $(SOURCETREE)/$(HAL) +phl_path_d1 := $(src)/$(HAL) endif # Base directory diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/bb/halbb_api_be_hw.c b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/bb/halbb_api_be_hw.c index 511cc732..3ba8ca55 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/bb/halbb_api_be_hw.c +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/bb/halbb_api_be_hw.c @@ -22,6 +22,10 @@ u8 halbb_get_prim_sb_be(struct bb_info *bb, u8 central_ch, u8 pri_ch, u8 prim_sb = 0; u8 prisb_cal_ofst[5] = {0, 2, 6, 14, 30}; + if (bw > 4) { + BB_WARNING("out-of-bounds, bw:%d\n", bw); + return prim_sb; + } prim_sb = (prisb_cal_ofst[bw] + pri_ch - central_ch) / 4; return prim_sb; diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/bb/halbb_ra.c b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/bb/halbb_ra.c index 24cd1479..a14ce56c 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/bb/halbb_ra.c +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/bb/halbb_ra.c @@ -1282,15 +1282,29 @@ bool halbb_ldpc_chk(struct bb_info *bb, struct rtw_phl_stainfo_t *phl_sta_i, u8 return ldpc_en; } -u8 halbb_nss_mapping(struct bb_info *bb, u8 nss) +u8 halbb_nss_mapping(struct bb_info *bb, u8 nss_cap, u8 nss_limit) { u8 mapping_nss = 0; - if (nss != 0) - mapping_nss = nss - 1; /* Driver tx_nss mapping */ - if (mapping_nss > (bb->phl_com->phy_cap[bb->bb_phy_idx].tx_path_num - 1)) + if (nss_cap != 0) + mapping_nss = nss_cap - 1; + + /*nss_limit. e.g. BTC_1ss feature*/ + if (nss_limit != 0) { /*nss_limit = 0 means no limit*/ + if (mapping_nss > nss_limit - 1) + mapping_nss = nss_limit - 1; + } + + /*protection when AP/NIC is connected to a device whose rx_nss > 2*/ + if (mapping_nss > (bb->phl_com->phy_cap[bb->bb_phy_idx].tx_path_num - 1)) { mapping_nss = bb->phl_com->phy_cap[bb->bb_phy_idx].tx_path_num - 1; + } + + BB_DBG(bb, DBG_RA, "nss_mapping:{nss_cap,nss_limit,rfpath_tx} = {%d,%d,%d}\n", + nss_cap, nss_limit, bb->phl_com->phy_cap[bb->bb_phy_idx].tx_path_num); + + return mapping_nss; } @@ -1643,7 +1657,7 @@ bool rtw_halbb_raregistered(struct bb_info *bb_0, struct rtw_phl_stainfo_t *phl_ BB_DBG(bb, DBG_RA, "Phy_idx=%d, RSSI_LV=%d, rssi_assoc=%d\n", bb->bb_phy_idx, init_lv, rssi_assoc); /*@Becareful RA use our "Tx" capability which means the capability of their "Rx"*/ - tx_nss = halbb_nss_mapping(bb, asoc_cap_i->nss_rx); + tx_nss = halbb_nss_mapping(bb, asoc_cap_i->nss_rx, hal_sta_i->ra_info.ra_nss_limit); if (asoc_cap_i->dcm_max_const_rx) ra_cfg->dcm_cap = 1; else @@ -1850,7 +1864,7 @@ bool rtw_halbb_raupdate(struct bb_info *bb_0, asoc_cap_i = &phl_sta_i->asoc_cap; rssi = hal_sta_i->rssi_stat.rssi >> 1; /*@Becareful RA use our "Tx" capability which means the capability of their "Rx"*/ - tx_nss = halbb_nss_mapping(bb, asoc_cap_i->nss_rx); + tx_nss = halbb_nss_mapping(bb, asoc_cap_i->nss_rx, hal_sta_i->ra_info.ra_nss_limit); ra_cfg->is_dis_ra = hal_sta_i->ra_info.dis_ra; mod_mask = hal_sta_i->ra_info.cur_ra_mask; ra_cfg->upd_all= false; @@ -1956,7 +1970,7 @@ bool halbb_ra_update_mask_watchdog(struct bb_info *bb, struct rtw_phl_stainfo_t asoc_cap_i = &phl_sta_i->asoc_cap; rssi = hal_sta_i->rssi_stat.rssi >> 1; /*@Becareful RA use our "Tx" capability which means the capability of their "Rx"*/ - tx_nss = halbb_nss_mapping(bb, asoc_cap_i->nss_rx); + tx_nss = halbb_nss_mapping(bb, asoc_cap_i->nss_rx, hal_sta_i->ra_info.ra_nss_limit); ra_cfg->is_dis_ra = hal_sta_i->ra_info.dis_ra; mod_mask = hal_sta_i->ra_info.cur_ra_mask; #ifdef BB_1115_DVLP_SPF diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/rf/halrf_pwr_table.c b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/rf/halrf_pwr_table.c index f2c3c889..466d1367 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/rf/halrf_pwr_table.c +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/rf/halrf_pwr_table.c @@ -2418,49 +2418,66 @@ s16 halrf_get_power(void *rf_void, struct halrf_pwr_info *pwr = &rf->pwr_info; struct rtw_phl_com_t *phl = rf->phl_com; struct rtw_tpu_info *tpu = &rf->hal_com->band[HW_PHY_0].rtw_tpu_i; - u8 band, limit_rate = PW_LMT_RS_CCK, tx_num = PW_LMT_PH_1T, limit_ch, reg = 0; + u32 band = rf->hal_com->band[HW_PHY_0].cur_chandef.band; + u8 limit_rate = PW_LMT_RS_CCK, tx_num = PW_LMT_PH_1T, limit_ch, reg = 0; u16 rate_tmp; s16 pwr_by_rate, pwr_limit, power; - RF_DBG(rf, DBG_RF_INIT, "======>%s rf_path=%d rate=%d dcm=%d bw=%d bf=%d ch=%d\n", + RF_DBG(rf, DBG_RF_POWER, "======>%s rf_path=%d rate=%d dcm=%d bw=%d bf=%d ch=%d\n", __func__, rf_path, rate, dcm, bandwidth, beamforming, channel); - if (channel >= 1 && channel <= 14) - band = PW_LMT_BAND_2_4G; - else - band = PW_LMT_BAND_5G; - tx_num = rf_path; rate_tmp = halrf_get_dcm_offset_pwr_by_rate(rf, rate, dcm, offset); pwr_by_rate = (s16)pwr->tx_pwr_by_rate[band][rate_tmp]; - RF_DBG(rf, DBG_RF_INIT, "pwr_by_rate(%d)=(s16)pwr->tx_pwr_by_rate[%d][%d]\n", + RF_DBG(rf, DBG_RF_POWER, "pwr_by_rate(%d)=(s16)pwr->tx_pwr_by_rate[%d][%d]\n", pwr_by_rate, band, rate_tmp); limit_rate = halrf_hw_rate_to_limit_rate_tx_num(rf, rate); - limit_ch = halrf_get_ch_idx_to_limit_array(rf, channel); - if (channel >= 1 && channel <= 14) { + if (band == BAND_ON_24G) { + limit_ch = halrf_get_ch_idx_to_limit_array(rf, channel); reg = halrf_get_regulation_info(rf, BAND_ON_24G); - if (reg >= PW_LMT_MAX_REGULATION_NUM) { + if (reg < PW_LMT_MAX_REGULATION_NUM) { + pwr_limit = (s16)pwr->tx_pwr_limit_2g[reg][bandwidth][limit_rate][beamforming][limit_ch][tx_num]; + RF_DBG(rf, DBG_RF_POWER, "pwr_limit(%d) = (s16)pwr->tx_pwr_limit_2g[%d][%d][%d][%d][%d][%d]\n", + pwr_limit, reg, bandwidth, limit_rate, beamforming, limit_ch, tx_num); + } else { reg = PW_LMT_REGU_WW13; RF_WARNING("===>%s reg >= PW_LMT_MAX_REGULATION_NUM\n", __func__); - } else { pwr_limit = (s16)pwr->tx_pwr_limit_2g[reg][bandwidth][limit_rate][beamforming][limit_ch][tx_num]; - RF_DBG(rf, DBG_RF_INIT, "pwr_limit(%d) = (s16)pwr->tx_pwr_limit_2g[%d][%d][%d][%d][%d][%d]\n", - pwr_limit, halrf_get_regulation_info(rf, BAND_ON_24G), bandwidth, limit_rate, beamforming, limit_ch, tx_num); + RF_DBG(rf, DBG_RF_POWER, "pwr_limit(%d) = (s16)pwr->tx_pwr_limit_2g[%d][%d][%d][%d][%d][%d]\n", + pwr_limit, PW_LMT_REGU_WW13, bandwidth, limit_rate, beamforming, limit_ch, tx_num); + } + } else if (band == BAND_ON_5G) { + limit_ch = halrf_get_ch_idx_to_limit_array(rf, channel); + reg = halrf_get_regulation_info(rf, BAND_ON_5G); + if (reg < PW_LMT_MAX_REGULATION_NUM) { + pwr_limit = (s16)pwr->tx_pwr_limit_5g[reg][bandwidth][limit_rate][beamforming][limit_ch][tx_num]; + RF_DBG(rf, DBG_RF_POWER, "pwr_limit(%d) = (s16)pwr->tx_pwr_limit_5g[%d][%d][%d][%d][%d][%d]\n", + pwr_limit, reg, bandwidth, limit_rate, beamforming, limit_ch, tx_num); + } else { + reg = PW_LMT_REGU_WW13; + RF_WARNING("===>%s reg >= PW_LMT_MAX_REGULATION_NUM\n", __func__); + pwr_limit = (s16)pwr->tx_pwr_limit_5g[reg][bandwidth][limit_rate][beamforming][limit_ch][tx_num]; + RF_DBG(rf, DBG_RF_POWER, "pwr_limit(%d) = (s16)pwr->tx_pwr_limit_5g[%d][%d][%d][%d][%d][%d]\n", + pwr_limit, PW_LMT_REGU_WW13, bandwidth, limit_rate, beamforming, limit_ch, tx_num); } } else { - reg = halrf_get_regulation_info(rf, BAND_ON_5G); - if (reg >= PW_LMT_MAX_REGULATION_NUM) { - reg = PW_LMT_REGU_WW13; - RF_WARNING("===>%s reg >= PW_LMT_MAX_REGULATION_NUM\n", __func__); + limit_ch = halrf_get_ch_idx_to_6g_limit_array(rf, channel); + reg = halrf_get_regulation_info(rf, BAND_ON_6G); + if (reg < PW_LMT_MAX_6G_REGULATION_NUM) { + pwr_limit = (s16)pwr->tx_pwr_limit_6g[reg][bandwidth][limit_rate][beamforming][limit_ch][tx_num]; + RF_DBG(rf, DBG_RF_POWER, "pwr_limit(%d) = (s16)pwr->tx_pwr_limit_6g[%d][%d][%d][%d][%d][%d]\n", + pwr_limit, reg, bandwidth, limit_rate, beamforming, limit_ch, tx_num); } else { - pwr_limit = (s16)pwr->tx_pwr_limit_5g[reg][bandwidth][limit_rate][beamforming][limit_ch][tx_num]; - RF_DBG(rf, DBG_RF_INIT, "pwr_limit(%d) = (s16)pwr->tx_pwr_limit_5g[%d][%d][%d][%d][%d][%d]\n", - pwr_limit, halrf_get_regulation_info(rf, BAND_ON_5G), bandwidth, limit_rate, beamforming, limit_ch, tx_num); + reg = PW_LMT_REGU_6G_WW13; + RF_WARNING("===>%s reg >= PW_LMT_MAX_6G_REGULATION_NUM\n", __func__); + pwr_limit = (s16)pwr->tx_pwr_limit_6g[reg][bandwidth][limit_rate][beamforming][limit_ch][tx_num]; + RF_DBG(rf, DBG_RF_POWER, "pwr_limit(%d) = (s16)pwr->tx_pwr_limit_6g[%d][%d][%d][%d][%d][%d]\n", + pwr_limit, PW_LMT_REGU_6G_WW13, bandwidth, limit_rate, beamforming, limit_ch, tx_num); } } @@ -2469,7 +2486,7 @@ s16 halrf_get_power(void *rf_void, else power = pwr_by_rate; - RF_DBG(rf, DBG_RF_INIT, "power = %d\n", power); + RF_DBG(rf, DBG_RF_POWER, "power = %d\n", power); return power; } diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/rf/rf.mk b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/rf/rf.mk index 21dd2569..717e176e 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/rf/rf.mk +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/phy/rf/rf.mk @@ -7,10 +7,10 @@ ifeq ($(CONFIG_PHL_ARCH), y) phl_path := phl/$(HAL) -phl_path_d1 := $(SOURCETREE)/phl/$(HAL) +phl_path_d1 := $(src)/phl/$(HAL) else phl_path := $(HAL) -phl_path_d1 := $(SOURCETREE)/$(HAL) +phl_path_d1 := $(src)/$(HAL) endif # Base directory diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/rtl8852c/pci/rtl8852ce_halinit.c b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/rtl8852c/pci/rtl8852ce_halinit.c index 0d5c5a60..552f50e7 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/rtl8852c/pci/rtl8852ce_halinit.c +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/hal_g6/rtl8852c/pci/rtl8852ce_halinit.c @@ -902,6 +902,13 @@ bool hal_recognize_int_8852ce(struct hal_info_t *hal) hal_disable_int_rmn_8852ce(hal); } else { /* if isr is not recognized, go to end */ +#if 1 + PHL_WARN("%s: unknown isr\n", __func__); + hal_com->_intr[0].val = 0; + hal_com->_intr[1].val = 0; + hal_com->_intr[2].val = 0; + hal_com->_intr[3].val = 0; +#endif goto end; } diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/phl.mk b/drivers/net/wireless/realtek/rtl8852ce/phl/phl.mk index aa31e68d..20c1368c 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/phl.mk +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/phl.mk @@ -11,10 +11,10 @@ endif ifeq ($(CONFIG_PHL_ARCH), y) phl_path := phl/ -phl_path_d1 := $(SOURCETREE)/phl/$(HAL) +phl_path_d1 := $(src)/phl/$(HAL) else phl_path := -phl_path_d1 := $(SOURCETREE)/$(HAL) +phl_path_d1 := $(src)/$(HAL) endif _PHL_FILES := $(phl_path)phl_init.o \ diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/phl_cmd_scan.c b/drivers/net/wireless/realtek/rtl8852ce/phl/phl_cmd_scan.c index 48d25735..33c54617 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/phl_cmd_scan.c +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/phl_cmd_scan.c @@ -241,17 +241,29 @@ _cmd_scan_update_chlist(void *drv, struct rtw_phl_scan_param *param, * => 0,1,2,[op0],[op1],3,4,5,[op0],[op1],6,7,8,[op0],[op1] */ -static inline void +static inline u8 _cmd_scan_enqueue_opch(void *drv, struct cmd_scan_ctrl *sctrl) { u8 idx = 0; + u8 op_ch = 0; for(idx = 0; idx < MAX_WIFI_ROLE_NUMBER; idx ++) { - if(sctrl->back_op_ch[idx].channel) + if(sctrl->back_op_ch[idx].channel) { + #if 0 + if (sctrl->scan_ch && + sctrl->scan_ch->band == sctrl->back_op_ch[idx].band && + sctrl->scan_ch->channel == sctrl->back_op_ch[idx].channel && + sctrl->scan_ch->duration >= sctrl->back_op_ch[idx].duration) { + continue; /* same as previous scan ch skip op channel */ + } + #endif + op_ch++; pq_push(drv, &sctrl->chlist, &sctrl->back_op_ch[idx].list, _first, _ps); - else + } else { break; + } } + return op_ch; } static struct phl_scan_channel *_cmd_scan_select_chnl( void *drv, struct rtw_phl_scan_param *param, u8 band_idx) @@ -276,6 +288,7 @@ next_ch: if(scan_ch->scan_mode == NORMAL_SCAN_MODE) { sctrl->ch_idx++; + /* 1- enable, 2- BK_CNT mode, 3- prev is non-op, 4- ch_intvl's turn */ if (back_op_is_required && param->back_op.mode == SCAN_BKOP_CNT) { if(!((sctrl->ch_idx + 1) % param->back_op.ch_intv)) { @@ -283,6 +296,19 @@ next_ch: } } else if (back_op_is_required && param->back_op.mode == SCAN_BKOP_TIMER) { +#ifdef PRIVATE_N + sctrl->off_ch_time += scan_ch->duration; + if (sctrl->off_ch_time > param->back_op.off_ch_dur_ms) { + + pq_push(drv, &sctrl->chlist, &scan_ch->list, _first, _ps); + sctrl->last_opch_add_time = + phl_get_passing_time_ms(param->start_time); + + if (_cmd_scan_enqueue_opch(drv, sctrl)) + sctrl->off_ch_time = 0; + goto next_ch; + } +#else if ((phl_get_passing_time_ms(param->start_time) - sctrl->last_opch_add_time) > param->back_op.off_ch_dur_ms) { @@ -290,6 +316,7 @@ next_ch: phl_get_passing_time_ms(param->start_time); _cmd_scan_enqueue_opch(drv, sctrl); } +#endif } } #ifdef CONFIG_PHL_CMD_SCAN_BKOP_TIME @@ -299,6 +326,9 @@ next_ch: _cmd_scan_enqueue_opch(drv, sctrl); } sctrl->ch_idx++; + } else if (scan_ch->scan_mode == BACKOP_MODE) { + sctrl->off_ch_time = 0; + sctrl->last_opch_add_time += scan_ch->duration; } #endif sctrl->scan_ch = scan_ch; @@ -313,12 +343,14 @@ next_ch: goto next_ch; } else { + printk("%s: scan done\n", __func__); return NULL; } - PHL_INFO("%s:[%d] repeat[%d] ch_idx=[%d], remain=[%d], ch_number=%d, scan_mode= %s\n", __func__, - band_idx, sctrl->repeat, sctrl->ch_idx, sctrl->chlist.cnt, sctrl->scan_ch->channel, - (sctrl->scan_ch->scan_mode == BACKOP_MODE)? "OP_CH": "Non-OP"); + param->done_num = param->ch_num - sctrl->chlist.cnt; + printk("%s:[%d] idx=%d, r=%d, ch=%d, p=%d\n", __func__, + band_idx, sctrl->ch_idx, sctrl->chlist.cnt, sctrl->scan_ch->channel, + phl_get_passing_time_ms(param->start_time)); return sctrl->scan_ch; } @@ -535,6 +567,7 @@ void _cmd_abort_notify(void *dispr, void *drv, _cmd_abort_notify_cb(drv, &msg); return; } + printk("%s(%d)vv abort=%d\n",__func__,__LINE__,abort); msg.rsvd[0].ptr = (u8*)sctrl->wrole; if (abort) @@ -814,6 +847,7 @@ enum phl_mdl_ret_code _cmd_scan_hdl_internal_evt( _cmd_scan_start(phl_info, sctrl, band_idx); PHL_INFO("[%d]MSG_EVT_SCAN_START \n", band_idx); + sctrl->off_ch_time = 0; /* [scan start notify] */ if (!TEST_SCAN_FLAGS(param->state, CMD_SCAN_STARTED)) { if (param->ops->scan_start) @@ -1229,7 +1263,7 @@ _cmd_scan_update_chparam(void *drv, struct rtw_phl_scan_param *param, u8 sctrl_i param->max_listen_time = ch->duration; total_scan_ms = ch->duration; break; - } + } } while(pq_get_next(drv, &sctrl->chlist, node, &node, _ps)); scan_section_ms = param->back_op.ch_dur_ms + param->back_op.off_ch_dur_ms; diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/phl_def.h b/drivers/net/wireless/realtek/rtl8852ce/phl/phl_def.h index 62121fea..eeb382c5 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/phl_def.h +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/phl_def.h @@ -60,6 +60,10 @@ enum phl_band_idx { #define RTW_ONE_LINK (1) #define RTW_RLINK_PRIMARY (0) +#define GET_DEV_SW_CAP(_phl_com) (_phl_com->dev_sw_cap) +#define GET_DEV_HW_CAP(_phl_com) (_phl_com->dev_hw_cap) +#define GET_DEV_CAP(_phl_com) (_phl_com->dev_cap) + /* * Refer to 802.11 spec (BE D1.3). * The description of Link ID subfield reserves 15 for if the reported AP is @@ -1077,6 +1081,8 @@ enum phl_msg_evt_id { MSG_EVT_P2P_SESSION_NO_LINK = 235, MSG_EVT_P2P_SESSION_LINKED = 236, + MSG_EVT_ANN_RX1SS = 240, /* Announce rx 1ss */ + MSG_EVT_ANN_RX_MAXSS = 241, /* Announce rx nss for max cap */ /* sub module IO */ MSG_EVT_NOTIFY_BB = 300, MSG_EVT_NOTIFY_RF = 301, @@ -2228,6 +2234,21 @@ enum dump_cfg_option { #define SET_FW_LOG_DUMP_ALLOWED(_phl_com) (_phl_com->dbg_cfg.dump_cfg |= DUMP_CFG_FW_LOG_ALLOW) #define CLR_FW_LOG_DUMP_ALLOWED(_phl_com) (_phl_com->dbg_cfg.dump_cfg &= ~DUMP_CFG_FW_LOG_ALLOW) +#ifdef CONFIG_BTCOEX +#define GET_DEV_BTC_CAP(_phl_com) (GET_DEV_CAP(_phl_com).btc_cap_i) +#define GET_DEV_SW_BTC_CAP(_phl_com) (GET_DEV_SW_CAP(_phl_com).btc_cap_i) +#define GET_DEV_HW_BTC_CAP(_phl_com) (GET_DEV_HW_CAP(_phl_com).btc_cap_i) + +enum rtw_btc_deg_wifi_cap { + BTC_DRG_WIFI_CAP_NONE = 0, + BTC_DRG_WIFI_CAP_TRX1SS = BIT0 +}; + +struct btc_cap_info { + u16 btc_deg_wifi_cap; /* enum rtw_btc_deg_wifi_cap */ +}; +#endif /* CONFIG_BTCOEX */ + struct rtw_phl_dbg_bb { u32 bb_init_ctrl_opt; u32 bb_init_ctrl_val; @@ -2345,6 +2366,9 @@ struct dev_cap_t { u8 domain; u8 domain_6g; u8 btc_mode; +#ifdef CONFIG_BTCOEX + struct btc_cap_info btc_cap_i; +#endif /* CONFIG_BTCOEX */ u8 ap_ps; /* support for AP mode PS in PHL */ u8 pwrbyrate_off; u8 pwrlmt_type; diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/phl_git_info.h b/drivers/net/wireless/realtek/rtl8852ce/phl/phl_git_info.h index d2eaba64..663d6808 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/phl_git_info.h +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/phl_git_info.h @@ -26,18 +26,18 @@ #define __PHL_GIT_INFO_H__ /*@--------------------------[Define] ---------------------------------------*/ -#define RTK_CORE_SHA1 "1fe335ba1ec320bc845ac6f63f382e3812cfc041" -#define RTK_PHL_SHA1 "bb78d7134f48dbfb6b60b5d63c8cc09ee2e79960" +#define RTK_CORE_SHA1 "455ab52c9370743897f9a49005601e716c23ea73" +#define RTK_PHL_SHA1 "cb718610a2b894e972b2c1179b4c24775480605e" #define RTK_HALMAC_SHA1 "a8003e258e7ceec767c2e329732e7e3b63934473" -#define RTK_HALBB_SHA1 "d46dd00f6fcd8350b4c627085cbd0c1533a33821" -#define RTK_HALRF_SHA1 "759bfcc2f801097d87fe60c9ab4e8c72085ab6c1" -#define RTK_BTC_SHA1 "0ada5eece000780f92e0e7534d84e1734cb7e538" +#define RTK_HALBB_SHA1 "8f07cd65ef4ef6867255f3a95706e417c8d31bf3" +#define RTK_HALRF_SHA1 "01c1864e02ade0c1d1482c85d6bb0fa0f4799651" +#define RTK_BTC_SHA1 "33bcdb9f10f24aa8b92ee86a7076f89faf6ccbed" -#define RTK_CORE_TAGINFO "v1.19.16.1-0-g1fe335ba1" -#define RTK_PHL_TAGINFO "PHL_1_19_111_0100-61-gbb78d7134" +#define RTK_CORE_TAGINFO "v1.19.16_nv-126-g455ab52c9" +#define RTK_PHL_TAGINFO "PHL_1_19_111_0100-86-gcb718610a" #define RTK_HALMAC_TAGINFO "HALMAC_0_29_95_0-1-ga8003e258" -#define RTK_HALBB_TAGINFO "HALBB_029_167_15-0-gd46dd00f" -#define RTK_HALRF_TAGINFO "HALRF_029_00_161-0-g759bfcc2" -#define RTK_BTC_TAGINFO "HALBTC_029_087-0-g0ada5ee" +#define RTK_HALBB_TAGINFO "HALBB_029_167_15-2-g8f07cd65" +#define RTK_HALRF_TAGINFO "HALRF_029_00_161_HOTFIX_001-0-g01c1864e" +#define RTK_BTC_TAGINFO "HALBTC_029_087-8-g33bcdb9" #endif /* __PHL_GIT_INFO_H__ */ diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/phl_init.c b/drivers/net/wireless/realtek/rtl8852ce/phl/phl_init.c index 83ac5ac1..d8f9bb4e 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/phl_init.c +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/phl_init.c @@ -113,6 +113,7 @@ void _phl_com_init_ppdu_sts(struct rtw_phl_com_t *phl_com) for (i = 0; i < PHL_MAX_PPDU_CNT; i++) { pq_init(phl_com->drv_priv, &(phl_com->ppdu_sts_info.sts_ent[j][i].frames)); + phl_com->ppdu_sts_info.sts_ent[j][i].frame_type = RTW_FRAME_TYPE_MAX; } } #endif diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/phl_rx.c b/drivers/net/wireless/realtek/rtl8852ce/phl/phl_rx.c index 7166534f..9d961086 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/phl_rx.c +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/phl_rx.c @@ -2195,6 +2195,7 @@ phl_rx_proc_ppdu_sts(struct phl_info_t *phl_info, struct rtw_phl_rx_pkt *phl_rx) } } } + ppdu_sts_ent->frame_type = RTW_FRAME_TYPE_MAX; #ifdef CONFIG_PHL_SNIFFER_SUPPORT /* sniffer info for high performance mode : only process once in recving ppdu_sts */ if (SNIFFER_INFO_MODE_HIGH_PERFORMANCE == ppdu_info->sniffer_info_mode) { diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/phl_scan.h b/drivers/net/wireless/realtek/rtl8852ce/phl/phl_scan.h index 9a5597bb..23a18282 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/phl_scan.h +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/phl_scan.h @@ -146,6 +146,7 @@ struct cmd_scan_ctrl { struct phl_scan_channel *scan_ch; int ch_idx; /* current scaned cahnnel index, init vaule = (-1) */ u32 last_opch_add_time; /* used for timer */ + u32 off_ch_time; }; enum scan_result { @@ -185,6 +186,7 @@ struct rtw_phl_scan_param { struct phl_scan_channel *ch; u8 ch_num; + u8 done_num; u32 ch_sz; u8 repeat; /* 255 means scan forever until cancel */ diff --git a/drivers/net/wireless/realtek/rtl8852ce/phl/rtw_general_def.h b/drivers/net/wireless/realtek/rtl8852ce/phl/rtw_general_def.h index f4128c63..a5fdd7dc 100644 --- a/drivers/net/wireless/realtek/rtl8852ce/phl/rtw_general_def.h +++ b/drivers/net/wireless/realtek/rtl8852ce/phl/rtw_general_def.h @@ -643,6 +643,7 @@ enum rtw_p2p_app_type { #define RTW_FRAME_TYPE_REASOC_REQ 8 #define RTW_FRAME_TYPE_REASOC_RESP 12 #define RTW_FRAME_TYPE_ACK 53 +#define RTW_FRAME_TYPE_MAX 0xFF #define RTW_IS_ASOC_PKT(_TYPE) \ ((_TYPE == RTW_FRAME_TYPE_REASOC_RESP) || \ (_TYPE == RTW_FRAME_TYPE_REASOC_REQ) || \ diff --git a/drivers/net/wireless/realtek/rtl8852ce/platform/custom_country_chplan.h b/drivers/net/wireless/realtek/rtl8852ce/platform/custom_country_chplan.h deleted file mode 100644 index 8039f1ec..00000000 --- a/drivers/net/wireless/realtek/rtl8852ce/platform/custom_country_chplan.h +++ /dev/null @@ -1,22 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2013 - 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. - * - *****************************************************************************/ - -#error "You have defined CONFIG_CUSTOMIZED_COUNTRY_CHPLAN_MAP to use a customized map of your own instead of the default one" -#error "Before removing these error notifications, please make sure regulatory certification requirements of your target markets" - -static const struct country_chplan CUSTOMIZED_country_chplan_map[] = { - COUNTRY_CHPLAN_ENT("TW", 0x76, 0x00, DEF , 1, 1, 1), /* Taiwan */ -}; -