1
0
mirror of https://github.com/aircrack-ng/rtl8812au.git synced 2024-11-22 13:24:36 +00:00

Uploaded the 8812au v5.2.20.2 driver

This commit is contained in:
kimocoder 2018-07-02 18:49:32 +02:00
parent b85ad0de96
commit 29fab55737
69 changed files with 2363 additions and 1392 deletions

9
.gitignore vendored
View File

@ -1,9 +0,0 @@
*.o
*.cmd
*.ko
*.cm
Module.symvers
modules.order
*.mod.c
.tmp_versions
.cache.mk

View File

@ -1,8 +1,8 @@
EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS)
EXTRA_CFLAGS += -O1
#EXTRA_CFLAGS += -O3
EXTRA_CFLAGS += -Wall
EXTRA_CFLAGS += -Wextra
#EXTRA_CFLAGS += -Wall
#EXTRA_CFLAGS += -Wextra
#EXTRA_CFLAGS += -Werror
#EXTRA_CFLAGS += -pedantic
#EXTRA_CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
@ -13,13 +13,7 @@ EXTRA_CFLAGS += -Wno-unused-label
EXTRA_CFLAGS += -Wno-unused-parameter
EXTRA_CFLAGS += -Wno-unused-function
EXTRA_CFLAGS += -Wno-unused
EXTRA_CFLAGS += -Wno-date-time
EXTRA_CFLAGS += -Wno-misleading-indentation
EXTRA_CFLAGS += -Wno-uninitialized
# Relax some warnings from '-Wextra' so we won't get flooded with warnings
EXTRA_CFLAGS += -Wno-sign-compare
EXTRA_CFLAGS += -Wno-missing-field-initializers
EXTRA_CFLAGS += -Wno-type-limits
#EXTRA_CFLAGS += -Wno-uninitialized
GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc )
ifeq ($(GCC_VER_49),1)
@ -51,7 +45,6 @@ CONFIG_PCI_HCI = n
CONFIG_SDIO_HCI = n
CONFIG_GSPI_HCI = n
########################## Features ###########################
CONFIG_NET_NS = y
CONFIG_MP_INCLUDED = y
CONFIG_POWER_SAVING = n
CONFIG_USB_AUTOSUSPEND = n
@ -75,18 +68,14 @@ CONFIG_80211W = n
CONFIG_REDUCE_TX_CPU_LOADING = n
CONFIG_BR_EXT = y
CONFIG_TDLS = n
CONFIG_WIFI_MONITOR = y
# If you are setting up AP (e.g. by hostapd) in 802.11ac mode, you may have to choose 'y' below.
# Otherwise some channels may be flagged 'NO-IR' (i.e. Passive scanning) by the driver.
# Please check your country's regulatory domain first,
# to see whether active scanning is permitted by law/regulations on the desired channels.
CONFIG_DISABLE_REGD_C=y
CONFIG_WIFI_MONITOR = n
CONFIG_MCC_MODE = n
CONFIG_APPEND_VENDOR_IE_ENABLE = n
CONFIG_RTW_NAPI = y
CONFIG_RTW_GRO = y
CONFIG_RTW_IPCAM_APPLICATION = n
CONFIG_RTW_REPEATER_SON = n
CONFIG_RTW_WIFI_HAL = y
CONFIG_VHT_EXTRAS = y
CONFIG_LED_CONTROL = y
CONFIG_LED_ENABLE = y
@ -163,8 +152,6 @@ CONFIG_PLATFORM_NOVATEK_NT72668 = n
CONFIG_PLATFORM_HISILICON = n
CONFIG_PLATFORM_NV_TK1 = n
CONFIG_PLATFORM_RTL8197D = n
CONFIG_PLATFORM_ARM_ODROIDC2 = n
CONFIG_PLATFORM_PPC = n
###############################################################
CONFIG_DRVEXT_MODULE = n
@ -172,10 +159,6 @@ CONFIG_DRVEXT_MODULE = n
export TopDIR ?= $(shell pwd)
########### COMMON #################################
ifeq ($(CONFIG_DISABLE_REGD_C), y)
EXTRA_CFLAGS += -DCONFIG_DISABLE_REGD_C
endif
ifeq ($(CONFIG_GSPI_HCI), y)
HCI_NAME = gspi
endif
@ -205,7 +188,6 @@ _OS_INTFS_FILES := os_dep/osdep_service.o \
os_dep/linux/rtw_cfgvendor.o \
os_dep/linux/wifi_regd.o \
os_dep/linux/rtw_android.o \
os_dep/linux/rtw_radiotap.o \
os_dep/linux/rtw_proc.o
ifeq ($(CONFIG_MP_INCLUDED), y)
@ -470,7 +452,7 @@ endif
EXTRA_CFLAGS += -DCONFIG_RTL8821A
_HAL_INTFS_FILES += hal/rtl8812a/hal8821a_fw.o
endif
endif
@ -978,6 +960,12 @@ EXTRA_CFLAGS += -DCONFIG_WIFI_MONITOR
endif
endif
ifeq ($(CONFIG_RTW_WIFI_HAL), y)
#EXTRA_CFLAGS += -DCONFIG_RTW_WIFI_HAL_DEBUG
EXTRA_CFLAGS += -DCONFIG_RTW_WIFI_HAL
EXTRA_CFLAGS += -DCONFIG_RTW_CFGVEDNOR_LLSTATS
endif
ifeq ($(CONFIG_VHT_EXTRAS), y)
EXTRA_CFLAGS += -DCONFIG_VHT_EXTRAS
endif
@ -1014,7 +1002,7 @@ EXTRA_CFLAGS += -DDM_ODM_SUPPORT_TYPE=0x04
ifeq ($(CONFIG_PLATFORM_I386_PC), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ | sed -e s/aarch64/arm64/ )
SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?=
KVER := $(shell uname -r)
@ -1271,15 +1259,13 @@ endif
ifeq ($(CONFIG_PLATFORM_FS_MX61), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
ARCH := arm
CROSS_COMPILE ?=
KVER ?= $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
INSTALL_PREFIX :=
CROSS_COMPILE := /home/share/CusEnv/FreeScale/arm-eabi-4.4.3/bin/arm-eabi-
KSRC ?= /home/share/CusEnv/FreeScale/FS_kernel_env
endif
ifeq ($(CONFIG_PLATFORM_ACTIONS_ATJ227X), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ACTIONS_ATJ227X
ARCH := mips
@ -1522,17 +1508,6 @@ CROSS_COMPILE := /home/android_sdk/Allwinner/a20/kitkat-a20_v4.4/lichee/out/andr
KSRC := /home/android_sdk/Allwinner/a20/kitkat-a20_v4.4/lichee/linux-3.4
endif
ifeq ($(CONFIG_PLATFORM_PPC), y)
EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN
SUBARCH := $(shell uname -m | sed -e s/ppc/powerpc/)
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?=
KVER ?= $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
INSTALL_PREFIX :=
endif
ifeq ($(CONFIG_PLATFORM_ARM_SUN8I_W3P1), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUN8I
@ -1763,7 +1738,7 @@ ARCH := arm
CROSS_COMPILE := /home/android_sdk/Telechips/v13.05_r1-tcc-android-4.2.2_tcc893x-evm_build/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
KSRC := /home/android_sdk/Telechips/v13.05_r1-tcc-android-4.2.2_tcc893x-evm_build/kernel
MODULE_NAME := wlan
endif
endif
ifeq ($(CONFIG_PLATFORM_RTL8197D), y)
EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN -DCONFIG_PLATFORM_RTL8197D
@ -1773,17 +1748,6 @@ CROSS_COMPILE:= $(DIR_LINUX)/../toolchain/rsdk-1.5.5-5281-EB-2.6.30-0.9.30.3-110
KSRC := $(DIR_LINUX)
endif
ifeq ($(CONFIG_PLATFORM_ARM_ODROIDC2), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
ARCH ?= arm64
CROSS_COMPILE ?=
KVER ?= $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
INSTALL_PREFIX :=
endif
ifeq ($(CONFIG_MULTIDRV), y)
ifeq ($(CONFIG_SDIO_HCI), y)
@ -1836,7 +1800,7 @@ rtk_core := core/rtw_cmd.o \
core/rtw_btcoex.o \
core/rtw_beamforming.o \
core/rtw_odm.o \
core/efuse/rtw_efuse.o
core/efuse/rtw_efuse.o
ifeq ($(CONFIG_SDIO_HCI), y)
rtk_core += core/rtw_sdio.o
@ -1870,7 +1834,7 @@ export CONFIG_RTL8812AU = m
all: modules
modules:
$(MAKE) -j $(shell nproc || echo 1) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(shell pwd) modules
$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(shell pwd) modules
strip:
$(CROSS_COMPILE)strip $(MODULE_NAME).ko --strip-unneeded
@ -1926,17 +1890,18 @@ config_r:
clean:
#$(MAKE) -C $(KSRC) M=$(shell pwd) clean
cd hal ; rm -fr */*/*/*.mod.c */*/*/*.mod */*/*/*.o */*/*/.*.cmd */*/*/*.ko
cd hal ; rm -fr */*/*.mod.c */*/*.mod */*/*.o */*/.*.cmd */*/*.ko
cd hal ; rm -fr */*.mod.c */*.mod */*.o */.*.cmd */*.ko
cd hal ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
cd core/efuse ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
cd core ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
cd os_dep/linux ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko .rtw_radiotap.o.d
cd os_dep ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
cd platform ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
cd hal ; rm -fr */*/*/*.mod.c */*/*/*.mod */*/*/*.o */*/*/*.o.* */*/*/.*.cmd */*/*/*.ko
cd hal ; rm -fr */*/*.mod.c */*/*.mod */*/*.o */*/*.o.* */*/.*.cmd */*/*.ko
cd hal ; rm -fr */*.mod.c */*.mod */*.o */*.o.* */.*.cmd */*.ko
cd hal ; rm -fr *.mod.c *.mod *.o *.o.* .*.cmd *.ko
cd core/efuse ; rm -fr *.mod.c *.mod *.o *.o.* .*.cmd *.ko
cd core ; rm -fr *.mod.c *.mod *.o *.o.* .*.cmd *.ko
cd os_dep/linux ; rm -fr *.mod.c *.mod *.o *.o.* .*.cmd *.ko
cd os_dep ; rm -fr *.mod.c *.mod *.o *.o.* .*.cmd *.ko
cd platform ; rm -fr *.mod.c *.mod *.o *.o.* .*.cmd *.ko
rm -fr Module.symvers ; rm -fr Module.markers ; rm -fr modules.order
rm -fr *.mod.c *.mod *.o .*.cmd *.ko *~
rm -fr *.mod.c *.mod *.o *.o.* .*.cmd *.ko *~
rm -fr .tmp_versions
rm -fr .cache.mk
endif

View File

@ -1,6 +1,6 @@
# rtl8812au
## Realtek 8812AU driver v5.2.20 with monitor mode and frame injection
## Realtek 8812AU driver v5.2.20.2 with monitor mode and frame injection
Only supports 8812AU chipset, not the 8814AU or the 8821AU at this point.
@ -31,7 +31,7 @@ $ sudo ./dkms-remove.sh
### Notes
Download
```
git clone -b v5.1.5 https://github.com/aircrack-ng/rtl8812au.git
git clone -b v5.2.20 https://github.com/aircrack-ng/rtl8812au.git
cd rtl*
```
Package / Build dependencies (Kali)

View File

@ -1,8 +1,16 @@
Product: RTL8812A USB Software Package - Linux Driver
Version: v5.2.20_25672.20171213
Version: v5.2.20.2_28373.20180619
Release History:
v5.2.20.2_28373.20180619
Update phydm to improve TP stability
v5.2.20.1_27761.20180508
Support WiFi-HAL for Android 8
v5.2.20_25672.20171213
Update PHYDM setting

View File

@ -1368,7 +1368,7 @@ static void rtw_ap_check_scan(_adapter *padapter)
if (_FALSE == ATOMIC_READ(&pmlmepriv->olbc_ht))
ATOMIC_SET(&pmlmepriv->olbc_ht, _TRUE);
if (padapter->registrypriv.wifi_spec)
RTW_INFO("%s: %s is a/b/g ap\n", __func__, pnetwork->network.Ssid.Ssid);
}
@ -1523,8 +1523,6 @@ void start_bss_network(_adapter *padapter, struct createbss_parm *parm)
chbw_decision:
ch_setting_changed = rtw_ap_chbw_decision(padapter, req_ch, req_bw, req_offset
, &ch_to_set, &bw_to_set, &offset_to_set, &chbw_allow);
RTW_INFO(FUNC_ADPT_FMT": channel setting changed: %d\n"
, FUNC_ADPT_ARG(padapter), ch_setting_changed);
/* let pnetwork_mlme == pnetwork_mlmeext */
_rtw_memcpy(pnetwork, pnetwork_mlmeext, pnetwork_mlmeext->Length);
@ -1538,7 +1536,7 @@ chbw_decision:
#ifdef CONFIG_MCC_MODE
if (MCC_EN(padapter)) {
/*
/*
* due to check under rtw_ap_chbw_decision
* if under MCC mode, means req channel setting is the same as current channel setting
* if not under MCC mode, mean req channel setting is not the same as current channel setting
@ -3991,7 +3989,7 @@ bool rtw_ap_chbw_decision(_adapter *adapter, s16 req_ch, s8 req_bw, s8 req_offse
rtw_hal_set_mcc_setting_disconnect(adapter);
}
}
}
}
#endif /* CONFIG_MCC_MODE */
@ -4097,16 +4095,16 @@ bool rtw_ap_chbw_decision(_adapter *adapter, s16 req_ch, s8 req_bw, s8 req_offse
goto exit;
}
/* if (rtw_odm_dfs_domain_unknown(adapter) && rtw_is_dfs_chbw(dec_ch, dec_bw, dec_offset)) { */
/* if (req_ch >= 0) */
/* RTW_WARN(FUNC_ADPT_FMT" DFS channel %u,%u,%u can't be used\n", FUNC_ADPT_ARG(adapter), dec_ch, dec_bw, dec_offset); */
/* if (req_ch > 0) { */
/* /\* specific channel and not from IE => don't change channel setting *\/ */
/* *chbw_allow = _FALSE; */
/* goto exit; */
/* } */
/* goto choose_chbw; */
/* } */
if (rtw_odm_dfs_domain_unknown(adapter) && rtw_is_dfs_chbw(dec_ch, dec_bw, dec_offset)) {
if (req_ch >= 0)
RTW_WARN(FUNC_ADPT_FMT" DFS channel %u,%u,%u can't be used\n", FUNC_ADPT_ARG(adapter), dec_ch, dec_bw, dec_offset);
if (req_ch > 0) {
/* specific channel and not from IE => don't change channel setting */
*chbw_allow = _FALSE;
goto exit;
}
goto choose_chbw;
}
if (rtw_chset_is_ch_non_ocp(adapter_to_chset(adapter), dec_ch, dec_bw, dec_offset) == _FALSE)
goto update_bss_chbw;

View File

@ -129,6 +129,10 @@ void dump_drv_cfg(void *sel)
RTW_PRINT_SEL(sel, "CONFIG_RTW_80211R\n");
#endif
#ifdef CONFIG_RTW_WIFI_HAL
RTW_PRINT_SEL(sel, "CONFIG_RTW_WIFI_HAL\n");
#endif
#ifdef CONFIG_USB_HCI
#ifdef CONFIG_SUPPORT_USB_INT
RTW_PRINT_SEL(sel, "CONFIG_SUPPORT_USB_INT\n");

View File

@ -1639,7 +1639,7 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame)
ptable->func = &OnAuth;
else
ptable->func = &OnAuthClient;
/* Intentional fallthrough */
/* pass through */
case WIFI_ASSOCREQ:
case WIFI_REASSOCREQ:
_mgt_dispatcher(padapter, ptable, precv_frame);
@ -2435,15 +2435,14 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
if (rtw_is_list_empty(&pstat->asoc_list) == _FALSE) {
rtw_list_delete(&pstat->asoc_list);
pstapriv->asoc_list_cnt--;
if (pstat->expire_to > 0) {
if (pstat->expire_to > 0)
;/* TODO: STA re_auth within expire_to */
}
}
_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
if (seq == 1) {
if (seq == 1)
; /* TODO: STA re_auth and auth timeout */
}
}
}
@ -7212,15 +7211,14 @@ void update_monitor_frame_attrib(_adapter *padapter, struct pkt_attrib *pattrib)
u8 wireless_mode;
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
// struct sta_info *psta = NULL;
// struct sta_priv *pstapriv = &padapter->stapriv;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
// psta = rtw_get_stainfo(pstapriv, pattrib->ra);
psta = rtw_get_stainfo(pstapriv, pattrib->ra);
pattrib->hdrlen = 24;
pattrib->nr_frags = 1;
pattrib->priority = 7;
pattrib->inject = 0xa5;
pattrib->mac_id = RTW_DEFAULT_MGMT_MACID;
pattrib->qsel = QSLT_MGNT;
@ -7260,7 +7258,7 @@ void update_monitor_frame_attrib(_adapter *padapter, struct pkt_attrib *pattrib)
pattrib->seqnum = pmlmeext->mgnt_seq;
pattrib->retry_ctrl = _FALSE;
pattrib->retry_ctrl = _TRUE;
pattrib->mbssid = 0;
pattrib->hw_ssn_sel = pxmitpriv->hw_ssn_seq_no;

View File

@ -539,7 +539,10 @@ static void PHY_SetRFPathSwitch(PADAPTER padapter , BOOLEAN bMain) {
#endif
} else if (IS_HARDWARE_TYPE_8812(padapter) || IS_HARDWARE_TYPE_8821(padapter)) {
#if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A)
phy_set_rf_path_switch_8812a(padapter, bMain);
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(padapter);
struct PHY_DM_STRUCT *dm = &hal_data->odmpriv;
phy_set_rf_path_switch_8812a(dm, bMain);
#endif
} else if (IS_HARDWARE_TYPE_8192E(padapter)) {
#ifdef CONFIG_RTL8192E

View File

@ -85,6 +85,10 @@ void _ips_enter(_adapter *padapter)
if (pwrpriv->ips_mode == IPS_LEVEL_2)
pwrpriv->bkeepfwalive = _TRUE;
#ifdef CONFIG_RTW_CFGVEDNOR_LLSTATS
pwrpriv->pwr_saving_start_time = rtw_get_current_time();
#endif /* CONFIG_RTW_CFGVEDNOR_LLSTATS */
rtw_ips_pwr_down(padapter);
pwrpriv->rf_pwrstate = rf_off;
}
@ -120,6 +124,11 @@ int _ips_leave(_adapter *padapter)
result = rtw_ips_pwr_up(padapter);
if (result == _SUCCESS)
pwrpriv->rf_pwrstate = rf_on;
#ifdef CONFIG_RTW_CFGVEDNOR_LLSTATS
pwrpriv->pwr_saving_time += rtw_get_passing_time_ms(pwrpriv->pwr_saving_start_time);
#endif /* CONFIG_RTW_CFGVEDNOR_LLSTATS */
RTW_PRINT("nolinked power save leave\n");
RTW_INFO("==> ips_leave.....LED(0x%08x)...\n", rtw_read32(padapter, 0x4c));
@ -1109,6 +1118,11 @@ void LPS_Enter(PADAPTER padapter, const char *msg)
sprintf(buf, "WIFI-%s", msg);
pwrpriv->bpower_saving = _TRUE;
#ifdef CONFIG_RTW_CFGVEDNOR_LLSTATS
pwrpriv->pwr_saving_start_time = rtw_get_current_time();
#endif /* CONFIG_RTW_CFGVEDNOR_LLSTATS */
rtw_set_ps_mode(padapter, pwrpriv->power_mgnt, padapter->registrypriv.smart_ps, 0, buf);
}
} else
@ -1153,6 +1167,10 @@ void LPS_Leave(PADAPTER padapter, const char *msg)
sprintf(buf, "WIFI-%s", msg);
rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, buf);
#ifdef CONFIG_RTW_CFGVEDNOR_LLSTATS
pwrpriv->pwr_saving_time += rtw_get_passing_time_ms(pwrpriv->pwr_saving_start_time);
#endif /* CONFIG_RTW_CFGVEDNOR_LLSTATS */
if (pwrpriv->pwr_mode == PS_MODE_ACTIVE)
LPS_RF_ON_check(padapter, LPS_LEAVE_TIMEOUT_MS);
}

View File

@ -2253,9 +2253,8 @@ sint validate_recv_frame(_adapter *adapter, union recv_frame *precv_frame)
dump_rx_packet(ptr);
}
#endif
} else {
} else
DBG_COUNTER(adapter->rx_logs.core_rx_pre_data_handled);
}
break;
default:
DBG_COUNTER(adapter->rx_logs.core_rx_pre_unknown);

View File

@ -2277,9 +2277,9 @@ int rtw_get_bcn_keys(ADAPTER *Adapter, u8 *pframe, u32 packet_len,
_rtw_memcpy(recv_beacon->ssid, elems.ssid, elems.ssid_len);
recv_beacon->ssid_len = elems.ssid_len;
} else {
} else
; /* means hidden ssid */
}
/* checking RSN first */
if (elems.rsn_ie && elems.rsn_ie_len) {
recv_beacon->encryp_protocol = ENCRYP_PROTOCOL_WPA2;

View File

@ -1331,9 +1331,9 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr
_rtw_memcpy(pattrib->ra, pattrib->dst, ETH_ALEN);
_rtw_memcpy(pattrib->ta, get_bssid(pmlmepriv), ETH_ALEN);
DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_ap);
} else {
} else
DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_unknown);
}
bmcast = IS_MCAST(pattrib->ra);
if (bmcast) {
psta = rtw_get_bcmc_stainfo(padapter);
@ -4214,28 +4214,7 @@ static void do_queue_select(_adapter *padapter, struct pkt_attrib *pattrib)
* 0 success, hardware will handle this xmit frame(packet)
* <0 fail
*/
int rtw_ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
int rtw_ieee80211_radiotap_iterator_init(
struct ieee80211_radiotap_iterator *iterator,
struct ieee80211_radiotap_header *radiotap_header,
int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24))
static struct xmit_frame* monitor_alloc_mgtxmitframe(struct xmit_priv *pxmitpriv) {
int tries;
int delay = 300;
struct xmit_frame *pmgntframe = NULL;
for(tries = 3; tries >= 0; tries--) {
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
if(pmgntframe != NULL)
return pmgntframe;
rtw_udelay_os(delay);
delay += delay/2;
}
return NULL;
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24))
s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
{
int ret = 0;
@ -4249,22 +4228,8 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
unsigned char dst_mac_addr[6];
struct rtw_ieee80211_hdr *dot11_hdr;
struct ieee80211_radiotap_header *rtap_hdr;
struct ieee80211_radiotap_iterator iterator;
u8 fixed_rate = MGN_1M, sgi = 0, bwidth = 0, ldpc = 0, stbc = 0;
u16 txflags = 0;
_adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
unsigned char *pframe;
struct rtw_ieee80211_hdr *pwlanhdr;
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
u8 *buf = skb->data;
u32 len = skb->len;
u8 category, action;
int type = -1;
if (skb)
rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize);
@ -4279,128 +4244,110 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
if (unlikely(skb->len < rtap_len))
goto fail;
if ((pmgntframe = monitor_alloc_mgtxmitframe(pxmitpriv)) == NULL) {
DBG_COUNTER(padapter->tx_logs.core_tx_err_pxmitframe);
return NETDEV_TX_BUSY;
if (rtap_len != 12) {
RTW_INFO("radiotap len (should be 14): %d\n", rtap_len);
goto fail;
}
ret = rtw_ieee80211_radiotap_iterator_init(&iterator, rtap_hdr, skb->len, NULL);
while (!ret) {
ret = rtw_ieee80211_radiotap_iterator_next(&iterator);
if (ret)
continue;
/* see if this argument is something we can use */
switch (iterator.this_arg_index) {
case IEEE80211_RADIOTAP_RATE: /* u8 */
fixed_rate = *iterator.this_arg;
break;
case IEEE80211_RADIOTAP_TX_FLAGS:
txflags = get_unaligned_le16(iterator.this_arg);
break;
case IEEE80211_RADIOTAP_MCS: { /* u8,u8,u8 */
u8 mcs_have = iterator.this_arg[0];
if (mcs_have & IEEE80211_RADIOTAP_MCS_HAVE_MCS) {
fixed_rate = iterator.this_arg[2] & 0x7f;
if(fixed_rate > 31)
fixed_rate = 0;
fixed_rate += MGN_MCS0;
}
if ((mcs_have & 4) &&
(iterator.this_arg[1] & 4))
sgi = 1;
if ((mcs_have & 1) &&
(iterator.this_arg[1] & 1))
bwidth = 1;
if ((mcs_have & 0x10) &&
(iterator.this_arg[1] & 0x10))
ldpc = 1;
if ((mcs_have & 0x20))
stbc = (iterator.this_arg[1] >> 5) & 3;
}
break;
case IEEE80211_RADIOTAP_VHT: {
/* u16 known, u8 flags, u8 bandwidth, u8 mcs_nss[4], u8 coding, u8 group_id, u16 partial_aid */
u8 known = iterator.this_arg[0];
u8 flags = iterator.this_arg[2];
unsigned int mcs, nss;
if((known & 4) && (flags & 4))
sgi = 1;
if((known & 1) && (flags & 1))
stbc = 1;
if(known & 0x40) {
bwidth = iterator.this_arg[3] & 0x1f;
if(bwidth>=1 && bwidth<=3)
bwidth = 1; // 40 MHz
else if(bwidth>=4 && bwidth<=10)
bwidth = 2; // 80 MHz
else
bwidth = 0; // 20 MHz
}
if(iterator.this_arg[8] & 1)
ldpc = 1;
mcs = (iterator.this_arg[4]>>4) & 0x0f;
nss = iterator.this_arg[4] & 0x0f;
if(nss > 0) {
if(nss > 4) nss = 4;
if(mcs > 9) mcs = 9;
fixed_rate = MGN_VHT1SS_MCS0 + ((nss-1)*10 + mcs);
}
}
break;
default:
break;
}
}
/* Skip the ratio tap header */
skb_pull(skb, rtap_len);
// dot11_hdr = (struct ieee80211_hdr *)skb->data;
// frame_ctl = le16_to_cpu(dot11_hdr->frame_control);
dot11_hdr = (struct rtw_ieee80211_hdr *)skb->data;
frame_ctl = le16_to_cpu(dot11_hdr->frame_ctl);
/* Check if the QoS bit is set */
pattrib = &pmgntframe->attrib;
update_monitor_frame_attrib(padapter, pattrib);
if ((frame_ctl & RTW_IEEE80211_FCTL_FTYPE) == RTW_IEEE80211_FTYPE_DATA) {
_rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
unsigned char *pframe;
struct rtw_ieee80211_hdr *pwlanhdr;
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
u8 *buf = skb->data;
u32 len = skb->len;
u8 category, action;
int type = -1;
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
if (pmgntframe == NULL) {
rtw_udelay_os(500);
goto fail;
}
pattrib = &pmgntframe->attrib;
_rtw_memcpy(pframe, (void*)skb->data, skb->len);
update_monitor_frame_attrib(padapter, pattrib);
pattrib->pktlen = skb->len;
pattrib->retry_ctrl = _FALSE;
//printk("**** rt mcs %x rate %x raid %d sgi %d bwidth %d ldpc %d stbc %d txflags %x\n", fixed_rate, pattrib->rate, pattrib->raid, sgi, bwidth, ldpc, stbc, txflags);
pattrib->rate = fixed_rate;
pattrib->sgi = sgi;
pattrib->bwmode = bwidth; // 0-20 MHz, 1-40 MHz, 2-80 MHz
pattrib->ldpc = ldpc;
pattrib->stbc = stbc;
pattrib->retry_ctrl = (txflags & 0x08)?_FALSE:_TRUE;
_rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
_rtw_memcpy(pframe, (void *)buf, len);
pmlmeext->mgnt_seq = GetSequence(pwlanhdr);
pattrib->seqnum = pmlmeext->mgnt_seq;
pmlmeext->mgnt_seq++;
pattrib->pktlen = len;
pattrib->last_txcmdsz = pattrib->pktlen;
dump_mgntframe(padapter, pmgntframe);
DBG_COUNTER(padapter->tx_logs.core_tx);
pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
if (is_broadcast_mac_addr(pwlanhdr->addr3) || is_broadcast_mac_addr(pwlanhdr->addr1))
pattrib->rate = MGN_24M;
pmlmeext->mgnt_seq = GetSequence(pwlanhdr);
pattrib->seqnum = pmlmeext->mgnt_seq;
pmlmeext->mgnt_seq++;
pattrib->last_txcmdsz = pattrib->pktlen;
dump_mgntframe(padapter, pmgntframe);
} else {
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
unsigned char *pframe;
struct rtw_ieee80211_hdr *pwlanhdr;
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
u8 *buf = skb->data;
u32 len = skb->len;
u8 category, action;
int type = -1;
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
if (pmgntframe == NULL)
goto fail;
pattrib = &pmgntframe->attrib;
update_mgntframe_attrib(padapter, pattrib);
pattrib->retry_ctrl = _FALSE;
_rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
_rtw_memcpy(pframe, (void *)buf, len);
pattrib->pktlen = len;
pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
pmlmeext->mgnt_seq = GetSequence(pwlanhdr);
pattrib->seqnum = pmlmeext->mgnt_seq;
pmlmeext->mgnt_seq++;
pattrib->last_txcmdsz = pattrib->pktlen;
dump_mgntframe(padapter, pmgntframe);
}
fail:
rtw_skb_free(skb);
return NETDEV_TX_OK;
return 0;
}
#endif
/*
* The main transmit(tx) entry
*

View File

@ -1,23 +0,0 @@
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "You must run this with superuser priviliges. Try \"sudo ./dkms-install.sh\"" 2>&1
exit 1
else
echo "About to run dkms install steps..."
fi
DRV_DIR=rtl8812au
DRV_NAME=rtl8812au
DRV_VERSION=5.2.20
cp -r ../${DRV_DIR} /usr/src/${DRV_NAME}-${DRV_VERSION}
dkms add -m ${DRV_NAME} -v ${DRV_VERSION}
dkms build -m ${DRV_NAME} -v ${DRV_VERSION}
dkms install -m ${DRV_NAME} -v ${DRV_VERSION}
RESULT=$?
echo "Finished running dkms install steps."
exit $RESULT

View File

@ -1,24 +0,0 @@
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "You must run this with superuser priviliges. Try \"sudo ./dkms-remove.sh\"" 2>&1
exit 1
else
echo "About to run dkms removal steps..."
fi
DRV_DIR=rtl8812au
DRV_NAME=rtl8812au
DRV_VERSION=5.2.20
dkms remove ${DRV_NAME}/${DRV_VERSION} --all
rm -rf /usr/src/${DRV_NAME}-${DRV_VERSION}
RESULT=$?
if [[ "$RESULT" != "0" ]]; then
echo "Error occurred while running dkms remove." 2>&1
else
echo "Finished running dkms removal steps."
fi
exit $RESULT

View File

@ -1,10 +1,10 @@
PACKAGE_NAME="realtek-rtl8812au"
PACKAGE_VERSION="5.2.20~20180701"
PACKAGE_NAME="@PKGBASE@"
PACKAGE_VERSION="@PKGVER@"
BUILT_MODULE_NAME[0]="8812au"
PROCS_NUM=`nproc`
[ $PROCS_NUM -gt 16 ] && PROCS_NUM=16
MAKE="'make' -j$PROCS_NUM KVER=${kernelver} KSRC=/lib/modules/${kernelver}/build"
CLEAN="'make' clean"
DEST_MODULE_LOCATION[0]="/updates"
DEST_MODULE_LOCATION[0]="/updates/dkms"
AUTOINSTALL="yes"
REMAKE_INITRD=no

View File

@ -1,57 +0,0 @@
kimocoder's changelog (goes beyond the Realtek changelog)
----------------------------------------------------------------------------------------
TODO:
- Fix count for frames in RadioTap header (add to stats)
- Place signal quality and per antenna rssi into radiotap header
- Calculate signal quality in the monitor mode
- Add channels 151 and 153
- Unmask all available channels
- Switch channels to 80 MHz widt in monitor mode
- Enable channel 14 and 80 MHz width in the regdom
- Switch channel in monitor mode
- Fix error switching to 80MHz channels under certain conditions
- Use configured driver name
- Disable driver debug output by default
- Fix is_compat_task() issue
- Use in_compat_syscall() instead of is_compat_task() if available
- Add support mode more adapters
- Add a more informational README
+++ And propably alot more. We'll see.
[2018.07.01]
- Fixed compilation warnings (brackets missing etc)
[2018.06.26]
- Enable TX queue in the monitor mode
- Add support for namespaces (CONFIG_NET_NS)
[2018.06.25]
- Fix injected frames drop
- Fixed compilation on some ARM platforms
- Added support for PPC platform
- Minor cleanups
[2018.06.23]
- Added more VID/PID's + moved 1 to correct place
- Moved changelogs into "docs/" folder
[2018.06.22]
- Enabled monitor mode
- Parse radiotap headers for proper frame injection
- RadioTap iterator from kernel 4.9 was added due to VHT field bug in kernels before 4.6
- Disabled DFS
- Enable DBG_TX_POWER_IDX and DBG_PG_TXPWR_READ, added extra logging for these
- Disabled AP mode channel switching due to DFS checks
- Tweaked & optimized Makefile to compile with all cores available. Decreasing the compile time.
- Added switch to turn ON/OFF regdomain settings (Makefile)
- Added ODROID-C2 support
- Added 2 more VID/PID's
- Fixed dkms.conf and added dkms-install.sh and dkms-remove.sh
- Cleaned up some files & execution permissions.

View File

@ -52,10 +52,6 @@ const char *const _pg_txpwr_src_str[] = {
#define DBG_PG_TXPWR_READ 0
#endif
#ifndef DBG_TX_POWER_IDX
#define DBG_TX_POWER_IDX 0
#endif
#if DBG_PG_TXPWR_READ
static void dump_pg_txpwr_info_2g(void *sel, TxPowerInfo24G *txpwr_info, u8 rfpath_num, u8 max_tx_cnt)
{
@ -1362,10 +1358,6 @@ phy_SetTxPowerByRateBase(
return;
}
if (DBG_TX_POWER_IDX)
RTW_INFO( "TXPWR: by-rate-base [%sG][%c] RateSection:%d = %d\n",
(Band == BAND_ON_2_4G) ? "2.4" : "5", rf_path_char(RfPath), RateSection, Value );
if (Band == BAND_ON_2_4G)
pHalData->TxPwrByRateBase2_4G[RfPath][RateSection] = Value;
else /* BAND_ON_5G */
@ -2663,11 +2655,6 @@ PHY_SetTxPowerByRate(
return;
}
if (DBG_TX_POWER_IDX)
RTW_INFO( "TXPWR: by-rate-base [%sG][%c] Rate:%s = %d\n",
(Band == BAND_ON_2_4G) ? "2.4" : "5", rf_path_char(RFPath),
MGN_RATE_STR(rateIndex), Value );
pHalData->TxPwrByRateOffset[Band][RFPath][rateIndex] = Value;
}
@ -2706,6 +2693,10 @@ phy_set_tx_power_level_by_path(
}
}
#ifndef DBG_TX_POWER_IDX
#define DBG_TX_POWER_IDX 0
#endif
VOID
PHY_SetTxPowerIndexByRateArray(
IN PADAPTER pAdapter,
@ -2722,6 +2713,7 @@ PHY_SetTxPowerIndexByRateArray(
for (i = 0; i < RateArraySize; ++i) {
#if DBG_TX_POWER_IDX
struct txpwr_idx_comp tic;
powerIndex = rtw_hal_get_tx_power_index(pAdapter, RFPath, Rates[i], BandWidth, Channel, &tic);
RTW_INFO("TXPWR: [%c][%s]ch:%u, %s %uT, pwr_idx:%u = %u + (%d=%d:%d) + (%d) + (%d)\n"
, rf_path_char(RFPath), ch_width_str(BandWidth), Channel, MGN_RATE_STR(Rates[i]), tic.ntx_idx + 1
@ -3508,10 +3500,6 @@ PHY_SetTxPowerIndex(
IN u8 Rate
)
{
/* if (DBG_TX_POWER_IDX) */
/* RTW_INFO( "TXPWR: set-index [%c] %s pwr_idx:%u\n", */
/* rf_path_char(RFPath), MGN_RATE_STR(Rate), PowerIndex ); */
if (IS_HARDWARE_TYPE_8814A(pAdapter)) {
#if (RTL8814A_SUPPORT == 1)
PHY_SetTxPowerIndex_8814A(pAdapter, PowerIndex, RFPath, Rate);

View File

@ -933,7 +933,6 @@ s32 c2h_handler(_adapter *adapter, u8 id, u8 seq, u8 plen, u8 *payload)
case C2H_EXTEND:
sub_id = payload[0];
/* Intentional fallthrough */
/* no handle, goto default */
default:

View File

@ -1006,6 +1006,20 @@ halrf_cmn_info_set(
case HALRF_CMNINFO_RATE_INDEX:
p_rf->p_rate_index = (u32)value;
break;
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
case HALRF_CMNINFO_MP_PSD_POINT:
p_rf->halrf_psd_data.point = (u32)value;
break;
case HALRF_CMNINFO_MP_PSD_START_POINT:
p_rf->halrf_psd_data.start_point = (u32)value;
break;
case HALRF_CMNINFO_MP_PSD_STOP_POINT:
p_rf->halrf_psd_data.stop_point = (u32)value;
break;
case HALRF_CMNINFO_MP_PSD_AVERAGE:
p_rf->halrf_psd_data.average = (u32)value;
break;
#endif
default:
/* do nothing */
break;

View File

@ -20,7 +20,7 @@
/*============================================================*/
/*include files*/
/*============================================================*/
#include "halrf/halrf_psd.h"
/*============================================================*/
@ -30,29 +30,29 @@
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
#define IQK_VERSION_8188E "0x14"
#define IQK_VERSION_8192E "0x01"
#define IQK_VERSION_8723B "0x1d"
#define IQK_VERSION_8723B "0x1e"
#define IQK_VERSION_8812A "0x01"
#define IQK_VERSION_8821A "0x01"
#elif (DM_ODM_SUPPORT_TYPE & (ODM_CE))
#define IQK_VERSION_8188E "0x01"
#define IQK_VERSION_8192E "0x01"
#define IQK_VERSION_8723B "0x19"
#define IQK_VERSION_8723B "0x1e"
#define IQK_VERSION_8812A "0x01"
#define IQK_VERSION_8821A "0x01"
#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP))
#define IQK_VERSION_8188E "0x01"
#define IQK_VERSION_8192E "0x01"
#define IQK_VERSION_8723B "0x01"
#define IQK_VERSION_8723B "0x1e"
#define IQK_VERSION_8812A "0x01"
#define IQK_VERSION_8821A "0x01"
#endif
#define IQK_VERSION_8814A "0x0f"
#define IQK_VERSION_8188F "0x01"
#define IQK_VERSION_8197F "0x01"
#define IQK_VERSION_8703B "0x04"
#define IQK_VERSION_8703B "0x05"
#define IQK_VERSION_8710B "0x01"
#define IQK_VERSION_8723D "0x01"
#define IQK_VERSION_8822B "0x2e"
#define IQK_VERSION_8723D "0x02"
#define IQK_VERSION_8822B "0x2f"
#define IQK_VERSION_8821C "0x23"
/*LCK version*/
@ -123,7 +123,11 @@ enum halrf_cmninfo_init_e {
HALRF_CMNINFO_FW_VER,
HALRF_CMNINFO_RFK_FORBIDDEN,
HALRF_CMNINFO_IQK_SEGMENT,
HALRF_CMNINFO_RATE_INDEX
HALRF_CMNINFO_RATE_INDEX,
HALRF_CMNINFO_MP_PSD_POINT,
HALRF_CMNINFO_MP_PSD_START_POINT,
HALRF_CMNINFO_MP_PSD_STOP_POINT,
HALRF_CMNINFO_MP_PSD_AVERAGE
};
enum halrf_cmninfo_hook_e {
@ -161,6 +165,9 @@ struct _hal_rf_ {
u8 *p_mp_rate_index;
u32 p_rate_index;
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
struct _halrf_psd_data halrf_psd_data;
#endif
};
/*============================================================*/

View File

@ -259,8 +259,6 @@ phydm_clear_kfree_to_rf_8821c(
));
}
void
phydm_get_thermal_trim_offset_8822b(
void *p_dm_void
@ -560,6 +558,104 @@ phydm_clear_kfree_to_rf_8822b(
));
}
void
phydm_get_thermal_trim_offset_8710b(
void *p_dm_void)
{
struct PHY_DM_STRUCT *p_dm = (struct PHY_DM_STRUCT *)p_dm_void;
struct odm_power_trim_data *p_power_trim_info = &(p_dm->power_trim_data);
u8 pg_therm = 0xff;
odm_efuse_one_byte_read(p_dm, 0x0EF, &pg_therm, false);
if (pg_therm != 0xff) {
pg_therm = pg_therm & 0x1f;
if ((pg_therm & BIT(0)) == 0)
p_power_trim_info->thermal = (-1 * (pg_therm >> 1));
else
p_power_trim_info->thermal = (pg_therm >> 1);
p_power_trim_info->flag |= KFREE_FLAG_THERMAL_K_ON;
}
ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8710b thermal trim flag:0x%02x\n", p_power_trim_info->flag));
if (p_power_trim_info->flag & KFREE_FLAG_THERMAL_K_ON)
ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8710b thermal:%d\n", p_power_trim_info->thermal));
}
void
phydm_get_power_trim_offset_8710b(
void *p_dm_void
)
{
struct PHY_DM_STRUCT *p_dm = (struct PHY_DM_STRUCT *)p_dm_void;
struct odm_power_trim_data *p_power_trim_info = &(p_dm->power_trim_data);
struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm->rf_calibrate_info);
u8 pg_power = 0xff;
odm_efuse_one_byte_read(p_dm, 0xEE, &pg_power, false);
if (pg_power != 0xff) {
/*Path A*/
odm_efuse_one_byte_read(p_dm, 0xEE, &pg_power, false);
p_power_trim_info->bb_gain[0][0] = (pg_power & 0xf);
p_power_trim_info->flag |= KFREE_FLAG_ON_2G;
p_power_trim_info->flag |= KFREE_FLAG_ON;
}
ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8710b power trim flag:0x%02x\n", p_power_trim_info->flag));
if (p_power_trim_info->flag & KFREE_FLAG_ON)
ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] 8710b power_trim_data->bb_gain[0][0]=0x%X\n", p_power_trim_info->bb_gain[0][0]));
}
void
phydm_set_kfree_to_rf_8710b(
void *p_dm_void,
u8 e_rf_path,
u8 data
)
{
struct PHY_DM_STRUCT *p_dm = (struct PHY_DM_STRUCT *)p_dm_void;
struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm->rf_calibrate_info);
odm_set_rf_reg(p_dm, e_rf_path, 0x55, BIT(19), (data & BIT(0)));
odm_set_rf_reg(p_dm, e_rf_path, 0x55, (BIT(18) | BIT(17) | BIT(16) | BIT(15)), ((data & 0xf) >> 1));
ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD,
("[kfree] 8710b 0x55[19:14]=0x%X path=%d\n",
odm_get_rf_reg(p_dm, e_rf_path, 0x55, (BIT(19) | BIT(18) | BIT(17) | BIT(16) | BIT(15) | BIT(14))),
e_rf_path
));
}
void
phydm_clear_kfree_to_rf_8710b(
void *p_dm_void,
u8 e_rf_path,
u8 data
)
{
struct PHY_DM_STRUCT *p_dm = (struct PHY_DM_STRUCT *)p_dm_void;
struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm->rf_calibrate_info);
odm_set_rf_reg(p_dm, e_rf_path, 0x55, BIT(19), (data & BIT(0)));
odm_set_rf_reg(p_dm, e_rf_path, 0x55, (BIT(18) | BIT(17) | BIT(16) | BIT(15) | BIT(14)), ((data & 0x1f) >> 1));
ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD,
("[kfree] 8710b clear power trim 0x55[19:14]=0x%X path=%d\n",
odm_get_rf_reg(p_dm, e_rf_path, 0x55, (BIT(19) | BIT(18) | BIT(17) | BIT(16) | BIT(15) | BIT(14))),
e_rf_path
));
}
void
@ -581,6 +677,9 @@ phydm_set_kfree_to_rf(
if (p_dm->support_ic_type & ODM_RTL8822B)
phydm_set_kfree_to_rf_8822b(p_dm, e_rf_path, data);
if (p_dm->support_ic_type & ODM_RTL8710B)
phydm_set_kfree_to_rf_8710b(p_dm, e_rf_path, data);
}
@ -599,6 +698,9 @@ phydm_clear_kfree_to_rf(
if (p_dm->support_ic_type & ODM_RTL8821C)
phydm_clear_kfree_to_rf_8821c(p_dm, e_rf_path, 1);
if (p_dm->support_ic_type & ODM_RTL8710B)
phydm_clear_kfree_to_rf_8710b(p_dm, e_rf_path, 1);
}
@ -625,6 +727,8 @@ phydm_get_thermal_trim_offset(
phydm_get_thermal_trim_offset_8821c(p_dm_void);
else if (p_dm->support_ic_type & ODM_RTL8822B)
phydm_get_thermal_trim_offset_8822b(p_dm_void);
else if (p_dm->support_ic_type & ODM_RTL8710B)
phydm_get_thermal_trim_offset_8710b(p_dm_void);
}
@ -650,6 +754,8 @@ phydm_get_power_trim_offset(
phydm_get_power_trim_offset_8821c(p_dm_void);
else if (p_dm->support_ic_type & ODM_RTL8822B)
phydm_get_power_trim_offset_8822b(p_dm_void);
else if (p_dm->support_ic_type & ODM_RTL8710B)
phydm_get_power_trim_offset_8710b(p_dm_void);
}
@ -710,7 +816,7 @@ phydm_config_kfree(
max_rf_path = 4; /*0~3*/
else if (p_dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8192E | ODM_RTL8822B))
max_rf_path = 2; /*0~1*/
else if (p_dm->support_ic_type & ODM_RTL8821C)
else if (p_dm->support_ic_type & (ODM_RTL8821C |ODM_RTL8710B))
max_rf_path = 1;
ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("===>[kfree] phy_ConfigKFree()\n"));
@ -723,12 +829,14 @@ phydm_config_kfree(
/*Make sure the targetval is defined*/
if (p_power_trim_info->flag & KFREE_FLAG_ON) {
/*if kfree_table[0] == 0xff, means no Kfree*/
if (p_dm->support_ic_type &ODM_RTL8710B)
ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] power_trim_data->bb_gain[0][0]=0x%X\n", p_power_trim_info->bb_gain[0][0]));
else if (p_dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8192E | ODM_RTL8822B |ODM_RTL8821C | ODM_RTL8814A)){
for (i = 0; i < KFREE_BAND_NUM; i++) {
for (j = 0; j < max_rf_path; j++)
ODM_RT_TRACE(p_dm, ODM_COMP_MP, ODM_DBG_LOUD, ("[kfree] power_trim_data->bb_gain[%d][%d]=0x%X\n", i, j, p_power_trim_info->bb_gain[i][j]));
}
}
if (*p_dm->p_band_type == ODM_BAND_2_4G && p_power_trim_info->flag & KFREE_FLAG_ON_2G) {
if (channel_to_sw >= 1 && channel_to_sw <= 14)

View File

@ -296,8 +296,6 @@ struct odm_rf_calibration_structure {
/*Add by Yuchen for Kfree Phydm*/
u8 reg_rf_kfree_enable; /*for registry*/
u8 rf_kfree_enable; /*for efuse enable check*/
HALMAC_PWR_TRACKING_OPTION HALMAC_PWR_TRACKING_INFO;
};

328
hal/phydm/halrf/halrf_psd.c Normal file
View File

@ -0,0 +1,328 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2017 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*****************************************************************************/
//============================================================
// include files
//============================================================
#include "mp_precomp.h"
#include "phydm_precomp.h"
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
#if 0
u32 _sqrt(u64 n)
{
u64 ans = 0, q = 0;
s64 i;
/*for (i = sizeof(n) * 8 - 2; i > -1; i = i - 2) {*/
for (i = 8 * 8 - 2; i > -1; i = i - 2) {
q = (q << 2) | ((n & (3 << i)) >> i);
if (q >= ((ans << 2) | 1))
{
q = q - ((ans << 2) | 1);
ans = (ans << 1) | 1;
}
else
ans = ans << 1;
}
DbgPrint("ans=0x%x\n", ans);
return (u32)ans;
}
#endif
u64 _sqrt(u64 x)
{
u64 i = 0;
u64 j = x / 2 + 1;
while (i <= j) {
u64 mid = (i + j) / 2;
u64 sq = mid * mid;
if (sq == x)
return mid;
else if (sq < x)
i = mid + 1;
else
j = mid - 1;
}
return j;
}
u32
halrf_get_psd_data(
void *p_dm_void,
u32 point
)
{
struct PHY_DM_STRUCT *p_dm = (struct PHY_DM_STRUCT *)p_dm_void;
struct _hal_rf_ *p_rf = &(p_dm->rf_table);
struct _halrf_psd_data *p_psd = &(p_rf->halrf_psd_data);
u32 psd_val = 0, psd_reg, psd_report, psd_point, psd_start, i, delay_time;
#if (DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE)
if (p_psd->average == 0)
delay_time = 100;
else
delay_time = 0;
#else
if (p_psd->average == 0)
delay_time = 1000;
else
delay_time = 100;
#endif
if (p_dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821 | ODM_RTL8814A | ODM_RTL8822B | ODM_RTL8821C)) {
psd_reg = 0x910;
psd_report = 0xf44;
} else {
psd_reg = 0x808;
psd_report = 0x8b4;
}
if (p_dm->support_ic_type & ODM_RTL8710B) {
psd_point = 0xeffffc00;
psd_start = 0x10000000;
} else {
psd_point = 0xffbffc00;
psd_start = 0x00400000;
}
psd_val = odm_get_bb_reg(p_dm, psd_reg, MASKDWORD);
psd_val &= psd_point;
psd_val |= point;
odm_set_bb_reg(p_dm, psd_reg, MASKDWORD, psd_val);
psd_val |= psd_start;
odm_set_bb_reg(p_dm, psd_reg, MASKDWORD, psd_val);
for (i = 0; i < delay_time; i++)
ODM_delay_us(1);
psd_val = odm_get_bb_reg(p_dm, psd_report, MASKDWORD);
if (p_dm->support_ic_type & (ODM_RTL8821C | ODM_RTL8710B)) {
psd_val &= MASKL3BYTES;
psd_val = psd_val / 32;
} else
psd_val &= MASKLWORD;
return psd_val;
}
void
halrf_psd(
void *p_dm_void,
u32 point,
u32 start_point,
u32 stop_point,
u32 average
)
{
struct PHY_DM_STRUCT *p_dm = (struct PHY_DM_STRUCT *)p_dm_void;
struct _hal_rf_ *p_rf = &(p_dm->rf_table);
struct _halrf_psd_data *p_psd = &(p_rf->halrf_psd_data);
u32 i = 0, j = 0, k = 0;
u32 psd_reg, avg_org, point_temp, average_tmp;
u64 data_tatal = 0, data_temp[64] = {0};
p_psd->buf_size = 256;
if (average == 0)
average_tmp = 1;
else
average_tmp = average;
if (p_dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821 | ODM_RTL8814A | ODM_RTL8822B | ODM_RTL8821C))
psd_reg = 0x910;
else
psd_reg = 0x808;
#if 0
dbg_print("[PSD]point=%d, start_point=%d, stop_point=%d, average=%d, average_tmp=%d, buf_size=%d\n",
point, start_point, stop_point, average, average_tmp, p_psd->buf_size);
#endif
for (i = 0; i < p_psd->buf_size; i++)
p_psd->psd_data[i] = 0;
if (p_dm->support_ic_type & ODM_RTL8710B)
avg_org = odm_get_bb_reg(p_dm, psd_reg, 0x30000);
else
avg_org = odm_get_bb_reg(p_dm, psd_reg, 0x3000);
if (average != 0)
{
if (p_dm->support_ic_type & ODM_RTL8710B)
odm_set_bb_reg(p_dm, psd_reg, 0x30000, 0x1);
else
odm_set_bb_reg(p_dm, psd_reg, 0x3000, 0x1);
}
#if 0
if (avg_temp == 0)
avg = 1;
else if (avg_temp == 1)
avg = 8;
else if (avg_temp == 2)
avg = 16;
else if (avg_temp == 3)
avg = 32;
#endif
i = start_point;
while (i < stop_point) {
data_tatal = 0;
if (i >= point)
point_temp = i - point;
else
point_temp = i;
for (k = 0; k < average_tmp; k++) {
data_temp[k] = halrf_get_psd_data(p_dm, point_temp);
data_tatal = data_tatal + (data_temp[k] * data_temp[k]);
#if 0
if ((k % 20) == 0)
dbg_print("\n ");
dbg_print("0x%x ", data_temp[k]);
#endif
}
/*dbg_print("\n");*/
data_tatal = ((data_tatal * 100) / average_tmp);
p_psd->psd_data[j] = (u32)_sqrt(data_tatal);
i++;
j++;
}
#if 0
for (i = 0; i < p_psd->buf_size; i++) {
if ((i % 20) == 0)
dbg_print("\n ");
dbg_print("0x%x ", p_psd->psd_data[i]);
}
dbg_print("\n\n");
#endif
if (p_dm->support_ic_type & ODM_RTL8710B)
odm_set_bb_reg(p_dm, psd_reg, 0x30000, avg_org);
else
odm_set_bb_reg(p_dm, psd_reg, 0x3000, avg_org);
}
enum rt_status
halrf_psd_init(
void *p_dm_void
)
{
enum rt_status ret_status = RT_STATUS_SUCCESS;
struct PHY_DM_STRUCT *p_dm = (struct PHY_DM_STRUCT *)p_dm_void;
struct _hal_rf_ *p_rf = &(p_dm->rf_table);
struct _halrf_psd_data *p_psd = &(p_rf->halrf_psd_data);
if (p_psd->psd_progress)
ret_status = RT_STATUS_PENDING;
else {
p_psd->psd_progress = 1;
halrf_psd(p_dm, p_psd->point, p_psd->start_point, p_psd->stop_point, p_psd->average);
p_psd->psd_progress = 0;
}
return ret_status;
}
enum rt_status
halrf_psd_query(
void *p_dm_void,
u32 *outbuf,
u32 buf_size
)
{
enum rt_status ret_status = RT_STATUS_SUCCESS;
struct PHY_DM_STRUCT *p_dm = (struct PHY_DM_STRUCT *)p_dm_void;
struct _hal_rf_ *p_rf = &(p_dm->rf_table);
struct _halrf_psd_data *p_psd = &(p_rf->halrf_psd_data);
if (p_psd->psd_progress)
ret_status = RT_STATUS_PENDING;
else
PlatformMoveMemory(outbuf, p_psd->psd_data, 0x400);
return ret_status;
}
enum rt_status
halrf_psd_init_query(
void *p_dm_void,
u32 *outbuf,
u32 point,
u32 start_point,
u32 stop_point,
u32 average,
u32 buf_size
)
{
enum rt_status ret_status = RT_STATUS_SUCCESS;
struct PHY_DM_STRUCT *p_dm = (struct PHY_DM_STRUCT *)p_dm_void;
struct _hal_rf_ *p_rf = &(p_dm->rf_table);
struct _halrf_psd_data *p_psd = &(p_rf->halrf_psd_data);
p_psd->point = point;
p_psd->start_point = start_point;
p_psd->stop_point = stop_point;
p_psd->average = average;
if (p_psd->psd_progress)
ret_status = RT_STATUS_PENDING;
else {
p_psd->psd_progress = 1;
halrf_psd(p_dm, p_psd->point, p_psd->start_point, p_psd->stop_point, p_psd->average);
PlatformMoveMemory(outbuf, p_psd->psd_data, 0x400);
p_psd->psd_progress = 0;
}
return ret_status;
}
#endif /*#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)*/

View File

@ -0,0 +1,60 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2017 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*****************************************************************************/
#ifndef __HALRF_PSD_H__
#define __HALRF_PSD_H__
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
struct _halrf_psd_data {
u32 point;
u32 start_point;
u32 stop_point;
u32 average;
u32 buf_size;
u32 psd_data[256];
u32 psd_progress;
};
enum rt_status
halrf_psd_init (
void *p_dm_void
);
enum rt_status
halrf_psd_query (
void *p_dm_void,
u32 *outbuf,
u32 buf_size
);
enum rt_status
halrf_psd_init_query(
void *p_dm_void,
u32 *outbuf,
u32 point,
u32 start_point,
u32 stop_point,
u32 average,
u32 buf_size
);
#endif /*#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)*/
#endif /*#ifndef __HALRF_PSD_H__*/

View File

@ -114,7 +114,7 @@ odm_tx_pwr_track_set_pwr8812a(
u8 final_cck_swing_index = 0;
u8 i = 0;
struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm->rf_calibrate_info);
struct _hal_rf_ *p_rf = &(p_dm->rf_table);
struct _hal_rf_ *p_rf = &(p_dm->rf_table);
if (*(p_dm->p_mp_mode) == true) {
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
@ -328,7 +328,7 @@ get_delta_swing_table_8812a(
struct PHY_DM_STRUCT *p_dm = (struct PHY_DM_STRUCT *)p_dm_void;
struct _ADAPTER *adapter = p_dm->adapter;
struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm->rf_calibrate_info);
struct _hal_rf_ *p_rf = &(p_dm->rf_table);
struct _hal_rf_ *p_rf = &(p_dm->rf_table);
HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
u8 tx_rate = 0xFF;
u8 channel = *p_dm->p_channel;
@ -442,6 +442,10 @@ void _iqk_rx_fill_iqc_8812a(
odm_set_bb_reg(p_dm, 0xc10, 0x03ff0000, 0);
ODM_RT_TRACE(p_dm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("RX_X = %x;;RX_Y = %x ====>fill to IQC\n", RX_X >> 1 & 0x000003ff, RX_Y >> 1 & 0x000003ff));
} else {
if (RX_X >= 0x20c)
RX_X = 0x20c;
else if (RX_X <= 0x1f4)
RX_X = 0x1f4;
odm_set_bb_reg(p_dm, 0xc10, 0x000003ff, RX_X >> 1);
odm_set_bb_reg(p_dm, 0xc10, 0x03ff0000, RX_Y >> 1);
ODM_RT_TRACE(p_dm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("RX_X = %x;;RX_Y = %x ====>fill to IQC\n", RX_X >> 1 & 0x000003ff, RX_Y >> 1 & 0x000003ff));
@ -457,6 +461,10 @@ void _iqk_rx_fill_iqc_8812a(
odm_set_bb_reg(p_dm, 0xe10, 0x03ff0000, 0);
ODM_RT_TRACE(p_dm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("RX_X = %x;;RX_Y = %x ====>fill to IQC\n", RX_X >> 1 & 0x000003ff, RX_Y >> 1 & 0x000003ff));
} else {
if (RX_X >= 0x20c)
RX_X = 0x20c;
else if (RX_X <= 0x1f4)
RX_X = 0x1f4;
odm_set_bb_reg(p_dm, 0xe10, 0x000003ff, RX_X >> 1);
odm_set_bb_reg(p_dm, 0xe10, 0x03ff0000, RX_Y >> 1);
ODM_RT_TRACE(p_dm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("RX_X = %x;;RX_Y = %x====>fill to IQC\n ", RX_X >> 1 & 0x000003ff, RX_Y >> 1 & 0x000003ff));
@ -958,7 +966,8 @@ void _iqk_tx_8812a(
odm_set_bb_reg(p_dm, 0x978, 0x03FF8000, (TX_IQC[0]) & 0x000007ff);
odm_set_bb_reg(p_dm, 0x978, 0x000007FF, (TX_IQC[1]) & 0x000007ff);
odm_set_bb_reg(p_dm, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */
if (p_dm->rfe_type == 1)
/*pathA RXIQK gain setting*/
if ((p_dm->rfe_type == 1) && (p_dm->ext_pa_5g))
odm_write_4byte(p_dm, 0xc8c, 0x28161500);
else
odm_write_4byte(p_dm, 0xc8c, 0x28160cc0);
@ -973,7 +982,8 @@ void _iqk_tx_8812a(
odm_set_bb_reg(p_dm, 0x978, 0x03FF8000, (TX_IQC[2]) & 0x000007ff);
odm_set_bb_reg(p_dm, 0x978, 0x000007FF, (TX_IQC[3]) & 0x000007ff);
odm_set_bb_reg(p_dm, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */
if (p_dm->rfe_type == 1)
/*pathB RXIQK gain setting*/
if ((p_dm->rfe_type == 1) && (p_dm->ext_pa_5g))
odm_write_4byte(p_dm, 0xe8c, 0x28161500);
else
odm_write_4byte(p_dm, 0xe8c, 0x28160ca0);
@ -1340,6 +1350,9 @@ _phy_iq_calibrate_by_fw_8812a(
// rtl8812_iqk_wait(p_adapter, 500);
}
/*IQK version:0x2*/
/*1. add RX IQK boundary*/
/*2. fine tune RXIQK loop gain*/
void
phy_iq_calibrate_8812a(
void *p_dm_void,
@ -1371,7 +1384,7 @@ phy_lc_calibrate_8812a(
}
void _phy_set_rf_path_switch_8812a(
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
#if ((DM_ODM_SUPPORT_TYPE & ODM_AP) || (DM_ODM_SUPPORT_TYPE == ODM_CE))
struct PHY_DM_STRUCT *p_dm,
#else
struct _ADAPTER *p_adapter,
@ -1381,13 +1394,13 @@ void _phy_set_rf_path_switch_8812a(
)
{
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_adapter);
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
struct PHY_DM_STRUCT *p_dm = &p_hal_data->odmpriv;
#elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
struct _ADAPTER *p_adapter = p_dm->adapter;
#endif
HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_adapter);
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
struct PHY_DM_STRUCT *p_dm = &p_hal_data->DM_OutSrc;
#endif
#endif
if (IS_HARDWARE_TYPE_8821(p_adapter)) {
@ -1412,7 +1425,7 @@ void _phy_set_rf_path_switch_8812a(
}
void phy_set_rf_path_switch_8812a(
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
#if ((DM_ODM_SUPPORT_TYPE & ODM_AP) || (DM_ODM_SUPPORT_TYPE == ODM_CE))
struct PHY_DM_STRUCT *p_dm,
#else
struct _ADAPTER *p_adapter,
@ -1426,9 +1439,11 @@ void phy_set_rf_path_switch_8812a(
#endif
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
_phy_set_rf_path_switch_8812a(p_dm, is_main, true);
#else
_phy_set_rf_path_switch_8812a(p_adapter, is_main, true);
#endif
#endif
}

View File

@ -87,7 +87,7 @@ halrf_rf_lna_setting_8812a(
void phy_set_rf_path_switch_8812a(
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
#if ((DM_ODM_SUPPORT_TYPE & ODM_AP) || (DM_ODM_SUPPORT_TYPE == ODM_CE))
struct PHY_DM_STRUCT *p_dm,
#else
struct _ADAPTER *p_adapter,

View File

@ -438,6 +438,10 @@ void _iqk_rx_fill_iqc_8812a(
odm_set_bb_reg(p_dm, 0xc10, 0x03ff0000, 0);
ODM_RT_TRACE(p_dm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("RX_X = %x;;RX_Y = %x ====>fill to IQC\n", RX_X >> 1 & 0x000003ff, RX_Y >> 1 & 0x000003ff));
} else {
if (RX_X >= 0x20c)
RX_X = 0x20c;
else if (RX_X <= 0x1f4)
RX_X = 0x1f4;
odm_set_bb_reg(p_dm, 0xc10, 0x000003ff, RX_X >> 1);
odm_set_bb_reg(p_dm, 0xc10, 0x03ff0000, RX_Y >> 1);
ODM_RT_TRACE(p_dm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("RX_X = %x;;RX_Y = %x ====>fill to IQC\n", RX_X >> 1 & 0x000003ff, RX_Y >> 1 & 0x000003ff));
@ -453,6 +457,10 @@ void _iqk_rx_fill_iqc_8812a(
odm_set_bb_reg(p_dm, 0xe10, 0x03ff0000, 0);
ODM_RT_TRACE(p_dm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("RX_X = %x;;RX_Y = %x ====>fill to IQC\n", RX_X >> 1 & 0x000003ff, RX_Y >> 1 & 0x000003ff));
} else {
if (RX_X >= 0x20c)
RX_X = 0x20c;
else if (RX_X <= 0x1f4)
RX_X = 0x1f4;
odm_set_bb_reg(p_dm, 0xe10, 0x000003ff, RX_X >> 1);
odm_set_bb_reg(p_dm, 0xe10, 0x03ff0000, RX_Y >> 1);
ODM_RT_TRACE(p_dm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("RX_X = %x;;RX_Y = %x====>fill to IQC\n ", RX_X >> 1 & 0x000003ff, RX_Y >> 1 & 0x000003ff));
@ -947,7 +955,8 @@ void _iqk_tx_8812a(
odm_set_bb_reg(p_dm, 0x978, 0x03FF8000, (TX_IQC[0]) & 0x000007ff);
odm_set_bb_reg(p_dm, 0x978, 0x000007FF, (TX_IQC[1]) & 0x000007ff);
odm_set_bb_reg(p_dm, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */
if (p_dm->rfe_type == 1)
/*pathA RXIQK gain setting*/
if ((p_dm->rfe_type == 1) && (p_dm->ext_pa_5g))
odm_write_4byte(p_dm, 0xc8c, 0x28161500);
else
odm_write_4byte(p_dm, 0xc8c, 0x28160cc0);
@ -962,7 +971,8 @@ void _iqk_tx_8812a(
odm_set_bb_reg(p_dm, 0x978, 0x03FF8000, (TX_IQC[2]) & 0x000007ff);
odm_set_bb_reg(p_dm, 0x978, 0x000007FF, (TX_IQC[3]) & 0x000007ff);
odm_set_bb_reg(p_dm, 0x82c, BIT(31), 0x1); /* [31] = 1 --> Page C1 */
if (p_dm->rfe_type == 1)
/*pathB RXIQK gain setting*/
if ((p_dm->rfe_type == 1) && (p_dm->ext_pa_5g))
odm_write_4byte(p_dm, 0xe8c, 0x28161500);
else
odm_write_4byte(p_dm, 0xe8c, 0x28160ca0);
@ -1343,6 +1353,10 @@ _phy_iq_calibrate_by_fw_8812a(
odm_fill_h2c_cmd(p_dm, ODM_H2C_IQ_CALIBRATION, 3, iqk_cmd);
}
/*IQK version:0x2*/
/*1. add RX IQK boundary*/
/*2. fine tune RXIQK loop gain*/
void
phy_iq_calibrate_8812a(
void *p_dm_void,

View File

@ -476,7 +476,7 @@ phydm_supportability_init_win(
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR |
/*ODM_BB_ENV_MONITOR |*/
ODM_BB_PRIMARY_CCA;
break;
#endif
@ -493,7 +493,7 @@ phydm_supportability_init_win(
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR |
/*ODM_BB_ENV_MONITOR |*/
ODM_BB_PRIMARY_CCA;
break;
#endif
@ -510,7 +510,7 @@ phydm_supportability_init_win(
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR |
/*ODM_BB_ENV_MONITOR |*/
ODM_BB_PRIMARY_CCA;
break;
#endif
@ -526,8 +526,8 @@ phydm_supportability_init_win(
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
ODM_BB_CFO_TRACKING;
/*ODM_BB_ENV_MONITOR;*/
break;
#endif
@ -542,8 +542,8 @@ phydm_supportability_init_win(
ODM_BB_CCK_PD |
/* ODM_BB_PWR_TRAIN | */
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
ODM_BB_CFO_TRACKING;
/*ODM_BB_ENV_MONITOR;*/
break;
#endif
@ -558,8 +558,8 @@ phydm_supportability_init_win(
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
ODM_BB_CFO_TRACKING;
/*ODM_BB_ENV_MONITOR;*/
break;
#endif
@ -574,8 +574,8 @@ phydm_supportability_init_win(
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
ODM_BB_CFO_TRACKING;
/*ODM_BB_ENV_MONITOR;*/
break;
#endif
@ -593,8 +593,8 @@ phydm_supportability_init_win(
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
ODM_BB_CFO_TRACKING;
/*ODM_BB_ENV_MONITOR;*/
break;
#endif
@ -609,8 +609,8 @@ phydm_supportability_init_win(
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
ODM_BB_CFO_TRACKING;
/*ODM_BB_ENV_MONITOR;*/
break;
#endif
@ -625,8 +625,8 @@ phydm_supportability_init_win(
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
ODM_BB_CFO_TRACKING;
/*ODM_BB_ENV_MONITOR;*/
break;
#endif
@ -642,7 +642,7 @@ phydm_supportability_init_win(
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR |
/*ODM_BB_ENV_MONITOR |*/
ODM_BB_ADAPTIVE_SOML;
break;
#endif
@ -658,8 +658,8 @@ phydm_supportability_init_win(
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
ODM_BB_CFO_TRACKING;
/*ODM_BB_ENV_MONITOR;*/
break;
#endif
@ -673,22 +673,14 @@ phydm_supportability_init_win(
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
ODM_BB_CFO_TRACKING;
/*ODM_BB_ENV_MONITOR;*/
dbg_print("[Warning] Supportability Init Warning !!!\n");
break;
}
/*[Config Antenna Diveristy]*/
if (*(p_dm->p_enable_antdiv))
support_ability |= ODM_BB_ANT_DIV;
/*[Config Adaptivity]*/
if (*(p_dm->p_enable_adaptivity))
support_ability |= ODM_BB_ADAPTIVITY;
return support_ability;
}
#endif
@ -920,15 +912,7 @@ phydm_supportability_init_ce(
break;
}
/*[Config Antenna Diveristy]*/
if (*(p_dm->p_enable_antdiv))
support_ability |= ODM_BB_ANT_DIV;
/*[Config Adaptivity]*/
if (*(p_dm->p_enable_adaptivity))
support_ability |= ODM_BB_ADAPTIVITY;
return support_ability;
}
#endif
@ -1181,15 +1165,7 @@ phydm_supportability_init_iot(
break;
}
/*[Config Antenna Diveristy]*/
if (*(p_dm->p_enable_antdiv))
support_ability |= ODM_BB_ANT_DIV;
/*[Config Adaptivity]*/
if (*(p_dm->p_enable_adaptivity))
support_ability |= ODM_BB_ADAPTIVITY;
return support_ability;
}
#endif
@ -1274,6 +1250,18 @@ phydm_supportability_init(
#elif(DM_ODM_SUPPORT_TYPE & (ODM_IOT))
support_ability = phydm_supportability_init_iot(p_dm);
#endif
/*[Config Antenna Diveristy]*/
if (IS_FUNC_EN(p_dm->p_enable_antdiv))
support_ability |= ODM_BB_ANT_DIV;
/*[Config Adaptive SOML]*/
if (IS_FUNC_EN(p_dm->en_adap_soml))
support_ability |= ODM_BB_ADAPTIVE_SOML;
/*[Config Adaptivity]*/
if (IS_FUNC_EN(p_dm->p_enable_adaptivity))
support_ability |= ODM_BB_ADAPTIVITY;
}
odm_cmn_info_init(p_dm, ODM_CMNINFO_ABILITY, support_ability);
PHYDM_DBG(p_dm, ODM_COMP_INIT, ("IC = ((0x%x)), Supportability Init = ((0x%llx))\n", p_dm->support_ic_type, p_dm->support_ability));
@ -2129,6 +2117,9 @@ odm_cmn_info_hook(
case ODM_CMNINFO_ANT_DIV:
p_dm->p_enable_antdiv = (u8 *)p_value;
break;
case ODM_CMNINFO_ADAPTIVE_SOML:
p_dm->en_adap_soml = (u8 *)p_value;
break;
case ODM_CMNINFO_ADAPTIVITY:
p_dm->p_enable_adaptivity = (u8 *)p_value;
break;

View File

@ -80,12 +80,16 @@ extern const u16 phy_rate_table[28];
#define MAX_2(_x_, _y_) (((_x_)>(_y_))? (_x_) : (_y_))
#define MIN_2(_x_, _y_) (((_x_)<(_y_))? (_x_) : (_y_))
#define IS_FUNC_EN(name) ((name) && (*name))
#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
#define PHYDM_WATCH_DOG_PERIOD 1 /*second*/
#else
#define PHYDM_WATCH_DOG_PERIOD 2 /*second*/
#endif
#define PHY_HIST_SIZE 12
/*============================================================*/
/*structure and define*/
/*============================================================*/
@ -103,17 +107,23 @@ struct phydm_phystatus_statistic {
u32 rssi_ofdm_cnt;
u32 evm_ofdm_sum;
u32 snr_ofdm_sum;
u16 evm_ofdm_hist[PHY_HIST_SIZE];
u16 snr_ofdm_hist[PHY_HIST_SIZE];
/*[1SS]*/
u32 rssi_1ss_cnt;
u32 rssi_1ss_sum;
u32 evm_1ss_sum;
u32 snr_1ss_sum;
u16 evm_1ss_hist[PHY_HIST_SIZE];
u16 snr_1ss_hist[PHY_HIST_SIZE];
/*[2SS]*/
#if (defined(PHYDM_COMPILE_ABOVE_2SS))
u32 rssi_2ss_cnt;
u32 rssi_2ss_sum[2];
u32 evm_2ss_sum[2];
u32 snr_2ss_sum[2];
u16 evm_2ss_hist[2][PHY_HIST_SIZE];
u16 snr_2ss_hist[2][PHY_HIST_SIZE];
#endif
/*[3SS]*/
#if (defined(PHYDM_COMPILE_ABOVE_3SS))
@ -121,6 +131,8 @@ struct phydm_phystatus_statistic {
u32 rssi_3ss_sum[3];
u32 evm_3ss_sum[3];
u32 snr_3ss_sum[3];
u16 evm_3ss_hist[3][PHY_HIST_SIZE];
u16 snr_3ss_hist[3][PHY_HIST_SIZE];
#endif
/*[4SS]*/
#if (defined(PHYDM_COMPILE_ABOVE_4SS))
@ -128,6 +140,8 @@ struct phydm_phystatus_statistic {
u32 rssi_4ss_sum[4];
u32 evm_4ss_sum[4];
u32 snr_4ss_sum[4];
u16 evm_4ss_hist[4][PHY_HIST_SIZE];
u16 snr_4ss_hist[4][PHY_HIST_SIZE];
#endif
};
@ -189,6 +203,8 @@ struct _odm_phy_dbg_info_ {
u16 num_qry_vht_pkt[VHT_RATE_NUM];
u8 vht_pkt_not_zero;
#endif
u16 snr_hist_th[PHY_HIST_SIZE - 1];
u16 evm_hist_th[PHY_HIST_SIZE - 1];
struct phydm_phystatus_statistic phystatus_statistic_info;
struct phydm_phystatus_avg phystatus_statistic_avg;
};
@ -253,6 +269,7 @@ enum odm_cmninfo_e {
ODM_CMNINFO_CHNL,
ODM_CMNINFO_FORCED_RATE,
ODM_CMNINFO_ANT_DIV,
ODM_CMNINFO_ADAPTIVE_SOML,
ODM_CMNINFO_ADAPTIVITY,
ODM_CMNINFO_SCAN,
ODM_CMNINFO_POWER_SAVING,
@ -616,6 +633,7 @@ struct phydm_iot_center {
u16 *p_forced_data_rate;
u8 *p_enable_antdiv;
u8 *en_adap_soml;
u8 *p_enable_adaptivity;
u8 *hub_usb_mode; /*1: USB 2.0, 2: USB 3.0*/
boolean *p_is_fw_dw_rsvd_page_in_progress;
@ -722,6 +740,8 @@ struct phydm_iot_center {
u8 path_select;
u8 antdiv_evm_en;
u8 bdc_holdstate;
u8 antdiv_counter;
/*---------------------------*/
u8 ndpa_period;

View File

@ -109,6 +109,15 @@ _PHYDM_FILES += hal/phydm/$(RTL871X)/halhwimg8814a_bb.o\
hal/phydm/txbf/haltxbf8814a.o
endif
ifeq ($(CONFIG_RTL8710B), y)
RTL871X = rtl8710b
_PHYDM_FILES += hal/phydm/$(RTL871X)/halhwimg8710b_bb.o\
hal/phydm/$(RTL871X)/halhwimg8710b_mac.o\
hal/phydm/$(RTL871X)/halhwimg8710b_rf.o\
hal/phydm/$(RTL871X)/phydm_regconfig8710b.o\
hal/phydm/$(RTL871X)/phydm_rtl8710b.o\
hal/phydm/halrf/$(RTL871X)/halrf_8710b.o
endif
ifeq ($(CONFIG_RTL8723C), y)
RTL871X = rtl8703b

View File

@ -1190,6 +1190,43 @@ odm_trx_hw_ant_div_init_8723d(
}
/*Mingzhi 2017-05-08*/
void
odm_s0s1_sw_ant_div_init_8723d(
void *p_dm_void
)
{
struct PHY_DM_STRUCT *p_dm = (struct PHY_DM_STRUCT *)p_dm_void;
struct _sw_antenna_switch_ *p_dm_swat_table = &p_dm->dm_swat_table;
struct phydm_fat_struct *p_dm_fat_table = &p_dm->dm_fat_table;
PHYDM_DBG(p_dm, DBG_ANT_DIV, ("***8723D AntDiv_Init => ant_div_type=[ S0S1_SW_AntDiv]\n"));
/*keep antsel_map when GNT_BT = 1*/
odm_set_bb_reg(p_dm, 0x864, BIT(12), 1);
/* Disable antsw when GNT_BT=1 */
odm_set_bb_reg(p_dm, 0x874, BIT(23), 0);
/* Mapping Table */
odm_set_bb_reg(p_dm, 0x914, MASKBYTE0, 0);
odm_set_bb_reg(p_dm, 0x914, MASKBYTE1, 1);
/* Output Pin Settings */
/* odm_set_bb_reg(p_dm, R_0x948, BIT6, 0x1); */
odm_set_bb_reg(p_dm, 0x870, BIT(8), 1);
odm_set_bb_reg(p_dm, 0x870, BIT(9), 1);
p_dm_fat_table->is_become_linked = false;
p_dm_swat_table->try_flag = SWAW_STEP_INIT;
p_dm_swat_table->double_chk_flag = 0;
p_dm_swat_table->cur_antenna = MAIN_ANT;
p_dm_swat_table->pre_antenna = MAIN_ANT;
p_dm->antdiv_counter = CONFIG_ANTENNA_DIVERSITY_PERIOD;
/* 2 [--For HW Bug setting] */
odm_set_bb_reg(p_dm, 0x80c, BIT(21), 0); /* TX ant by Reg */
}
void
odm_update_rx_idle_ant_8723d(
void *p_dm_void,
@ -1203,13 +1240,28 @@ odm_update_rx_idle_ant_8723d(
struct _ADAPTER *p_adapter = p_dm->adapter;
u8 count = 0;
#if (DM_ODM_SUPPORT_TYPE & (ODM_CE))
/*score board to BT ,a002:WL to do ant-div*/
odm_set_mac_reg(p_dm, 0xa8, MASKHWORD, 0xa002);
ODM_delay_us(50);
#endif
/* odm_set_bb_reg(p_dm, 0x948, BIT(6), 0x1); */
odm_set_bb_reg(p_dm, 0x948, BIT(7), default_ant);
if (p_dm->ant_div_type == S0S1_SW_ANTDIV) {
odm_set_bb_reg(p_dm, 0x860, BIT(8), default_ant);
odm_set_bb_reg(p_dm, 0x860, BIT(9), default_ant);
}
odm_set_bb_reg(p_dm, 0x864, BIT(5) | BIT(4) | BIT(3), default_ant); /*Default RX*/
odm_set_bb_reg(p_dm, 0x864, BIT(8) | BIT(7) | BIT(6), optional_ant); /*Optional RX*/
odm_set_bb_reg(p_dm, 0x860, BIT(14) | BIT(13) | BIT(12), default_ant); /*Default TX*/
p_dm_fat_table->rx_idle_ant = ant;
#if (DM_ODM_SUPPORT_TYPE & (ODM_CE))
/*score board to BT ,a000:WL@S1 a001:WL@S0*/
if (default_ant == ANT1_2G)
odm_set_mac_reg(p_dm, 0xa8, MASKHWORD, 0xa000);
else
odm_set_mac_reg(p_dm, 0xa8, MASKHWORD, 0xa001);
#endif
}
@ -2557,6 +2609,16 @@ odm_s0s1_sw_ant_div(
PHYDM_DBG(p_dm, DBG_ANT_DIV, ("8723B: First link! Force antenna to %s\n", (value32 == 0x0 ? "MAIN" : "AUX")));
}
if (p_dm->support_ic_type == ODM_RTL8723D) {
value32 = odm_get_bb_reg(p_dm, 0x864, BIT(5) | BIT(4) | BIT(3));
#if (RTL8723D_SUPPORT == 1)
if (value32 == 0x0)
odm_update_rx_idle_ant_8723d(p_dm, MAIN_ANT, ANT1_2G, ANT2_2G);
else if (value32 == 0x1)
odm_update_rx_idle_ant_8723d(p_dm, AUX_ANT, ANT2_2G, ANT1_2G);
#endif
PHYDM_DBG(p_dm, DBG_ANT_DIV, ("8723D: First link! Force antenna to %s\n", (value32 == 0x0 ? "MAIN" : "AUX")));
}
p_dm_fat_table->is_become_linked = p_dm->is_linked;
}
}
@ -2699,7 +2761,7 @@ odm_s0s1_sw_ant_div(
p_dm_swat_table->rssi_trying = 0;
PHYDM_DBG(p_dm, DBG_ANT_DIV, ("Test the current ant for (( %d )) ms again\n", p_dm_swat_table->train_time));
odm_update_rx_idle_ant(p_dm, p_dm_fat_table->rx_idle_ant);
odm_update_rx_idle_ant(p_dm, p_dm_fat_table->rx_idle_ant);
odm_set_timer(p_dm, &(p_dm_swat_table->phydm_sw_antenna_switch_timer), p_dm_swat_table->train_time); /*ms*/
return;
}
@ -2732,7 +2794,7 @@ odm_s0s1_sw_ant_div(
p_entry = p_dm->p_phydm_sta_info[i];
if (is_sta_active(p_entry)) {
/* 2 Caculate RSSI per Antenna */
/*
main_ant_sum = (u32)p_dm_fat_table->main_ant_sum[i] + (u32)p_dm_fat_table->main_ant_sum_cck[i];
aux_ant_sum = (u32)p_dm_fat_table->aux_ant_sum[i] + (u32)p_dm_fat_table->aux_ant_sum_cck[i];
main_ant_cnt = (u32)p_dm_fat_table->main_ant_cnt[i] + (u32)p_dm_fat_table->main_ant_cnt_cck[i];
@ -2745,9 +2807,41 @@ odm_s0s1_sw_ant_div(
main_rssi = 0;
if (p_dm_fat_table->aux_ant_cnt[i] <= 1 && p_dm_fat_table->aux_ant_cnt_cck[i] >= 1)
aux_rssi = 0;
target_ant = (main_rssi == aux_rssi) ? p_dm_swat_table->pre_antenna : ((main_rssi >= aux_rssi) ? MAIN_ANT : AUX_ANT);
aux_rssi = 0;*/
if ((p_dm_fat_table->main_ant_cnt[i] != 0) || (p_dm_fat_table->aux_ant_cnt[i] != 0)) {
main_ant_cnt = (u32)p_dm_fat_table->main_ant_cnt[i];
aux_ant_cnt = (u32)p_dm_fat_table->aux_ant_cnt[i];
main_rssi = (main_ant_cnt != 0) ? (p_dm_fat_table->main_ant_sum[i] / main_ant_cnt) : 0;
aux_rssi = (aux_ant_cnt != 0) ? (p_dm_fat_table->aux_ant_sum[i] / aux_ant_cnt) : 0;
if (p_dm->support_ic_type == ODM_RTL8723D) {
if (p_dm_swat_table->pre_antenna == MAIN_ANT) {
if (main_ant_cnt == 0) {
target_ant = (aux_ant_cnt != 0) ? AUX_ANT : p_dm_swat_table->pre_antenna;
} else {
target_ant = ((aux_ant_cnt > main_ant_cnt) && ((main_rssi - aux_rssi < 5) || (aux_rssi > main_rssi))) ? AUX_ANT : p_dm_swat_table->pre_antenna;
}
} else {
if (aux_ant_cnt == 0) {
target_ant = (main_ant_cnt != 0) ? MAIN_ANT : p_dm_swat_table->pre_antenna;
} else {
target_ant = ((main_ant_cnt > aux_ant_cnt) && ((aux_rssi - main_rssi < 5) || (main_rssi > aux_rssi))) ? MAIN_ANT : p_dm_swat_table->pre_antenna;
}
}
} else {
if (p_dm_swat_table->pre_antenna == MAIN_ANT) {
target_ant = ((aux_ant_cnt > 20) && (aux_rssi >= main_rssi)) ? AUX_ANT : p_dm_swat_table->pre_antenna;
} else {
target_ant = ((main_ant_cnt > 20) && (main_rssi >= aux_rssi)) ? MAIN_ANT : p_dm_swat_table->pre_antenna;
}
}
} else { /*CCK only case*/
main_ant_cnt = p_dm_fat_table->main_ant_cnt_cck[i];
aux_ant_cnt = p_dm_fat_table->aux_ant_cnt_cck[i];
main_rssi = (main_ant_cnt != 0) ? (p_dm_fat_table->main_ant_sum_cck[i] / main_ant_cnt) : 0;
aux_rssi = (aux_ant_cnt != 0) ? (p_dm_fat_table->aux_ant_sum_cck[i] / aux_ant_cnt) : 0;
target_ant = (main_rssi == aux_rssi) ? p_dm_fat_table->rx_idle_ant : ((main_rssi >= aux_rssi) ? MAIN_ANT : AUX_ANT); /*Use RSSI for CCK only case*/
}
/*target_ant = (main_rssi == aux_rssi) ? p_dm_swat_table->pre_antenna : ((main_rssi >= aux_rssi) ? MAIN_ANT : AUX_ANT);*/
local_max_rssi = (main_rssi >= aux_rssi) ? main_rssi : aux_rssi;
local_min_rssi = (main_rssi >= aux_rssi) ? aux_rssi : main_rssi;
@ -2885,6 +2979,20 @@ odm_s0s1_sw_ant_div(
/* 1 5.Reset Statistics */
p_dm_fat_table->rx_idle_ant = next_ant;
if (p_dm->support_ic_type == ODM_RTL8723D) {
if (p_dm_fat_table->rx_idle_ant == MAIN_ANT) {
p_dm_fat_table->main_ant_sum[0] = 0;
p_dm_fat_table->main_ant_cnt[0] = 0;
p_dm_fat_table->main_ant_sum_cck[0] = 0;
p_dm_fat_table->main_ant_cnt_cck[0] = 0;
} else {
p_dm_fat_table->aux_ant_sum[0] = 0;
p_dm_fat_table->aux_ant_cnt[0] = 0;
p_dm_fat_table->aux_ant_sum_cck[0] = 0;
p_dm_fat_table->aux_ant_cnt_cck[0] = 0;
}
}
if (p_dm->support_ic_type == ODM_RTL8188F) {
if (p_dm->support_interface == ODM_ITRF_SDIO) {
@ -3526,6 +3634,8 @@ odm_ant_div_init(
if (p_dm->ant_div_type == S0S1_TRX_HW_ANTDIV)
odm_trx_hw_ant_div_init_8723d(p_dm);
else if (p_dm->ant_div_type == S0S1_SW_ANTDIV)
odm_s0s1_sw_ant_div_init_8723d(p_dm);
else {
PHYDM_DBG(p_dm, DBG_ANT_DIV, ("[Return!!!] 8723D Not Supprrt This AntDiv type\n"));
p_dm->support_ability &= ~(ODM_BB_ANT_DIV);
@ -3730,6 +3840,8 @@ odm_ant_div(
p_dm_fat_table->fix_ant_bfee = 0;
}
}
}else {
odm_ant_div_on_off(p_dm, ANTDIV_ON);
}
#endif
}
@ -3854,9 +3966,19 @@ odm_ant_div(
/*8723D*/
#if (RTL8723D_SUPPORT == 1)
else if (p_dm->support_ic_type == ODM_RTL8723D) {
odm_hw_ant_div(p_dm);
/**/
if (p_dm->ant_div_type == S0S1_SW_ANTDIV) {
#ifdef CONFIG_S0S1_SW_ANTENNA_DIVERSITY
if (p_dm->antdiv_counter == CONFIG_ANTENNA_DIVERSITY_PERIOD) {
odm_s0s1_sw_ant_div(p_dm, SWAW_STEP_PEEK);
p_dm->antdiv_counter--;
} else {
p_dm->antdiv_counter--;
}
if (p_dm->antdiv_counter == 0)
p_dm->antdiv_counter = CONFIG_ANTENNA_DIVERSITY_PERIOD;
#endif
} else if (p_dm->ant_div_type == CG_TRX_HW_ANTDIV)
odm_hw_ant_div(p_dm);
}
#endif
@ -4461,7 +4583,8 @@ odm_ant_div_config(
if (p_dm->support_ic_type == ODM_RTL8723B)
p_dm->ant_div_type = S0S1_SW_ANTDIV;
if (p_dm->support_ic_type == ODM_RTL8723D)
p_dm->ant_div_type = S0S1_SW_ANTDIV;
#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP))

View File

@ -131,6 +131,12 @@
/*Hong Lin Smart antenna*/
#define HL_SMTANT_2WIRE_DATA_LEN 24
#if (RTL8723D_SUPPORT == 1)
#ifndef CONFIG_ANTENNA_DIVERSITY_PERIOD
#define CONFIG_ANTENNA_DIVERSITY_PERIOD 1
#endif
#endif
/* 1 ============================================================
* 1 structure
* 1 ============================================================ */

View File

@ -201,6 +201,7 @@ phydm_cckpd_new_cs_ratio(
u8 pd_th = 0, cs_ration = 0, cs_2r_offset = 0;
u8 igi_curr = p_dig_t->cur_ig_value;
u8 en_2rcca;
boolean is_update = true;
PHYDM_DBG(p_dm, DBG_CCKPD, ("%s ======>\n", __func__));
@ -230,6 +231,7 @@ phydm_cckpd_new_cs_ratio(
cs_ration = p_dig_t->aaa_default;
pd_th = 0x3;
} else {
is_update = false;
cs_ration = p_cckpd_t->cck_cca_th_aaa;
pd_th = p_cckpd_t->cur_cck_cca_thres;
}
@ -244,6 +246,7 @@ phydm_cckpd_new_cs_ratio(
cs_ration = p_dig_t->aaa_default;
pd_th = 0x3;
} else {
is_update = false;
cs_ration = p_cckpd_t->cck_cca_th_aaa;
pd_th = p_cckpd_t->cur_cck_cca_thres;
}
@ -252,15 +255,15 @@ phydm_cckpd_new_cs_ratio(
if (en_2rcca)
cs_ration = (cs_ration >= cs_2r_offset) ? (cs_ration - cs_2r_offset) : 0;
p_cckpd_t->cur_cck_cca_thres = pd_th;
p_cckpd_t->cck_cca_th_aaa = cs_ration;
PHYDM_DBG(p_dm, DBG_CCKPD,
("[New] cs_ratio=0x%x, pd_th=0x%x\n", cs_ration, pd_th));
odm_set_bb_reg(p_dm, 0xa08, 0xf0000, pd_th);
odm_set_bb_reg(p_dm, 0xaa8, 0x1f0000, cs_ration);
if (is_update) {
p_cckpd_t->cur_cck_cca_thres = pd_th;
p_cckpd_t->cck_cca_th_aaa = cs_ration;
odm_set_bb_reg(p_dm, 0xa08, 0xf0000, pd_th);
odm_set_bb_reg(p_dm, 0xaa8, 0x1f0000, cs_ration);
}
/*phydm_write_cck_cca_th_new_cs_ratio(p_dm, pd_th, cs_ration);*/
}
@ -445,8 +448,15 @@ phydm_cck_pd_init(
p_cckpd_t->pause_bitmap = 0;
if (p_dm->support_ic_type & EXTEND_CCK_CCATH_AAA_IC)
if (p_dm->support_ic_type & EXTEND_CCK_CCATH_AAA_IC) {
p_dig_t->aaa_default = odm_read_1byte(p_dm, 0xaaa) & 0x1f;
p_dig_t->a0a_default = (u8)odm_get_bb_reg(p_dm, 0xa08, 0xff0000);
p_cckpd_t->cck_cca_th_aaa = p_dig_t->aaa_default;
p_cckpd_t->cur_cck_cca_thres = p_dig_t->a0a_default;
} else {
p_dig_t->a0a_default = (u8)odm_get_bb_reg(p_dm, 0xa08, 0xff0000);
p_cckpd_t->cur_cck_cca_thres = p_dig_t->a0a_default;
}
odm_memory_set(p_dm, p_cckpd_t->pause_cckpd_value, 0, PHYDM_PAUSE_MAX_NUM);
#endif

View File

@ -72,7 +72,7 @@ phydm_set_crystal_cap(
#if (RTL8710B_SUPPORT == 1)
else if (p_dm->support_ic_type & (ODM_RTL8710B)) {
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
/* write 0x60[29:24] = 0x60[23:18] = crystal_cap */
HAL_SetSYSOnReg(p_dm->adapter, REG_SYS_XTAL_CTRL0, 0x3FFC0000, (crystal_cap | (crystal_cap << 6)));
#endif

View File

@ -72,6 +72,7 @@ phydm_init_debug_setting(
p_dm->fw_buff_is_enpty = true;
p_dm->pre_c2h_seq = 0;
p_dm->c2h_cmd_start = 0;
phydm_reset_rx_rate_distribution(p_dm);
}
void
@ -955,6 +956,114 @@ phydm_rx_rate_distribution
}
void phydm_print_hist_2_buf(void *dm_void, u16 *val, u16 len, char *buf,
u16 buf_size)
{
struct PHY_DM_STRUCT *dm = (struct PHY_DM_STRUCT *)dm_void;
if (len == PHY_HIST_SIZE) {
PHYDM_PRINT2BUF(buf, buf_size,
"[%.2d, %.2d, %.2d, %.2d, %.2d, %.2d, %.2d, %.2d, %.2d, %.2d, %.2d, %.2d]",
val[0], val[1], val[2], val[3], val[4],
val[5], val[6], val[7], val[8], val[9],
val[10], val[11]);
} else if (len == (PHY_HIST_SIZE - 1)) {
PHYDM_PRINT2BUF(buf, buf_size,
"[%.2d, %.2d, %.2d, %.2d, %.2d, %.2d, %.2d, %.2d, %.2d, %.2d, %.2d]",
val[0], val[1], val[2], val[3], val[4],
val[5], val[6], val[7], val[8], val[9],
val[10]);
}
}
void phydm_nss_hitogram(void *dm_void, enum PDM_RATE_TYPE rate_type)
{
struct PHY_DM_STRUCT *dm = (struct PHY_DM_STRUCT *)dm_void;
struct _odm_phy_dbg_info_ *dbg_i = &dm->phy_dbg_info;
struct phydm_phystatus_statistic *dbg_s = &dbg_i->phystatus_statistic_info;
char buf[PHYDM_SNPRINT_SIZE] = {0};
u16 buf_size = PHYDM_SNPRINT_SIZE;
u16 h_size = PHY_HIST_SIZE;
u16 *evm_hist = NULL, *snr_hist = NULL;
u8 i = 0;
u8 ss = phydm_rate_type_2_num_ss(dm, rate_type);
for (i = 0; i < ss; i++) {
if (rate_type == PDM_1SS) {
evm_hist = &dbg_s->evm_1ss_hist[0];
snr_hist = &dbg_s->snr_1ss_hist[0];
} else if (rate_type == PDM_2SS) {
#if (defined(PHYDM_COMPILE_ABOVE_2SS))
evm_hist = &dbg_s->evm_2ss_hist[i][0];
snr_hist = &dbg_s->snr_2ss_hist[i][0];
#endif
} else if (rate_type == PDM_3SS) {
#if (defined(PHYDM_COMPILE_ABOVE_3SS))
evm_hist = &dbg_s->evm_3ss_hist[i][0];
snr_hist = &dbg_s->snr_3ss_hist[i][0];
#endif
} else if (rate_type == PDM_4SS) {
#if (defined(PHYDM_COMPILE_ABOVE_4SS))
evm_hist = &dbg_s->evm_4ss_hist[i][0];
snr_hist = &dbg_s->snr_4ss_hist[i][0];
#endif
}
phydm_print_hist_2_buf(dm, evm_hist, h_size, buf, buf_size);
PHYDM_DBG(dm, ODM_COMP_COMMON, ("[%d-SS][EVM][%d]=%s\n", ss, i, buf));
phydm_print_hist_2_buf(dm, snr_hist, h_size, buf, buf_size);
PHYDM_DBG(dm, ODM_COMP_COMMON, ("[%d-SS][SNR][%d]=%s\n", ss, i, buf));
}
}
void phydm_show_phy_hitogram(void *dm_void)
{
struct PHY_DM_STRUCT *dm = (struct PHY_DM_STRUCT *)dm_void;
struct _odm_phy_dbg_info_ *dbg_i = &dm->phy_dbg_info;
struct phydm_phystatus_statistic *dbg_s = &dbg_i->phystatus_statistic_info;
char buf[PHYDM_SNPRINT_SIZE] = {0};
u16 buf_size = PHYDM_SNPRINT_SIZE;
u16 th_size = PHY_HIST_SIZE - 1;
u8 i = 0;
PHYDM_DBG(dm, ODM_COMP_COMMON, ("[PHY Histogram] ==============>\n"));
/*===[Threshold]==============================================================*/
phydm_print_hist_2_buf(dm, dbg_i->evm_hist_th, th_size, buf, buf_size);
PHYDM_DBG(dm, ODM_COMP_COMMON, ("%-16s=%s\n", "[EVM_TH]", buf));
phydm_print_hist_2_buf(dm, dbg_i->snr_hist_th, th_size, buf, buf_size);
PHYDM_DBG(dm, ODM_COMP_COMMON, ("%-16s=%s\n", "[SNR_TH]", buf));
/*===[OFDM]===================================================================*/
if (dbg_s->rssi_ofdm_cnt) {
phydm_print_hist_2_buf(dm, dbg_s->evm_ofdm_hist, PHY_HIST_SIZE,
buf, buf_size);
PHYDM_DBG(dm, ODM_COMP_COMMON, ("%-14s=%s\n", "[OFDM][EVM]", buf));
phydm_print_hist_2_buf(dm, dbg_s->snr_ofdm_hist, PHY_HIST_SIZE,
buf, buf_size);
PHYDM_DBG(dm, ODM_COMP_COMMON, ("%-14s=%s\n", "[OFDM][SNR]", buf));
}
/*===[1-SS]===================================================================*/
if (dbg_s->rssi_1ss_cnt)
phydm_nss_hitogram(dm, PDM_1SS);
/*===[2-SS]===================================================================*/
#if (defined(PHYDM_COMPILE_ABOVE_2SS))
if ((dm->support_ic_type & PHYDM_IC_ABOVE_2SS) && dbg_s->rssi_2ss_cnt)
phydm_nss_hitogram(dm, PDM_2SS);
#endif
/*===[3-SS]===================================================================*/
#if (defined(PHYDM_COMPILE_ABOVE_3SS))
if ((dm->support_ic_type & PHYDM_IC_ABOVE_3SS) && dbg_s->rssi_3ss_cnt)
phydm_nss_hitogram(dm, PDM_3SS);
#endif
/*===[4-SS]===================================================================*/
#if (defined(PHYDM_COMPILE_ABOVE_4SS))
if (dm->support_ic_type & PHYDM_IC_ABOVE_4SS && dbg_s->rssi_4ss_cnt)
phydm_nss_hitogram(dm, PDM_4SS);
#endif
}
void
phydm_get_avg_phystatus_val
(
@ -1081,6 +1190,7 @@ phydm_get_phy_statistic(
phydm_rx_rate_distribution(p_dm);
phydm_reset_rx_rate_distribution(p_dm);
phydm_show_phy_hitogram(p_dm);
phydm_get_avg_phystatus_val(p_dm);
phydm_reset_phystatus_statistic(p_dm);
};
@ -1102,8 +1212,8 @@ phydm_basic_dbg_message
s32 tmp_val = 0;
u8 tmp_val_u1 = 0;
if (!(p_dm->debug_components & ODM_COMP_COMMON))
return;
/* if (!(p_dm->debug_components & ODM_COMP_COMMON)) */
/* return; */
PHYDM_DBG(p_dm, ODM_COMP_COMMON, ("[PHYDM Common MSG] System up time: ((%d sec))----->\n", p_dm->phydm_sys_up_time));

View File

@ -73,6 +73,8 @@
#define RA_H2C BIT(5)
#define F_RATE_AP_RPT BIT(7)
#define PHYDM_SNPRINT_SIZE 64
/* -----------------------------------------------------------------------------
* Define the tracing components
*
@ -95,20 +97,24 @@
#define dcmd_printf DCMD_Printf
#define dcmd_scanf DCMD_Scanf
#define RT_PRINTK dbg_print
#define PHYDM_PRINT2BUF RT_SPRINTF
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) && defined(DM_ODM_CE_MAC80211)
#define dbg_print(args...)
#define RT_PRINTK(fmt, args...) \
RT_TRACE(((struct rtl_priv *)p_dm->adapter), \
COMP_PHYDM, DBG_DMESG, fmt, ## args)
#define RT_DISP(dbgtype, dbgflag, printstr)
#define PHYDM_PRINT2BUF snprintf
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
#define dbg_print printk
#define RT_PRINTK(fmt, args...) dbg_print(fmt, ## args)
#define RT_DISP(dbgtype, dbgflag, printstr)
#define PHYDM_PRINT2BUF snprintf
#else
#define dbg_print panic_printk
/*#define RT_PRINTK(fmt, args...) dbg_print("%s(): " fmt, __FUNCTION__, ## args);*/
#define RT_PRINTK(args...) dbg_print(args)
#define PHYDM_PRINT2BUF snprintf
#endif
#ifndef ASSERT
@ -214,27 +220,45 @@
#define PHYDM_SSCANF(x, y, z) sscanf(x, y, z)
#define PHYDM_VAST_INFO_SNPRINTF(msg)\
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
#define PHYDM_VAST_INFO_SNPRINTF(msg)\
do {\
snprintf msg;\
dbg_print("%s\n", output);\
} while (0)
#else
#define PHYDM_VAST_INFO_SNPRINTF(msg)\
do {\
snprintf msg;\
dbg_print(output);\
} while (0)
#endif
#if (PHYDM_DBGPRINT == 1)
#define PHYDM_SNPRINTF(msg)\
do {\
snprintf msg;\
dbg_print(output);\
} while (0)
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
#define PHYDM_SNPRINTF(msg)\
do {\
snprintf msg;\
dbg_print("%s\n", output);\
} while (0)
#else
#define PHYDM_SNPRINTF(msg)\
do {\
snprintf msg;\
dbg_print(output);\
} while (0)
#endif
#else
#define PHYDM_SNPRINTF(msg)\
do {\
if (out_len > used)\
used += snprintf msg;\
} while (0)
#endif
#define PHYDM_SNPRINTF(msg)\
do {\
if (out_len > used)\
used += snprintf msg;\
} while (0)
#endif /*#if (PHYDM_DBGPRINT == 1)*/
#endif
void phydm_show_phy_hitogram(void *dm_void);
void
phydm_init_debug_setting(
struct PHY_DM_STRUCT *p_dm

View File

@ -480,6 +480,8 @@ phydm_radar_detect_dm_check(
}
}
fa_flag = 1;
} else {
p_dfs->radar_det_mask_hist[index] = 0;
}
if (p_dfs->det_print) {
@ -494,7 +496,7 @@ phydm_radar_detect_dm_check(
for (i=0; i<5; i++)
PHYDM_DBG(p_dm, DBG_DFS, ("%d ", p_dfs->fa_inc_hist[i]));
PHYDM_DBG(p_dm, DBG_DFS,
("\nmax_fa_in_hist: %d pre_post_now_acc_fa_in_hist: %d ", max_fa_in_hist, pre_post_now_acc_fa_in_hist));
("\nfa_mask_th: %d max_fa_in_hist: %d total_fa_in_hist: %d pre_post_now_acc_fa_in_hist: %d ", fa_mask_th, max_fa_in_hist, total_fa_in_hist, pre_post_now_acc_fa_in_hist));
}
sum = 0;
@ -547,7 +549,7 @@ phydm_radar_detect_dm_check(
odm_set_bb_reg(p_dm, 0x918, 0x00001f00, p_dfs->pwdb_th);
}
if (p_dfs->det_print2) {
if (p_dfs->det_print) {
PHYDM_DBG(p_dm, DBG_DFS,
("fault_flag_det[%d], fault_flag_psd[%d], DFS_detected [%d]\n", fault_flag_det, fault_flag_psd, radar_detected));
}

View File

@ -99,11 +99,21 @@ odm_fa_threshold_check(
struct PHY_DM_STRUCT *p_dm = (struct PHY_DM_STRUCT *)p_dm_void;
struct phydm_dig_struct *p_dig_t = &p_dm->dm_dig_table;
if (p_dig_t->is_dbg_fa_th == true)
return;
if (p_dig_t->is_dbg_fa_th) {
PHYDM_DBG(p_dm, DBG_DIG, ("Manual Fix FA_th\n"));
//if (p_dig_t->is_dbg_fa_th == true)
//return;
} else if (p_dm->is_linked && (is_performance || is_dfs_band)) {
if (p_dm->rssi_min < 20) { /*[PHYDM-252]*/
p_dig_t->fa_th[0] = 500;
p_dig_t->fa_th[1] = 750;
p_dig_t->fa_th[2] = 1000;
if (p_dm->is_linked && (is_performance || is_dfs_band)) {
if ((p_dm->rx_tp >> 2) > p_dm->tx_tp && p_dm->rx_tp < 10 && p_dm->rx_tp > 1) { /*10Mbps & 1Mbps*/
//if (p_dm->is_linked && (is_performance || is_dfs_band)) {
} else if ((p_dm->rx_tp >> 2) > p_dm->tx_tp && p_dm->rx_tp < 10 && p_dm->rx_tp > 1) { /*10Mbps & 1Mbps*/
p_dig_t->fa_th[0] = 125;
p_dig_t->fa_th[1] = 250;
p_dig_t->fa_th[2] = 500;
@ -579,6 +589,7 @@ phydm_dig_dym_boundary_decision(
{
struct phydm_dig_struct *p_dig_t = &p_dm->dm_dig_table;
u8 offset = 15, tmp_max = 0;
u8 max_of_rssi_min = 0;
PHYDM_DBG(p_dm, DBG_DIG,
("Offset=((%d))\n", offset));
@ -593,7 +604,11 @@ phydm_dig_dym_boundary_decision(
/* DIG upper bound */
tmp_max = p_dig_t->rx_gain_range_min + offset;
if (p_dig_t->rx_gain_range_min != p_dm->rssi_min) {
max_of_rssi_min = p_dm->rssi_min + offset;
if (tmp_max > max_of_rssi_min)
tmp_max = max_of_rssi_min;
}
if (tmp_max > p_dig_t->dm_dig_max)
p_dig_t->rx_gain_range_max = p_dig_t->dm_dig_max;
else

View File

@ -39,7 +39,7 @@
#define DIG_MAX_OF_MIN_BALANCE_MODE 0x2a
#define DIG_MAX_PERFORMANCE_MODE 0x5a
#define DIG_MAX_OF_MIN_PERFORMANCE_MODE 0x2a /*from 3E -> 2A, refine by YuChen 2017/04/18*/
#define DIG_MAX_OF_MIN_PERFORMANCE_MODE 0x40 /*from 3E -> 2A, refine by YuChen 2017/04/18*/
#define DIG_MIN_PERFORMANCE 0x20
@ -109,6 +109,7 @@ struct phydm_dig_struct {
u8 pause_dig_value[PHYDM_PAUSE_MAX_NUM];
enum dig_goupcheck_level dig_go_up_check_level;
u8 aaa_default;
u8 a0a_default;
u16 fa_th[3];
#if (RTL8822B_SUPPORT == 1 || RTL8197F_SUPPORT == 1 || RTL8821C_SUPPORT == 1)
u8 rf_gain_idx;
@ -146,6 +147,7 @@ struct phydm_fa_struct {
u32 cnt_ofdm_fail_pre; /* For RTL8881A */
u32 cnt_cck_fail;
u32 cnt_all;
u32 cnt_all_accumulated; /*accumulate cnt_all*/
u32 cnt_all_pre;
u32 cnt_fast_fsync;
u32 cnt_sb_search_fail;

View File

@ -40,7 +40,7 @@
#endif
#if (RTL8822B_SUPPORT == 1 || RTL8197F_SUPPORT == 1)
/*#define CONFIG_ADAPTIVE_SOML*/
#define CONFIG_ADAPTIVE_SOML
#endif
@ -61,7 +61,7 @@
#ifdef CONFIG_PHYDM_ANTENNA_DIVERSITY
#if (RTL8723B_SUPPORT == 1) || (RTL8821A_SUPPORT == 1) || (RTL8188F_SUPPORT == 1) || (RTL8821C_SUPPORT == 1)
#if (RTL8723B_SUPPORT == 1) || (RTL8821A_SUPPORT == 1) || (RTL8188F_SUPPORT == 1) || (RTL8821C_SUPPORT == 1) || (RTL8723D_SUPPORT == 1)
#define CONFIG_S0S1_SW_ANTENNA_DIVERSITY
#endif
@ -72,6 +72,7 @@
#if (RTL8822B_SUPPORT == 1)
/*#define CONFIG_HL_SMART_ANTENNA_TYPE2*/
#endif
#endif
#endif

View File

@ -348,13 +348,11 @@ odm_config_rf_with_tx_pwr_track_header_file(
/* JJ ADD 20161014 */
#if RTL8710B_SUPPORT
if (p_dm->support_ic_type == ODM_RTL8710B) {
if (p_dm->support_interface == ODM_ITRF_PCIE)
READ_AND_CONFIG_MP(8710b, _txpowertrack_pcie);
else if (p_dm->support_interface == ODM_ITRF_USB)
READ_AND_CONFIG_MP(8710b, _txpowertrack_usb);
else if (p_dm->support_interface == ODM_ITRF_SDIO)
READ_AND_CONFIG_MP(8710b, _txpowertrack_sdio);
if (p_dm->package_type == 1)
READ_AND_CONFIG_MP(8710b, _txpowertrack_qfn48m_smic);
else if (p_dm->package_type == 5)
READ_AND_CONFIG_MP(8710b, _txpowertrack_qfn48m_umc);
READ_AND_CONFIG_MP(8710b, _txxtaltrack);
}
#endif

View File

@ -75,7 +75,28 @@ odm_sign_conversion(
return value;
}
/*threshold must form low to high*/
u16 phydm_find_intrvl(void *dm_void, u16 val, u16 *threshold, u16 th_len)
{
struct PHY_DM_STRUCT *dm = (struct PHY_DM_STRUCT *)dm_void;
u16 i = 0;
u16 ret_val = 0;
u16 max_th = threshold[th_len - 1];
for (i = 0; i < th_len; i++) {
if (val < threshold[i]) {
ret_val = i;
break;
} else if (val >= max_th) {
ret_val = th_len;
break;
}
}
return ret_val;
}
void
phydm_seq_sorting(
void *p_dm_void,

View File

@ -55,6 +55,8 @@ odm_sign_conversion(
u32 total_bit
);
u16 phydm_find_intrvl(void *dm_void, u16 val, u16 *threshold, u16 th_len);
void
phydm_seq_sorting(
void *p_dm_void,

View File

@ -91,97 +91,162 @@ phydm_reset_phystatus_statistic(
void
phydm_avg_phystatus_index(
struct PHY_DM_STRUCT *p_dm,
void *dm_void,
struct phydm_phyinfo_struct *p_phy_info,
struct phydm_perpkt_info_struct *p_pktinfo
)
{
u8 rate_ss = phydm_rate_to_num_ss(p_dm, p_pktinfo->data_rate);
struct phydm_phystatus_statistic *p_dbg_statistic = &(p_dm->phy_dbg_info.phystatus_statistic_info);
struct PHY_DM_STRUCT *dm = (struct PHY_DM_STRUCT *)dm_void;
struct _odm_phy_dbg_info_ *dbg_i = &dm->phy_dbg_info;
struct phydm_phystatus_statistic *dbg_s = &dbg_i->phystatus_statistic_info;
u8 rssi[PHYSTS_PATH_NUM] = {0};
u8 evm[PHYSTS_PATH_NUM] = {0};
s8 snr[PHYSTS_PATH_NUM] = {0};
u32 size = PHYSTS_PATH_NUM; /*size of path=4*/
u16 size_th = PHY_HIST_SIZE - 1; /*size of threshold*/
u16 val = 0, intvl = 0;
u8 i = 0;
odm_move_memory(dm, rssi, p_phy_info->rx_mimo_signal_strength, size);
odm_move_memory(dm, evm, p_phy_info->rx_mimo_evm_dbm, size);
odm_move_memory(dm, snr, p_phy_info->rx_snr, size);
if (p_pktinfo->data_rate <= ODM_RATE11M) {
/*RSSI*/
p_dbg_statistic->rssi_cck_sum += p_phy_info->rx_mimo_signal_strength[0];
p_dbg_statistic->rssi_cck_cnt++;
dbg_s->rssi_cck_sum += rssi[0];
dbg_s->rssi_cck_cnt++;
return;
} else if (p_pktinfo->data_rate <= ODM_RATE54M) {
/*evm*/
p_dbg_statistic->evm_ofdm_sum += p_phy_info->rx_mimo_evm_dbm[0];
dbg_s->evm_ofdm_sum += evm[0];
/*SNR*/
p_dbg_statistic->snr_ofdm_sum += p_phy_info->rx_snr[0];
dbg_s->snr_ofdm_sum += snr[0];
/*RSSI*/
p_dbg_statistic->rssi_ofdm_sum += p_phy_info->rx_mimo_signal_strength[0];
p_dbg_statistic->rssi_ofdm_cnt++;
} else if (rate_ss == 1) {
dbg_s->rssi_ofdm_sum += rssi[0];
dbg_s->rssi_ofdm_cnt++;
val = (u16)evm[0];
intvl = phydm_find_intrvl(dm, val, dbg_i->evm_hist_th, size_th);
dbg_s->evm_ofdm_hist[intvl]++;
val = (u16)snr[0];
intvl = phydm_find_intrvl(dm, val, dbg_i->snr_hist_th, size_th);
dbg_s->snr_ofdm_hist[intvl]++;
} else if (p_pktinfo->rate_ss == 1) {
/*===[1-SS]===================================================================*/
/*evm*/
p_dbg_statistic->evm_1ss_sum += p_phy_info->rx_mimo_evm_dbm[0];
dbg_s->evm_1ss_sum += evm[0];
/*SNR*/
p_dbg_statistic->snr_1ss_sum += p_phy_info->rx_snr[0];
dbg_s->snr_1ss_sum += snr[0];
p_dbg_statistic->rssi_1ss_sum += p_phy_info->rx_mimo_signal_strength[0];
p_dbg_statistic->rssi_1ss_cnt++;
} else if (rate_ss == 2) {
/*RSSI*/
dbg_s->rssi_1ss_sum += rssi[0];
/*EVM Histogram*/
val = (u16)evm[0];
intvl = phydm_find_intrvl(dm, val, dbg_i->evm_hist_th, size_th);
dbg_s->evm_1ss_hist[intvl]++;
/*SNR Histogram*/
val = (u16)snr[0];
intvl = phydm_find_intrvl(dm, val, dbg_i->snr_hist_th, size_th);
dbg_s->snr_1ss_hist[intvl]++;
dbg_s->rssi_1ss_cnt++;
} else if (p_pktinfo->rate_ss == 2) {
/*===[2-SS]===================================================================*/
#if (defined(PHYDM_COMPILE_ABOVE_2SS))
/*evm*/
p_dbg_statistic->evm_2ss_sum[0] += p_phy_info->rx_mimo_evm_dbm[0];
p_dbg_statistic->evm_2ss_sum[1] += p_phy_info->rx_mimo_evm_dbm[1];
for (i = 0; i < p_pktinfo->rate_ss; i++) {
/*evm*/
dbg_s->evm_2ss_sum[i] += evm[i];
/*SNR*/
dbg_s->snr_2ss_sum[i] += snr[i];
/*RSSI*/
dbg_s->rssi_2ss_sum[i] += rssi[i];
/*EVM Histogram*/
val = (u16)evm[i];
intvl = phydm_find_intrvl(dm, val, dbg_i->evm_hist_th,
size_th);
dbg_s->evm_2ss_hist[i][intvl]++;
/*SNR*/
p_dbg_statistic->snr_2ss_sum[0] += p_phy_info->rx_snr[0];
p_dbg_statistic->snr_2ss_sum[1] += p_phy_info->rx_snr[1];
/*RSSI*/
p_dbg_statistic->rssi_2ss_sum[0] += p_phy_info->rx_mimo_signal_strength[0];
p_dbg_statistic->rssi_2ss_sum[1] += p_phy_info->rx_mimo_signal_strength[1];
p_dbg_statistic->rssi_2ss_cnt++;
/*SNR Histogram*/
val = (u16)snr[i];
intvl = phydm_find_intrvl(dm, val, dbg_i->snr_hist_th,
size_th);
dbg_s->snr_2ss_hist[i][intvl]++;
}
dbg_s->rssi_2ss_cnt++;
#endif
} else if (rate_ss == 3) {
} else if (p_pktinfo->rate_ss == 3) {
/*===[3-SS]===================================================================*/
#if (defined(PHYDM_COMPILE_ABOVE_3SS))
/*evm*/
p_dbg_statistic->evm_3ss_sum[0] += p_phy_info->rx_mimo_evm_dbm[0];
p_dbg_statistic->evm_3ss_sum[1] += p_phy_info->rx_mimo_evm_dbm[1];
p_dbg_statistic->evm_3ss_sum[2] += p_phy_info->rx_mimo_evm_dbm[2];
for (i = 0; i < p_pktinfo->rate_ss; i++) {
/*evm*/
dbg_s->evm_3ss_sum[i] += evm[i];
/*SNR*/
dbg_s->snr_3ss_sum[i] += snr[i];
/*RSSI*/
dbg_s->rssi_3ss_sum[i] += rssi[i];
/*EVM Histogram*/
val = (u16)evm[i];
intvl = phydm_find_intrvl(dm, val, dbg_i->evm_hist_th,
size_th);
dbg_s->evm_3ss_hist[i][intvl]++;
/*SNR*/
p_dbg_statistic->snr_3ss_sum[0] += p_phy_info->rx_snr[0];
p_dbg_statistic->snr_3ss_sum[1] += p_phy_info->rx_snr[1];
p_dbg_statistic->snr_3ss_sum[2] += p_phy_info->rx_snr[2];
/*RSSI*/
p_dbg_statistic->rssi_3ss_sum[0] += p_phy_info->rx_mimo_signal_strength[0];
p_dbg_statistic->rssi_3ss_sum[1] += p_phy_info->rx_mimo_signal_strength[1];
p_dbg_statistic->rssi_3ss_sum[2] += p_phy_info->rx_mimo_signal_strength[2];
p_dbg_statistic->rssi_3ss_cnt++;
/*SNR Histogram*/
val = (u16)snr[i];
intvl = phydm_find_intrvl(dm, val, dbg_i->snr_hist_th,
size_th);
dbg_s->snr_3ss_hist[i][intvl]++;
}
dbg_s->rssi_3ss_cnt++;
#endif
} else if (rate_ss == 4) {
} else if (p_pktinfo->rate_ss == 4) {
/*===[4-SS]===================================================================*/
#if (defined(PHYDM_COMPILE_ABOVE_4SS))
/*evm*/
p_dbg_statistic->evm_4ss_sum[0] += p_phy_info->rx_mimo_evm_dbm[0];
p_dbg_statistic->evm_4ss_sum[1] += p_phy_info->rx_mimo_evm_dbm[1];
p_dbg_statistic->evm_4ss_sum[2] += p_phy_info->rx_mimo_evm_dbm[2];
p_dbg_statistic->evm_4ss_sum[3] += p_phy_info->rx_mimo_evm_dbm[3];
for (i = 0; i < p_pktinfo->rate_ss; i++) {
/*evm*/
dbg_s->evm_4ss_sum[i] += evm[i];
/*SNR*/
dbg_s->snr_4ss_sum[i] += snr[i];
/*RSSI*/
dbg_s->rssi_4ss_sum[i] += rssi[i];
/*EVM Histogram*/
val = (u16)evm[i];
intvl = phydm_find_intrvl(dm, val, dbg_i->evm_hist_th,
size_th);
dbg_s->evm_4ss_hist[i][intvl]++;
/*SNR*/
p_dbg_statistic->snr_4ss_sum[0] += p_phy_info->rx_snr[0];
p_dbg_statistic->snr_4ss_sum[1] += p_phy_info->rx_snr[1];
p_dbg_statistic->snr_4ss_sum[2] += p_phy_info->rx_snr[2];
p_dbg_statistic->snr_4ss_sum[3] += p_phy_info->rx_snr[3];
/*RSSI*/
p_dbg_statistic->rssi_4ss_sum[0] += p_phy_info->rx_mimo_signal_strength[0];
p_dbg_statistic->rssi_4ss_sum[1] += p_phy_info->rx_mimo_signal_strength[1];
p_dbg_statistic->rssi_4ss_sum[2] += p_phy_info->rx_mimo_signal_strength[2];
p_dbg_statistic->rssi_4ss_sum[3] += p_phy_info->rx_mimo_signal_strength[3];
p_dbg_statistic->rssi_4ss_cnt++;
/*SNR Histogram*/
val = (u16)snr[i];
intvl = phydm_find_intrvl(dm, val, dbg_i->snr_hist_th,
size_th);
dbg_s->snr_4ss_hist[i][intvl]++;
}
dbg_s->rssi_4ss_cnt++;
#endif
}
}
void phydm_avg_phystatus_init(void *dm_void)
{
struct PHY_DM_STRUCT *dm = (struct PHY_DM_STRUCT *)dm_void;
struct _odm_phy_dbg_info_ *dbg_i = &dm->phy_dbg_info;
u16 snr_hist_th[PHY_HIST_SIZE - 1] = {5, 8, 11, 14, 17, 20, 23, 26,
29, 32, 35};
u16 evm_hist_th[PHY_HIST_SIZE - 1] = {5, 8, 11, 14, 17, 20, 23, 26,
29, 32, 35};
u32 size = (PHY_HIST_SIZE - 1) * 2;
odm_move_memory(dm, dbg_i->snr_hist_th, snr_hist_th, size);
odm_move_memory(dm, dbg_i->evm_hist_th, evm_hist_th, size);
}
u8 phydm_get_signal_quality(
struct phydm_phyinfo_struct *p_phy_info,
struct PHY_DM_STRUCT *p_dm,
@ -773,7 +838,8 @@ phydm_rx_phy_status92c_series_parsing(
is_cck_rate = (p_pktinfo->data_rate <= ODM_RATE11M) ? true : false;
p_dm->rate_ss = phydm_rate_to_num_ss(p_dm, p_pktinfo->data_rate);
p_pktinfo->rate_ss = p_dm->rate_ss;
if (p_pktinfo->is_to_self)
p_dm->curr_station_id = p_pktinfo->station_id;
@ -1094,6 +1160,7 @@ phydm_rx_phy_status_jaguar_series_parsing(
is_cck_rate = (p_pktinfo->data_rate <= ODM_RATE11M) ? true : false;
p_dm->rate_ss = phydm_rate_to_num_ss(p_dm, p_pktinfo->data_rate);
p_pktinfo->rate_ss = p_dm->rate_ss;
if (p_pktinfo->is_to_self)
p_dm->curr_station_id = p_pktinfo->station_id;
@ -2492,6 +2559,7 @@ phydm_rx_phy_status_new_type(
/* Memory reset */
phydm_reset_phy_info(p_dm, p_phy_info);
p_dm->rate_ss = phydm_rate_to_num_ss(p_dm, p_pktinfo->data_rate);
p_pktinfo->rate_ss = p_dm->rate_ss;
/* Phy status parsing */
switch (phy_status_type) {
@ -2563,8 +2631,9 @@ phydm_rx_phy_status_init(
void *p_dm_void
)
{
#ifdef PHYDM_PHYSTAUS_SMP_MODE
struct PHY_DM_STRUCT *p_dm = (struct PHY_DM_STRUCT *)p_dm_void;
#ifdef PHYDM_PHYSTAUS_SMP_MODE
struct pkt_process_info *p_pkt_process = &(p_dm->pkt_proc_struct);
if (p_dm->support_ic_type == ODM_RTL8822B) {
@ -2578,4 +2647,5 @@ phydm_rx_phy_status_init(
odm_set_bb_reg(p_dm, 0x9e4, 0xfc00, 0x0); /*Update Sampling time*/
}
#endif
phydm_avg_phystatus_init(p_dm);
}

View File

@ -28,6 +28,8 @@
#define CFO_HW_RPT_2_MHZ(val) ((val<<1) + (val>>1))
/* ((X* 3125) / 10)>>7 = (X*10)>>2 = X*2.5 = X<<1 + X>>1 */
#define PHYSTS_PATH_NUM 4
/* ************************************************************
* structure and define
* ************************************************************ */

View File

@ -76,6 +76,15 @@
#define RX_SMOOTH_FACTOR 20
#endif
enum PDM_RATE_TYPE {
PDM_1SS = 1, /*VHT/HT 1SS*/
PDM_2SS = 2, /*VHT/HT 2SS*/
PDM_3SS = 3, /*VHT/HT 3SS*/
PDM_4SS = 4, /*VHT/HT 4SS*/
PDM_CCK = 11, /*B*/
PDM_OFDM = 12 /*G*/
};
/* -----MGN rate--------------------------------- */
enum ODM_MGN_RATE {

View File

@ -109,7 +109,7 @@ rtw_phydm_cfg_phy_para(
#endif
/* JJ ADD 20161014 */
#if (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_AP|ODM_IOT))
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_IOT))
#define RTL8710B_SUPPORT 0
#endif

View File

@ -19,6 +19,32 @@
#include "mp_precomp.h"
#include "phydm_precomp.h"
u8 phydm_rate_type_2_num_ss(void *dm_void, enum PDM_RATE_TYPE type)
{
u8 num_ss = 1;
switch (type) {
case PDM_CCK:
case PDM_OFDM:
case PDM_1SS:
num_ss = 1;
break;
case PDM_2SS:
num_ss = 2;
break;
case PDM_3SS:
num_ss = 3;
break;
case PDM_4SS:
num_ss = 4;
break;
default:
break;
}
return num_ss;
}
void
phydm_h2C_debug(
void *p_dm_void,
@ -890,17 +916,17 @@ phydm_get_bb_mod_ra_mask(
if (wireless_mode != WIRELESS_CCK) {
if (rssi_lv == 0)
ra_mask_bitmap &= 0xffffffff;
ra_mask_bitmap &= 0xffffffffffffffff;
else if (rssi_lv == 1)
ra_mask_bitmap &= 0xfffffff0;
ra_mask_bitmap &= 0xfffffffffffffff0;
else if (rssi_lv == 2)
ra_mask_bitmap &= 0xffffefe0;
ra_mask_bitmap &= 0xffffffffffffefe0;
else if (rssi_lv == 3)
ra_mask_bitmap &= 0xffffcfc0;
ra_mask_bitmap &= 0xffffffffffffcfc0;
else if (rssi_lv == 4)
ra_mask_bitmap &= 0xffff8f80;
ra_mask_bitmap &= 0xffffffffffff8f80;
else if (rssi_lv >= 5)
ra_mask_bitmap &= 0xffff0f00;
ra_mask_bitmap &= 0xffffffffffff0f00;
}
PHYDM_DBG(p_dm, DBG_RA, ("Mod by RSSI=0x%llx\n", ra_mask_bitmap));
@ -1098,7 +1124,7 @@ phydm_ra_registed(
#if (RTL8188E_SUPPORT == 1) && (RATE_ADAPTIVE_SUPPORT == 1)
if (p_dm->support_ic_type == ODM_RTL8188E)
phydm_get_rate_id_88e(p_dm, macid);
p_ra->rate_id = phydm_get_rate_id_88e(p_dm, macid);
else
#endif
{

View File

@ -214,6 +214,8 @@ struct _rate_adaptive_table_ {
void (*record_ra_info)(void *p_dm_void, u8 macid, struct cmn_sta_info *p_sta, u64 ra_mask);
};
u8 phydm_rate_type_2_num_ss(void *dm_void, enum PDM_RATE_TYPE type);
void
phydm_h2C_debug(
void *p_dm_void,

View File

@ -20,6 +20,7 @@
#include "mp_precomp.h"
#include "phydm_precomp.h"
#ifdef NEVER
void
phydm_dynamicsoftmletting(
struct PHY_DM_STRUCT *p_dm
@ -54,6 +55,7 @@ phydm_dynamicsoftmletting(
#endif
}
#endif
#ifdef CONFIG_ADAPTIVE_SOML
void
@ -126,6 +128,37 @@ phydm_adaptive_soml_workitem_callback(
#endif
}
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
void
phydm_adaptive_soml_callback(
void *dm_void
)
{
struct PHY_DM_STRUCT *dm = (struct PHY_DM_STRUCT *)dm_void;
void *padapter = dm->adapter;
if (*dm->p_is_net_closed)
return;
if (dm->support_interface == ODM_ITRF_PCIE) {
phydm_adsl(dm);
} else {
/* Can't do I/O in timer callback*/
rtw_run_in_thread_cmd(padapter, phydm_adaptive_soml_workitem_callback, padapter);
}
}
void
phydm_adaptive_soml_workitem_callback(
void *context
)
{
void *adapter = (void *)context;
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(((PADAPTER)adapter));
struct PHY_DM_STRUCT *dm = &hal_data->odmpriv;
/*dbg_print("phydm_adaptive_soml-phydm_adaptive_soml_workitem_callback\n");*/
phydm_adsl(dm);
}
#else
void
@ -202,32 +235,34 @@ phydm_soml_statistics(
u8 i;
u32 num_bytes_diff;
if (p_dm->support_ic_type == ODM_RTL8197F) {
if (on_off_state == SOML_ON) {
for (i = 0; i < HT_RATE_IDX; i++) {
num_bytes_diff = p_dm_soml_table->num_ht_bytes[i] - p_dm_soml_table->pre_num_ht_bytes[i];
p_dm_soml_table->num_ht_bytes_on[i] += num_bytes_diff;
p_dm_soml_table->pre_num_ht_bytes[i] = p_dm_soml_table->num_ht_bytes[i];
}
} else if (on_off_state == SOML_OFF) {
for (i = 0; i < HT_RATE_IDX; i++) {
num_bytes_diff = p_dm_soml_table->num_ht_bytes[i] - p_dm_soml_table->pre_num_ht_bytes[i];
p_dm_soml_table->num_ht_bytes_off[i] += num_bytes_diff;
p_dm_soml_table->pre_num_ht_bytes[i] = p_dm_soml_table->num_ht_bytes[i];
if (on_off_state == SOML_ON) {
if (*p_dm->p_channel <= 14) {
for (i = ODM_RATEMCS0; i <= ODM_RATEMCS15; i++) {
num_bytes_diff = p_dm_soml_table->num_ht_bytes[i - ODM_RATEMCS0] - p_dm_soml_table->pre_num_ht_bytes[i - ODM_RATEMCS0];
p_dm_soml_table->num_ht_bytes_on[i - ODM_RATEMCS0] += num_bytes_diff;
p_dm_soml_table->pre_num_ht_bytes[i - ODM_RATEMCS0] = p_dm_soml_table->num_ht_bytes[i - ODM_RATEMCS0];
}
}
} else if (p_dm->support_ic_type == ODM_RTL8822B) {
if (on_off_state == SOML_ON) {
for (i = 0; i < VHT_RATE_IDX; i++) {
num_bytes_diff = p_dm_soml_table->num_vht_bytes[i] - p_dm_soml_table->pre_num_vht_bytes[i];
p_dm_soml_table->num_vht_bytes_on[i] += num_bytes_diff;
p_dm_soml_table->pre_num_vht_bytes[i] = p_dm_soml_table->num_vht_bytes[i];
if (p_dm->support_ic_type == ODM_RTL8822B) {
for (i = ODM_RATEVHTSS1MCS0; i <= ODM_RATEVHTSS2MCS9; i++) {
num_bytes_diff = p_dm_soml_table->num_vht_bytes[i - ODM_RATEVHTSS1MCS0] - p_dm_soml_table->pre_num_vht_bytes[i - ODM_RATEVHTSS1MCS0];
p_dm_soml_table->num_vht_bytes_on[i - ODM_RATEVHTSS1MCS0] += num_bytes_diff;
p_dm_soml_table->pre_num_vht_bytes[i - ODM_RATEVHTSS1MCS0] = p_dm_soml_table->num_vht_bytes[i - ODM_RATEVHTSS1MCS0];
}
} else if (on_off_state == SOML_OFF) {
for (i = 0; i < VHT_RATE_IDX; i++) {
num_bytes_diff = p_dm_soml_table->num_vht_bytes[i] - p_dm_soml_table->pre_num_vht_bytes[i];
p_dm_soml_table->num_vht_bytes_off[i] += num_bytes_diff;
p_dm_soml_table->pre_num_vht_bytes[i] = p_dm_soml_table->num_vht_bytes[i];
}
} else if (on_off_state == SOML_OFF) {
if (*p_dm->p_channel <= 14) {
for (i = ODM_RATEMCS0; i <= ODM_RATEMCS15; i++) {
num_bytes_diff = p_dm_soml_table->num_ht_bytes[i - ODM_RATEMCS0] - p_dm_soml_table->pre_num_ht_bytes[i - ODM_RATEMCS0];
p_dm_soml_table->num_ht_bytes_off[i - ODM_RATEMCS0] += num_bytes_diff;
p_dm_soml_table->pre_num_ht_bytes[i - ODM_RATEMCS0] = p_dm_soml_table->num_ht_bytes[i - ODM_RATEMCS0];
}
}
if (p_dm->support_ic_type == ODM_RTL8822B) {
for (i = ODM_RATEVHTSS1MCS0; i <= ODM_RATEVHTSS2MCS9; i++) {
num_bytes_diff = p_dm_soml_table->num_vht_bytes[i - ODM_RATEVHTSS1MCS0] - p_dm_soml_table->pre_num_vht_bytes[i - ODM_RATEVHTSS1MCS0];
p_dm_soml_table->num_vht_bytes_off[i - ODM_RATEVHTSS1MCS0] += num_bytes_diff;
p_dm_soml_table->pre_num_vht_bytes[i - ODM_RATEVHTSS1MCS0] = p_dm_soml_table->num_vht_bytes[i - ODM_RATEVHTSS1MCS0];
}
}
}
@ -255,152 +290,127 @@ phydm_adsl(
else if (p_dm->support_ic_type & ODM_IC_2SS)
rate_num = 2;
if ((p_dm->support_ic_type & ODM_ADAPTIVE_SOML_SUPPORT_IC)) {
if (p_dm->number_active_client == 1) {
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("rssi_min =%d\n", p_dm->rssi_min));
if ((p_dm->rssi_min >= SOML_RSSI_TH_HIGH) || (p_dm_soml_table->is_soml_method_enable == 1)) {
if (!(p_dm->support_ic_type & ODM_ADAPTIVE_SOML_SUPPORT_IC))
return;
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("rssi_min =%d\n", p_dm->rssi_min));
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("soml_state_cnt =((%d))\n", p_dm_soml_table->soml_state_cnt));
/*Traning state: 0(alt) 1(ori) 2(alt) 3(ori)============================================================*/
if (p_dm_soml_table->soml_state_cnt < (p_dm_soml_table->soml_train_num << 1)) {
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("> TH_H || is_soml_method_enable==1\n"));
if (p_dm_soml_table->soml_state_cnt == 0) {
if (p_dm->rssi_min >= SOML_RSSI_TH_LOW) {
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("> TH_L, soml_state_cnt =((%d))\n", p_dm_soml_table->soml_state_cnt));
/*Traning state: 0(alt) 1(ori) 2(alt) 3(ori)============================================================*/
if (p_dm_soml_table->soml_state_cnt < ((p_dm_soml_table->soml_train_num)<<1)) {
odm_move_memory(p_dm, p_dm_soml_table->num_ht_bytes, ht_reset, HT_RATE_IDX * size);
odm_move_memory(p_dm, p_dm_soml_table->num_ht_bytes_on, ht_reset, HT_RATE_IDX * size);
odm_move_memory(p_dm, p_dm_soml_table->num_ht_bytes_off, ht_reset, HT_RATE_IDX * size);
odm_move_memory(p_dm, p_dm_soml_table->num_vht_bytes, vht_reset, VHT_RATE_IDX * size);
odm_move_memory(p_dm, p_dm_soml_table->num_vht_bytes_on, vht_reset, VHT_RATE_IDX * size);
odm_move_memory(p_dm, p_dm_soml_table->num_vht_bytes_off, vht_reset, VHT_RATE_IDX * size);
if (p_dm_soml_table->soml_state_cnt == 0) {
p_dm_soml_table->is_soml_method_enable = 1;
p_dm_soml_table->soml_state_cnt++;
next_on_off = (p_dm_soml_table->soml_on_off == SOML_ON) ? SOML_ON : SOML_OFF;
phydm_soml_on_off(p_dm, next_on_off);
odm_set_timer(p_dm, &p_dm_soml_table->phydm_adaptive_soml_timer, p_dm_soml_table->soml_delay_time); /*ms*/
} else if ((p_dm_soml_table->soml_state_cnt % 2) != 0) {
if (p_dm->support_ic_type == ODM_RTL8197F) {
p_dm_soml_table->soml_state_cnt++;
odm_move_memory(p_dm, p_dm_soml_table->pre_num_ht_bytes, p_dm_soml_table->num_ht_bytes, HT_RATE_IDX * size);
odm_move_memory(p_dm, p_dm_soml_table->pre_num_vht_bytes, p_dm_soml_table->num_vht_bytes, VHT_RATE_IDX * size);
odm_set_timer(p_dm, &p_dm_soml_table->phydm_adaptive_soml_timer, p_dm_soml_table->soml_intvl); /*ms*/
} else if ((p_dm_soml_table->soml_state_cnt % 2) == 0) {
odm_move_memory(p_dm, p_dm_soml_table->num_ht_bytes, ht_reset, HT_RATE_IDX*size);
odm_move_memory(p_dm, p_dm_soml_table->num_ht_bytes_on, ht_reset, HT_RATE_IDX*size);
odm_move_memory(p_dm, p_dm_soml_table->num_ht_bytes_off, ht_reset, HT_RATE_IDX*size);
} else if (p_dm->support_ic_type == ODM_RTL8822B) {
odm_move_memory(p_dm, p_dm_soml_table->num_vht_bytes, vht_reset, VHT_RATE_IDX*size);
odm_move_memory(p_dm, p_dm_soml_table->num_vht_bytes_on, vht_reset, VHT_RATE_IDX*size);
odm_move_memory(p_dm, p_dm_soml_table->num_vht_bytes_off, vht_reset, VHT_RATE_IDX*size);
}
p_dm_soml_table->is_soml_method_enable = 1;
p_dm_soml_table->soml_state_cnt++;
next_on_off = (p_dm_soml_table->soml_on_off == SOML_ON) ? SOML_ON : SOML_OFF;
phydm_soml_on_off(p_dm, next_on_off);
odm_set_timer(p_dm, &p_dm_soml_table->phydm_adaptive_soml_timer, p_dm_soml_table->soml_delay_time); /*ms*/
} else if ((p_dm_soml_table->soml_state_cnt % 2) != 0) {
p_dm_soml_table->soml_state_cnt++;
if (p_dm->support_ic_type == ODM_RTL8197F)
odm_move_memory(p_dm, p_dm_soml_table->pre_num_ht_bytes, p_dm_soml_table->num_ht_bytes, HT_RATE_IDX*size);
else if (p_dm->support_ic_type == ODM_RTL8822B)
odm_move_memory(p_dm, p_dm_soml_table->pre_num_vht_bytes, p_dm_soml_table->num_vht_bytes, VHT_RATE_IDX*size);
odm_set_timer(p_dm, &p_dm_soml_table->phydm_adaptive_soml_timer, p_dm_soml_table->soml_intvl); /*ms*/
} else if ((p_dm_soml_table->soml_state_cnt % 2) == 0) {
p_dm_soml_table->soml_state_cnt++;
phydm_soml_statistics(p_dm, p_dm_soml_table->soml_on_off);
next_on_off = (p_dm_soml_table->soml_on_off == SOML_ON) ? SOML_OFF : SOML_ON;
phydm_soml_on_off(p_dm, next_on_off);
odm_set_timer(p_dm, &p_dm_soml_table->phydm_adaptive_soml_timer, p_dm_soml_table->soml_delay_time); /*ms*/
}
}
/*Decision state: ==============================================================*/
else {
p_dm_soml_table->soml_state_cnt = 0;
phydm_soml_statistics(p_dm, p_dm_soml_table->soml_on_off);
/* [Search 1st and 2ed rate by counter] */
if (p_dm->support_ic_type == ODM_RTL8197F) {
for (i = 0; i < rate_num; i++) {
rate_ss_shift = (i << 3);
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("*num_ht_bytes_on HT MCS[%d :%d ] = {%d, %d, %d, %d, %d, %d, %d, %d}\n",
(rate_ss_shift), (rate_ss_shift+7),
p_dm_soml_table->num_ht_bytes_on[rate_ss_shift + 0], p_dm_soml_table->num_ht_bytes_on[rate_ss_shift + 1],
p_dm_soml_table->num_ht_bytes_on[rate_ss_shift + 2], p_dm_soml_table->num_ht_bytes_on[rate_ss_shift + 3],
p_dm_soml_table->num_ht_bytes_on[rate_ss_shift + 4], p_dm_soml_table->num_ht_bytes_on[rate_ss_shift + 5],
p_dm_soml_table->num_ht_bytes_on[rate_ss_shift + 6], p_dm_soml_table->num_ht_bytes_on[rate_ss_shift + 7]));
}
for (i = 0; i < rate_num; i++) {
rate_ss_shift = (i << 3);
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("*num_ht_bytes_off HT MCS[%d :%d ] = {%d, %d, %d, %d, %d, %d, %d, %d}\n",
(rate_ss_shift), (rate_ss_shift+7),
p_dm_soml_table->num_ht_bytes_off[rate_ss_shift + 0], p_dm_soml_table->num_ht_bytes_off[rate_ss_shift + 1],
p_dm_soml_table->num_ht_bytes_off[rate_ss_shift + 2], p_dm_soml_table->num_ht_bytes_off[rate_ss_shift + 3],
p_dm_soml_table->num_ht_bytes_off[rate_ss_shift + 4], p_dm_soml_table->num_ht_bytes_off[rate_ss_shift + 5],
p_dm_soml_table->num_ht_bytes_off[rate_ss_shift + 6], p_dm_soml_table->num_ht_bytes_off[rate_ss_shift + 7]));
}
for (i = 0; i < HT_RATE_IDX; i++) {
byte_total_on += p_dm_soml_table->num_vht_bytes_on[i];
byte_total_off += p_dm_soml_table->num_vht_bytes_off[i];
}
} else if (p_dm->support_ic_type == ODM_RTL8822B) {
for (i = 0; i < rate_num; i++) {
rate_ss_shift = 10 * i;
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("* num_vht_bytes_on VHT-%d ss MCS[0:9] = {%d, %d, %d, %d, %d, %d, %d, %d, %d, %d}\n",
(i + 1),
p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 0], p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 1],
p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 2], p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 3],
p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 4], p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 5],
p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 6], p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 7],
p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 8], p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 9]));
}
for (i = 0; i < rate_num; i++) {
rate_ss_shift = 10 * i;
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("* num_vht_bytes_off VHT-%d ss MCS[0:9] = {%d, %d, %d, %d, %d, %d, %d, %d, %d, %d}\n",
(i + 1),
p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 0], p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 1],
p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 2], p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 3],
p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 4], p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 5],
p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 6], p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 7],
p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 8], p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 9]));
}
for (i = 0; i < VHT_RATE_IDX; i++) {
byte_total_on += p_dm_soml_table->num_vht_bytes_on[i];
byte_total_off += p_dm_soml_table->num_vht_bytes_off[i];
}
}
/* [Decision] */
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("[ byte_total_on = %d ; byte_total_off = %d ]\n", byte_total_on, byte_total_off));
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("[Decisoin state ]\n"));
if (byte_total_on > byte_total_off) {
next_on_off = SOML_ON;
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("[ byte_total_on > byte_total_off ==> SOML_ON ]\n"));
} else if (byte_total_on < byte_total_off) {
next_on_off = SOML_OFF;
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("[ byte_total_on < byte_total_off ==> SOML_OFF ]\n"));
} else {
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("[ stay at soml_last_state ]\n"));
next_on_off = p_dm_soml_table->soml_last_state;
}
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("[ Final decisoin ] : "));
phydm_soml_on_off(p_dm, next_on_off);
p_dm_soml_table->soml_last_state = next_on_off;
}
} else { /* RSSI< = SOML_RSSI_TH_LOW */
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("[ <TH_L: escape from > TH_L ]\n"));
phydm_adaptive_soml_reset(p_dm);
phydm_soml_on_off(p_dm, SOML_ON);
}
} else {
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("[escape from > TH_H || is_soml_method_enable==1]\n"));
phydm_adaptive_soml_reset(p_dm);
phydm_soml_on_off(p_dm, SOML_ON);
}
} else {
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("[multi-Client]\n"));
phydm_adaptive_soml_reset(p_dm);
phydm_soml_on_off(p_dm, SOML_ON);
p_dm_soml_table->soml_state_cnt++;
phydm_soml_statistics(p_dm, p_dm_soml_table->soml_on_off);
next_on_off = (p_dm_soml_table->soml_on_off == SOML_ON) ? SOML_OFF : SOML_ON;
phydm_soml_on_off(p_dm, next_on_off);
odm_set_timer(p_dm, &p_dm_soml_table->phydm_adaptive_soml_timer, p_dm_soml_table->soml_delay_time); /*ms*/
}
}
/*Decision state: ==============================================================*/
else {
p_dm_soml_table->soml_state_cnt = 0;
phydm_soml_statistics(p_dm, p_dm_soml_table->soml_on_off);
/* [Search 1st and 2ed rate by counter] */
if (*p_dm->p_channel <= 14) {
for (i = 0; i < rate_num; i++) {
rate_ss_shift = (i << 3);
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("*num_ht_bytes_on HT MCS[%d :%d ] = {%d, %d, %d, %d, %d, %d, %d, %d}\n",
(rate_ss_shift),
(rate_ss_shift + 7),
p_dm_soml_table->num_ht_bytes_on[rate_ss_shift + 0], p_dm_soml_table->num_ht_bytes_on[rate_ss_shift + 1],
p_dm_soml_table->num_ht_bytes_on[rate_ss_shift + 2], p_dm_soml_table->num_ht_bytes_on[rate_ss_shift + 3],
p_dm_soml_table->num_ht_bytes_on[rate_ss_shift + 4], p_dm_soml_table->num_ht_bytes_on[rate_ss_shift + 5],
p_dm_soml_table->num_ht_bytes_on[rate_ss_shift + 6], p_dm_soml_table->num_ht_bytes_on[rate_ss_shift + 7]));
}
for (i = 0; i < rate_num; i++) {
rate_ss_shift = (i << 3);
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("*num_ht_bytes_off HT MCS[%d :%d ] = {%d, %d, %d, %d, %d, %d, %d, %d}\n",
(rate_ss_shift), (rate_ss_shift + 7),
p_dm_soml_table->num_ht_bytes_off[rate_ss_shift + 0], p_dm_soml_table->num_ht_bytes_off[rate_ss_shift + 1],
p_dm_soml_table->num_ht_bytes_off[rate_ss_shift + 2], p_dm_soml_table->num_ht_bytes_off[rate_ss_shift + 3],
p_dm_soml_table->num_ht_bytes_off[rate_ss_shift + 4], p_dm_soml_table->num_ht_bytes_off[rate_ss_shift + 5],
p_dm_soml_table->num_ht_bytes_off[rate_ss_shift + 6], p_dm_soml_table->num_ht_bytes_off[rate_ss_shift + 7]));
}
for (i = ODM_RATEMCS8; i <= ODM_RATEMCS15; i++) {
byte_total_on += p_dm_soml_table->num_ht_bytes_on[i - ODM_RATEMCS0];
byte_total_off += p_dm_soml_table->num_ht_bytes_off[i - ODM_RATEMCS0];
}
} else if (p_dm->support_ic_type == ODM_RTL8822B) {
for (i = 0; i < rate_num; i++) {
rate_ss_shift = 10 * i;
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("* num_vht_bytes_on VHT-%d ss MCS[0:9] = {%d, %d, %d, %d, %d, %d, %d, %d, %d, %d}\n",
(i + 1),
p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 0], p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 1],
p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 2], p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 3],
p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 4], p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 5],
p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 6], p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 7],
p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 8], p_dm_soml_table->num_vht_bytes_on[rate_ss_shift + 9]));
}
for (i = 0; i < rate_num; i++) {
rate_ss_shift = 10 * i;
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("* num_vht_bytes_off VHT-%d ss MCS[0:9] = {%d, %d, %d, %d, %d, %d, %d, %d, %d, %d}\n",
(i + 1),
p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 0], p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 1],
p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 2], p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 3],
p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 4], p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 5],
p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 6], p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 7],
p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 8], p_dm_soml_table->num_vht_bytes_off[rate_ss_shift + 9]));
}
for (i = ODM_RATEVHTSS2MCS0; i <= ODM_RATEVHTSS2MCS9; i++) {
byte_total_on += p_dm_soml_table->num_vht_bytes_on[i - ODM_RATEVHTSS1MCS0];
byte_total_off += p_dm_soml_table->num_vht_bytes_off[i - ODM_RATEVHTSS1MCS0];
}
}
/* [Decision] */
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("[ byte_total_on = %d ; byte_total_off = %d ]\n", byte_total_on, byte_total_off));
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("[Decisoin state ]\n"));
if (byte_total_on > byte_total_off) {
next_on_off = SOML_ON;
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("[ byte_total_on > byte_total_off ==> SOML_ON ]\n"));
} else if (byte_total_on < byte_total_off) {
next_on_off = SOML_OFF;
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("[ byte_total_on < byte_total_off ==> SOML_OFF ]\n"));
} else {
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("[ stay at soml_last_state ]\n"));
next_on_off = p_dm_soml_table->soml_last_state;
}
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("[ Final decisoin ] : "));
phydm_soml_on_off(p_dm, next_on_off);
p_dm_soml_table->soml_last_state = next_on_off;
}
}
void
@ -417,6 +427,24 @@ phydm_adaptive_soml_reset(
}
#endif /* end of CONFIG_ADAPTIVE_SOML*/
void
phydm_soml_bytes_acq(
void *dm_void,
u8 rate_id,
u32 length
)
{
#ifdef CONFIG_ADAPTIVE_SOML
struct PHY_DM_STRUCT *dm = (struct PHY_DM_STRUCT *)dm_void;
struct adaptive_soml *dm_soml_table = &dm->dm_soml_table;
if ((rate_id >= ODM_RATEMCS0) && (rate_id <= ODM_RATEMCS31))
dm_soml_table->num_ht_bytes[rate_id - ODM_RATEMCS0] += length;
else if ((rate_id >= ODM_RATEVHTSS1MCS0) && (rate_id <= ODM_RATEVHTSS4MCS9))
dm_soml_table->num_vht_bytes[rate_id - ODM_RATEVHTSS1MCS0] += length;
#endif
}
void
phydm_adaptive_soml_timers(
@ -448,10 +476,6 @@ phydm_adaptive_soml_init(
struct PHY_DM_STRUCT *p_dm = (struct PHY_DM_STRUCT *)p_dm_void;
struct adaptive_soml *p_dm_soml_table = &p_dm->dm_soml_table;
if (!(p_dm->support_ability & ODM_BB_ADAPTIVE_SOML)) {
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("[Return] Not Support Adaptive SOML\n"));
return;
}
PHYDM_DBG(p_dm, DBG_ADPTV_SOML, ("phydm_adaptive_soml_init\n"));
p_dm_soml_table->soml_state_cnt = 0;
@ -462,6 +486,8 @@ phydm_adaptive_soml_init(
p_dm_soml_table->soml_counter = 0;
p_dm_soml_table->soml_period = 4;
p_dm_soml_table->soml_select = 0;
if (p_dm->support_ic_type & (ODM_RTL8197F | ODM_RTL8192F))
odm_set_bb_reg(p_dm, 0x988, BIT(25), 1);
#endif
}
@ -498,9 +524,58 @@ phydm_adaptive_soml(
phydm_soml_on_off(p_dm, SOML_OFF);
return;
}
if (p_dm->support_ic_type & ODM_ADAPTIVE_SOML_SUPPORT_IC)
phydm_adsl(p_dm);
phydm_adsl(p_dm);
#endif
}
void
phydm_enable_adaptive_soml(
void *dm_void
)
{
#ifdef CONFIG_ADAPTIVE_SOML
struct PHY_DM_STRUCT *dm = (struct PHY_DM_STRUCT *)dm_void;
PHYDM_DBG(dm, DBG_ADPTV_SOML, ("[%s][Return!!!] enable Adaptive SOML\n\n", __func__));
dm->support_ability |= ODM_BB_ADAPTIVE_SOML;
phydm_soml_on_off(dm, SOML_ON);
#endif
}
void
phydm_stop_adaptive_soml(
void *dm_void
)
{
#ifdef CONFIG_ADAPTIVE_SOML
struct PHY_DM_STRUCT *dm = (struct PHY_DM_STRUCT *)dm_void;
PHYDM_DBG(dm, DBG_ADPTV_SOML, ("[%s][Return!!!] Stop Adaptive SOML\n\n", __func__));
dm->support_ability &= ~ODM_BB_ADAPTIVE_SOML;
phydm_soml_on_off(dm, SOML_ON);
#endif
}
void
phydm_adaptive_soml_para_set(
void *dm_void,
u8 train_num,
u8 intvl,
u8 period,
u8 delay_time
)
{
#ifdef CONFIG_ADAPTIVE_SOML
struct PHY_DM_STRUCT *dm = (struct PHY_DM_STRUCT *)dm_void;
struct adaptive_soml *dm_soml_table = &dm->dm_soml_table;
dm_soml_table->soml_train_num = train_num;
dm_soml_table->soml_intvl = intvl;
dm_soml_table->soml_period = period;
dm_soml_table->soml_delay_time = delay_time;
#endif
}

View File

@ -49,12 +49,10 @@ struct adaptive_soml {
u32 pre_num_ht_bytes[HT_RATE_IDX];
u32 num_ht_bytes_on[HT_RATE_IDX];
u32 num_ht_bytes_off[HT_RATE_IDX];
#if ODM_IC_11AC_SERIES_SUPPORT
u32 num_vht_bytes[VHT_RATE_IDX];
u32 pre_num_vht_bytes[VHT_RATE_IDX];
u32 num_vht_bytes_on[VHT_RATE_IDX];
u32 num_vht_bytes_off[VHT_RATE_IDX];
#endif
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
#if USE_WORKITEM
@ -62,14 +60,8 @@ struct adaptive_soml {
#endif
#endif
struct timer_list phydm_adaptive_soml_timer;
};
void
phydm_dynamicsoftmletting(
struct PHY_DM_STRUCT *p_dm
);
void
phydm_soml_on_off(
void *p_dm_void,
@ -87,6 +79,17 @@ phydm_adaptive_soml_workitem_callback(
void *p_context
);
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
void
phydm_adaptive_soml_callback(
void *dm_void
);
void
phydm_adaptive_soml_workitem_callback(
void *context
);
#else
void
@ -123,6 +126,19 @@ phydm_adaptive_soml_reset(
);
#endif
#ifdef NEVER
void
phydm_dynamicsoftmletting(
struct PHY_DM_STRUCT *p_dm
);
#endif
void
phydm_soml_bytes_acq(
void *dm_void,
u8 rate_id,
u32 length
);
void
phydm_adaptive_soml_timers(
@ -140,6 +156,25 @@ phydm_adaptive_soml(
void *p_dm_void
);
void
phydm_enable_adaptive_soml(
void *dm_void
);
void
phydm_stop_adaptive_soml(
void *dm_void
);
void
phydm_adaptive_soml_para_set(
void *dm_void,
u8 train_num,
u8 intvl,
u8 period,
u8 delay_time
);
void
phydm_init_soft_ml_setting(
void *p_dm_void

View File

@ -46,9 +46,8 @@ hal_com_txbf_config_gtab(
{
struct PHY_DM_STRUCT *p_dm = (struct PHY_DM_STRUCT *)p_dm_void;
if (p_dm->support_ic_type & ODM_RTL8822B) {
if (p_dm->support_ic_type & ODM_RTL8822B)
hal_txbf_8822b_config_gtab(p_dm);
}
}
void
@ -205,18 +204,14 @@ hal_com_txbf_enter_work_item_callback(
PHYDM_DBG(p_dm, DBG_TXBF, ("[%s] Start!\n", __func__));
if (p_dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821)) {
if (p_dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821))
hal_txbf_jaguar_enter(p_dm, idx);
}
else if (p_dm->support_ic_type & ODM_RTL8192E) {
else if (p_dm->support_ic_type & ODM_RTL8192E)
hal_txbf_8192e_enter(p_dm, idx);
}
else if (p_dm->support_ic_type & ODM_RTL8814A) {
else if (p_dm->support_ic_type & ODM_RTL8814A)
hal_txbf_8814a_enter(p_dm, idx);
}
else if (p_dm->support_ic_type & ODM_RTL8822B) {
else if (p_dm->support_ic_type & ODM_RTL8822B)
hal_txbf_8822b_enter(p_dm, idx);
}
}
void
@ -240,18 +235,14 @@ hal_com_txbf_leave_work_item_callback(
PHYDM_DBG(p_dm, DBG_TXBF, ("[%s] Start!\n", __func__));
if (p_dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821)) {
if (p_dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821))
hal_txbf_jaguar_leave(p_dm, idx);
}
else if (p_dm->support_ic_type & ODM_RTL8192E) {
else if (p_dm->support_ic_type & ODM_RTL8192E)
hal_txbf_8192e_leave(p_dm, idx);
}
else if (p_dm->support_ic_type & ODM_RTL8814A) {
else if (p_dm->support_ic_type & ODM_RTL8814A)
hal_txbf_8814a_leave(p_dm, idx);
}
else if (p_dm->support_ic_type & ODM_RTL8822B) {
else if (p_dm->support_ic_type & ODM_RTL8822B)
hal_txbf_8822b_leave(p_dm, idx);
}
}
@ -275,18 +266,14 @@ hal_com_txbf_fw_ndpa_work_item_callback(
PHYDM_DBG(p_dm, DBG_TXBF, ("[%s] Start!\n", __func__));
if (p_dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821)) {
if (p_dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821))
hal_txbf_jaguar_fw_txbf(p_dm, idx);
}
else if (p_dm->support_ic_type & ODM_RTL8192E) {
else if (p_dm->support_ic_type & ODM_RTL8192E)
hal_txbf_8192e_fw_tx_bf(p_dm, idx);
}
else if (p_dm->support_ic_type & ODM_RTL8814A) {
else if (p_dm->support_ic_type & ODM_RTL8814A)
hal_txbf_8814a_fw_txbf(p_dm, idx);
}
else if (p_dm->support_ic_type & ODM_RTL8822B) {
else if (p_dm->support_ic_type & ODM_RTL8822B)
hal_txbf_8822b_fw_txbf(p_dm, idx);
}
}
void
@ -334,15 +321,12 @@ hal_com_txbf_rate_work_item_callback(
PHYDM_DBG(p_dm, DBG_TXBF, ("[%s] Start!\n", __func__));
if (p_dm->support_ic_type & ODM_RTL8812) {
if (p_dm->support_ic_type & ODM_RTL8812)
hal_txbf_8812a_set_ndpa_rate(p_dm, BW, rate);
}
else if (p_dm->support_ic_type & ODM_RTL8192E) {
else if (p_dm->support_ic_type & ODM_RTL8192E)
hal_txbf_8192e_set_ndpa_rate(p_dm, BW, rate);
}
else if (p_dm->support_ic_type & ODM_RTL8814A) {
else if (p_dm->support_ic_type & ODM_RTL8814A)
hal_txbf_8814a_set_ndpa_rate(p_dm, BW, rate);
}
}
@ -392,18 +376,14 @@ hal_com_txbf_status_work_item_callback(
PHYDM_DBG(p_dm, DBG_TXBF, ("[%s] Start!\n", __func__));
if (p_dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821)) {
if (p_dm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821))
hal_txbf_jaguar_status(p_dm, idx);
}
else if (p_dm->support_ic_type & ODM_RTL8192E) {
else if (p_dm->support_ic_type & ODM_RTL8192E)
hal_txbf_8192e_status(p_dm, idx);
}
else if (p_dm->support_ic_type & ODM_RTL8814A) {
else if (p_dm->support_ic_type & ODM_RTL8814A)
hal_txbf_8814a_status(p_dm, idx);
}
else if (p_dm->support_ic_type & ODM_RTL8822B) {
else if (p_dm->support_ic_type & ODM_RTL8822B)
hal_txbf_8822b_status(p_dm, idx);
}
}
void
@ -425,9 +405,9 @@ hal_com_txbf_reset_tx_path_work_item_callback(
u8 idx = p_txbf_info->txbf_idx;
if (p_dm->support_ic_type & ODM_RTL8814A) {
if (p_dm->support_ic_type & ODM_RTL8814A)
hal_txbf_8814a_reset_tx_path(p_dm, idx);
}
}
void
@ -446,9 +426,8 @@ hal_com_txbf_get_tx_rate_work_item_callback(
struct PHY_DM_STRUCT *p_dm = (struct PHY_DM_STRUCT *)p_dm_void;
#endif
if (p_dm->support_ic_type & ODM_RTL8814A) {
if (p_dm->support_ic_type & ODM_RTL8814A)
hal_txbf_8814a_get_tx_rate(p_dm);
}
}

View File

@ -55,7 +55,7 @@ phydm_get_mu_bfee_snding_decision(
);
#else
#define phydm_get_beamforming_sounding_info(p_dm_void, troughput, total_bfee_num, tx_rate)
#define phydm_get_beamforming_sounding_info(p_dm_void, troughput, total_bfee_num, tx_rate) 0
#define phydm_get_ndpa_rate(p_dm_void)
#define phydm_get_mu_bfee_snding_decision(p_dm_void, troughput)

View File

@ -326,31 +326,6 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz , u8 ba
SET_TX_DESC_GID_8812(ptxdesc, pattrib->txbf_g_id);
SET_TX_DESC_PAID_8812(ptxdesc, pattrib->txbf_p_aid);
#endif
/* injected frame */
if(pattrib->inject == 0xa5) {
SET_TX_DESC_RETRY_LIMIT_ENABLE_8812(ptxdesc, 1);
if (pattrib->retry_ctrl == _TRUE) {
SET_TX_DESC_DATA_RETRY_LIMIT_8812(ptxdesc, 6);
} else {
SET_TX_DESC_DATA_RETRY_LIMIT_8812(ptxdesc, 0);
}
if(pattrib->sgi == _TRUE) {
SET_TX_DESC_DATA_SHORT_8812(ptxdesc, 1);
} else {
SET_TX_DESC_DATA_SHORT_8812(ptxdesc, 0);
}
SET_TX_DESC_USE_RATE_8812(ptxdesc, 1);
SET_TX_DESC_TX_RATE_8812(ptxdesc, MRateToHwRate(pattrib->rate));
if (pattrib->ldpc)
SET_TX_DESC_DATA_LDPC_8812(ptxdesc, 1);
SET_TX_DESC_DATA_STBC_8812(ptxdesc, pattrib->stbc & 3);
//SET_TX_DESC_GF_8812(ptxdesc, 1); // no MCS rates if sets, GreenField?
//SET_TX_DESC_LSIG_TXOP_EN_8812(ptxdesc, 1);
//SET_TX_DESC_HTC_8812(ptxdesc, 1);
//SET_TX_DESC_NO_ACM_8812(ptxdesc, 1);
SET_TX_DESC_DATA_BW_8812(ptxdesc, pattrib->bwmode); // 0 - 20 MHz, 1 - 40 MHz, 2 - 80 MHz
}
rtl8812a_cal_txdesc_chksum(ptxdesc);
_dbg_dump_tx_info(padapter, pxmitframe->frame_tag, ptxdesc);
return pull;
@ -1126,8 +1101,7 @@ s32 rtl8812au_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt)
ptxdesc->txdw3 |= cpu_to_le32((8 << 28)); /* set bit3 to 1. Suugested by TimChen. 2009.12.29. */
//rtl8188eu_cal_txdesc_chksum(ptxdesc);
rtl8812au_cal_txdesc_chksum(ptxdesc);
rtl8188eu_cal_txdesc_chksum(ptxdesc);
/* ----- end of fill tx desc ----- */
/* */
@ -1145,7 +1119,7 @@ s32 rtl8812au_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt)
pipe = usb_sndbulkpipe(pdvobj->pusbdev, pHalData->Queue2EPNum[(u8)MGT_QUEUE_INX] & 0x0f);
usb_fill_bulk_urb(urb, pdvobj->pusbdev, pipe,
pxmit_skb->data, pxmit_skb->len, rtl8812au_hostap_mgnt_xmit_cb, pxmit_skb);
pxmit_skb->data, pxmit_skb->len, rtl8192cu_hostap_mgnt_xmit_cb, pxmit_skb);
urb->transfer_flags |= URB_ZERO_PACKET;
usb_anchor_urb(urb, &phostapdpriv->anchored);

View File

@ -135,7 +135,7 @@ PHY_SetSwChnlBWMode8812(
VOID
phy_set_rf_path_switch_8812a(
IN PADAPTER pAdapter,
IN struct PHY_DM_STRUCT *phydm,
IN bool bMain
);

View File

@ -79,7 +79,7 @@
#define CONFIG_RECV_REORDERING_CTRL 1
#define CONFIG_DFS 0
#define CONFIG_DFS 1
/* #define CONFIG_SUPPORT_USB_INT */
#ifdef CONFIG_SUPPORT_USB_INT
@ -323,7 +323,7 @@
/*
* Debug Related Config
*/
#define DBG 1
#define DBG 1
#define CONFIG_PROC_DEBUG
@ -346,9 +346,6 @@
/* #define DBG_RX_SIGNAL_DISPLAY_PROCESSING */
/* #define DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED "jeff-ap" */
#define DBG_TX_POWER_IDX 1
#define DBG_PG_TXPWR_READ 1
/* #define DBG_SHOW_MCUFWDL_BEFORE_51_ENABLE */

View File

@ -106,7 +106,7 @@ enum bb_path {
BB_PATH_ACD = (BB_PATH_A | BB_PATH_C | BB_PATH_D),
BB_PATH_BCD = (BB_PATH_B | BB_PATH_C | BB_PATH_D),
BB_PATH_ABCD = (BB_PATH_A | BB_PATH_B | BB_PATH_D | BB_PATH_D),
BB_PATH_ABCD = (BB_PATH_A | BB_PATH_B | BB_PATH_C | BB_PATH_D),
};
enum rf_path {
@ -155,6 +155,7 @@ struct rssi_info {
u16 cck_sum_power;
u8 is_send_rssi;
u8 valid_bit;
s16 rssi_acc; /*accumulate RSSI for per packet MA sum*/
};
struct ra_sta_info {
@ -178,6 +179,12 @@ struct ra_sta_info {
u64 ramask;
};
struct dtp_info {
u8 dyn_tx_power; /*Dynamic Tx power offset*/
u8 sta_tx_high_power_lvl;
u8 sta_last_dtp_lvl;
};
struct cmn_sta_info {
u16 dm_ctrl;
enum channel_width bw_mode; /*max bandwidth*/
@ -196,6 +203,9 @@ struct cmn_sta_info {
struct bf_cmn_info bf_info;
#endif
u8 sm_ps:2;
struct dtp_info dtp_stat; /*Dynamic Tx power offset*/
u8 pw2cca_over_TH_cnt;
u8 total_pw2cca_cnt;
};
struct phydm_phyinfo_struct {
@ -219,12 +229,16 @@ struct phydm_phyinfo_struct {
u8 channel; /* channel number---*/
u8 is_mu_packet:1; /* is MU packet or not---boolean*/
u8 is_beamformed:1; /* BF packet---boolean*/
u8 cnt_pw2cca;
u8 cnt_cca2agc_rdy;
/*ODM_PHY_STATUS_NEW_TYPE_SUPPORT*/
};
struct phydm_perpkt_info_struct {
u8 data_rate;
u8 station_id;
u8 is_cck_rate: 1;
u8 rate_ss:3; /*spatial stream of data rate*/
u8 is_packet_match_bssid:1; /*boolean*/
u8 is_packet_to_self:1; /*boolean*/
u8 is_packet_beacon:1; /*boolean*/

View File

@ -463,6 +463,16 @@ struct pwrctrl_priv {
u8 blpspg_info_up;
#endif
u8 current_lps_hw_port_id;
#ifdef CONFIG_RTW_CFGVEDNOR_LLSTATS
systime radio_on_start_time;
systime pwr_saving_start_time;
u32 pwr_saving_time;
u32 on_time;
u32 tx_time;
u32 rx_time;
#endif /* CONFIG_RTW_CFGVEDNOR_LLSTATS */
};
#define rtw_get_ips_mode_req(pwrctl) \

View File

@ -1 +1 @@
#define DRIVERVERSION "v5.2.20_25672.20171213"
#define DRIVERVERSION "v5.2.20.2_28373.20180619"

View File

@ -80,7 +80,7 @@
#ifdef CONFIG_SINGLE_XMIT_BUF
#define NR_XMIT_EXTBUFF (1)
#else
#define NR_XMIT_EXTBUFF (64)
#define NR_XMIT_EXTBUFF (32)
#endif
#ifdef CONFIG_RTL8812A
@ -483,7 +483,6 @@ struct pkt_attrib {
*/
u8 bf_pkt_type;
#endif
u8 inject; /* == a5 if injected */
};
#endif

View File

@ -2059,7 +2059,6 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
case NL80211_IFTYPE_P2P_CLIENT:
is_p2p = _TRUE;
#endif
/* Intentional fallthrough */
case NL80211_IFTYPE_STATION:
networkType = Ndis802_11Infrastructure;
@ -2084,7 +2083,6 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
case NL80211_IFTYPE_P2P_GO:
is_p2p = _TRUE;
#endif
/* Intentional fallthrough */
case NL80211_IFTYPE_AP:
networkType = Ndis802_11APMode;
@ -7190,9 +7188,6 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy)
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0))
#if defined(CONFIG_NET_NS)
wiphy->flags |= WIPHY_FLAG_NETNS_OK;
#endif //CONFIG_NET_NS
wiphy->flags |= WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS;
#endif

View File

@ -1605,9 +1605,6 @@ int rtw_os_ndev_register(_adapter *adapter, const char *name)
rtw_init_netdev_name(ndev, name);
_rtw_memcpy(ndev->dev_addr, adapter_mac_addr(adapter), ETH_ALEN);
#if defined(CONFIG_NET_NS)
dev_net_set(ndev, wiphy_net(adapter_to_wiphy(adapter)));
#endif //defined(CONFIG_NET_NS)
/* Tell the network stack we exist */
@ -3214,7 +3211,7 @@ int _netdev_open(struct net_device *pnetdev)
rtw_set_pwr_state_check_timer(pwrctrlpriv);
#endif
rtw_netif_carrier_on(pnetdev); /* call this func when rtw_joinbss_event_callback return success */
/* rtw_netif_carrier_on(pnetdev); */ /* call this func when rtw_joinbss_event_callback return success */
rtw_netif_wake_queue(pnetdev);
#ifdef CONFIG_BR_EXT
@ -3244,6 +3241,15 @@ netdev_open_normal_process:
}
#endif
#ifdef CONFIG_RTW_CFGVEDNOR_LLSTATS
pwrctrlpriv->radio_on_start_time = rtw_get_current_time();
pwrctrlpriv->pwr_saving_start_time = rtw_get_current_time();
pwrctrlpriv->pwr_saving_time = 0;
pwrctrlpriv->on_time = 0;
pwrctrlpriv->tx_time = 0;
pwrctrlpriv->rx_time = 0;
#endif /* CONFIG_RTW_CFGVEDNOR_LLSTATS */
RTW_INFO("-871x_drv - drv_open, bup=%d\n", padapter->bup);
return 0;

View File

@ -501,11 +501,10 @@ void rtw_os_recv_indicate_pkt(_adapter *padapter, _pkt *pkt, union recv_frame *r
#endif /* CONFIG_RTW_NAPI */
ret = rtw_netif_rx(padapter->pnetdev, pkt);
if (ret == NET_RX_SUCCESS) {
if (ret == NET_RX_SUCCESS)
DBG_COUNTER(padapter->rx_logs.os_netif_ok);
} else {
else
DBG_COUNTER(padapter->rx_logs.os_netif_err);
}
}
}

View File

@ -209,22 +209,34 @@ static int rtw_cfgvendor_send_cmd_reply(struct wiphy *wiphy,
return rtw_cfg80211_vendor_cmd_reply(skb);
}
#define WIFI_FEATURE_INFRA 0x0001 /* Basic infrastructure mode */
#define WIFI_FEATURE_INFRA_5G 0x0002 /* Support for 5 GHz Band */
#define WIFI_FEATURE_HOTSPOT 0x0004 /* Support for GAS/ANQP */
#define WIFI_FEATURE_P2P 0x0008 /* Wifi-Direct */
#define WIFI_FEATURE_SOFT_AP 0x0010 /* Soft AP */
#define WIFI_FEATURE_GSCAN 0x0020 /* Google-Scan APIs */
#define WIFI_FEATURE_NAN 0x0040 /* Neighbor Awareness Networking */
#define WIFI_FEATURE_D2D_RTT 0x0080 /* Device-to-device RTT */
#define WIFI_FEATURE_D2AP_RTT 0x0100 /* Device-to-AP RTT */
#define WIFI_FEATURE_BATCH_SCAN 0x0200 /* Batched Scan (legacy) */
#define WIFI_FEATURE_PNO 0x0400 /* Preferred network offload */
#define WIFI_FEATURE_ADDITIONAL_STA 0x0800 /* Support for two STAs */
#define WIFI_FEATURE_TDLS 0x1000 /* Tunnel directed link setup */
#define WIFI_FEATURE_TDLS_OFFCHANNEL 0x2000 /* Support for TDLS off channel */
#define WIFI_FEATURE_EPR 0x4000 /* Enhanced power reporting */
#define WIFI_FEATURE_AP_STA 0x8000 /* Support for AP STA Concurrency */
/* Feature enums */
#define WIFI_FEATURE_INFRA 0x0001 // Basic infrastructure mode
#define WIFI_FEATURE_INFRA_5G 0x0002 // Support for 5 GHz Band
#define WIFI_FEATURE_HOTSPOT 0x0004 // Support for GAS/ANQP
#define WIFI_FEATURE_P2P 0x0008 // Wifi-Direct
#define WIFI_FEATURE_SOFT_AP 0x0010 // Soft AP
#define WIFI_FEATURE_GSCAN 0x0020 // Google-Scan APIs
#define WIFI_FEATURE_NAN 0x0040 // Neighbor Awareness Networking
#define WIFI_FEATURE_D2D_RTT 0x0080 // Device-to-device RTT
#define WIFI_FEATURE_D2AP_RTT 0x0100 // Device-to-AP RTT
#define WIFI_FEATURE_BATCH_SCAN 0x0200 // Batched Scan (legacy)
#define WIFI_FEATURE_PNO 0x0400 // Preferred network offload
#define WIFI_FEATURE_ADDITIONAL_STA 0x0800 // Support for two STAs
#define WIFI_FEATURE_TDLS 0x1000 // Tunnel directed link setup
#define WIFI_FEATURE_TDLS_OFFCHANNEL 0x2000 // Support for TDLS off channel
#define WIFI_FEATURE_EPR 0x4000 // Enhanced power reporting
#define WIFI_FEATURE_AP_STA 0x8000 // Support for AP STA Concurrency
#define WIFI_FEATURE_LINK_LAYER_STATS 0x10000 // Link layer stats collection
#define WIFI_FEATURE_LOGGER 0x20000 // WiFi Logger
#define WIFI_FEATURE_HAL_EPNO 0x40000 // WiFi PNO enhanced
#define WIFI_FEATURE_RSSI_MONITOR 0x80000 // RSSI Monitor
#define WIFI_FEATURE_MKEEP_ALIVE 0x100000 // WiFi mkeep_alive
#define WIFI_FEATURE_CONFIG_NDO 0x200000 // ND offload configure
#define WIFI_FEATURE_TX_TRANSMIT_POWER 0x400000 // Capture Tx transmit power levels
#define WIFI_FEATURE_CONTROL_ROAMING 0x800000 // Enable/Disable firmware roaming
#define WIFI_FEATURE_IE_WHITELIST 0x1000000 // Support Probe IE white listing
#define WIFI_FEATURE_SCAN_RAND 0x2000000 // Support MAC & Probe Sequence Number randomization
// Add more features here
#define MAX_FEATURE_SET_CONCURRRENT_GROUPS 3
@ -239,14 +251,18 @@ int rtw_dev_get_feature_set(struct net_device *dev)
feature_set |= WIFI_FEATURE_INFRA;
if (IS_8814A_SERIES(*hal_ver) || IS_8812_SERIES(*hal_ver) ||
IS_8821_SERIES(*hal_ver))
#ifdef CONFIG_IEEE80211_BAND_5GHZ
if (is_supported_5g(adapter_to_regsty(adapter)->wireless_mode))
feature_set |= WIFI_FEATURE_INFRA_5G;
#endif
feature_set |= WIFI_FEATURE_P2P;
feature_set |= WIFI_FEATURE_SOFT_AP;
feature_set |= WIFI_FEATURE_ADDITIONAL_STA;
#ifdef CONFIG_RTW_CFGVEDNOR_LLSTATS
feature_set |= WIFI_FEATURE_LINK_LAYER_STATS;
#endif /* CONFIG_RTW_CFGVEDNOR_LLSTATS */
return feature_set;
}
@ -362,8 +378,8 @@ exit:
}
#if defined(GSCAN_SUPPORT) && 0
int wl_cfgvendor_send_hotlist_event(struct wiphy *wiphy,
struct net_device *dev, void *data, int len, wl_vendor_event_t event)
int rtw_cfgvendor_send_hotlist_event(struct wiphy *wiphy,
struct net_device *dev, void *data, int len, rtw_vendor_event_t event)
{
u16 kflags;
const void *ptr;
@ -413,7 +429,7 @@ int wl_cfgvendor_send_hotlist_event(struct wiphy *wiphy,
}
static int wl_cfgvendor_gscan_get_capabilities(struct wiphy *wiphy,
static int rtw_cfgvendor_gscan_get_capabilities(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data, int len)
{
int err = 0;
@ -440,7 +456,7 @@ static int wl_cfgvendor_gscan_get_capabilities(struct wiphy *wiphy,
return err;
}
static int wl_cfgvendor_gscan_get_channel_list(struct wiphy *wiphy,
static int rtw_cfgvendor_gscan_get_channel_list(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data, int len)
{
int err = 0, type, band;
@ -487,7 +503,7 @@ exit:
return err;
}
static int wl_cfgvendor_gscan_get_batch_results(struct wiphy *wiphy,
static int rtw_cfgvendor_gscan_get_batch_results(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data, int len)
{
int err = 0;
@ -571,7 +587,7 @@ static int wl_cfgvendor_gscan_get_batch_results(struct wiphy *wiphy,
return rtw_cfg80211_vendor_cmd_reply(skb);
}
static int wl_cfgvendor_initiate_gscan(struct wiphy *wiphy,
static int rtw_cfgvendor_initiate_gscan(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data, int len)
{
int err = 0;
@ -601,7 +617,7 @@ static int wl_cfgvendor_initiate_gscan(struct wiphy *wiphy,
}
static int wl_cfgvendor_enable_full_scan_result(struct wiphy *wiphy,
static int rtw_cfgvendor_enable_full_scan_result(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data, int len)
{
int err = 0;
@ -625,7 +641,7 @@ static int wl_cfgvendor_enable_full_scan_result(struct wiphy *wiphy,
return err;
}
static int wl_cfgvendor_set_scan_cfg(struct wiphy *wiphy,
static int rtw_cfgvendor_set_scan_cfg(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data, int len)
{
int err = 0;
@ -717,7 +733,7 @@ static int wl_cfgvendor_set_scan_cfg(struct wiphy *wiphy,
}
static int wl_cfgvendor_hotlist_cfg(struct wiphy *wiphy,
static int rtw_cfgvendor_hotlist_cfg(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data, int len)
{
int err = 0;
@ -783,7 +799,7 @@ exit:
kfree(hotlist_params);
return err;
}
static int wl_cfgvendor_set_batch_scan_cfg(struct wiphy *wiphy,
static int rtw_cfgvendor_set_batch_scan_cfg(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data, int len)
{
int err = 0, tmp, type;
@ -820,7 +836,7 @@ static int wl_cfgvendor_set_batch_scan_cfg(struct wiphy *wiphy,
return err;
}
static int wl_cfgvendor_significant_change_cfg(struct wiphy *wiphy,
static int rtw_cfgvendor_significant_change_cfg(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data, int len)
{
int err = 0;
@ -894,7 +910,7 @@ exit:
#endif /* GSCAN_SUPPORT */
#if defined(RTT_SUPPORT) && 0
void wl_cfgvendor_rtt_evt(void *ctx, void *rtt_data)
void rtw_cfgvendor_rtt_evt(void *ctx, void *rtt_data)
{
struct wireless_dev *wdev = (struct wireless_dev *)ctx;
struct wiphy *wiphy;
@ -958,7 +974,7 @@ exit:
return;
}
static int wl_cfgvendor_rtt_set_config(struct wiphy *wiphy, struct wireless_dev *wdev,
static int rtw_cfgvendor_rtt_set_config(struct wiphy *wiphy, struct wireless_dev *wdev,
const void *data, int len)
{
int err = 0, rem, rem1, rem2, type;
@ -1045,7 +1061,7 @@ exit:
return err;
}
static int wl_cfgvendor_rtt_cancel_config(struct wiphy *wiphy, struct wireless_dev *wdev,
static int rtw_cfgvendor_rtt_cancel_config(struct wiphy *wiphy, struct wireless_dev *wdev,
const void *data, int len)
{
int err = 0, rem, type, target_cnt = 0;
@ -1085,7 +1101,7 @@ exit:
kfree(mac_list);
return err;
}
static int wl_cfgvendor_rtt_get_capability(struct wiphy *wiphy, struct wireless_dev *wdev,
static int rtw_cfgvendor_rtt_get_capability(struct wiphy *wiphy, struct wireless_dev *wdev,
const void *data, int len)
{
int err = 0;
@ -1107,57 +1123,174 @@ exit:
}
#endif /* RTT_SUPPORT */
static int wl_cfgvendor_priv_string_handler(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data, int len)
#ifdef CONFIG_RTW_CFGVEDNOR_LLSTATS
enum {
LSTATS_SUBCMD_GET_INFO = ANDROID_NL80211_SUBCMD_LSTATS_RANGE_START,
LSTATS_SUBCMD_SET_INFO,
LSTATS_SUBCMD_CLEAR_INFO,
};
static void LinkLayerStats(_adapter *padapter)
{
int err = 0;
u8 resp[1] = {'\0'};
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
struct recv_priv *precvpriv = &(padapter->recvpriv);
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
u32 ps_time, trx_total_time;
u64 tx_bytes, rx_bytes, trx_total_bytes = 0;
u64 tmp = 0;
RTW_DBG("%s adapter type : %u\n", __func__, padapter->adapter_type);
RTW_PRINT(FUNC_NDEV_FMT" %s\n", FUNC_NDEV_ARG(wdev_to_ndev(wdev)), (char *)data);
err = rtw_cfgvendor_send_cmd_reply(wiphy, wdev_to_ndev(wdev), resp, 1);
if (unlikely(err))
RTW_ERR(FUNC_NDEV_FMT"Vendor Command reply failed ret:%d\n"
, FUNC_NDEV_ARG(wdev_to_ndev(wdev)), err);
tx_bytes = 0;
rx_bytes = 0;
ps_time = 0;
trx_total_time = 0;
return err;
#if 0
struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
int err = 0;
int data_len = 0;
if ( padapter->netif_up == _TRUE ) {
bzero(cfg->ioctl_buf, WLC_IOCTL_MAXLEN);
pwrpriv->on_time = rtw_get_passing_time_ms(pwrpriv->radio_on_start_time);
if (strncmp((char *)data, BRCM_VENDOR_SCMD_CAPA, strlen(BRCM_VENDOR_SCMD_CAPA)) == 0) {
err = wldev_iovar_getbuf(bcmcfg_to_prmry_ndev(cfg), "cap", NULL, 0,
cfg->ioctl_buf, WLC_IOCTL_MAXLEN, &cfg->ioctl_buf_sync);
if (unlikely(err)) {
WL_ERR(("error (%d)\n", err));
return err;
if (rtw_mi_check_fwstate(padapter, _FW_LINKED)) {
if ( pwrpriv->bpower_saving == _TRUE ) {
pwrpriv->pwr_saving_time += rtw_get_passing_time_ms(pwrpriv->pwr_saving_start_time);
pwrpriv->pwr_saving_start_time = rtw_get_current_time();
}
} else {
#ifdef CONFIG_IPS
if ( pwrpriv->bpower_saving == _TRUE ) {
pwrpriv->pwr_saving_time += rtw_get_passing_time_ms(pwrpriv->pwr_saving_start_time);
pwrpriv->pwr_saving_start_time = rtw_get_current_time();
}
#else
pwrpriv->pwr_saving_time = pwrpriv->on_time;
#endif
}
data_len = strlen(cfg->ioctl_buf);
cfg->ioctl_buf[data_len] = '\0';
ps_time = pwrpriv->pwr_saving_time;
/* Deviation caused by caculation start time */
if ( ps_time > pwrpriv->on_time )
ps_time = pwrpriv->on_time;
tx_bytes = pdvobjpriv->traffic_stat.last_tx_bytes;
rx_bytes = pdvobjpriv->traffic_stat.last_rx_bytes;
trx_total_bytes = tx_bytes + rx_bytes;
trx_total_time = pwrpriv->on_time - ps_time;
if ( trx_total_bytes == 0) {
pwrpriv->tx_time = 0;
pwrpriv->rx_time = 0;
} else {
/* tx_time = (trx_total_time * tx_total_bytes) / trx_total_bytes; */
/* rx_time = (trx_total_time * rx_total_bytes) / trx_total_bytes; */
tmp = (tx_bytes * trx_total_time);
tmp = rtw_division64(tmp, trx_total_bytes);
pwrpriv->tx_time = tmp;
tmp = (rx_bytes * trx_total_time);
tmp = rtw_division64(tmp, trx_total_bytes);
pwrpriv->rx_time = tmp;
}
}
else {
pwrpriv->on_time = 0;
pwrpriv->tx_time = 0;
pwrpriv->rx_time = 0;
}
err = rtw_cfgvendor_send_cmd_reply(wiphy, bcmcfg_to_prmry_ndev(cfg),
cfg->ioctl_buf, data_len + 1);
if (unlikely(err))
WL_ERR(("Vendor Command reply failed ret:%d\n", err));
else
WL_INFORM(("Vendor Command reply sent successfully!\n"));
#ifdef CONFIG_RTW_WIFI_HAL_DEBUG
RTW_INFO("- tx_bytes : %llu rx_bytes : %llu total bytes : %llu\n", tx_bytes, rx_bytes, trx_total_bytes);
RTW_INFO("- netif_up=%s, on_time : %u ms\n", padapter->netif_up ? "1":"0", pwrpriv->on_time);
RTW_INFO("- pwr_saving_time : %u (%u) ms\n", pwrpriv->pwr_saving_time, ps_time);
RTW_INFO("- trx_total_time : %u ms\n", trx_total_time);
RTW_INFO("- tx_time : %u ms\n", pwrpriv->tx_time);
RTW_INFO("- rx_time : %u ms\n", pwrpriv->rx_time);
#endif /* CONFIG_RTW_WIFI_HAL_DEBUG */
return err;
#endif
}
#define DUMMY_TIME_STATICS 99
static int rtw_cfgvendor_lstats_get_info(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data, int len)
{
int err = 0;
_adapter *padapter = GET_PRIMARY_ADAPTER(wiphy_to_adapter(wiphy));
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
wifi_radio_stat *radio;
wifi_iface_stat *iface;
char *output;
output = rtw_malloc(sizeof(wifi_radio_stat) + sizeof(wifi_iface_stat)+1);
if (output == NULL) {
RTW_DBG("Allocate lstats info buffer fail!\n");
}
radio = (wifi_radio_stat *)output;
radio->num_channels = 0;
radio->radio = 1;
/* to get on_time, tx_time, rx_time */
LinkLayerStats(padapter);
radio->on_time = pwrpriv->on_time;
radio->tx_time = pwrpriv->tx_time;
radio->rx_time = pwrpriv->rx_time;
radio->num_tx_levels = 1;
radio->tx_time_per_levels = NULL;
radio->tx_time_per_levels = (u32*)(output+sizeof(wifi_radio_stat) + sizeof(wifi_iface_stat));
*(radio->tx_time_per_levels) = DUMMY_TIME_STATICS;
radio->on_time_scan = 0;
radio->on_time_nbd = 0;
radio->on_time_gscan = 0;
radio->on_time_pno_scan = 0;
radio->on_time_hs20 = 0;
#ifdef CONFIG_RTW_WIFI_HAL_DEBUG
RTW_INFO("==== %s ====\n", __func__);
RTW_INFO("radio->radio : %d\n", (radio->radio));
RTW_INFO("pwrpriv->on_time : %u ms\n", (pwrpriv->on_time));
RTW_INFO("pwrpriv->tx_time : %u ms\n", (pwrpriv->tx_time));
RTW_INFO("pwrpriv->rx_time : %u ms\n", (pwrpriv->rx_time));
RTW_INFO("radio->on_time : %u ms\n", (radio->on_time));
RTW_INFO("radio->tx_time : %u ms\n", (radio->tx_time));
RTW_INFO("radio->rx_time : %u ms\n", (radio->rx_time));
RTW_INFO("radio->tx_time_per_levels value : %u ms\n", *(radio->tx_time_per_levels));
#endif /* CONFIG_RTW_WIFI_HAL_DEBUG */
RTW_DBG(FUNC_NDEV_FMT" %s\n", FUNC_NDEV_ARG(wdev_to_ndev(wdev)), (char*)data);
err = rtw_cfgvendor_send_cmd_reply(wiphy, wdev_to_ndev(wdev),
output, sizeof(wifi_iface_stat) + sizeof(wifi_radio_stat)+1);
if (unlikely(err))
RTW_ERR(FUNC_NDEV_FMT"Vendor Command reply failed ret:%d \n"
, FUNC_NDEV_ARG(wdev_to_ndev(wdev)), err);
rtw_mfree(output, sizeof(wifi_iface_stat) + sizeof(wifi_radio_stat)+1);
return err;
}
static int rtw_cfgvendor_lstats_set_info(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data, int len)
{
int err = 0;
RTW_INFO("%s\n", __func__);
return err;
}
static int rtw_cfgvendor_lstats_clear_info(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data, int len)
{
int err = 0;
RTW_INFO("%s\n", __func__);
return err;
}
#endif /* CONFIG_RTW_CFGVEDNOR_LLSTATS */
static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
{
{
.vendor_id = OUI_BRCM,
.subcmd = BRCM_VENDOR_SCMD_PRIV_STR
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = wl_cfgvendor_priv_string_handler
},
#if defined(GSCAN_SUPPORT) && 0
{
{
@ -1165,7 +1298,7 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
.subcmd = GSCAN_SUBCMD_GET_CAPABILITIES
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = wl_cfgvendor_gscan_get_capabilities
.doit = rtw_cfgvendor_gscan_get_capabilities
},
{
{
@ -1173,7 +1306,7 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
.subcmd = GSCAN_SUBCMD_SET_CONFIG
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = wl_cfgvendor_set_scan_cfg
.doit = rtw_cfgvendor_set_scan_cfg
},
{
{
@ -1181,7 +1314,7 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
.subcmd = GSCAN_SUBCMD_SET_SCAN_CONFIG
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = wl_cfgvendor_set_batch_scan_cfg
.doit = rtw_cfgvendor_set_batch_scan_cfg
},
{
{
@ -1189,7 +1322,7 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
.subcmd = GSCAN_SUBCMD_ENABLE_GSCAN
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = wl_cfgvendor_initiate_gscan
.doit = rtw_cfgvendor_initiate_gscan
},
{
{
@ -1197,7 +1330,7 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
.subcmd = GSCAN_SUBCMD_ENABLE_FULL_SCAN_RESULTS
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = wl_cfgvendor_enable_full_scan_result
.doit = rtw_cfgvendor_enable_full_scan_result
},
{
{
@ -1205,7 +1338,7 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
.subcmd = GSCAN_SUBCMD_SET_HOTLIST
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = wl_cfgvendor_hotlist_cfg
.doit = rtw_cfgvendor_hotlist_cfg
},
{
{
@ -1213,7 +1346,7 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
.subcmd = GSCAN_SUBCMD_SET_SIGNIFICANT_CHANGE_CONFIG
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = wl_cfgvendor_significant_change_cfg
.doit = rtw_cfgvendor_significant_change_cfg
},
{
{
@ -1221,7 +1354,7 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
.subcmd = GSCAN_SUBCMD_GET_SCAN_RESULTS
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = wl_cfgvendor_gscan_get_batch_results
.doit = rtw_cfgvendor_gscan_get_batch_results
},
{
{
@ -1229,7 +1362,7 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
.subcmd = GSCAN_SUBCMD_GET_CHANNEL_LIST
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = wl_cfgvendor_gscan_get_channel_list
.doit = rtw_cfgvendor_gscan_get_channel_list
},
#endif /* GSCAN_SUPPORT */
#if defined(RTT_SUPPORT) && 0
@ -1239,7 +1372,7 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
.subcmd = RTT_SUBCMD_SET_CONFIG
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = wl_cfgvendor_rtt_set_config
.doit = rtw_cfgvendor_rtt_set_config
},
{
{
@ -1247,7 +1380,7 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
.subcmd = RTT_SUBCMD_CANCEL_CONFIG
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = wl_cfgvendor_rtt_cancel_config
.doit = rtw_cfgvendor_rtt_cancel_config
},
{
{
@ -1255,13 +1388,39 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
.subcmd = RTT_SUBCMD_GETCAPABILITY
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = wl_cfgvendor_rtt_get_capability
.doit = rtw_cfgvendor_rtt_get_capability
},
#endif /* RTT_SUPPORT */
#ifdef CONFIG_RTW_CFGVEDNOR_LLSTATS
{
{
.vendor_id = OUI_GOOGLE,
.subcmd = ANDR_WIFI_SUBCMD_GET_FEATURE_SET
.subcmd = LSTATS_SUBCMD_GET_INFO
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = rtw_cfgvendor_lstats_get_info
},
{
{
.vendor_id = OUI_GOOGLE,
.subcmd = LSTATS_SUBCMD_SET_INFO
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = rtw_cfgvendor_lstats_set_info
},
{
{
.vendor_id = OUI_GOOGLE,
.subcmd = LSTATS_SUBCMD_CLEAR_INFO
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = rtw_cfgvendor_lstats_clear_info
},
#endif /* CONFIG_RTW_CFGVEDNOR_LLSTATS */
{
{
.vendor_id = OUI_GOOGLE,
.subcmd = WIFI_SUBCMD_GET_FEATURE_SET
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = rtw_cfgvendor_get_feature_set
@ -1269,7 +1428,7 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
{
{
.vendor_id = OUI_GOOGLE,
.subcmd = ANDR_WIFI_SUBCMD_GET_FEATURE_SET_MATRIX
.subcmd = WIFI_SUBCMD_GET_FEATURE_SET_MATRIX
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = rtw_cfgvendor_get_feature_set_matrix
@ -1277,20 +1436,18 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
};
static const struct nl80211_vendor_cmd_info rtw_vendor_events[] = {
{ OUI_BRCM, BRCM_VENDOR_EVENT_UNSPEC },
{ OUI_BRCM, BRCM_VENDOR_EVENT_PRIV_STR },
#if defined(GSCAN_SUPPORT) && 0
{ OUI_GOOGLE, GOOGLE_GSCAN_SIGNIFICANT_EVENT },
{ OUI_GOOGLE, GOOGLE_GSCAN_GEOFENCE_FOUND_EVENT },
{ OUI_GOOGLE, GOOGLE_GSCAN_BATCH_SCAN_EVENT },
{ OUI_GOOGLE, GOOGLE_SCAN_FULL_RESULTS_EVENT },
{ OUI_GOOGLE, GSCAN_EVENT_SIGNIFICANT_CHANGE_RESULTS },
{ OUI_GOOGLE, GSCAN_EVENT_HOTLIST_RESULTS_FOUND },
{ OUI_GOOGLE, GSCAN_EVENT_SCAN_RESULTS_AVAILABLE },
{ OUI_GOOGLE, GSCAN_EVENT_FULL_SCAN_RESULTS },
#endif /* GSCAN_SUPPORT */
#if defined(RTT_SUPPORT) && 0
{ OUI_GOOGLE, GOOGLE_RTT_COMPLETE_EVENT },
{ OUI_GOOGLE, RTT_EVENT_COMPLETE },
#endif /* RTT_SUPPORT */
#if defined(GSCAN_SUPPORT) && 0
{ OUI_GOOGLE, GOOGLE_SCAN_COMPLETE_EVENT },
{ OUI_GOOGLE, GOOGLE_GSCAN_GEOFENCE_LOST_EVENT }
{ OUI_GOOGLE, GSCAN_EVENT_COMPLETE_SCAN },
{ OUI_GOOGLE, GSCAN_EVENT_HOTLIST_RESULTS_LOST }
#endif /* GSCAN_SUPPORT */
};

View File

@ -16,9 +16,7 @@
#ifndef _RTW_CFGVENDOR_H_
#define _RTW_CFGVENDOR_H_
#define OUI_BRCM 0x001018
#define OUI_GOOGLE 0x001A11
#define BRCM_VENDOR_SUBCMD_PRIV_STR 1
#define ATTRIBUTE_U32_LEN (NLA_HDRLEN + 4)
#define VENDOR_ID_OVERHEAD ATTRIBUTE_U32_LEN
#define VENDOR_SUBCMD_OVERHEAD ATTRIBUTE_U32_LEN
@ -39,54 +37,91 @@
VENDOR_SUBCMD_OVERHEAD + \
VENDOR_DATA_OVERHEAD)
typedef enum {
/* don't use 0 as a valid subcommand */
VENDOR_NL80211_SUBCMD_UNSPECIFIED,
/* don't use 0 as a valid subcommand */
VENDOR_NL80211_SUBCMD_UNSPECIFIED,
/* define all vendor startup commands between 0x0 and 0x0FFF */
VENDOR_NL80211_SUBCMD_RANGE_START = 0x0001,
VENDOR_NL80211_SUBCMD_RANGE_END = 0x0FFF,
/* define all vendor startup commands between 0x0 and 0x0FFF */
VENDOR_NL80211_SUBCMD_RANGE_START = 0x0001,
VENDOR_NL80211_SUBCMD_RANGE_END = 0x0FFF,
/* define all GScan related commands between 0x1000 and 0x10FF */
ANDROID_NL80211_SUBCMD_GSCAN_RANGE_START = 0x1000,
ANDROID_NL80211_SUBCMD_GSCAN_RANGE_END = 0x10FF,
/* define all GScan related commands between 0x1000 and 0x10FF */
ANDROID_NL80211_SUBCMD_GSCAN_RANGE_START = 0x1000,
ANDROID_NL80211_SUBCMD_GSCAN_RANGE_END = 0x10FF,
/* define all NearbyDiscovery related commands between 0x1100 and 0x11FF */
ANDROID_NL80211_SUBCMD_NBD_RANGE_START = 0x1100,
ANDROID_NL80211_SUBCMD_NBD_RANGE_END = 0x11FF,
/* define all NearbyDiscovery related commands between 0x1100 and 0x11FF */
ANDROID_NL80211_SUBCMD_NBD_RANGE_START = 0x1100,
ANDROID_NL80211_SUBCMD_NBD_RANGE_END = 0x11FF,
/* define all RTT related commands between 0x1100 and 0x11FF */
ANDROID_NL80211_SUBCMD_RTT_RANGE_START = 0x1100,
ANDROID_NL80211_SUBCMD_RTT_RANGE_END = 0x11FF,
/* define all RTT related commands between 0x1100 and 0x11FF */
ANDROID_NL80211_SUBCMD_RTT_RANGE_START = 0x1100,
ANDROID_NL80211_SUBCMD_RTT_RANGE_END = 0x11FF,
ANDROID_NL80211_SUBCMD_LSTATS_RANGE_START = 0x1200,
ANDROID_NL80211_SUBCMD_LSTATS_RANGE_END = 0x12FF,
ANDROID_NL80211_SUBCMD_LSTATS_RANGE_START = 0x1200,
ANDROID_NL80211_SUBCMD_LSTATS_RANGE_END = 0x12FF,
ANDROID_NL80211_SUBCMD_TDLS_RANGE_START = 0x1300,
ANDROID_NL80211_SUBCMD_TDLS_RANGE_END = 0x13FF,
/* This is reserved for future usage */
/* define all Logger related commands between 0x1400 and 0x14FF */
ANDROID_NL80211_SUBCMD_DEBUG_RANGE_START = 0x1400,
ANDROID_NL80211_SUBCMD_DEBUG_RANGE_END = 0x14FF,
/* define all wifi offload related commands between 0x1600 and 0x16FF */
ANDROID_NL80211_SUBCMD_WIFI_OFFLOAD_RANGE_START = 0x1600,
ANDROID_NL80211_SUBCMD_WIFI_OFFLOAD_RANGE_END = 0x16FF,
/* define all NAN related commands between 0x1700 and 0x17FF */
ANDROID_NL80211_SUBCMD_NAN_RANGE_START = 0x1700,
ANDROID_NL80211_SUBCMD_NAN_RANGE_END = 0x17FF,
/* define all Android Packet Filter related commands between 0x1800 and 0x18FF */
ANDROID_NL80211_SUBCMD_PKT_FILTER_RANGE_START = 0x1800,
ANDROID_NL80211_SUBCMD_PKT_FILTER_RANGE_END = 0x18FF,
/* This is reserved for future usage */
} ANDROID_VENDOR_SUB_COMMAND;
enum wl_vendor_subcmd {
BRCM_VENDOR_SCMD_UNSPEC,
BRCM_VENDOR_SCMD_PRIV_STR,
GSCAN_SUBCMD_GET_CAPABILITIES = ANDROID_NL80211_SUBCMD_GSCAN_RANGE_START,
GSCAN_SUBCMD_SET_CONFIG,
GSCAN_SUBCMD_SET_SCAN_CONFIG,
GSCAN_SUBCMD_ENABLE_GSCAN,
GSCAN_SUBCMD_GET_SCAN_RESULTS,
GSCAN_SUBCMD_SCAN_RESULTS,
GSCAN_SUBCMD_SET_HOTLIST,
GSCAN_SUBCMD_SET_SIGNIFICANT_CHANGE_CONFIG,
GSCAN_SUBCMD_ENABLE_FULL_SCAN_RESULTS,
GSCAN_SUBCMD_GET_CHANNEL_LIST,
ANDR_WIFI_SUBCMD_GET_FEATURE_SET,
ANDR_WIFI_SUBCMD_GET_FEATURE_SET_MATRIX,
enum rtw_vendor_subcmd {
GSCAN_SUBCMD_GET_CAPABILITIES = ANDROID_NL80211_SUBCMD_GSCAN_RANGE_START,
GSCAN_SUBCMD_SET_CONFIG, /* 0x1001 */
GSCAN_SUBCMD_SET_SCAN_CONFIG, /* 0x1002 */
GSCAN_SUBCMD_ENABLE_GSCAN, /* 0x1003 */
GSCAN_SUBCMD_GET_SCAN_RESULTS, /* 0x1004 */
GSCAN_SUBCMD_SCAN_RESULTS, /* 0x1005 */
GSCAN_SUBCMD_SET_HOTLIST, /* 0x1006 */
GSCAN_SUBCMD_SET_SIGNIFICANT_CHANGE_CONFIG, /* 0x1007 */
GSCAN_SUBCMD_ENABLE_FULL_SCAN_RESULTS, /* 0x1008 */
GSCAN_SUBCMD_GET_CHANNEL_LIST, /* 0x1009 */
WIFI_SUBCMD_GET_FEATURE_SET, /* 0x100A */
WIFI_SUBCMD_GET_FEATURE_SET_MATRIX, /* 0x100B */
WIFI_SUBCMD_SET_PNO_RANDOM_MAC_OUI, /* 0x100C */
WIFI_SUBCMD_NODFS_SET, /* 0x100D */
WIFI_SUBCMD_SET_COUNTRY_CODE, /* 0x100E */
/* Add more sub commands here */
GSCAN_SUBCMD_SET_EPNO_SSID, /* 0x100F */
WIFI_SUBCMD_SET_SSID_WHITE_LIST, /* 0x1010 */
WIFI_SUBCMD_SET_ROAM_PARAMS, /* 0x1011 */
WIFI_SUBCMD_ENABLE_LAZY_ROAM, /* 0x1012 */
WIFI_SUBCMD_SET_BSSID_PREF, /* 0x1013 */
WIFI_SUBCMD_SET_BSSID_BLACKLIST, /* 0x1014 */
GSCAN_SUBCMD_ANQPO_CONFIG, /* 0x1015 */
WIFI_SUBCMD_SET_RSSI_MONITOR, /* 0x1016 */
WIFI_SUBCMD_CONFIG_ND_OFFLOAD, /* 0x1017 */
/* Add more sub commands here */
GSCAN_SUBCMD_MAX,
RTT_SUBCMD_SET_CONFIG = ANDROID_NL80211_SUBCMD_RTT_RANGE_START,
RTT_SUBCMD_CANCEL_CONFIG,
RTT_SUBCMD_GETCAPABILITY,
/* Add more sub commands here */
VENDOR_SUBCMD_MAX
APF_SUBCMD_GET_CAPABILITIES = ANDROID_NL80211_SUBCMD_PKT_FILTER_RANGE_START,
APF_SUBCMD_SET_FILTER,
};
enum gscan_attributes {
@ -178,24 +213,29 @@ enum rtt_attributes {
RTT_ATTRIBUTE_TARGET_NUM_RETRY
};
typedef enum wl_vendor_event {
BRCM_VENDOR_EVENT_UNSPEC,
BRCM_VENDOR_EVENT_PRIV_STR,
GOOGLE_GSCAN_SIGNIFICANT_EVENT,
GOOGLE_GSCAN_GEOFENCE_FOUND_EVENT,
GOOGLE_GSCAN_BATCH_SCAN_EVENT,
GOOGLE_SCAN_FULL_RESULTS_EVENT,
GOOGLE_RTT_COMPLETE_EVENT,
GOOGLE_SCAN_COMPLETE_EVENT,
GOOGLE_GSCAN_GEOFENCE_LOST_EVENT
} wl_vendor_event_t;
typedef enum rtw_vendor_event {
RTK_RESERVED1,
RTK_RESERVED2,
GSCAN_EVENT_SIGNIFICANT_CHANGE_RESULTS ,
GSCAN_EVENT_HOTLIST_RESULTS_FOUND,
GSCAN_EVENT_SCAN_RESULTS_AVAILABLE,
GSCAN_EVENT_FULL_SCAN_RESULTS,
RTT_EVENT_COMPLETE,
GSCAN_EVENT_COMPLETE_SCAN,
GSCAN_EVENT_HOTLIST_RESULTS_LOST,
GSCAN_EVENT_EPNO_EVENT,
GOOGLE_DEBUG_RING_EVENT,
GOOGLE_DEBUG_MEM_DUMP_EVENT,
GSCAN_EVENT_ANQPO_HOTSPOT_MATCH,
GOOGLE_RSSI_MONITOR_EVENT
} rtw_vendor_event_t;
enum andr_wifi_feature_set_attr {
ANDR_WIFI_ATTRIBUTE_NUM_FEATURE_SET,
ANDR_WIFI_ATTRIBUTE_FEATURE_SET
};
typedef enum wl_vendor_gscan_attribute {
typedef enum rtw_vendor_gscan_attribute {
ATTR_START_GSCAN,
ATTR_STOP_GSCAN,
ATTR_SET_SCAN_BATCH_CFG_ID, /* set batch scan params */
@ -205,7 +245,7 @@ typedef enum wl_vendor_gscan_attribute {
ATTR_GET_GSCAN_CAPABILITIES_ID,
/* Add more sub commands here */
ATTR_GSCAN_MAX
} wl_vendor_gscan_attribute_t;
} rtw_vendor_gscan_attribute_t;
typedef enum gscan_batch_attribute {
ATTR_GSCAN_BATCH_BESTN,
@ -222,9 +262,288 @@ typedef enum gscan_complete_event {
WIFI_SCAN_BUFFER_FULL,
WIFI_SCAN_COMPLETE
} gscan_complete_event_t;
/* wifi_hal.h */
/* WiFi Common definitions */
typedef unsigned char byte;
typedef int wifi_request_id;
typedef int wifi_channel; // indicates channel frequency in MHz
typedef int wifi_rssi;
typedef byte mac_addr[6];
typedef byte oui[3];
typedef int64_t wifi_timestamp; // In microseconds (us)
typedef int64_t wifi_timespan; // In picoseconds (ps)
struct wifi_info;
struct wifi_interface_info;
typedef struct wifi_info *wifi_handle;
typedef struct wifi_interface_info *wifi_interface_handle;
/* channel operating width */
typedef enum {
WIFI_CHAN_WIDTH_20 = 0,
WIFI_CHAN_WIDTH_40 = 1,
WIFI_CHAN_WIDTH_80 = 2,
WIFI_CHAN_WIDTH_160 = 3,
WIFI_CHAN_WIDTH_80P80 = 4,
WIFI_CHAN_WIDTH_5 = 5,
WIFI_CHAN_WIDTH_10 = 6,
WIFI_CHAN_WIDTH_INVALID = -1
} wifi_channel_width;
typedef int wifi_radio;
typedef struct {
wifi_channel_width width;
int center_frequency0;
int center_frequency1;
int primary_frequency;
} wifi_channel_spec;
typedef enum {
WIFI_SUCCESS = 0,
WIFI_ERROR_NONE = 0,
WIFI_ERROR_UNKNOWN = -1,
WIFI_ERROR_UNINITIALIZED = -2,
WIFI_ERROR_NOT_SUPPORTED = -3,
WIFI_ERROR_NOT_AVAILABLE = -4, // Not available right now, but try later
WIFI_ERROR_INVALID_ARGS = -5,
WIFI_ERROR_INVALID_REQUEST_ID = -6,
WIFI_ERROR_TIMED_OUT = -7,
WIFI_ERROR_TOO_MANY_REQUESTS = -8, // Too many instances of this request
WIFI_ERROR_OUT_OF_MEMORY = -9,
WIFI_ERROR_BUSY = -10,
} wifi_error;
#ifdef CONFIG_RTW_CFGVEDNOR_LLSTATS
#define STATS_MAJOR_VERSION 1
#define STATS_MINOR_VERSION 0
#define STATS_MICRO_VERSION 0
typedef enum {
WIFI_DISCONNECTED = 0,
WIFI_AUTHENTICATING = 1,
WIFI_ASSOCIATING = 2,
WIFI_ASSOCIATED = 3,
WIFI_EAPOL_STARTED = 4, // if done by firmware/driver
WIFI_EAPOL_COMPLETED = 5, // if done by firmware/driver
} wifi_connection_state;
typedef enum {
WIFI_ROAMING_IDLE = 0,
WIFI_ROAMING_ACTIVE = 1,
} wifi_roam_state;
typedef enum {
WIFI_INTERFACE_STA = 0,
WIFI_INTERFACE_SOFTAP = 1,
WIFI_INTERFACE_IBSS = 2,
WIFI_INTERFACE_P2P_CLIENT = 3,
WIFI_INTERFACE_P2P_GO = 4,
WIFI_INTERFACE_NAN = 5,
WIFI_INTERFACE_MESH = 6,
WIFI_INTERFACE_UNKNOWN = -1
} wifi_interface_mode;
#define WIFI_CAPABILITY_QOS 0x00000001 // set for QOS association
#define WIFI_CAPABILITY_PROTECTED 0x00000002 // set for protected association (802.11 beacon frame control protected bit set)
#define WIFI_CAPABILITY_INTERWORKING 0x00000004 // set if 802.11 Extended Capabilities element interworking bit is set
#define WIFI_CAPABILITY_HS20 0x00000008 // set for HS20 association
#define WIFI_CAPABILITY_SSID_UTF8 0x00000010 // set is 802.11 Extended Capabilities element UTF-8 SSID bit is set
#define WIFI_CAPABILITY_COUNTRY 0x00000020 // set is 802.11 Country Element is present
typedef struct {
wifi_interface_mode mode; // interface mode
u8 mac_addr[6]; // interface mac address (self)
wifi_connection_state state; // connection state (valid for STA, CLI only)
wifi_roam_state roaming; // roaming state
u32 capabilities; // WIFI_CAPABILITY_XXX (self)
u8 ssid[33]; // null terminated SSID
u8 bssid[6]; // bssid
u8 ap_country_str[3]; // country string advertised by AP
u8 country_str[3]; // country string for this association
} wifi_interface_link_layer_info;
/* channel information */
typedef struct {
wifi_channel_width width; // channel width (20, 40, 80, 80+80, 160)
wifi_channel center_freq; // primary 20 MHz channel
wifi_channel center_freq0; // center frequency (MHz) first segment
wifi_channel center_freq1; // center frequency (MHz) second segment
} wifi_channel_info;
/* wifi rate */
typedef struct {
u32 preamble :3; // 0: OFDM, 1:CCK, 2:HT 3:VHT 4..7 reserved
u32 nss :2; // 0:1x1, 1:2x2, 3:3x3, 4:4x4
u32 bw :3; // 0:20MHz, 1:40Mhz, 2:80Mhz, 3:160Mhz
u32 rateMcsIdx :8; // OFDM/CCK rate code would be as per ieee std in the units of 0.5mbps
// HT/VHT it would be mcs index
u32 reserved :16; // reserved
u32 bitrate; // units of 100 Kbps
} wifi_rate;
/* channel statistics */
typedef struct {
wifi_channel_info channel; // channel
u32 on_time; // msecs the radio is awake (32 bits number accruing over time)
u32 cca_busy_time; // msecs the CCA register is busy (32 bits number accruing over time)
} wifi_channel_stat;
// Max number of tx power levels. The actual number vary per device and is specified by |num_tx_levels|
#define RADIO_STAT_MAX_TX_LEVELS 256
/* radio statistics */
typedef struct {
wifi_radio radio; // wifi radio (if multiple radio supported)
u32 on_time; // msecs the radio is awake (32 bits number accruing over time)
u32 tx_time; // msecs the radio is transmitting (32 bits number accruing over time)
u32 num_tx_levels; // number of radio transmit power levels
u32* tx_time_per_levels; // pointer to an array of radio transmit per power levels in
// msecs accured over time
u32 rx_time; // msecs the radio is in active receive (32 bits number accruing over time)
u32 on_time_scan; // msecs the radio is awake due to all scan (32 bits number accruing over time)
u32 on_time_nbd; // msecs the radio is awake due to NAN (32 bits number accruing over time)
u32 on_time_gscan; // msecs the radio is awake due to G?scan (32 bits number accruing over time)
u32 on_time_roam_scan; // msecs the radio is awake due to roam?scan (32 bits number accruing over time)
u32 on_time_pno_scan; // msecs the radio is awake due to PNO scan (32 bits number accruing over time)
u32 on_time_hs20; // msecs the radio is awake due to HS2.0 scans and GAS exchange (32 bits number accruing over time)
u32 num_channels; // number of channels
wifi_channel_stat channels[]; // channel statistics
} wifi_radio_stat;
/**
* Packet statistics reporting by firmware is performed on MPDU basi (i.e. counters increase by 1 for each MPDU)
* As well, "data packet" in associated comments, shall be interpreted as 802.11 data packet,
* that is, 802.11 frame control subtype == 2 and excluding management and control frames.
*
* As an example, in the case of transmission of an MSDU fragmented in 16 MPDUs which are transmitted
* OTA in a 16 units long a-mpdu, for which a block ack is received with 5 bits set:
* tx_mpdu : shall increase by 5
* retries : shall increase by 16
* tx_ampdu : shall increase by 1
* data packet counters shall not increase regardless of the number of BAR potentially sent by device for this a-mpdu
* data packet counters shall not increase regardless of the number of BA received by device for this a-mpdu
*
* For each subsequent retransmission of the 11 remaining non ACK'ed mpdus
* (regardless of the fact that they are transmitted in a-mpdu or not)
* retries : shall increase by 1
*
* If no subsequent BA or ACK are received from AP, until packet lifetime expires for those 11 packet that were not ACK'ed
* mpdu_lost : shall increase by 11
*/
/* per rate statistics */
typedef struct {
wifi_rate rate; // rate information
u32 tx_mpdu; // number of successfully transmitted data pkts (ACK rcvd)
u32 rx_mpdu; // number of received data pkts
u32 mpdu_lost; // number of data packet losses (no ACK)
u32 retries; // total number of data pkt retries
u32 retries_short; // number of short data pkt retries
u32 retries_long; // number of long data pkt retries
} wifi_rate_stat;
/* access categories */
typedef enum {
WIFI_AC_VO = 0,
WIFI_AC_VI = 1,
WIFI_AC_BE = 2,
WIFI_AC_BK = 3,
WIFI_AC_MAX = 4,
} wifi_traffic_ac;
/* wifi peer type */
typedef enum
{
WIFI_PEER_STA,
WIFI_PEER_AP,
WIFI_PEER_P2P_GO,
WIFI_PEER_P2P_CLIENT,
WIFI_PEER_NAN,
WIFI_PEER_TDLS,
WIFI_PEER_INVALID,
} wifi_peer_type;
/* per peer statistics */
typedef struct {
wifi_peer_type type; // peer type (AP, TDLS, GO etc.)
u8 peer_mac_address[6]; // mac address
u32 capabilities; // peer WIFI_CAPABILITY_XXX
u32 num_rate; // number of rates
wifi_rate_stat rate_stats[]; // per rate statistics, number of entries = num_rate
} wifi_peer_info;
/* Per access category statistics */
typedef struct {
wifi_traffic_ac ac; // access category (VI, VO, BE, BK)
u32 tx_mpdu; // number of successfully transmitted unicast data pkts (ACK rcvd)
u32 rx_mpdu; // number of received unicast data packets
u32 tx_mcast; // number of succesfully transmitted multicast data packets
// STA case: implies ACK received from AP for the unicast packet in which mcast pkt was sent
u32 rx_mcast; // number of received multicast data packets
u32 rx_ampdu; // number of received unicast a-mpdus; support of this counter is optional
u32 tx_ampdu; // number of transmitted unicast a-mpdus; support of this counter is optional
u32 mpdu_lost; // number of data pkt losses (no ACK)
u32 retries; // total number of data pkt retries
u32 retries_short; // number of short data pkt retries
u32 retries_long; // number of long data pkt retries
u32 contention_time_min; // data pkt min contention time (usecs)
u32 contention_time_max; // data pkt max contention time (usecs)
u32 contention_time_avg; // data pkt avg contention time (usecs)
u32 contention_num_samples; // num of data pkts used for contention statistics
} wifi_wmm_ac_stat;
/* interface statistics */
typedef struct {
wifi_interface_handle iface; // wifi interface
wifi_interface_link_layer_info info; // current state of the interface
u32 beacon_rx; // access point beacon received count from connected AP
u64 average_tsf_offset; // average beacon offset encountered (beacon_TSF - TBTT)
// The average_tsf_offset field is used so as to calculate the
// typical beacon contention time on the channel as well may be
// used to debug beacon synchronization and related power consumption issue
u32 leaky_ap_detected; // indicate that this AP typically leaks packets beyond the driver guard time.
u32 leaky_ap_avg_num_frames_leaked; // average number of frame leaked by AP after frame with PM bit set was ACK'ed by AP
u32 leaky_ap_guard_time; // guard time currently in force (when implementing IEEE power management based on
// frame control PM bit), How long driver waits before shutting down the radio and
// after receiving an ACK for a data frame with PM bit set)
u32 mgmt_rx; // access point mgmt frames received count from connected AP (including Beacon)
u32 mgmt_action_rx; // action frames received count
u32 mgmt_action_tx; // action frames transmit count
wifi_rssi rssi_mgmt; // access Point Beacon and Management frames RSSI (averaged)
wifi_rssi rssi_data; // access Point Data Frames RSSI (averaged) from connected AP
wifi_rssi rssi_ack; // access Point ACK RSSI (averaged) from connected AP
wifi_wmm_ac_stat ac[WIFI_AC_MAX]; // per ac data packet statistics
u32 num_peers; // number of peers
wifi_peer_info peer_info[]; // per peer statistics
} wifi_iface_stat;
/* configuration params */
typedef struct {
u32 mpdu_size_threshold; // threshold to classify the pkts as short or long
// packet size < mpdu_size_threshold => short
u32 aggressive_statistics_gathering; // set for field debug mode. Driver should collect all statistics regardless of performance impact.
} wifi_link_layer_params;
/* callback for reporting link layer stats */
typedef struct {
void (*on_link_stats_results) (wifi_request_id id, wifi_iface_stat *iface_stat,
int num_radios, wifi_radio_stat *radio_stat);
} wifi_stats_result_handler;
/* wifi statistics bitmap */
#define WIFI_STATS_RADIO 0x00000001 // all radio statistics
#define WIFI_STATS_RADIO_CCA 0x00000002 // cca_busy_time (within radio statistics)
#define WIFI_STATS_RADIO_CHANNELS 0x00000004 // all channel statistics (within radio statistics)
#define WIFI_STATS_RADIO_SCAN 0x00000008 // all scan statistics (within radio statistics)
#define WIFI_STATS_IFACE 0x00000010 // all interface statistics
#define WIFI_STATS_IFACE_TXRATE 0x00000020 // all tx rate statistics (within interface statistics)
#define WIFI_STATS_IFACE_AC 0x00000040 // all ac statistics (within interface statistics)
#define WIFI_STATS_IFACE_CONTENTION 0x00000080 // all contention (min, max, avg) statistics (within ac statisctics)
#endif /* CONFIG_RTW_CFGVEDNOR_LLSTATS */
/* Capture the BRCM_VENDOR_SUBCMD_PRIV_STRINGS* here */
#define BRCM_VENDOR_SCMD_CAPA "cap"
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(RTW_VENDOR_EXT_SUPPORT)
extern int rtw_cfgvendor_attach(struct wiphy *wiphy);
@ -232,8 +551,8 @@ extern int rtw_cfgvendor_detach(struct wiphy *wiphy);
extern int rtw_cfgvendor_send_async_event(struct wiphy *wiphy,
struct net_device *dev, int event_id, const void *data, int len);
#if defined(GSCAN_SUPPORT) && 0
extern int wl_cfgvendor_send_hotlist_event(struct wiphy *wiphy,
struct net_device *dev, void *data, int len, wl_vendor_event_t event);
extern int rtw_cfgvendor_send_hotlist_event(struct wiphy *wiphy,
struct net_device *dev, void *data, int len, rtw_vendor_event_t event);
#endif
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(RTW_VENDOR_EXT_SUPPORT) */

View File

@ -1,370 +0,0 @@
/*
* Radiotap parser
*
* Copyright 2007 Andy Green <andy@warmcat.com>
* Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Alternatively, this software may be distributed under the terms of BSD
* license.
*
* See COPYING for more details.
*/
#include <linux/kernel.h>
#include <linux/export.h>
#include <net/cfg80211.h>
#include <net/ieee80211_radiotap.h>
#include <asm/unaligned.h>
/* function prototypes and related defs are in include/net/cfg80211.h */
static const struct radiotap_align_size rtap_namespace_sizes[] = {
[IEEE80211_RADIOTAP_TSFT] = { .align = 8, .size = 8, },
[IEEE80211_RADIOTAP_FLAGS] = { .align = 1, .size = 1, },
[IEEE80211_RADIOTAP_RATE] = { .align = 1, .size = 1, },
[IEEE80211_RADIOTAP_CHANNEL] = { .align = 2, .size = 4, },
[IEEE80211_RADIOTAP_FHSS] = { .align = 2, .size = 2, },
[IEEE80211_RADIOTAP_DBM_ANTSIGNAL] = { .align = 1, .size = 1, },
[IEEE80211_RADIOTAP_DBM_ANTNOISE] = { .align = 1, .size = 1, },
[IEEE80211_RADIOTAP_LOCK_QUALITY] = { .align = 2, .size = 2, },
[IEEE80211_RADIOTAP_TX_ATTENUATION] = { .align = 2, .size = 2, },
[IEEE80211_RADIOTAP_DB_TX_ATTENUATION] = { .align = 2, .size = 2, },
[IEEE80211_RADIOTAP_DBM_TX_POWER] = { .align = 1, .size = 1, },
[IEEE80211_RADIOTAP_ANTENNA] = { .align = 1, .size = 1, },
[IEEE80211_RADIOTAP_DB_ANTSIGNAL] = { .align = 1, .size = 1, },
[IEEE80211_RADIOTAP_DB_ANTNOISE] = { .align = 1, .size = 1, },
[IEEE80211_RADIOTAP_RX_FLAGS] = { .align = 2, .size = 2, },
[IEEE80211_RADIOTAP_TX_FLAGS] = { .align = 2, .size = 2, },
[IEEE80211_RADIOTAP_RTS_RETRIES] = { .align = 1, .size = 1, },
[IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, },
[IEEE80211_RADIOTAP_MCS] = { .align = 1, .size = 3, },
[IEEE80211_RADIOTAP_AMPDU_STATUS] = { .align = 4, .size = 8, },
[IEEE80211_RADIOTAP_VHT] = { .align = 2, .size = 12, },
/*
* add more here as they are defined in radiotap.h
*/
};
static const struct ieee80211_radiotap_namespace radiotap_ns = {
.n_bits = ARRAY_SIZE(rtap_namespace_sizes),
.align_size = rtap_namespace_sizes,
};
/**
* ieee80211_radiotap_iterator_init - radiotap parser iterator initialization
* @iterator: radiotap_iterator to initialize
* @radiotap_header: radiotap header to parse
* @max_length: total length we can parse into (eg, whole packet length)
*
* Returns: 0 or a negative error code if there is a problem.
*
* This function initializes an opaque iterator struct which can then
* be passed to ieee80211_radiotap_iterator_next() to visit every radiotap
* argument which is present in the header. It knows about extended
* present headers and handles them.
*
* How to use:
* call __ieee80211_radiotap_iterator_init() to init a semi-opaque iterator
* struct ieee80211_radiotap_iterator (no need to init the struct beforehand)
* checking for a good 0 return code. Then loop calling
* __ieee80211_radiotap_iterator_next()... it returns either 0,
* -ENOENT if there are no more args to parse, or -EINVAL if there is a problem.
* The iterator's @this_arg member points to the start of the argument
* associated with the current argument index that is present, which can be
* found in the iterator's @this_arg_index member. This arg index corresponds
* to the IEEE80211_RADIOTAP_... defines.
*
* Radiotap header length:
* You can find the CPU-endian total radiotap header length in
* iterator->max_length after executing ieee80211_radiotap_iterator_init()
* successfully.
*
* Alignment Gotcha:
* You must take care when dereferencing iterator.this_arg
* for multibyte types... the pointer is not aligned. Use
* get_unaligned((type *)iterator.this_arg) to dereference
* iterator.this_arg for type "type" safely on all arches.
*
* Example code:
* See Documentation/networking/radiotap-headers.txt
*/
int rtw_ieee80211_radiotap_iterator_init(
struct ieee80211_radiotap_iterator *iterator,
struct ieee80211_radiotap_header *radiotap_header,
int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns)
{
/* check the radiotap header can actually be present */
if (max_length < sizeof(struct ieee80211_radiotap_header))
return -EINVAL;
/* Linux only supports version 0 radiotap format */
if (radiotap_header->it_version)
return -EINVAL;
/* sanity check for allowed length and radiotap length field */
if (max_length < get_unaligned_le16(&radiotap_header->it_len))
return -EINVAL;
iterator->_rtheader = radiotap_header;
iterator->_max_length = get_unaligned_le16(&radiotap_header->it_len);
iterator->_arg_index = 0;
iterator->_bitmap_shifter = get_unaligned_le32(&radiotap_header->it_present);
iterator->_arg = (uint8_t *)radiotap_header + sizeof(*radiotap_header);
iterator->_reset_on_ext = 0;
iterator->_next_bitmap = &radiotap_header->it_present;
iterator->_next_bitmap++;
iterator->_vns = vns;
iterator->current_namespace = &radiotap_ns;
iterator->is_radiotap_ns = 1;
/* find payload start allowing for extended bitmap(s) */
if (iterator->_bitmap_shifter & (1<<IEEE80211_RADIOTAP_EXT)) {
if ((unsigned long)iterator->_arg -
(unsigned long)iterator->_rtheader + sizeof(uint32_t) >
(unsigned long)iterator->_max_length)
return -EINVAL;
while (get_unaligned_le32(iterator->_arg) &
(1 << IEEE80211_RADIOTAP_EXT)) {
iterator->_arg += sizeof(uint32_t);
/*
* check for insanity where the present bitmaps
* keep claiming to extend up to or even beyond the
* stated radiotap header length
*/
if ((unsigned long)iterator->_arg -
(unsigned long)iterator->_rtheader +
sizeof(uint32_t) >
(unsigned long)iterator->_max_length)
return -EINVAL;
}
iterator->_arg += sizeof(uint32_t);
/*
* no need to check again for blowing past stated radiotap
* header length, because ieee80211_radiotap_iterator_next
* checks it before it is dereferenced
*/
}
iterator->this_arg = iterator->_arg;
/* we are all initialized happily */
return 0;
}
EXPORT_SYMBOL(rtw_ieee80211_radiotap_iterator_init);
static void find_ns(struct ieee80211_radiotap_iterator *iterator,
uint32_t oui, uint8_t subns)
{
int i;
iterator->current_namespace = NULL;
if (!iterator->_vns)
return;
for (i = 0; i < iterator->_vns->n_ns; i++) {
if (iterator->_vns->ns[i].oui != oui)
continue;
if (iterator->_vns->ns[i].subns != subns)
continue;
iterator->current_namespace = &iterator->_vns->ns[i];
break;
}
}
/**
* ieee80211_radiotap_iterator_next - return next radiotap parser iterator arg
* @iterator: radiotap_iterator to move to next arg (if any)
*
* Returns: 0 if there is an argument to handle,
* -ENOENT if there are no more args or -EINVAL
* if there is something else wrong.
*
* This function provides the next radiotap arg index (IEEE80211_RADIOTAP_*)
* in @this_arg_index and sets @this_arg to point to the
* payload for the field. It takes care of alignment handling and extended
* present fields. @this_arg can be changed by the caller (eg,
* incremented to move inside a compound argument like
* IEEE80211_RADIOTAP_CHANNEL). The args pointed to are in
* little-endian format whatever the endianess of your CPU.
*
* Alignment Gotcha:
* You must take care when dereferencing iterator.this_arg
* for multibyte types... the pointer is not aligned. Use
* get_unaligned((type *)iterator.this_arg) to dereference
* iterator.this_arg for type "type" safely on all arches.
*/
int rtw_ieee80211_radiotap_iterator_next(
struct ieee80211_radiotap_iterator *iterator)
{
while (1) {
int hit = 0;
int pad, align, size, subns;
uint32_t oui;
/* if no more EXT bits, that's it */
if ((iterator->_arg_index % 32) == IEEE80211_RADIOTAP_EXT &&
!(iterator->_bitmap_shifter & 1))
return -ENOENT;
if (!(iterator->_bitmap_shifter & 1))
goto next_entry; /* arg not present */
/* get alignment/size of data */
switch (iterator->_arg_index % 32) {
case IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE:
case IEEE80211_RADIOTAP_EXT:
align = 1;
size = 0;
break;
case IEEE80211_RADIOTAP_VENDOR_NAMESPACE:
align = 2;
size = 6;
break;
default:
if (!iterator->current_namespace ||
iterator->_arg_index >= iterator->current_namespace->n_bits) {
if (iterator->current_namespace == &radiotap_ns)
return -ENOENT;
align = 0;
} else {
align = iterator->current_namespace->align_size[iterator->_arg_index].align;
size = iterator->current_namespace->align_size[iterator->_arg_index].size;
}
if (!align) {
/* skip all subsequent data */
iterator->_arg = iterator->_next_ns_data;
/* give up on this namespace */
iterator->current_namespace = NULL;
goto next_entry;
}
break;
}
/*
* arg is present, account for alignment padding
*
* Note that these alignments are relative to the start
* of the radiotap header. There is no guarantee
* that the radiotap header itself is aligned on any
* kind of boundary.
*
* The above is why get_unaligned() is used to dereference
* multibyte elements from the radiotap area.
*/
pad = ((unsigned long)iterator->_arg -
(unsigned long)iterator->_rtheader) & (align - 1);
if (pad)
iterator->_arg += align - pad;
if (iterator->_arg_index % 32 == IEEE80211_RADIOTAP_VENDOR_NAMESPACE) {
int vnslen;
if ((unsigned long)iterator->_arg + size -
(unsigned long)iterator->_rtheader >
(unsigned long)iterator->_max_length)
return -EINVAL;
oui = (*iterator->_arg << 16) |
(*(iterator->_arg + 1) << 8) |
*(iterator->_arg + 2);
subns = *(iterator->_arg + 3);
find_ns(iterator, oui, subns);
vnslen = get_unaligned_le16(iterator->_arg + 4);
iterator->_next_ns_data = iterator->_arg + size + vnslen;
if (!iterator->current_namespace)
size += vnslen;
}
/*
* this is what we will return to user, but we need to
* move on first so next call has something fresh to test
*/
iterator->this_arg_index = iterator->_arg_index;
iterator->this_arg = iterator->_arg;
iterator->this_arg_size = size;
/* internally move on the size of this arg */
iterator->_arg += size;
/*
* check for insanity where we are given a bitmap that
* claims to have more arg content than the length of the
* radiotap section. We will normally end up equalling this
* max_length on the last arg, never exceeding it.
*/
if ((unsigned long)iterator->_arg -
(unsigned long)iterator->_rtheader >
(unsigned long)iterator->_max_length)
return -EINVAL;
/* these special ones are valid in each bitmap word */
switch (iterator->_arg_index % 32) {
case IEEE80211_RADIOTAP_VENDOR_NAMESPACE:
iterator->_reset_on_ext = 1;
iterator->is_radiotap_ns = 0;
/*
* If parser didn't register this vendor
* namespace with us, allow it to show it
* as 'raw. Do do that, set argument index
* to vendor namespace.
*/
iterator->this_arg_index =
IEEE80211_RADIOTAP_VENDOR_NAMESPACE;
if (!iterator->current_namespace)
hit = 1;
goto next_entry;
case IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE:
iterator->_reset_on_ext = 1;
iterator->current_namespace = &radiotap_ns;
iterator->is_radiotap_ns = 1;
goto next_entry;
case IEEE80211_RADIOTAP_EXT:
/*
* bit 31 was set, there is more
* -- move to next u32 bitmap
*/
iterator->_bitmap_shifter =
get_unaligned_le32(iterator->_next_bitmap);
iterator->_next_bitmap++;
if (iterator->_reset_on_ext)
iterator->_arg_index = 0;
else
iterator->_arg_index++;
iterator->_reset_on_ext = 0;
break;
default:
/* we've got a hit! */
hit = 1;
next_entry:
iterator->_bitmap_shifter >>= 1;
iterator->_arg_index++;
}
/* if we found a valid arg earlier, return it now */
if (hit)
return 0;
}
}
EXPORT_SYMBOL(rtw_ieee80211_radiotap_iterator_next);

View File

@ -184,12 +184,11 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
{USB_DEVICE(0x2001, 0x3316), .driver_info = RTL8812}, /* D-Link - Cameo */
{USB_DEVICE(0x2019, 0xAB30), .driver_info = RTL8812}, /* Planex - Abocom */
{USB_DEVICE(0x20F4, 0x805B), .driver_info = RTL8812}, /* TRENDnet - Cameo */
{USB_DEVICE(0x2357, 0x0101), .driver_info = RTL8812}, /* TP-Link - Archer T4U AC1200 */
{USB_DEVICE(0x2357, 0x0103), .driver_info = RTL8812}, /* TP-Link - T4UH */
{USB_DEVICE(0x2357, 0x0101), .driver_info = RTL8812}, /* TP-Link - Archer T4U */
{USB_DEVICE(0x2357, 0x0103), .driver_info = RTL8812}, /* TP-Link - Archer T4UH */
{USB_DEVICE(0x2357, 0x010D), .driver_info = RTL8812}, /* TP-Link - Archer T4U AC1300 */
{USB_DEVICE(0x2357, 0x010E), .driver_info = RTL8812}, /* TP-Link - Archer T4UH AC1300 */
{USB_DEVICE(0x2357, 0x010F), .driver_info = RTL8812}, /* TP-Link - T4UHP */
{USB_DEVICE(0x2357, 0x0122), .driver_info = RTL8812}, /* TP-Link - T4UHP (other) */
{USB_DEVICE(0x2604, 0x0012), .driver_info = RTL8812}, /* Tenda - U12 */
{USB_DEVICE(0x7392, 0xA812), .driver_info = RTL8812}, /* Edimax - EW-7811UTC */
{USB_DEVICE(0x7392, 0xA822), .driver_info = RTL8812}, /* Edimax - Edimax */
@ -200,27 +199,17 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
{USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0811), .driver_info = RTL8821}, /* Default ID */
{USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0821), .driver_info = RTL8821}, /* Default ID */
{USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8822), .driver_info = RTL8821}, /* Default ID */
{USB_DEVICE(USB_VENDER_ID_REALTEK, 0xA811), .driver_info = RTL8821},/* Default ID */
{USB_DEVICE(USB_VENDER_ID_REALTEK, 0xA811) , .driver_info = RTL8821},/* Default ID */
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0x0820, 0xff, 0xff, 0xff), .driver_info = RTL8821}, /* 8821AU */
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0x0823, 0xff, 0xff, 0xff), .driver_info = RTL8821}, /* 8821AU */
/*=== Customer ID ===*/
{USB_DEVICE(0x7392, 0xA811), .driver_info = RTL8821}, /* Edimax - Edimax */
{USB_DEVICE(0x7392, 0xA812), .driver_info = RTL8821}, /* Edimax - EW-7811UTC */
{USB_DEVICE(0x7392, 0xA813), .driver_info = RTL8821}, /* Edimax - EW-7811UAC */
{USB_DEVICE(0x0BDA, 0xA811), .driver_info = RTL8821}, /* OUTLINK - Edimax */
{USB_DEVICE(0x04BB, 0x0953), .driver_info = RTL8821}, /* I-O DATA - Edimax */
{USB_DEVICE(0x2001, 0x3314), .driver_info = RTL8821}, /* D-Link - Cameo */
{USB_DEVICE(0x2001, 0x3318), .driver_info = RTL8821}, /* D-Link - Cameo */
{USB_DEVICE(0x0E66, 0x0023), .driver_info = RTL8821}, /* HAWKING - Edimax */
{USB_DEVICE(0x056E, 0x400E), .driver_info = RTL8821}, /* ELECOM - ELECOM */
{USB_DEVICE(0x056E, 0x400F), .driver_info = RTL8821}, /* ELECOM - ELECOM */
{USB_DEVICE(0x0846, 0x9052), .driver_info = RTL8821}, /* Netgear - A6100 */
{USB_DEVICE(0x2019, 0xAB32), .driver_info = RTL8821}, /* Planex - GW-450S */
{USB_DEVICE(0x0411, 0x0242), .driver_info = RTL8821}, /* BUFFALO - Edimax */
{USB_DEVICE(0x0411, 0x025D), .driver_info = RTL8821}, /* BUFFALO - WI-U3-866D */
{USB_DEVICE(0x0411, 0x029B), .driver_info = RTL8821}, /* BUFFALO - WI-U2-433DHP */
{USB_DEVICE(0x0BDA, 0xA811), .driver_info = RTL8821}, /* Comfast - CF-915AC, CF-916AC */
{USB_DEVICE(0x056E, 0x4007), .driver_info = RTL8821}, /* Elecom - WDC-433DU2HBK */
{USB_DEVICE(0x056E, 0x400E) , .driver_info = RTL8821}, /* ELECOM - ELECOM */
{USB_DEVICE(0x056E, 0x400F) , .driver_info = RTL8821}, /* ELECOM - ELECOM */
#endif
#ifdef CONFIG_RTL8192E
@ -242,21 +231,13 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
#endif /* CONFIG_RTL8703B */
#ifdef CONFIG_RTL8814A
{USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8813), .driver_info = RTL8814A},
{USB_DEVICE(0x2001, 0x331A), .driver_info = RTL8814A}, /* D-Link - D-Link */
{USB_DEVICE(0x0B05, 0x1817), .driver_info = RTL8814A}, /* ASUS - ASUSTeK */
{USB_DEVICE(0x0B05, 0x1852), .driver_info = RTL8814A}, /* ASUS - ASUSTeK */
{USB_DEVICE(0x0B05, 0x1853), .driver_info = RTL8814A}, /* ASUS - ASUSTeK */
{USB_DEVICE(0x2001, 0x331a), .driver_info = RTL8814A}, /* D-Link - D-Link */
{USB_DEVICE(0x0b05, 0x1817), .driver_info = RTL8814A}, /* ASUS - ASUSTeK */
{USB_DEVICE(0x056E, 0x400B), .driver_info = RTL8814A}, /* ELECOM - ELECOM */
{USB_DEVICE(0x056E, 0x400D), .driver_info = RTL8814A}, /* ELECOM - ELECOM */
{USB_DEVICE(0x7392, 0xA834), .driver_info = RTL8814A}, /* Edimax - Edimax */
{USB_DEVICE(0x7392, 0xA833), .driver_info = RTL8814A}, /* Edimax - AC1750 */
{USB_DEVICE(0x0BDA, 0x8813), .driver_info = RTL8814A}, /* Edimax - EDUP Adapters */
{USB_DEVICE(0x2357, 0x0106), .driver_info = RTL8814A}, /* TP-LINK Archer T9UH */
{USB_DEVICE(0x20F4, 0x809A), .driver_info = RTL8814A}, /* TRENDnet - TRENDnet */
{USB_DEVICE(0x20F4, 0x809B), .driver_info = RTL8814A}, /* TRENDnet TEW-809UB */
{USB_DEVICE(0x0846, 0x9054), .driver_info = RTL8814A}, /* Netgear A7000 */
{USB_DEVICE(0x0E66, 0x0026), .driver_info = RTL8814A}, /* Hawking HW17ACU 1750AC */
#endif /* CONFIG_RTL8814A */
#ifdef CONFIG_RTL8188F

View File

@ -529,7 +529,6 @@ static struct country_code_to_enum_rd *_rtw_regd_find_country(u16 countrycode)
int rtw_regd_init(_adapter *padapter)
{
#ifndef CONFIG_DISABLE_REGD_C
struct wiphy *wiphy = padapter->rtw_wdev->wiphy;
#if 0
@ -548,7 +547,7 @@ int rtw_regd_init(_adapter *padapter)
#endif
_rtw_regd_init_wiphy(NULL, wiphy);
#endif
return 0;
}
#endif /* CONFIG_IOCTL_CFG80211 */

View File

@ -522,9 +522,10 @@ int rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev)
if (pkt) {
if (check_fwstate(pmlmepriv, WIFI_MONITOR_STATE) == _TRUE) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24))
ret = rtw_monitor_xmit_entry((struct sk_buff *)pkt, pnetdev);
rtw_monitor_xmit_entry((struct sk_buff *)pkt, pnetdev);
#endif
} else {
}
else {
rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, pkt->truesize);
ret = _rtw_xmit_entry(pkt, pnetdev);
}