1
0
mirror of https://github.com/aircrack-ng/rtl8812au.git synced 2024-11-22 05:14:35 +00:00

Upload new v5.6.4 driver

This commit is contained in:
kimocoder 2019-05-24 21:43:57 +02:00
parent b41fa340f4
commit 6c1b4a333b
575 changed files with 126775 additions and 210911 deletions

View File

@ -1,6 +1,6 @@
config RTL8821AU
tristate "Realtek 8821A USB WiFi"
config RTL8812AU
tristate "Realtek 8812A USB WiFi"
depends on USB
---help---
Help message of RTL8821AU
Help message of RTL8812AU

911
Makefile

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@ make install
### Notes
Download
```
git clone -b v5.3.4 https://github.com/aircrack-ng/rtl8812au.git
git clone -b v5.6.4 https://github.com/aircrack-ng/rtl8812au.git
cd rtl*
```
Package / Build dependencies (Kali)

248
REALTEK_README.txt Normal file
View File

@ -0,0 +1,248 @@
===============================================================================
Software Package - Component
===============================================================================
1. ReleaseNotes.pdf
2. document/
2.1 Quick_Start_Guide_for_Driver_Compilation_and_Installation.pdf
2.2 Quick_Start_Guide_for_Station_Mode.pdf
2.3 Quick_Start_Guide_for_SoftAP.pdf
2.4 Quick_Start_Guide_for_Bridge.pdf
2.5 Quick_Start_Guide_for_WOW.pdf
2.6 Quick_Start_Guide_for_Adaptivity_and_Carrier_Sensing_Test.pdf
2.7 HowTo_support_more_VidPids.pdf
2.8 HowTo_support_WIFI_certification_test.pdf
2.9 HowTo_enable_the_power_saving_functionality.pdf
2.10 HowTo_enable_driver_to_support_80211d.pdf
2.11 HowTo_enable_and_verify_TDLS_function_in_Wi-Fi_driver.pdf
2.12 How_to_set_driver_debug_log_level.pdf
2.13 How_to_append_vendor_specific_ie_to_driver_management_frames.pdf
2.14 wpa_cli_with_wpa_supplicant.pdf
2.15 Wireless_tools_porting_guide.pdf
2.16 SoftAP_Mode_features.pdf
2.17 linux_dhcp_server_notes.txt
2.18 RTK_P2P_WFD_Programming_guide.pdf
2.19 Realtek_WiFi_concurrent_mode_Introduction.pdf
2.20 Miracast_for_Realtek_WiFi.pdf
2.21 Driver_Configuration_for_RF_Regulatory_Certification.pdf
3. driver/
3.1 rtl8812AU_linux_v5.6.4_33522.20190509.tar.gz
Naming rule: rtlCHIPS_linux_vM.N.P[.H]_sssss.yyyymmdd[_COEX_VER][_beta].tar.gz
where:
CHIPS: supported chips
M: Major version
N: miNor version
P: Patch number
H: Hotfix number
s: SVN number
y: package year
m: package month
d: package day
COEX_VER: Coext version
_beta: beta driver
4. wpa_supplicant_hostapd/
4.1 wpa_supplicant_hostapd-0.8_rtw_r24647.20171025.tar.gz
4.1.1 wpa_supplicant
The tool help the wlan network to communicate under the
protection of WPAPSK mechanism (WPA/WPA2) and add WPS patch
4.1.2 hostapd
4.2 wpa_0_8.conf
Configure file sample for wpa_supplicant-0.8
4.3 rtl_hostapd_2G.conf
4.4 rtl_hostapd_5G.conf
Configure files for Soft-AP mode 2.4G/5G
4.5 p2p_hostapd.conf
Configure file for hostapd for Wi-Fi Direct (P2P)
4.6 wpa_supplicant_8_jb_4.2_rtw_r25670.20171213.tar.gz
wpa_supplicant_8 from Android 4.2 SDK and patched by Realtek
could be used for pure-linux and Android 4.2. Support only cfg80211/nl80211.
4.7 wpa_supplicant_8_kk_4.4_rtw_r25669.20171213.tar.gz
wpa_supplicant_8 from Android 4.4 SDK and patched by Realtek
could be used for pure-linux and Android 4.4. Support only cfg80211/nl80211.
4.8 wpa_supplicant_8_L_5.x_rtw_r24600.20171025.tar.gz
wpa_supplicant_8 from Android 5.x SDK and patched by Realtek
could be used for pure-linux and Android 5.x Support only cfg80211/nl80211.
4.9 wpa_supplicant_8_M_6.x_rtw_r24570.20171025.tar.gz
wpa_supplicant_8 from Android 6.x SDK and patched by Realtek
could be used for pure-linux and Android 6.x. Support only cfg80211/nl80211.
4.10 wpa_supplicant_8_N_7.x_rtw_r24577.20171025.tar.gz
wpa_supplicant_8 from Android 7.x SDK and patched by Realtek
could be used for pure-linux and Android 7.x. Support only cfg80211/nl80211.
4.11 wpa_supplicant_8_O_8.x_rtw_r31832.20190226.tar.gz
wpa_supplicant_8 from Android 8.x SDK and patched by Realtek
could be used for pure-linux and Android 8.x. Support only cfg80211/nl80211.
4.12 wpa_supplicant_8_P_9.x_rtw_r29226.20180827.tar.gz
wpa_supplicant_8 from Android 8.x SDK and patched by Realtek
could be used for pure-linux and Android 9.x. Support only cfg80211/nl80211.
5. wireless_tools/
5.1 wireless_tools.30.rtl.tar.gz
6. WiFi_Direct_User_Interface/
6.1 p2p_api_test_linux.c
6.2 p2p_ui_test_linux.c
6.3 p2p_test.h
6.4 Start_Guide_P2P_User_Interface_Linux.pdf
7. android_ref_codes_JB_4.2
7.1 linux-3.0.42_STATION_INFO_ASSOC_REQ_IES.diff
Kernel patch file for cfg80211's STATION_INFO_ASSOC_REQ_IES event for kernel 3.0.
7.2 realtek_wifi_SDK_for_android_JB_4.2_20130208.tar.gz
This tar ball includes our android wifi reference codes for Android 4.2
7.3 Realtek_Wi-Fi_SDK_for_Android_JB_4.2.pdf
Guide for porting Realtek wifi onto your Android 4.2 system
8. android_ref_codes_KK_4.4
8.1 linux-3.0.42_STATION_INFO_ASSOC_REQ_IES.diff
Kernel patch file for cfg80211's STATION_INFO_ASSOC_REQ_IES event for kernel 3.0.
8.2 realtek_wifi_SDK_for_android_KK_4.4_20140117.tar.gz
This tar ball includes our android wifi reference codes for Android 4.4
8.3 Realtek_Wi-Fi_SDK_for_Android_KK_4.4.pdf
Guide for porting Realtek wifi onto your Android 4.4 system
9. android_ref_codes_L_5.x
9.1 linux-3.0.42_STATION_INFO_ASSOC_REQ_IES.diff
Kernel patch file for cfg80211's STATION_INFO_ASSOC_REQ_IES event for kernel 3.0.
9.2 realtek_wifi_SDK_for_android_L_5.x_20150811.tgz
This tar ball includes our android wifi reference codes for Android 5.x
9.3 Realtek_Wi-Fi_SDK_for_Android_L_5.x.pdf
Guide for porting Realtek wifi onto your Android 5.x system
10. android_ref_codes_M_6.x
10.1 linux-3.0.42_STATION_INFO_ASSOC_REQ_IES.diff
Kernel patch file for cfg80211's STATION_INFO_ASSOC_REQ_IES event for kernel 3.0.
10.2 realtek_wifi_SDK_for_android_L_6.x_20151116.tgz
This tar ball includes our android wifi reference codes for Android 6.x
10.3 Realtek_Wi-Fi_SDK_for_Android_M_6.x.pdf
Guide for porting Realtek wifi onto your Android 6.x system
11. android_ref_codes_M_7.0
11.1 linux-3.0.42_STATION_INFO_ASSOC_REQ_IES.diff
Kernel patch file for cfg80211's STATION_INFO_ASSOC_REQ_IES event for kernel 3.0.
11.2 realtek_wifi_SDK_for_android_N_7.0_20161024.zip
This tar ball includes our android wifi reference codes for Android 7.0
11.3 Realtek_Wi-Fi_SDK_for_Android_N_7.0.pdf
Guide for porting Realtek wifi onto your Android 7.0 system
12. android_ref_codes_O_8.0
12.1 linux-3.0.42_STATION_INFO_ASSOC_REQ_IES.diff
Kernel patch file for cfg80211's STATION_INFO_ASSOC_REQ_IES event for kernel 3.0.
12.2 realtek_wifi_SDK_for_android_O_8.0_20181001.tar.gz
This tar ball includes our android wifi reference codes for Android 8.0
12.3 Realtek_Wi-Fi_SDK_for_Android_O_8.0.pdf
Guide for porting Realtek wifi onto your Android 8.0 system
13. android_ref_codes_P_9.x
13.1 linux-3.0.42_STATION_INFO_ASSOC_REQ_IES.diff
Kernel patch file for cfg80211's STATION_INFO_ASSOC_REQ_IES event for kernel 3.0.
13.2 realtek_wifi_SDK_for_android_P_9.x_20180813.tar.gz
This tar ball includes our android wifi reference codes for Android 9.x
13.3 Realtek_Wi-Fi_SDK_for_Android_P_9.x.pdf
Guide for porting Realtek wifi onto your Android 9.x system
13. install.sh
Script to compile and install WiFi driver easily in PC-Linux
==================================================================================================================
User Guide for Driver compilation and installation
==================================================================================================================
(*) Please refer to document/Quick_Start_Guide_for_Driver_Compilation_and_Installation.pdf
==================================================================================================================
User Guide for Station mode
==================================================================================================================
(*) Please refer to document/Quick_Start_Guide_for_Station_Mode.pdf
==================================================================================================================
User Guide for Soft-AP mode
==================================================================================================================
(*) Please refer to document/Quick_Start_Guide_for_SoftAP.pdf
(*) Please use wpa_supplicant_hostapd-0.8_rtw_r24647.20171025.tar.gz
(*) Please refer to document/linux_dhcp_server_notes.txt
==================================================================================================================
User Guide for Wi-Fi Direct
==================================================================================================================
Realtek Legacy Wi-Fi Direct:
(*) Please refer to document/RTK_P2P_WFD_Programming_guide.pdf
(*) Please use wpa_supplicant_hostapd-0.8_rtw_r24647.20171025.tar.gz
(*) Please refer to document/linux_dhcp_server_notes.txt
(*) Please refer to WiFi_Direct_User_Interface/
Wi-Fi Direct with nl80211
(*) Please use:
or
wpa_supplicant_8_jb_4.2_rtw_r25670.20171213.tar.gz
or
wpa_supplicant_8_kk_4.4_rtw_r25669.20171213.tar.gz
or
wpa_supplicant_8_L_5.x_rtw_r24600.20171025.tar.gz
or
wpa_supplicant_8_M_6.x_rtw_r24570.20171025.tar.gz
or
wpa_supplicant_8_N_7.x_rtw_r24577.20171025.tar.gz
or
wpa_supplicant_8_O_8.x_rtw_r33457.20190507.tar.gz
or
wpa_supplicant_8_P_9.x_rtw_r29226.20180827.tar.gz
(*) For P2P instruction/command, please refer to:
README-P2P inside the wpa_supplicant folder of the wpa_supplicant_8 you choose
(*) For DHCP server, please refer to:
document/linux_dhcp_server_notes.txt
==================================================================================================================
User Guide for WPS2.0
==================================================================================================================
(*) Please use:
wpa_supplicant_hostapd-0.8_rtw_r24647.20171025.tar.gz
or
wpa_supplicant_8_jb_4.2_rtw_r25670.20171213.tar.gz
or
wpa_supplicant_8_kk_4.4_rtw_r25669.20171213.tar.gz
or
wpa_supplicant_8_L_5.x_rtw_r24600.20171025.tar.gz
or
wpa_supplicant_8_M_6.x_rtw_r24570.20171025.tar.gz
or
wpa_supplicant_8_N_7.x_rtw_r24577.20171025.tar.gz
or
wpa_supplicant_8_O_8.x_rtw_r33457.20190507.tar.gz
or
wpa_supplicant_8_P_9.x_rtw_r29226.20180827.tar.gz
(*) For WPS instruction/command, please refert to:
README-WPS inside the wpa_supplicant folder of the wpa_supplicant_8 you choose
==================================================================================================================
User Guide for Power Saving Mode
==================================================================================================================
(*) Please refer to document/HowTo_enable_the_power_saving_functionality.pdf
==================================================================================================================
User Guide for Applying Wi-Fi solution onto Andriod System
==================================================================================================================
(*) For Android 1.6 ~ 2.3, 4.0, 4.1, 4.3, please contact us for further information
(*) For Android 4.2, please refer to android_ref_codes_JB_4.2/Realtek_Wi-Fi_SDK_for_Android_JB_4.2.pdf
(*) For Android 4.4, please refer to android_ref_codes_KK_4.4/Realtek_Wi-Fi_SDK_for_Android_KK_4.4.pdf
(*) For Android 5.X, please refer to android_ref_codes_L_5.x/Realtek_Wi-Fi_SDK_for_Android_L_5.x.pdf
(*) For Android 6.X, please refer to android_ref_codes_M_6.x/Realtek_Wi-Fi_SDK_for_Android_M_6.x.pdf
(*) For Android 7.X, please refer to android_ref_codes_N_7.0/Realtek_Wi-Fi_SDK_for_Android_N_7.0.pdf
(*) For Android 8.X, please refer to android_ref_codes_O_8.0/Realtek_Wi-Fi_SDK_for_Android_O_8.0.pdf
(*) For Android 9.X, please refer to android_ref_codes_P_9.x/Realtek_Wi-Fi_SDK_for_Android_P_9.x.pdf

View File

@ -1,123 +0,0 @@
Product: RTL8812A USB Software Package - Linux Driver
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
Update FW to v52.10
Correct DFS master function
Fixed WPA2 vulnerability - key reinstallation attacks(KRACKs)(update)
v5.2.9.3_24903.20171101
Fixed WPA2 vulnerability - key reinstallation attacks(KRACKs)
v5.2.9.2_24491.20171027
Remove test code
Fix crash for BF function
Fix wrong memory accesse
Fix encrypt broadcast packet fail
Fix crash for TDLS
v5.2.9.1_24461.20171018
(Do not use)
v5.2.9_22809.20170621
Update FW to v52.2
Update PHYDM setting
Support PNO
Fix WOW issue
Fix efuse issue
Sync channel plan document
Fix DFS issue
Support NAPI & GRO
Enable Power by rate
Fix MP power tracking issue
Fix potential memory out of range
Support CE-RED. 2G: ETSI v2.1.1 / 5G: ETSI v2.1.0
v5.1.5_19247.20160830
Update FW to v49
Update PHY parameters v57
Support TDLS
Enable GTK offload under WOW
Fix no scan results after resume
Fix NDPA issue under scan
Fix dynamic watchdog don't work
v4.3.20_16317.20160108
Disable CONFIG_WIFI_TEST & CONFIG_WOWLAN in Makefile default
v4.3.20_16317.20151231
Fix STBC issue
Fix NDPA sounding issue
Fix r/w rf register racing issue
Fix kernel panic for BT & timer
Fix memory leak for cmd thread
Fix ADDBA flow
Support Power limit
Support USB mode switch
Support Linux Kernel 4.2
Update FW to v41
Update PHY parameters to v55
v4.3.13_14061.20150505
Update FW
Update Phy parameters
Support WOWLAN GTK offload
Support Adaptivity
Support 1T2R
Support 8812AU-VN
Fix scan timeout issue
Fix RFE type error
Fix Spur Calibration flow
Fix some 802.11 logo issue
Fix some crash issues
v4.3.8_12175.20140912
Update PHY parameters to improve throughput
Update FW
Support PMF
Support WoWLAN
Modify channel plan
Fix MP issue
v4.3.2_11100.20140411
Fix p2p issues
Improve throughput
Update FW
v4.2.3_8123.20130705
Update PHY parameters to improve throughput
v4.2.2_7502.20130517
Support 11AC for STA
v4.2.0_7054.20130328
Fix LED behavior
v4.2.0_6952.20130315
First release

BIN
ReleaseNotes.pdf Normal file

Binary file not shown.

View File

@ -0,0 +1,11 @@
ifneq ($(TARGET_SIMULATOR),true)
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES += p2p_api_test_linux.c p2p_ui_test_linux.c
LOCAL_SHARED_LIBRARIES := libc libcutils
LOCAL_MODULE = P2P_UI
LOCAL_MODULE_TAGS := optional
include $(BUILD_EXECUTABLE)
endif

View File

@ -0,0 +1,101 @@
wpa_supplicant_hostapd=`ls -1 ../wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8_*`
echo $wpa_supplicant_hostapd
if [ -e $wpa_supplicant_hostapd ]; then
echo "Checking wpa_supplicant_hostatpd"
else
echo "wpa_supplicant_hostapd doesn'tt exist in corresponding folder"
exit
fi
if [ -e ../wpa_supplicant_hostapd/p2p_hostapd.conf ]; then
echo "Checking p2p_hostapd.conf"
else
echo "p2p_hostapd.conf doesn't exist in corresponding folder"
exit
fi
if [ -e ../wpa_supplicant_hostapd/wpa_0_8.conf ]; then
echo "Checking wpa_0_8.conf"
else
echo "wpa_0_8.conf doesn't exist in corresponding folder"
exit
fi
#cp ../wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8_rtw_20111118.zip ./
cp $wpa_supplicant_hostapd ./
wpa_supplicant_hostapd=`ls -1 ./wpa_supplicant_hostapd-0.8_*`
echo " "$wpa_supplicant_hostapd
unzip $wpa_supplicant_hostapd
cd wpa_supplicant_hostapd-0.8
cd wpa_supplicant
make clean all
cd ..
cd hostapd
make clean all
cd ..
cd ..
cp ../wpa_supplicant_hostapd/p2p_hostapd.conf ./
cp ../wpa_supplicant_hostapd/wpa_0_8.conf ./
cp ./wpa_supplicant_hostapd-0.8/hostapd/hostapd ./
cp ./wpa_supplicant_hostapd-0.8/hostapd/hostapd_cli ./
cp ./wpa_supplicant_hostapd-0.8/wpa_supplicant/wpa_supplicant ./
cp ./wpa_supplicant_hostapd-0.8/wpa_supplicant/wpa_cli ./
rm -rf wpa_supplicant_hostapd-0.8
rm -rf $wpa_supplicant_hostapd
gcc -o P2P_UI ./p2p_api_test_linux.c ./p2p_ui_test_linux.c -lpthread
if [ ! -e ./p2p_hostapd.conf ]; then
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
echo "Doesn't have p2p_hostapd.conf"
result="fail"
fi
if [ ! -e ./wpa_0_8.conf ]; then
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
echo "Doesn't have wpa_0_8.conf"
result="fail"
fi
if [ ! -e ./hostapd ]; then
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
echo "Doesn't have hostapd"
result="fail"
fi
if [ ! -e ./wpa_supplicant ]; then
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
echo "Doesn't have hostapd_cli"
result="fail"
fi
if [ ! -e ./wpa_cli ]; then
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
echo "Doesn't have p2p_hostapd.conf"
result="fail"
fi
if [ ! -e ./P2P_UI ]; then
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
echo "Doesn't have P2P_UI"
result="fail"
fi
if [ "$result" == "fail" ]; then
echo "WiFi_Direct_User_Interface install unsuccessful"
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
exit
fi
echo "##################################################"
echo "WiFi_Direct_User_Interface install complete!!!!!!!"
echo "##################################################"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,167 @@
#ifndef _P2P_UI_TEST_H_
#define _P2P_UI_TEST_H_
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#define P2P_AUTO 1
//#define DHCP 1
#define CMD_SZ 100
#define SSID_SZ 32
#define SEC 1000000
#define SCAN_POOL_NO 8
#define NEGO_RETRY_INTERVAL 10 * SEC
#define NEGO_QUERY_INTERVAL 0.5 * SEC
#define PRE_NEGO_INTERVAL 0.5 * SEC
#define MAX_PROV_RETRY 15
#define PROV_RETRY_INTERVAL 5
#define PROV_WAIT_TIME 1 * SEC
#define MAX_NEGO_RETRY 60
#define NEGO_WAIT_TIME 0.5 * SEC
#define WPS_RETRY 120
#define SUPPLICANT_INIT_TIME 1 * SEC
#define HOSTAPD_INIT_TIME 1 * SEC
#define SUPPLICANT_INTERVAL 1 * SEC
#define HOSTAPD_INTERVAL 1 * SEC
#define POLLING_INTERVAL 1 * SEC
#define _TRUE 1
#define _FALSE 0
#define WPS_CONFIG_METHOD_LABEL 0x0004
#define WPS_CONFIG_METHOD_DISPLAY 0x0008
#define WPS_CONFIG_METHOD_E_NFC 0x0010
#define WPS_CONFIG_METHOD_I_NFC 0x0020
#define WPS_CONFIG_METHOD_NFC 0x0040
#define WPS_CONFIG_METHOD_PBC 0x0080
#define WPS_CONFIG_METHOD_KEYPAD 0x0100
#define WPS_CONFIG_METHOD_VPBC 0x0280
#define WPS_CONFIG_METHOD_PPBC 0x0480
#define WPS_CONFIG_METHOD_VDISPLAY 0x2008
#define WPS_CONFIG_METHOD_PDISPLAY 0x4008
enum thread_trigger{
THREAD_NONE = 0,
THREAD_DEVICE = 1,
THREAD_GO = 2,
};
enum P2P_ROLE {
P2P_ROLE_DISABLE = 0,
P2P_ROLE_DEVICE = 1,
P2P_ROLE_CLIENT = 2,
P2P_ROLE_GO = 3
};
enum P2P_STATE {
P2P_STATE_NONE = 0, // P2P disable
P2P_STATE_IDLE = 1, // P2P had enabled and do nothing
P2P_STATE_LISTEN = 2, // In pure listen state
P2P_STATE_SCAN = 3, // In scan phase
P2P_STATE_FIND_PHASE_LISTEN = 4, // In the listen state of find phase
P2P_STATE_FIND_PHASE_SEARCH = 5, // In the search state of find phase
P2P_STATE_TX_PROVISION_DIS_REQ = 6, // In P2P provisioning discovery
P2P_STATE_RX_PROVISION_DIS_RSP = 7,
P2P_STATE_RX_PROVISION_DIS_REQ = 8,
P2P_STATE_GONEGO_ING = 9, // Doing the group owner negoitation handshake
P2P_STATE_GONEGO_OK = 10, // finish the group negoitation handshake with success
P2P_STATE_GONEGO_FAIL = 11, // finish the group negoitation handshake with failure
P2P_STATE_RECV_INVITE_REQ = 12, // receiving the P2P Inviation request
P2P_STATE_PROVISIONING_ING = 13, // Doing the P2P WPS
P2P_STATE_PROVISIONING_DONE = 14, // Finish the P2P WPS
};
enum P2P_WPSINFO {
P2P_NO_WPSINFO = 0,
P2P_GOT_WPSINFO_PEER_DISPLAY_PIN = 1,
P2P_GOT_WPSINFO_SELF_DISPLAY_PIN = 2,
P2P_GOT_WPSINFO_PBC = 3,
};
struct scan{
char addr[18];
int go;
};
struct p2p{
char ifname[10];
int enable;
int status;
char dev_name[33];
int intent;
int listen_ch;
int wps_info;
int wpsing;
unsigned int pin;
int role;
char peer_devaddr[18];
int p2p_get; //p2p_get==1 : print messages from ioctl p2p_get
char print_line[CMD_SZ];
int have_p2p_dev; //have_p2p_dev==1 : after scanning p2p device
int show_scan_result;
int count_line;
char peer_ifaddr[18];
char cmd[CMD_SZ];
char parse[CMD_SZ];
char apd_ssid[SSID_SZ];
int op_ch; //operation channel
int wpa_open;
int ap_open;
char ap_conf[CMD_SZ];
char ap_path[CMD_SZ];
char apcli_path[CMD_SZ];
char wpa_conf[CMD_SZ];
char wpa_path[CMD_SZ];
char wpacli_path[CMD_SZ];
char ok_msg[CMD_SZ];
char redo_msg[CMD_SZ];
char fail_msg[CMD_SZ];
char nego_msg[CMD_SZ];
char scan_msg[CMD_SZ];
int thread_trigger;
pthread_t pthread;
pthread_t pthread_go;
int res; //check if thread is created; 1: disabled, 0: enabled
int res_go; //created if p2p device becomes GO
struct scan scan_pool[SCAN_POOL_NO];
int connect_go;
int no_sta_connected;
};
void ui_screen(struct p2p *p);
char *naming_wpsinfo(int wps_info);
char *naming_role(int role);
char *naming_status(int status);
unsigned int wps_pin_checksum(unsigned int pin);
void p2p_enable(struct p2p *p);
void p2p_scan(struct p2p *p);
void scan_result(struct p2p *p);
void p2p_intent(struct p2p *p);
void p2p_pincode(struct p2p *p, char *ins_no, char *ins_no_again);
void p2p_devaddr(struct p2p *p);
void p2p_role(struct p2p *p, int flag);
void p2p_status(struct p2p *p, int flag);
void p2p_prov_disc_no_addr(struct p2p *p, char *msg);
void p2p_prov_disc(struct p2p *p, char *msg, char *dis_msg, char *label_msg);
void p2p_set_nego(struct p2p *p);
void p2p_ifaddr(struct p2p *p);
void p2p_client_mode(struct p2p *p);
void p2p_go_mode(struct p2p *p);
void p2p_get_hostapd_conf(struct p2p *p);
void p2p_set_opch(struct p2p *p, char *msg, int print);
void p2p_softap_ssid(struct p2p *p, char *msg, int print);
void p2p_listen_ch(struct p2p *p, char *msg);
void p2p_peer_devaddr(struct p2p *p, char *peer_devaddr);
void p2p_peer_req_cm(struct p2p *p, char *peer_req_cm);
void p2p_peer_info(struct p2p *p, char *peer_devaddr, char *peer_req_cm);
void p2p_wps_cm(struct p2p *p, char *scan_addr, char *cms);
void p2p_device_name(struct p2p *p, char *scan_addr, char *dns);
void p2p_setDN(struct p2p *p);
void *polling_status(void *arg);
void *polling_client(void *arg);
void *print_status(void *arg);
#endif //_P2P_UI_TEST_H_

View File

@ -0,0 +1,536 @@
#include "p2p_test.h"
char *naming_wpsinfo(int wps_info)
{
switch(wps_info)
{
case P2P_NO_WPSINFO: return ("P2P_NO_WPSINFO");
case P2P_GOT_WPSINFO_PEER_DISPLAY_PIN: return ("P2P_GOT_WPSINFO_PEER_DISPLAY_PIN");
case P2P_GOT_WPSINFO_SELF_DISPLAY_PIN: return ("P2P_GOT_WPSINFO_SELF_DISPLAY_PIN");
case P2P_GOT_WPSINFO_PBC: return ("P2P_GOT_WPSINFO_PBC");
default: return ("UI unknown failed");
}
}
char *naming_role(int role)
{
switch(role)
{
case P2P_ROLE_DISABLE: return ("P2P_ROLE_DISABLE");
case P2P_ROLE_DEVICE: return ("P2P_ROLE_DEVICE");
case P2P_ROLE_CLIENT: return ("P2P_ROLE_CLIENT");
case P2P_ROLE_GO: return ("P2P_ROLE_GO");
default: return ("UI unknown failed");
}
}
char *naming_status(int status)
{
switch(status)
{
case P2P_STATE_NONE: return ("P2P_STATE_NONE");
case P2P_STATE_IDLE: return ("P2P_STATE_IDLE");
case P2P_STATE_LISTEN: return ("P2P_STATE_LISTEN");
case P2P_STATE_SCAN: return ("P2P_STATE_SCAN");
case P2P_STATE_FIND_PHASE_LISTEN: return ("P2P_STATE_FIND_PHASE_LISTEN");
case P2P_STATE_FIND_PHASE_SEARCH: return ("P2P_STATE_FIND_PHASE_SEARCH");
case P2P_STATE_TX_PROVISION_DIS_REQ: return ("P2P_STATE_TX_PROVISION_DIS_REQ");
case P2P_STATE_RX_PROVISION_DIS_RSP: return ("P2P_STATE_RX_PROVISION_DIS_RSP");
case P2P_STATE_RX_PROVISION_DIS_REQ: return ("P2P_STATE_RX_PROVISION_DIS_REQ");
case P2P_STATE_GONEGO_ING: return ("P2P_STATE_GONEGO_ING");
case P2P_STATE_GONEGO_OK: return ("P2P_STATE_GONEGO_OK");
case P2P_STATE_GONEGO_FAIL: return ("P2P_STATE_GONEGO_FAIL");
case P2P_STATE_RECV_INVITE_REQ: return ("P2P_STATE_RECV_INVITE_REQ");
case P2P_STATE_PROVISIONING_ING: return ("P2P_STATE_PROVISIONING_ING");
case P2P_STATE_PROVISIONING_DONE: return ("P2P_STATE_PROVISIONING_DONE");
default: return ("UI unknown failed");
}
}
char* naming_enable(int enable)
{
switch(enable)
{
case P2P_ROLE_DISABLE: return ("[Disabled]");
case P2P_ROLE_DEVICE: return ("[Enable/Device]");
case P2P_ROLE_CLIENT: return ("[Enable/Client]");
case P2P_ROLE_GO: return ("[Enable/GO]");
default: return ("UI unknown failed");
}
}
void ui_screen(struct p2p *p)
{
system("clear");
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
printf("****************************************************************************************************\n");
printf("* P2P UI TEST v0.5 *\n");
printf("****************************************************************************************************\n");
printf("* Enable: %-89s*\n", naming_enable(p->enable));
printf("* Intent: %2d *\n", p->intent);
printf("* Status: %-89s*\n", naming_status(p->status));
printf("* Role: %-91s*\n", naming_role(p->role));
printf("* WPS method: %-85s*\n", naming_wpsinfo(p->wps_info));
printf("* PIN code: %08d *\n", p->pin);
printf("* Device name: %-84s*\n", p->dev_name);
printf("* Peer device address: %-76s*\n", p->peer_devaddr);
printf("* Peer interface address: %-73s*\n", p->peer_ifaddr);
printf("* *\n");
printf("* e) Wi-Fi Direct Enable/Disable *\n");
printf("* i) Intent ( The degree to be Group Owner/SoftAP ) *\n");
printf("* a) Scan Wi-Fi Direct devices *\n");
printf("* m) Peer device address you want to test *\n");
printf("* p) Provision discovery *\n");
printf("* c) Input PIN codes *\n");
printf("* w) WPS method *\n");
printf("* n) Group owner negotiation *\n");
printf("* x) Start wpa_supplicant/hostapd *\n");
printf("* h) Set operation channel | t) Set SoftAP ssid *\n");
printf("* r) Get Current P2P Role | s) Get Current P2P Status *\n");
printf("* d) Set device name | l) Set Listen channel *\n");
printf("* f) Reflash Current State | q) Quit *\n");
printf("****************************************************************************************************\n");
if(p->p2p_get==0)
{
printf("* *\n");
}
else if(p->p2p_get==1)
{
printf("*%-98s*\n", p->print_line);
}
printf("****************************************************************************************************\n");
if( ( p->show_scan_result == 1 ) && ( p->have_p2p_dev == 1 ) )
//if( (p->have_p2p_dev == 1) && (p->enable >= P2P_ROLE_DEVICE) && ( p->wpsing == 0 ) && (p->status >= P2P_STATE_LISTEN && p->status <= P2P_STATE_FIND_PHASE_SEARCH) )
{
scan_result(p);
}
else
{
int i=0;
for(i = 0; i < SCAN_POOL_NO + 1; i++ )
printf("* *\n");
}
printf("****************************************************************************************************\n");
p->show_scan_result = 0;
}
void init_p2p(struct p2p *p)
{
strcpy( p->ifname, "wlan0" );
p->enable = P2P_ROLE_DISABLE;
p->res = 1;
p->res_go = 1;
p->status = P2P_STATE_NONE;
p->intent = 1;
p->wps_info = 0;
p->wpsing = 0;
p->pin = 12345670;
p->role = P2P_ROLE_DISABLE;
p->listen_ch = 11;
strcpy( p->peer_devaddr, "00:00:00:00:00:00" );
p->p2p_get = 0;
memset( p->print_line, 0x00, CMD_SZ);
p->have_p2p_dev = 0;
p->count_line = 0;
strcpy( p->peer_ifaddr, "00:00:00:00:00:00" );
memset( p->cmd, 0x00, CMD_SZ);
p->wpa_open=0;
p->ap_open=0;
strcpy(p->ok_msg, "WiFi Direct handshake done" );
strcpy(p->redo_msg, "Re-do GO handshake" );
strcpy(p->fail_msg, "GO handshake unsuccessful" );
strcpy(p->nego_msg, "Start P2P negotiation" );
strcpy(p->wpa_conf, "./wpa_0_8.conf" );
strcpy(p->wpa_path, "./wpa_supplicant" );
strcpy(p->wpacli_path, "./wpa_cli" );
strcpy(p->ap_conf, "./p2p_hostapd.conf" );
strcpy(p->ap_path, "./hostapd" );
strcpy(p->apcli_path, "./hostapd_cli" );
strcpy(p->scan_msg, "Device haven't enable p2p functionalities" );
}
void rename_intf(struct p2p *p)
{
FILE *pfin = NULL;
FILE *pfout = NULL;
pfin = fopen( p->ap_conf, "r" );
pfout = fopen( "./p2p_hostapd_temp.conf", "w" );
if ( pfin )
{
while( !feof( pfin ) ){
memset(p->parse, 0x00, CMD_SZ);
fgets(p->parse, CMD_SZ, pfin);
if(strncmp(p->parse, "interface=", 10) == 0)
{
memset(p->parse, 0x00, CMD_SZ);
sprintf( p->parse, "interface=%s\n", p->ifname );
fputs( p->parse, pfout );
}
else
fputs(p->parse, pfout);
}
}
fclose( pfout );
system( "rm -rf ./p2p_hostapd.conf" );
system( "mv ./p2p_hostapd_temp.conf ./p2p_hostapd.conf" );
return;
}
//int main()
int main(int argc, char **argv)
{
char peerifa[40] = { 0x00 };
char scan[CMD_SZ];
struct p2p p2pstruct;
struct p2p *p=NULL;
p = &p2pstruct;
if( p != NULL)
{
memset(p, 0x00, sizeof(struct p2p));
init_p2p(p);
}
strcpy(p->ifname, argv[1] );
/* Disable P2P functionalities at first*/
p->enable=P2P_ROLE_DISABLE;
p2p_enable(p);
p2p_get_hostapd_conf(p);
usleep(50000);
rename_intf(p);
do
{
ui_screen(p);
printf("*insert cmd:");
memset( scan, 0x00, CMD_SZ );
scanf("%s", scan);
if( p->thread_trigger == THREAD_NONE ) //Active mode for user interface
{
if( strncmp(scan, "e", 1) == 0 ) //Enable
{
p->show_scan_result = 1;
ui_screen(p);
printf("Please insert enable mode;[0]Disable, [1]Device, [2]Client, [3]GO:");
scanf("%d",&p->enable);
p2p_enable(p);
p->show_scan_result = 1;
}
else if( strncmp(scan, "a", 1) == 0 ) // Scan P2P device
{
p2p_scan(p);
p->show_scan_result = 1;
}
else if( strncmp(scan, "d", 1) == 0 ) // Set device name
{
p->p2p_get = 0;
printf("Please insert device name :");
scanf("\n%[^\n]", p->dev_name);
p2p_setDN(p);
p->show_scan_result = 1;
}
else if( strncmp(scan, "i", 1) == 0 ) // Intent
{
p->show_scan_result = 1;
ui_screen(p);
printf("Please insert intent from [0~15(must be softap)] :");
scanf("%d",&p->intent);
p2p_intent(p);
p->show_scan_result = 1;
}
else if( strncmp(scan, "w", 1) == 0 ) // WPS_info
{
p->show_scan_result = 1;
ui_screen(p);
printf("Please insert WPS method\n");
printf("[0]None, [1]Peer Display PIN, [2]Self Display Pin, [3]PBC :");
scanf("%d",&p->wps_info);
p2p_wpsinfo(p);
p->show_scan_result = 1;
}
else if( strncmp(scan, "c", 1) == 0 ) // PIN_code
{
char ins_no[CMD_SZ], ins_no_again[CMD_SZ];
memset(ins_no, 0x00, CMD_SZ);
strcpy(ins_no, "Please insert 8-digit number, eg:12345670 :" );
memset(ins_no_again, 0x00, CMD_SZ);
strcpy(ins_no_again, "Invalid number, insert again, eg:12345670 :" );
p2p_pincode(p, ins_no, ins_no_again);
p->show_scan_result = 1;
}
else if( strncmp(scan, "m", 1) == 0 ) // Set peer device address
{
p->show_scan_result = 1;
ui_screen(p);
printf("Please insert number in scan list:");
p2p_devaddr(p);
p->show_scan_result = 1;
}
else if( strncmp(scan, "r", 1) == 0 ) // Get role
{
p2p_role(p,1);
p->show_scan_result = 1;
}
else if( strncmp(scan, "s", 1) == 0 ) // Get status
{
p2p_status(p, 1);
p->show_scan_result = 1;
}
else if( strncmp(scan, "p", 1) == 0 ) // Provision discovery
{
char msg[CMD_SZ];
memset( msg, 0x00, CMD_SZ );
char dis_msg[CMD_SZ];
memset( dis_msg, 0x00, CMD_SZ );
char label_msg[CMD_SZ];
memset( label_msg, 0x00, CMD_SZ );
if(strncmp(p->peer_devaddr, "00:00:00:00:00:00", 17) == 0)
{
strcpy( msg, "Please insert peer P2P device at first" );
p2p_prov_disc_no_addr(p, msg);
p->show_scan_result = 1;
}
else
{
strcpy( msg, "Please insert WPS configuration method ;[0]display, [1]keypad, [2]pbc, [3]label:\n" );
strcpy( dis_msg, "Please insert PIN code displays on peer device screen:" );
strcpy( label_msg, "Please insert PIN code displays on peer label:" );
p2p_prov_disc(p, msg, dis_msg, label_msg);
}
}
else if( strncmp(scan, "n", 1) == 0 ) // Set negotiation
{
p2p_set_nego(p);
}
else if( strncmp(scan, "f", 1) == 0 ) // Reflash current state
{
p->show_scan_result = 1;
p2p_status(p, 0);
p2p_role(p, 0);
p2p_ifaddr(p);
if( p->status == P2P_STATE_RX_PROVISION_DIS_REQ )
{
char peer_devaddr[18];
char peer_req_cm[4];
memset( peer_devaddr, 0x00, 18);
memset( peer_req_cm, 0x00, 4);
p2p_peer_devaddr(p, peer_devaddr);
p2p_peer_req_cm(p, peer_req_cm);
p2p_peer_info(p, p->peer_devaddr, peer_req_cm);
}
#ifndef P2P_AUTO
else
{
if( p->role == P2P_ROLE_CLIENT )
{
p2p_client_mode(p);
}
else if( p->role == P2P_ROLE_GO )
{
p2p_go_mode(p);
}
}
#endif //P2P_AUTO
}
else if( strncmp(scan, "x", 1) == 0 ) // Start wpa_supplicant/hostapd
{
if( p->role == P2P_ROLE_CLIENT )
{
p2p_client_mode(p);
}
else if( p->role == P2P_ROLE_GO )
{
p2p_go_mode(p);
}
}
else if( strncmp(scan, "h", 1) == 0 ) // Set operation channel
{
char msg[CMD_SZ];
memset( msg, 0x00, CMD_SZ );
strcpy( msg, "Please insert desired operation channel:" );
p2p_set_opch(p, msg, 1);
p->show_scan_result = 1;
}
else if( strncmp(scan, "t", 1) == 0 ) // Set SoftAP ssid
{
char msg[CMD_SZ];
memset( msg, 0x00, CMD_SZ );
strcpy( msg, "Please insert desired SoftAP ssid:" );
p2p_softap_ssid(p, msg, 1);
p->show_scan_result = 1;
}
else if( strncmp(scan, "l", 1) == 0 ) // Set Listen channel
{
char msg[CMD_SZ];
memset( msg, 0x00, CMD_SZ );
strcpy( msg, "Please insert desired Listen channel, only ch.1.6.11 are available:" );
p2p_listen_ch(p, msg);
p->show_scan_result = 1;
}
else if( strncmp(scan, "q", 1) == 0 ) // Quit
{
if( p->res == 0 )
p->res = 1;
if( p->res_go == 0 )
p->res_go = 1;
break;
}
else // Insert wrong commamd
{
p->p2p_get=1;
p->show_scan_result = 1;
memset( p->print_line, 0x00, CMD_SZ );
sprintf( p->print_line, " BAD argument");
}
}
else if( p->thread_trigger == THREAD_DEVICE ) //Passive mode for user interface
{
p->thread_trigger = THREAD_NONE ;
if( strncmp(scan, "b", 1) == 0 )
{
p->wps_info=3;
p2p_wpsinfo(p);
p2p_status(p, 0);
if(p->status != P2P_STATE_GONEGO_OK)
{
p2p_set_nego(p);
}
else
{
p2p_role(p,0);
if( p->role == P2P_ROLE_CLIENT )
{
p2p_client_mode(p);
}
else if( p->role == P2P_ROLE_GO )
{
p2p_go_mode(p);
}
}
}
else if( strncmp(scan, "c", 1) == 0 )
{
p->wps_info=2;
p2p_wpsinfo(p);
p2p_status(p, 0);
if(p->status != P2P_STATE_GONEGO_OK)
{
p2p_set_nego(p);
}
else
{
p2p_role(p,0);
p2p_ifaddr(p);
if( p->role == P2P_ROLE_CLIENT )
{
p2p_client_mode(p);
}
else if( p->role == P2P_ROLE_GO )
{
p2p_go_mode(p);
}
}
}
else if( ('0' <= *scan ) && ( *scan <= '9') )
{
printf("In passive pin code\n");
p->pin = atoi(scan);
p->wps_info=1;
p2p_wpsinfo(p);
p2p_set_nego(p);
}
}
else if( p->thread_trigger == THREAD_GO ) //Passive mode for user interface
{
p->thread_trigger = THREAD_NONE ;
if( strncmp(scan, "b", 1) == 0 )
{
p->wps_info=3;
p2p_wpsinfo(p);
}
else if( strncmp(scan, "c", 1) == 0 )
{
p->wps_info=2;
p2p_wpsinfo(p);
}
else if( ('0' <= *scan ) && ( *scan <= '9') )
{
printf("In passive pin code\n");
p->pin = atoi(scan);
p->wps_info=1;
p2p_wpsinfo(p);
}
p2p_go_mode(p);
}
}
while( 1 );
/* Disable P2P functionalities when exits*/
p->enable= -1 ;
p2p_enable(p);
system( "rm -f ./supp_status.txt" );
system( "rm -f ./temp.txt" );
system( "rm -f ./scan.txt" );
system( "rm -f ./peer.txt" );
system( "rm -f ./status.txt" );
system( "rm -f ./cm.txt" );
return 0;
}

View File

@ -0,0 +1,57 @@
diff -urN linux-3.0.42/include/net/cfg80211.h linux-3.0.42-patch/include/net/cfg80211.h
--- linux-3.0.42/include/net/cfg80211.h 2012-09-05 21:02:06.960467827 +0800
+++ linux-3.0.42-patch/include/net/cfg80211.h 2012-09-05 21:00:09.775049000 +0800
@@ -426,6 +426,7 @@
* @STATION_INFO_RX_BITRATE: @rxrate fields are filled
* @STATION_INFO_BSS_PARAM: @bss_param filled
* @STATION_INFO_CONNECTED_TIME: @connected_time filled
+ * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
*/
enum station_info_flags {
STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -444,7 +445,8 @@
STATION_INFO_SIGNAL_AVG = 1<<13,
STATION_INFO_RX_BITRATE = 1<<14,
STATION_INFO_BSS_PARAM = 1<<15,
- STATION_INFO_CONNECTED_TIME = 1<<16
+ STATION_INFO_CONNECTED_TIME = 1<<16,
+ STATION_INFO_ASSOC_REQ_IES = 1<<17
};
/**
@@ -536,6 +538,11 @@
* This number should increase every time the list of stations
* changes, i.e. when a station is added or removed, so that
* userspace can tell whether it got a consistent snapshot.
+ * @assoc_req_ies: IEs from (Re)Association Request.
+ * This is used only when in AP mode with drivers that do not use
+ * user space MLME/SME implementation. The information is provided for
+ * the cfg80211_new_sta() calls to notify user space of the IEs.
+ * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
*/
struct station_info {
u32 filled;
@@ -558,6 +565,9 @@
struct sta_bss_parameters bss_param;
int generation;
+
+ const u8 *assoc_req_ies;
+ size_t assoc_req_ies_len;
};
/**
diff -urN linux-3.0.42/net/wireless/nl80211.c linux-3.0.42-patch/net/wireless/nl80211.c
--- linux-3.0.42/net/wireless/nl80211.c 2012-09-05 21:03:25.528853240 +0800
+++ linux-3.0.42-patch/net/wireless/nl80211.c 2012-09-05 20:47:08.472824000 +0800
@@ -2213,6 +2213,10 @@
}
nla_nest_end(msg, sinfoattr);
+ if (sinfo->filled & STATION_INFO_ASSOC_REQ_IES)
+ NLA_PUT(msg, NL80211_ATTR_IE, sinfo->assoc_req_ies_len,
+ sinfo->assoc_req_ies);
+
return genlmsg_end(msg, hdr);
nla_put_failure:

View File

@ -0,0 +1,57 @@
diff -urN linux-3.0.42/include/net/cfg80211.h linux-3.0.42-patch/include/net/cfg80211.h
--- linux-3.0.42/include/net/cfg80211.h 2012-09-05 21:02:06.960467827 +0800
+++ linux-3.0.42-patch/include/net/cfg80211.h 2012-09-05 21:00:09.775049000 +0800
@@ -426,6 +426,7 @@
* @STATION_INFO_RX_BITRATE: @rxrate fields are filled
* @STATION_INFO_BSS_PARAM: @bss_param filled
* @STATION_INFO_CONNECTED_TIME: @connected_time filled
+ * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
*/
enum station_info_flags {
STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -444,7 +445,8 @@
STATION_INFO_SIGNAL_AVG = 1<<13,
STATION_INFO_RX_BITRATE = 1<<14,
STATION_INFO_BSS_PARAM = 1<<15,
- STATION_INFO_CONNECTED_TIME = 1<<16
+ STATION_INFO_CONNECTED_TIME = 1<<16,
+ STATION_INFO_ASSOC_REQ_IES = 1<<17
};
/**
@@ -536,6 +538,11 @@
* This number should increase every time the list of stations
* changes, i.e. when a station is added or removed, so that
* userspace can tell whether it got a consistent snapshot.
+ * @assoc_req_ies: IEs from (Re)Association Request.
+ * This is used only when in AP mode with drivers that do not use
+ * user space MLME/SME implementation. The information is provided for
+ * the cfg80211_new_sta() calls to notify user space of the IEs.
+ * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
*/
struct station_info {
u32 filled;
@@ -558,6 +565,9 @@
struct sta_bss_parameters bss_param;
int generation;
+
+ const u8 *assoc_req_ies;
+ size_t assoc_req_ies_len;
};
/**
diff -urN linux-3.0.42/net/wireless/nl80211.c linux-3.0.42-patch/net/wireless/nl80211.c
--- linux-3.0.42/net/wireless/nl80211.c 2012-09-05 21:03:25.528853240 +0800
+++ linux-3.0.42-patch/net/wireless/nl80211.c 2012-09-05 20:47:08.472824000 +0800
@@ -2213,6 +2213,10 @@
}
nla_nest_end(msg, sinfoattr);
+ if (sinfo->filled & STATION_INFO_ASSOC_REQ_IES)
+ NLA_PUT(msg, NL80211_ATTR_IE, sinfo->assoc_req_ies_len,
+ sinfo->assoc_req_ies);
+
return genlmsg_end(msg, hdr);
nla_put_failure:

View File

@ -0,0 +1,57 @@
diff -urN linux-3.0.42/include/net/cfg80211.h linux-3.0.42-patch/include/net/cfg80211.h
--- linux-3.0.42/include/net/cfg80211.h 2012-09-05 21:02:06.960467827 +0800
+++ linux-3.0.42-patch/include/net/cfg80211.h 2012-09-05 21:00:09.775049000 +0800
@@ -426,6 +426,7 @@
* @STATION_INFO_RX_BITRATE: @rxrate fields are filled
* @STATION_INFO_BSS_PARAM: @bss_param filled
* @STATION_INFO_CONNECTED_TIME: @connected_time filled
+ * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
*/
enum station_info_flags {
STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -444,7 +445,8 @@
STATION_INFO_SIGNAL_AVG = 1<<13,
STATION_INFO_RX_BITRATE = 1<<14,
STATION_INFO_BSS_PARAM = 1<<15,
- STATION_INFO_CONNECTED_TIME = 1<<16
+ STATION_INFO_CONNECTED_TIME = 1<<16,
+ STATION_INFO_ASSOC_REQ_IES = 1<<17
};
/**
@@ -536,6 +538,11 @@
* This number should increase every time the list of stations
* changes, i.e. when a station is added or removed, so that
* userspace can tell whether it got a consistent snapshot.
+ * @assoc_req_ies: IEs from (Re)Association Request.
+ * This is used only when in AP mode with drivers that do not use
+ * user space MLME/SME implementation. The information is provided for
+ * the cfg80211_new_sta() calls to notify user space of the IEs.
+ * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
*/
struct station_info {
u32 filled;
@@ -558,6 +565,9 @@
struct sta_bss_parameters bss_param;
int generation;
+
+ const u8 *assoc_req_ies;
+ size_t assoc_req_ies_len;
};
/**
diff -urN linux-3.0.42/net/wireless/nl80211.c linux-3.0.42-patch/net/wireless/nl80211.c
--- linux-3.0.42/net/wireless/nl80211.c 2012-09-05 21:03:25.528853240 +0800
+++ linux-3.0.42-patch/net/wireless/nl80211.c 2012-09-05 20:47:08.472824000 +0800
@@ -2213,6 +2213,10 @@
}
nla_nest_end(msg, sinfoattr);
+ if (sinfo->filled & STATION_INFO_ASSOC_REQ_IES)
+ NLA_PUT(msg, NL80211_ATTR_IE, sinfo->assoc_req_ies_len,
+ sinfo->assoc_req_ies);
+
return genlmsg_end(msg, hdr);
nla_put_failure:

View File

@ -0,0 +1,57 @@
diff -urN linux-3.0.42/include/net/cfg80211.h linux-3.0.42-patch/include/net/cfg80211.h
--- linux-3.0.42/include/net/cfg80211.h 2012-09-05 21:02:06.960467827 +0800
+++ linux-3.0.42-patch/include/net/cfg80211.h 2012-09-05 21:00:09.775049000 +0800
@@ -426,6 +426,7 @@
* @STATION_INFO_RX_BITRATE: @rxrate fields are filled
* @STATION_INFO_BSS_PARAM: @bss_param filled
* @STATION_INFO_CONNECTED_TIME: @connected_time filled
+ * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
*/
enum station_info_flags {
STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -444,7 +445,8 @@
STATION_INFO_SIGNAL_AVG = 1<<13,
STATION_INFO_RX_BITRATE = 1<<14,
STATION_INFO_BSS_PARAM = 1<<15,
- STATION_INFO_CONNECTED_TIME = 1<<16
+ STATION_INFO_CONNECTED_TIME = 1<<16,
+ STATION_INFO_ASSOC_REQ_IES = 1<<17
};
/**
@@ -536,6 +538,11 @@
* This number should increase every time the list of stations
* changes, i.e. when a station is added or removed, so that
* userspace can tell whether it got a consistent snapshot.
+ * @assoc_req_ies: IEs from (Re)Association Request.
+ * This is used only when in AP mode with drivers that do not use
+ * user space MLME/SME implementation. The information is provided for
+ * the cfg80211_new_sta() calls to notify user space of the IEs.
+ * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
*/
struct station_info {
u32 filled;
@@ -558,6 +565,9 @@
struct sta_bss_parameters bss_param;
int generation;
+
+ const u8 *assoc_req_ies;
+ size_t assoc_req_ies_len;
};
/**
diff -urN linux-3.0.42/net/wireless/nl80211.c linux-3.0.42-patch/net/wireless/nl80211.c
--- linux-3.0.42/net/wireless/nl80211.c 2012-09-05 21:03:25.528853240 +0800
+++ linux-3.0.42-patch/net/wireless/nl80211.c 2012-09-05 20:47:08.472824000 +0800
@@ -2213,6 +2213,10 @@
}
nla_nest_end(msg, sinfoattr);
+ if (sinfo->filled & STATION_INFO_ASSOC_REQ_IES)
+ NLA_PUT(msg, NL80211_ATTR_IE, sinfo->assoc_req_ies_len,
+ sinfo->assoc_req_ies);
+
return genlmsg_end(msg, hdr);
nla_put_failure:

View File

@ -0,0 +1,57 @@
diff -urN linux-3.0.42/include/net/cfg80211.h linux-3.0.42-patch/include/net/cfg80211.h
--- linux-3.0.42/include/net/cfg80211.h 2012-09-05 21:02:06.960467827 +0800
+++ linux-3.0.42-patch/include/net/cfg80211.h 2012-09-05 21:00:09.775049000 +0800
@@ -426,6 +426,7 @@
* @STATION_INFO_RX_BITRATE: @rxrate fields are filled
* @STATION_INFO_BSS_PARAM: @bss_param filled
* @STATION_INFO_CONNECTED_TIME: @connected_time filled
+ * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
*/
enum station_info_flags {
STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -444,7 +445,8 @@
STATION_INFO_SIGNAL_AVG = 1<<13,
STATION_INFO_RX_BITRATE = 1<<14,
STATION_INFO_BSS_PARAM = 1<<15,
- STATION_INFO_CONNECTED_TIME = 1<<16
+ STATION_INFO_CONNECTED_TIME = 1<<16,
+ STATION_INFO_ASSOC_REQ_IES = 1<<17
};
/**
@@ -536,6 +538,11 @@
* This number should increase every time the list of stations
* changes, i.e. when a station is added or removed, so that
* userspace can tell whether it got a consistent snapshot.
+ * @assoc_req_ies: IEs from (Re)Association Request.
+ * This is used only when in AP mode with drivers that do not use
+ * user space MLME/SME implementation. The information is provided for
+ * the cfg80211_new_sta() calls to notify user space of the IEs.
+ * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
*/
struct station_info {
u32 filled;
@@ -558,6 +565,9 @@
struct sta_bss_parameters bss_param;
int generation;
+
+ const u8 *assoc_req_ies;
+ size_t assoc_req_ies_len;
};
/**
diff -urN linux-3.0.42/net/wireless/nl80211.c linux-3.0.42-patch/net/wireless/nl80211.c
--- linux-3.0.42/net/wireless/nl80211.c 2012-09-05 21:03:25.528853240 +0800
+++ linux-3.0.42-patch/net/wireless/nl80211.c 2012-09-05 20:47:08.472824000 +0800
@@ -2213,6 +2213,10 @@
}
nla_nest_end(msg, sinfoattr);
+ if (sinfo->filled & STATION_INFO_ASSOC_REQ_IES)
+ NLA_PUT(msg, NL80211_ATTR_IE, sinfo->assoc_req_ies_len,
+ sinfo->assoc_req_ies);
+
return genlmsg_end(msg, hdr);
nla_put_failure:

View File

@ -0,0 +1,57 @@
diff -urN linux-3.0.42/include/net/cfg80211.h linux-3.0.42-patch/include/net/cfg80211.h
--- linux-3.0.42/include/net/cfg80211.h 2012-09-05 21:02:06.960467827 +0800
+++ linux-3.0.42-patch/include/net/cfg80211.h 2012-09-05 21:00:09.775049000 +0800
@@ -426,6 +426,7 @@
* @STATION_INFO_RX_BITRATE: @rxrate fields are filled
* @STATION_INFO_BSS_PARAM: @bss_param filled
* @STATION_INFO_CONNECTED_TIME: @connected_time filled
+ * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
*/
enum station_info_flags {
STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -444,7 +445,8 @@
STATION_INFO_SIGNAL_AVG = 1<<13,
STATION_INFO_RX_BITRATE = 1<<14,
STATION_INFO_BSS_PARAM = 1<<15,
- STATION_INFO_CONNECTED_TIME = 1<<16
+ STATION_INFO_CONNECTED_TIME = 1<<16,
+ STATION_INFO_ASSOC_REQ_IES = 1<<17
};
/**
@@ -536,6 +538,11 @@
* This number should increase every time the list of stations
* changes, i.e. when a station is added or removed, so that
* userspace can tell whether it got a consistent snapshot.
+ * @assoc_req_ies: IEs from (Re)Association Request.
+ * This is used only when in AP mode with drivers that do not use
+ * user space MLME/SME implementation. The information is provided for
+ * the cfg80211_new_sta() calls to notify user space of the IEs.
+ * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
*/
struct station_info {
u32 filled;
@@ -558,6 +565,9 @@
struct sta_bss_parameters bss_param;
int generation;
+
+ const u8 *assoc_req_ies;
+ size_t assoc_req_ies_len;
};
/**
diff -urN linux-3.0.42/net/wireless/nl80211.c linux-3.0.42-patch/net/wireless/nl80211.c
--- linux-3.0.42/net/wireless/nl80211.c 2012-09-05 21:03:25.528853240 +0800
+++ linux-3.0.42-patch/net/wireless/nl80211.c 2012-09-05 20:47:08.472824000 +0800
@@ -2213,6 +2213,10 @@
}
nla_nest_end(msg, sinfoattr);
+ if (sinfo->filled & STATION_INFO_ASSOC_REQ_IES)
+ NLA_PUT(msg, NL80211_ATTR_IE, sinfo->assoc_req_ies_len,
+ sinfo->assoc_req_ies);
+
return genlmsg_end(msg, hdr);
nla_put_failure:

View File

@ -0,0 +1,57 @@
diff -urN linux-3.0.42/include/net/cfg80211.h linux-3.0.42-patch/include/net/cfg80211.h
--- linux-3.0.42/include/net/cfg80211.h 2012-09-05 21:02:06.960467827 +0800
+++ linux-3.0.42-patch/include/net/cfg80211.h 2012-09-05 21:00:09.775049000 +0800
@@ -426,6 +426,7 @@
* @STATION_INFO_RX_BITRATE: @rxrate fields are filled
* @STATION_INFO_BSS_PARAM: @bss_param filled
* @STATION_INFO_CONNECTED_TIME: @connected_time filled
+ * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
*/
enum station_info_flags {
STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -444,7 +445,8 @@
STATION_INFO_SIGNAL_AVG = 1<<13,
STATION_INFO_RX_BITRATE = 1<<14,
STATION_INFO_BSS_PARAM = 1<<15,
- STATION_INFO_CONNECTED_TIME = 1<<16
+ STATION_INFO_CONNECTED_TIME = 1<<16,
+ STATION_INFO_ASSOC_REQ_IES = 1<<17
};
/**
@@ -536,6 +538,11 @@
* This number should increase every time the list of stations
* changes, i.e. when a station is added or removed, so that
* userspace can tell whether it got a consistent snapshot.
+ * @assoc_req_ies: IEs from (Re)Association Request.
+ * This is used only when in AP mode with drivers that do not use
+ * user space MLME/SME implementation. The information is provided for
+ * the cfg80211_new_sta() calls to notify user space of the IEs.
+ * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
*/
struct station_info {
u32 filled;
@@ -558,6 +565,9 @@
struct sta_bss_parameters bss_param;
int generation;
+
+ const u8 *assoc_req_ies;
+ size_t assoc_req_ies_len;
};
/**
diff -urN linux-3.0.42/net/wireless/nl80211.c linux-3.0.42-patch/net/wireless/nl80211.c
--- linux-3.0.42/net/wireless/nl80211.c 2012-09-05 21:03:25.528853240 +0800
+++ linux-3.0.42-patch/net/wireless/nl80211.c 2012-09-05 20:47:08.472824000 +0800
@@ -2213,6 +2213,10 @@
}
nla_nest_end(msg, sinfoattr);
+ if (sinfo->filled & STATION_INFO_ASSOC_REQ_IES)
+ NLA_PUT(msg, NL80211_ATTR_IE, sinfo->assoc_req_ies_len,
+ sinfo->assoc_req_ies);
+
return genlmsg_end(msg, hdr);
nla_put_failure:

View File

@ -62,7 +62,7 @@ BOOLEAN efuse_IsMasked(PADAPTER pAdapter, u16 Offset)
if (pAdapter->registrypriv.boffefusemask)
return FALSE;
#if DEV_BUS_TYPE == RT_USB_INTERFACE
#ifdef CONFIG_USB_HCI
#if defined(CONFIG_RTL8188E)
if (IS_HARDWARE_TYPE_8188E(pAdapter))
return (IS_MASKED(8188E, _MUSB, Offset)) ? TRUE : FALSE;
@ -99,6 +99,10 @@ BOOLEAN efuse_IsMasked(PADAPTER pAdapter, u16 Offset)
if (IS_HARDWARE_TYPE_8188F(pAdapter))
return (IS_MASKED(8188F, _MUSB, Offset)) ? TRUE : FALSE;
#endif
#if defined(CONFIG_RTL8188GTV)
if (IS_HARDWARE_TYPE_8188GTV(pAdapter))
return (IS_MASKED(8188GTV, _MUSB, Offset)) ? TRUE : FALSE;
#endif
#if defined(CONFIG_RTL8822B)
if (IS_HARDWARE_TYPE_8822B(pAdapter))
return (IS_MASKED(8822B, _MUSB, Offset)) ? TRUE : FALSE;
@ -107,13 +111,22 @@ BOOLEAN efuse_IsMasked(PADAPTER pAdapter, u16 Offset)
if (IS_HARDWARE_TYPE_8723D(pAdapter))
return (IS_MASKED(8723D, _MUSB, Offset)) ? TRUE : FALSE;
#endif
#if defined(CONFIG_RTL8710B)
if (IS_HARDWARE_TYPE_8710B(pAdapter))
return (IS_MASKED(8710B, _MUSB, Offset)) ? TRUE : FALSE;
#endif
#if defined(CONFIG_RTL8821C)
if (IS_HARDWARE_TYPE_8821CU(pAdapter))
return (IS_MASKED(8821C, _MUSB, Offset)) ? TRUE : FALSE;
#endif
#elif DEV_BUS_TYPE == RT_PCI_INTERFACE
#if defined(CONFIG_RTL8192F)
if (IS_HARDWARE_TYPE_8192FU(pAdapter))
return (IS_MASKED(8192F, _MUSB, Offset)) ? TRUE : FALSE;
#endif
#endif /*CONFIG_USB_HCI*/
#ifdef CONFIG_PCI_HCI
#if defined(CONFIG_RTL8188E)
if (IS_HARDWARE_TYPE_8188E(pAdapter))
return (IS_MASKED(8188E, _MPCIE, Offset)) ? TRUE : FALSE;
@ -147,7 +160,13 @@ BOOLEAN efuse_IsMasked(PADAPTER pAdapter, u16 Offset)
return (IS_MASKED(8821C, _MPCIE, Offset)) ? TRUE : FALSE;
#endif
#elif DEV_BUS_TYPE == RT_SDIO_INTERFACE
#if defined(CONFIG_RTL8192F)
if (IS_HARDWARE_TYPE_8192FE(pAdapter))
return (IS_MASKED(8192F, _MPCIE, Offset)) ? TRUE : FALSE;
#endif
#endif /*CONFIG_PCI_HCI*/
#ifdef CONFIG_SDIO_HCI
#ifdef CONFIG_RTL8188E_SDIO
if (IS_HARDWARE_TYPE_8188E(pAdapter))
return (IS_MASKED(8188E, _MSDIO, Offset)) ? TRUE : FALSE;
@ -156,10 +175,14 @@ BOOLEAN efuse_IsMasked(PADAPTER pAdapter, u16 Offset)
if (IS_HARDWARE_TYPE_8723BS(pAdapter))
return (IS_MASKED(8723B, _MSDIO, Offset)) ? TRUE : FALSE;
#endif
#ifdef CONFIG_RTL8188F_SDIO
#ifdef CONFIG_RTL8188F
if (IS_HARDWARE_TYPE_8188F(pAdapter))
return (IS_MASKED(8188F, _MSDIO, Offset)) ? TRUE : FALSE;
#endif
#ifdef CONFIG_RTL8188GTV
if (IS_HARDWARE_TYPE_8188GTV(pAdapter))
return (IS_MASKED(8188GTV, _MSDIO, Offset)) ? TRUE : FALSE;
#endif
#ifdef CONFIG_RTL8192E
if (IS_HARDWARE_TYPE_8192ES(pAdapter))
return (IS_MASKED(8192E, _MSDIO, Offset)) ? TRUE : FALSE;
@ -176,7 +199,11 @@ BOOLEAN efuse_IsMasked(PADAPTER pAdapter, u16 Offset)
if (IS_HARDWARE_TYPE_8822B(pAdapter))
return (IS_MASKED(8822B, _MSDIO, Offset)) ? TRUE : FALSE;
#endif
#if defined(CONFIG_RTL8192F)
if (IS_HARDWARE_TYPE_8192FS(pAdapter))
return (IS_MASKED(8192F, _MSDIO, Offset)) ? TRUE : FALSE;
#endif
#endif /*CONFIG_SDIO_HCI*/
return FALSE;
}
@ -185,7 +212,7 @@ void rtw_efuse_mask_array(PADAPTER pAdapter, u8 *pArray)
{
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
#if DEV_BUS_TYPE == RT_USB_INTERFACE
#ifdef CONFIG_USB_HCI
#if defined(CONFIG_RTL8188E)
if (IS_HARDWARE_TYPE_8188E(pAdapter))
GET_MASK_ARRAY(8188E, _MUSB, pArray);
@ -214,6 +241,10 @@ void rtw_efuse_mask_array(PADAPTER pAdapter, u8 *pArray)
if (IS_HARDWARE_TYPE_8188F(pAdapter))
GET_MASK_ARRAY(8188F, _MUSB, pArray);
#endif
#if defined(CONFIG_RTL8188GTV)
if (IS_HARDWARE_TYPE_8188GTV(pAdapter))
GET_MASK_ARRAY(8188GTV, _MUSB, pArray);
#endif
#if defined(CONFIG_RTL8814A)
if (IS_HARDWARE_TYPE_8814A(pAdapter))
GET_MASK_ARRAY(8814A, _MUSB, pArray);
@ -226,9 +257,13 @@ void rtw_efuse_mask_array(PADAPTER pAdapter, u8 *pArray)
if (IS_HARDWARE_TYPE_8821CU(pAdapter))
GET_MASK_ARRAY(8821C, _MUSB, pArray);
#endif
#if defined(CONFIG_RTL8192F)
if (IS_HARDWARE_TYPE_8192FU(pAdapter))
GET_MASK_ARRAY(8192F, _MUSB, pArray);
#endif
#endif /*CONFIG_USB_HCI*/
#elif DEV_BUS_TYPE == RT_PCI_INTERFACE
#ifdef CONFIG_PCI_HCI
#if defined(CONFIG_RTL8188E)
if (IS_HARDWARE_TYPE_8188E(pAdapter))
GET_MASK_ARRAY(8188E, _MPCIE, pArray);
@ -261,9 +296,13 @@ void rtw_efuse_mask_array(PADAPTER pAdapter, u8 *pArray)
if (IS_HARDWARE_TYPE_8821CE(pAdapter))
GET_MASK_ARRAY(8821C, _MPCIE, pArray);
#endif
#if defined(CONFIG_RTL8192F)
if (IS_HARDWARE_TYPE_8192FE(pAdapter))
GET_MASK_ARRAY(8192F, _MPCIE, pArray);
#endif
#endif /*CONFIG_PCI_HCI*/
#elif DEV_BUS_TYPE == RT_SDIO_INTERFACE
#ifdef CONFIG_SDIO_HCI
#if defined(CONFIG_RTL8188E)
if (IS_HARDWARE_TYPE_8188E(pAdapter))
GET_MASK_ARRAY(8188E, _MSDIO, pArray);
@ -276,6 +315,10 @@ void rtw_efuse_mask_array(PADAPTER pAdapter, u8 *pArray)
if (IS_HARDWARE_TYPE_8188F(pAdapter))
GET_MASK_ARRAY(8188F, _MSDIO, pArray);
#endif
#if defined(CONFIG_RTL8188GTV)
if (IS_HARDWARE_TYPE_8188GTV(pAdapter))
GET_MASK_ARRAY(8188GTV, _MSDIO, pArray);
#endif
#if defined(CONFIG_RTL8192E)
if (IS_HARDWARE_TYPE_8192ES(pAdapter))
GET_MASK_ARRAY(8192E, _MSDIO, pArray);
@ -292,14 +335,18 @@ void rtw_efuse_mask_array(PADAPTER pAdapter, u8 *pArray)
if (IS_HARDWARE_TYPE_8822B(pAdapter))
GET_MASK_ARRAY(8822B , _MSDIO, pArray);
#endif
#endif /*#elif DEV_BUS_TYPE == RT_SDIO_INTERFACE*/
#if defined(CONFIG_RTL8192F)
if (IS_HARDWARE_TYPE_8192FS(pAdapter))
GET_MASK_ARRAY(8192F, _MSDIO, pArray);
#endif
#endif /*CONFIG_SDIO_HCI*/
}
u16 rtw_get_efuse_mask_arraylen(PADAPTER pAdapter)
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
#if DEV_BUS_TYPE == RT_USB_INTERFACE
#ifdef CONFIG_USB_HCI
#if defined(CONFIG_RTL8188E)
if (IS_HARDWARE_TYPE_8188E(pAdapter))
return GET_MASK_ARRAY_LEN(8188E, _MUSB);
@ -328,6 +375,10 @@ u16 rtw_get_efuse_mask_arraylen(PADAPTER pAdapter)
if (IS_HARDWARE_TYPE_8188F(pAdapter))
return GET_MASK_ARRAY_LEN(8188F, _MUSB);
#endif
#if defined(CONFIG_RTL8188GTV)
if (IS_HARDWARE_TYPE_8188GTV(pAdapter))
return GET_MASK_ARRAY_LEN(8188GTV, _MUSB);
#endif
#if defined(CONFIG_RTL8814A)
if (IS_HARDWARE_TYPE_8814A(pAdapter))
return GET_MASK_ARRAY_LEN(8814A, _MUSB);
@ -340,9 +391,13 @@ u16 rtw_get_efuse_mask_arraylen(PADAPTER pAdapter)
if (IS_HARDWARE_TYPE_8821CU(pAdapter))
return GET_MASK_ARRAY_LEN(8821C, _MUSB);
#endif
#if defined(CONFIG_RTL8192F)
if (IS_HARDWARE_TYPE_8192FU(pAdapter))
return GET_MASK_ARRAY_LEN(8192F, _MUSB);
#endif
#endif /*CONFIG_USB_HCI*/
#elif DEV_BUS_TYPE == RT_PCI_INTERFACE
#ifdef CONFIG_PCI_HCI
#if defined(CONFIG_RTL8188E)
if (IS_HARDWARE_TYPE_8188E(pAdapter))
return GET_MASK_ARRAY_LEN(8188E, _MPCIE);
@ -375,9 +430,13 @@ u16 rtw_get_efuse_mask_arraylen(PADAPTER pAdapter)
if (IS_HARDWARE_TYPE_8821CE(pAdapter))
return GET_MASK_ARRAY_LEN(8821C, _MPCIE);
#endif
#if defined(CONFIG_RTL8192F)
if (IS_HARDWARE_TYPE_8192FE(pAdapter))
return GET_MASK_ARRAY_LEN(8192F, _MPCIE);
#endif
#endif /*CONFIG_PCI_HCI*/
#elif DEV_BUS_TYPE == RT_SDIO_INTERFACE
#ifdef CONFIG_SDIO_HCI
#if defined(CONFIG_RTL8188E)
if (IS_HARDWARE_TYPE_8188E(pAdapter))
return GET_MASK_ARRAY_LEN(8188E, _MSDIO);
@ -390,6 +449,10 @@ u16 rtw_get_efuse_mask_arraylen(PADAPTER pAdapter)
if (IS_HARDWARE_TYPE_8188F(pAdapter))
return GET_MASK_ARRAY_LEN(8188F, _MSDIO);
#endif
#if defined(CONFIG_RTL8188GTV)
if (IS_HARDWARE_TYPE_8188GTV(pAdapter))
return GET_MASK_ARRAY_LEN(8188GTV, _MSDIO);
#endif
#if defined(CONFIG_RTL8192E)
if (IS_HARDWARE_TYPE_8192ES(pAdapter))
return GET_MASK_ARRAY_LEN(8192E, _MSDIO);
@ -406,7 +469,11 @@ u16 rtw_get_efuse_mask_arraylen(PADAPTER pAdapter)
if (IS_HARDWARE_TYPE_8822B(pAdapter))
return GET_MASK_ARRAY_LEN(8822B, _MSDIO);
#endif
#if defined(CONFIG_RTL8192F)
if (IS_HARDWARE_TYPE_8192FS(pAdapter))
return GET_MASK_ARRAY_LEN(8192F, _MSDIO);
#endif
#endif/*CONFIG_SDIO_HCI*/
return 0;
}
@ -577,7 +644,7 @@ void rtw_efuse_analyze(PADAPTER padapter, u8 Type, u8 Fake)
for (bank = startBank; bank <= endBank; bank++) {
if (!hal_EfuseSwitchToBank(padapter, bank, bPseudoTest)) {
RTW_INFO("EFUSE_SwitchToBank() Fail!!\n");
return;
goto out_free_buffer;
}
eFuse_Addr = bank * EFUSE_MAX_BANK_SIZE;
@ -586,7 +653,7 @@ void rtw_efuse_analyze(PADAPTER padapter, u8 Type, u8 Fake)
if (efuseHeader == 0xFF && bank == startBank && Fake != TRUE) {
RTW_INFO("Non-PGed Efuse\n");
return;
goto out_free_buffer;
}
RTW_INFO("EFUSE_REAL_CONTENT_LEN = %d\n", maprawlen);
@ -719,6 +786,8 @@ void rtw_efuse_analyze(PADAPTER padapter, u8 Type, u8 Fake)
);
}
_RTW_PRINT_SEL(RTW_DBGDUMP, "\n");
out_free_buffer:
if (eFuseWord)
rtw_mfree((u8 *)eFuseWord, EFUSE_MAX_SECTION_NUM * (EFUSE_MAX_WORD_UNIT * 2));
}
@ -1997,6 +2066,14 @@ efuse_OneByteRead(
return bResult;
}
#ifdef CONFIG_RTL8710B
/* <20171208, Peter>, Dont do the following write16(0x34) */
if (IS_HARDWARE_TYPE_8710B(pAdapter)) {
bResult = pAdapter->hal_func.efuse_indirect_read4(pAdapter, addr, data);
return bResult;
}
#endif
if (IS_HARDWARE_TYPE_8723B(pAdapter) ||
(IS_HARDWARE_TYPE_8192E(pAdapter) && (!IS_A_CUT(pHalData->version_id))) ||
(IS_VENDOR_8188E_I_CUT_SERIES(pAdapter)) || (IS_CHIP_VENDOR_SMIC(pHalData->version_id))
@ -2687,31 +2764,6 @@ EFUSE_ShadowWrite(
} /* EFUSE_ShadowWrite */
VOID
Efuse_InitSomeVar(
IN PADAPTER pAdapter
);
VOID
Efuse_InitSomeVar(
IN PADAPTER pAdapter
)
{
u8 i;
_rtw_memset((PVOID)&fakeEfuseContent[0], 0xff, EFUSE_MAX_HW_SIZE);
_rtw_memset((PVOID)&fakeEfuseInitMap[0], 0xff, EFUSE_MAX_MAP_LEN);
_rtw_memset((PVOID)&fakeEfuseModifiedMap[0], 0xff, EFUSE_MAX_MAP_LEN);
for (i = 0; i < EFUSE_MAX_BT_BANK; i++)
_rtw_memset((PVOID)&BTEfuseContent[i][0], EFUSE_MAX_HW_SIZE, 0xff);
_rtw_memset((PVOID)&BTEfuseInitMap[0], 0xff, EFUSE_BT_MAX_MAP_LEN);
_rtw_memset((PVOID)&BTEfuseModifiedMap[0], 0xff, EFUSE_BT_MAX_MAP_LEN);
for (i = 0; i < EFUSE_MAX_BT_BANK; i++)
_rtw_memset((PVOID)&fakeBTEfuseContent[i][0], 0xff, EFUSE_MAX_HW_SIZE);
_rtw_memset((PVOID)&fakeBTEfuseInitMap[0], 0xff, EFUSE_BT_MAX_MAP_LEN);
_rtw_memset((PVOID)&fakeBTEfuseModifiedMap[0], 0xff, EFUSE_BT_MAX_MAP_LEN);
}
#endif /* !RTW_HALMAC */
/*-----------------------------------------------------------------------------
* Function: efuse_ShadowRead1Byte

View File

@ -234,6 +234,259 @@ exit:
return ret;
}
void rtw_mesh_bss_peering_status(WLAN_BSSID_EX *bss, u8 *nop, u8 *accept)
{
u8 *ie;
int ie_len;
if (nop)
*nop = 0;
if (accept)
*accept = 0;
ie = rtw_get_ie(BSS_EX_TLV_IES(bss), WLAN_EID_MESH_CONFIG, &ie_len,
BSS_EX_TLV_IES_LEN(bss));
if (!ie || ie_len != 7)
goto exit;
if (nop)
*nop = GET_MESH_CONF_ELE_NUM_OF_PEERINGS(ie + 2);
if (accept)
*accept = GET_MESH_CONF_ELE_ACCEPT_PEERINGS(ie + 2);
exit:
return;
}
#if CONFIG_RTW_MESH_ACNODE_PREVENT
void rtw_mesh_update_scanned_acnode_status(_adapter *adapter, struct wlan_network *scanned)
{
bool acnode;
u8 nop, accept;
rtw_mesh_bss_peering_status(&scanned->network, &nop, &accept);
acnode = !nop && accept;
if (acnode && scanned->acnode_stime == 0) {
scanned->acnode_stime = rtw_get_current_time();
if (scanned->acnode_stime == 0)
scanned->acnode_stime++;
} else if (!acnode) {
scanned->acnode_stime = 0;
scanned->acnode_notify_etime = 0;
}
}
bool rtw_mesh_scanned_is_acnode_confirmed(_adapter *adapter, struct wlan_network *scanned)
{
return scanned->acnode_stime
&& rtw_get_passing_time_ms(scanned->acnode_stime)
> adapter->mesh_cfg.peer_sel_policy.acnode_conf_timeout_ms;
}
static bool rtw_mesh_scanned_is_acnode_allow_notify(_adapter *adapter, struct wlan_network *scanned)
{
return scanned->acnode_notify_etime
&& rtw_time_after(scanned->acnode_notify_etime, rtw_get_current_time());
}
bool rtw_mesh_acnode_prevent_allow_sacrifice(_adapter *adapter)
{
struct rtw_mesh_cfg *mcfg = &adapter->mesh_cfg;
struct sta_priv *stapriv = &adapter->stapriv;
bool allow = 0;
if (!mcfg->peer_sel_policy.acnode_prevent
|| mcfg->max_peer_links <= 1
|| stapriv->asoc_list_cnt < mcfg->max_peer_links)
goto exit;
#if CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST
if (rtw_mesh_cto_mgate_required(adapter))
goto exit;
#endif
allow = 1;
exit:
return allow;
}
static bool rtw_mesh_acnode_candidate_exist(_adapter *adapter)
{
struct rtw_mesh_cfg *mcfg = &adapter->mesh_cfg;
struct sta_priv *stapriv = &adapter->stapriv;
struct mlme_priv *mlme = &adapter->mlmepriv;
_queue *queue = &(mlme->scanned_queue);
_list *head, *list;
_irqL irqL;
struct wlan_network *scanned = NULL;
struct sta_info *sta = NULL;
bool need = 0;
_enter_critical_bh(&(mlme->scanned_queue.lock), &irqL);
head = get_list_head(queue);
list = get_next(head);
while (!rtw_end_of_queue_search(head, list)) {
scanned = LIST_CONTAINOR(list, struct wlan_network, list);
list = get_next(list);
if (rtw_get_passing_time_ms(scanned->last_scanned) < mcfg->peer_sel_policy.scanr_exp_ms
&& rtw_mesh_scanned_is_acnode_confirmed(adapter, scanned)
&& (!mcfg->rssi_threshold || mcfg->rssi_threshold <= scanned->network.Rssi)
#if CONFIG_RTW_MACADDR_ACL
&& rtw_access_ctrl(adapter, scanned->network.MacAddress) == _TRUE
#endif
&& rtw_bss_is_candidate_mesh_peer(&mlme->cur_network.network, &scanned->network, 1, 1)
#if CONFIG_RTW_MESH_PEER_BLACKLIST
&& !rtw_mesh_peer_blacklist_search(adapter, scanned->network.MacAddress)
#endif
#if CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST
&& rtw_mesh_cto_mgate_network_filter(adapter, scanned)
#endif
) {
need = 1;
break;
}
}
_exit_critical_bh(&(mlme->scanned_queue.lock), &irqL);
exit:
return need;
}
static int rtw_mesh_acnode_prevent_sacrifice_chk(_adapter *adapter, struct sta_info **sac, struct sta_info *com)
{
struct rtw_mesh_cfg *mcfg = &adapter->mesh_cfg;
int updated = 0;
/*
* TODO: compare next_hop reference cnt of forwarding info
* don't sacrifice working next_hop or choose sta with least cnt
*/
if (*sac == NULL) {
updated = 1;
goto exit;
}
#if CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST
if (mcfg->peer_sel_policy.cto_mgate_require
&& !mcfg->dot11MeshGateAnnouncementProtocol
) {
if (IS_CTO_MGATE_CONF_TIMEOUT(com->plink)) {
if (!IS_CTO_MGATE_CONF_TIMEOUT((*sac)->plink)) {
/* blacklist > not blacklist */
updated = 1;
goto exit;
}
} else if (!IS_CTO_MGATE_CONF_DISABLED(com->plink)) {
if (IS_CTO_MGATE_CONF_DISABLED((*sac)->plink)) {
/* confirming > disabled */
updated = 1;
goto exit;
}
}
}
#endif
exit:
if (updated)
*sac = com;
return updated;
}
struct sta_info *_rtw_mesh_acnode_prevent_pick_sacrifice(_adapter *adapter)
{
struct sta_priv *stapriv = &adapter->stapriv;
_list *head, *list;
struct sta_info *sta, *sacrifice = NULL;
u8 nop;
head = &stapriv->asoc_list;
list = get_next(head);
while (rtw_end_of_queue_search(head, list) == _FALSE) {
sta = LIST_CONTAINOR(list, struct sta_info, asoc_list);
list = get_next(list);
if (!sta->plink || !sta->plink->scanned) {
rtw_warn_on(1);
continue;
}
rtw_mesh_bss_peering_status(&sta->plink->scanned->network, &nop, NULL);
if (nop < 2)
continue;
rtw_mesh_acnode_prevent_sacrifice_chk(adapter, &sacrifice, sta);
}
return sacrifice;
}
struct sta_info *rtw_mesh_acnode_prevent_pick_sacrifice(_adapter *adapter)
{
struct sta_priv *stapriv = &adapter->stapriv;
struct sta_info *sacrifice = NULL;
enter_critical_bh(&stapriv->asoc_list_lock);
sacrifice = _rtw_mesh_acnode_prevent_pick_sacrifice(adapter);
exit_critical_bh(&stapriv->asoc_list_lock);
return sacrifice;
}
static void rtw_mesh_acnode_rsvd_chk(_adapter *adapter)
{
struct rtw_mesh_info *minfo = &adapter->mesh_info;
struct mesh_plink_pool *plink_ctl = &minfo->plink_ctl;
u8 acnode_rsvd = 0;
if (rtw_mesh_acnode_prevent_allow_sacrifice(adapter)
&& rtw_mesh_acnode_prevent_pick_sacrifice(adapter)
&& rtw_mesh_acnode_candidate_exist(adapter))
acnode_rsvd = 1;
if (plink_ctl->acnode_rsvd != acnode_rsvd) {
plink_ctl->acnode_rsvd = acnode_rsvd;
RTW_INFO(FUNC_ADPT_FMT" acnode_rsvd = %d\n", FUNC_ADPT_ARG(adapter), plink_ctl->acnode_rsvd);
update_beacon(adapter, WLAN_EID_MESH_CONFIG, NULL, 1);
}
}
static void rtw_mesh_acnode_set_notify_etime(_adapter *adapter, u8 *rframe_whdr)
{
if (adapter->mesh_info.plink_ctl.acnode_rsvd) {
struct wlan_network *scanned = rtw_find_network(&adapter->mlmepriv.scanned_queue, get_addr2_ptr(rframe_whdr));
if (rtw_mesh_scanned_is_acnode_confirmed(adapter, scanned)) {
scanned->acnode_notify_etime = rtw_get_current_time()
+ rtw_ms_to_systime(adapter->mesh_cfg.peer_sel_policy.acnode_notify_timeout_ms);
if (scanned->acnode_notify_etime == 0)
scanned->acnode_notify_etime++;
}
}
}
void dump_mesh_acnode_prevent_settings(void *sel, _adapter *adapter)
{
struct mesh_peer_sel_policy *peer_sel_policy = &adapter->mesh_cfg.peer_sel_policy;
RTW_PRINT_SEL(sel, "%-6s %-12s %-14s\n"
, "enable", "conf_timeout", "nofity_timeout");
RTW_PRINT_SEL(sel, "%6u %12u %14u\n"
, peer_sel_policy->acnode_prevent
, peer_sel_policy->acnode_conf_timeout_ms
, peer_sel_policy->acnode_notify_timeout_ms);
}
#endif /* CONFIG_RTW_MESH_ACNODE_PREVENT */
#if CONFIG_RTW_MESH_PEER_BLACKLIST
int rtw_mesh_peer_blacklist_add(_adapter *adapter, const u8 *addr)
{
@ -355,10 +608,9 @@ void dump_mesh_cto_mgate_blacklist_settings(void *sel, _adapter *adapter)
{
struct mesh_peer_sel_policy *peer_sel_policy = &adapter->mesh_cfg.peer_sel_policy;
RTW_PRINT_SEL(sel, "%-7s %-12s %-17s\n"
, "require", "conf_timeout", "blacklist_timeout");
RTW_PRINT_SEL(sel, "%7u %12u %17u\n"
, peer_sel_policy->cto_mgate_require
RTW_PRINT_SEL(sel, "%-12s %-17s\n"
, "conf_timeout", "blacklist_timeout");
RTW_PRINT_SEL(sel, "%12u %17u\n"
, peer_sel_policy->cto_mgate_conf_timeout_ms
, peer_sel_policy->cto_mgate_blacklist_timeout_ms);
}
@ -406,6 +658,7 @@ void rtw_chk_candidate_peer_notify(_adapter *adapter, struct wlan_network *scann
struct rtw_mesh_info *minfo = &adapter->mesh_info;
struct rtw_mesh_cfg *mcfg = &adapter->mesh_cfg;
struct mesh_plink_pool *plink_ctl = &minfo->plink_ctl;
bool acnode = 0;
if (IS_CH_WAITING(rfctl) && !IS_UNDER_CAC(rfctl))
goto exit;
@ -413,8 +666,16 @@ void rtw_chk_candidate_peer_notify(_adapter *adapter, struct wlan_network *scann
if (plink_ctl->num >= RTW_MESH_MAX_PEER_CANDIDATES)
goto exit;
#if CONFIG_RTW_MESH_ACNODE_PREVENT
if (plink_ctl->acnode_rsvd) {
acnode = rtw_mesh_scanned_is_acnode_confirmed(adapter, scanned);
if (acnode && !rtw_mesh_scanned_is_acnode_allow_notify(adapter, scanned))
goto exit;
}
#endif
/* wpa_supplicant's auto peer will initiate peering when candidate peer is reported without max_peer_links consideration */
if (plink_ctl->num >= mcfg->max_peer_links)
if (plink_ctl->num >= mcfg->max_peer_links + acnode ? 1 : 0)
goto exit;
if (rtw_get_passing_time_ms(scanned->last_scanned) >= mcfg->peer_sel_policy.scanr_exp_ms
@ -433,14 +694,19 @@ void rtw_chk_candidate_peer_notify(_adapter *adapter, struct wlan_network *scann
)
goto exit;
#if CONFIG_RTW_MESH_ACNODE_PREVENT
if (acnode) {
scanned->acnode_notify_etime = 0;
RTW_INFO(FUNC_ADPT_FMT" acnode "MAC_FMT"\n"
, FUNC_ADPT_ARG(adapter), MAC_ARG(scanned->network.MacAddress));
}
#endif
#ifdef CONFIG_IOCTL_CFG80211
rtw_cfg80211_notify_new_peer_candidate(adapter->rtw_wdev
, scanned->network.MacAddress
, BSS_EX_TLV_IES(&scanned->network)
, BSS_EX_TLV_IES_LEN(&scanned->network)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0))
, scanned->network.Rssi
#endif
, GFP_ATOMIC
);
#endif
@ -464,7 +730,7 @@ void rtw_mesh_peer_status_chk(_adapter *adapter)
u8 cto_mgate, forwarding, mgate;
#endif
u8 flush;
char flush_list[NUM_STA];
s8 flush_list[NUM_STA];
u8 flush_num = 0;
int i;
@ -582,14 +848,19 @@ flush_add:
exit_critical_bh(&(plink_ctl->lock));
for (i = 0; i < flush_num; i++) {
if (flush_num) {
u8 sta_addr[ETH_ALEN];
u8 updated = _FALSE;
sta = rtw_get_stainfo_by_offset(stapriv, flush_list[i]);
_rtw_memcpy(sta_addr, sta->cmn.mac_addr, ETH_ALEN);
for (i = 0; i < flush_num; i++) {
sta = rtw_get_stainfo_by_offset(stapriv, flush_list[i]);
_rtw_memcpy(sta_addr, sta->cmn.mac_addr, ETH_ALEN);
ap_free_sta(adapter, sta, _TRUE, WLAN_REASON_DEAUTH_LEAVING, _FALSE);
rtw_mesh_expire_peer(adapter, sta_addr);
updated |= ap_free_sta(adapter, sta, _TRUE, WLAN_REASON_DEAUTH_LEAVING, _FALSE);
rtw_mesh_expire_peer(adapter, sta_addr);
}
associated_clients_update(adapter, updated, STA_INFO_UPDATE_ALL);
}
#if CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST
@ -597,6 +868,10 @@ flush_add:
rtw_mesh_cto_mgate_blacklist_chk(adapter);
#endif
#if CONFIG_RTW_MESH_ACNODE_PREVENT
rtw_mesh_acnode_rsvd_chk(adapter);
#endif
return;
}
@ -654,10 +929,12 @@ u8 rtw_mesh_offch_candidate_accepted(_adapter *adapter)
{
struct rtw_mesh_info *minfo = &adapter->mesh_info;
struct mesh_plink_pool *plink_ctl = &minfo->plink_ctl;
u8 ret;
u8 ret = 0;
ret = MLME_IS_MESH(adapter)
&& check_fwstate(&adapter->mlmepriv, WIFI_ASOC_STATE) == _TRUE
if (!adapter->mesh_cfg.peer_sel_policy.offch_cand)
goto exit;
ret = MLME_IS_MESH(adapter) && MLME_IS_ASOC(adapter)
&& (!plink_ctl->num || rtw_mesh_offch_cto_mgate_required(adapter))
;
@ -666,12 +943,12 @@ u8 rtw_mesh_offch_candidate_accepted(_adapter *adapter)
struct mi_state mstate_no_self;
rtw_mi_status_no_self(adapter, &mstate_no_self);
if (MSTATE_STA_LD_NUM(&mstate_no_self) || MSTATE_AP_LD_NUM(&mstate_no_self)
|| MSTATE_ADHOC_LD_NUM(&mstate_no_self) || MSTATE_MESH_LD_NUM(&mstate_no_self))
if (MSTATE_STA_LD_NUM(&mstate_no_self))
ret = 0;
}
#endif
exit:
return ret;
}
@ -689,12 +966,15 @@ u8 rtw_mesh_select_operating_ch(_adapter *adapter)
_irqL irqL;
struct wlan_network *scanned = NULL;
int i;
/* statistics for candidate accept peering */
u8 cand_ap_cnt[MAX_CHANNEL_NUM] = {0};
u8 max_cand_ap_ch = 0;
u8 max_cand_ap_cnt = 0;
/* statistics for candidate including not accept peering */
u8 cand_cnt[MAX_CHANNEL_NUM] = {0};
u8 max_cand_ch = 0;
u8 max_cand_cnt = 0;
for (i = 0; i < rfctl->max_chan_nums; i++)
rfctl->channel_set[i].mesh_candidate_cnt = 0;
_enter_critical_bh(&(mlme->scanned_queue.lock), &irqL);
head = get_list_head(queue);
@ -708,7 +988,7 @@ u8 rtw_mesh_select_operating_ch(_adapter *adapter)
#if CONFIG_RTW_MACADDR_ACL
&& rtw_access_ctrl(adapter, scanned->network.MacAddress) == _TRUE
#endif
&& rtw_bss_is_candidate_mesh_peer(&mlme->cur_network.network, &scanned->network, 0, 1)
&& rtw_bss_is_candidate_mesh_peer(&mlme->cur_network.network, &scanned->network, 0, 0)
#if CONFIG_RTW_MESH_PEER_BLACKLIST
&& !rtw_mesh_peer_blacklist_search(adapter, scanned->network.MacAddress)
#endif
@ -721,18 +1001,38 @@ u8 rtw_mesh_select_operating_ch(_adapter *adapter)
if (ch_set_idx >= 0
&& !CH_IS_NON_OCP(&rfctl->channel_set[ch_set_idx])
) {
rfctl->channel_set[ch_set_idx].mesh_candidate_cnt++;
if (max_cand_cnt < rfctl->channel_set[ch_set_idx].mesh_candidate_cnt) {
max_cand_cnt = rfctl->channel_set[ch_set_idx].mesh_candidate_cnt;
u8 nop, accept;
rtw_mesh_bss_peering_status(&scanned->network, &nop, &accept);
cand_cnt[ch_set_idx]++;
if (max_cand_cnt < cand_cnt[ch_set_idx]) {
max_cand_cnt = cand_cnt[ch_set_idx];
max_cand_ch = rfctl->channel_set[ch_set_idx].ChannelNum;
}
if (accept) {
cand_ap_cnt[ch_set_idx]++;
if (max_cand_ap_cnt < cand_ap_cnt[ch_set_idx]) {
max_cand_ap_cnt = cand_ap_cnt[ch_set_idx];
max_cand_ap_ch = rfctl->channel_set[ch_set_idx].ChannelNum;
}
}
}
}
}
_exit_critical_bh(&(mlme->scanned_queue.lock), &irqL);
return max_cand_ch;
return max_cand_ap_ch ? max_cand_ap_ch : max_cand_ch;
}
void dump_mesh_offch_cand_settings(void *sel, _adapter *adapter)
{
struct mesh_peer_sel_policy *peer_sel_policy = &adapter->mesh_cfg.peer_sel_policy;
RTW_PRINT_SEL(sel, "%-6s %-11s\n"
, "enable", "find_int_ms");
RTW_PRINT_SEL(sel, "%6u %11u\n"
, peer_sel_policy->offch_cand, peer_sel_policy->offch_find_int_ms);
}
#endif /* CONFIG_RTW_MESH_OFFCH_CAND */
@ -740,36 +1040,24 @@ void dump_mesh_peer_sel_policy(void *sel, _adapter *adapter)
{
struct mesh_peer_sel_policy *peer_sel_policy = &adapter->mesh_cfg.peer_sel_policy;
#if CONFIG_RTW_MESH_OFFCH_CAND
#define OFFCH_CAND_TITLE_FMT " %-17s"
#define OFFCH_CAND_VALUE_FMT " %17u"
#define OFFCH_CAND_TITLE_ARG , "offch_find_int_ms"
#define OFFCH_CAND_VALUE_ARG , peer_sel_policy->offch_find_int_ms
#else
#define OFFCH_CAND_TITLE_FMT ""
#define OFFCH_CAND_VALUE_FMT ""
#define OFFCH_CAND_TITLE_ARG
#define OFFCH_CAND_VALUE_ARG
#endif
RTW_PRINT_SEL(sel,
"%-12s"
OFFCH_CAND_TITLE_FMT
"\n"
, "scanr_exp_ms"
OFFCH_CAND_TITLE_ARG
);
RTW_PRINT_SEL(sel,
"%12u"
OFFCH_CAND_VALUE_FMT
"\n"
, peer_sel_policy->scanr_exp_ms
OFFCH_CAND_VALUE_ARG
);
RTW_PRINT_SEL(sel, "%-12s\n", "scanr_exp_ms");
RTW_PRINT_SEL(sel, "%12u\n", peer_sel_policy->scanr_exp_ms);
}
void dump_mesh_networks(void *sel, _adapter *adapter)
{
#if CONFIG_RTW_MESH_ACNODE_PREVENT
#define NSTATE_TITLE_FMT_ACN " %-5s"
#define NSTATE_VALUE_FMT_ACN " %5d"
#define NSTATE_TITLE_ARG_ACN , "acn"
#define NSTATE_VALUE_ARG_ACN , (acn_ms < 99999 ? acn_ms : 99999)
#else
#define NSTATE_TITLE_FMT_ACN ""
#define NSTATE_VALUE_FMT_ACN ""
#define NSTATE_TITLE_ARG_ACN
#define NSTATE_VALUE_ARG_ACN
#endif
struct mlme_priv *mlme = &(adapter->mlmepriv);
_queue *queue = &(mlme->scanned_queue);
struct wlan_network *network;
@ -780,13 +1068,16 @@ void dump_mesh_networks(void *sel, _adapter *adapter)
u8 blocked;
u8 established;
s32 age_ms;
#if CONFIG_RTW_MESH_ACNODE_PREVENT
s32 acn_ms;
#endif
u8 *mesh_conf_ie;
sint mesh_conf_ie_len;
struct wlan_network **mesh_networks;
u8 mesh_network_cnt = 0;
int i;
mesh_networks = rtw_zvmalloc(MAX_BSS_CNT * sizeof(struct wlan_network *));
mesh_networks = rtw_zvmalloc(mlme->max_bss_cnt * sizeof(struct wlan_network *));
if (!mesh_networks)
return;
@ -811,9 +1102,12 @@ void dump_mesh_networks(void *sel, _adapter *adapter)
exit_critical_bh(&queue->lock);
RTW_PRINT_SEL(sel, " %-17s %-3s %-4s %-5s %-32s %-3s %-3s %-3s\n"
, "bssid", "ch", "rssi", "age", "mesh_id", "nop", "fwd", "cto");
RTW_PRINT_SEL(sel, " %-17s %-3s %-4s %-5s %-32s %-3s %-3s %-3s"
NSTATE_TITLE_FMT_ACN
"\n"
, "bssid", "ch", "rssi", "age", "mesh_id", "nop", "fwd", "cto"
NSTATE_TITLE_ARG_ACN
);
for (i = 0; i < mesh_network_cnt; i++) {
network = mesh_networks[i];
@ -827,6 +1121,12 @@ void dump_mesh_networks(void *sel, _adapter *adapter)
continue;
age_ms = rtw_get_passing_time_ms(network->last_scanned);
#if CONFIG_RTW_MESH_ACNODE_PREVENT
if (network->acnode_stime == 0)
acn_ms = 0;
else
acn_ms = rtw_get_passing_time_ms(network->acnode_stime);
#endif
same_mbss = 0;
candidate = 0;
plink = NULL;
@ -847,7 +1147,9 @@ void dump_mesh_networks(void *sel, _adapter *adapter)
same_mbss = 1;
}
RTW_PRINT_SEL(sel, "%c "MAC_FMT" %3d %4ld %5d %-32s %c%2u %3u %c%c \n"
RTW_PRINT_SEL(sel, "%c "MAC_FMT" %3d %4ld %5d %-32s %c%2u %3u %c%c "
NSTATE_VALUE_FMT_ACN
"\n"
, established ? 'E' : (blocked ? 'B' : (plink ? 'N' : (candidate ? 'C' : (same_mbss ? 'S' : ' '))))
, MAC_ARG(network->network.MacAddress)
, network->network.Configuration.DSConfig
@ -859,10 +1161,22 @@ void dump_mesh_networks(void *sel, _adapter *adapter)
, GET_MESH_CONF_ELE_FORWARDING(mesh_conf_ie + 2)
, GET_MESH_CONF_ELE_CTO_MGATE(mesh_conf_ie + 2) ? 'G' : ' '
, GET_MESH_CONF_ELE_CTO_AS(mesh_conf_ie + 2) ? 'A' : ' '
NSTATE_VALUE_ARG_ACN
);
}
rtw_vmfree(mesh_networks, MAX_BSS_CNT * sizeof(struct wlan_network *));
rtw_vmfree(mesh_networks, mlme->max_bss_cnt * sizeof(struct wlan_network *));
}
void rtw_mesh_adjust_chbw(u8 req_ch, u8 *req_bw, u8 *req_offset)
{
if (req_ch >= 5 && req_ch <= 9) {
/* prevent secondary channel offset mismatch */
if (*req_bw > CHANNEL_WIDTH_20) {
*req_bw = CHANNEL_WIDTH_20;
*req_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
}
}
}
int rtw_sae_check_frames(_adapter *adapter, const u8 *buf, u32 len, u8 tx)
@ -1136,37 +1450,37 @@ struct mpm_frame_info {
};
/*
* pid:0x0000 llid:0x0000 chosen_pmk:0x00000000000000000000000000000000
* aid:0x0000 pid:0x0000 llid:0x0000 plid:0x0000 chosen_pmk:0x00000000000000000000000000000000
* pid:0x0000 llid:0x0000 plid:0x0000 reason:0x0000 chosen_pmk:0x00000000000000000000000000000000
* pid:00000 llid:00000 chosen_pmk:0x00000000000000000000000000000000
* aid:00000 pid:00000 llid:00000 plid:00000 chosen_pmk:0x00000000000000000000000000000000
* pid:00000 llid:00000 plid:00000 reason:00000 chosen_pmk:0x00000000000000000000000000000000
*/
#define MPM_LOG_BUF_LEN 96 /* this length is limited for legal combination */
#define MPM_LOG_BUF_LEN 92 /* this length is limited for legal combination */
static void rtw_mpm_info_msg(struct mpm_frame_info *mpm_info, u8 *mpm_log_buf)
{
int cnt = 0;
if (mpm_info->aid) {
cnt += snprintf(mpm_log_buf + cnt, MPM_LOG_BUF_LEN - cnt - 1, "aid:0x%04x ", mpm_info->aid_v);
cnt += snprintf(mpm_log_buf + cnt, MPM_LOG_BUF_LEN - cnt - 1, "aid:%u ", mpm_info->aid_v);
if (cnt >= MPM_LOG_BUF_LEN - 1)
goto exit;
}
if (mpm_info->pid) {
cnt += snprintf(mpm_log_buf + cnt, MPM_LOG_BUF_LEN - cnt - 1, "pid:0x%04x ", mpm_info->pid_v);
cnt += snprintf(mpm_log_buf + cnt, MPM_LOG_BUF_LEN - cnt - 1, "pid:%u ", mpm_info->pid_v);
if (cnt >= MPM_LOG_BUF_LEN - 1)
goto exit;
}
if (mpm_info->llid) {
cnt += snprintf(mpm_log_buf + cnt, MPM_LOG_BUF_LEN - cnt - 1, "llid:0x%04x ", mpm_info->llid_v);
cnt += snprintf(mpm_log_buf + cnt, MPM_LOG_BUF_LEN - cnt - 1, "llid:%u ", mpm_info->llid_v);
if (cnt >= MPM_LOG_BUF_LEN - 1)
goto exit;
}
if (mpm_info->plid) {
cnt += snprintf(mpm_log_buf + cnt, MPM_LOG_BUF_LEN - cnt - 1, "plid:0x%04x ", mpm_info->plid_v);
cnt += snprintf(mpm_log_buf + cnt, MPM_LOG_BUF_LEN - cnt - 1, "plid:%u ", mpm_info->plid_v);
if (cnt >= MPM_LOG_BUF_LEN - 1)
goto exit;
}
if (mpm_info->reason) {
cnt += snprintf(mpm_log_buf + cnt, MPM_LOG_BUF_LEN - cnt - 1, "reason:0x%04x ", mpm_info->reason_v);
cnt += snprintf(mpm_log_buf + cnt, MPM_LOG_BUF_LEN - cnt - 1, "reason:%u ", mpm_info->reason_v);
if (cnt >= MPM_LOG_BUF_LEN - 1)
goto exit;
}
@ -1348,6 +1662,40 @@ bypass_sync_bss:
rtw_mesh_plink_set_peer_conf_timeout(adapter, peer_addr);
} else
#endif
#if CONFIG_RTW_MESH_ACNODE_PREVENT
if (action == RTW_ACT_SELF_PROTECTED_MESH_CLOSE) {
if (tx && mpm_info.reason && mpm_info.reason_v == WLAN_REASON_MESH_MAX_PEERS) {
if (rtw_mesh_scanned_is_acnode_confirmed(adapter, plink->scanned)
&& rtw_mesh_acnode_prevent_allow_sacrifice(adapter)
) {
struct sta_info *sac = rtw_mesh_acnode_prevent_pick_sacrifice(adapter);
if (sac) {
struct sta_priv *stapriv = &adapter->stapriv;
_irqL irqL;
u8 sta_addr[ETH_ALEN];
u8 updated = _FALSE;
_enter_critical_bh(&stapriv->asoc_list_lock, &irqL);
if (!rtw_is_list_empty(&sac->asoc_list)) {
rtw_list_delete(&sac->asoc_list);
stapriv->asoc_list_cnt--;
STA_SET_MESH_PLINK(sac, NULL);
}
_exit_critical_bh(&stapriv->asoc_list_lock, &irqL);
RTW_INFO(FUNC_ADPT_FMT" sacrifice "MAC_FMT" for acnode\n"
, FUNC_ADPT_ARG(adapter), MAC_ARG(sac->cmn.mac_addr));
_rtw_memcpy(sta_addr, sac->cmn.mac_addr, ETH_ALEN);
updated = ap_free_sta(adapter, sac, 0, 0, 1);
rtw_mesh_expire_peer(stapriv->padapter, sta_addr);
associated_clients_update(adapter, updated, STA_INFO_UPDATE_ALL);
}
}
}
} else
#endif
if (action == RTW_ACT_SELF_PROTECTED_MESH_CONF) {
_irqL irqL;
@ -1478,6 +1826,31 @@ int rtw_mesh_check_frames_rx(_adapter *adapter, const u8 *buf, size_t len)
return rtw_mesh_check_frames(adapter, &buf, &len, _FALSE);
}
int rtw_mesh_on_auth(_adapter *adapter, union recv_frame *rframe)
{
u8 *whdr = rframe->u.hdr.rx_data;
#if CONFIG_RTW_MACADDR_ACL
if (rtw_access_ctrl(adapter, get_addr2_ptr(whdr)) == _FALSE)
return _SUCCESS;
#endif
if (!rtw_mesh_plink_get(adapter, get_addr2_ptr(whdr))) {
#if CONFIG_RTW_MESH_ACNODE_PREVENT
rtw_mesh_acnode_set_notify_etime(adapter, whdr);
#endif
if (adapter_to_rfctl(adapter)->offch_state == OFFCHS_NONE)
issue_probereq(adapter, &adapter->mlmepriv.cur_network.network.mesh_id, get_addr2_ptr(whdr));
/* only peer being added (checked by notify conditions) is allowed */
return _SUCCESS;
}
rtw_cfg80211_rx_mframe(adapter, rframe, NULL);
return _SUCCESS;
}
unsigned int on_action_self_protected(_adapter *adapter, union recv_frame *rframe)
{
unsigned int ret = _FAIL;
@ -1581,6 +1954,10 @@ bool rtw_mesh_update_bss_peering_status(_adapter *adapter, WLAN_BSSID_EX *bss)
int ie_len;
bool updated = 0;
#if CONFIG_RTW_MESH_ACNODE_PREVENT
accept_peerings |= plink_ctl->acnode_rsvd;
#endif
ie = rtw_get_ie(BSS_EX_TLV_IES(bss), WLAN_EID_MESH_CONFIG, &ie_len, BSS_EX_TLV_IES_LEN(bss));
if (!ie || ie_len != 7) {
rtw_warn_on(1);
@ -1948,6 +2325,9 @@ void dump_mesh_plink_ctl(void *sel, _adapter *adapter)
int i;
RTW_PRINT_SEL(sel, "num:%u\n", plink_ctl->num);
#if CONFIG_RTW_MESH_ACNODE_PREVENT
RTW_PRINT_SEL(sel, "acnode_rsvd:%u\n", plink_ctl->acnode_rsvd);
#endif
for (i = 0; i < RTW_MESH_MAX_PEER_CANDIDATES; i++) {
ent = &plink_ctl->ent[i];
@ -2079,6 +2459,10 @@ int rtw_mesh_peer_establish(_adapter *adapter, struct mesh_plink_ent *plink, str
goto exit;
rtw_ap_parse_sta_wmm_ie(adapter, sta, tlv_ies, tlv_ieslen);
#ifdef CONFIG_RTS_FULL_BW
/*check vendor IE*/
rtw_parse_sta_vendor_ie_8812(adapter, sta, tlv_ies, tlv_ieslen);
#endif/*CONFIG_RTS_FULL_BW*/
rtw_ap_parse_sta_ht_ie(adapter, sta, &elems);
rtw_ap_parse_sta_vht_ie(adapter, sta, &elems);
@ -2106,7 +2490,8 @@ int rtw_mesh_peer_establish(_adapter *adapter, struct mesh_plink_ent *plink, str
_enter_critical_bh(&stapriv->asoc_list_lock, &irqL);
if (rtw_is_list_empty(&sta->asoc_list)) {
STA_SET_MESH_PLINK(sta, plink);
sta->expire_to = mcfg->plink_timeout / 2;
/* TBD: up layer timeout mechanism */
/* sta->expire_to = mcfg->plink_timeout / 2; */
rtw_list_insert_tail(&sta->asoc_list, &stapriv->asoc_list);
stapriv->asoc_list_cnt++;
}
@ -2131,9 +2516,6 @@ void rtw_mesh_expire_peer_notify(_adapter *adapter, const u8 *peer_addr)
, peer_addr
, null_ssid
, 2
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0))
, 0
#endif
, GFP_ATOMIC
);
#endif
@ -2593,13 +2975,58 @@ static int rtw_mesh_decache(_adapter *adapter, const u8 *msa, u32 seq)
return rtw_mrc_check(adapter, msa, seq);
}
#ifndef RTW_MESH_SCAN_RESULT_EXP_MS
#define RTW_MESH_SCAN_RESULT_EXP_MS (10 * 1000)
#endif
#ifndef RTW_MESH_ACNODE_PREVENT
#define RTW_MESH_ACNODE_PREVENT 0
#endif
#ifndef RTW_MESH_ACNODE_CONF_TIMEOUT_MS
#define RTW_MESH_ACNODE_CONF_TIMEOUT_MS (20 * 1000)
#endif
#ifndef RTW_MESH_ACNODE_NOTIFY_TIMEOUT_MS
#define RTW_MESH_ACNODE_NOTIFY_TIMEOUT_MS (2 * 1000)
#endif
#ifndef RTW_MESH_OFFCH_CAND
#define RTW_MESH_OFFCH_CAND 1
#endif
#ifndef RTW_MESH_OFFCH_CAND_FIND_INT_MS
#define RTW_MESH_OFFCH_CAND_FIND_INT_MS (10 * 1000)
#endif
#ifndef RTW_MESH_PEER_CONF_TIMEOUT_MS
#define RTW_MESH_PEER_CONF_TIMEOUT_MS (20 * 1000)
#endif
#ifndef RTW_MESH_PEER_BLACKLIST_TIMEOUT_MS
#define RTW_MESH_PEER_BLACKLIST_TIMEOUT_MS (20 * 1000)
#endif
#ifndef RTW_MESH_CTO_MGATE_REQUIRE
#define RTW_MESH_CTO_MGATE_REQUIRE 0
#endif
#ifndef RTW_MESH_CTO_MGATE_CONF_TIMEOUT_MS
#define RTW_MESH_CTO_MGATE_CONF_TIMEOUT_MS (20 * 1000)
#endif
#ifndef RTW_MESH_CTO_MGATE_BLACKLIST_TIMEOUT_MS
#define RTW_MESH_CTO_MGATE_BLACKLIST_TIMEOUT_MS (20 * 1000)
#endif
void rtw_mesh_cfg_init_peer_sel_policy(struct rtw_mesh_cfg *mcfg)
{
struct mesh_peer_sel_policy *sel_policy = &mcfg->peer_sel_policy;
sel_policy->scanr_exp_ms = RTW_MESH_SCAN_RESULT_EXP_MS;
#if CONFIG_RTW_MESH_ACNODE_PREVENT
sel_policy->acnode_prevent = RTW_MESH_ACNODE_PREVENT;
sel_policy->acnode_conf_timeout_ms = RTW_MESH_ACNODE_CONF_TIMEOUT_MS;
sel_policy->acnode_notify_timeout_ms = RTW_MESH_ACNODE_NOTIFY_TIMEOUT_MS;
#endif
#if CONFIG_RTW_MESH_OFFCH_CAND
sel_policy->offch_cand = RTW_MESH_OFFCH_CAND;
sel_policy->offch_find_int_ms = RTW_MESH_OFFCH_CAND_FIND_INT_MS;
#endif
@ -2609,7 +3036,7 @@ void rtw_mesh_cfg_init_peer_sel_policy(struct rtw_mesh_cfg *mcfg)
#endif
#if CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST
sel_policy->cto_mgate_require = 0;
sel_policy->cto_mgate_require = RTW_MESH_CTO_MGATE_REQUIRE;
sel_policy->cto_mgate_conf_timeout_ms = RTW_MESH_CTO_MGATE_CONF_TIMEOUT_MS;
sel_policy->cto_mgate_blacklist_timeout_ms = RTW_MESH_CTO_MGATE_BLACKLIST_TIMEOUT_MS;
#endif
@ -2641,6 +3068,10 @@ void rtw_mesh_cfg_init(_adapter *adapter)
mcfg->dot11MeshHWMPconfirmationInterval = RTW_MESH_ROOT_CONFIRMATION_INTERVAL;
mcfg->path_gate_timeout_factor = 3;
rtw_mesh_cfg_init_peer_sel_policy(mcfg);
#ifdef CONFIG_RTW_MESH_ADD_ROOT_CHK
mcfg->sane_metric_delta = RTW_MESH_SANE_METRIC_DELTA;
mcfg->max_root_add_chk_cnt = RTW_MESH_MAX_ROOT_ADD_CHK_CNT;
#endif
#if CONFIG_RTW_MESH_DATA_BMC_TO_UC
mcfg->b2u_flags_msrc = 0;
@ -3343,7 +3774,8 @@ endlookup:
#define RTW_MESH_DECACHE_BMC 1
#define RTW_MESH_DECACHE_UC 0
#define RTW_MESH_FORWARD_MDA_SELF_COND 1
#define RTW_MESH_FORWARD_MDA_SELF_COND 0
#define DBG_RTW_MESH_FORWARD_MDA_SELF_COND 0
int rtw_mesh_rx_msdu_act_check(union recv_frame *rframe
, const u8 *mda, const u8 *msa
, const u8 *da, const u8 *sa
@ -3463,57 +3895,90 @@ int rtw_mesh_rx_msdu_act_check(union recv_frame *rframe
} else {
/* mDA is self */
#if RTW_MESH_FORWARD_MDA_SELF_COND
u8 is_da_self = da == mda || _rtw_memcmp(da, adapter_mac_addr(adapter), ETH_ALEN);
if (is_da_self) {
if (da == mda
|| _rtw_memcmp(da, adapter_mac_addr(adapter), ETH_ALEN)
) {
/* DA is self, indicate */
act |= RTW_RX_MSDU_ACT_INDICATE;
goto exit;
}
/* DA is not self */
if (rtw_mesh_nexthop_lookup(adapter, da, msa, fwd_ra) == _SUCCESS) {
if (rtw_get_iface_by_macddr(adapter, da)) {
/* DA is buddy, indicate */
act |= RTW_RX_MSDU_ACT_INDICATE;
#if DBG_RTW_MESH_FORWARD_MDA_SELF_COND
RTW_INFO(FUNC_ADPT_FMT" DA("MAC_FMT") is buddy("ADPT_FMT")\n"
, FUNC_ADPT_ARG(adapter), MAC_ARG(da), ADPT_ARG(rtw_get_iface_by_macddr(adapter, da)));
#endif
goto exit;
}
/* DA is not self or buddy */
if (rtw_mesh_nexthop_lookup(adapter, da, msa, fwd_ra) == 0) {
/* DA is known in fwd info */
if (!mcfg->dot11MeshForwarding) {
/* path error to? */
#ifdef DBG_RX_DROP_FRAME
#if defined(DBG_RX_DROP_FRAME) || DBG_RTW_MESH_FORWARD_MDA_SELF_COND
RTW_INFO("DBG_RX_DROP_FRAME "FUNC_ADPT_FMT" DA("MAC_FMT") not self, !dot11MeshForwarding\n"
, FUNC_ADPT_ARG(adapter), MAC_ARG(da));
#endif
goto exit;
}
mda = da;
#if DBG_RTW_MESH_FORWARD_MDA_SELF_COND
RTW_INFO(FUNC_ADPT_FMT" fwd to DA("MAC_FMT"), fwd_RA("MAC_FMT")\n"
, FUNC_ADPT_ARG(adapter), MAC_ARG(da), MAC_ARG(fwd_ra));
#endif
goto fwd_chk;
}
rtw_rcu_read_lock();
mppath = rtw_mpp_path_lookup(adapter, da);
if (mppath && _rtw_memcmp(mppath->mpp, adapter_mac_addr(adapter), ETH_ALEN) == _FALSE) {
/* DA is reached by the other gate */
if (!mcfg->dot11MeshForwarding) {
/* path error to? */
#ifdef DBG_RX_DROP_FRAME
RTW_INFO("DBG_RX_DROP_FRAME "FUNC_ADPT_FMT" DA("MAC_FMT") is reached by proxy("MAC_FMT"), !dot11MeshForwarding\n"
, FUNC_ADPT_ARG(adapter), MAC_ARG(da), MAC_ARG(mppath->mpp));
#endif
if (mppath) {
if (_rtw_memcmp(mppath->mpp, adapter_mac_addr(adapter), ETH_ALEN) == _FALSE) {
/* DA is proxied by others */
if (!mcfg->dot11MeshForwarding) {
/* path error to? */
#if defined(DBG_RX_DROP_FRAME) || DBG_RTW_MESH_FORWARD_MDA_SELF_COND
RTW_INFO("DBG_RX_DROP_FRAME "FUNC_ADPT_FMT" DA("MAC_FMT") is proxied by ("MAC_FMT"), !dot11MeshForwarding\n"
, FUNC_ADPT_ARG(adapter), MAC_ARG(da), MAC_ARG(mppath->mpp));
#endif
rtw_rcu_read_unlock();
goto exit;
}
_rtw_memcpy(fwd_mpp, mppath->mpp, ETH_ALEN);
mda = fwd_mpp;
msa = adapter_mac_addr(adapter);
rtw_rcu_read_unlock();
goto exit;
}
_rtw_memcpy(fwd_mpp, mppath->mpp, ETH_ALEN);
mda = fwd_mpp;
msa = adapter_mac_addr(adapter);
rtw_rcu_read_unlock();
/* resolve RA */
if (rtw_mesh_nexthop_lookup(adapter, mda, msa, fwd_ra) != _SUCCESS) {
minfo->mshstats.dropped_frames_no_route++;
goto exit;
/* resolve RA */
if (rtw_mesh_nexthop_lookup(adapter, mda, msa, fwd_ra) != 0) {
minfo->mshstats.dropped_frames_no_route++;
#if defined(DBG_RX_DROP_FRAME) || DBG_RTW_MESH_FORWARD_MDA_SELF_COND
RTW_INFO("DBG_RX_DROP_FRAME "FUNC_ADPT_FMT" DA("MAC_FMT") is proxied by ("MAC_FMT"), RA resolve fail\n"
, FUNC_ADPT_ARG(adapter), MAC_ARG(da), MAC_ARG(mppath->mpp));
#endif
goto exit;
}
#if DBG_RTW_MESH_FORWARD_MDA_SELF_COND
RTW_INFO(FUNC_ADPT_FMT" DA("MAC_FMT") is proxied by ("MAC_FMT"), fwd_RA("MAC_FMT")\n"
, FUNC_ADPT_ARG(adapter), MAC_ARG(da), MAC_ARG(mppath->mpp), MAC_ARG(fwd_ra));
#endif
goto fwd_chk; /* forward to other gate */
} else {
#if DBG_RTW_MESH_FORWARD_MDA_SELF_COND
RTW_INFO(FUNC_ADPT_FMT" DA("MAC_FMT") is proxied by self\n"
, FUNC_ADPT_ARG(adapter), MAC_ARG(da));
#endif
}
goto fwd_chk; /* forward to other gate */
}
}
rtw_rcu_read_unlock();
if (!mppath) {
#if DBG_RTW_MESH_FORWARD_MDA_SELF_COND
RTW_INFO(FUNC_ADPT_FMT" DA("MAC_FMT") unknown\n"
, FUNC_ADPT_ARG(adapter), MAC_ARG(da));
#endif
/* DA is unknown */
#if 0 /* TODO: flags with AE bit */
rtw_mesh_path_error_tx(adapter
@ -3527,7 +3992,7 @@ int rtw_mesh_rx_msdu_act_check(union recv_frame *rframe
/*
* indicate to DS for both cases:
* 1.) DA is reached by self
* 1.) DA is proxied by self
* 2.) DA is unknown
*/
#endif /* RTW_MESH_FORWARD_MDA_SELF_COND */

View File

@ -19,25 +19,22 @@
#error "CONFIG_RTW_MESH can't be enabled when CONFIG_AP_MODE is not defined\n"
#endif
#ifndef RTW_MESH_SCAN_RESULT_EXP_MS
#define RTW_MESH_SCAN_RESULT_EXP_MS (10 * 1000)
#endif
#ifndef RTW_MESH_OFFCH_CAND_FIND_INT_MS
#define RTW_MESH_OFFCH_CAND_FIND_INT_MS (10 * 1000)
#endif
#define RTW_MESH_TTL 31
#define RTW_MESH_PERR_MIN_INT 100
#define RTW_MESH_TTL 31
#define RTW_MESH_PERR_MIN_INT 100
#define RTW_MESH_DEFAULT_ELEMENT_TTL 31
#define RTW_MESH_RANN_INTERVAL 5000
#define RTW_MESH_RANN_INTERVAL 5000
#define RTW_MESH_PATH_TO_ROOT_TIMEOUT 6000
#define RTW_MESH_DIAM_TRAVERSAL_TIME 50
#define RTW_MESH_PATH_TIMEOUT 5000
#define RTW_MESH_PREQ_MIN_INT 10
#define RTW_MESH_MAX_PREQ_RETRIES 4
#define RTW_MESH_PATH_TIMEOUT 5000
#define RTW_MESH_PREQ_MIN_INT 10
#define RTW_MESH_MAX_PREQ_RETRIES 4
#define RTW_MESH_MIN_DISCOVERY_TIMEOUT (2 * RTW_MESH_DIAM_TRAVERSAL_TIME)
#define RTW_MESH_ROOT_CONFIRMATION_INTERVAL 2000
#define RTW_MESH_PATH_REFRESH_TIME 1000
#define RTW_MESH_ROOT_INTERVAL 5000
#define RTW_MESH_ROOT_CONFIRMATION_INTERVAL 2000
#define RTW_MESH_PATH_REFRESH_TIME 1000
#define RTW_MESH_ROOT_INTERVAL 5000
#define RTW_MESH_SANE_METRIC_DELTA 100
#define RTW_MESH_MAX_ROOT_ADD_CHK_CNT 2
#define RTW_MESH_PLINK_UNKNOWN 0
#define RTW_MESH_PLINK_LISTEN 1
@ -105,8 +102,10 @@ extern const char *_rtw_mesh_ps_str[];
/* Max number of paths */
#define RTW_MESH_MAX_PATHS 1024
#define RTW_PREQ_Q_F_START 0x1
#define RTW_PREQ_Q_F_START 0x1
#define RTW_PREQ_Q_F_REFRESH 0x2
#define RTW_PREQ_Q_F_CHK 0x4
#define RTW_PREQ_Q_F_PEER_AKA 0x8
struct rtw_mesh_preq_queue {
_list list;
u8 dst[ETH_ALEN];
@ -242,6 +241,10 @@ struct mesh_plink_pool {
u8 num; /* current ent being used */
struct mesh_plink_ent ent[RTW_MESH_MAX_PEER_CANDIDATES];
#if CONFIG_RTW_MESH_ACNODE_PREVENT
u8 acnode_rsvd;
#endif
#if CONFIG_RTW_MESH_PEER_BLACKLIST
_queue peer_blacklist;
#endif
@ -250,16 +253,18 @@ struct mesh_plink_pool {
#endif
};
#define RTW_MESH_PEER_CONF_TIMEOUT_MS (20 * 1000)
#define RTW_MESH_PEER_BLACKLIST_TIMEOUT_MS (20 * 1000)
#define RTW_MESH_CTO_MGATE_CONF_TIMEOUT_MS (20 * 1000)
#define RTW_MESH_CTO_MGATE_BLACKLIST_TIMEOUT_MS (20 * 1000)
struct mesh_peer_sel_policy {
u32 scanr_exp_ms;
#if CONFIG_RTW_MESH_ACNODE_PREVENT
u8 acnode_prevent;
u32 acnode_conf_timeout_ms;
u32 acnode_notify_timeout_ms;
#endif
#if CONFIG_RTW_MESH_OFFCH_CAND
u32 offch_find_int_ms; /* 0 means no offch find by driver */
u8 offch_cand;
u32 offch_find_int_ms; /* 0 means no offch find triggerred by driver self*/
#endif
#if CONFIG_RTW_MESH_PEER_BLACKLIST
@ -293,6 +298,11 @@ struct mesh_peer_sel_policy {
|| ((flags & RTW_MESH_B2U_IP_MCAST) && (IP_MCAST_MAC(mda) || ICMPV6_MCAST_MAC(mda))) \
)
/**
* @sane_metric_delta: Controlling if trigger additional path check mechanism
* @max_root_add_chk_cnt: The retry cnt to send additional root confirmation
* PREQ through old(last) path
*/
struct rtw_mesh_cfg {
u8 max_peer_links; /* peering limit */
u32 plink_timeout; /* seconds */
@ -315,6 +325,10 @@ struct rtw_mesh_cfg {
u32 dot11MeshHWMPactivePathToRootTimeout;
u16 dot11MeshHWMProotInterval;
u8 path_gate_timeout_factor;
#ifdef CONFIG_RTW_MESH_ADD_ROOT_CHK
u16 sane_metric_delta;
u8 max_root_add_chk_cnt;
#endif
struct mesh_peer_sel_policy peer_sel_policy;
@ -370,6 +384,8 @@ struct rtw_mesh_info {
int mpp_paths_generation;
int num_gates;
struct rtw_mesh_path *max_addr_gate;
bool max_addr_gate_is_larger_than_self;
struct rtw_mesh_stats mshstats;
@ -401,9 +417,18 @@ void rtw_chk_candidate_peer_notify(_adapter *adapter, struct wlan_network *scann
void rtw_mesh_peer_status_chk(_adapter *adapter);
#if CONFIG_RTW_MESH_ACNODE_PREVENT
void rtw_mesh_update_scanned_acnode_status(_adapter *adapter, struct wlan_network *scanned);
bool rtw_mesh_scanned_is_acnode_confirmed(_adapter *adapter, struct wlan_network *scanned);
bool rtw_mesh_acnode_prevent_allow_sacrifice(_adapter *adapter);
struct sta_info *rtw_mesh_acnode_prevent_pick_sacrifice(_adapter *adapter);
void dump_mesh_acnode_prevent_settings(void *sel, _adapter *adapter);
#endif
#if CONFIG_RTW_MESH_OFFCH_CAND
u8 rtw_mesh_offch_candidate_accepted(_adapter *adapter);
u8 rtw_mesh_select_operating_ch(_adapter *adapter);
void dump_mesh_offch_cand_settings(void *sel, _adapter *adapter);
#endif
#if CONFIG_RTW_MESH_PEER_BLACKLIST
@ -427,10 +452,13 @@ void dump_mesh_cto_mgate_blacklist_settings(void *sel, _adapter *adapter);
void dump_mesh_peer_sel_policy(void *sel, _adapter *adapter);
void dump_mesh_networks(void *sel, _adapter *adapter);
void rtw_mesh_adjust_chbw(u8 req_ch, u8 *req_bw, u8 *req_offset);
int rtw_sae_check_frames(_adapter *adapter, const u8 *buf, u32 len, u8 tx);
int rtw_mesh_check_frames_tx(_adapter *adapter, const u8 **buf, size_t *len);
int rtw_mesh_check_frames_rx(_adapter *adapter, const u8 *buf, size_t len);
int rtw_mesh_on_auth(_adapter *adapter, union recv_frame *rframe);
unsigned int on_action_self_protected(_adapter *adapter, union recv_frame *rframe);
bool rtw_mesh_update_bss_peering_status(_adapter *adapter, WLAN_BSSID_EX *bss);

View File

@ -826,14 +826,16 @@ static void rtw_hwmp_prep_frame_process(_adapter *adapter,
target_addr = RTW_PREP_IE_TARGET_ADDR(prep_elem);
path = rtw_mesh_path_lookup(adapter, target_addr);
if (path && path->gate_asked) {
enter_critical_bh(&path->state_lock);
path->gate_asked = false;
exit_critical_bh(&path->state_lock);
flags = RTW_PREP_IE_FLAGS(prep_elem);
if ((flags & BIT(7)) && !(flags & RTW_IEEE80211_PREQ_IS_GATE_FLAG)) {
if (flags & BIT(7)) {
enter_critical_bh(&path->state_lock);
rtw_mesh_gate_del(adapter->mesh_info.mesh_paths, path);
path->gate_asked = false;
exit_critical_bh(&path->state_lock);
if (!(flags & RTW_IEEE80211_PREQ_IS_GATE_FLAG)) {
enter_critical_bh(&path->state_lock);
rtw_mesh_gate_del(adapter->mesh_info.mesh_paths, path);
exit_critical_bh(&path->state_lock);
}
}
}
@ -1000,9 +1002,26 @@ static void rtw_hwmp_rann_frame_process(_adapter *adapter,
rtw_root_path_confirmation_jiffies(adapter)) ||
rtw_time_before(rtw_get_current_time(), path->last_preq_to_root))) &&
!(path->flags & RTW_MESH_PATH_FIXED) && (ttl != 0)) {
u8 preq_node_flag = RTW_PREQ_Q_F_START | RTW_PREQ_Q_F_REFRESH;
RTW_HWMP_DBG("time to refresh root path "MAC_FMT"\n",
MAC_ARG(originator_addr));
rtw_mesh_queue_preq(path, RTW_PREQ_Q_F_START | RTW_PREQ_Q_F_REFRESH);
#ifdef CONFIG_RTW_MESH_ADD_ROOT_CHK
if (RTW_SN_LT(path->sn, originator_sn) &&
(path->rann_metric + mshcfg->sane_metric_delta < metric) &&
_rtw_memcmp(bcast_addr, path->rann_snd_addr, ETH_ALEN) == _FALSE) {
RTW_HWMP_DBG("Trigger additional check for root "
"confirm PREQ. rann_snd_addr = "MAC_FMT
"add_chk_rann_snd_addr= "MAC_FMT"\n",
MAC_ARG(mgmt->addr2),
MAC_ARG(path->rann_snd_addr));
_rtw_memcpy(path->add_chk_rann_snd_addr,
path->rann_snd_addr, ETH_ALEN);
preq_node_flag |= RTW_PREQ_Q_F_CHK;
}
#endif
rtw_mesh_queue_preq(path, preq_node_flag);
path->last_preq_to_root = rtw_get_current_time();
}
@ -1138,6 +1157,13 @@ static u32 rtw_hwmp_route_info_get(_adapter *adapter,
path->exp_time = rtw_time_after(path->exp_time, exp_time)
? path->exp_time : exp_time;
rtw_mesh_path_activate(path);
#ifdef CONFIG_RTW_MESH_ADD_ROOT_CHK
if (path->is_root && (action == RTW_MPATH_PREP)) {
_rtw_memcpy(path->rann_snd_addr,
mgmt->addr2, ETH_ALEN);
path->rann_metric = new_metric;
}
#endif
exit_critical_bh(&path->state_lock);
rtw_mesh_path_tx_pending(path);
} else
@ -1184,6 +1210,15 @@ static u32 rtw_hwmp_route_info_get(_adapter *adapter,
return process ? new_metric : 0;
}
static void rtw_mesh_rx_hwmp_frame_cnts(_adapter *adapter, u8 *addr)
{
struct sta_info *sta;
sta = rtw_get_stainfo(&adapter->stapriv, addr);
if (sta)
sta->sta_stats.rx_hwmp_pkts++;
}
void rtw_mesh_rx_path_sel_frame(_adapter *adapter, union recv_frame *rframe)
{
struct mesh_plink_ent *plink = NULL;
@ -1200,6 +1235,8 @@ void rtw_mesh_rx_path_sel_frame(_adapter *adapter, union recv_frame *rframe)
if (!plink || plink->plink_state != RTW_MESH_PLINK_ESTAB)
return;
rtw_mesh_rx_hwmp_frame_cnts(adapter, get_addr2_ptr(pframe));
/* Mesh action frame IE offset = 2 */
attrib->hdrlen = sizeof(struct rtw_ieee80211_hdr_3addr);
left = frame_len - attrib->hdrlen - attrib->iv_len - attrib->icv_len - 2;
@ -1276,6 +1313,12 @@ void rtw_mesh_queue_preq(struct rtw_mesh_path *path, u8 flags)
preq_node->flags = flags;
path->flags |= RTW_MESH_PATH_REQ_QUEUED;
#ifdef CONFIG_RTW_MESH_ADD_ROOT_CHK
if (flags & RTW_PREQ_Q_F_CHK)
path->flags |= RTW_MESH_PATH_ROOT_ADD_CHK;
#endif
if (flags & RTW_PREQ_Q_F_PEER_AKA)
path->flags |= RTW_MESH_PATH_PEER_AKA;
_rtw_spinunlock(&path->state_lock);
rtw_list_insert_tail(&preq_node->list, &minfo->preq_queue.list);
@ -1291,7 +1334,27 @@ void rtw_mesh_queue_preq(struct rtw_mesh_path *path, u8 flags)
rtw_mesh_work(&adapter->mesh_work);
} else
rtw_mod_timer(&adapter->mesh_path_timer, minfo->last_preq +
rtw_min_preq_int_jiff(adapter));
rtw_min_preq_int_jiff(adapter) + 1);
}
static const u8 *rtw_hwmp_preq_da(struct rtw_mesh_path *path,
BOOLEAN is_root_add_chk, BOOLEAN da_is_peer)
{
const u8 *da;
if (da_is_peer)
da = path->dst;
else if (path->is_root)
#ifdef CONFIG_RTW_MESH_ADD_ROOT_CHK
da = is_root_add_chk ? path->add_chk_rann_snd_addr:
path->rann_snd_addr;
#else
da = path->rann_snd_addr;
#endif
else
da = bcast_addr;
return da;
}
void rtw_mesh_path_start_discovery(_adapter *adapter)
@ -1304,6 +1367,8 @@ void rtw_mesh_path_start_discovery(_adapter *adapter)
const u8 *da;
u32 lifetime;
u8 flags = 0;
BOOLEAN is_root_add_chk = _FALSE;
BOOLEAN da_is_peer;
enter_critical_bh(&minfo->mesh_preq_queue_lock);
if (!minfo->preq_queue_len ||
@ -1368,8 +1433,14 @@ void rtw_mesh_path_start_discovery(_adapter *adapter)
else
target_flags &= ~RTW_IEEE80211_PREQ_TO_FLAG;
#ifdef CONFIG_RTW_MESH_ADD_ROOT_CHK
is_root_add_chk = !!(path->flags & RTW_MESH_PATH_ROOT_ADD_CHK);
#endif
da_is_peer = !!(path->flags & RTW_MESH_PATH_PEER_AKA);
exit_critical_bh(&path->state_lock);
da = (path->is_root) ? path->rann_snd_addr : bcast_addr;
da = rtw_hwmp_preq_da(path, is_root_add_chk, da_is_peer);
#ifdef CONFIG_RTW_MESH_ON_DMD_GANN
flags = (mshcfg->dot11MeshGateAnnouncementProtocol)
? RTW_IEEE80211_PREQ_IS_GATE_FLAG : 0;
@ -1389,7 +1460,10 @@ void rtw_mesh_path_timer(void *ctx)
struct rtw_mesh_path *path = (void *) ctx;
_adapter *adapter = path->adapter;
int ret;
u8 retry = 0;
#ifdef CONFIG_RTW_MESH_ADD_ROOT_CHK
struct rtw_mesh_cfg *mshcfg = &adapter->mesh_cfg;
#endif
/* TBD: Proctect for suspend */
#if 0
if (suspending)
@ -1398,18 +1472,30 @@ void rtw_mesh_path_timer(void *ctx)
enter_critical_bh(&path->state_lock);
if (path->flags & RTW_MESH_PATH_RESOLVED ||
(!(path->flags & RTW_MESH_PATH_RESOLVING))) {
path->flags &= ~(RTW_MESH_PATH_RESOLVING | RTW_MESH_PATH_RESOLVED);
path->flags &= ~(RTW_MESH_PATH_RESOLVING |
RTW_MESH_PATH_RESOLVED |
RTW_MESH_PATH_ROOT_ADD_CHK |
RTW_MESH_PATH_PEER_AKA);
exit_critical_bh(&path->state_lock);
} else if (path->discovery_retries < rtw_max_preq_retries(adapter)) {
++path->discovery_retries;
path->discovery_timeout *= 2;
path->flags &= ~RTW_MESH_PATH_REQ_QUEUED;
#ifdef CONFIG_RTW_MESH_ADD_ROOT_CHK
if (path->discovery_retries > mshcfg->max_root_add_chk_cnt)
path->flags &= ~RTW_MESH_PATH_ROOT_ADD_CHK;
#endif
if (path->gate_asked)
retry |= RTW_PREQ_Q_F_REFRESH;
exit_critical_bh(&path->state_lock);
rtw_mesh_queue_preq(path, 0);
rtw_mesh_queue_preq(path, retry);
} else {
path->flags &= ~(RTW_MESH_PATH_RESOLVING |
RTW_MESH_PATH_RESOLVED |
RTW_MESH_PATH_REQ_QUEUED);
RTW_MESH_PATH_REQ_QUEUED |
RTW_MESH_PATH_ROOT_ADD_CHK |
RTW_MESH_PATH_PEER_AKA);
path->exp_time = rtw_get_current_time();
exit_critical_bh(&path->state_lock);
if (!path->is_gate && rtw_mesh_gate_num(adapter) > 0) {
@ -1515,10 +1601,19 @@ void rtw_mesh_work_hdl(_workitem *work)
{
_adapter *adapter = container_of(work, _adapter, mesh_work);
if (adapter->mesh_info.preq_queue_len &&
rtw_time_after(rtw_get_current_time(),
adapter->mesh_info.last_preq + rtw_ms_to_systime(adapter->mesh_cfg.dot11MeshHWMPpreqMinInterval)))
rtw_mesh_path_start_discovery(adapter);
while(adapter->mesh_info.preq_queue_len) {
if (rtw_time_after(rtw_get_current_time(),
adapter->mesh_info.last_preq + rtw_min_preq_int_jiff(adapter)))
/* It will consume preq_queue_len */
rtw_mesh_path_start_discovery(adapter);
else {
struct rtw_mesh_info *minfo = &adapter->mesh_info;
rtw_mod_timer(&adapter->mesh_path_timer,
minfo->last_preq + rtw_min_preq_int_jiff(adapter) + 1);
break;
}
}
if (rtw_test_and_clear_bit(RTW_MESH_WORK_ROOT, &adapter->wrkq_flags))
rtw_ieee80211_mesh_rootpath(adapter);

View File

@ -324,6 +324,58 @@ rtw_mesh_path_lookup_by_idx(_adapter *adapter, int idx)
return __rtw_mesh_path_lookup_by_idx(adapter->mesh_info.mesh_paths, idx);
}
void dump_mpath(void *sel, _adapter *adapter)
{
struct rtw_mesh_path *mpath;
int idx = 0;
char dst[ETH_ALEN];
char next_hop[ETH_ALEN];
u32 sn, metric, qlen;
u32 exp_ms = 0, dto_ms;
u8 drty;
enum rtw_mesh_path_flags flags;
RTW_PRINT_SEL(sel, "%-17s %-17s %-10s %-10s %-4s %-6s %-6s %-4s flags\n"
, "dst", "next_hop", "sn", "metric", "qlen", "exp_ms", "dto_ms", "drty"
);
do {
rtw_rcu_read_lock();
mpath = rtw_mesh_path_lookup_by_idx(adapter, idx);
if (mpath) {
_rtw_memcpy(dst, mpath->dst, ETH_ALEN);
_rtw_memcpy(next_hop, mpath->next_hop->cmn.mac_addr, ETH_ALEN);
sn = mpath->sn;
metric = mpath->metric;
qlen = mpath->frame_queue_len;
if (rtw_time_after(mpath->exp_time, rtw_get_current_time()))
exp_ms = rtw_get_remaining_time_ms(mpath->exp_time);
dto_ms = rtw_systime_to_ms(mpath->discovery_timeout);
drty = mpath->discovery_retries;
flags = mpath->flags;
}
rtw_rcu_read_unlock();
if (mpath) {
RTW_PRINT_SEL(sel, MAC_FMT" "MAC_FMT" %10u %10u %4u %6u %6u %4u%s%s%s%s%s\n"
, MAC_ARG(dst), MAC_ARG(next_hop), sn, metric, qlen
, exp_ms < 999999 ? exp_ms : 999999
, dto_ms < 999999 ? dto_ms : 999999
, drty
, (flags & RTW_MESH_PATH_ACTIVE) ? " ACT" : ""
, (flags & RTW_MESH_PATH_RESOLVING) ? " RSVING" : ""
, (flags & RTW_MESH_PATH_SN_VALID) ? " SN_VALID" : ""
, (flags & RTW_MESH_PATH_FIXED) ? " FIXED" : ""
, (flags & RTW_MESH_PATH_RESOLVED) ? " RSVED" : ""
);
}
idx++;
} while (mpath);
}
/**
* rtw_mpp_path_lookup_by_idx - look up a path in the proxy path table by its index
* @idx: index
@ -374,12 +426,26 @@ int rtw_mesh_path_add_gate(struct rtw_mesh_path *mpath)
ori_num_gates = minfo->num_gates;
minfo->num_gates++;
rtw_hlist_add_head_rcu(&mpath->gate_list, &tbl->known_gates);
if (ori_num_gates == 0
|| rtw_macaddr_is_larger(mpath->dst, minfo->max_addr_gate->dst)
) {
minfo->max_addr_gate = mpath;
minfo->max_addr_gate_is_larger_than_self =
rtw_macaddr_is_larger(mpath->dst, adapter_mac_addr(mpath->adapter));
}
_rtw_spinunlock(&tbl->gates_lock);
exit_critical_bh(&mpath->state_lock);
if (ori_num_gates == 0)
if (ori_num_gates == 0) {
update_beacon(mpath->adapter, WLAN_EID_MESH_CONFIG, NULL, _TRUE);
#if CONFIG_RTW_MESH_CTO_MGATE_CARRIER
if (!rtw_mesh_cto_mgate_required(mpath->adapter))
rtw_netif_carrier_on(mpath->adapter->pnetdev);
#endif
}
RTW_MPATH_DBG(
FUNC_ADPT_FMT" Mesh path: Recorded new gate: %pM. %d known gates\n",
@ -414,10 +480,32 @@ void rtw_mesh_gate_del(struct rtw_mesh_table *tbl, struct rtw_mesh_path *mpath)
rtw_hlist_del_rcu(&mpath->gate_list);
ori_num_gates = minfo->num_gates;
minfo->num_gates--;
if (ori_num_gates == 1) {
minfo->max_addr_gate = NULL;
minfo->max_addr_gate_is_larger_than_self = 0;
} else if (minfo->max_addr_gate == mpath) {
struct rtw_mesh_path *gate, *max_addr_gate = NULL;
rtw_hlist_node *node;
rtw_hlist_for_each_entry_rcu(gate, node, &tbl->known_gates, gate_list) {
if (!max_addr_gate || rtw_macaddr_is_larger(gate->dst, max_addr_gate->dst))
max_addr_gate = gate;
}
minfo->max_addr_gate = max_addr_gate;
minfo->max_addr_gate_is_larger_than_self =
rtw_macaddr_is_larger(max_addr_gate->dst, adapter_mac_addr(mpath->adapter));
}
exit_critical_bh(&tbl->gates_lock);
if (ori_num_gates == 1)
if (ori_num_gates == 1) {
update_beacon(mpath->adapter, WLAN_EID_MESH_CONFIG, NULL, _TRUE);
#if CONFIG_RTW_MESH_CTO_MGATE_CARRIER
if (rtw_mesh_cto_mgate_required(mpath->adapter))
rtw_netif_carrier_off(mpath->adapter->pnetdev);
#endif
}
RTW_MPATH_DBG(
FUNC_ADPT_FMT" Mesh path: Deleted gate: %pM. %d known gates\n",
@ -458,6 +546,45 @@ int rtw_mesh_gate_num(_adapter *adapter)
return adapter->mesh_info.num_gates;
}
bool rtw_mesh_is_primary_gate(_adapter *adapter)
{
struct rtw_mesh_cfg *mcfg = &adapter->mesh_cfg;
struct rtw_mesh_info *minfo = &adapter->mesh_info;
return mcfg->dot11MeshGateAnnouncementProtocol
&& !minfo->max_addr_gate_is_larger_than_self;
}
void dump_known_gates(void *sel, _adapter *adapter)
{
struct rtw_mesh_info *minfo = &adapter->mesh_info;
struct rtw_mesh_table *tbl;
struct rtw_mesh_path *gate;
rtw_hlist_node *node;
if (!rtw_mesh_gate_num(adapter))
goto exit;
rtw_rcu_read_lock();
tbl = minfo->mesh_paths;
if (!tbl)
goto unlock;
RTW_PRINT_SEL(sel, "num:%d\n", rtw_mesh_gate_num(adapter));
rtw_hlist_for_each_entry_rcu(gate, node, &tbl->known_gates, gate_list) {
RTW_PRINT_SEL(sel, "%c"MAC_FMT"\n"
, gate == minfo->max_addr_gate ? '*' : ' '
, MAC_ARG(gate->dst));
}
unlock:
rtw_rcu_read_unlock();
exit:
return;
}
static
struct rtw_mesh_path *rtw_mesh_path_new(_adapter *adapter,
const u8 *dst)
@ -574,6 +701,34 @@ int rtw_mpp_path_add(_adapter *adapter,
return ret;
}
void dump_mpp(void *sel, _adapter *adapter)
{
struct rtw_mesh_path *mpath;
int idx = 0;
char dst[ETH_ALEN];
char mpp[ETH_ALEN];
RTW_PRINT_SEL(sel, "%-17s %-17s\n", "dst", "mpp");
do {
rtw_rcu_read_lock();
mpath = rtw_mpp_path_lookup_by_idx(adapter, idx);
if (mpath) {
_rtw_memcpy(dst, mpath->dst, ETH_ALEN);
_rtw_memcpy(mpp, mpath->mpp, ETH_ALEN);
}
rtw_rcu_read_unlock();
if (mpath) {
RTW_PRINT_SEL(sel, MAC_FMT" "MAC_FMT"\n"
, MAC_ARG(dst), MAC_ARG(mpp));
}
idx++;
} while (mpath);
}
/**
* rtw_mesh_plink_broken - deactivates paths and sends perr when a link breaks

View File

@ -38,7 +38,11 @@
* already queued up, waiting for the discovery process to start.
* @RTW_MESH_PATH_DELETED: the mesh path has been deleted and should no longer
* be used
*
* @RTW_MESH_PATH_ROOT_ADD_CHK: root additional check in root mode.
* With this flag, It will try the last used rann_snd_addr
* @RTW_MESH_PATH_PEER_AKA: only used toward a peer, only used in active keep
* alive mechanism. PREQ's da = path dst
*
* RTW_MESH_PATH_RESOLVED is used by the mesh path timer to
* decide when to stop or cancel the mesh path discovery.
*/
@ -50,6 +54,8 @@ enum rtw_mesh_path_flags {
RTW_MESH_PATH_RESOLVED = BIT(4),
RTW_MESH_PATH_REQ_QUEUED = BIT(5),
RTW_MESH_PATH_DELETED = BIT(6),
RTW_MESH_PATH_ROOT_ADD_CHK = BIT(7),
RTW_MESH_PATH_PEER_AKA = BIT(8),
};
/**
@ -111,6 +117,9 @@ struct rtw_mesh_path {
enum rtw_mesh_path_flags flags;
_lock state_lock;
u8 rann_snd_addr[ETH_ALEN];
#ifdef CONFIG_RTW_MESH_ADD_ROOT_CHK
u8 add_chk_rann_snd_addr[ETH_ALEN];
#endif
u32 rann_metric;
unsigned long last_preq_to_root;
bool is_root;
@ -153,8 +162,12 @@ struct rtw_mesh_path *rtw_mpp_path_lookup(_adapter *adapter,
const u8 *dst);
int rtw_mpp_path_add(_adapter *adapter,
const u8 *dst, const u8 *mpp);
void dump_mpp(void *sel, _adapter *adapter);
struct rtw_mesh_path *
rtw_mesh_path_lookup_by_idx(_adapter *adapter, int idx);
void dump_mpath(void *sel, _adapter *adapter);
struct rtw_mesh_path *
rtw_mpp_path_lookup_by_idx(_adapter *adapter, int idx);
void rtw_mesh_path_fix_nexthop(struct rtw_mesh_path *mpath, struct sta_info *next_hop);
@ -168,6 +181,8 @@ void rtw_mesh_gate_del(struct rtw_mesh_table *tbl, struct rtw_mesh_path *mpath);
bool rtw_mesh_gate_search(struct rtw_mesh_table *tbl, const u8 *addr);
int rtw_mesh_path_send_to_gates(struct rtw_mesh_path *mpath);
int rtw_mesh_gate_num(_adapter *adapter);
bool rtw_mesh_is_primary_gate(_adapter *adapter);
void dump_known_gates(void *sel, _adapter *adapter);
void rtw_mesh_plink_broken(struct sta_info *sta);

File diff suppressed because it is too large Load Diff

View File

@ -1071,7 +1071,7 @@ static u8 _bfer_set_entry_gid(PADAPTER adapter, u8 *addr, u8 *gid, u8 *position)
struct beamformer_entry bfer;
memset(&bfer, 0, sizeof(bfer));
memcpy(bfer.mac_addr, addr, 6);
memcpy(bfer.mac_addr, addr, ETH_ALEN);
/* Parsing Membership Status Array */
memcpy(bfer.gid_valid, gid, 8);
@ -3047,7 +3047,7 @@ void beamforming_wk_hdl(_adapter *padapter, u8 type, u8 *pbuf)
struct sta_info *psta = (PVOID)pbuf;
u16 staIdx = psta->cmn.mac_id;
beamforming_enter(pDM_Odm, staIdx);
beamforming_enter(pDM_Odm, staIdx, adapter_mac_addr(psta->padapter));
break;
}
case BEAMFORMING_CTRL_LEAVE:

View File

@ -301,7 +301,7 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char
return 0;
}
#ifdef SUPPORT_RX_UNI2MCAST
static void convert_ipv6_mac_to_mc(struct sk_buff *skb)
{
struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN);
@ -319,6 +319,7 @@ static void convert_ipv6_mac_to_mc(struct sk_buff *skb)
#endif
}
#endif /* CL_IPV6_PASS */
#endif /* SUPPORT_RX_UNI2MCAST */
static __inline__ int __nat25_network_hash(unsigned char *networkAddr)

View File

@ -437,7 +437,6 @@ u8 rtw_btcoex_LPS_Leave(PADAPTER padapter)
if (pwrpriv->pwr_mode != PS_MODE_ACTIVE) {
rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "BTCOEX");
LPS_RF_ON_check(padapter, 100);
pwrpriv->bpower_saving = _FALSE;
}

View File

@ -26,6 +26,11 @@ void rtw_btcoex_wifionly_scan_notify(PADAPTER padapter)
hal_btcoex_wifionly_scan_notify(padapter);
}
void rtw_btcoex_wifionly_connect_notify(PADAPTER padapter)
{
hal_btcoex_wifionly_connect_notify(padapter);
}
void rtw_btcoex_wifionly_hw_config(PADAPTER padapter)
{
hal_btcoex_wifionly_hw_config(padapter);

1193
core/rtw_chplan.c Normal file

File diff suppressed because it is too large Load Diff

181
core/rtw_chplan.h Normal file
View File

@ -0,0 +1,181 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2018 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*****************************************************************************/
#ifndef __RTW_CHPLAN_H__
#define __RTW_CHPLAN_H__
enum rtw_chplan_id {
/* ===== 0x00 ~ 0x1F, legacy channel plan ===== */
RTW_CHPLAN_FCC = 0x00,
RTW_CHPLAN_IC = 0x01,
RTW_CHPLAN_ETSI = 0x02,
RTW_CHPLAN_SPAIN = 0x03,
RTW_CHPLAN_FRANCE = 0x04,
RTW_CHPLAN_MKK = 0x05,
RTW_CHPLAN_MKK1 = 0x06,
RTW_CHPLAN_ISRAEL = 0x07,
RTW_CHPLAN_TELEC = 0x08,
RTW_CHPLAN_GLOBAL_DOAMIN = 0x09,
RTW_CHPLAN_WORLD_WIDE_13 = 0x0A,
RTW_CHPLAN_TAIWAN = 0x0B,
RTW_CHPLAN_CHINA = 0x0C,
RTW_CHPLAN_SINGAPORE_INDIA_MEXICO = 0x0D,
RTW_CHPLAN_KOREA = 0x0E,
RTW_CHPLAN_TURKEY = 0x0F,
RTW_CHPLAN_JAPAN = 0x10,
RTW_CHPLAN_FCC_NO_DFS = 0x11,
RTW_CHPLAN_JAPAN_NO_DFS = 0x12,
RTW_CHPLAN_WORLD_WIDE_5G = 0x13,
RTW_CHPLAN_TAIWAN_NO_DFS = 0x14,
/* ===== 0x20 ~ 0x7F, new channel plan ===== */
RTW_CHPLAN_WORLD_NULL = 0x20,
RTW_CHPLAN_ETSI1_NULL = 0x21,
RTW_CHPLAN_FCC1_NULL = 0x22,
RTW_CHPLAN_MKK1_NULL = 0x23,
RTW_CHPLAN_ETSI2_NULL = 0x24,
RTW_CHPLAN_FCC1_FCC1 = 0x25,
RTW_CHPLAN_WORLD_ETSI1 = 0x26,
RTW_CHPLAN_MKK1_MKK1 = 0x27,
RTW_CHPLAN_WORLD_KCC1 = 0x28,
RTW_CHPLAN_WORLD_FCC2 = 0x29,
RTW_CHPLAN_FCC2_NULL = 0x2A,
RTW_CHPLAN_IC1_IC2 = 0x2B,
RTW_CHPLAN_MKK2_NULL = 0x2C,
RTW_CHPLAN_WORLD_CHILE1= 0x2D,
RTW_CHPLAN_WORLD1_WORLD1 = 0x2E,
RTW_CHPLAN_WORLD_CHILE2 = 0x2F,
RTW_CHPLAN_WORLD_FCC3 = 0x30,
RTW_CHPLAN_WORLD_FCC4 = 0x31,
RTW_CHPLAN_WORLD_FCC5 = 0x32,
RTW_CHPLAN_WORLD_FCC6 = 0x33,
RTW_CHPLAN_FCC1_FCC7 = 0x34,
RTW_CHPLAN_WORLD_ETSI2 = 0x35,
RTW_CHPLAN_WORLD_ETSI3 = 0x36,
RTW_CHPLAN_MKK1_MKK2 = 0x37,
RTW_CHPLAN_MKK1_MKK3 = 0x38,
RTW_CHPLAN_FCC1_NCC1 = 0x39,
RTW_CHPLAN_ETSI1_ETSI1 = 0x3A,
RTW_CHPLAN_ETSI1_ACMA1 = 0x3B,
RTW_CHPLAN_ETSI1_ETSI6 = 0x3C,
RTW_CHPLAN_ETSI1_ETSI12 = 0x3D,
RTW_CHPLAN_KCC1_KCC2 = 0x3E,
RTW_CHPLAN_FCC1_FCC11 = 0x3F,
RTW_CHPLAN_FCC1_NCC2 = 0x40,
RTW_CHPLAN_GLOBAL_NULL = 0x41,
RTW_CHPLAN_ETSI1_ETSI4 = 0x42,
RTW_CHPLAN_FCC1_FCC2 = 0x43,
RTW_CHPLAN_FCC1_NCC3 = 0x44,
RTW_CHPLAN_WORLD_ACMA1 = 0x45,
RTW_CHPLAN_FCC1_FCC8 = 0x46,
RTW_CHPLAN_WORLD_ETSI6 = 0x47,
RTW_CHPLAN_WORLD_ETSI7 = 0x48,
RTW_CHPLAN_WORLD_ETSI8 = 0x49,
RTW_CHPLAN_IC2_IC2 = 0x4A,
RTW_CHPLAN_WORLD_ETSI9 = 0x50,
RTW_CHPLAN_WORLD_ETSI10 = 0x51,
RTW_CHPLAN_WORLD_ETSI11 = 0x52,
RTW_CHPLAN_FCC1_NCC4 = 0x53,
RTW_CHPLAN_WORLD_ETSI12 = 0x54,
RTW_CHPLAN_FCC1_FCC9 = 0x55,
RTW_CHPLAN_WORLD_ETSI13 = 0x56,
RTW_CHPLAN_FCC1_FCC10 = 0x57,
RTW_CHPLAN_MKK2_MKK4 = 0x58,
RTW_CHPLAN_WORLD_ETSI14 = 0x59,
RTW_CHPLAN_FCC1_FCC5 = 0x60,
RTW_CHPLAN_FCC2_FCC7 = 0x61,
RTW_CHPLAN_FCC2_FCC1 = 0x62,
RTW_CHPLAN_WORLD_ETSI15 = 0x63,
RTW_CHPLAN_MKK2_MKK5 = 0x64,
RTW_CHPLAN_ETSI1_ETSI16 = 0x65,
RTW_CHPLAN_FCC1_FCC14 = 0x66,
RTW_CHPLAN_FCC1_FCC12 = 0x67,
RTW_CHPLAN_FCC2_FCC14 = 0x68,
RTW_CHPLAN_FCC2_FCC12 = 0x69,
RTW_CHPLAN_ETSI1_ETSI17 = 0x6A,
RTW_CHPLAN_WORLD_FCC16 = 0x6B,
RTW_CHPLAN_WORLD_FCC13 = 0x6C,
RTW_CHPLAN_FCC2_FCC15 = 0x6D,
RTW_CHPLAN_WORLD_FCC12 = 0x6E,
RTW_CHPLAN_NULL_ETSI8 = 0x6F,
RTW_CHPLAN_NULL_ETSI18 = 0x70,
RTW_CHPLAN_NULL_ETSI17 = 0x71,
RTW_CHPLAN_NULL_ETSI19 = 0x72,
RTW_CHPLAN_WORLD_FCC7 = 0x73,
RTW_CHPLAN_FCC2_FCC17 = 0x74,
RTW_CHPLAN_WORLD_ETSI20 = 0x75,
RTW_CHPLAN_FCC2_FCC11 = 0x76,
RTW_CHPLAN_WORLD_ETSI21 = 0x77,
RTW_CHPLAN_FCC1_FCC18 = 0x78,
RTW_CHPLAN_MKK2_MKK1 = 0x79,
RTW_CHPLAN_MAX,
RTW_CHPLAN_REALTEK_DEFINE = 0x7F,
RTW_CHPLAN_UNSPECIFIED = 0xFF,
};
u8 rtw_chplan_get_default_regd(u8 id);
bool rtw_chplan_is_empty(u8 id);
#define rtw_is_channel_plan_valid(chplan) (((chplan) < RTW_CHPLAN_MAX || (chplan) == RTW_CHPLAN_REALTEK_DEFINE) && !rtw_chplan_is_empty(chplan))
#define rtw_is_legacy_channel_plan(chplan) ((chplan) < 0x20)
struct _RT_CHANNEL_INFO;
u8 init_channel_set(_adapter *padapter, u8 ChannelPlan, struct _RT_CHANNEL_INFO *channel_set);
#define IS_ALPHA2_NO_SPECIFIED(_alpha2) ((*((u16 *)(_alpha2))) == 0xFFFF)
#define RTW_MODULE_RTL8821AE_HMC_M2 BIT0 /* RTL8821AE(HMC + M.2) */
#define RTW_MODULE_RTL8821AU BIT1 /* RTL8821AU */
#define RTW_MODULE_RTL8812AENF_NGFF BIT2 /* RTL8812AENF(8812AE+8761)_NGFF */
#define RTW_MODULE_RTL8812AEBT_HMC BIT3 /* RTL8812AEBT(8812AE+8761)_HMC */
#define RTW_MODULE_RTL8188EE_HMC_M2 BIT4 /* RTL8188EE(HMC + M.2) */
#define RTW_MODULE_RTL8723BE_HMC_M2 BIT5 /* RTL8723BE(HMC + M.2) */
#define RTW_MODULE_RTL8723BS_NGFF1216 BIT6 /* RTL8723BS(NGFF1216) */
#define RTW_MODULE_RTL8192EEBT_HMC_M2 BIT7 /* RTL8192EEBT(8192EE+8761AU)_(HMC + M.2) */
#define RTW_MODULE_RTL8723DE_NGFF1630 BIT8 /* RTL8723DE(NGFF1630) */
#define RTW_MODULE_RTL8822BE BIT9 /* RTL8822BE */
#define RTW_MODULE_RTL8821CE BIT10 /* RTL8821CE */
struct country_chplan {
char alpha2[2];
u8 chplan;
#ifdef CONFIG_80211AC_VHT
u8 en_11ac;
#endif
#if RTW_DEF_MODULE_REGULATORY_CERT
u16 def_module_flags; /* RTW_MODULE_RTLXXX */
#endif
};
#ifdef CONFIG_80211AC_VHT
#define COUNTRY_CHPLAN_EN_11AC(_ent) ((_ent)->en_11ac)
#else
#define COUNTRY_CHPLAN_EN_11AC(_ent) 0
#endif
#if RTW_DEF_MODULE_REGULATORY_CERT
#define COUNTRY_CHPLAN_DEF_MODULE_FALGS(_ent) ((_ent)->def_module_flags)
#else
#define COUNTRY_CHPLAN_DEF_MODULE_FALGS(_ent) 0
#endif
const struct country_chplan *rtw_get_chplan_from_country(const char *country_code);
void dump_country_chplan(void *sel, const struct country_chplan *ent);
void dump_country_chplan_map(void *sel);
void dump_chplan_id_list(void *sel);
void dump_chplan_test(void *sel);
void dump_chplan_ver(void *sel);
#endif /* __RTW_CHPLAN_H__ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -127,6 +127,19 @@ int rtw_get_bit_value_from_ieee_value(u8 val)
}
return 0;
}
uint rtw_get_cckrate_size(u8 *rate, u32 rate_length)
{
int i = 0;
while(i < rate_length){
RTW_DBG("%s, rate[%d]=%u\n", __FUNCTION__, i, rate[i]);
if (((rate[i] & 0x7f) == 2) || ((rate[i] & 0x7f) == 4) ||
((rate[i] & 0x7f) == 11) || ((rate[i] & 0x7f) == 22))
i++;
else
break;
}
return i;
}
uint rtw_is_cckrates_included(u8 *rate)
{
@ -381,6 +394,52 @@ exit:
return ret;
}
/* Returns: remove size OR _FAIL: not updated*/
int rtw_remove_ie_g_rate(u8 *ie, uint *ie_len, uint offset, u8 eid)
{
int ret = _FAIL;
u8 *tem_target_ie;
u8 *target_ie;
u32 target_ielen,temp_target_ielen,cck_rate_size,rm_size;
u8 *start;
uint search_len;
u8 *remain_ies;
uint remain_len;
if (!ie || !ie_len || *ie_len <= offset)
goto exit;
start = ie + offset;
search_len = *ie_len - offset;
while (1) {
tem_target_ie=rtw_get_ie(start,eid,&temp_target_ielen,search_len);
/*if(tem_target_ie)
RTW_INFO("%s, tem_target_ie=%u\n", __FUNCTION__,*tem_target_ie);*/
if (tem_target_ie && temp_target_ielen) {
cck_rate_size = rtw_get_cckrate_size((tem_target_ie+2), temp_target_ielen);
rm_size = temp_target_ielen - cck_rate_size;
RTW_DBG("%s,cck_rate_size=%u rm_size=%u\n", __FUNCTION__, cck_rate_size, rm_size);
temp_target_ielen=temp_target_ielen + 2;/*org size of Supposrted Rates(include id + length)*/
/*RTW_INFO("%s, temp_target_ielen=%u\n", __FUNCTION__,temp_target_ielen);*/
remain_ies = tem_target_ie + temp_target_ielen;
remain_len = search_len - (remain_ies - start);
target_ielen=cck_rate_size;/*discount g mode rate 6, 9 12,18Mbps,id , length*/
*(tem_target_ie+1)=target_ielen;/*set new length to Supposrted Rates*/
target_ie=tem_target_ie+target_ielen + 2;/*set target ie to address of rate 6Mbps */
_rtw_memmove(target_ie, remain_ies, remain_len);
*ie_len = *ie_len - rm_size;
ret = rm_size;
start = target_ie;
search_len = remain_len;
} else
break;
}
exit:
return ret;
}
void rtw_set_supported_rate(u8 *SupportedRates, uint mode)
{
@ -496,7 +555,7 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv)
#ifdef CONFIG_80211N_HT
/* HT Cap. */
if (((pregistrypriv->wireless_mode & WIRELESS_11_5N) || (pregistrypriv->wireless_mode & WIRELESS_11_24N))
if (is_supported_ht(pregistrypriv->wireless_mode)
&& (pregistrypriv->ht_enable == _TRUE)) {
/* todo: */
}
@ -677,7 +736,6 @@ int rtw_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwis
int rtw_rsne_info_parse(const u8 *ie, uint ie_len, struct rsne_info *info)
{
int i;
const u8 *pos = ie;
u16 cnt;
@ -819,7 +877,7 @@ exit:
int rtw_get_wapi_ie(u8 *in_ie, uint in_len, u8 *wapi_ie, u16 *wapi_len)
{
int len = 0;
u8 authmode, i;
u8 authmode;
uint cnt;
u8 wapi_oui1[4] = {0x0, 0x14, 0x72, 0x01};
u8 wapi_oui2[4] = {0x0, 0x14, 0x72, 0x02};
@ -862,7 +920,7 @@ int rtw_get_wapi_ie(u8 *in_ie, uint in_len, u8 *wapi_ie, u16 *wapi_len)
int rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 *wpa_ie, u16 *wpa_len)
{
u8 authmode, sec_idx, i;
u8 authmode, sec_idx;
u8 wpa_oui[4] = {0x0, 0x50, 0xf2, 0x01};
uint cnt;
@ -1287,7 +1345,7 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
elems->timeout_int = pos;
elems->timeout_int_len = elen;
break;
case WLAN_EID_HT_CAPABILITY:
case WLAN_EID_HT_CAP:
elems->ht_capabilities = pos;
elems->ht_capabilities_len = elen;
break;
@ -1303,7 +1361,7 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
elems->vht_operation = pos;
elems->vht_operation_len = elen;
break;
case WLAN_EID_OPMODE_NOTIF:
case WLAN_EID_VHT_OP_MODE_NOTIFY:
elems->vht_op_mode_notify = pos;
elems->vht_op_mode_notify_len = elen;
break;
@ -1543,14 +1601,10 @@ void dump_ht_cap_ie_content(void *sel, const u8 *buf, u32 buf_len)
void dump_ht_cap_ie(void *sel, const u8 *ie, u32 ie_len)
{
const u8 *pos = ie;
u16 id;
u16 len;
const u8 *ht_cap_ie;
sint ht_cap_ielen;
ht_cap_ie = rtw_get_ie(ie, WLAN_EID_HT_CAPABILITY, &ht_cap_ielen, ie_len);
ht_cap_ie = rtw_get_ie(ie, WLAN_EID_HT_CAP, &ht_cap_ielen, ie_len);
if (!ie || ht_cap_ie != ie)
return;
@ -1580,10 +1634,6 @@ void dump_ht_op_ie_content(void *sel, const u8 *buf, u32 buf_len)
void dump_ht_op_ie(void *sel, const u8 *ie, u32 ie_len)
{
const u8 *pos = ie;
u16 id;
u16 len;
const u8 *ht_op_ie;
sint ht_op_ielen;
@ -1841,7 +1891,7 @@ u32 rtw_get_p2p_merged_ies_len(u8 *in_ie, u32 in_len)
PNDIS_802_11_VARIABLE_IEs pIE;
u8 OUI[4] = { 0x50, 0x6f, 0x9a, 0x09 };
int i = 0;
int j = 0, len = 0;
int len = 0;
while (i < in_len) {
pIE = (PNDIS_802_11_VARIABLE_IEs)(in_ie + i);

View File

@ -419,9 +419,13 @@ u32 _rtw_write_port_and_wait(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem, int
ret = _rtw_write_port(adapter, addr, cnt, pmem);
if (ret == _SUCCESS)
if (ret == _SUCCESS) {
ret = rtw_sctx_wait(&sctx, __func__);
if (ret != _SUCCESS)
pxmitbuf->sctx = NULL;
}
return ret;
}
@ -484,39 +488,192 @@ void rtw_reset_continual_io_error(struct dvobj_priv *dvobj)
}
#ifdef DBG_IO
#define RTW_IO_SNIFF_TYPE_RANGE 0 /* specific address range is accessed */
#define RTW_IO_SNIFF_TYPE_EN 1 /* part or all sniffed range is enabled */
#define RTW_IO_SNIFF_TYPE_DIS 2 /* part or all sniffed range is disabled */
u32 read_sniff_ranges[][2] = {
/* {0x520, 0x523}, */
struct rtw_io_sniff_ent {
u8 chip;
u8 hci;
u32 addr;
u8 type;
union {
u32 end_addr;
u32 mask;
} u;
char *tag;
};
u32 write_sniff_ranges[][2] = {
/* {0x520, 0x523}, */
/* {0x4c, 0x4c}, */
};
int read_sniff_num = sizeof(read_sniff_ranges) / sizeof(u32) / 2;
int write_sniff_num = sizeof(write_sniff_ranges) / sizeof(u32) / 2;
bool match_read_sniff_ranges(u32 addr, u16 len)
const char *rtw_io_sniff_ent_get_tag(const struct rtw_io_sniff_ent *ent)
{
int i;
for (i = 0; i < read_sniff_num; i++) {
if (addr + len > read_sniff_ranges[i][0] && addr <= read_sniff_ranges[i][1])
return _TRUE;
}
return _FALSE;
return ent->tag;
}
bool match_write_sniff_ranges(u32 addr, u16 len)
#define RTW_IO_SNIFF_RANGE_ENT(_chip, _hci, _addr, _end_addr, _tag) \
{.chip = _chip, .hci = _hci, .addr = _addr, .u.end_addr = _end_addr, .tag = _tag, .type = RTW_IO_SNIFF_TYPE_RANGE,}
#define RTW_IO_SNIFF_EN_ENT(_chip, _hci, _addr, _mask, _tag) \
{.chip = _chip, .hci = _hci, .addr = _addr, .u.mask = _mask, .tag = _tag, .type = RTW_IO_SNIFF_TYPE_EN,}
#define RTW_IO_SNIFF_DIS_ENT(_chip, _hci, _addr, _mask, _tag) \
{.chip = _chip, .hci = _hci, .addr = _addr, .u.mask = _mask, .tag = _tag, .type = RTW_IO_SNIFF_TYPE_DIS,}
const struct rtw_io_sniff_ent read_sniff[] = {
#ifdef DBG_IO_HCI_EN_CHK
RTW_IO_SNIFF_EN_ENT(MAX_CHIP_TYPE, RTW_SDIO, 0x02, 0x1FC, "SDIO 0x02[8:2] not all 0"),
RTW_IO_SNIFF_EN_ENT(MAX_CHIP_TYPE, RTW_USB, 0x02, 0x1E0, "USB 0x02[8:5] not all 0"),
RTW_IO_SNIFF_EN_ENT(MAX_CHIP_TYPE, RTW_PCIE, 0x02, 0x01C, "PCI 0x02[4:2] not all 0"),
#endif
#ifdef DBG_IO_SNIFF_EXAMPLE
RTW_IO_SNIFF_RANGE_ENT(MAX_CHIP_TYPE, 0, 0x522, 0x522, "read TXPAUSE"),
RTW_IO_SNIFF_DIS_ENT(MAX_CHIP_TYPE, 0, 0x02, 0x3, "0x02[1:0] not all 1"),
#endif
};
const int read_sniff_num = sizeof(read_sniff) / sizeof(struct rtw_io_sniff_ent);
const struct rtw_io_sniff_ent write_sniff[] = {
#ifdef DBG_IO_HCI_EN_CHK
RTW_IO_SNIFF_EN_ENT(MAX_CHIP_TYPE, RTW_SDIO, 0x02, 0x1FC, "SDIO 0x02[8:2] not all 0"),
RTW_IO_SNIFF_EN_ENT(MAX_CHIP_TYPE, RTW_USB, 0x02, 0x1E0, "USB 0x02[8:5] not all 0"),
RTW_IO_SNIFF_EN_ENT(MAX_CHIP_TYPE, RTW_PCIE, 0x02, 0x01C, "PCI 0x02[4:2] not all 0"),
#endif
#ifdef DBG_IO_SNIFF_EXAMPLE
RTW_IO_SNIFF_RANGE_ENT(MAX_CHIP_TYPE, 0, 0x522, 0x522, "write TXPAUSE"),
RTW_IO_SNIFF_DIS_ENT(MAX_CHIP_TYPE, 0, 0x02, 0x3, "0x02[1:0] not all 1"),
#endif
};
const int write_sniff_num = sizeof(write_sniff) / sizeof(struct rtw_io_sniff_ent);
static bool match_io_sniff_ranges(_adapter *adapter
, const struct rtw_io_sniff_ent *sniff, int i, u32 addr, u16 len)
{
int i;
for (i = 0; i < write_sniff_num; i++) {
if (addr + len > write_sniff_ranges[i][0] && addr <= write_sniff_ranges[i][1])
return _TRUE;
/* check if IO range after sniff end address */
if (addr > sniff->u.end_addr)
return 0;
return 1;
}
static bool match_io_sniff_en(_adapter *adapter
, const struct rtw_io_sniff_ent *sniff, int i, u32 addr, u8 len, u32 val)
{
u8 sniff_len;
u8 shift;
u32 mask;
bool ret = 0;
/* check if IO range after sniff end address */
sniff_len = 4;
while (!(sniff->u.mask & (0xFF << ((sniff_len - 1) * 8)))) {
sniff_len--;
if (sniff_len == 0)
goto exit;
}
if (sniff->addr + sniff_len <= addr)
goto exit;
if (sniff->addr > addr) {
shift = (sniff->addr - addr) * 8;
mask = sniff->u.mask << shift;
} else if (sniff->addr < addr) {
shift = (addr - sniff->addr) * 8;
mask = sniff->u.mask >> shift;
} else {
shift = 0;
mask = sniff->u.mask;
}
return _FALSE;
if (sniff->type == RTW_IO_SNIFF_TYPE_DIS) {
if (len == 4)
mask &= 0xFFFFFFFF;
else if (len == 3)
mask &= 0x00FFFFFF;
else if (len == 2)
mask &= 0x0000FFFF;
else if (len == 1)
mask &= 0x000000FF;
else
mask &= 0x00000000;
}
if ((sniff->type == RTW_IO_SNIFF_TYPE_EN && (mask & val))
|| (sniff->type == RTW_IO_SNIFF_TYPE_DIS && (mask & val) != mask)
) {
ret = 1;
if (0)
RTW_INFO(FUNC_ADPT_FMT" addr:0x%x len:%u val:0x%x i:%d sniff_len:%u shift:%u mask:0x%x\n"
, FUNC_ADPT_ARG(adapter), addr, len, val, i, sniff_len, shift, mask);
}
exit:
return ret;
}
static bool match_io_sniff(_adapter *adapter
, const struct rtw_io_sniff_ent *sniff, int i, u32 addr, u8 len, u32 val)
{
bool ret = 0;
if (sniff->chip != MAX_CHIP_TYPE
&& sniff->chip != rtw_get_chip_type(adapter))
goto exit;
if (sniff->hci
&& !(sniff->hci & rtw_get_intf_type(adapter)))
goto exit;
if (sniff->addr >= addr + len) /* IO range below sniff start address */
goto exit;
switch (sniff->type) {
case RTW_IO_SNIFF_TYPE_RANGE:
ret = match_io_sniff_ranges(adapter, sniff, i, addr, len);
break;
case RTW_IO_SNIFF_TYPE_EN:
case RTW_IO_SNIFF_TYPE_DIS:
if (len == 1 || len == 2 || len == 4)
ret = match_io_sniff_en(adapter, sniff, i, addr, len, val);
break;
default:
rtw_warn_on(1);
break;
}
exit:
return ret;
}
const struct rtw_io_sniff_ent *match_read_sniff(_adapter *adapter
, u32 addr, u16 len, u32 val)
{
int i;
bool ret = 0;
for (i = 0; i < read_sniff_num; i++) {
ret = match_io_sniff(adapter, &read_sniff[i], i, addr, len, val);
if (ret)
goto exit;
}
exit:
return ret ? &read_sniff[i] : NULL;
}
const struct rtw_io_sniff_ent *match_write_sniff(_adapter *adapter
, u32 addr, u16 len, u32 val)
{
int i;
bool ret = 0;
for (i = 0; i < write_sniff_num; i++) {
ret = match_io_sniff(adapter, &write_sniff[i], i, addr, len, val);
if (ret)
goto exit;
}
exit:
return ret ? &write_sniff[i] : NULL;
}
struct rf_sniff_ent {
@ -538,7 +695,7 @@ struct rf_sniff_ent rf_write_sniff_ranges[] = {
int rf_read_sniff_num = sizeof(rf_read_sniff_ranges) / sizeof(struct rf_sniff_ent);
int rf_write_sniff_num = sizeof(rf_write_sniff_ranges) / sizeof(struct rf_sniff_ent);
bool match_rf_read_sniff_ranges(u8 path, u32 addr, u32 mask)
bool match_rf_read_sniff_ranges(_adapter *adapter, u8 path, u32 addr, u32 mask)
{
int i;
@ -551,7 +708,7 @@ bool match_rf_read_sniff_ranges(u8 path, u32 addr, u32 mask)
return _FALSE;
}
bool match_rf_write_sniff_ranges(u8 path, u32 addr, u32 mask)
bool match_rf_write_sniff_ranges(_adapter *adapter, u8 path, u32 addr, u32 mask)
{
int i;
@ -567,9 +724,12 @@ bool match_rf_write_sniff_ranges(u8 path, u32 addr, u32 mask)
u8 dbg_rtw_read8(_adapter *adapter, u32 addr, const char *caller, const int line)
{
u8 val = _rtw_read8(adapter, addr);
const struct rtw_io_sniff_ent *ent = match_read_sniff(adapter, addr, 1, val);
if (match_read_sniff_ranges(addr, 1))
RTW_INFO("DBG_IO %s:%d rtw_read8(0x%04x) return 0x%02x\n", caller, line, addr, val);
if (ent) {
RTW_INFO("DBG_IO %s:%d rtw_read8(0x%04x) return 0x%02x %s\n"
, caller, line, addr, val, rtw_io_sniff_ent_get_tag(ent));
}
return val;
}
@ -577,9 +737,12 @@ u8 dbg_rtw_read8(_adapter *adapter, u32 addr, const char *caller, const int line
u16 dbg_rtw_read16(_adapter *adapter, u32 addr, const char *caller, const int line)
{
u16 val = _rtw_read16(adapter, addr);
const struct rtw_io_sniff_ent *ent = match_read_sniff(adapter, addr, 2, val);
if (match_read_sniff_ranges(addr, 2))
RTW_INFO("DBG_IO %s:%d rtw_read16(0x%04x) return 0x%04x\n", caller, line, addr, val);
if (ent) {
RTW_INFO("DBG_IO %s:%d rtw_read16(0x%04x) return 0x%04x %s\n"
, caller, line, addr, val, rtw_io_sniff_ent_get_tag(ent));
}
return val;
}
@ -587,38 +750,57 @@ u16 dbg_rtw_read16(_adapter *adapter, u32 addr, const char *caller, const int li
u32 dbg_rtw_read32(_adapter *adapter, u32 addr, const char *caller, const int line)
{
u32 val = _rtw_read32(adapter, addr);
const struct rtw_io_sniff_ent *ent = match_read_sniff(adapter, addr, 4, val);
if (match_read_sniff_ranges(addr, 4))
RTW_INFO("DBG_IO %s:%d rtw_read32(0x%04x) return 0x%08x\n", caller, line, addr, val);
if (ent) {
RTW_INFO("DBG_IO %s:%d rtw_read32(0x%04x) return 0x%08x %s\n"
, caller, line, addr, val, rtw_io_sniff_ent_get_tag(ent));
}
return val;
}
int dbg_rtw_write8(_adapter *adapter, u32 addr, u8 val, const char *caller, const int line)
{
if (match_write_sniff_ranges(addr, 1))
RTW_INFO("DBG_IO %s:%d rtw_write8(0x%04x, 0x%02x)\n", caller, line, addr, val);
const struct rtw_io_sniff_ent *ent = match_write_sniff(adapter, addr, 1, val);
if (ent) {
RTW_INFO("DBG_IO %s:%d rtw_write8(0x%04x, 0x%02x) %s\n"
, caller, line, addr, val, rtw_io_sniff_ent_get_tag(ent));
}
return _rtw_write8(adapter, addr, val);
}
int dbg_rtw_write16(_adapter *adapter, u32 addr, u16 val, const char *caller, const int line)
{
if (match_write_sniff_ranges(addr, 2))
RTW_INFO("DBG_IO %s:%d rtw_write16(0x%04x, 0x%04x)\n", caller, line, addr, val);
const struct rtw_io_sniff_ent *ent = match_write_sniff(adapter, addr, 2, val);
if (ent) {
RTW_INFO("DBG_IO %s:%d rtw_write16(0x%04x, 0x%04x) %s\n"
, caller, line, addr, val, rtw_io_sniff_ent_get_tag(ent));
}
return _rtw_write16(adapter, addr, val);
}
int dbg_rtw_write32(_adapter *adapter, u32 addr, u32 val, const char *caller, const int line)
{
if (match_write_sniff_ranges(addr, 4))
RTW_INFO("DBG_IO %s:%d rtw_write32(0x%04x, 0x%08x)\n", caller, line, addr, val);
const struct rtw_io_sniff_ent *ent = match_write_sniff(adapter, addr, 4, val);
if (ent) {
RTW_INFO("DBG_IO %s:%d rtw_write32(0x%04x, 0x%08x) %s\n"
, caller, line, addr, val, rtw_io_sniff_ent_get_tag(ent));
}
return _rtw_write32(adapter, addr, val);
}
int dbg_rtw_writeN(_adapter *adapter, u32 addr , u32 length , u8 *data, const char *caller, const int line)
{
if (match_write_sniff_ranges(addr, length))
RTW_INFO("DBG_IO %s:%d rtw_writeN(0x%04x, %u)\n", caller, line, addr, length);
const struct rtw_io_sniff_ent *ent = match_write_sniff(adapter, addr, length, 0);
if (ent) {
RTW_INFO("DBG_IO %s:%d rtw_writeN(0x%04x, %u) %s\n"
, caller, line, addr, length, rtw_io_sniff_ent_get_tag(ent));
}
return _rtw_writeN(adapter, addr, length, data);
}
@ -629,8 +811,12 @@ u8 dbg_rtw_sd_f0_read8(_adapter *adapter, u32 addr, const char *caller, const in
u8 val = _rtw_sd_f0_read8(adapter, addr);
#if 0
if (match_read_sniff_ranges(addr, 1))
RTW_INFO("DBG_IO %s:%d rtw_sd_f0_read8(0x%04x) return 0x%02x\n", caller, line, addr, val);
const struct rtw_io_sniff_ent *ent = match_read_sniff(adapter, addr, 1, val);
if (ent) {
RTW_INFO("DBG_IO %s:%d rtw_sd_f0_read8(0x%04x) return 0x%02x %s\n"
, caller, line, addr, val, rtw_io_sniff_ent_get_tag(ent));
}
#endif
return val;
@ -640,9 +826,12 @@ u8 dbg_rtw_sd_f0_read8(_adapter *adapter, u32 addr, const char *caller, const in
u8 dbg_rtw_sd_iread8(_adapter *adapter, u32 addr, const char *caller, const int line)
{
u8 val = rtw_sd_iread8(adapter, addr);
const struct rtw_io_sniff_ent *ent = match_read_sniff(adapter, addr, 1, val);
if (match_read_sniff_ranges(addr, 1))
RTW_INFO("DBG_IO %s:%d rtw_sd_iread8(0x%04x) return 0x%02x\n", caller, line, addr, val);
if (ent) {
RTW_INFO("DBG_IO %s:%d rtw_sd_iread8(0x%04x) return 0x%02x %s\n"
, caller, line, addr, val, rtw_io_sniff_ent_get_tag(ent));
}
return val;
}
@ -650,9 +839,12 @@ u8 dbg_rtw_sd_iread8(_adapter *adapter, u32 addr, const char *caller, const int
u16 dbg_rtw_sd_iread16(_adapter *adapter, u32 addr, const char *caller, const int line)
{
u16 val = _rtw_sd_iread16(adapter, addr);
const struct rtw_io_sniff_ent *ent = match_read_sniff(adapter, addr, 2, val);
if (match_read_sniff_ranges(addr, 2))
RTW_INFO("DBG_IO %s:%d rtw_sd_iread16(0x%04x) return 0x%04x\n", caller, line, addr, val);
if (ent) {
RTW_INFO("DBG_IO %s:%d rtw_sd_iread16(0x%04x) return 0x%04x %s\n"
, caller, line, addr, val, rtw_io_sniff_ent_get_tag(ent));
}
return val;
}
@ -660,31 +852,46 @@ u16 dbg_rtw_sd_iread16(_adapter *adapter, u32 addr, const char *caller, const in
u32 dbg_rtw_sd_iread32(_adapter *adapter, u32 addr, const char *caller, const int line)
{
u32 val = _rtw_sd_iread32(adapter, addr);
const struct rtw_io_sniff_ent *ent = match_read_sniff(adapter, addr, 4, val);
if (match_read_sniff_ranges(addr, 4))
RTW_INFO("DBG_IO %s:%d rtw_sd_iread32(0x%04x) return 0x%08x\n", caller, line, addr, val);
if (ent) {
RTW_INFO("DBG_IO %s:%d rtw_sd_iread32(0x%04x) return 0x%08x %s\n"
, caller, line, addr, val, rtw_io_sniff_ent_get_tag(ent));
}
return val;
}
int dbg_rtw_sd_iwrite8(_adapter *adapter, u32 addr, u8 val, const char *caller, const int line)
{
if (match_write_sniff_ranges(addr, 1))
RTW_INFO("DBG_IO %s:%d rtw_sd_iwrite8(0x%04x, 0x%02x)\n", caller, line, addr, val);
const struct rtw_io_sniff_ent *ent = match_write_sniff(adapter, addr, 1, val);
if (ent) {
RTW_INFO("DBG_IO %s:%d rtw_sd_iwrite8(0x%04x, 0x%02x) %s\n"
, caller, line, addr, val, rtw_io_sniff_ent_get_tag(ent));
}
return _rtw_sd_iwrite8(adapter, addr, val);
}
int dbg_rtw_sd_iwrite16(_adapter *adapter, u32 addr, u16 val, const char *caller, const int line)
{
if (match_write_sniff_ranges(addr, 2))
RTW_INFO("DBG_IO %s:%d rtw_sd_iwrite16(0x%04x, 0x%04x)\n", caller, line, addr, val);
const struct rtw_io_sniff_ent *ent = match_write_sniff(adapter, addr, 2, val);
if (ent) {
RTW_INFO("DBG_IO %s:%d rtw_sd_iwrite16(0x%04x, 0x%04x) %s\n"
, caller, line, addr, val, rtw_io_sniff_ent_get_tag(ent));
}
return _rtw_sd_iwrite16(adapter, addr, val);
}
int dbg_rtw_sd_iwrite32(_adapter *adapter, u32 addr, u32 val, const char *caller, const int line)
{
if (match_write_sniff_ranges(addr, 4))
RTW_INFO("DBG_IO %s:%d rtw_sd_iwrite32(0x%04x, 0x%08x)\n", caller, line, addr, val);
const struct rtw_io_sniff_ent *ent = match_write_sniff(adapter, addr, 4, val);
if (ent) {
RTW_INFO("DBG_IO %s:%d rtw_sd_iwrite32(0x%04x, 0x%08x) %s\n"
, caller, line, addr, val, rtw_io_sniff_ent_get_tag(ent));
}
return _rtw_sd_iwrite32(adapter, addr, val);
}

View File

@ -42,7 +42,9 @@ u8 rtw_validate_bssid(u8 *bssid)
u8 rtw_validate_ssid(NDIS_802_11_SSID *ssid)
{
#ifdef CONFIG_VALIDATE_SSID
u8 i;
#endif
u8 ret = _TRUE;
@ -106,10 +108,17 @@ u8 rtw_do_join(_adapter *padapter)
if (pmlmepriv->LinkDetectInfo.bBusyTraffic == _FALSE
|| rtw_to_roam(padapter) > 0
) {
/* submit site_survey_cmd */
ret = rtw_sitesurvey_cmd(padapter, &parm);
if (_SUCCESS != ret) {
u8 ssc_chk = rtw_sitesurvey_condition_check(padapter, _FALSE);
if ((ssc_chk == SS_ALLOW) || (ssc_chk == SS_DENY_BUSY_TRAFFIC) ){
/* submit site_survey_cmd */
ret = rtw_sitesurvey_cmd(padapter, &parm);
if (_SUCCESS != ret)
pmlmepriv->to_join = _FALSE;
} else {
/*if (ssc_chk == SS_DENY_BUDDY_UNDER_SURVEY)*/
pmlmepriv->to_join = _FALSE;
ret = _FAIL;
}
} else {
pmlmepriv->to_join = _FALSE;
@ -155,26 +164,22 @@ u8 rtw_do_join(_adapter *padapter)
/* can't associate ; reset under-linking */
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
#if 0
if ((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE)) {
if (_rtw_memcmp(pmlmepriv->cur_network.network.Ssid.Ssid, pmlmepriv->assoc_ssid.Ssid, pmlmepriv->assoc_ssid.SsidLength)) {
/* for funk to do roaming */
/* funk will reconnect, but funk will not sitesurvey before reconnect */
if (pmlmepriv->sitesurveyctrl.traffic_busy == _FALSE)
rtw_sitesurvey_cmd(padapter, &parm);
}
}
#endif
/* when set_ssid/set_bssid for rtw_do_join(), but there are no desired bss in scanning queue */
/* we try to issue sitesurvey firstly */
if (pmlmepriv->LinkDetectInfo.bBusyTraffic == _FALSE
|| rtw_to_roam(padapter) > 0
) {
/* RTW_INFO("rtw_do_join() when no desired bss in scanning queue\n"); */
ret = rtw_sitesurvey_cmd(padapter, &parm);
if (_SUCCESS != ret) {
u8 ssc_chk = rtw_sitesurvey_condition_check(padapter, _FALSE);
if ((ssc_chk == SS_ALLOW) || (ssc_chk == SS_DENY_BUSY_TRAFFIC)){
/* RTW_INFO(("rtw_do_join() when no desired bss in scanning queue\n"); */
ret = rtw_sitesurvey_cmd(padapter, &parm);
if (_SUCCESS != ret)
pmlmepriv->to_join = _FALSE;
} else {
/*if (ssc_chk == SS_DENY_BUDDY_UNDER_SURVEY) {
} else {*/
ret = _FAIL;
pmlmepriv->to_join = _FALSE;
}
} else {
@ -307,7 +312,7 @@ u8 rtw_set_802_11_bssid(_adapter *padapter, u8 *bssid)
if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
rtw_indicate_disconnect(padapter, 0, _FALSE);
rtw_free_assoc_resources(padapter, 1);
rtw_free_assoc_resources_cmd(padapter, _TRUE, 0);
if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE)) {
_clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
@ -344,7 +349,6 @@ u8 rtw_set_802_11_ssid(_adapter *padapter, NDIS_802_11_SSID *ssid)
{
_irqL irqL;
u8 status = _SUCCESS;
u32 cur_time = 0;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_network *pnetwork = &pmlmepriv->cur_network;
@ -379,7 +383,7 @@ u8 rtw_set_802_11_ssid(_adapter *padapter, NDIS_802_11_SSID *ssid)
if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
rtw_indicate_disconnect(padapter, 0, _FALSE);
rtw_free_assoc_resources(padapter, 1);
rtw_free_assoc_resources_cmd(padapter, _TRUE, 0);
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE) {
_clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
@ -400,7 +404,7 @@ u8 rtw_set_802_11_ssid(_adapter *padapter, NDIS_802_11_SSID *ssid)
if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
rtw_indicate_disconnect(padapter, 0, _FALSE);
rtw_free_assoc_resources(padapter, 1);
rtw_free_assoc_resources_cmd(padapter, _TRUE, 0);
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE) {
_clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
@ -442,7 +446,6 @@ u8 rtw_set_802_11_connect(_adapter *padapter, u8 *bssid, NDIS_802_11_SSID *ssid)
{
_irqL irqL;
u8 status = _SUCCESS;
u32 cur_time = 0;
bool bssid_valid = _TRUE;
bool ssid_valid = _TRUE;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@ -508,7 +511,7 @@ exit:
}
u8 rtw_set_802_11_infrastructure_mode(_adapter *padapter,
NDIS_802_11_NETWORK_INFRASTRUCTURE networktype)
NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, u8 flags)
{
_irqL irqL;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@ -516,6 +519,7 @@ u8 rtw_set_802_11_infrastructure_mode(_adapter *padapter,
NDIS_802_11_NETWORK_INFRASTRUCTURE *pold_state = &(cur_network->network.InfrastructureMode);
u8 ap2sta_mode = _FALSE;
u8 ret = _TRUE;
u8 is_linked = _FALSE, is_adhoc_master = _FALSE;
if (*pold_state != networktype) {
/* RTW_INFO("change mode, old_mode=%d, new_mode=%d, fw_state=0x%x\n", *pold_state, networktype, get_fwstate(pmlmepriv)); */
@ -532,20 +536,30 @@ u8 rtw_set_802_11_infrastructure_mode(_adapter *padapter,
}
_enter_critical_bh(&pmlmepriv->lock, &irqL);
is_linked = check_fwstate(pmlmepriv, _FW_LINKED);
is_adhoc_master = check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
if ((check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) || (*pold_state == Ndis802_11IBSS))
rtw_disassoc_cmd(padapter, 0, 0);
/* flags = 0, means enqueue cmd and no wait */
if (flags != 0)
_exit_critical_bh(&pmlmepriv->lock, &irqL);
if ((check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) ||
(check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE))
rtw_free_assoc_resources(padapter, 1);
if ((is_linked == _TRUE) || (*pold_state == Ndis802_11IBSS))
rtw_disassoc_cmd(padapter, 0, flags);
if ((is_linked == _TRUE) ||
(is_adhoc_master == _TRUE))
rtw_free_assoc_resources_cmd(padapter, _TRUE, flags);
if ((*pold_state == Ndis802_11Infrastructure) || (*pold_state == Ndis802_11IBSS)) {
if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) {
if (is_linked == _TRUE) {
rtw_indicate_disconnect(padapter, 0, _FALSE); /*will clr Linked_state; before this function, we must have checked whether issue dis-assoc_cmd or not*/
}
}
/* flags = 0, means enqueue cmd and no wait */
if (flags != 0)
_enter_critical_bh(&pmlmepriv->lock, &irqL);
*pold_state = networktype;
_clr_fwstate_(pmlmepriv, ~WIFI_NULL_STATE);
@ -612,7 +626,7 @@ u8 rtw_set_802_11_disassociate(_adapter *padapter)
rtw_disassoc_cmd(padapter, 0, 0);
rtw_indicate_disconnect(padapter, 0, _FALSE);
/* modify for CONFIG_IEEE80211W, none 11w can use it */
rtw_free_assoc_resources_cmd(padapter);
rtw_free_assoc_resources_cmd(padapter, _TRUE, 0);
if (_FAIL == rtw_pwr_wakeup(padapter))
RTW_INFO("%s(): rtw_pwr_wakeup fail !!!\n", __FUNCTION__);
}
@ -768,10 +782,13 @@ exit:
*/
u16 rtw_get_cur_max_rate(_adapter *adapter)
{
int j;
int i = 0;
u16 rate = 0, max_rate = 0;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
WLAN_BSSID_EX *pcur_bss = &pmlmepriv->cur_network.network;
int sta_bssrate_len = 0;
unsigned char sta_bssrate[NumRates];
struct sta_info *psta = NULL;
u8 short_GI = 0;
#ifdef CONFIG_80211N_HT
@ -811,16 +828,38 @@ u16 rtw_get_cur_max_rate(_adapter *adapter)
else
#endif /* CONFIG_80211N_HT */
{
/*station mode show :station && ap support rate; softap :show ap support rate*/
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE)
get_rate_set(adapter, sta_bssrate, &sta_bssrate_len);/*get sta rate and length*/
while ((pcur_bss->SupportedRates[i] != 0) && (pcur_bss->SupportedRates[i] != 0xFF)) {
rate = pcur_bss->SupportedRates[i] & 0x7F;
if (rate > max_rate)
max_rate = rate;
rate = pcur_bss->SupportedRates[i] & 0x7F;/*AP support rates*/
/*RTW_INFO("%s rate=%02X \n", __func__, rate);*/
/*check STA support rate or not */
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE) {
for (j = 0; j < sta_bssrate_len; j++) {
/* Avoid the proprietary data rate (22Mbps) of Handlink WSG-4000 AP */
if ((rate | IEEE80211_BASIC_RATE_MASK)
== (sta_bssrate[j] | IEEE80211_BASIC_RATE_MASK)) {
if (rate > max_rate) {
max_rate = rate;
}
break;
}
}
} else {
if (rate > max_rate)
max_rate = rate;
}
i++;
}
max_rate = max_rate * 10 / 2;
}
return max_rate;
}
@ -850,9 +889,6 @@ int rtw_set_scan_mode(_adapter *adapter, RT_SCAN_TYPE scan_mode)
*/
int rtw_set_channel_plan(_adapter *adapter, u8 channel_plan)
{
struct registry_priv *pregistrypriv = &adapter->registrypriv;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
/* handle by cmd_thread to sync with scan operation */
return rtw_set_chplan_cmd(adapter, RTW_CMDF_WAIT_ACK, channel_plan, 1);
}

View File

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

View File

@ -27,6 +27,7 @@ void rtw_mi_update_union_chan_inf(_adapter *adapter, u8 ch, u8 offset , u8 bw)
iface_state->union_offset = offset;
}
#ifdef DBG_IFACE_STATUS
#ifdef CONFIG_P2P
static u8 _rtw_mi_p2p_listen_scan_chk(_adapter *adapter)
{
@ -46,6 +47,8 @@ static u8 _rtw_mi_p2p_listen_scan_chk(_adapter *adapter)
return p2p_listen_scan_state;
}
#endif
#endif
u8 rtw_mi_stayin_union_ch_chk(_adapter *adapter)
{
u8 rst = _TRUE;
@ -104,9 +107,8 @@ u8 rtw_mi_stayin_union_band_chk(_adapter *adapter)
}
/* Find union about ch, bw, ch_offset of all linked/linking interfaces */
int _rtw_mi_get_ch_setting_union(_adapter *adapter, u8 *ch, u8 *bw, u8 *offset, bool include_self)
int rtw_mi_get_ch_setting_union_by_ifbmp(struct dvobj_priv *dvobj, u8 ifbmp, u8 *ch, u8 *bw, u8 *offset)
{
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
_adapter *iface;
struct mlme_ext_priv *mlmeext;
int i;
@ -124,6 +126,9 @@ int _rtw_mi_get_ch_setting_union(_adapter *adapter, u8 *ch, u8 *bw, u8 *offset,
for (i = 0; i < dvobj->iface_nums; i++) {
iface = dvobj->padapters[i];
if (!iface || !(ifbmp & BIT(iface->iface_id)))
continue;
mlmeext = &iface->mlmeextpriv;
if (!check_fwstate(&iface->mlmepriv, _FW_LINKED | _FW_UNDER_LINKING))
@ -132,9 +137,6 @@ int _rtw_mi_get_ch_setting_union(_adapter *adapter, u8 *ch, u8 *bw, u8 *offset,
if (check_fwstate(&iface->mlmepriv, WIFI_OP_CH_SWITCHING))
continue;
if (include_self == _FALSE && adapter == iface)
continue;
if (num == 0) {
ch_ret = mlmeext->cur_channel;
bw_ret = mlmeext->cur_bwmode;
@ -173,22 +175,17 @@ int _rtw_mi_get_ch_setting_union(_adapter *adapter, u8 *ch, u8 *bw, u8 *offset,
inline int rtw_mi_get_ch_setting_union(_adapter *adapter, u8 *ch, u8 *bw, u8 *offset)
{
return _rtw_mi_get_ch_setting_union(adapter, ch, bw, offset, 1);
return rtw_mi_get_ch_setting_union_by_ifbmp(adapter_to_dvobj(adapter), 0xFF, ch, bw, offset);
}
inline int rtw_mi_get_ch_setting_union_no_self(_adapter *adapter, u8 *ch, u8 *bw, u8 *offset)
{
return _rtw_mi_get_ch_setting_union(adapter, ch, bw, offset, 0);
return rtw_mi_get_ch_setting_union_by_ifbmp(adapter_to_dvobj(adapter), 0xFF & ~BIT(adapter->iface_id), ch, bw, offset);
}
#define MI_STATUS_SELF_ONLY 0
#define MI_STATUS_OTHERS_ONLY 1
#define MI_STATUS_ALL 2
/* For now, not return union_ch/bw/offset */
void _rtw_mi_status(_adapter *adapter, struct mi_state *mstate, u8 target_sel)
void rtw_mi_status_by_ifbmp(struct dvobj_priv *dvobj, u8 ifbmp, struct mi_state *mstate)
{
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
_adapter *iface;
int i;
@ -196,10 +193,7 @@ void _rtw_mi_status(_adapter *adapter, struct mi_state *mstate, u8 target_sel)
for (i = 0; i < dvobj->iface_nums; i++) {
iface = dvobj->padapters[i];
if (target_sel == MI_STATUS_SELF_ONLY && iface != adapter)
continue;
if (target_sel == MI_STATUS_OTHERS_ONLY && iface == adapter)
if (!iface || !(ifbmp & BIT(iface->iface_id)))
continue;
if (check_fwstate(&iface->mlmepriv, WIFI_STATION_STATE) == _TRUE) {
@ -211,6 +205,10 @@ void _rtw_mi_status(_adapter *adapter, struct mi_state *mstate, u8 target_sel)
if (iface->tdlsinfo.link_established == _TRUE)
MSTATE_TDLS_LD_NUM(mstate)++;
#endif
#ifdef CONFIG_P2P
if (MLME_IS_GC(iface))
MSTATE_P2P_GC_NUM(mstate)++;
#endif
}
if (check_fwstate(&iface->mlmepriv, _FW_UNDER_LINKING) == _TRUE)
MSTATE_STA_LG_NUM(mstate)++;
@ -221,6 +219,10 @@ void _rtw_mi_status(_adapter *adapter, struct mi_state *mstate, u8 target_sel)
MSTATE_AP_NUM(mstate)++;
if (iface->stapriv.asoc_sta_count > 2)
MSTATE_AP_LD_NUM(mstate)++;
#ifdef CONFIG_P2P
if (MLME_IS_GO(iface))
MSTATE_P2P_GO_NUM(mstate)++;
#endif
} else
MSTATE_AP_STARTING_NUM(mstate)++;
#endif
@ -262,23 +264,26 @@ void _rtw_mi_status(_adapter *adapter, struct mi_state *mstate, u8 target_sel)
MSTATE_ROCH_NUM(mstate)++;
#endif
#endif /* CONFIG_IOCTL_CFG80211 */
#ifdef CONFIG_P2P
if (MLME_IS_PD(iface))
MSTATE_P2P_DV_NUM(mstate)++;
#endif
}
}
inline void rtw_mi_status(_adapter *adapter, struct mi_state *mstate)
{
return _rtw_mi_status(adapter, mstate, MI_STATUS_ALL);
return rtw_mi_status_by_ifbmp(adapter_to_dvobj(adapter), 0xFF, mstate);
}
inline void rtw_mi_status_no_self(_adapter *adapter, struct mi_state *mstate)
{
return _rtw_mi_status(adapter, mstate, MI_STATUS_OTHERS_ONLY);
return rtw_mi_status_by_ifbmp(adapter_to_dvobj(adapter), 0xFF & ~BIT(adapter->iface_id), mstate);
}
inline void rtw_mi_status_no_others(_adapter *adapter, struct mi_state *mstate)
{
return _rtw_mi_status(adapter, mstate, MI_STATUS_SELF_ONLY);
return rtw_mi_status_by_ifbmp(adapter_to_dvobj(adapter), BIT(adapter->iface_id), mstate);
}
/* For now, not handle union_ch/bw/offset */
@ -332,7 +337,9 @@ void dump_mi_status(void *sel, struct dvobj_priv *dvobj)
RTW_PRINT_SEL(sel, "linked_mesh_num:%d\n", DEV_MESH_LD_NUM(dvobj));
#endif
#ifdef CONFIG_P2P
RTW_PRINT_SEL(sel, "p2p_device_num:%d\n", rtw_mi_stay_in_p2p_mode(dvobj_get_primary_adapter(dvobj)));
RTW_PRINT_SEL(sel, "p2p_device_num:%d\n", DEV_P2P_DV_NUM(dvobj));
RTW_PRINT_SEL(sel, "p2p_gc_num:%d\n", DEV_P2P_GC_NUM(dvobj));
RTW_PRINT_SEL(sel, "p2p_go_num:%d\n", DEV_P2P_GO_NUM(dvobj));
#endif
RTW_PRINT_SEL(sel, "scan_num:%d\n", DEV_SCAN_NUM(dvobj));
RTW_PRINT_SEL(sel, "under_wps_num:%d\n", DEV_WPS_NUM(dvobj));
@ -360,9 +367,7 @@ inline void rtw_mi_update_iface_status(struct mlme_priv *pmlmepriv, sint state)
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
struct mi_state *iface_state = &dvobj->iface_state;
struct mi_state tmp_mstate;
u8 i;
u8 u_ch, u_offset, u_bw;
_adapter *iface;
if (state == WIFI_MONITOR_STATE
|| state == 0xFFFFFFFF
@ -748,6 +753,30 @@ void rtw_mi_buddy_intf_stop(_adapter *adapter)
_rtw_mi_process(adapter, _TRUE, NULL, _rtw_mi_intf_stop);
}
#ifdef CONFIG_NEW_NETDEV_HDL
static u8 _rtw_mi_hal_iface_init(_adapter *padapter, void *data)
{
if (rtw_hal_iface_init(padapter) == _SUCCESS)
return _TRUE;
return _FALSE;
}
u8 rtw_mi_hal_iface_init(_adapter *padapter)
{
int i;
_adapter *iface;
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
u8 ret = _TRUE;
for (i = 0; i < dvobj->iface_nums; i++) {
iface = dvobj->padapters[i];
if (iface && iface->netif_up)
rtw_hal_iface_init(padapter);
}
return ret;
}
#endif
static u8 _rtw_mi_suspend_free_assoc_resource(_adapter *padapter, void *data)
{
return rtw_suspend_free_assoc_resource(padapter);
@ -864,7 +893,6 @@ u8 _rtw_mi_busy_traffic_check(_adapter *padapter, void *data)
if (check_sc_interval) {
/* Miracast can't do AP scan*/
passtime = rtw_get_passing_time_ms(pmlmepriv->lastscantime);
pmlmepriv->lastscantime = rtw_get_current_time();
if (passtime > BUSY_TRAFFIC_SCAN_DENY_PERIOD) {
RTW_INFO(ADPT_FMT" bBusyTraffic == _TRUE\n", ADPT_ARG(padapter));
return _TRUE;
@ -1089,20 +1117,6 @@ u8 rtw_mi_buddy_dynamic_check_timer_handlder(_adapter *padapter)
return _rtw_mi_process(padapter, _TRUE, NULL, _rtw_mi_dynamic_check_timer_handlder);
}
static u8 _rtw_mi_dev_unload(_adapter *adapter, void *data)
{
rtw_dev_unload(adapter);
return _TRUE;
}
u8 rtw_mi_dev_unload(_adapter *padapter)
{
return _rtw_mi_process(padapter, _FALSE, NULL, _rtw_mi_dev_unload);
}
u8 rtw_mi_buddy_dev_unload(_adapter *padapter)
{
return _rtw_mi_process(padapter, _TRUE, NULL, _rtw_mi_dev_unload);
}
static u8 _rtw_mi_dynamic_chk_wk_hdl(_adapter *adapter, void *data)
{
rtw_iface_dynamic_chk_wk_hdl(adapter);
@ -1163,6 +1177,29 @@ u8 rtw_mi_sreset_adapter_hdl(_adapter *padapter, u8 bstart)
return _rtw_mi_process(padapter, _FALSE, &in_data, _rtw_mi_sreset_adapter_hdl);
}
#if defined(DBG_CONFIG_ERROR_RESET) && defined(CONFIG_CONCURRENT_MODE)
void rtw_mi_ap_info_restore(_adapter *adapter)
{
int i;
_adapter *iface;
struct mlme_priv *pmlmepriv;
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
for (i = 0; i < dvobj->iface_nums; i++) {
iface = dvobj->padapters[i];
if (iface) {
pmlmepriv = &iface->mlmepriv;
if (MLME_IS_AP(iface) || MLME_IS_MESH(iface)) {
RTW_INFO(FUNC_ADPT_FMT" %s\n", FUNC_ADPT_ARG(iface), MLME_IS_AP(iface) ? "AP" : "MESH");
rtw_iface_bcmc_sec_cam_map_restore(iface);
}
}
}
}
#endif /*#if defined(DBG_CONFIG_ERROR_RESET) && defined(CONFIG_CONCURRENT_MODE)*/
u8 rtw_mi_buddy_sreset_adapter_hdl(_adapter *padapter, u8 bstart)
{
u8 in_data = bstart;
@ -1176,7 +1213,7 @@ static u8 _rtw_mi_tx_beacon_hdl(_adapter *adapter, void *data)
) {
adapter->mlmepriv.update_bcn = _TRUE;
#ifndef CONFIG_INTERRUPT_BASED_TXBCN
#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) || defined(CONFIG_PCI_BCN_POLLING)
tx_beacon_hdl(adapter, NULL);
#endif
#endif
@ -1262,7 +1299,7 @@ _adapter *rtw_get_iface_by_id(_adapter *padapter, u8 iface_id)
return dvobj->padapters[iface_id];
}
_adapter *rtw_get_iface_by_macddr(_adapter *padapter, u8 *mac_addr)
_adapter *rtw_get_iface_by_macddr(_adapter *padapter, const u8 *mac_addr)
{
int i;
_adapter *iface = NULL;
@ -1354,9 +1391,10 @@ void rtw_dbg_skb_process(_adapter *padapter, union recv_frame *precvframe, union
static s32 _rtw_mi_buddy_clone_bcmc_packet(_adapter *adapter, union recv_frame *precvframe, u8 *pphy_status, union recv_frame *pcloneframe)
{
s32 ret = _SUCCESS;
#ifdef CONFIG_SKB_ALLOCATED
u8 *pbuf = precvframe->u.hdr.rx_data;
#endif
struct rx_pkt_attrib *pattrib = NULL;
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(adapter);
if (pcloneframe) {
pcloneframe->u.hdr.adapter = adapter;
@ -1451,6 +1489,45 @@ _adapter *rtw_mi_get_ap_adapter(_adapter *padapter)
}
#endif
u8 rtw_mi_get_ld_sta_ifbmp(_adapter *adapter)
{
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
int i;
_adapter *iface = NULL;
u8 ifbmp = 0;
for (i = 0; i < dvobj->iface_nums; i++) {
iface = dvobj->padapters[i];
if (!iface)
continue;
if (MLME_IS_STA(iface) && MLME_IS_ASOC(iface))
ifbmp |= BIT(i);
}
return ifbmp;
}
u8 rtw_mi_get_ap_mesh_ifbmp(_adapter *adapter)
{
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
int i;
_adapter *iface = NULL;
u8 ifbmp = 0;
for (i = 0; i < dvobj->iface_nums; i++) {
iface = dvobj->padapters[i];
if (!iface)
continue;
if (CHK_MLME_STATE(iface, WIFI_AP_STATE | WIFI_MESH_STATE)
&& MLME_IS_ASOC(iface))
ifbmp |= BIT(i);
}
return ifbmp;
}
void rtw_mi_update_ap_bmc_camid(_adapter *padapter, u8 camid_a, u8 camid_b)
{
#ifdef CONFIG_CONCURRENT_MODE
@ -1476,3 +1553,19 @@ void rtw_mi_update_ap_bmc_camid(_adapter *padapter, u8 camid_a, u8 camid_b)
#endif
}
u8 rtw_mi_get_assoc_if_num(_adapter *adapter)
{
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
u8 n_assoc_iface = 0;
#if 1
u8 i;
for (i = 0; i < dvobj->iface_nums; i++) {
if (check_fwstate(&(dvobj->padapters[i]->mlmepriv), WIFI_ASOC_STATE))
n_assoc_iface++;
}
#else
n_assoc_iface = DEV_STA_LD_NUM(dvobj) + DEV_AP_NUM(dvobj) + DEV_ADHOC_NUM(dvobj) + DEV_MESH_NUM(dvobj);
#endif
return n_assoc_iface;
}

File diff suppressed because it is too large Load Diff

1764
core/rtw_mlme_ext.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

View File

@ -120,7 +120,7 @@ static void _init_mp_priv_(struct mp_priv *pmp_priv)
pmp_priv->channel = 1;
pmp_priv->bandwidth = CHANNEL_WIDTH_20;
pmp_priv->prime_channel_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
pmp_priv->prime_channel_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
pmp_priv->rateidx = RATE_1M;
pmp_priv->txpoweridx = 0x2A;
@ -147,6 +147,7 @@ static void _init_mp_priv_(struct mp_priv *pmp_priv)
pmp_priv->bloopback = _FALSE;
pmp_priv->bloadefusemap = _FALSE;
pmp_priv->brx_filter_beacon = _FALSE;
pnetwork = &pmp_priv->mp_network.network;
_rtw_memcpy(pnetwork->MacAddress, pmp_priv->network_macaddr, ETH_ALEN);
@ -222,6 +223,7 @@ static int init_mp_priv_by_os(struct mp_priv *pmp_priv)
#endif
#ifdef PLATFORM_LINUX
#if 0
static int init_mp_priv_by_os(struct mp_priv *pmp_priv)
{
int i, res;
@ -263,6 +265,7 @@ _exit_init_mp_priv:
return res;
}
#endif
#endif
static void mp_init_xmit_attrib(struct mp_tx *pmptx, PADAPTER padapter)
{
@ -298,6 +301,11 @@ static void mp_init_xmit_attrib(struct mp_tx *pmptx, PADAPTER padapter)
pattrib->pktlen = 1500;
if (pHalData->rf_type == RF_2T2R)
pattrib->raid = RATEID_IDX_BGN_40M_2SS;
else
pattrib->raid = RATEID_IDX_BGN_40M_1SS;
#ifdef CONFIG_80211AC_VHT
if (pHalData->rf_type == RF_1T1R)
pattrib->raid = RATEID_IDX_VHT_1SS;
@ -363,7 +371,7 @@ void free_mp_priv(struct mp_priv *pmp_priv)
pmp_priv->pmp_xmtframe_buf = NULL;
}
#if 0
static VOID PHY_IQCalibrate_default(
IN PADAPTER pAdapter,
IN BOOLEAN bReCovery
@ -386,7 +394,7 @@ static VOID PHY_SetRFPathSwitch_default(
{
RTW_INFO("%s\n", __func__);
}
#endif
void mpt_InitHWConfig(PADAPTER Adapter)
{
@ -453,8 +461,8 @@ void mpt_InitHWConfig(PADAPTER Adapter)
else if (IS_HARDWARE_TYPE_8821C(Adapter))
PlatformEFIOWrite2Byte(Adapter, REG_RXFLTMAP1_8821C, 0x2000);
#endif /* CONFIG_RTL8821C */
#ifdef CONFIG_RTL8188F
else if (IS_HARDWARE_TYPE_8188F(Adapter)) {
#if defined(CONFIG_RTL8188F) || defined(CONFIG_RTL8188GTV)
else if (IS_HARDWARE_TYPE_8188F(Adapter) || IS_HARDWARE_TYPE_8188GTV(Adapter)) {
if (IS_A_CUT(hal->version_id) || IS_B_CUT(hal->version_id)) {
RTW_INFO("%s() Active large power detection\n", __func__);
phy_active_large_power_detection_8188f(&(GET_HAL_DATA(Adapter)->odmpriv));
@ -504,6 +512,10 @@ static u8 PHY_QueryRFPathSwitch(PADAPTER padapter)
} else if (IS_HARDWARE_TYPE_8188F(padapter)) {
#ifdef CONFIG_RTL8188F
bmain = PHY_QueryRFPathSwitch_8188F(padapter);
#endif
} else if (IS_HARDWARE_TYPE_8188GTV(padapter)) {
#ifdef CONFIG_RTL8188GTV
bmain = PHY_QueryRFPathSwitch_8188GTV(padapter);
#endif
} else if (IS_HARDWARE_TYPE_8822B(padapter)) {
#ifdef CONFIG_RTL8822B
@ -538,7 +550,7 @@ static void PHY_SetRFPathSwitch(PADAPTER padapter , BOOLEAN bMain) {
#ifdef CONFIG_RTL8188E
phy_set_rf_path_switch_8188e(phydm, bMain);
#endif
} else if (IS_HARDWARE_TYPE_8814A(padapter)) {
} else if (IS_HARDWARE_TYPE_8814A(padapter)) {
#ifdef CONFIG_RTL8814A
phy_set_rf_path_switch_8814a(phydm, bMain);
#endif
@ -554,9 +566,13 @@ static void PHY_SetRFPathSwitch(PADAPTER padapter , BOOLEAN bMain) {
#ifdef CONFIG_RTL8703B
phy_set_rf_path_switch_8703b(phydm, bMain);
#endif
} else if (IS_HARDWARE_TYPE_8188F(padapter)) {
#ifdef CONFIG_RTL8188F
} else if (IS_HARDWARE_TYPE_8188F(padapter) || IS_HARDWARE_TYPE_8188GTV(padapter)) {
#if defined(CONFIG_RTL8188F) || defined(CONFIG_RTL8188GTV)
phy_set_rf_path_switch_8188f(phydm, bMain);
#endif
} else if (IS_HARDWARE_TYPE_8192F(padapter)) {
#ifdef CONFIG_RTL8192F
phy_set_rf_path_switch_8192f(padapter, bMain);
#endif
} else if (IS_HARDWARE_TYPE_8822B(padapter)) {
#ifdef CONFIG_RTL8822B
@ -575,17 +591,16 @@ static void PHY_SetRFPathSwitch(PADAPTER padapter , BOOLEAN bMain) {
static void phy_switch_rf_path_set(PADAPTER padapter , u8 *prf_set_State) {
#ifdef CONFIG_RTL8821C
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
struct dm_struct *p_dm = &pHalData->odmpriv;
#ifdef CONFIG_RTL8821C
if (IS_HARDWARE_TYPE_8821C(padapter)) {
config_phydm_set_ant_path(p_dm, *prf_set_State, p_dm->current_ant_num_8821c);
/* Do IQK when switching to BTG/WLG, requested by RF Binson */
if (*prf_set_State == SWITCH_TO_BTG || *prf_set_State == SWITCH_TO_WLG)
PHY_IQCalibrate(padapter, FALSE);
}
}
#endif
}
@ -619,7 +634,6 @@ MPT_InitializeAdapter(
s32 rtStatus = _SUCCESS;
PMPT_CONTEXT pMptCtx = &pAdapter->mppriv.mpt_ctx;
u32 ledsetting;
struct mlme_priv *pmlmepriv = &pAdapter->mlmepriv;
pMptCtx->bMptDrvUnload = _FALSE;
pMptCtx->bMassProdTest = _FALSE;
@ -644,9 +658,9 @@ MPT_InitializeAdapter(
phy_set_bb_reg(pAdapter, 0xA00, BIT8, 0x0);
PHY_SetRFPathSwitch(pAdapter, 1/*pHalData->bDefaultAntenna*/); /*default use Main*/
if (pHalData->PackageType == PACKAGE_DEFAULT)
if (pHalData->PackageType == PACKAGE_DEFAULT)
phy_set_rf_reg(pAdapter, RF_PATH_A, 0x51, bRFRegOffsetMask, 0x6B04E);
else
else
phy_set_rf_reg(pAdapter, RF_PATH_A, 0x51, bRFRegOffsetMask, 0x6F10E);
}
@ -826,6 +840,9 @@ void MPT_PwrCtlDM(PADAPTER padapter, u32 bstart)
else if (pDM_Odm->support_ic_type == ODM_RTL8723D) {
(*c.odm_tx_pwr_track_set_pwr)(pDM_Odm, BBSWING, RF_PATH_A, chnl);
SetTxPower(padapter);
} else if (pDM_Odm->support_ic_type == ODM_RTL8192F) {
(*c.odm_tx_pwr_track_set_pwr)(pDM_Odm, MIX_MODE, RF_PATH_A, chnl);
(*c.odm_tx_pwr_track_set_pwr)(pDM_Odm, MIX_MODE, RF_PATH_B, chnl);
} else {
(*c.odm_tx_pwr_track_set_pwr)(pDM_Odm, BBSWING, RF_PATH_A, chnl);
(*c.odm_tx_pwr_track_set_pwr)(pDM_Odm, BBSWING, RF_PATH_B, chnl);
@ -842,7 +859,6 @@ u32 mp_join(PADAPTER padapter, u8 mode)
WLAN_BSSID_EX bssid;
struct sta_info *psta;
u32 length;
u8 val8, join_type;
_irqL irqL;
s32 res = _SUCCESS;
@ -853,9 +869,6 @@ u32 mp_join(PADAPTER padapter, u8 mode)
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX *)(&(pmlmeinfo->network));
#ifdef CONFIG_IOCTL_CFG80211
struct wireless_dev *pwdev = padapter->rtw_wdev;
#endif /* #ifdef CONFIG_IOCTL_CFG80211 */
/* 1. initialize a new WLAN_BSSID_EX */
_rtw_memset(&bssid, 0, sizeof(WLAN_BSSID_EX));
RTW_INFO("%s ,pmppriv->network_macaddr=%x %x %x %x %x %x\n", __func__,
@ -894,7 +907,7 @@ u32 mp_join(PADAPTER padapter, u8 mode)
if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) {
rtw_disassoc_cmd(padapter, 500, 0);
rtw_indicate_disconnect(padapter, 0, _FALSE);
rtw_free_assoc_resources(padapter, 1);
rtw_free_assoc_resources_cmd(padapter, _TRUE, 0);
}
pmppriv->prev_fw_state = get_fwstate(pmlmepriv);
/*pmlmepriv->fw_state = WIFI_MP_STATE;*/
@ -962,6 +975,9 @@ end_of_mp_start_test:
s32 mp_start_test(PADAPTER padapter)
{
struct mp_priv *pmppriv = &padapter->mppriv;
#ifdef CONFIG_PCI_HCI
PHAL_DATA_TYPE hal;
#endif
s32 res = _SUCCESS;
padapter->registrypriv.mp_mode = 1;
@ -985,6 +1001,9 @@ s32 mp_start_test(PADAPTER padapter)
#ifdef CONFIG_RTL8188F
rtl8188f_InitHalDm(padapter);
#endif
#ifdef CONFIG_RTL8188GTV
rtl8188gtv_InitHalDm(padapter);
#endif
#ifdef CONFIG_RTL8188E
rtl8188e_InitHalDm(padapter);
#endif
@ -992,6 +1011,13 @@ s32 mp_start_test(PADAPTER padapter)
rtl8723d_InitHalDm(padapter);
#endif /* CONFIG_RTL8723D */
#ifdef CONFIG_PCI_HCI
hal = GET_HAL_DATA(padapter);
hal->pci_backdoor_ctrl = 0;
rtw_pci_aspm_config(padapter);
#endif
/* 3 0. update mp_priv */
if (!RF_TYPE_VALID(padapter->registrypriv.rf_config)) {
@ -1031,6 +1057,10 @@ void mp_stop_test(PADAPTER padapter)
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_network *tgt_network = &pmlmepriv->cur_network;
struct sta_info *psta;
#ifdef CONFIG_PCI_HCI
struct registry_priv *registry_par = &padapter->registrypriv;
PHAL_DATA_TYPE hal;
#endif
_irqL irqL;
@ -1044,7 +1074,7 @@ void mp_stop_test(PADAPTER padapter)
rtw_indicate_disconnect(padapter, 0, _FALSE);
/* 3 2. clear psta used in mp test mode.
* rtw_free_assoc_resources(padapter, 1); */
* rtw_free_assoc_resources(padapter, _TRUE); */
psta = rtw_get_stainfo(&padapter->stapriv, tgt_network->network.MacAddress);
if (psta)
rtw_free_stainfo(padapter, psta);
@ -1062,6 +1092,12 @@ end_of_mp_stop_test:
_exit_critical_bh(&pmlmepriv->lock, &irqL);
#ifdef CONFIG_PCI_HCI
hal = GET_HAL_DATA(padapter);
hal->pci_backdoor_ctrl = registry_par->pci_aspm_config;
rtw_pci_aspm_config(padapter);
#endif
#ifdef CONFIG_RTL8812A
rtl8812_InitHalDm(padapter);
#endif
@ -1077,6 +1113,9 @@ end_of_mp_stop_test:
#ifdef CONFIG_RTL8188F
rtl8188f_InitHalDm(padapter);
#endif
#ifdef CONFIG_RTL8188GTV
rtl8188gtv_InitHalDm(padapter);
#endif
#ifdef CONFIG_RTL8723D
rtl8723d_InitHalDm(padapter);
#endif
@ -1142,6 +1181,7 @@ static VOID mpt_AdjustRFRegByRateByChan92CU(PADAPTER pAdapter, u8 RateIdx, u8 Ch
* 01/09/2009 MHC Add CCK modification for 40MHZ. Suggestion from SD3.
*
*---------------------------------------------------------------------------*/
#if 0
static void mpt_SwitchRfSetting(PADAPTER pAdapter)
{
hal_mpt_SwitchRfSetting(pAdapter);
@ -1153,6 +1193,7 @@ static void MPT_CCKTxPowerAdjust(PADAPTER Adapter, BOOLEAN bInCH14)
{
hal_mpt_CCKTxPowerAdjust(Adapter, bInCH14);
}
#endif
/*---------------------------hal\rtl8192c\MPT_HelperFunc.c---------------------------*/
@ -1231,6 +1272,7 @@ s32 SetThermalMeter(PADAPTER pAdapter, u8 target_ther)
return hal_mpt_SetThermalMeter(pAdapter, target_ther);
}
#if 0
static void TriggerRFThermalMeter(PADAPTER pAdapter)
{
hal_mpt_TriggerRFThermalMeter(pAdapter);
@ -1240,6 +1282,7 @@ static u8 ReadRFThermalMeter(PADAPTER pAdapter)
{
return hal_mpt_ReadRFThermalMeter(pAdapter);
}
#endif
void GetThermalMeter(PADAPTER pAdapter, u8 *value)
{
@ -1313,7 +1356,7 @@ static struct xmit_frame *alloc_mp_xmitframe(struct xmit_priv *pxmitpriv)
}
#ifdef CONFIG_PCIE_HCI
#ifdef CONFIG_PCI_HCI
static u8 check_nic_enough_desc(_adapter *padapter, struct pkt_attrib *pattrib)
{
u32 prio;
@ -1373,7 +1416,7 @@ static thread_return mp_xmit_packet_thread(thread_context context)
RTW_INFO("%s:pkTx Start\n", __func__);
while (1) {
pxmitframe = alloc_mp_xmitframe(pxmitpriv);
#ifdef CONFIG_PCIE_HCI
#ifdef CONFIG_PCI_HCI
if(check_nic_enough_desc(padapter, &pmptx->attrib) == _FALSE) {
rtw_usleep_os(1000);
continue;
@ -1487,7 +1530,7 @@ void fill_tx_desc_8814a(PADAPTER padapter)
u32 pkt_size = pattrib->last_txcmdsz;
s32 bmcast = IS_MCAST(pattrib->ra);
u8 data_rate, pwr_status, offset;
u8 offset;
/* SET_TX_DESC_FIRST_SEG_8814A(pDesc, 1); */
SET_TX_DESC_LAST_SEG_8814A(pDesc, 1);
@ -1741,6 +1784,37 @@ void fill_tx_desc_8188f(PADAPTER padapter)
}
#endif
#if defined(CONFIG_RTL8188GTV)
void fill_tx_desc_8188gtv(PADAPTER padapter)
{
struct mp_priv *pmp_priv = &padapter->mppriv;
struct pkt_attrib *pattrib = &(pmp_priv->tx.attrib);
u8 *ptxdesc = pmp_priv->tx.desc;
SET_TX_DESC_AGG_BREAK_8188GTV(ptxdesc, 1);
SET_TX_DESC_MACID_8188GTV(ptxdesc, pattrib->mac_id);
SET_TX_DESC_QUEUE_SEL_8188GTV(ptxdesc, pattrib->qsel);
SET_TX_DESC_RATE_ID_8188GTV(ptxdesc, pattrib->raid);
SET_TX_DESC_SEQ_8188GTV(ptxdesc, pattrib->seqnum);
SET_TX_DESC_HWSEQ_EN_8188GTV(ptxdesc, 1);
SET_TX_DESC_USE_RATE_8188GTV(ptxdesc, 1);
SET_TX_DESC_DISABLE_FB_8188GTV(ptxdesc, 1);
if (pmp_priv->preamble)
if (HwRateToMPTRate(pmp_priv->rateidx) <= MPT_RATE_54M)
SET_TX_DESC_DATA_SHORT_8188GTV(ptxdesc, 1);
if (pmp_priv->bandwidth == CHANNEL_WIDTH_40)
SET_TX_DESC_DATA_BW_8188GTV(ptxdesc, 1);
SET_TX_DESC_TX_RATE_8188GTV(ptxdesc, pmp_priv->rateidx);
SET_TX_DESC_DATA_RATE_FB_LIMIT_8188GTV(ptxdesc, 0x1F);
SET_TX_DESC_RTS_RATE_FB_LIMIT_8188GTV(ptxdesc, 0xF);
}
#endif
#if defined(CONFIG_RTL8723D)
void fill_tx_desc_8723d(PADAPTER padapter)
{
@ -1773,6 +1847,70 @@ void fill_tx_desc_8723d(PADAPTER padapter)
}
#endif
#if defined(CONFIG_RTL8710B)
void fill_tx_desc_8710b(PADAPTER padapter)
{
struct mp_priv *pmp_priv = &padapter->mppriv;
struct pkt_attrib *pattrib = &(pmp_priv->tx.attrib);
u8 *ptxdesc = pmp_priv->tx.desc;
SET_TX_DESC_BK_8710B(ptxdesc, 1);
SET_TX_DESC_MACID_8710B(ptxdesc, pattrib->mac_id);
SET_TX_DESC_QUEUE_SEL_8710B(ptxdesc, pattrib->qsel);
SET_TX_DESC_RATE_ID_8710B(ptxdesc, pattrib->raid);
SET_TX_DESC_SEQ_8710B(ptxdesc, pattrib->seqnum);
SET_TX_DESC_HWSEQ_EN_8710B(ptxdesc, 1);
SET_TX_DESC_USE_RATE_8710B(ptxdesc, 1);
SET_TX_DESC_DISABLE_FB_8710B(ptxdesc, 1);
if (pmp_priv->preamble) {
if (HwRateToMPTRate(pmp_priv->rateidx) <= MPT_RATE_54M)
SET_TX_DESC_DATA_SHORT_8710B(ptxdesc, 1);
}
if (pmp_priv->bandwidth == CHANNEL_WIDTH_40)
SET_TX_DESC_DATA_BW_8710B(ptxdesc, 1);
SET_TX_DESC_TX_RATE_8710B(ptxdesc, pmp_priv->rateidx);
SET_TX_DESC_DATA_RATE_FB_LIMIT_8710B(ptxdesc, 0x1F);
SET_TX_DESC_RTS_RATE_FB_LIMIT_8710B(ptxdesc, 0xF);
}
#endif
#if defined(CONFIG_RTL8192F)
void fill_tx_desc_8192f(PADAPTER padapter)
{
struct mp_priv *pmp_priv = &padapter->mppriv;
struct pkt_attrib *pattrib = &(pmp_priv->tx.attrib);
u8 *ptxdesc = pmp_priv->tx.desc;
SET_TX_DESC_BK_8192F(ptxdesc, 1);
SET_TX_DESC_MACID_8192F(ptxdesc, pattrib->mac_id);
SET_TX_DESC_QUEUE_SEL_8192F(ptxdesc, pattrib->qsel);
SET_TX_DESC_RATE_ID_8192F(ptxdesc, pattrib->raid);
SET_TX_DESC_SEQ_8192F(ptxdesc, pattrib->seqnum);
SET_TX_DESC_HWSEQ_EN_8192F(ptxdesc, 1);
SET_TX_DESC_USE_RATE_8192F(ptxdesc, 1);
SET_TX_DESC_DISABLE_FB_8192F(ptxdesc, 1);
if (pmp_priv->preamble) {
if (HwRateToMPTRate(pmp_priv->rateidx) <= MPT_RATE_54M)
SET_TX_DESC_DATA_SHORT_8192F(ptxdesc, 1);
}
if (pmp_priv->bandwidth == CHANNEL_WIDTH_40)
SET_TX_DESC_DATA_BW_8192F(ptxdesc, 1);
SET_TX_DESC_TX_RATE_8192F(ptxdesc, pmp_priv->rateidx);
SET_TX_DESC_DATA_RATE_FB_LIMIT_8192F(ptxdesc, 0x1F);
SET_TX_DESC_RTS_RATE_FB_LIMIT_8192F(ptxdesc, 0xF);
}
#endif
static void Rtw_MPSetMacTxEDCA(PADAPTER padapter)
{
@ -1790,8 +1928,8 @@ static void Rtw_MPSetMacTxEDCA(PADAPTER padapter)
void SetPacketTx(PADAPTER padapter)
{
u8 *ptr, *pkt_start, *pkt_end, *fctrl;
u32 pkt_size, offset, startPlace, i;
u8 *ptr, *pkt_start, *pkt_end;
u32 pkt_size, i;
struct rtw_ieee80211_hdr *hdr;
u8 payload;
s32 bmcast;
@ -1812,7 +1950,7 @@ void SetPacketTx(PADAPTER padapter)
_rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
_rtw_memcpy(pattrib->ra, pattrib->dst, ETH_ALEN);
bmcast = IS_MCAST(pattrib->ra);
if (bmcast)
if (bmcast)
pattrib->psta = rtw_get_bcmc_stainfo(padapter);
else
pattrib->psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv));
@ -1885,10 +2023,24 @@ void SetPacketTx(PADAPTER padapter)
fill_tx_desc_8188f(padapter);
#endif
#if defined(CONFIG_RTL8188GTV)
if (IS_HARDWARE_TYPE_8188GTV(padapter))
fill_tx_desc_8188gtv(padapter);
#endif
#if defined(CONFIG_RTL8723D)
if (IS_HARDWARE_TYPE_8723D(padapter))
fill_tx_desc_8723d(padapter);
#endif
#if defined(CONFIG_RTL8192F)
if (IS_HARDWARE_TYPE_8192F(padapter))
fill_tx_desc_8192f(padapter);
#endif
#if defined(CONFIG_RTL8710B)
if (IS_HARDWARE_TYPE_8710B(padapter))
fill_tx_desc_8710b(padapter);
#endif
/* 3 4. make wlan header, make_wlanhdr() */
hdr = (struct rtw_ieee80211_hdr *)pkt_start;
@ -1984,6 +2136,7 @@ void SetPacketRx(PADAPTER pAdapter, u8 bStartRx, u8 bAB)
write_bbreg(pAdapter, 0x550, BIT3, bEnable);
#endif
rtw_write16(pAdapter, REG_RXFLTMAP0, 0xFFEF); /* REG_RXFLTMAP0 (RX Filter Map Group 0) */
pmppriv->brx_filter_beacon = _TRUE;
} else {
pHalData->ReceiveConfig |= RCR_ADF;
@ -2053,6 +2206,167 @@ u32 GetPhyRxPktCRC32Error(PADAPTER pAdapter)
return OFDM_cnt + CCK_cnt + HT_cnt;
}
struct psd_init_regs {
/* 3 wire */
int reg_88c;
int reg_c00;
int reg_e00;
int reg_1800;
int reg_1a00;
/* cck */
int reg_800;
int reg_808;
};
static int rtw_mp_psd_init(PADAPTER padapter, struct psd_init_regs *regs)
{
HAL_DATA_TYPE *phal_data = GET_HAL_DATA(padapter);
switch (phal_data->rf_type) {
/* 1R */
case RF_1T1R:
if (hal_chk_proto_cap(padapter, PROTO_CAP_11AC)) {
/* 11AC 1R PSD Setting 3wire & cck off */
regs->reg_c00 = rtw_read32(padapter, 0xC00);
phy_set_bb_reg(padapter, 0xC00, 0x3, 0x00);
regs->reg_808 = rtw_read32(padapter, 0x808);
phy_set_bb_reg(padapter, 0x808, 0x10000000, 0x0);
} else {
/* 11N 3-wire off 1 */
regs->reg_88c = rtw_read32(padapter, 0x88C);
phy_set_bb_reg(padapter, 0x88C, 0x300000, 0x3);
/* 11N CCK off */
regs->reg_800 = rtw_read32(padapter, 0x800);
phy_set_bb_reg(padapter, 0x800, 0x1000000, 0x0);
}
break;
/* 2R */
case RF_1T2R:
case RF_2T2R:
if (hal_chk_proto_cap(padapter, PROTO_CAP_11AC)) {
/* 11AC 2R PSD Setting 3wire & cck off */
regs->reg_c00 = rtw_read32(padapter, 0xC00);
regs->reg_e00 = rtw_read32(padapter, 0xE00);
phy_set_bb_reg(padapter, 0xC00, 0x3, 0x00);
phy_set_bb_reg(padapter, 0xE00, 0x3, 0x00);
regs->reg_808 = rtw_read32(padapter, 0x808);
phy_set_bb_reg(padapter, 0x808, 0x10000000, 0x0);
} else {
/* 11N 3-wire off 2 */
regs->reg_88c = rtw_read32(padapter, 0x88C);
phy_set_bb_reg(padapter, 0x88C, 0xF00000, 0xF);
/* 11N CCK off */
regs->reg_800 = rtw_read32(padapter, 0x800);
phy_set_bb_reg(padapter, 0x800, 0x1000000, 0x0);
}
break;
/* 3R */
case RF_2T3R:
case RF_3T3R:
if (hal_chk_proto_cap(padapter, PROTO_CAP_11AC)) {
/* 11AC 3R PSD Setting 3wire & cck off */
regs->reg_c00 = rtw_read32(padapter, 0xC00);
regs->reg_e00 = rtw_read32(padapter, 0xE00);
regs->reg_1800 = rtw_read32(padapter, 0x1800);
phy_set_bb_reg(padapter, 0xC00, 0x3, 0x00);
phy_set_bb_reg(padapter, 0xE00, 0x3, 0x00);
phy_set_bb_reg(padapter, 0x1800, 0x3, 0x00);
regs->reg_808 = rtw_read32(padapter, 0x808);
phy_set_bb_reg(padapter, 0x808, 0x10000000, 0x0);
} else {
RTW_ERR("%s: 11n don't support 3R\n", __func__);
return -1;
}
break;
/* 4R */
case RF_2T4R:
case RF_3T4R:
case RF_4T4R:
if (hal_chk_proto_cap(padapter, PROTO_CAP_11AC)) {
/* 11AC 4R PSD Setting 3wire & cck off */
regs->reg_c00 = rtw_read32(padapter, 0xC00);
regs->reg_e00 = rtw_read32(padapter, 0xE00);
regs->reg_1800 = rtw_read32(padapter, 0x1800);
regs->reg_1a00 = rtw_read32(padapter, 0x1A00);
phy_set_bb_reg(padapter, 0xC00, 0x3, 0x00);
phy_set_bb_reg(padapter, 0xE00, 0x3, 0x00);
phy_set_bb_reg(padapter, 0x1800, 0x3, 0x00);
phy_set_bb_reg(padapter, 0x1A00, 0x3, 0x00);
regs->reg_808 = rtw_read32(padapter, 0x808);
phy_set_bb_reg(padapter, 0x808, 0x10000000, 0x0);
} else {
RTW_ERR("%s: 11n don't support 4R\n", __func__);
return -1;
}
break;
default:
RTW_ERR("%s: unknown %d rf type\n", __func__, phal_data->rf_type);
return -1;
}
/* Set PSD points, 0=128, 1=256, 2=512, 3=1024 */
if (hal_chk_proto_cap(padapter, PROTO_CAP_11AC))
phy_set_bb_reg(padapter, 0x910, 0xC000, 3);
else
phy_set_bb_reg(padapter, 0x808, 0xC000, 3);
RTW_INFO("%s: set %d rf type done\n", __func__, phal_data->rf_type);
return 0;
}
static int rtw_mp_psd_close(PADAPTER padapter, struct psd_init_regs *regs)
{
HAL_DATA_TYPE *phal_data = GET_HAL_DATA(padapter);
if (!hal_chk_proto_cap(padapter, PROTO_CAP_11AC)) {
/* 11n 3wire restore */
rtw_write32(padapter, 0x88C, regs->reg_88c);
/* 11n cck restore */
rtw_write32(padapter, 0x800, regs->reg_800);
RTW_INFO("%s: restore %d rf type\n", __func__, phal_data->rf_type);
return 0;
}
/* 11ac 3wire restore */
switch (phal_data->rf_type) {
case RF_1T1R:
rtw_write32(padapter, 0xC00, regs->reg_c00);
break;
case RF_1T2R:
case RF_2T2R:
rtw_write32(padapter, 0xC00, regs->reg_c00);
rtw_write32(padapter, 0xE00, regs->reg_e00);
break;
case RF_2T3R:
case RF_3T3R:
rtw_write32(padapter, 0xC00, regs->reg_c00);
rtw_write32(padapter, 0xE00, regs->reg_e00);
rtw_write32(padapter, 0x1800, regs->reg_1800);
break;
case RF_2T4R:
case RF_3T4R:
case RF_4T4R:
rtw_write32(padapter, 0xC00, regs->reg_c00);
rtw_write32(padapter, 0xE00, regs->reg_e00);
rtw_write32(padapter, 0x1800, regs->reg_1800);
rtw_write32(padapter, 0x1A00, regs->reg_1a00);
break;
default:
RTW_WARN("%s: unknown %d rf type\n", __func__, phal_data->rf_type);
break;
}
/* 11ac cck restore */
rtw_write32(padapter, 0x808, regs->reg_808);
RTW_INFO("%s: restore %d rf type done\n", __func__, phal_data->rf_type);
return 0;
}
/* reg 0x808[9:0]: FFT data x
* reg 0x808[22]: 0 --> 1 to get 1 FFT data y
* reg 0x8B4[15:0]: FFT data y report */
@ -2102,7 +2416,8 @@ u32 mp_query_psd(PADAPTER pAdapter, u8 *data)
{
u32 i, psd_pts = 0, psd_start = 0, psd_stop = 0;
u32 psd_data = 0;
struct psd_init_regs regs = {};
int psd_analysis = 0;
#ifdef PLATFORM_LINUX
if (!netif_running(pAdapter->pnetdev)) {
@ -2118,6 +2433,11 @@ u32 mp_query_psd(PADAPTER pAdapter, u8 *data)
psd_pts = 128;
psd_start = 64;
psd_stop = 128;
} else if (strncmp(data, "analysis,", 9) == 0) {
if (rtw_mp_psd_init(pAdapter, &regs) != 0)
return 0;
psd_analysis = 1;
sscanf(data + 9, "pts=%d,start=%d,stop=%d", &psd_pts, &psd_start, &psd_stop);
} else
sscanf(data, "pts=%d,start=%d,stop=%d", &psd_pts, &psd_start, &psd_stop);
@ -2139,6 +2459,9 @@ u32 mp_query_psd(PADAPTER pAdapter, u8 *data)
rtw_mdelay_os(100);
#endif
if (psd_analysis)
rtw_mp_psd_close(pAdapter, &regs);
return strlen(data) + 1;
}
@ -2735,7 +3058,6 @@ ULONG mpt_ProQueryCalTxPower(
PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx);
ULONG TxPower = 1;
u1Byte rate = 0;
struct txpwr_idx_comp tic;
u8 mgn_rate = mpt_to_mgnt_rate(pMptCtx->mpt_rate_index);
@ -2746,10 +3068,14 @@ ULONG mpt_ProQueryCalTxPower(
, TxPower, tic.base, (tic.by_rate > tic.limit ? tic.limit : tic.by_rate), tic.by_rate, tic.limit, tic.tpt, tic.ebias);
pAdapter->mppriv.txpoweridx = (u8)TxPower;
pMptCtx->TxPwrLevel[RF_PATH_A] = (u8)TxPower;
pMptCtx->TxPwrLevel[RF_PATH_B] = (u8)TxPower;
pMptCtx->TxPwrLevel[RF_PATH_C] = (u8)TxPower;
pMptCtx->TxPwrLevel[RF_PATH_D] = (u8)TxPower;
if (RfPath == RF_PATH_A)
pMptCtx->TxPwrLevel[RF_PATH_A] = (u8)TxPower;
else if (RfPath == RF_PATH_B)
pMptCtx->TxPwrLevel[RF_PATH_B] = (u8)TxPower;
else if (RfPath == RF_PATH_C)
pMptCtx->TxPwrLevel[RF_PATH_C] = (u8)TxPower;
else if (RfPath == RF_PATH_D)
pMptCtx->TxPwrLevel[RF_PATH_D] = (u8)TxPower;
hal_mpt_SetTxPower(pAdapter);
return TxPower;

View File

@ -103,43 +103,16 @@ void rtw_odm_adaptivity_mode_msg(void *sel, _adapter *adapter)
_RTW_PRINT_SEL(sel, "INVALID\n");
}
#define RTW_ADAPTIVITY_DML_DISABLE 0
#define RTW_ADAPTIVITY_DML_ENABLE 1
void rtw_odm_adaptivity_dml_msg(void *sel, _adapter *adapter)
{
struct registry_priv *regsty = &adapter->registrypriv;
RTW_PRINT_SEL(sel, "RTW_ADAPTIVITY_DML_");
if (regsty->adaptivity_dml == RTW_ADAPTIVITY_DML_DISABLE)
_RTW_PRINT_SEL(sel, "DISABLE\n");
else if (regsty->adaptivity_dml == RTW_ADAPTIVITY_DML_ENABLE)
_RTW_PRINT_SEL(sel, "ENABLE\n");
else
_RTW_PRINT_SEL(sel, "INVALID\n");
}
void rtw_odm_adaptivity_dc_backoff_msg(void *sel, _adapter *adapter)
{
struct registry_priv *regsty = &adapter->registrypriv;
RTW_PRINT_SEL(sel, "RTW_ADAPTIVITY_DC_BACKOFF:%u\n", regsty->adaptivity_dc_backoff);
}
void rtw_odm_adaptivity_config_msg(void *sel, _adapter *adapter)
{
rtw_odm_adaptivity_ver_msg(sel, adapter);
rtw_odm_adaptivity_en_msg(sel, adapter);
rtw_odm_adaptivity_mode_msg(sel, adapter);
rtw_odm_adaptivity_dml_msg(sel, adapter);
rtw_odm_adaptivity_dc_backoff_msg(sel, adapter);
}
bool rtw_odm_adaptivity_needed(_adapter *adapter)
{
struct registry_priv *regsty = &adapter->registrypriv;
struct mlme_priv *mlme = &adapter->mlmepriv;
bool ret = _FALSE;
if (regsty->adaptivity_en == RTW_ADAPTIVITY_EN_ENABLE)
@ -154,32 +127,20 @@ void rtw_odm_adaptivity_parm_msg(void *sel, _adapter *adapter)
rtw_odm_adaptivity_config_msg(sel, adapter);
RTW_PRINT_SEL(sel, "%10s %16s %16s %22s %12s\n"
, "th_l2h_ini", "th_edcca_hl_diff", "th_l2h_ini_mode2", "th_edcca_hl_diff_mode2", "edcca_enable");
RTW_PRINT_SEL(sel, "0x%-8x %-16d 0x%-14x %-22d %-12d\n"
RTW_PRINT_SEL(sel, "%10s %16s\n"
, "th_l2h_ini", "th_edcca_hl_diff");
RTW_PRINT_SEL(sel, "0x%-8x %-16d\n"
, (u8)odm->th_l2h_ini
, odm->th_edcca_hl_diff
, (u8)odm->th_l2h_ini_mode2
, odm->th_edcca_hl_diff_mode2
, odm->edcca_enable
);
RTW_PRINT_SEL(sel, "%15s %9s\n", "AdapEnableState", "Adap_Flag");
RTW_PRINT_SEL(sel, "%-15x %-9x\n"
, odm->adaptivity_enable
, odm->adaptivity_flag
);
}
void rtw_odm_adaptivity_parm_set(_adapter *adapter, s8 th_l2h_ini, s8 th_edcca_hl_diff, s8 th_l2h_ini_mode2, s8 th_edcca_hl_diff_mode2, u8 edcca_enable)
void rtw_odm_adaptivity_parm_set(_adapter *adapter, s8 th_l2h_ini, s8 th_edcca_hl_diff)
{
struct dm_struct *odm = adapter_to_phydm(adapter);
odm->th_l2h_ini = th_l2h_ini;
odm->th_edcca_hl_diff = th_edcca_hl_diff;
odm->th_l2h_ini_mode2 = th_l2h_ini_mode2;
odm->th_edcca_hl_diff_mode2 = th_edcca_hl_diff_mode2;
odm->edcca_enable = edcca_enable;
}
void rtw_odm_get_perpkt_rssi(void *sel, _adapter *adapter)
@ -217,10 +178,10 @@ void rtw_odm_releasespinlock(_adapter *adapter, enum rt_spinlock_type type)
}
}
inline u8 rtw_odm_get_dfs_domain(_adapter *adapter)
inline u8 rtw_odm_get_dfs_domain(struct dvobj_priv *dvobj)
{
#ifdef CONFIG_DFS_MASTER
struct dm_struct *pDM_Odm = adapter_to_phydm(adapter);
struct dm_struct *pDM_Odm = dvobj_to_phydm(dvobj);
return pDM_Odm->dfs_region_domain;
#else
@ -228,10 +189,10 @@ inline u8 rtw_odm_get_dfs_domain(_adapter *adapter)
#endif
}
inline u8 rtw_odm_dfs_domain_unknown(_adapter *adapter)
inline u8 rtw_odm_dfs_domain_unknown(struct dvobj_priv *dvobj)
{
#ifdef CONFIG_DFS_MASTER
return rtw_odm_get_dfs_domain(adapter) == PHYDM_DFS_DOMAIN_UNKNOWN;
return rtw_odm_get_dfs_domain(dvobj) == PHYDM_DFS_DOMAIN_UNKNOWN;
#else
return 1;
#endif
@ -258,6 +219,11 @@ inline BOOLEAN rtw_odm_radar_detect(_adapter *adapter)
{
return phydm_radar_detect(adapter_to_phydm(adapter));
}
inline u8 rtw_odm_radar_detect_polling_int_ms(struct dvobj_priv *dvobj)
{
return phydm_dfs_polling_time(dvobj_to_phydm(dvobj));
}
#endif /* CONFIG_DFS_MASTER */
void rtw_odm_parse_rx_phy_status_chinfo(union recv_frame *rframe, u8 *phys)
@ -301,7 +267,7 @@ void rtw_odm_parse_rx_phy_status_chinfo(union recv_frame *rframe, u8 *phys)
*/
if ((*phys & 0xf) == 0) {
struct phy_status_rpt_jaguar2_type0 *phys_t0 = (struct phy_status_rpt_jaguar2_type0 *)phys;
struct phy_sts_rpt_jgr2_type0 *phys_t0 = (struct phy_sts_rpt_jgr2_type0 *)phys;
if (DBG_RX_PHYSTATUS_CHINFO) {
RTW_PRINT("phys_t%u ta="MAC_FMT" %s, %s(band:%u, ch:%u, l_rxsc:%u)\n"
@ -314,7 +280,7 @@ void rtw_odm_parse_rx_phy_status_chinfo(union recv_frame *rframe, u8 *phys)
}
} else if ((*phys & 0xf) == 1) {
struct phy_status_rpt_jaguar2_type1 *phys_t1 = (struct phy_status_rpt_jaguar2_type1 *)phys;
struct phy_sts_rpt_jgr2_type1 *phys_t1 = (struct phy_sts_rpt_jgr2_type1 *)phys;
u8 rxsc = (attrib->data_rate > DESC_RATE11M && attrib->data_rate < DESC_RATEMCS0) ? phys_t1->l_rxsc : phys_t1->ht_rxsc;
u8 pkt_cch = 0;
u8 pkt_bw = CHANNEL_WIDTH_20;
@ -435,7 +401,7 @@ type1_end:
attrib->ch = pkt_cch;
} else {
struct phy_status_rpt_jaguar2_type2 *phys_t2 = (struct phy_status_rpt_jaguar2_type2 *)phys;
struct phy_sts_rpt_jgr2_type2 *phys_t2 = (struct phy_sts_rpt_jgr2_type2 *)phys;
if (DBG_RX_PHYSTATUS_CHINFO) {
RTW_PRINT("phys_t%u ta="MAC_FMT" %s, %s(band:%u, ch:%u, l_rxsc:%u, ht_rxsc:%u)\n"

View File

@ -290,7 +290,6 @@ static void issue_p2p_provision_resp(struct wifidirect_info *pwdinfo, u8 *raddr,
unsigned short *fctrl;
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
@ -2807,8 +2806,6 @@ u8 process_p2p_group_negotation_resp(struct wifidirect_info *pwdinfo, u8 *pframe
u8 attr_content = 0x00;
u32 attr_contentlen = 0;
u8 operatingch_info[5] = { 0x00 };
uint ch_cnt = 0;
u8 ch_content[100] = { 0x00 };
u8 groupid[38];
u16 cap_attr;
u8 peer_ch_list[100] = { 0x00 };
@ -2974,7 +2971,9 @@ u8 process_p2p_group_negotation_resp(struct wifidirect_info *pwdinfo, u8 *pframe
u8 process_p2p_group_negotation_confirm(struct wifidirect_info *pwdinfo, u8 *pframe, uint len)
{
#ifdef CONFIG_CONCURRENT_MODE
_adapter *padapter = pwdinfo->padapter;
#endif
u8 *ies;
u32 ies_len;
u8 *p2p_ie;
@ -3097,8 +3096,6 @@ void p2p_concurrent_handler(_adapter *padapter);
void restore_p2p_state_handler(_adapter *padapter)
{
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_FAIL))
rtw_p2p_set_role(pwdinfo, P2P_ROLE_DEVICE);
@ -3295,16 +3292,15 @@ u8 roch_stay_in_cur_chan(_adapter *padapter)
if (iface) {
pmlmepriv = &iface->mlmepriv;
if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING | WIFI_UNDER_WPS) == _TRUE) {
RTW_ERR(ADPT_FMT"- _FW_UNDER_LINKING |WIFI_UNDER_WPS (mlme state:0x%x)\n",
if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING | WIFI_UNDER_WPS | WIFI_UNDER_KEY_HANDSHAKE) == _TRUE) {
RTW_INFO(ADPT_FMT"- _FW_UNDER_LINKING |WIFI_UNDER_WPS | WIFI_UNDER_KEY_HANDSHAKE (mlme state:0x%x)\n",
ADPT_ARG(iface), get_fwstate(&iface->mlmepriv));
rst = _TRUE;
break;
}
#ifdef CONFIG_AP_MODE
if (MLME_IS_AP(iface) || MLME_IS_MESH(iface)) {
if (rtw_ap_sta_linking_state_check(iface) == _TRUE) {
RTW_ERR(ADPT_FMT"- SoftAP/Mesh -have sta under linking\n", ADPT_ARG(iface));
if (rtw_ap_sta_states_check(iface) == _TRUE) {
rst = _TRUE;
break;
}
@ -3322,8 +3318,12 @@ static int ro_ch_handler(_adapter *adapter, u8 *buf)
struct p2p_roch_parm *roch_parm = (struct p2p_roch_parm *)buf;
struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter);
struct cfg80211_wifidirect_info *pcfg80211_wdinfo = &adapter->cfg80211_wdinfo;
struct wifidirect_info *pwdinfo = &adapter->wdinfo;
#ifdef CONFIG_CONCURRENT_MODE
struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
#ifdef RTW_ROCH_BACK_OP
struct wifidirect_info *pwdinfo = &adapter->wdinfo;
#endif
#endif
u8 ready_on_channel = _FALSE;
u8 remain_ch;
unsigned int duration;
@ -3442,6 +3442,7 @@ static int cancel_ro_ch_handler(_adapter *padapter, u8 *buf)
#if defined(RTW_ROCH_BACK_OP) && defined(CONFIG_CONCURRENT_MODE)
_cancel_timer_ex(&pwdinfo->ap_p2p_switch_timer);
ATOMIC_SET(&pwdev_priv->switch_ch_to, 1);
#endif
if (rtw_mi_get_ch_setting_union(padapter, &ch, &bw, &offset) != 0) {
@ -3503,6 +3504,7 @@ static void ro_ch_timer_process(void *FunctionContext)
p2p_cancel_roch_cmd(adapter, 0, NULL, 0);
}
#if 0
static void rtw_change_p2pie_op_ch(_adapter *padapter, const u8 *frame_body, u32 len, u8 ch)
{
u8 *ies, *p2p_ie;
@ -3533,7 +3535,9 @@ static void rtw_change_p2pie_op_ch(_adapter *padapter, const u8 *frame_body, u32
p2p_ie = rtw_get_p2p_ie(p2p_ie + p2p_ielen, ies_len - (p2p_ie - ies + p2p_ielen), NULL, &p2p_ielen);
}
}
#endif
#if defined(CONFIG_CONCURRENT_MODE) && defined(CONFIG_CFG80211_ONECHANNEL_UNDER_CONCURRENT)
static void rtw_change_p2pie_ch_list(_adapter *padapter, const u8 *frame_body, u32 len, u8 ch)
{
u8 *ies, *p2p_ie;
@ -3577,11 +3581,12 @@ static void rtw_change_p2pie_ch_list(_adapter *padapter, const u8 *frame_body, u
p2p_ie = rtw_get_p2p_ie(p2p_ie + p2p_ielen, ies_len - (p2p_ie - ies + p2p_ielen), NULL, &p2p_ielen);
}
}
#endif
#if defined(CONFIG_CONCURRENT_MODE) && defined(CONFIG_CFG80211_ONECHANNEL_UNDER_CONCURRENT)
static bool rtw_chk_p2pie_ch_list_with_buddy(_adapter *padapter, const u8 *frame_body, u32 len)
{
bool fit = _FALSE;
#ifdef CONFIG_CONCURRENT_MODE
u8 *ies, *p2p_ie;
u32 ies_len, p2p_ielen;
u8 union_ch = rtw_mi_get_union_chan(padapter);
@ -3623,14 +3628,14 @@ static bool rtw_chk_p2pie_ch_list_with_buddy(_adapter *padapter, const u8 *frame
/* Get the next P2P IE */
p2p_ie = rtw_get_p2p_ie(p2p_ie + p2p_ielen, ies_len - (p2p_ie - ies + p2p_ielen), NULL, &p2p_ielen);
}
#endif
return fit;
}
#if defined(CONFIG_P2P_INVITE_IOT)
static bool rtw_chk_p2pie_op_ch_with_buddy(_adapter *padapter, const u8 *frame_body, u32 len)
{
bool fit = _FALSE;
#ifdef CONFIG_CONCURRENT_MODE
u8 *ies, *p2p_ie;
u32 ies_len, p2p_ielen;
u8 union_ch = rtw_mi_get_union_chan(padapter);
@ -3659,13 +3664,13 @@ static bool rtw_chk_p2pie_op_ch_with_buddy(_adapter *padapter, const u8 *frame_b
/* Get the next P2P IE */
p2p_ie = rtw_get_p2p_ie(p2p_ie + p2p_ielen, ies_len - (p2p_ie - ies + p2p_ielen), NULL, &p2p_ielen);
}
#endif
return fit;
}
#endif
static void rtw_cfg80211_adjust_p2pie_channel(_adapter *padapter, const u8 *frame_body, u32 len)
{
#ifdef CONFIG_CONCURRENT_MODE
u8 *ies, *p2p_ie;
u32 ies_len, p2p_ielen;
u8 union_ch = rtw_mi_get_union_chan(padapter);
@ -3728,8 +3733,8 @@ static void rtw_cfg80211_adjust_p2pie_channel(_adapter *padapter, const u8 *fram
}
#endif
}
#endif
#ifdef CONFIG_WFD
u32 rtw_xframe_build_wfd_ie(struct xmit_frame *xframe)
@ -3813,8 +3818,6 @@ u32 rtw_xframe_build_wfd_ie(struct xmit_frame *xframe)
bool rtw_xframe_del_wfd_ie(struct xmit_frame *xframe)
{
#define DBG_XFRAME_DEL_WFD_IE 0
_adapter *adapter = xframe->padapter;
u8 *frame = xframe->buf_addr + TXDESC_OFFSET;
u8 *frame_body = frame + sizeof(struct rtw_ieee80211_hdr_3addr);
u8 *frame_tail = frame + xframe->attrib.pktlen;
@ -3861,12 +3864,9 @@ bool rtw_xframe_del_wfd_ie(struct xmit_frame *xframe)
void rtw_xframe_chk_wfd_ie(struct xmit_frame *xframe)
{
_adapter *adapter = xframe->padapter;
u8 *frame = xframe->buf_addr + TXDESC_OFFSET;
u8 *frame_body = frame + sizeof(struct rtw_ieee80211_hdr_3addr);
u8 *frame_tail = frame + xframe->attrib.pktlen;
#ifdef CONFIG_IOCTL_CFG80211
struct wifidirect_info *wdinfo = &adapter->wdinfo;
struct mlme_priv *mlme = &adapter->mlmepriv;
#endif
u8 build = 0;
u8 del = 0;
@ -3874,7 +3874,7 @@ void rtw_xframe_chk_wfd_ie(struct xmit_frame *xframe)
del = 1;
#ifdef CONFIG_IOCTL_CFG80211
if (_TRUE == wdinfo->wfd_info->wfd_enable)
if (wdinfo->wfd_info->wfd_enable == _TRUE)
#endif
del = build = 1;
@ -3894,7 +3894,6 @@ u8 *dump_p2p_attr_ch_list(u8 *p2p_ie, uint p2p_ielen, u8 *buf, u32 buf_len)
int w_sz = 0;
u8 ch_cnt = 0;
u8 ch_list[40];
bool continuous = _FALSE;
pattr = rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CH_LIST, NULL, &attr_contentlen);
if (pattr != NULL) {
@ -4353,7 +4352,6 @@ void rtw_init_cfg80211_wifidirect_info(_adapter *padapter)
s32 p2p_protocol_wk_hdl(_adapter *padapter, int intCmdType, u8 *buf)
{
int ret = H2C_SUCCESS;
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
switch (intCmdType) {
case P2P_FIND_PHASE_WK:
@ -4430,7 +4428,6 @@ int process_p2p_cross_connect_ie(PADAPTER padapter, u8 *IEs, u32 IELength)
u8 p2p_attr[MAX_P2P_IE_LEN] = { 0x00 };/* NoA length should be n*(13) + 2 */
u32 attr_contentlen = 0;
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
if (IELength <= _BEACON_IE_OFFSET_)
@ -4553,7 +4550,6 @@ void p2p_ps_wk_hdl(_adapter *padapter, u8 p2p_ps_state)
{
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
u32 ps_deny = 0;
/* Pre action for p2p state */
@ -4731,7 +4727,6 @@ static void pre_tx_scan_timer_process(void *FunctionContext)
struct wifidirect_info *pwdinfo = &adapter->wdinfo;
_irqL irqL;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
u8 _status = 0;
if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
return;
@ -5045,7 +5040,6 @@ void init_wifidirect_info(_adapter *padapter, enum P2P_ROLE role)
#ifdef CONFIG_WFD
struct wifi_display_info *pwfd_info = &padapter->wfd_info;
#endif
u8 union_ch = 0;
pwdinfo = &padapter->wdinfo;
pwdinfo->padapter = padapter;
@ -5060,6 +5054,8 @@ void init_wifidirect_info(_adapter *padapter, enum P2P_ROLE role)
&& pwdinfo->driver_interface != DRIVER_CFG80211
) {
#ifdef CONFIG_CONCURRENT_MODE
u8 union_ch = 0;
if (rtw_mi_check_status(padapter, MI_LINKED))
union_ch = rtw_mi_get_union_chan(padapter);
@ -5195,6 +5191,14 @@ void init_wifidirect_info(_adapter *padapter, enum P2P_ROLE role)
pwdinfo->p2p_info.scan_op_ch_only = 0;
}
void _rtw_p2p_set_role(struct wifidirect_info *wdinfo, enum P2P_ROLE role)
{
if (wdinfo->role != role) {
wdinfo->role = role;
rtw_mi_update_iface_status(&(wdinfo->padapter->mlmepriv), 0);
}
}
#ifdef CONFIG_DBG_P2P
/**
@ -5343,9 +5347,6 @@ int rtw_p2p_enable(_adapter *padapter, enum P2P_ROLE role)
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
if (role == P2P_ROLE_DEVICE || role == P2P_ROLE_CLIENT || role == P2P_ROLE_GO) {
u8 channel, ch_offset;
u16 bwmode;
#if defined(CONFIG_CONCURRENT_MODE) && (!defined(RTW_P2P_GROUP_INTERFACE) || !RTW_P2P_GROUP_INTERFACE)
/* Commented by Albert 2011/12/30 */
/* The driver just supports 1 P2P group operation. */

View File

@ -18,13 +18,13 @@
#include <hal_data.h>
#include <hal_com_h2c.h>
#ifdef DBG_CHECK_FW_PS_STATE
int rtw_fw_ps_state(PADAPTER padapter)
{
struct dvobj_priv *psdpriv = padapter->dvobj;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
int ret = _FAIL, dont_care = 0;
u16 fw_ps_state = 0;
u32 start_time;
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
struct registry_priv *registry_par = &padapter->registrypriv;
@ -40,6 +40,15 @@ int rtw_fw_ps_state(PADAPTER padapter)
, rtw_is_drv_stopped(padapter) ? "True" : "False");
goto exit_fw_ps_state;
}
#if defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) || defined(CONFIG_RTL8822C)
rtw_hal_get_hwreg(padapter, HW_VAR_FW_PS_STATE, (u8 *)&fw_ps_state);
if ((fw_ps_state & BIT_LPS_STATUS) == 0)
ret = _SUCCESS;
else {
pdbgpriv->dbg_poll_fail_cnt++;
RTW_INFO("%s: fw_ps_state=%04x\n", __FUNCTION__, fw_ps_state);
}
#else
rtw_hal_set_hwreg(padapter, HW_VAR_SET_REQ_FW_PS, (u8 *)&dont_care);
{
/* 4. if 0x88[7]=1, driver set cmd to leave LPS/IPS. */
@ -58,13 +67,13 @@ int rtw_fw_ps_state(PADAPTER padapter)
RTW_INFO("%s: fw_ps_state=%04x\n", __FUNCTION__, fw_ps_state);
}
}
#endif
exit_fw_ps_state:
_exit_pwrlock(&pwrpriv->check_32k_lock);
return ret;
}
#endif /*DBG_CHECK_FW_PS_STATE*/
#ifdef CONFIG_IPS
void _ips_enter(_adapter *padapter)
{
@ -144,8 +153,10 @@ int _ips_leave(_adapter *padapter)
int ips_leave(_adapter *padapter)
{
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
#ifdef DBG_CHECK_FW_PS_STATE
struct dvobj_priv *psdpriv = padapter->dvobj;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
#endif
int ret;
if (!is_primary_adapter(padapter))
@ -263,9 +274,6 @@ exit:
*/
void rtw_ps_processor(_adapter *padapter)
{
#ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
#endif /* CONFIG_P2P */
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
struct dvobj_priv *psdpriv = padapter->dvobj;
@ -398,9 +406,69 @@ void pwr_state_check_handler(void *ctx)
}
#ifdef CONFIG_LPS
#ifdef CONFIG_CHECK_LEAVE_LPS
#ifdef CONFIG_LPS_CHK_BY_TP
void traffic_check_for_leave_lps_by_tp(PADAPTER padapter, u8 tx, struct sta_info *sta)
{
struct stainfo_stats *pstats = &sta->sta_stats;
u64 cur_acc_tx_bytes = 0, cur_acc_rx_bytes = 0;
u32 tx_tp_kbyte = 0, rx_tp_kbyte = 0;
u32 tx_tp_th = 0, rx_tp_th = 0;
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
u8 leave_lps = _FALSE;
if (tx) { /* from tx */
cur_acc_tx_bytes = pstats->tx_bytes - pstats->acc_tx_bytes;
tx_tp_kbyte = cur_acc_tx_bytes >> 10;
tx_tp_th = pwrpriv->lps_tx_tp_th * 1024 / 8 * 2; /*KBytes @2s*/
if (tx_tp_kbyte >= tx_tp_th ||
padapter->mlmepriv.LinkDetectInfo.NumTxOkInPeriod >= pwrpriv->lps_tx_pkts){
if (pwrpriv->bLeisurePs
&& (pwrpriv->pwr_mode != PS_MODE_ACTIVE)
#ifdef CONFIG_BT_COEXIST
&& (rtw_btcoex_IsBtControlLps(padapter) == _FALSE)
#endif
) {
leave_lps = _TRUE;
}
}
} else { /* from rx path */
cur_acc_rx_bytes = pstats->rx_bytes - pstats->acc_rx_bytes;
rx_tp_kbyte = cur_acc_rx_bytes >> 10;
rx_tp_th = pwrpriv->lps_rx_tp_th * 1024 / 8 * 2;
if (rx_tp_kbyte>= rx_tp_th ||
padapter->mlmepriv.LinkDetectInfo.NumRxUnicastOkInPeriod >= pwrpriv->lps_rx_pkts) {
if (pwrpriv->bLeisurePs
&& (pwrpriv->pwr_mode != PS_MODE_ACTIVE)
#ifdef CONFIG_BT_COEXIST
&& (rtw_btcoex_IsBtControlLps(padapter) == _FALSE)
#endif
) {
leave_lps = _TRUE;
}
}
}
if (leave_lps) {
#ifdef DBG_LPS_CHK_BY_TP
RTW_INFO("leave lps via %s, ", tx ? "Tx" : "Rx");
if (tx)
RTW_INFO("Tx = %d [%d] (KB)\n", tx_tp_kbyte, tx_tp_th);
else
RTW_INFO("Rx = %d [%d] (KB)\n", rx_tp_kbyte, rx_tp_th);
#endif
pwrpriv->lps_chk_cnt = pwrpriv->lps_chk_cnt_th;
/* rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, 1); */
rtw_lps_ctrl_wk_cmd(padapter, tx ? LPS_CTRL_TX_TRAFFIC_LEAVE : LPS_CTRL_RX_TRAFFIC_LEAVE, 1);
}
}
#endif /*CONFIG_LPS_CHK_BY_TP*/
void traffic_check_for_leave_lps(PADAPTER padapter, u8 tx, u32 tx_packets)
{
#ifdef CONFIG_CHECK_LEAVE_LPS
static systime start_time = 0;
static u32 xmit_cnt = 0;
u8 bLeaveLPS = _FALSE;
@ -450,62 +518,76 @@ void traffic_check_for_leave_lps(PADAPTER padapter, u8 tx, u32 tx_packets)
/* rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, 1); */
rtw_lps_ctrl_wk_cmd(padapter, tx ? LPS_CTRL_TX_TRAFFIC_LEAVE : LPS_CTRL_RX_TRAFFIC_LEAVE, tx ? 0 : 1);
}
#endif /* CONFIG_CHECK_LEAVE_LPS */
}
#endif /* CONFIG_CHECK_LEAVE_LPS */
#ifdef CONFIG_LPS_LCLK
u8 rtw_cpwm_polling(_adapter *adapter, u8 cpwm_orig)
#define LPS_CPWM_TIMEOUT_MS 10 /*ms*/
#define LPS_RPWM_RETRY_CNT 3
u8 rtw_cpwm_polling(_adapter *adapter, u8 rpwm, u8 cpwm_orig)
{
u8 result = _FAIL;
u8 cpwm_now;
u8 poll_cnt = 0;
u8 rst = _FAIL;
u8 cpwm_now = 0;
systime start_time;
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(adapter);
#ifdef DBG_CHECK_FW_PS_STATE
struct debug_priv *pdbgpriv = &(adapter_to_dvobj(adapter)->drv_dbg);
#endif
/*RTW_INFO("%s.....\n", __func__);*/
pwrpriv->rpwm_retry = 0;
start_time = rtw_get_current_time();
/* polling cpwm */
do {
rtw_msleep_os(1);
poll_cnt++;
cpwm_now = 0;
rtw_hal_get_hwreg(adapter, HW_VAR_CPWM, &cpwm_now);
start_time = rtw_get_current_time();
do {
rtw_msleep_os(1);
rtw_hal_get_hwreg(adapter, HW_VAR_CPWM, &cpwm_now);
if ((cpwm_orig ^ cpwm_now) & 0x80) {
pwrpriv->cpwm = PS_STATE_S4;
pwrpriv->cpwm_tog = cpwm_now & PS_TOGGLE;
#ifdef DBG_CHECK_FW_PS_STATE
RTW_INFO("%s: polling cpwm OK! poll_cnt=%d, cpwm_orig=%02x, cpwm_now=%02x , 0x100=0x%x\n"
, __func__, poll_cnt, cpwm_orig, cpwm_now, rtw_read8(adapter, REG_CR));
if (rtw_fw_ps_state(adapter) == _FAIL) {
RTW_INFO("leave 32k but fw state in 32k\n");
pdbgpriv->dbg_rpwm_toogle_cnt++;
if ((cpwm_orig ^ cpwm_now) & 0x80) {
pwrpriv->cpwm = PS_STATE_S4;
pwrpriv->cpwm_tog = cpwm_now & PS_TOGGLE;
rst = _SUCCESS;
break;
}
#endif /* DBG_CHECK_FW_PS_STATE */
result = _SUCCESS;
break;
}
} while (rtw_get_passing_time_ms(start_time) < LPS_CPWM_TIMEOUT_MS && !RTW_CANNOT_RUN(adapter));
if (rtw_get_passing_time_ms(start_time) > LPS_RPWM_WAIT_MS) {
RTW_ERR("%s: polling cpwm timeout! poll_cnt=%d, cpwm_orig=%02x, cpwm_now=%02x\n"
, __func__, poll_cnt, cpwm_orig, cpwm_now);
#ifdef DBG_CHECK_FW_PS_STATE
if (rtw_fw_ps_state(adapter) == _FAIL) {
RTW_INFO("rpwm timeout and fw ps state in 32k\n");
pdbgpriv->dbg_rpwm_timeout_fail_cnt++;
}
#endif /* DBG_CHECK_FW_PS_STATE */
#ifdef CONFIG_LPS_RPWM_TIMER
_set_timer(&pwrpriv->pwr_rpwm_timer, 1);
#endif /* CONFIG_LPS_RPWM_TIMER */
if (rst == _SUCCESS)
break;
else {
/* rpwm retry */
cpwm_orig = cpwm_now;
rpwm &= ~PS_TOGGLE;
rpwm |= pwrpriv->tog;
rtw_hal_set_hwreg(adapter, HW_VAR_SET_RPWM, (u8 *)(&rpwm));
pwrpriv->tog += 0x80;
}
} while (1);
return result;
} while (pwrpriv->rpwm_retry++ < LPS_RPWM_RETRY_CNT && !RTW_CANNOT_RUN(adapter));
if (rst == _SUCCESS) {
#ifdef DBG_CHECK_FW_PS_STATE
RTW_INFO("%s: polling cpwm OK! rpwm_retry=%d, cpwm_orig=%02x, cpwm_now=%02x , 0x100=0x%x\n"
, __func__, pwrpriv->rpwm_retry, cpwm_orig, cpwm_now, rtw_read8(adapter, REG_CR));
if (rtw_fw_ps_state(adapter) == _FAIL) {
RTW_INFO("leave 32k but fw state in 32k\n");
pdbgpriv->dbg_rpwm_toogle_cnt++;
}
#endif /* DBG_CHECK_FW_PS_STATE */
} else {
RTW_ERR("%s: polling cpwm timeout! rpwm_retry=%d, cpwm_orig=%02x, cpwm_now=%02x\n"
, __func__, pwrpriv->rpwm_retry, cpwm_orig, cpwm_now);
#ifdef DBG_CHECK_FW_PS_STATE
if (rtw_fw_ps_state(adapter) == _FAIL) {
RTW_INFO("rpwm timeout and fw ps state in 32k\n");
pdbgpriv->dbg_rpwm_timeout_fail_cnt++;
}
#endif /* DBG_CHECK_FW_PS_STATE */
#ifdef CONFIG_LPS_RPWM_TIMER
_set_timer(&pwrpriv->pwr_rpwm_timer, 1);
#endif /* CONFIG_LPS_RPWM_TIMER */
}
return rst;
}
#endif
/*
@ -517,15 +599,13 @@ u8 rtw_cpwm_polling(_adapter *adapter, u8 cpwm_orig)
* pslv power state level, only could be PS_STATE_S0 ~ PS_STATE_S4
*
*/
void rtw_set_rpwm(PADAPTER padapter, u8 pslv)
u8 rtw_set_rpwm(PADAPTER padapter, u8 pslv)
{
u8 rpwm;
u8 rpwm = 0xFF;
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
#ifdef CONFIG_LPS_LCLK
u8 cpwm_orig;
#endif
struct dvobj_priv *psdpriv = padapter->dvobj;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
pslv = PS_STATE(pslv);
@ -541,7 +621,7 @@ void rtw_set_rpwm(PADAPTER padapter, u8 pslv)
#endif
|| (pwrpriv->lps_level == LPS_NORMAL)
) {
return;
return rpwm;
}
}
@ -550,12 +630,12 @@ void rtw_set_rpwm(PADAPTER padapter, u8 pslv)
pwrpriv->cpwm = PS_STATE_S4;
return;
return rpwm;
}
if (rtw_is_drv_stopped(padapter))
if (pslv < PS_STATE_S2)
return;
return rpwm;
rpwm = pslv | pwrpriv->tog;
#ifdef CONFIG_LPS_LCLK
@ -573,9 +653,16 @@ void rtw_set_rpwm(PADAPTER padapter, u8 pslv)
#endif
#if defined(CONFIG_LPS_RPWM_TIMER) && !defined(CONFIG_DETECT_CPWM_BY_POLLING)
if (rpwm & PS_ACK)
_set_timer(&pwrpriv->pwr_rpwm_timer, LPS_RPWM_WAIT_MS);
if (rpwm & PS_ACK) {
#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) || defined(CONFIG_P2P_WOWLAN)
if (pwrpriv->wowlan_mode != _TRUE &&
pwrpriv->wowlan_ap_mode != _TRUE &&
pwrpriv->wowlan_p2p_mode != _TRUE)
#endif
_set_timer(&pwrpriv->pwr_rpwm_timer, LPS_CPWM_TIMEOUT_MS);
}
#endif /* CONFIG_LPS_RPWM_TIMER & !CONFIG_DETECT_CPWM_BY_POLLING */
rtw_hal_set_hwreg(padapter, HW_VAR_SET_RPWM, (u8 *)(&rpwm));
pwrpriv->tog += 0x80;
@ -583,14 +670,14 @@ void rtw_set_rpwm(PADAPTER padapter, u8 pslv)
#ifdef CONFIG_LPS_LCLK
/* No LPS 32K, No Ack */
if (rpwm & PS_ACK) {
#ifdef CONFIG_DETECT_CPWM_BY_POLLING
rtw_cpwm_polling(padapter, cpwm_orig);
#ifdef CONFIG_DETECT_CPWM_BY_POLLING
rtw_cpwm_polling(padapter, rpwm, cpwm_orig);
#else
#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) || defined(CONFIG_P2P_WOWLAN)
if (pwrpriv->wowlan_mode == _TRUE ||
pwrpriv->wowlan_ap_mode == _TRUE ||
pwrpriv->wowlan_p2p_mode == _TRUE)
rtw_cpwm_polling(padapter, cpwm_orig);
rtw_cpwm_polling(padapter, rpwm, cpwm_orig);
#endif /*#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) || defined(CONFIG_P2P_WOWLAN)*/
#endif /*#ifdef CONFIG_DETECT_CPWM_BY_POLLING*/
} else
@ -599,6 +686,7 @@ void rtw_set_rpwm(PADAPTER padapter, u8 pslv)
pwrpriv->cpwm = pslv;
}
return rpwm;
}
u8 PS_RDY_CHECK(_adapter *padapter)
@ -606,12 +694,6 @@ u8 PS_RDY_CHECK(_adapter *padapter)
u32 delta_ms;
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
#ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
#ifdef CONFIG_IOCTL_CFG80211
struct cfg80211_wifidirect_info *pcfg80211_wdinfo = &padapter->cfg80211_wdinfo;
#endif /* CONFIG_IOCTL_CFG80211 */
#endif /* CONFIG_P2P */
#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN)
if (_TRUE == pwrpriv->bInSuspend && pwrpriv->wowlan_mode)
@ -642,6 +724,9 @@ u8 PS_RDY_CHECK(_adapter *padapter)
/* TDLS link is established. */
|| (padapter->tdlsinfo.link_established == _TRUE)
#endif /* CONFIG_TDLS */
#ifdef CONFIG_DFS_MASTER
|| adapter_to_rfctl(padapter)->radar_detect_enabled
#endif
)
return _FALSE;
@ -777,9 +862,14 @@ void rtw_set_fw_in_ips_mode(PADAPTER padapter, u8 enable)
void rtw_set_ps_mode(PADAPTER padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode, const char *msg)
{
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) || defined(CONFIG_P2P_WOWLAN)
struct dvobj_priv *psdpriv = padapter->dvobj;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
#endif
#ifdef CONFIG_WMMPS_STA
struct registry_priv *pregistrypriv = &padapter->registrypriv;
#endif
#ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
#endif /* CONFIG_P2P */
@ -907,11 +997,18 @@ void rtw_set_ps_mode(PADAPTER padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode
rtw_hal_set_hwreg(padapter, HW_VAR_LPS_PG_HANDLE, (u8 *)(&lps_pg_hdl_id));
}
#endif
#ifdef CONFIG_WOWLAN
if (pwrpriv->wowlan_mode == _TRUE)
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_INACTIVE_IPS, (u8 *)(&ps_mode));
#endif /* CONFIG_WOWLAN */
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&ps_mode));
rtw_hal_set_hwreg(padapter, HW_VAR_LPS_STATE_CHK, (u8 *)(&ps_mode));
#ifdef CONFIG_LPS_PG
if (pwrpriv->lps_level == LPS_PG) {
lps_pg_hdl_id = LPS_PG_RESEND_H2C;
lps_pg_hdl_id = LPS_PG_PHYDM_EN;
rtw_hal_set_hwreg(padapter, HW_VAR_LPS_PG_HANDLE, (u8 *)(&lps_pg_hdl_id));
}
#endif
@ -936,6 +1033,9 @@ void rtw_set_ps_mode(PADAPTER padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode
#ifdef CONFIG_P2P_WOWLAN
|| (_TRUE == pwrpriv->wowlan_p2p_mode)
#endif /* CONFIG_P2P_WOWLAN */
#ifdef CONFIG_WOWLAN
|| WOWLAN_IS_STA_MIX_MODE(padapter)
#endif /* CONFIG_WOWLAN */
) {
u8 pslv;
@ -974,12 +1074,24 @@ void rtw_set_ps_mode(PADAPTER padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode
pwrpriv->pwr_mode = ps_mode;
pwrpriv->smart_ps = smart_ps;
pwrpriv->bcn_ant_mode = bcn_ant_mode;
#ifdef CONFIG_LPS_PG
if (pwrpriv->lps_level == LPS_PG) {
lps_pg_hdl_id = LPS_PG_PHYDM_DIS;
rtw_hal_set_hwreg(padapter, HW_VAR_LPS_PG_HANDLE, (u8 *)(&lps_pg_hdl_id));
}
#endif
#ifdef CONFIG_WMMPS_STA
pwrpriv->wmm_smart_ps = pregistrypriv->wmm_smart_ps;
#endif /* CONFIG_WMMPS_STA */
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&ps_mode));
if (check_fwstate(pmlmepriv, _FW_LINKED))
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&ps_mode));
#ifdef CONFIG_WOWLAN
if (pwrpriv->wowlan_mode == _TRUE)
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_INACTIVE_IPS, (u8 *)(&ps_mode));
#endif /* CONFIG_WOWLAN */
#ifdef CONFIG_P2P_PS
/* Set CTWindow after LPS */
@ -1015,42 +1127,6 @@ void rtw_set_ps_mode(PADAPTER padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode
}
/*
* Return:
* 0: Leave OK
* -1: Timeout
* -2: Other error
*/
s32 LPS_RF_ON_check(PADAPTER padapter, u32 delay_ms)
{
systime start_time;
u8 bAwake = _FALSE;
s32 err = 0;
start_time = rtw_get_current_time();
while (1) {
rtw_hal_get_hwreg(padapter, HW_VAR_FWLPS_RF_ON, &bAwake);
if (_TRUE == bAwake)
break;
if (rtw_is_surprise_removed(padapter)) {
err = -2;
RTW_INFO("%s: device surprise removed!!\n", __FUNCTION__);
break;
}
if (rtw_get_passing_time_ms(start_time) > delay_ms) {
err = -1;
RTW_INFO("%s: Wait for FW LPS leave more than %u ms!!!\n", __FUNCTION__, delay_ms);
break;
}
rtw_usleep_os(100);
}
return err;
}
/*
* Description:
* Enter the leisure power save mode.
@ -1059,11 +1135,11 @@ void LPS_Enter(PADAPTER padapter, const char *msg)
{
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(dvobj);
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
int n_assoc_iface = 0;
int i;
char buf[32] = {0};
#ifdef DBG_LA_MODE
struct registry_priv *registry_par = &(padapter->registrypriv);
#endif
/* RTW_INFO("+LeisurePSEnter\n"); */
if (GET_HAL_DATA(padapter)->bFWReady == _FALSE)
@ -1074,12 +1150,14 @@ void LPS_Enter(PADAPTER padapter, const char *msg)
return;
#endif
/* Skip lps enter request if number of assocated adapters is not 1 */
for (i = 0; i < dvobj->iface_nums; i++) {
if (check_fwstate(&(dvobj->padapters[i]->mlmepriv), WIFI_ASOC_STATE))
n_assoc_iface++;
#ifdef DBG_LA_MODE
if(registry_par->la_mode_en == 1) {
RTW_INFO("%s LA debug mode lps_leave \n", __func__);
return;
}
if (n_assoc_iface != 1)
#endif
/* Skip lps enter request if number of assocated adapters is not 1 */
if (rtw_mi_get_assoc_if_num(padapter) != 1)
return;
#ifndef CONFIG_FW_MULTI_PORT_SUPPORT
@ -1093,6 +1171,14 @@ void LPS_Enter(PADAPTER padapter, const char *msg)
return;
}
#ifdef CONFIG_CLIENT_PORT_CFG
if ((rtw_hal_get_port(padapter) == CLT_PORT_INVALID) ||
get_clt_num(padapter) > MAX_CLIENT_PORT_NUM){
RTW_ERR(ADPT_FMT" cannot get client port or clt num(%d) over than 4\n", ADPT_ARG(padapter), get_clt_num(padapter));
return;
}
#endif
#ifdef CONFIG_P2P_PS
if (padapter->wdinfo.p2p_ps_mode == P2P_PS_NOA) {
return;/* supporting p2p client ps NOA via H2C_8723B_P2P_PS_OFFLOAD */
@ -1136,10 +1222,10 @@ void LPS_Leave(PADAPTER padapter, const char *msg)
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(dvobj);
u32 start_time;
u8 bAwake = _FALSE;
char buf[32] = {0};
#ifdef DBG_CHECK_FW_PS_STATE
struct debug_priv *pdbgpriv = &dvobj->drv_dbg;
#endif
/* RTW_INFO("+LeisurePSLeave\n"); */
@ -1163,9 +1249,6 @@ void LPS_Leave(PADAPTER padapter, const char *msg)
#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);
}
}
@ -1198,15 +1281,13 @@ void rtw_wow_lps_level_decide(_adapter *adapter, u8 wow_en)
void LeaveAllPowerSaveModeDirect(PADAPTER Adapter)
{
PADAPTER pri_padapter = GET_PRIMARY_ADAPTER(Adapter);
struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(Adapter);
struct dvobj_priv *psdpriv = Adapter->dvobj;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
#ifdef CONFIG_LPS_LCLK
#ifndef CONFIG_DETECT_CPWM_BY_POLLING
u8 cpwm_orig, cpwm_now;
systime start_time;
u8 cpwm_orig;
#endif /* CONFIG_DETECT_CPWM_BY_POLLING */
u8 rpwm;
#endif
RTW_INFO("%s.....\n", __FUNCTION__);
@ -1229,46 +1310,15 @@ void LeaveAllPowerSaveModeDirect(PADAPTER Adapter)
cpwm_orig = 0;
rtw_hal_get_hwreg(Adapter, HW_VAR_CPWM, &cpwm_orig);
#endif /* CONFIG_DETECT_CPWM_BY_POLLING */
rtw_set_rpwm(Adapter, PS_STATE_S4);
rpwm = rtw_set_rpwm(Adapter, PS_STATE_S4);
#ifndef CONFIG_DETECT_CPWM_BY_POLLING
start_time = rtw_get_current_time();
/* polling cpwm */
do {
rtw_mdelay_os(1);
rtw_hal_get_hwreg(Adapter, HW_VAR_CPWM, &cpwm_now);
if ((cpwm_orig ^ cpwm_now) & 0x80) {
pwrpriv->cpwm = PS_STATE_S4;
pwrpriv->cpwm_tog = cpwm_now & PS_TOGGLE;
#ifdef DBG_CHECK_FW_PS_STATE
RTW_INFO("%s: polling cpwm OK! cpwm_orig=%02x, cpwm_now=%02x, 0x100=0x%x\n"
, __FUNCTION__, cpwm_orig, cpwm_now, rtw_read8(Adapter, REG_CR));
if (rtw_fw_ps_state(Adapter) == _FAIL) {
RTW_INFO("%s: leave 32k but fw state in 32k\n", __FUNCTION__);
pdbgpriv->dbg_rpwm_toogle_cnt++;
}
#endif /* DBG_CHECK_FW_PS_STATE */
break;
}
if (rtw_get_passing_time_ms(start_time) > LPS_RPWM_WAIT_MS) {
RTW_INFO("%s: polling cpwm timeout! cpwm_orig=%02x, cpwm_now=%02x\n", __FUNCTION__, cpwm_orig, cpwm_now);
#ifdef DBG_CHECK_FW_PS_STATE
if (rtw_fw_ps_state(Adapter) == _FAIL) {
RTW_INFO("rpwm timeout and fw ps state in 32k\n");
pdbgpriv->dbg_rpwm_timeout_fail_cnt++;
}
#endif /* DBG_CHECK_FW_PS_STATE */
break;
}
} while (1);
if (rpwm != 0xFF && rpwm & PS_ACK)
rtw_cpwm_polling(Adapter, rpwm, cpwm_orig);
#endif /* CONFIG_DETECT_CPWM_BY_POLLING */
_exit_pwrlock(&pwrpriv->lock);
#endif
#endif/*CONFIG_LPS_LCLK*/
#ifdef CONFIG_P2P_PS
p2p_ps_wk_cmd(pri_padapter, P2P_PS_DISABLE, 0);
@ -1308,31 +1358,25 @@ void LeaveAllPowerSaveModeDirect(PADAPTER Adapter)
void LeaveAllPowerSaveMode(IN PADAPTER Adapter)
{
struct dvobj_priv *dvobj = adapter_to_dvobj(Adapter);
struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
u8 enqueue = 0;
int n_assoc_iface = 0;
int i;
/* RTW_INFO("%s.....\n",__FUNCTION__); */
#ifndef CONFIG_NEW_NETDEV_HDL
if (_FALSE == Adapter->bup) {
RTW_INFO(FUNC_ADPT_FMT ": bup=%d Skip!\n",
FUNC_ADPT_ARG(Adapter), Adapter->bup);
return;
}
#endif
/* RTW_INFO(FUNC_ADPT_FMT "\n", FUNC_ADPT_ARG(Adapter));*/
if (rtw_is_surprise_removed(Adapter)) {
RTW_INFO(FUNC_ADPT_FMT ": bSurpriseRemoved=_TRUE Skip!\n", FUNC_ADPT_ARG(Adapter));
return;
}
for (i = 0; i < dvobj->iface_nums; i++) {
if (check_fwstate(&(dvobj->padapters[i]->mlmepriv), WIFI_ASOC_STATE))
n_assoc_iface++;
}
if (n_assoc_iface) {
if (rtw_mi_get_assoc_if_num(Adapter)) {
/* connect */
#ifdef CONFIG_LPS_LCLK
enqueue = 1;
@ -1413,7 +1457,7 @@ void LPS_Leave_check(
break;
if (rtw_get_passing_time_ms(start_time) > 100) {
RTW_INFO("Wait for cpwm event than 100 ms!!!\n");
RTW_ERR("Wait for cpwm event than 100 ms!!!\n");
break;
}
rtw_msleep_os(1);
@ -1509,6 +1553,9 @@ static void rtw_cpwm_chk_fail_debug(_adapter *padapter)
RTW_INFO("[PS-DBG] Reg_10FC =0x%08x\n", cpu_state);
RTW_INFO("[PS-DBG] Reg_10F8 =0x%08x\n", rtw_read32(padapter, 0x10F8));
RTW_INFO("[PS-DBG] Reg_11F8 =0x%08x\n", rtw_read32(padapter, 0x11F8));
RTW_INFO("[PS-DBG] Reg_4A4 =0x%08x\n", rtw_read32(padapter, 0x4A4));
RTW_INFO("[PS-DBG] Reg_4A8 =0x%08x\n", rtw_read32(padapter, 0x4A8));
if (cpu_state == CPU_EXCEPTION_CODE) {
RTW_INFO("[PS-DBG] Reg_48C =0x%08x\n", rtw_read32(padapter, 0x48C));
@ -1518,6 +1565,14 @@ static void rtw_cpwm_chk_fail_debug(_adapter *padapter)
RTW_INFO("[PS-DBG] Reg_49C =0x%08x\n", rtw_read32(padapter, 0x49C));
RTW_INFO("[PS-DBG] Reg_4A0 =0x%08x\n", rtw_read32(padapter, 0x4A0));
RTW_INFO("[PS-DBG] Reg_1BC =0x%08x\n", rtw_read32(padapter, 0x1BC));
RTW_INFO("[PS-DBG] Reg_008 =0x%08x\n", rtw_read32(padapter, 0x08));
RTW_INFO("[PS-DBG] Reg_2F0 =0x%08x\n", rtw_read32(padapter, 0x2F0));
RTW_INFO("[PS-DBG] Reg_2F4 =0x%08x\n", rtw_read32(padapter, 0x2F4));
RTW_INFO("[PS-DBG] Reg_2F8 =0x%08x\n", rtw_read32(padapter, 0x2F8));
RTW_INFO("[PS-DBG] Reg_2FC =0x%08x\n", rtw_read32(padapter, 0x2FC));
rtw_dump_fifo(RTW_DBGDUMP, padapter, 5, 0, 3072);
}
}
#endif
@ -1543,6 +1598,18 @@ static void rpwmtimeout_workitem_callback(struct work_struct *work)
RTW_INFO("%s: rpwm=0x%02X cpwm=0x%02X CPWM done!\n", __func__, pwrpriv->rpwm, pwrpriv->cpwm);
goto exit;
}
if (pwrpriv->rpwm_retry++ < LPS_RPWM_RETRY_CNT) {
u8 rpwm = (pwrpriv->rpwm | pwrpriv->tog | PS_ACK);
rtw_hal_set_hwreg(padapter, HW_VAR_SET_RPWM, (u8 *)(&rpwm));
pwrpriv->tog += 0x80;
_set_timer(&pwrpriv->pwr_rpwm_timer, LPS_CPWM_TIMEOUT_MS);
goto exit;
}
pwrpriv->rpwm_retry = 0;
_exit_pwrlock(&pwrpriv->lock);
#if defined(DBG_CPWM_CHK_FAIL) && (defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C))
@ -2030,9 +2097,12 @@ void rtw_unregister_evt_alive(PADAPTER padapter)
void rtw_init_pwrctrl_priv(PADAPTER padapter)
{
struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter);
#ifdef CONFIG_WOWLAN
struct registry_priv *registry_par = &padapter->registrypriv;
#endif
#ifdef CONFIG_GPIO_WAKEUP
u8 val8 = 0;
#endif
#if defined(CONFIG_CONCURRENT_MODE)
if (!is_primary_adapter(padapter))
@ -2052,6 +2122,15 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter)
pwrctrlpriv->lps_enter_cnts = 0;
pwrctrlpriv->lps_leave_cnts = 0;
pwrctrlpriv->bips_processing = _FALSE;
#ifdef CONFIG_LPS_CHK_BY_TP
pwrctrlpriv->lps_chk_by_tp = padapter->registrypriv.lps_chk_by_tp;
pwrctrlpriv->lps_tx_tp_th = LPS_TX_TP_TH;
pwrctrlpriv->lps_rx_tp_th = LPS_RX_TP_TH;
pwrctrlpriv->lps_bi_tp_th = LPS_BI_TP_TH;
pwrctrlpriv->lps_chk_cnt = pwrctrlpriv->lps_chk_cnt_th = LPS_TP_CHK_CNT;
pwrctrlpriv->lps_tx_pkts = LPS_CHK_PKTS_TX;
pwrctrlpriv->lps_rx_pkts = LPS_CHK_PKTS_RX;
#endif
pwrctrlpriv->ips_mode = padapter->registrypriv.ips_mode;
pwrctrlpriv->ips_mode_req = padapter->registrypriv.ips_mode;
@ -2096,6 +2175,7 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter)
pwrctrlpriv->dtim = 0;
pwrctrlpriv->tog = 0x80;
pwrctrlpriv->rpwm_retry = 0;
#ifdef CONFIG_LPS_LCLK
rtw_hal_set_hwreg(padapter, HW_VAR_SET_RPWM, (u8 *)(&pwrctrlpriv->rpwm));
@ -2131,8 +2211,12 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter)
#ifdef CONFIG_GPIO_WAKEUP
/*default low active*/
pwrctrlpriv->is_high_active = HIGH_ACTIVE;
pwrctrlpriv->is_high_active = HIGH_ACTIVE_DEV2HST;
pwrctrlpriv->hst2dev_high_active = HIGH_ACTIVE_HST2DEV;
#ifdef CONFIG_RTW_ONE_PIN_GPIO
rtw_hal_switch_gpio_wl_ctrl(padapter, WAKEUP_GPIO_IDX, _TRUE);
rtw_hal_set_input_gpio(padapter, WAKEUP_GPIO_IDX);
#else
#ifdef CONFIG_WAKEUP_GPIO_INPUT_MODE
if (pwrctrlpriv->is_high_active == 0)
rtw_hal_set_input_gpio(padapter, WAKEUP_GPIO_IDX);
@ -2144,6 +2228,7 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter)
RTW_INFO("%s: set GPIO_%d %d as default.\n",
__func__, WAKEUP_GPIO_IDX, val8);
#endif /*CONFIG_WAKEUP_GPIO_INPUT_MODE*/
#endif /* CONFIG_RTW_ONE_PIN_GPIO */
#endif /* CONFIG_GPIO_WAKEUP */
#ifdef CONFIG_WOWLAN
@ -2411,9 +2496,9 @@ int _rtw_pwr_wakeup(_adapter *padapter, u32 ips_deffer_ms, const char *caller)
struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(dvobj);
struct mlme_priv *pmlmepriv;
int ret = _SUCCESS;
int i;
systime start = rtw_get_current_time();
/*RTW_INFO(FUNC_ADPT_FMT "===>\n", FUNC_ADPT_ARG(padapter));*/
/* for LPS */
LeaveAllPowerSaveMode(padapter);
@ -2549,6 +2634,7 @@ int _rtw_pwr_wakeup(_adapter *padapter, u32 ips_deffer_ms, const char *caller)
exit:
if (rtw_time_after(rtw_get_current_time() + rtw_ms_to_systime(ips_deffer_ms), pwrpriv->ips_deny_time))
pwrpriv->ips_deny_time = rtw_get_current_time() + rtw_ms_to_systime(ips_deffer_ms);
/*RTW_INFO(FUNC_ADPT_FMT "<===\n", FUNC_ADPT_ARG(padapter));*/
return ret;
}
@ -2611,8 +2697,6 @@ int rtw_pm_set_ips(_adapter *padapter, u8 mode)
void rtw_ps_deny(PADAPTER padapter, PS_DENY_REASON reason)
{
struct pwrctrl_priv *pwrpriv;
s32 ret;
/* RTW_INFO("+" FUNC_ADPT_FMT ": Request PS deny for %d (0x%08X)\n",
* FUNC_ADPT_ARG(padapter), reason, BIT(reason)); */
@ -2671,3 +2755,38 @@ u32 rtw_ps_deny_get(PADAPTER padapter)
return deny;
}
static void _rtw_ssmps(_adapter *adapter, struct sta_info *sta)
{
struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
if (MLME_IS_STA(adapter)) {
issue_action_SM_PS_wait_ack(adapter , get_my_bssid(&(pmlmeinfo->network)),
sta->cmn.sm_ps, 3 , 1);
}
else if (MLME_IS_AP(adapter)) {
}
rtw_phydm_ra_registed(adapter, sta);
}
void rtw_ssmps_enter(_adapter *adapter, struct sta_info *sta)
{
if (sta->cmn.sm_ps == SM_PS_STATIC)
return;
RTW_INFO(ADPT_FMT" STA [" MAC_FMT "]\n", ADPT_ARG(adapter), MAC_ARG(sta->cmn.mac_addr));
sta->cmn.sm_ps = SM_PS_STATIC;
_rtw_ssmps(adapter, sta);
}
void rtw_ssmps_leave(_adapter *adapter, struct sta_info *sta)
{
if (sta->cmn.sm_ps == SM_PS_DISABLE)
return;
RTW_INFO(ADPT_FMT" STA [" MAC_FMT "] \n", ADPT_ARG(adapter), MAC_ARG(sta->cmn.mac_addr));
sta->cmn.sm_ps = SM_PS_DISABLE;
_rtw_ssmps(adapter, sta);
}

453
core/rtw_recv.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

View File

@ -204,7 +204,6 @@ struct center_chs_ent_t center_chs_5g_by_bw[] = {
*/
u8 rtw_get_scch_by_cch_offset(u8 cch, u8 bw, u8 offset)
{
int i;
u8 t_cch = 0;
if (bw == CHANNEL_WIDTH_20) {
@ -470,7 +469,6 @@ bool rtw_chbw_to_freq_range(u8 ch, u8 bw, u8 offset, u32 *hi, u32 *lo)
u8 c_ch;
u32 freq;
u32 hi_ret = 0, lo_ret = 0;
int i;
bool valid = _FALSE;
if (hi)
@ -567,471 +565,6 @@ const u8 _rf_type_to_rf_rx_cnt[] = {
1, /*RF_TYPE_MAX*/
};
#ifdef CONFIG_80211AC_VHT
#define COUNTRY_CHPLAN_ASSIGN_EN_11AC(_val) , .en_11ac = (_val)
#else
#define COUNTRY_CHPLAN_ASSIGN_EN_11AC(_val)
#endif
#if RTW_DEF_MODULE_REGULATORY_CERT
#define COUNTRY_CHPLAN_ASSIGN_DEF_MODULE_FLAGS(_val) , .def_module_flags = (_val)
#else
#define COUNTRY_CHPLAN_ASSIGN_DEF_MODULE_FLAGS(_val)
#endif
/* has def_module_flags specified, used by common map and HAL dfference map */
#define COUNTRY_CHPLAN_ENT(_alpha2, _chplan, _en_11ac, _def_module_flags) \
{.alpha2 = (_alpha2), .chplan = (_chplan) \
COUNTRY_CHPLAN_ASSIGN_EN_11AC(_en_11ac) \
COUNTRY_CHPLAN_ASSIGN_DEF_MODULE_FLAGS(_def_module_flags) \
}
#ifdef CONFIG_CUSTOMIZED_COUNTRY_CHPLAN_MAP
#include "../platform/custom_country_chplan.h"
#elif RTW_DEF_MODULE_REGULATORY_CERT
/* leave def_module_flags empty, def_module_flags check is done on country_chplan_map */
#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8821AE_HMC_M2) /* 2013 certify */
static const struct country_chplan RTL8821AE_HMC_M2_country_chplan_exc_map[] = {
COUNTRY_CHPLAN_ENT("CA", 0x34, 1, 0), /* Canada */
COUNTRY_CHPLAN_ENT("CL", 0x30, 1, 0), /* Chile */
COUNTRY_CHPLAN_ENT("CN", 0x51, 1, 0), /* China */
COUNTRY_CHPLAN_ENT("MX", 0x34, 1, 0), /* Mexico */
COUNTRY_CHPLAN_ENT("MY", 0x47, 1, 0), /* Malaysia */
COUNTRY_CHPLAN_ENT("TW", 0x39, 1, 0), /* Taiwan */
COUNTRY_CHPLAN_ENT("UA", 0x36, 0, 0), /* Ukraine */
COUNTRY_CHPLAN_ENT("US", 0x34, 1, 0), /* United States of America (USA) */
};
#endif
#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8821AU) /* 2014 certify */
static const struct country_chplan RTL8821AU_country_chplan_exc_map[] = {
COUNTRY_CHPLAN_ENT("CA", 0x34, 1, 0), /* Canada */
COUNTRY_CHPLAN_ENT("RU", 0x59, 0, 0), /* Russia(fac/gost), Kaliningrad */
COUNTRY_CHPLAN_ENT("TW", 0x39, 1, 0), /* Taiwan */
COUNTRY_CHPLAN_ENT("UA", 0x36, 0, 0), /* Ukraine */
COUNTRY_CHPLAN_ENT("US", 0x34, 1, 0), /* United States of America (USA) */
};
#endif
#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8812AENF_NGFF) /* 2014 certify */
static const struct country_chplan RTL8812AENF_NGFF_country_chplan_exc_map[] = {
COUNTRY_CHPLAN_ENT("TW", 0x39, 1, 0), /* Taiwan */
COUNTRY_CHPLAN_ENT("US", 0x34, 1, 0), /* United States of America (USA) */
};
#endif
#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8812AEBT_HMC) /* 2013 certify */
static const struct country_chplan RTL8812AEBT_HMC_country_chplan_exc_map[] = {
COUNTRY_CHPLAN_ENT("CA", 0x34, 1, 0), /* Canada */
COUNTRY_CHPLAN_ENT("RU", 0x59, 0, 0), /* Russia(fac/gost), Kaliningrad */
COUNTRY_CHPLAN_ENT("TW", 0x39, 1, 0), /* Taiwan */
COUNTRY_CHPLAN_ENT("UA", 0x36, 0, 0), /* Ukraine */
COUNTRY_CHPLAN_ENT("US", 0x34, 1, 0), /* United States of America (USA) */
};
#endif
#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8188EE_HMC_M2) /* 2012 certify */
static const struct country_chplan RTL8188EE_HMC_M2_country_chplan_exc_map[] = {
COUNTRY_CHPLAN_ENT("CA", 0x20, 1, 0), /* Canada */
COUNTRY_CHPLAN_ENT("MX", 0x34, 1, 0), /* Mexico */
COUNTRY_CHPLAN_ENT("TW", 0x39, 1, 0), /* Taiwan */
COUNTRY_CHPLAN_ENT("US", 0x34, 1, 0), /* United States of America (USA) */
};
#endif
#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8723BE_HMC_M2) /* 2013 certify */
static const struct country_chplan RTL8723BE_HMC_M2_country_chplan_exc_map[] = {
COUNTRY_CHPLAN_ENT("CA", 0x20, 1, 0), /* Canada */
COUNTRY_CHPLAN_ENT("MX", 0x34, 1, 0), /* Mexico */
COUNTRY_CHPLAN_ENT("TW", 0x39, 1, 0), /* Taiwan */
COUNTRY_CHPLAN_ENT("US", 0x34, 1, 0), /* United States of America (USA) */
};
#endif
#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8723BS_NGFF1216) /* 2014 certify */
static const struct country_chplan RTL8723BS_NGFF1216_country_chplan_exc_map[] = {
COUNTRY_CHPLAN_ENT("CA", 0x20, 1, 0), /* Canada */
COUNTRY_CHPLAN_ENT("MX", 0x34, 1, 0), /* Mexico */
COUNTRY_CHPLAN_ENT("TW", 0x39, 1, 0), /* Taiwan */
COUNTRY_CHPLAN_ENT("US", 0x34, 1, 0), /* United States of America (USA) */
};
#endif
#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8192EEBT_HMC_M2) /* 2013 certify */
static const struct country_chplan RTL8192EEBT_HMC_M2_country_chplan_exc_map[] = {
COUNTRY_CHPLAN_ENT("CA", 0x20, 1, 0), /* Canada */
COUNTRY_CHPLAN_ENT("MX", 0x34, 1, 0), /* Mexico */
COUNTRY_CHPLAN_ENT("TW", 0x39, 1, 0), /* Taiwan */
COUNTRY_CHPLAN_ENT("US", 0x34, 1, 0), /* United States of America (USA) */
};
#endif
#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8723DE_NGFF1630) /* 2016 certify */
static const struct country_chplan RTL8723DE_NGFF1630_country_chplan_exc_map[] = {
COUNTRY_CHPLAN_ENT("CA", 0x2A, 1, 0), /* Canada */
COUNTRY_CHPLAN_ENT("MX", 0x34, 1, 0), /* Mexico */
};
#endif
#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8822BE) /* 2016 certify */
static const struct country_chplan RTL8822BE_country_chplan_exc_map[] = {
};
#endif
#if (RTW_DEF_MODULE_REGULATORY_CERT & RTW_MODULE_RTL8821CE) /* 2016 certify */
static const struct country_chplan RTL8821CE_country_chplan_exc_map[] = {
};
#endif
/**
* rtw_def_module_get_chplan_from_country -
* @country_code: string of country code
* @return:
* Return NULL for case referring to common map
*/
static const struct country_chplan *rtw_def_module_get_chplan_from_country(const char *country_code)
{
const struct country_chplan *ent = NULL;
const struct country_chplan *hal_map = NULL;
u16 hal_map_sz = 0;
int i;
/* TODO: runtime selection for multi driver */
#if (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8821AE_HMC_M2)
hal_map = RTL8821AE_HMC_M2_country_chplan_exc_map;
hal_map_sz = sizeof(RTL8821AE_HMC_M2_country_chplan_exc_map) / sizeof(struct country_chplan);
#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8821AU)
hal_map = RTL8821AU_country_chplan_exc_map;
hal_map_sz = sizeof(RTL8821AU_country_chplan_exc_map) / sizeof(struct country_chplan);
#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8812AENF_NGFF)
hal_map = RTL8812AENF_NGFF_country_chplan_exc_map;
hal_map_sz = sizeof(RTL8812AENF_NGFF_country_chplan_exc_map) / sizeof(struct country_chplan);
#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8812AEBT_HMC)
hal_map = RTL8812AEBT_HMC_country_chplan_exc_map;
hal_map_sz = sizeof(RTL8812AEBT_HMC_country_chplan_exc_map) / sizeof(struct country_chplan);
#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8188EE_HMC_M2)
hal_map = RTL8188EE_HMC_M2_country_chplan_exc_map;
hal_map_sz = sizeof(RTL8188EE_HMC_M2_country_chplan_exc_map) / sizeof(struct country_chplan);
#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8723BE_HMC_M2)
hal_map = RTL8723BE_HMC_M2_country_chplan_exc_map;
hal_map_sz = sizeof(RTL8723BE_HMC_M2_country_chplan_exc_map) / sizeof(struct country_chplan);
#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8723BS_NGFF1216)
hal_map = RTL8723BS_NGFF1216_country_chplan_exc_map;
hal_map_sz = sizeof(RTL8723BS_NGFF1216_country_chplan_exc_map) / sizeof(struct country_chplan);
#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8192EEBT_HMC_M2)
hal_map = RTL8192EEBT_HMC_M2_country_chplan_exc_map;
hal_map_sz = sizeof(RTL8192EEBT_HMC_M2_country_chplan_exc_map) / sizeof(struct country_chplan);
#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8723DE_NGFF1630)
hal_map = RTL8723DE_NGFF1630_country_chplan_exc_map;
hal_map_sz = sizeof(RTL8723DE_NGFF1630_country_chplan_exc_map) / sizeof(struct country_chplan);
#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8822BE)
hal_map = RTL8822BE_country_chplan_exc_map;
hal_map_sz = sizeof(RTL8822BE_country_chplan_exc_map) / sizeof(struct country_chplan);
#elif (RTW_DEF_MODULE_REGULATORY_CERT == RTW_MODULE_RTL8821CE)
hal_map = RTL8821CE_country_chplan_exc_map;
hal_map_sz = sizeof(RTL8821CE_country_chplan_exc_map) / sizeof(struct country_chplan);
#endif
if (hal_map == NULL || hal_map_sz == 0)
goto exit;
for (i = 0; i < hal_map_sz; i++) {
if (strncmp(country_code, hal_map[i].alpha2, 2) == 0) {
ent = &hal_map[i];
break;
}
}
exit:
return ent;
}
#endif /* CONFIG_CUSTOMIZED_COUNTRY_CHPLAN_MAP or RTW_DEF_MODULE_REGULATORY_CERT */
static const struct country_chplan country_chplan_map[] = {
COUNTRY_CHPLAN_ENT("AD", 0x26, 1, 0x000), /* Andorra */
COUNTRY_CHPLAN_ENT("AE", 0x26, 1, 0x7FB), /* United Arab Emirates */
COUNTRY_CHPLAN_ENT("AF", 0x42, 1, 0x000), /* Afghanistan */
COUNTRY_CHPLAN_ENT("AG", 0x26, 1, 0x000), /* Antigua & Barbuda */
COUNTRY_CHPLAN_ENT("AI", 0x26, 1, 0x000), /* Anguilla(UK) */
COUNTRY_CHPLAN_ENT("AL", 0x26, 1, 0x7F1), /* Albania */
COUNTRY_CHPLAN_ENT("AM", 0x26, 1, 0x6B0), /* Armenia */
COUNTRY_CHPLAN_ENT("AN", 0x26, 1, 0x7F1), /* Netherlands Antilles */
COUNTRY_CHPLAN_ENT("AO", 0x47, 1, 0x6E0), /* Angola */
COUNTRY_CHPLAN_ENT("AQ", 0x26, 1, 0x000), /* Antarctica */
COUNTRY_CHPLAN_ENT("AR", 0x61, 1, 0x7F3), /* Argentina */
COUNTRY_CHPLAN_ENT("AS", 0x34, 1, 0x000), /* American Samoa */
COUNTRY_CHPLAN_ENT("AT", 0x26, 1, 0x7FB), /* Austria */
COUNTRY_CHPLAN_ENT("AU", 0x45, 1, 0x7FB), /* Australia */
COUNTRY_CHPLAN_ENT("AW", 0x34, 1, 0x0B0), /* Aruba */
COUNTRY_CHPLAN_ENT("AZ", 0x26, 1, 0x7F1), /* Azerbaijan */
COUNTRY_CHPLAN_ENT("BA", 0x26, 1, 0x7F1), /* Bosnia & Herzegovina */
COUNTRY_CHPLAN_ENT("BB", 0x34, 1, 0x650), /* Barbados */
COUNTRY_CHPLAN_ENT("BD", 0x26, 1, 0x7F1), /* Bangladesh */
COUNTRY_CHPLAN_ENT("BE", 0x26, 1, 0x7FB), /* Belgium */
COUNTRY_CHPLAN_ENT("BF", 0x26, 1, 0x6B0), /* Burkina Faso */
COUNTRY_CHPLAN_ENT("BG", 0x26, 1, 0x7F1), /* Bulgaria */
COUNTRY_CHPLAN_ENT("BH", 0x47, 1, 0x7F1), /* Bahrain */
COUNTRY_CHPLAN_ENT("BI", 0x26, 1, 0x6B0), /* Burundi */
COUNTRY_CHPLAN_ENT("BJ", 0x26, 1, 0x6B0), /* Benin */
COUNTRY_CHPLAN_ENT("BN", 0x47, 1, 0x610), /* Brunei */
COUNTRY_CHPLAN_ENT("BO", 0x73, 1, 0x7F1), /* Bolivia */
COUNTRY_CHPLAN_ENT("BR", 0x62, 1, 0x7F1), /* Brazil */
COUNTRY_CHPLAN_ENT("BS", 0x34, 1, 0x620), /* Bahamas */
COUNTRY_CHPLAN_ENT("BW", 0x26, 1, 0x6F1), /* Botswana */
COUNTRY_CHPLAN_ENT("BY", 0x26, 1, 0x7F1), /* Belarus */
COUNTRY_CHPLAN_ENT("BZ", 0x34, 1, 0x000), /* Belize */
COUNTRY_CHPLAN_ENT("CA", 0x2B, 1, 0x7FB), /* Canada */
COUNTRY_CHPLAN_ENT("CC", 0x26, 1, 0x000), /* Cocos (Keeling) Islands (Australia) */
COUNTRY_CHPLAN_ENT("CD", 0x26, 1, 0x6B0), /* Congo, Republic of the */
COUNTRY_CHPLAN_ENT("CF", 0x26, 1, 0x6B0), /* Central African Republic */
COUNTRY_CHPLAN_ENT("CG", 0x26, 1, 0x6B0), /* Congo, Democratic Republic of the. Zaire */
COUNTRY_CHPLAN_ENT("CH", 0x26, 1, 0x7FB), /* Switzerland */
COUNTRY_CHPLAN_ENT("CI", 0x26, 1, 0x7F1), /* Cote d'Ivoire */
COUNTRY_CHPLAN_ENT("CK", 0x26, 1, 0x000), /* Cook Islands */
COUNTRY_CHPLAN_ENT("CL", 0x2D, 1, 0x7F1), /* Chile */
COUNTRY_CHPLAN_ENT("CM", 0x26, 1, 0x6B0), /* Cameroon */
COUNTRY_CHPLAN_ENT("CN", 0x48, 1, 0x7FB), /* China */
COUNTRY_CHPLAN_ENT("CO", 0x34, 1, 0x7F1), /* Colombia */
COUNTRY_CHPLAN_ENT("CR", 0x34, 1, 0x7F1), /* Costa Rica */
COUNTRY_CHPLAN_ENT("CV", 0x26, 1, 0x6B0), /* Cape Verde */
COUNTRY_CHPLAN_ENT("CX", 0x45, 1, 0x000), /* Christmas Island (Australia) */
COUNTRY_CHPLAN_ENT("CY", 0x26, 1, 0x7FB), /* Cyprus */
COUNTRY_CHPLAN_ENT("CZ", 0x26, 1, 0x7FB), /* Czech Republic */
COUNTRY_CHPLAN_ENT("DE", 0x26, 1, 0x7FB), /* Germany */
COUNTRY_CHPLAN_ENT("DJ", 0x26, 1, 0x680), /* Djibouti */
COUNTRY_CHPLAN_ENT("DK", 0x26, 1, 0x7FB), /* Denmark */
COUNTRY_CHPLAN_ENT("DM", 0x34, 1, 0x000), /* Dominica */
COUNTRY_CHPLAN_ENT("DO", 0x34, 1, 0x7F1), /* Dominican Republic */
COUNTRY_CHPLAN_ENT("DZ", 0x26, 1, 0x7F1), /* Algeria */
COUNTRY_CHPLAN_ENT("EC", 0x34, 1, 0x7F1), /* Ecuador */
COUNTRY_CHPLAN_ENT("EE", 0x26, 1, 0x7FB), /* Estonia */
COUNTRY_CHPLAN_ENT("EG", 0x47, 1, 0x7F1), /* Egypt */
COUNTRY_CHPLAN_ENT("EH", 0x47, 1, 0x680), /* Western Sahara */
COUNTRY_CHPLAN_ENT("ER", 0x26, 1, 0x000), /* Eritrea */
COUNTRY_CHPLAN_ENT("ES", 0x26, 1, 0x7FB), /* Spain, Canary Islands, Ceuta, Melilla */
COUNTRY_CHPLAN_ENT("ET", 0x26, 1, 0x4B0), /* Ethiopia */
COUNTRY_CHPLAN_ENT("FI", 0x26, 1, 0x7FB), /* Finland */
COUNTRY_CHPLAN_ENT("FJ", 0x34, 1, 0x600), /* Fiji */
COUNTRY_CHPLAN_ENT("FK", 0x26, 1, 0x000), /* Falkland Islands (Islas Malvinas) (UK) */
COUNTRY_CHPLAN_ENT("FM", 0x34, 1, 0x000), /* Micronesia, Federated States of (USA) */
COUNTRY_CHPLAN_ENT("FO", 0x26, 1, 0x000), /* Faroe Islands (Denmark) */
COUNTRY_CHPLAN_ENT("FR", 0x26, 1, 0x7FB), /* France */
COUNTRY_CHPLAN_ENT("GA", 0x26, 1, 0x6B0), /* Gabon */
COUNTRY_CHPLAN_ENT("GB", 0x26, 1, 0x7FB), /* Great Britain (United Kingdom; England) */
COUNTRY_CHPLAN_ENT("GD", 0x34, 1, 0x0B0), /* Grenada */
COUNTRY_CHPLAN_ENT("GE", 0x26, 1, 0x600), /* Georgia */
COUNTRY_CHPLAN_ENT("GF", 0x26, 1, 0x080), /* French Guiana */
COUNTRY_CHPLAN_ENT("GG", 0x26, 1, 0x000), /* Guernsey (UK) */
COUNTRY_CHPLAN_ENT("GH", 0x26, 1, 0x7F1), /* Ghana */
COUNTRY_CHPLAN_ENT("GI", 0x26, 1, 0x600), /* Gibraltar (UK) */
COUNTRY_CHPLAN_ENT("GL", 0x26, 1, 0x600), /* Greenland (Denmark) */
COUNTRY_CHPLAN_ENT("GM", 0x26, 1, 0x6B0), /* Gambia */
COUNTRY_CHPLAN_ENT("GN", 0x26, 1, 0x610), /* Guinea */
COUNTRY_CHPLAN_ENT("GP", 0x26, 1, 0x600), /* Guadeloupe (France) */
COUNTRY_CHPLAN_ENT("GQ", 0x26, 1, 0x6B0), /* Equatorial Guinea */
COUNTRY_CHPLAN_ENT("GR", 0x26, 1, 0x7FB), /* Greece */
COUNTRY_CHPLAN_ENT("GS", 0x26, 1, 0x000), /* South Georgia and the Sandwich Islands (UK) */
COUNTRY_CHPLAN_ENT("GT", 0x34, 1, 0x7F1), /* Guatemala */
COUNTRY_CHPLAN_ENT("GU", 0x34, 1, 0x600), /* Guam (USA) */
COUNTRY_CHPLAN_ENT("GW", 0x26, 1, 0x6B0), /* Guinea-Bissau */
COUNTRY_CHPLAN_ENT("GY", 0x44, 1, 0x000), /* Guyana */
COUNTRY_CHPLAN_ENT("HK", 0x26, 1, 0x7FB), /* Hong Kong */
COUNTRY_CHPLAN_ENT("HM", 0x45, 1, 0x000), /* Heard and McDonald Islands (Australia) */
COUNTRY_CHPLAN_ENT("HN", 0x32, 1, 0x7F1), /* Honduras */
COUNTRY_CHPLAN_ENT("HR", 0x26, 1, 0x7F9), /* Croatia */
COUNTRY_CHPLAN_ENT("HT", 0x34, 1, 0x650), /* Haiti */
COUNTRY_CHPLAN_ENT("HU", 0x26, 1, 0x7FB), /* Hungary */
COUNTRY_CHPLAN_ENT("ID", 0x3D, 0, 0x7F3), /* Indonesia */
COUNTRY_CHPLAN_ENT("IE", 0x26, 1, 0x7FB), /* Ireland */
COUNTRY_CHPLAN_ENT("IL", 0x47, 1, 0x7F1), /* Israel */
COUNTRY_CHPLAN_ENT("IM", 0x26, 1, 0x000), /* Isle of Man (UK) */
COUNTRY_CHPLAN_ENT("IN", 0x48, 1, 0x7F1), /* India */
COUNTRY_CHPLAN_ENT("IQ", 0x26, 1, 0x000), /* Iraq */
COUNTRY_CHPLAN_ENT("IR", 0x26, 0, 0x000), /* Iran */
COUNTRY_CHPLAN_ENT("IS", 0x26, 1, 0x7FB), /* Iceland */
COUNTRY_CHPLAN_ENT("IT", 0x26, 1, 0x7FB), /* Italy */
COUNTRY_CHPLAN_ENT("JE", 0x26, 1, 0x000), /* Jersey (UK) */
COUNTRY_CHPLAN_ENT("JM", 0x51, 1, 0x7F1), /* Jamaica */
COUNTRY_CHPLAN_ENT("JO", 0x49, 1, 0x7FB), /* Jordan */
COUNTRY_CHPLAN_ENT("JP", 0x27, 1, 0x7FF), /* Japan- Telec */
COUNTRY_CHPLAN_ENT("KE", 0x47, 1, 0x7F9), /* Kenya */
COUNTRY_CHPLAN_ENT("KG", 0x26, 1, 0x7F1), /* Kyrgyzstan */
COUNTRY_CHPLAN_ENT("KH", 0x26, 1, 0x7F1), /* Cambodia */
COUNTRY_CHPLAN_ENT("KI", 0x26, 1, 0x000), /* Kiribati */
COUNTRY_CHPLAN_ENT("KN", 0x34, 1, 0x000), /* Saint Kitts and Nevis */
COUNTRY_CHPLAN_ENT("KR", 0x28, 1, 0x7FB), /* South Korea */
COUNTRY_CHPLAN_ENT("KW", 0x47, 1, 0x7FB), /* Kuwait */
COUNTRY_CHPLAN_ENT("KY", 0x34, 1, 0x000), /* Cayman Islands (UK) */
COUNTRY_CHPLAN_ENT("KZ", 0x26, 1, 0x700), /* Kazakhstan */
COUNTRY_CHPLAN_ENT("LA", 0x26, 1, 0x000), /* Laos */
COUNTRY_CHPLAN_ENT("LB", 0x26, 1, 0x7F1), /* Lebanon */
COUNTRY_CHPLAN_ENT("LC", 0x34, 1, 0x000), /* Saint Lucia */
COUNTRY_CHPLAN_ENT("LI", 0x26, 1, 0x7FB), /* Liechtenstein */
COUNTRY_CHPLAN_ENT("LK", 0x26, 1, 0x7F1), /* Sri Lanka */
COUNTRY_CHPLAN_ENT("LR", 0x26, 1, 0x6B0), /* Liberia */
COUNTRY_CHPLAN_ENT("LS", 0x26, 1, 0x7F1), /* Lesotho */
COUNTRY_CHPLAN_ENT("LT", 0x26, 1, 0x7FB), /* Lithuania */
COUNTRY_CHPLAN_ENT("LU", 0x26, 1, 0x7FB), /* Luxembourg */
COUNTRY_CHPLAN_ENT("LV", 0x26, 1, 0x7FB), /* Latvia */
COUNTRY_CHPLAN_ENT("LY", 0x26, 1, 0x000), /* Libya */
COUNTRY_CHPLAN_ENT("MA", 0x47, 1, 0x7F1), /* Morocco */
COUNTRY_CHPLAN_ENT("MC", 0x26, 1, 0x7FB), /* Monaco */
COUNTRY_CHPLAN_ENT("MD", 0x26, 1, 0x7F1), /* Moldova */
COUNTRY_CHPLAN_ENT("ME", 0x26, 1, 0x7F1), /* Montenegro */
COUNTRY_CHPLAN_ENT("MF", 0x34, 1, 0x000), /* Saint Martin */
COUNTRY_CHPLAN_ENT("MG", 0x26, 1, 0x620), /* Madagascar */
COUNTRY_CHPLAN_ENT("MH", 0x34, 1, 0x000), /* Marshall Islands (USA) */
COUNTRY_CHPLAN_ENT("MK", 0x26, 1, 0x7F1), /* Republic of Macedonia (FYROM) */
COUNTRY_CHPLAN_ENT("ML", 0x26, 1, 0x6B0), /* Mali */
COUNTRY_CHPLAN_ENT("MM", 0x26, 1, 0x000), /* Burma (Myanmar) */
COUNTRY_CHPLAN_ENT("MN", 0x26, 1, 0x000), /* Mongolia */
COUNTRY_CHPLAN_ENT("MO", 0x26, 1, 0x600), /* Macau */
COUNTRY_CHPLAN_ENT("MP", 0x34, 1, 0x000), /* Northern Mariana Islands (USA) */
COUNTRY_CHPLAN_ENT("MQ", 0x26, 1, 0x640), /* Martinique (France) */
COUNTRY_CHPLAN_ENT("MR", 0x26, 1, 0x6A0), /* Mauritania */
COUNTRY_CHPLAN_ENT("MS", 0x26, 1, 0x000), /* Montserrat (UK) */
COUNTRY_CHPLAN_ENT("MT", 0x26, 1, 0x7FB), /* Malta */
COUNTRY_CHPLAN_ENT("MU", 0x26, 1, 0x6B0), /* Mauritius */
COUNTRY_CHPLAN_ENT("MV", 0x47, 1, 0x000), /* Maldives */
COUNTRY_CHPLAN_ENT("MW", 0x26, 1, 0x6B0), /* Malawi */
COUNTRY_CHPLAN_ENT("MX", 0x61, 1, 0x7F1), /* Mexico */
COUNTRY_CHPLAN_ENT("MY", 0x63, 1, 0x7F1), /* Malaysia */
COUNTRY_CHPLAN_ENT("MZ", 0x26, 1, 0x7F1), /* Mozambique */
COUNTRY_CHPLAN_ENT("NA", 0x26, 1, 0x700), /* Namibia */
COUNTRY_CHPLAN_ENT("NC", 0x26, 1, 0x000), /* New Caledonia */
COUNTRY_CHPLAN_ENT("NE", 0x26, 1, 0x6B0), /* Niger */
COUNTRY_CHPLAN_ENT("NF", 0x45, 1, 0x000), /* Norfolk Island (Australia) */
COUNTRY_CHPLAN_ENT("NG", 0x75, 1, 0x7F9), /* Nigeria */
COUNTRY_CHPLAN_ENT("NI", 0x34, 1, 0x7F1), /* Nicaragua */
COUNTRY_CHPLAN_ENT("NL", 0x26, 1, 0x7FB), /* Netherlands */
COUNTRY_CHPLAN_ENT("NO", 0x26, 1, 0x7FB), /* Norway */
COUNTRY_CHPLAN_ENT("NP", 0x47, 1, 0x6F0), /* Nepal */
COUNTRY_CHPLAN_ENT("NR", 0x26, 1, 0x000), /* Nauru */
COUNTRY_CHPLAN_ENT("NU", 0x45, 1, 0x000), /* Niue */
COUNTRY_CHPLAN_ENT("NZ", 0x45, 1, 0x7FB), /* New Zealand */
COUNTRY_CHPLAN_ENT("OM", 0x26, 1, 0x7F9), /* Oman */
COUNTRY_CHPLAN_ENT("PA", 0x34, 1, 0x7F1), /* Panama */
COUNTRY_CHPLAN_ENT("PE", 0x34, 1, 0x7F1), /* Peru */
COUNTRY_CHPLAN_ENT("PF", 0x26, 1, 0x000), /* French Polynesia (France) */
COUNTRY_CHPLAN_ENT("PG", 0x26, 1, 0x7F1), /* Papua New Guinea */
COUNTRY_CHPLAN_ENT("PH", 0x26, 1, 0x7F1), /* Philippines */
COUNTRY_CHPLAN_ENT("PK", 0x51, 1, 0x7F1), /* Pakistan */
COUNTRY_CHPLAN_ENT("PL", 0x26, 1, 0x7FB), /* Poland */
COUNTRY_CHPLAN_ENT("PM", 0x26, 1, 0x000), /* Saint Pierre and Miquelon (France) */
COUNTRY_CHPLAN_ENT("PR", 0x34, 1, 0x7F1), /* Puerto Rico */
COUNTRY_CHPLAN_ENT("PT", 0x26, 1, 0x7FB), /* Portugal */
COUNTRY_CHPLAN_ENT("PW", 0x34, 1, 0x000), /* Palau */
COUNTRY_CHPLAN_ENT("PY", 0x34, 1, 0x7F1), /* Paraguay */
COUNTRY_CHPLAN_ENT("QA", 0x51, 1, 0x7F9), /* Qatar */
COUNTRY_CHPLAN_ENT("RE", 0x26, 1, 0x000), /* Reunion (France) */
COUNTRY_CHPLAN_ENT("RO", 0x26, 1, 0x7F1), /* Romania */
COUNTRY_CHPLAN_ENT("RS", 0x26, 1, 0x7F1), /* Serbia, Kosovo */
COUNTRY_CHPLAN_ENT("RU", 0x59, 1, 0x7FB), /* Russia(fac/gost), Kaliningrad */
COUNTRY_CHPLAN_ENT("RW", 0x26, 1, 0x0B0), /* Rwanda */
COUNTRY_CHPLAN_ENT("SA", 0x26, 1, 0x7FB), /* Saudi Arabia */
COUNTRY_CHPLAN_ENT("SB", 0x26, 1, 0x000), /* Solomon Islands */
COUNTRY_CHPLAN_ENT("SC", 0x34, 1, 0x690), /* Seychelles */
COUNTRY_CHPLAN_ENT("SE", 0x26, 1, 0x7FB), /* Sweden */
COUNTRY_CHPLAN_ENT("SG", 0x26, 1, 0x7FB), /* Singapore */
COUNTRY_CHPLAN_ENT("SH", 0x26, 1, 0x000), /* Saint Helena (UK) */
COUNTRY_CHPLAN_ENT("SI", 0x26, 1, 0x7FB), /* Slovenia */
COUNTRY_CHPLAN_ENT("SJ", 0x26, 1, 0x000), /* Svalbard (Norway) */
COUNTRY_CHPLAN_ENT("SK", 0x26, 1, 0x7FB), /* Slovakia */
COUNTRY_CHPLAN_ENT("SL", 0x26, 1, 0x6B0), /* Sierra Leone */
COUNTRY_CHPLAN_ENT("SM", 0x26, 1, 0x000), /* San Marino */
COUNTRY_CHPLAN_ENT("SN", 0x26, 1, 0x7F1), /* Senegal */
COUNTRY_CHPLAN_ENT("SO", 0x26, 1, 0x000), /* Somalia */
COUNTRY_CHPLAN_ENT("SR", 0x74, 1, 0x000), /* Suriname */
COUNTRY_CHPLAN_ENT("ST", 0x34, 1, 0x680), /* Sao Tome and Principe */
COUNTRY_CHPLAN_ENT("SV", 0x30, 1, 0x7F1), /* El Salvador */
COUNTRY_CHPLAN_ENT("SX", 0x34, 1, 0x000), /* Sint Marteen */
COUNTRY_CHPLAN_ENT("SZ", 0x26, 1, 0x020), /* Swaziland */
COUNTRY_CHPLAN_ENT("TC", 0x26, 1, 0x000), /* Turks and Caicos Islands (UK) */
COUNTRY_CHPLAN_ENT("TD", 0x26, 1, 0x6B0), /* Chad */
COUNTRY_CHPLAN_ENT("TF", 0x26, 1, 0x680), /* French Southern and Antarctic Lands (FR Southern Territories) */
COUNTRY_CHPLAN_ENT("TG", 0x26, 1, 0x6B0), /* Togo */
COUNTRY_CHPLAN_ENT("TH", 0x26, 1, 0x7F1), /* Thailand */
COUNTRY_CHPLAN_ENT("TJ", 0x26, 1, 0x640), /* Tajikistan */
COUNTRY_CHPLAN_ENT("TK", 0x45, 1, 0x000), /* Tokelau */
COUNTRY_CHPLAN_ENT("TM", 0x26, 1, 0x000), /* Turkmenistan */
COUNTRY_CHPLAN_ENT("TN", 0x47, 1, 0x7F1), /* Tunisia */
COUNTRY_CHPLAN_ENT("TO", 0x26, 1, 0x000), /* Tonga */
COUNTRY_CHPLAN_ENT("TR", 0x26, 1, 0x7F1), /* Turkey, Northern Cyprus */
COUNTRY_CHPLAN_ENT("TT", 0x42, 1, 0x3F1), /* Trinidad & Tobago */
COUNTRY_CHPLAN_ENT("TW", 0x76, 1, 0x7FF), /* Taiwan */
COUNTRY_CHPLAN_ENT("TZ", 0x26, 1, 0x6F0), /* Tanzania */
COUNTRY_CHPLAN_ENT("UA", 0x36, 1, 0x7FB), /* Ukraine */
COUNTRY_CHPLAN_ENT("UG", 0x26, 1, 0x6F1), /* Uganda */
COUNTRY_CHPLAN_ENT("US", 0x76, 1, 0x7FF), /* United States of America (USA) */
COUNTRY_CHPLAN_ENT("UY", 0x30, 1, 0x7F1), /* Uruguay */
COUNTRY_CHPLAN_ENT("UZ", 0x47, 1, 0x6F0), /* Uzbekistan */
COUNTRY_CHPLAN_ENT("VA", 0x26, 1, 0x000), /* Holy See (Vatican City) */
COUNTRY_CHPLAN_ENT("VC", 0x34, 1, 0x010), /* Saint Vincent and the Grenadines */
COUNTRY_CHPLAN_ENT("VE", 0x30, 1, 0x7F1), /* Venezuela */
COUNTRY_CHPLAN_ENT("VI", 0x34, 1, 0x000), /* United States Virgin Islands (USA) */
COUNTRY_CHPLAN_ENT("VN", 0x26, 1, 0x7F1), /* Vietnam */
COUNTRY_CHPLAN_ENT("VU", 0x26, 1, 0x000), /* Vanuatu */
COUNTRY_CHPLAN_ENT("WF", 0x26, 1, 0x000), /* Wallis and Futuna (France) */
COUNTRY_CHPLAN_ENT("WS", 0x34, 1, 0x000), /* Samoa */
COUNTRY_CHPLAN_ENT("YE", 0x26, 1, 0x040), /* Yemen */
COUNTRY_CHPLAN_ENT("YT", 0x26, 1, 0x680), /* Mayotte (France) */
COUNTRY_CHPLAN_ENT("ZA", 0x26, 1, 0x7F1), /* South Africa */
COUNTRY_CHPLAN_ENT("ZM", 0x26, 1, 0x6B0), /* Zambia */
COUNTRY_CHPLAN_ENT("ZW", 0x26, 1, 0x7F1), /* Zimbabwe */
};
/*
* rtw_get_chplan_from_country -
* @country_code: string of country code
*
* Return pointer of struct country_chplan entry or NULL when unsupported country_code is given
*/
const struct country_chplan *rtw_get_chplan_from_country(const char *country_code)
{
#if RTW_DEF_MODULE_REGULATORY_CERT
const struct country_chplan *exc_ent = NULL;
#endif
const struct country_chplan *ent = NULL;
const struct country_chplan *map = NULL;
u16 map_sz = 0;
char code[2];
int i;
code[0] = alpha_to_upper(country_code[0]);
code[1] = alpha_to_upper(country_code[1]);
#ifdef CONFIG_CUSTOMIZED_COUNTRY_CHPLAN_MAP
map = CUSTOMIZED_country_chplan_map;
map_sz = sizeof(CUSTOMIZED_country_chplan_map) / sizeof(struct country_chplan);
#else
#if RTW_DEF_MODULE_REGULATORY_CERT
exc_ent = rtw_def_module_get_chplan_from_country(code);
#endif
map = country_chplan_map;
map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan);
#endif
for (i = 0; i < map_sz; i++) {
if (strncmp(code, map[i].alpha2, 2) == 0) {
ent = &map[i];
break;
}
}
exit:
#if RTW_DEF_MODULE_REGULATORY_CERT
if (!ent || !(COUNTRY_CHPLAN_DEF_MODULE_FALGS(ent) & RTW_DEF_MODULE_REGULATORY_CERT))
exc_ent = ent = NULL;
if (exc_ent)
ent = exc_ent;
#endif
return ent;
}
const char *const _regd_str[] = {
"NONE",
"FCC",
@ -1044,7 +577,7 @@ const char *const _regd_str[] = {
"WW",
};
#ifdef CONFIG_TXPWR_LIMIT
#if CONFIG_TXPWR_LIMIT
void _dump_regd_exc_list(void *sel, struct rf_ctl_t *rfctl)
{
struct regd_exc_ent *ent;
@ -1161,7 +694,6 @@ struct regd_exc_ent *_rtw_regd_exc_search(struct rf_ctl_t *rfctl, const char *co
break;
}
exit:
if (match)
return ent;
else
@ -1341,13 +873,13 @@ void dump_txpwr_lmt(void *sel, _adapter *adapter)
ent = LIST_CONTAINOR(cur, struct txpwr_lmt_ent, list);
cur = get_next(cur);
sprintf(fmt, "%%%zus%%s ", strlen(ent->regd_name) < 4 ? 5 - strlen(ent->regd_name) : 1);
sprintf(fmt, "%%%zus%%s ", strlen(ent->regd_name) >= 6 ? 1 : 6 - strlen(ent->regd_name));
snprintf(tmp_str, TMP_STR_LEN, fmt
, strcmp(ent->regd_name, rfctl->regd_name) == 0 ? "*" : ""
, ent->regd_name);
_RTW_PRINT_SEL(sel, "%s", tmp_str);
}
sprintf(fmt, "%%%zus%%s ", strlen(regd_str(TXPWR_LMT_WW)) < 4 ? 5 - strlen(regd_str(TXPWR_LMT_WW)) : 1);
sprintf(fmt, "%%%zus%%s ", strlen(regd_str(TXPWR_LMT_WW)) >= 6 ? 1 : 6 - strlen(regd_str(TXPWR_LMT_WW)));
snprintf(tmp_str, TMP_STR_LEN, fmt
, strcmp(rfctl->regd_name, regd_str(TXPWR_LMT_WW)) == 0 ? "*" : ""
, regd_str(TXPWR_LMT_WW));
@ -1394,45 +926,41 @@ void dump_txpwr_lmt(void *sel, _adapter *adapter)
ent = LIST_CONTAINOR(cur, struct txpwr_lmt_ent, list);
cur = get_next(cur);
lmt = phy_get_txpwr_lmt_abs(adapter, ent->regd_name, band, bw, tlrs, ntx_idx, ch, 0);
if (lmt == MAX_POWER_INDEX) {
sprintf(fmt, "%%%zus ", strlen(ent->regd_name) >= 5 ? strlen(ent->regd_name) + 1 : 5);
if (lmt == hal_spec->txgi_max) {
sprintf(fmt, "%%%zus ", strlen(ent->regd_name) >= 6 ? strlen(ent->regd_name) + 1 : 6);
snprintf(tmp_str, TMP_STR_LEN, fmt, "NA");
_RTW_PRINT_SEL(sel, "%s", tmp_str);
} else {
if (lmt == -1) { /* -0.5 */
sprintf(fmt, "%%%zus ", strlen(ent->regd_name) >= 5 ? strlen(ent->regd_name) + 1 : 5);
snprintf(tmp_str, TMP_STR_LEN, fmt, "-0.5");
_RTW_PRINT_SEL(sel, "%s", tmp_str);
} else if (lmt % 2) { /* n.5 */
sprintf(fmt, "%%%zud.5 ", strlen(ent->regd_name) >= 5 ? strlen(ent->regd_name) - 1 : 3);
snprintf(tmp_str, TMP_STR_LEN, fmt, lmt / 2);
_RTW_PRINT_SEL(sel, "%s", tmp_str);
} else { /* n */
sprintf(fmt, "%%%zud ", strlen(ent->regd_name) >= 5 ? strlen(ent->regd_name) + 1 : 5);
snprintf(tmp_str, TMP_STR_LEN, fmt, lmt / 2);
_RTW_PRINT_SEL(sel, "%s", tmp_str);
}
} else if (lmt > -hal_spec->txgi_pdbm && lmt < 0) { /* -0.xx */
sprintf(fmt, "%%%zus-0.%%d ", strlen(ent->regd_name) >= 6 ? strlen(ent->regd_name) - 4 : 1);
snprintf(tmp_str, TMP_STR_LEN, fmt, "", (rtw_abs(lmt) % hal_spec->txgi_pdbm) * 100 / hal_spec->txgi_pdbm);
_RTW_PRINT_SEL(sel, "%s", tmp_str);
} else if (lmt % hal_spec->txgi_pdbm) { /* d.xx */
sprintf(fmt, "%%%zud.%%d ", strlen(ent->regd_name) >= 6 ? strlen(ent->regd_name) - 2 : 3);
snprintf(tmp_str, TMP_STR_LEN, fmt, lmt / hal_spec->txgi_pdbm, (rtw_abs(lmt) % hal_spec->txgi_pdbm) * 100 / hal_spec->txgi_pdbm);
_RTW_PRINT_SEL(sel, "%s", tmp_str);
} else { /* d */
sprintf(fmt, "%%%zud ", strlen(ent->regd_name) >= 6 ? strlen(ent->regd_name) + 1 : 6);
snprintf(tmp_str, TMP_STR_LEN, fmt, lmt / hal_spec->txgi_pdbm);
_RTW_PRINT_SEL(sel, "%s", tmp_str);
}
}
lmt = phy_get_txpwr_lmt_abs(adapter, regd_str(TXPWR_LMT_WW), band, bw, tlrs, ntx_idx, ch, 0);
if (lmt == MAX_POWER_INDEX) {
sprintf(fmt, "%%%zus ", strlen(regd_str(TXPWR_LMT_WW)) >= 5 ? strlen(regd_str(TXPWR_LMT_WW)) + 1 : 5);
if (lmt == hal_spec->txgi_max) {
sprintf(fmt, "%%%zus ", strlen(regd_str(TXPWR_LMT_WW)) >= 6 ? strlen(regd_str(TXPWR_LMT_WW)) + 1 : 6);
snprintf(tmp_str, TMP_STR_LEN, fmt, "NA");
_RTW_PRINT_SEL(sel, "%s", tmp_str);
} else {
if (lmt == -1) { /* -0.5 */
sprintf(fmt, "%%%zus ", strlen(regd_str(TXPWR_LMT_WW)) >= 5 ? strlen(regd_str(TXPWR_LMT_WW)) + 1 : 5);
snprintf(tmp_str, TMP_STR_LEN, fmt, "-0.5");
_RTW_PRINT_SEL(sel, "%s", tmp_str);
} else if (lmt % 2) { /* n.5 */
sprintf(fmt, "%%%zud.5 ", strlen(regd_str(TXPWR_LMT_WW)) >= 5 ? strlen(regd_str(TXPWR_LMT_WW)) - 1 : 3);
snprintf(tmp_str, TMP_STR_LEN, fmt, lmt / 2);
_RTW_PRINT_SEL(sel, "%s", tmp_str);
} else { /* n */
sprintf(fmt, "%%%zud ", strlen(regd_str(TXPWR_LMT_WW)) >= 5 ? strlen(regd_str(TXPWR_LMT_WW)) + 1 : 5);
snprintf(tmp_str, TMP_STR_LEN, fmt, lmt / 2);
_RTW_PRINT_SEL(sel, "%s", tmp_str);
}
} else if (lmt > -hal_spec->txgi_pdbm && lmt < 0) { /* -0.xx */
sprintf(fmt, "%%%zus-0.%%d ", strlen(regd_str(TXPWR_LMT_WW)) >= 6 ? strlen(regd_str(TXPWR_LMT_WW)) - 4 : 1);
snprintf(tmp_str, TMP_STR_LEN, fmt, "", (rtw_abs(lmt) % hal_spec->txgi_pdbm) * 100 / hal_spec->txgi_pdbm);
_RTW_PRINT_SEL(sel, "%s", tmp_str);
} else if (lmt % hal_spec->txgi_pdbm) { /* d.xx */
sprintf(fmt, "%%%zud.%%d ", strlen(regd_str(TXPWR_LMT_WW)) >= 6 ? strlen(regd_str(TXPWR_LMT_WW)) - 2 : 3);
snprintf(tmp_str, TMP_STR_LEN, fmt, lmt / hal_spec->txgi_pdbm, (rtw_abs(lmt) % hal_spec->txgi_pdbm) * 100 / hal_spec->txgi_pdbm);
_RTW_PRINT_SEL(sel, "%s", tmp_str);
} else { /* d */
sprintf(fmt, "%%%zud ", strlen(regd_str(TXPWR_LMT_WW)) >= 6 ? strlen(regd_str(TXPWR_LMT_WW)) + 1 : 6);
snprintf(tmp_str, TMP_STR_LEN, fmt, lmt / hal_spec->txgi_pdbm);
_RTW_PRINT_SEL(sel, "%s", tmp_str);
}
/* dump limit offset of each path */
@ -1450,8 +978,8 @@ void dump_txpwr_lmt(void *sel, _adapter *adapter)
ent = LIST_CONTAINOR(cur, struct txpwr_lmt_ent, list);
cur = get_next(cur);
lmt_offset = phy_get_txpwr_lmt(adapter, ent->regd_name, band, bw, path, rs, ntx_idx, ch, 0);
if (lmt_offset == MAX_POWER_INDEX) {
*(lmt_idx + i * RF_PATH_MAX + path) = MAX_POWER_INDEX;
if (lmt_offset == hal_spec->txgi_max) {
*(lmt_idx + i * RF_PATH_MAX + path) = hal_spec->txgi_max;
_RTW_PRINT_SEL(sel, "%3s ", "NA");
} else {
*(lmt_idx + i * RF_PATH_MAX + path) = lmt_offset + base;
@ -1460,7 +988,7 @@ void dump_txpwr_lmt(void *sel, _adapter *adapter)
i++;
}
lmt_offset = phy_get_txpwr_lmt(adapter, regd_str(TXPWR_LMT_WW), band, bw, path, rs, ntx_idx, ch, 0);
if (lmt_offset == MAX_POWER_INDEX)
if (lmt_offset == hal_spec->txgi_max)
_RTW_PRINT_SEL(sel, "%3s ", "NA");
else
_RTW_PRINT_SEL(sel, "%3d ", lmt_offset);
@ -1502,6 +1030,7 @@ release_lock:
void rtw_txpwr_lmt_add_with_nlen(struct rf_ctl_t *rfctl, const char *regd_name, u32 nlen
, u8 band, u8 bw, u8 tlrs, u8 ntx_idx, u8 ch_idx, s8 lmt)
{
struct hal_spec_t *hal_spec = GET_HAL_SPEC(dvobj_get_primary_adapter(rfctl_to_dvobj(rfctl)));
struct txpwr_lmt_ent *ent;
_irqL irqL;
_list *cur, *head;
@ -1540,13 +1069,13 @@ void rtw_txpwr_lmt_add_with_nlen(struct rf_ctl_t *rfctl, const char *regd_name,
for (k = 0; k < TXPWR_LMT_RS_NUM_2G; ++k)
for (m = 0; m < CENTER_CH_2G_NUM; ++m)
for (l = 0; l < MAX_TX_COUNT; ++l)
ent->lmt_2g[j][k][m][l] = MAX_POWER_INDEX;
ent->lmt_2g[j][k][m][l] = hal_spec->txgi_max;
#ifdef CONFIG_IEEE80211_BAND_5GHZ
for (j = 0; j < MAX_5G_BANDWIDTH_NUM; ++j)
for (k = 0; k < TXPWR_LMT_RS_NUM_5G; ++k)
for (m = 0; m < CENTER_CH_5G_ALL_NUM; ++m)
for (l = 0; l < MAX_TX_COUNT; ++l)
ent->lmt_5g[j][k][m][l] = MAX_POWER_INDEX;
ent->lmt_5g[j][k][m][l] = hal_spec->txgi_max;
#endif
}
@ -1563,7 +1092,7 @@ chk_lmt_val:
else
goto release_lock;
if (pre_lmt != MAX_POWER_INDEX)
if (pre_lmt != hal_spec->txgi_max)
RTW_PRINT("duplicate txpwr_lmt for [%s][%s][%s][%s][%uT][%d]\n"
, regd_name, band_str(band), ch_width_str(bw), txpwr_lmt_rs_str(tlrs), ntx_idx + 1
, band == BAND_ON_2_4G ? ch_idx + 1 : center_ch_5g_all[ch_idx]);
@ -1684,7 +1213,6 @@ s8 rtw_rf_get_kfree_tx_gain_offset(_adapter *padapter, u8 path, u8 ch)
s8 kfree_offset = 0;
#ifdef CONFIG_RF_POWER_TRIM
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(padapter);
struct kfree_data_t *kfree_data = GET_KFREE_DATA(padapter);
s8 bb_gain_sel = rtw_ch_to_bb_gain_sel(ch);
@ -1710,7 +1238,9 @@ exit:
void rtw_rf_set_tx_gain_offset(_adapter *adapter, u8 path, s8 offset)
{
#if !defined(CONFIG_RTL8814A) && !defined(CONFIG_RTL8822B) && !defined(CONFIG_RTL8821C)
u8 write_value;
#endif
u8 target_path = 0;
u32 val32 = 0;
@ -1749,6 +1279,12 @@ void rtw_rf_set_tx_gain_offset(_adapter *adapter, u8 path, s8 offset)
rtw_hal_write_rfreg(adapter, target_path, 0x55, 0x0fc000, write_value);
break;
#endif /* CONFIG_RTL8188F */
#ifdef CONFIG_RTL8188GTV
case RTL8188GTV:
write_value = RF_TX_GAIN_OFFSET_8188GTV(offset);
rtw_hal_write_rfreg(adapter, target_path, 0x55, 0x0fc000, write_value);
break;
#endif /* CONFIG_RTL8188GTV */
#ifdef CONFIG_RTL8192E
case RTL8192E:
write_value = RF_TX_GAIN_OFFSET_8192E(offset);
@ -1762,10 +1298,11 @@ void rtw_rf_set_tx_gain_offset(_adapter *adapter, u8 path, s8 offset)
rtw_hal_write_rfreg(adapter, target_path, 0x55, 0x0f8000, write_value);
break;
#endif /* CONFIG_RTL8821A */
#if defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C)
#if defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) || defined(CONFIG_RTL8192F)
case RTL8814A:
case RTL8822B:
case RTL8821C:
case RTL8192F:
RTW_INFO("\nkfree by PhyDM on the sw CH. path %d\n", path);
break;
#endif /* CONFIG_RTL8814A || CONFIG_RTL8822B || CONFIG_RTL8821C */

View File

@ -430,40 +430,17 @@ int issue_null_reply(struct rm_obj *prm)
int ready_for_scan(struct rm_obj *prm)
{
_adapter *padapter = prm->psta->padapter;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
if (rtw_is_scan_deny(padapter))
return _FALSE;
u8 ssc_chk;
if (!rtw_is_adapter_up(padapter))
return _FALSE;
if (rtw_mi_busy_traffic_check(padapter, _FALSE))
return _FALSE;
ssc_chk = rtw_sitesurvey_condition_check(padapter, _FALSE);
if (check_fwstate(pmlmepriv, WIFI_AP_STATE)
&& check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) {
RTW_INFO(FUNC_ADPT_FMT" WIFI_AP_STATE && WIFI_UNDER_WPS\n",
FUNC_ADPT_ARG(padapter));
return _FALSE;
}
if (check_fwstate(pmlmepriv,
(_FW_UNDER_SURVEY | _FW_UNDER_LINKING)) == _TRUE) {
RTW_INFO(FUNC_ADPT_FMT" _FW_UNDER_SURVEY|_FW_UNDER_LINKING\n",
FUNC_ADPT_ARG(padapter));
return _FALSE;
}
if (ssc_chk == SS_ALLOW)
return _SUCCESS;
#ifdef CONFIG_CONCURRENT_MODE
if (rtw_mi_buddy_check_fwstate(padapter,
(_FW_UNDER_SURVEY | _FW_UNDER_LINKING | WIFI_UNDER_WPS))) {
RTW_INFO(FUNC_ADPT_FMT", but buddy_intf is under scanning or linking or wps_phase\n",
FUNC_ADPT_ARG(padapter));
return _FALSE;
}
#endif
return _SUCCESS;
return _FALSE;
}
int rm_sitesurvey(struct rm_obj *prm)

View File

@ -656,8 +656,8 @@ static int rm_state_do_meas(struct rm_obj *prm, enum RM_EV_ID evid)
case RM_EV_start_meas:
if (prm->q.action_code == RM_ACT_RADIO_MEAS_REQ) {
/* resotre measurement start time */
rtw_hal_get_hwreg(padapter, HW_VAR_TSF, (u8 *)&val64);
prm->meas_start_time = val64;
prm->meas_start_time = rtw_hal_get_tsftr_by_port(padapter
, rtw_hal_get_port(padapter));
switch (prm->q.m_type) {
case bcn_req:
@ -741,8 +741,8 @@ static int rm_state_do_meas(struct rm_obj *prm, enum RM_EV_ID evid)
case RM_EV_state_out:
rm_cancel_clock(prm);
/* resotre measurement end time */
rtw_hal_get_hwreg(padapter, HW_VAR_TSF, (u8 *)&val64);
_rtw_memcpy(&prm->meas_end_time, (char *)&val64, sizeof(u64));
prm->meas_end_time = rtw_hal_get_tsftr_by_port(padapter
, rtw_hal_get_port(padapter));
val8 = 0; /* Disable free run counter */
rtw_hal_set_hwreg(padapter, HW_VAR_FREECNT, &val8);

View File

@ -555,7 +555,7 @@ void rtw_rson_scan_cmd_hdl(_adapter *padapter, int op)
RTW_INFO("change to widi listen\n");
}
#endif /* CONFIG_INTEL_WIDI */
rtw_free_assoc_resources(padapter, 1);
rtw_free_assoc_resources(padapter, _TRUE);
rtw_indicate_disconnect(padapter, 0, _FALSE);
} else
pmlmepriv->to_join = _TRUE;

View File

@ -982,13 +982,6 @@ static void next_key(u8 *key, sint round);
static void byte_sub(u8 *in, u8 *out);
static void shift_row(u8 *in, u8 *out);
static void mix_column(u8 *in, u8 *out);
#ifndef PLATFORM_FREEBSD
static void add_round_key(u8 *shiftrow_in,
u8 *mcol_in,
u8 *block_in,
sint round,
u8 *out);
#endif /* PLATFORM_FREEBSD */
static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext);
@ -1929,7 +1922,6 @@ u32 rtw_aes_decrypt(_adapter *padapter, u8 *precvframe)
sint length;
u32 prwskeylen;
u8 *pframe, *prwskey; /* , *payload,*iv */
struct sta_info *stainfo;
struct rx_pkt_attrib *prxattrib = &((union recv_frame *)precvframe)->u.hdr.attrib;
@ -2139,6 +2131,7 @@ BIP_exit:
#endif /* CONFIG_IEEE80211W */
#ifndef PLATFORM_FREEBSD
#if defined(CONFIG_TDLS)
/* compress 512-bits */
static int sha256_compress(struct sha256_state *md, unsigned char *buf)
{
@ -2319,7 +2312,9 @@ static u8 os_strlen(const char *s)
p++;
return p - s;
}
#endif
#if defined(CONFIG_TDLS) || defined(CONFIG_RTW_MESH_AEK)
static int os_memcmp(const void *s1, const void *s2, u8 n)
{
const unsigned char *p1 = s1, *p2 = s2;
@ -2337,6 +2332,7 @@ static int os_memcmp(const void *s1, const void *s2, u8 n)
return *p1 - *p2;
}
#endif
/**
* hmac_sha256_vector - HMAC-SHA256 over data vector (RFC 2104)
@ -2347,6 +2343,7 @@ static int os_memcmp(const void *s1, const void *s2, u8 n)
* @len: Lengths of the data blocks
* @mac: Buffer for the hash (32 bytes)
*/
#if defined(CONFIG_TDLS)
static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
u8 *addr[], size_t *len, u8 *mac)
{
@ -2408,6 +2405,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
_len[1] = 32;
sha256_vector(2, _addr, _len, mac);
}
#endif /* CONFIG_TDLS */
#endif /* PLATFORM_FREEBSD */
/**
* sha256_prf - SHA256-based Pseudo-Random Function (IEEE 802.11r, 8.5.1.5.2)
@ -2423,6 +2421,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
* given key.
*/
#ifndef PLATFORM_FREEBSD /* Baron */
#if defined(CONFIG_TDLS)
static void sha256_prf(u8 *key, size_t key_len, char *label,
u8 *data, size_t data_len, u8 *buf, size_t buf_len)
{
@ -2459,6 +2458,7 @@ static void sha256_prf(u8 *key, size_t key_len, char *label,
counter++;
}
}
#endif
#endif /* PLATFORM_FREEBSD Baron */
/* AES tables*/

View File

@ -47,10 +47,9 @@ u8 sreset_get_wifi_status(_adapter *padapter)
#if defined(DBG_CONFIG_ERROR_DETECT)
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
u8 status = WIFI_STATUS_SUCCESS;
u32 val32 = 0;
_irqL irqL;
if (psrtpriv->silent_reset_inprogress == _TRUE)
return status;
val32 = rtw_read32(padapter, REG_TXDMA_STATUS);
@ -104,11 +103,9 @@ bool sreset_inprogress(_adapter *padapter)
void sreset_restore_security_station(_adapter *padapter)
{
u8 EntryId = 0;
struct mlme_priv *mlmepriv = &padapter->mlmepriv;
struct sta_priv *pstapriv = &padapter->stapriv;
struct sta_info *psta;
struct security_priv *psecuritypriv = &(padapter->securitypriv);
struct mlme_ext_info *pmlmeinfo = &padapter->mlmeextpriv.mlmext_info;
{
@ -147,25 +144,6 @@ void sreset_restore_network_station(_adapter *padapter)
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
u8 doiqk = _FALSE;
#if 0
{
/* ======================================================= */
/* reset related register of Beacon control */
/* set MSR to nolink */
Set_MSR(padapter, _HW_STATE_NOLINK_);
/* reject all data frame */
rtw_write16(padapter, REG_RXFLTMAP2, 0x00);
/* reset TSF */
rtw_write8(padapter, REG_DUAL_TSF_RST, (BIT(0) | BIT(1)));
/* disable update TSF */
SetBcnCtrlReg(padapter, BIT(4), 0);
/* ======================================================= */
}
#endif
rtw_setopmode_cmd(padapter, Ndis802_11Infrastructure, RTW_CMDF_DIRECTLY);
{
@ -173,6 +151,7 @@ void sreset_restore_network_station(_adapter *padapter)
#ifdef CONFIG_USB_HCI
/* TH=1 => means that invalidate usb rx aggregation */
/* TH=0 => means that validate usb rx aggregation, use init value. */
#ifdef CONFIG_80211N_HT
if (mlmepriv->htpriv.ht_option) {
if (padapter->registrypriv.wifi_spec == 1)
threshold = 1;
@ -183,6 +162,7 @@ void sreset_restore_network_station(_adapter *padapter)
threshold = 1;
rtw_hal_set_hwreg(padapter, HW_VAR_RXDMA_AGG_PG_TH, (u8 *)(&threshold));
}
#endif /* CONFIG_80211N_HT */
#endif
}
@ -200,8 +180,9 @@ void sreset_restore_network_station(_adapter *padapter)
{
u8 join_type = 0;
rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
rtw_hal_rcr_set_chk_bssid(padapter, MLME_STA_CONNECTING);
rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
}
Set_MSR(padapter, (pmlmeinfo->state & 0x3));
@ -217,8 +198,6 @@ void sreset_restore_network_station(_adapter *padapter)
void sreset_restore_network_status(_adapter *padapter)
{
struct mlme_priv *mlmepriv = &padapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
if (check_fwstate(mlmepriv, WIFI_STATION_STATE)) {
RTW_INFO(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_STATION_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
@ -316,6 +295,9 @@ void sreset_reset(_adapter *padapter)
#ifdef CONFIG_IPS
_ips_enter(padapter);
_ips_leave(padapter);
#endif
#ifdef CONFIG_CONCURRENT_MODE
rtw_mi_ap_info_restore(padapter);
#endif
rtw_mi_sreset_adapter_hdl(padapter, _TRUE);/*sreset_start_adapter*/

View File

@ -498,7 +498,7 @@ static void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl)
/* struct sta_info *rtw_alloc_stainfo(_queue *pfree_sta_queue, unsigned char *hwaddr) */
struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, const u8 *hwaddr)
{
_irqL irqL, irqL2;
_irqL irqL2;
s32 index;
_list *phash_list;
struct sta_info *psta;
@ -512,13 +512,13 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, const u8 *hwaddr)
/* _enter_critical_bh(&(pfree_sta_queue->lock), &irqL); */
_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL2);
if (!pstapriv->padapter->pnetdev || _rtw_queue_empty(pfree_sta_queue) == _TRUE) {
if (_rtw_queue_empty(pfree_sta_queue) == _TRUE) {
/* _exit_critical_bh(&(pfree_sta_queue->lock), &irqL); */
_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2);
psta = NULL;
} else {
psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list);
if (!psta)
goto exit;
rtw_list_delete(&(psta->list));
/* _exit_critical_bh(&(pfree_sta_queue->lock), &irqL); */
@ -595,6 +595,7 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, const u8 *hwaddr)
#endif
/* init for the sequence number of received management frame */
psta->RxMgmtFrameSeqNum = 0xffff;
_rtw_memset(&psta->sta_stats, 0, sizeof(struct stainfo_stats));
rtw_alloc_macid(pstapriv->padapter, psta);
@ -798,11 +799,6 @@ u32 rtw_free_stainfo(_adapter *padapter , struct sta_info *psta)
#ifdef CONFIG_NATIVEAP_MLME
if (psta->cmn.aid > 31) {
pr_err("***** psta->aid (%d) out of bounds\n", psta->cmn.aid);
return _FAIL;
}
if (pmlmeinfo->state == _HW_STATE_AP_) {
rtw_tim_map_clear(padapter, pstapriv->sta_dz_bitmap, psta->cmn.aid);
rtw_tim_map_clear(padapter, pstapriv->tim_bitmap, psta->cmn.aid);

View File

@ -439,7 +439,7 @@ void rtw_tdls_process_ht_cap(_adapter *padapter, struct sta_info *ptdls_sta, u8
}
if (ptdls_sta->flags & WLAN_STA_HT) {
if (padapter->registrypriv.ht_enable == _TRUE) {
if (padapter->registrypriv.ht_enable == _TRUE && is_supported_ht(padapter->registrypriv.wireless_mode) ) {
ptdls_sta->htpriv.ht_option = _TRUE;
ptdls_sta->qos_option = _TRUE;
} else {
@ -559,7 +559,7 @@ void rtw_tdls_process_vht_cap(_adapter *padapter, struct sta_info *ptdls_sta, u8
if (ptdls_sta->flags & WLAN_STA_VHT) {
if (REGSTY_IS_11AC_ENABLE(&padapter->registrypriv)
&& hal_chk_proto_cap(padapter, PROTO_CAP_11AC)
&& is_supported_vht(padapter->registrypriv.wireless_mode)
&& (!rfctl->country_ent || COUNTRY_CHPLAN_EN_11AC(rfctl->country_ent)))
ptdls_sta->vhtpriv.vht_option = _TRUE;
else
@ -2374,7 +2374,7 @@ int On_TDLS_Dis_Req(_adapter *padapter, union recv_frame *precv_frame)
if (psta_ap == NULL)
goto exit;
dst = pIE->data + 12;
if (MacAddr_isBcst(dst) == _FALSE && (_rtw_memcmp(adapter_mac_addr(padapter), dst, 6) == _FALSE))
if (MacAddr_isBcst(dst) == _FALSE && (_rtw_memcmp(adapter_mac_addr(padapter), dst, ETH_ALEN) == _FALSE))
goto exit;
break;
default:
@ -2853,7 +2853,7 @@ void rtw_build_tdls_setup_req_ies(_adapter *padapter, struct xmit_frame *pxmitfr
#ifdef CONFIG_80211AC_VHT
if ((padapter->mlmepriv.htpriv.ht_option == _TRUE) && (pmlmeext->cur_channel > 14)
&& REGSTY_IS_11AC_ENABLE(pregistrypriv)
&& hal_chk_proto_cap(padapter, PROTO_CAP_11AC)
&& is_supported_vht(pregistrypriv->wireless_mode)
&& (!rfctl->country_ent || COUNTRY_CHPLAN_EN_11AC(rfctl->country_ent))
) {
pframe = rtw_tdls_set_aid(padapter, pframe, pattrib);
@ -2948,7 +2948,7 @@ void rtw_build_tdls_setup_rsp_ies(_adapter *padapter, struct xmit_frame *pxmitfr
#ifdef CONFIG_80211AC_VHT
if ((padapter->mlmepriv.htpriv.ht_option == _TRUE) && (pmlmeext->cur_channel > 14)
&& REGSTY_IS_11AC_ENABLE(pregistrypriv)
&& hal_chk_proto_cap(padapter, PROTO_CAP_11AC)
&& is_supported_vht(pregistrypriv->wireless_mode)
&& (!rfctl->country_ent || COUNTRY_CHPLAN_EN_11AC(rfctl->country_ent))
) {
pframe = rtw_tdls_set_aid(padapter, pframe, pattrib);
@ -3025,7 +3025,7 @@ void rtw_build_tdls_setup_cfm_ies(_adapter *padapter, struct xmit_frame *pxmitfr
if ((padapter->mlmepriv.htpriv.ht_option == _TRUE)
&& (ptdls_sta->vhtpriv.vht_option == _TRUE) && (pmlmeext->cur_channel > 14)
&& REGSTY_IS_11AC_ENABLE(pregistrypriv)
&& hal_chk_proto_cap(padapter, PROTO_CAP_11AC)
&& is_supported_vht(pregistrypriv->wireless_mode)
&& (!rfctl->country_ent || COUNTRY_CHPLAN_EN_11AC(rfctl->country_ent))
) {
pframe = rtw_tdls_set_vht_operation(padapter, pframe, pattrib, pmlmeext->cur_channel);

View File

@ -61,10 +61,6 @@ void dump_vht_cap_ie_content(void *sel, const u8 *buf, u32 buf_len)
void dump_vht_cap_ie(void *sel, const u8 *ie, u32 ie_len)
{
const u8 *pos = ie;
u16 id;
u16 len;
const u8 *vht_cap_ie;
sint vht_cap_ielen;
@ -99,10 +95,6 @@ void dump_vht_op_ie_content(void *sel, const u8 *buf, u32 buf_len)
void dump_vht_op_ie(void *sel, const u8 *ie, u32 ie_len)
{
const u8 *pos = ie;
u16 id;
u16 len;
const u8 *vht_op_ie;
sint vht_op_ielen;
@ -490,6 +482,83 @@ void update_hw_vht_param(_adapter *padapter)
rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, (u8 *)(&pvhtpriv->ampdu_len));
}
#ifdef ROKU_PRIVATE
u8 VHT_get_ss_from_map(u8 *vht_mcs_map)
{
u8 i, j;
u8 ss = 0;
for (i = 0; i < 2; i++) {
if (vht_mcs_map[i] != 0xff) {
for (j = 0; j < 8; j += 2) {
if (((vht_mcs_map[i] >> j) & 0x03) == 0x03)
break;
ss++;
}
}
}
return ss;
}
void VHT_caps_handler_infra_ap(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct vht_priv_infra_ap *pvhtpriv = &pmlmepriv->vhtpriv_infra_ap;
u8 cur_stbc_cap_infra_ap = 0;
u16 cur_beamform_cap_infra_ap = 0;
u8 *pcap_mcs;
u8 *pcap_mcs_tx;
u8 Rx_ss = 0, Tx_ss = 0;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
if (pIE == NULL)
return;
pmlmeinfo->ht_vht_received |= BIT(1);
pvhtpriv->ldpc_cap_infra_ap = GET_VHT_CAPABILITY_ELE_RX_LDPC(pIE->data);
if (GET_VHT_CAPABILITY_ELE_RX_STBC(pIE->data))
SET_FLAG(cur_stbc_cap_infra_ap, STBC_VHT_ENABLE_RX);
if (GET_VHT_CAPABILITY_ELE_TX_STBC(pIE->data))
SET_FLAG(cur_stbc_cap_infra_ap, STBC_VHT_ENABLE_TX);
pvhtpriv->stbc_cap_infra_ap = cur_stbc_cap_infra_ap;
/*store ap info for channel bandwidth*/
pvhtpriv->channel_width_infra_ap = GET_VHT_CAPABILITY_ELE_CHL_WIDTH(pIE->data);
/*check B11: SU Beamformer Capable and B12: SU Beamformee B19: MU Beamformer B20:MU Beamformee*/
if (GET_VHT_CAPABILITY_ELE_SU_BFER(pIE->data))
SET_FLAG(cur_beamform_cap_infra_ap, BEAMFORMING_VHT_BEAMFORMER_ENABLE);
if (GET_VHT_CAPABILITY_ELE_SU_BFEE(pIE->data))
SET_FLAG(cur_beamform_cap_infra_ap, BEAMFORMING_VHT_BEAMFORMEE_ENABLE);
if (GET_VHT_CAPABILITY_ELE_MU_BFER(pIE->data))
SET_FLAG(cur_beamform_cap_infra_ap, BEAMFORMING_VHT_MU_MIMO_AP_ENABLE);
if (GET_VHT_CAPABILITY_ELE_MU_BFEE(pIE->data))
SET_FLAG(cur_beamform_cap_infra_ap, BEAMFORMING_VHT_MU_MIMO_STA_ENABLE);
pvhtpriv->beamform_cap_infra_ap = cur_beamform_cap_infra_ap;
/*store information about vht_mcs_set*/
pcap_mcs = GET_VHT_CAPABILITY_ELE_RX_MCS(pIE->data);
pcap_mcs_tx = GET_VHT_CAPABILITY_ELE_TX_MCS(pIE->data);
_rtw_memcpy(pvhtpriv->vht_mcs_map_infra_ap, pcap_mcs, 2);
_rtw_memcpy(pvhtpriv->vht_mcs_map_tx_infra_ap, pcap_mcs_tx, 2);
Rx_ss = VHT_get_ss_from_map(pvhtpriv->vht_mcs_map_infra_ap);
Tx_ss = VHT_get_ss_from_map(pvhtpriv->vht_mcs_map_tx_infra_ap);
if (Rx_ss >= Tx_ss) {
pvhtpriv->number_of_streams_infra_ap = Rx_ss;
} else{
pvhtpriv->number_of_streams_infra_ap = Tx_ss;
}
}
#endif /* ROKU_PRIVATE */
void VHT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
{
struct hal_spec_t *hal_spec = GET_HAL_SPEC(padapter);
@ -621,17 +690,21 @@ void rtw_process_vht_op_mode_notify(_adapter *padapter, u8 *pframe, PVOID sta)
struct sta_info *psta = (struct sta_info *)sta;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct registry_priv *regsty = adapter_to_regsty(padapter);
u8 target_bw;
u8 target_rxss, current_rxss;
u8 update_ra = _FALSE;
u8 tx_nss = 0, rf_type = RF_1T1R;
struct hal_spec_t *hal_spec = GET_HAL_SPEC(padapter);
if (pvhtpriv->vht_option == _FALSE)
return;
target_bw = GET_VHT_OPERATING_MODE_FIELD_CHNL_WIDTH(pframe);
target_rxss = (GET_VHT_OPERATING_MODE_FIELD_RX_NSS(pframe) + 1);
rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type));
tx_nss = rtw_min(rf_type_to_rf_tx_cnt(rf_type), hal_spec->tx_nss_num);
target_rxss = rtw_min(tx_nss, (GET_VHT_OPERATING_MODE_FIELD_RX_NSS(pframe) + 1));
if (target_bw != psta->cmn.bw_mode) {
if (hal_is_bw_support(padapter, target_bw)
@ -720,7 +793,7 @@ u32 rtw_build_vht_op_mode_notify_ie(_adapter *padapter, u8 *pbuf, u8 bw)
u32 rtw_build_vht_cap_ie(_adapter *padapter, u8 *pbuf)
{
u8 bw, rf_type, rf_num, rx_stbc_nss = 0;
u8 bw, rf_num, rx_stbc_nss = 0;
u16 HighestRate;
u8 *pcap, *pcap_mcs;
u32 len = 0;
@ -738,19 +811,19 @@ u32 rtw_build_vht_cap_ie(_adapter *padapter, u8 *pbuf)
rtw_hal_get_def_var(padapter, HAL_DEF_RX_PACKET_OFFSET, &rx_packet_offset);
rtw_hal_get_def_var(padapter, HAL_DEF_MAX_RECVBUF_SZ, &max_recvbuf_sz);
RTW_DBG("%s, line%d, Available RX buf size = %d bytes\n.", __FUNCTION__, __LINE__, max_recvbuf_sz - rx_packet_offset);
RTW_DBG("%s, line%d, Available RX buf size = %d bytes\n", __FUNCTION__, __LINE__, max_recvbuf_sz - rx_packet_offset);
if ((max_recvbuf_sz - rx_packet_offset) >= 11454) {
SET_VHT_CAPABILITY_ELE_MAX_MPDU_LENGTH(pcap, 2);
RTW_INFO("%s, line%d, Set MAX MPDU len = 11454 bytes\n.", __FUNCTION__, __LINE__);
RTW_INFO("%s, line%d, Set MAX MPDU len = 11454 bytes\n", __FUNCTION__, __LINE__);
} else if ((max_recvbuf_sz - rx_packet_offset) >= 7991) {
SET_VHT_CAPABILITY_ELE_MAX_MPDU_LENGTH(pcap, 1);
RTW_INFO("%s, line%d, Set MAX MPDU len = 7991 bytes\n.", __FUNCTION__, __LINE__);
RTW_INFO("%s, line%d, Set MAX MPDU len = 7991 bytes\n", __FUNCTION__, __LINE__);
} else if ((max_recvbuf_sz - rx_packet_offset) >= 3895) {
SET_VHT_CAPABILITY_ELE_MAX_MPDU_LENGTH(pcap, 0);
RTW_INFO("%s, line%d, Set MAX MPDU len = 3895 bytes\n.", __FUNCTION__, __LINE__);
RTW_INFO("%s, line%d, Set MAX MPDU len = 3895 bytes\n", __FUNCTION__, __LINE__);
} else
RTW_ERR("%s, line%d, Error!! Available RX buf size < 3895 bytes\n.", __FUNCTION__, __LINE__);
RTW_ERR("%s, line%d, Error!! Available RX buf size < 3895 bytes\n", __FUNCTION__, __LINE__);
/* B2 B3 Supported Channel Width Set */
if (hal_chk_bw_cap(padapter, BW_CAP_160M) && REGSTY_IS_BW_5G_SUPPORT(pregistrypriv, CHANNEL_WIDTH_160)) {
@ -811,10 +884,11 @@ u32 rtw_build_vht_cap_ie(_adapter *padapter, u8 *pbuf)
rtw_hal_get_def_var(padapter, HAL_DEF_BEAMFORMEE_CAP, (u8 *)&rf_num);
/* IOT action suggested by Yu Chen 2017/3/3 */
#ifdef CONFIG_80211AC_VHT
if ((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_BROADCOM) &&
!GET_VHT_CAPABILITY_ELE_MU_BFER(&pvhtpriv->beamform_cap))
!pvhtpriv->ap_is_mu_bfer)
rf_num = (rf_num >= 2 ? 2 : rf_num);
#endif
/* B13 14 15 Compressed Steering Number of Beamformer Antennas Supported */
SET_VHT_CAPABILITY_ELE_BFER_ANT_SUPP(pcap, rf_num);
/* B20 SU Beamformee Capable */
@ -859,6 +933,8 @@ u32 rtw_build_vht_cap_ie(_adapter *padapter, u8 *pbuf)
u32 rtw_restructure_vht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, uint in_len, uint *pout_len)
{
struct rf_ctl_t *rfctl = adapter_to_rfctl(padapter);
RT_CHANNEL_INFO *chset = rfctl->channel_set;
u32 ielen;
u8 max_bw;
u8 oper_ch, oper_bw = CHANNEL_WIDTH_20, oper_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
@ -920,7 +996,11 @@ u32 rtw_restructure_vht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, uint in_le
oper_bw = rtw_min(oper_bw, max_bw);
/* try downgrage bw to fit in channel plan setting */
while (!rtw_chset_is_chbw_valid(adapter_to_chset(padapter), oper_ch, oper_bw, oper_offset)) {
while (!rtw_chset_is_chbw_valid(chset, oper_ch, oper_bw, oper_offset)
|| (IS_DFS_SLAVE_WITH_RD(rfctl)
&& !rtw_odm_dfs_domain_unknown(rfctl_to_dvobj(rfctl))
&& rtw_chset_is_chbw_non_ocp(chset, oper_ch, oper_bw, oper_offset))
) {
oper_bw--;
if (oper_bw == CHANNEL_WIDTH_20) {
oper_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
@ -930,7 +1010,9 @@ u32 rtw_restructure_vht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, uint in_le
}
}
rtw_warn_on(!rtw_chset_is_chbw_valid(adapter_to_chset(padapter), oper_ch, oper_bw, oper_offset));
rtw_warn_on(!rtw_chset_is_chbw_valid(chset, oper_ch, oper_bw, oper_offset));
if (IS_DFS_SLAVE_WITH_RD(rfctl) && !rtw_odm_dfs_domain_unknown(rfctl_to_dvobj(rfctl)))
rtw_warn_on(rtw_chset_is_chbw_non_ocp(chset, oper_ch, oper_bw, oper_offset));
/* update VHT_OP_IE */
if (oper_bw < CHANNEL_WIDTH_80) {

View File

@ -1065,7 +1065,7 @@ void wapi_test_set_key(struct _adapter *padapter, u8 *buf)
void wapi_test_init(struct _adapter *padapter)
{
u8 keybuf[100];
u8 mac_addr[6] = {0x00, 0xe0, 0x4c, 0x72, 0x04, 0x70};
u8 mac_addr[ETH_ALEN] = {0x00, 0xe0, 0x4c, 0x72, 0x04, 0x70};
u8 UskDataKey[16] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
u8 UskMicKey[16] = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f};
u8 UskId = 0;
@ -1091,7 +1091,7 @@ void wapi_test_init(struct _adapter *padapter)
keybuf[2] = 1; /* AE */
keybuf[3] = 0; /* not update */
memcpy(keybuf + 4, mac_addr, 6);
memcpy(keybuf + 4, mac_addr, ETH_ALEN);
memcpy(keybuf + 10, UskDataKey, 16);
memcpy(keybuf + 26, UskMicKey, 16);
keybuf[42] = UskId;
@ -1103,7 +1103,7 @@ void wapi_test_init(struct _adapter *padapter)
keybuf[2] = 0; /* AE */
keybuf[3] = 0; /* not update */
memcpy(keybuf + 4, mac_addr, 6);
memcpy(keybuf + 4, mac_addr, ETH_ALEN);
memcpy(keybuf + 10, UskDataKey, 16);
memcpy(keybuf + 26, UskMicKey, 16);
keybuf[42] = UskId;
@ -1116,7 +1116,7 @@ void wapi_test_init(struct _adapter *padapter)
keybuf[1] = 1; /* Enable TX */
keybuf[2] = 1; /* AE */
keybuf[3] = 0; /* not update */
memcpy(keybuf + 4, mac_addr, 6);
memcpy(keybuf + 4, mac_addr, ETH_ALEN);
memcpy(keybuf + 10, MskDataKey, 16);
memcpy(keybuf + 26, MskMicKey, 16);
keybuf[42] = MskId;
@ -1127,7 +1127,7 @@ void wapi_test_init(struct _adapter *padapter)
keybuf[1] = 1; /* Enable TX */
keybuf[2] = 0; /* AE */
keybuf[3] = 0; /* not update */
memcpy(keybuf + 4, mac_addr, 6);
memcpy(keybuf + 4, mac_addr, ETH_ALEN);
memcpy(keybuf + 10, MskDataKey, 16);
memcpy(keybuf + 26, MskMicKey, 16);
keybuf[42] = MskId;

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,6 @@
#include <drv_types.h>
#include <hal_data.h>
#include <net/cfg80211.h>
#if defined(PLATFORM_LINUX) && defined (PLATFORM_WINDOWS)
#error "Shall be Linux or Windows, but not both!\n"
@ -472,7 +471,6 @@ void rtw_get_adapter_tx_rate_bmp_by_bw(_adapter *adapter, u8 bw, u16 *r_bmp_cck_
{
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj);
struct mlme_ext_priv *mlmeext = &adapter->mlmeextpriv;
u8 fix_bw = 0xFF;
u16 bmp_cck_ofdm = 0;
u32 bmp_ht = 0;
@ -505,7 +503,6 @@ void rtw_get_adapter_tx_rate_bmp_by_bw(_adapter *adapter, u8 bw, u16 *r_bmp_cck_
/* TODO: mlmeext->tx_rate*/
exit:
if (r_bmp_cck_ofdm)
*r_bmp_cck_ofdm = bmp_cck_ofdm;
if (r_bmp_ht)
@ -926,8 +923,7 @@ static void update_attrib_phy_info(_adapter *padapter, struct pkt_attrib *pattri
pattrib->triggered = 0;
pattrib->ampdu_spacing = 0;
/* qos_en, ht_en, init rate, ,bw, ch_offset, sgi */
pattrib->qos_en = psta->qos_option;
/* ht_en, init rate, ,bw, ch_offset, sgi */
pattrib->raid = psta->cmn.ra_info.rate_id;
@ -939,23 +935,26 @@ static void update_attrib_phy_info(_adapter *padapter, struct pkt_attrib *pattri
pattrib->stbc = psta->cmn.stbc_en;
#ifdef CONFIG_80211N_HT
pattrib->ht_en = psta->htpriv.ht_option;
pattrib->ch_offset = psta->htpriv.ch_offset;
pattrib->ampdu_en = _FALSE;
if(padapter->registrypriv.ht_enable &&
is_supported_ht(padapter->registrypriv.wireless_mode)) {
pattrib->ht_en = psta->htpriv.ht_option;
pattrib->ch_offset = psta->htpriv.ch_offset;
pattrib->ampdu_en = _FALSE;
if (padapter->driver_ampdu_spacing != 0xFF) /* driver control AMPDU Density for peer sta's rx */
pattrib->ampdu_spacing = padapter->driver_ampdu_spacing;
else
pattrib->ampdu_spacing = psta->htpriv.rx_ampdu_min_spacing;
if (padapter->driver_ampdu_spacing != 0xFF) /* driver control AMPDU Density for peer sta's rx */
pattrib->ampdu_spacing = padapter->driver_ampdu_spacing;
else
pattrib->ampdu_spacing = psta->htpriv.rx_ampdu_min_spacing;
/* check if enable ampdu */
if (pattrib->ht_en && psta->htpriv.ampdu_enable) {
if (psta->htpriv.agg_enable_bitmap & BIT(pattrib->priority)) {
pattrib->ampdu_en = _TRUE;
if (psta->htpriv.tx_amsdu_enable == _TRUE)
pattrib->amsdu_ampdu_en = _TRUE;
else
pattrib->amsdu_ampdu_en = _FALSE;
/* check if enable ampdu */
if (pattrib->ht_en && psta->htpriv.ampdu_enable) {
if (psta->htpriv.agg_enable_bitmap & BIT(pattrib->priority)) {
pattrib->ampdu_en = _TRUE;
if (psta->htpriv.tx_amsdu_enable == _TRUE)
pattrib->amsdu_ampdu_en = _TRUE;
else
pattrib->amsdu_ampdu_en = _FALSE;
}
}
}
#endif /* CONFIG_80211N_HT */
@ -971,10 +970,13 @@ static void update_attrib_phy_info(_adapter *padapter, struct pkt_attrib *pattri
pattrib->raid = psta->cmn.ra_info.rate_id;
#ifdef CONFIG_80211N_HT
pattrib->bwmode = rtw_get_tx_bw_mode(padapter, psta);
pattrib->ht_en = psta->htpriv.ht_option;
pattrib->ch_offset = psta->htpriv.ch_offset;
pattrib->sgi = query_ra_short_GI(psta, pattrib->bwmode);
if(padapter->registrypriv.ht_enable &&
is_supported_ht(padapter->registrypriv.wireless_mode)) {
pattrib->bwmode = rtw_get_tx_bw_mode(padapter, psta);
pattrib->ht_en = psta->htpriv.ht_option;
pattrib->ch_offset = psta->htpriv.ch_offset;
pattrib->sgi = query_ra_short_GI(psta, pattrib->bwmode);
}
#endif /* CONFIG_80211N_HT */
}
#endif /* CONFIG_TDLS */
@ -1186,6 +1188,15 @@ static void set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
UserPriority = 7;
}
*/
#ifdef CONFIG_ICMP_VOQ
if(pattrib->icmp_pkt==1)/*use VO queue to send icmp packet*/
UserPriority = 7;
#endif
#ifdef CONFIG_IP_R_MONITOR
if (pattrib->ether_type == ETH_P_ARP)
UserPriority = 7;
#endif/*CONFIG_IP_R_MONITOR*/
pattrib->priority = UserPriority;
pattrib->hdrlen = WLAN_HDR_A3_QOS_LEN;
pattrib->subtype = WIFI_QOS_DATA_TYPE;
@ -1247,6 +1258,8 @@ s32 update_tdls_attrib(_adapter *padapter, struct pkt_attrib *pattrib)
/* get ether_hdr_len */
pattrib->pkt_hdrlen = ETH_HLEN;
pattrib->qos_en = psta->qos_option;
/* [TDLS] TODO: setup req/rsp should be AC_BK */
if (pqospriv->qos_option && psta->qos_option) {
pattrib->priority = 4; /* tdls management frame should be AC_VI */
@ -1274,19 +1287,49 @@ exit:
#endif /* CONFIG_TDLS */
/*get non-qos hw_ssn control register,mapping to REG_HW_SEQ0,1,2,3*/
/*get non-qos hw_ssn control register,mapping to REG_HW_SEQ 0,1,2,3*/
inline u8 rtw_get_hwseq_no(_adapter *padapter)
{
u8 hwseq_num = 0;
#ifdef CONFIG_CONCURRENT_MODE
#if defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) || defined(CONFIG_RTL8822C)
hwseq_num = padapter->iface_id;
if (hwseq_num > 3)
hwseq_num = 3;
#else
if (!is_primary_adapter(padapter))
hwseq_num = 1;
/* else */
/* hwseq_num = 2; */
#endif
#endif /* CONFIG_CONCURRENT_MODE */
return hwseq_num;
}
#ifdef CONFIG_LPS
#define LPS_PT_NORMAL 0
#define LPS_PT_SP 1/* only DHCP packets is as SPECIAL_PACKET*/
#define LPS_PT_ICMP 2
/*If EAPOL , ARP , OR DHCP packet, driver must be in active mode.*/
static u8 _rtw_lps_chk_packet_type(struct pkt_attrib *pattrib)
{
u8 pkt_type = LPS_PT_NORMAL; /*normal data frame*/
#ifdef CONFIG_WAPI_SUPPORT
if ((pattrib->ether_type == 0x88B4) || (pattrib->ether_type == 0x0806) || (pattrib->ether_type == 0x888e) || (pattrib->dhcp_pkt == 1))
pkt_type = LPS_PT_SP;
#else /* !CONFIG_WAPI_SUPPORT */
#ifndef CONFIG_LPS_NOT_LEAVE_FOR_ICMP
if (pattrib->icmp_pkt == 1)
pkt_type = LPS_PT_ICMP;
else
#endif
if (pattrib->dhcp_pkt == 1)
pkt_type = LPS_PT_SP;
#endif
return pkt_type;
}
#endif
static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattrib)
{
uint i;
@ -1296,12 +1339,13 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr
sint bmcast;
struct sta_priv *pstapriv = &padapter->stapriv;
struct security_priv *psecuritypriv = &padapter->securitypriv;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct qos_priv *pqospriv = &pmlmepriv->qospriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
sint res = _SUCCESS;
#ifdef CONFIG_LPS
u8 pkt_type = 0;
#endif
DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib);
@ -1334,9 +1378,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);
}
get_sta_info:
bmcast = IS_MCAST(pattrib->ra);
if (bmcast) {
@ -1442,29 +1486,34 @@ get_sta_info:
}
} else if (0x888e == pattrib->ether_type)
RTW_PRINT("send eapol packet\n");
parsing_eapol_packet(padapter, pktfile.cur_addr, psta, 1);
#ifdef DBG_ARP_DUMP
else if (pattrib->ether_type == ETH_P_ARP) {
u8 arp[28] = {0};
_rtw_pktfile_read(&pktfile, arp, 28);
dump_arp_pkt(RTW_DBGDUMP, etherhdr.h_dest, etherhdr.h_source, arp, 1);
}
#endif
if ((pattrib->ether_type == 0x888e) || (pattrib->dhcp_pkt == 1))
rtw_mi_set_scan_deny(padapter, 3000);
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) &&
pattrib->ether_type == ETH_P_ARP &&
!IS_MCAST(pattrib->dst)) {
rtw_mi_set_scan_deny(padapter, 1000);
rtw_mi_scan_abort(padapter, _FALSE); /*rtw_scan_abort_no_wait*/
}
#ifdef CONFIG_LPS
/* If EAPOL , ARP , OR DHCP packet, driver must be in active mode. */
#ifdef CONFIG_WAPI_SUPPORT
if ((pattrib->ether_type == 0x88B4) || (pattrib->ether_type == 0x0806) || (pattrib->ether_type == 0x888e) || (pattrib->dhcp_pkt == 1))
#else /* !CONFIG_WAPI_SUPPORT */
#if 0
if ((pattrib->ether_type == 0x0806) || (pattrib->ether_type == 0x888e) || (pattrib->dhcp_pkt == 1))
#else /* only ICMP/DHCP packets is as SPECIAL_PACKET, and leave LPS when tx IMCP/DHCP packets. */
/* if ((pattrib->ether_type == 0x888e) || (pattrib->dhcp_pkt == 1) ) */
if (pattrib->icmp_pkt == 1)
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, 1);
else if (pattrib->dhcp_pkt == 1)
#endif
#endif
{
pkt_type = _rtw_lps_chk_packet_type(pattrib);
if (pkt_type == LPS_PT_SP) {/*packet is as SPECIAL_PACKET*/
DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_active);
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SPECIAL_PACKET, 1);
}
} else if (pkt_type == LPS_PT_ICMP)
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, 1);
#endif /* CONFIG_LPS */
#ifdef CONFIG_BEAMFORMING
@ -1478,26 +1527,14 @@ get_sta_info:
goto exit;
}
update_attrib_phy_info(padapter, pattrib, psta);
/* RTW_INFO("%s ==> mac_id(%d)\n",__FUNCTION__,pattrib->mac_id ); */
pattrib->psta = psta;
/* TODO:_unlock */
pattrib->pctrl = 0;
pattrib->ack_policy = 0;
/* get ether_hdr_len */
pattrib->pkt_hdrlen = ETH_HLEN;/* (pattrib->ether_type == 0x8100) ? (14 + 4 ): 14; */ /* vlan tag */
pattrib->hdrlen = WLAN_HDR_A3_LEN;
pattrib->subtype = WIFI_DATA_TYPE;
pattrib->qos_en = psta->qos_option;
pattrib->priority = 0;
if (bmcast)
pattrib->rate = psta->init_rate;
if (check_fwstate(pmlmepriv, WIFI_AP_STATE | WIFI_MESH_STATE
| WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE)
) {
@ -1524,6 +1561,21 @@ get_sta_info:
}
}
}
update_attrib_phy_info(padapter, pattrib, psta);
/* RTW_INFO("%s ==> mac_id(%d)\n",__FUNCTION__,pattrib->mac_id ); */
pattrib->psta = psta;
/* TODO:_unlock */
pattrib->pctrl = 0;
pattrib->ack_policy = 0;
if (bmcast)
pattrib->rate = psta->init_rate;
#ifdef CONFIG_WMMPS_STA
update_attrib_trigger_frame_info(padapter, pattrib);
@ -1545,7 +1597,6 @@ static s32 xmitframe_addmic(_adapter *padapter, struct xmit_frame *pxmitframe)
u8 *pframe, *payload, mic[8];
struct mic_data micdata;
/* struct sta_info *stainfo; */
struct qos_priv *pqospriv = &(padapter->mlmepriv.qospriv);
struct pkt_attrib *pattrib = &pxmitframe->attrib;
struct security_priv *psecuritypriv = &padapter->securitypriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
@ -1629,7 +1680,6 @@ static s32 xmitframe_addmic(_adapter *padapter, struct xmit_frame *pxmitframe)
}
/* if(pqospriv->qos_option==1) */
if (pattrib->qos_en)
priority[0] = (u8)pxmitframe->attrib.priority;
@ -2517,7 +2567,7 @@ s32 rtw_xmitframe_coalesce_amsdu(_adapter *padapter, struct xmit_frame *pxmitfra
xmitframe_swencrypt(padapter, pxmitframe);
pattrib->vcs_mode = NONE_VCS;
update_attrib_vcs_info(padapter, pxmitframe);
exit:
return res;
@ -3161,11 +3211,15 @@ void rtw_count_tx_stats(PADAPTER padapter, struct xmit_frame *pxmitframe, int sz
pstats->tx_pkts += pkt_num;
pstats->tx_bytes += sz;
#if defined(CONFIG_CHECK_LEAVE_LPS) && defined(CONFIG_LPS_CHK_BY_TP)
if (adapter_to_pwrctl(padapter)->lps_chk_by_tp)
traffic_check_for_leave_lps_by_tp(padapter, _TRUE, psta);
#endif /* CONFIG_LPS */
}
#ifdef CONFIG_CHECK_LEAVE_LPS
/* traffic_check_for_leave_lps(padapter, _TRUE); */
#endif /* CONFIG_LPS */
#endif /* CONFIG_CHECK_LEAVE_LPS */
}
}
@ -3202,9 +3256,6 @@ static struct xmit_buf *__rtw_alloc_cmd_xmitbuf(struct xmit_priv *pxmitpriv,
} else
RTW_INFO("%s fail, no xmitbuf available !!!\n", __func__);
exit:
return pxmitbuf;
}
@ -3735,10 +3786,6 @@ struct xmit_frame *rtw_get_xframe(struct xmit_priv *pxmitpriv, int *num_frame)
struct registry_priv *pregpriv = &padapter->registrypriv;
int i, inx[4];
#ifdef CONFIG_USB_HCI
/* int j, tmp, acirp_cnt[4]; */
#endif
inx[0] = 0;
inx[1] = 1;
inx[2] = 2;
@ -3793,10 +3840,6 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi
_adapter *padapter = pxmitpriv->adapter;
struct registry_priv *pregpriv = &padapter->registrypriv;
int i, inx[4];
#ifdef CONFIG_USB_HCI
/* int j, tmp, acirp_cnt[4]; */
#endif
inx[0] = 0;
inx[1] = 1;
@ -3804,7 +3847,7 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi
inx[3] = 3;
if (pregpriv->wifi_spec == 1) {
int j, tmp, acirp_cnt[4];
int j;
#if 0
if (flags < XMIT_QUEUE_ENTRY) {
/* priority exchange according to the completed xmitbuf flags. */
@ -3967,7 +4010,6 @@ s32 rtw_xmit_classifier(_adapter *padapter, struct xmit_frame *pxmitframe)
struct sta_info *psta;
struct tx_servq *ptxservq;
struct pkt_attrib *pattrib = &pxmitframe->attrib;
struct sta_priv *pstapriv = &padapter->stapriv;
struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
sint res = _SUCCESS;
@ -4115,7 +4157,6 @@ void rtw_init_hwxmits(struct hw_xmit *phwxmit, sint entry)
int rtw_br_client_tx(_adapter *padapter, struct sk_buff **pskb)
{
struct sk_buff *skb = *pskb;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
_irqL irqL;
/* if(check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) == _TRUE) */
{
@ -4380,9 +4421,10 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
u8 dummybuf[32];
int len = skb->len, rtap_len;
if (skb)
rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize);
rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize);
#ifndef CONFIG_CUSTOMER_ALIBABA_GENERAL
if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
goto fail;
@ -4401,7 +4443,7 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
}
_rtw_pktfile_read(&pktfile, dummybuf, rtap_len-sizeof(struct ieee80211_radiotap_header));
len = len - rtap_len;
#endif
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
if (pmgntframe == NULL) {
rtw_udelay_os(500);
@ -4441,7 +4483,6 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
dump_mgntframe(padapter, pmgntframe);
fail:
rtw_endofpktfile(&pktfile);
rtw_skb_free(skb);
return 0;
}
@ -4738,7 +4779,6 @@ sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *p
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
struct pkt_attrib *pattrib = &pxmitframe->attrib;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
sint bmcst = IS_MCAST(pattrib->ra);
bool update_tim = _FALSE;
#ifdef CONFIG_TDLS
@ -5259,7 +5299,9 @@ void xmit_delivery_enabled_frames(_adapter *padapter, struct sta_info *psta)
}
#ifdef CONFIG_TDLS
exit:
#endif
/* _exit_critical_bh(&psta->sleep_q.lock, &irqL); */
_exit_critical_bh(&pxmitpriv->lock, &irqL);
@ -5492,7 +5534,6 @@ bool rtw_xmit_ac_blocked(_adapter *adapter)
struct rf_ctl_t *rfctl = adapter_to_rfctl(adapter);
_adapter *iface;
struct mlme_ext_priv *mlmeext;
struct mlme_ext_info *mlmeextinfo;
bool blocked = _FALSE;
int i;
#ifdef DBG_CONFIG_ERROR_DETECT
@ -5506,8 +5547,14 @@ bool rtw_xmit_ac_blocked(_adapter *adapter)
#endif/* #ifdef DBG_CONFIG_ERROR_RESET */
#endif/* #ifdef DBG_CONFIG_ERROR_DETECT */
if (rfctl->offch_state != OFFCHS_NONE)
if (rfctl->offch_state != OFFCHS_NONE
#ifdef CONFIG_DFS
|| IS_RADAR_DETECTED(rfctl) || rfctl->csa_ch
#endif
) {
blocked = _TRUE;
goto exit;
}
for (i = 0; i < dvobj->iface_nums; i++) {
iface = dvobj->padapters[i];
@ -5703,8 +5750,6 @@ static u8 backup_idx[HW_QUEUE_ENTRY];
void rtw_tx_desc_backup(_adapter *padapter, struct xmit_frame *pxmitframe, u8 desc_size, u8 hwq)
{
u16 reg_rp;
u16 reg_wp;
u32 tmp32;
u8 *pxmit_buf;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,132 @@
//Install dhcp server
[root@localhost ~]#yum install dhcp
//We shoule copy /usr/share/doc/dhcp-4.2.0/dhcpd.conf.sample to /etc/dhcp/dhcpd.conf
//and modifiy /etc/dhcp/dhcpd.conf as the following
[root@localhost ~]#cat /etc/dhcp/dhcpd.conf
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#
# option definitions common to all supported networks...
option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;
# Use this to enble / disable dynamic dns updates globally.
#ddns-update-style none;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.
subnet 10.152.187.0 netmask 255.255.255.0 {
}
# This is a very basic subnet declaration.
subnet 10.254.239.0 netmask 255.255.255.224 {
range 10.254.239.10 10.254.239.20;
option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
}
# This declaration allows BOOTP clients to get dynamic addresses,
# which we don't really recommend.
subnet 10.254.239.32 netmask 255.255.255.224 {
range dynamic-bootp 10.254.239.40 10.254.239.60;
option broadcast-address 10.254.239.31;
option routers rtr-239-32-1.example.org;
}
# A slightly different configuration for an internal subnet.
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.30 192.168.1.150;
option domain-name-servers 192.168.1.254;
option domain-name "internal.org";
option routers 192.168.1.254;
option broadcast-address 192.168.1.255;
default-lease-time 6000;
max-lease-time 7200;
}
subnet 172.21.69.0 netmask 255.255.255.0 {
}
# Hosts which require special configuration options can be listed in
# host statements. If no address is specified, the address will be
# allocated dynamically (if possible), but the host-specific information
# will still come from the host declaration.
host passacaglia {
hardware ethernet 0:0:c0:5d:bd:95;
filename "vmunix.passacaglia";
server-name "toccata.fugue.com";
}
# Fixed IP addresses can also be specified for hosts. These addresses
# should not also be listed as being available for dynamic assignment.
# Hosts for which fixed IP addresses have been specified can boot using
# BOOTP or DHCP. Hosts for which no fixed address is specified can only
# be booted with DHCP, unless there is an address range on the subnet
# to which a BOOTP client is connected which has the dynamic-bootp flag
# set.
host fantasia {
hardware ethernet 08:00:07:26:c0:a5;
fixed-address fantasia.fugue.com;
}
# You can declare a class of clients and then do address allocation
# based on that. The example below shows a case where all clients
# in a certain class get addresses on the 10.17.224/24 subnet, and all
# other clients get addresses on the 10.0.29/24 subnet.
class "foo" {
match if substring (option vendor-class-identifier, 0, 4) = "SUNW";
}
shared-network 224-29 {
subnet 10.17.224.0 netmask 255.255.255.0 {
option routers rtr-224.example.org;
}
subnet 10.0.29.0 netmask 255.255.255.0 {
option routers rtr-29.example.org;
}
pool {
allow members of "foo";
range 10.17.224.10 10.17.224.250;
}
pool {
deny members of "foo";
range 10.0.29.10 10.0.29.230;
}
}
[root@localhost ~]#
//Depends on the above setting, wlan interface IP would be 192.168.1.254
[root@localhost ~]#ifconfig wlan14 192.168.1.254
//Set only one interface as dhcp server
[root@localhost ~]#cat /etc/sysconfig/dhcpd
# Command line options here
DHCPDARGS=wlan0
//If /var/lib/dhcpd/dhcpd.leases doesn't exist,
//we should establish it
//This file is used to record clients information.
[root@localhost ~]#touch /var/lib/dhcpd/dhcpd.leases
//Execute
[root@localhost ~]#/etc/rc.d/init.d/dhcpd start

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,240 +0,0 @@
/******************************************************************************
*
* Copyright(c) 2016 - 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.
*
*****************************************************************************/
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
#if (RTL8192E_SUPPORT == 1)
/* *******************************************
* The following is for 8192E 1ANT BT Co-exist definition
* ******************************************* */
#define BT_AUTO_REPORT_ONLY_8192E_1ANT 1
#define BT_INFO_8192E_1ANT_B_FTP BIT(7)
#define BT_INFO_8192E_1ANT_B_A2DP BIT(6)
#define BT_INFO_8192E_1ANT_B_HID BIT(5)
#define BT_INFO_8192E_1ANT_B_SCO_BUSY BIT(4)
#define BT_INFO_8192E_1ANT_B_ACL_BUSY BIT(3)
#define BT_INFO_8192E_1ANT_B_INQ_PAGE BIT(2)
#define BT_INFO_8192E_1ANT_B_SCO_ESCO BIT(1)
#define BT_INFO_8192E_1ANT_B_CONNECTION BIT(0)
#define BT_INFO_8192E_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
#define BTC_RSSI_COEX_THRESH_TOL_8192E_1ANT 2
#define BT_8192E_1ANT_WIFI_NOISY_THRESH 30 /* max: 255 */
enum bt_info_src_8192e_1ant {
BT_INFO_SRC_8192E_1ANT_WIFI_FW = 0x0,
BT_INFO_SRC_8192E_1ANT_BT_RSP = 0x1,
BT_INFO_SRC_8192E_1ANT_BT_ACTIVE_SEND = 0x2,
BT_INFO_SRC_8192E_1ANT_MAX
};
enum bt_8192e_1ant_bt_status {
BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
BT_8192E_1ANT_BT_STATUS_INQ_PAGE = 0x2,
BT_8192E_1ANT_BT_STATUS_ACL_BUSY = 0x3,
BT_8192E_1ANT_BT_STATUS_SCO_BUSY = 0x4,
BT_8192E_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
BT_8192E_1ANT_BT_STATUS_MAX
};
enum bt_8192e_1ant_wifi_status {
BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SPECIFIC_PKT = 0x3,
BT_8192E_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
BT_8192E_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
BT_8192E_1ANT_WIFI_STATUS_MAX
};
enum bt_8192e_1ant_coex_algo {
BT_8192E_1ANT_COEX_ALGO_UNDEFINED = 0x0,
BT_8192E_1ANT_COEX_ALGO_SCO = 0x1,
BT_8192E_1ANT_COEX_ALGO_HID = 0x2,
BT_8192E_1ANT_COEX_ALGO_A2DP = 0x3,
BT_8192E_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
BT_8192E_1ANT_COEX_ALGO_PANEDR = 0x5,
BT_8192E_1ANT_COEX_ALGO_PANHS = 0x6,
BT_8192E_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
BT_8192E_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
BT_8192E_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
BT_8192E_1ANT_COEX_ALGO_HID_A2DP = 0xa,
BT_8192E_1ANT_COEX_ALGO_MAX = 0xb,
};
struct coex_dm_8192e_1ant {
/* fw mechanism */
boolean cur_ignore_wlan_act;
boolean pre_ignore_wlan_act;
u8 pre_ps_tdma;
u8 cur_ps_tdma;
u8 ps_tdma_para[5];
u8 ps_tdma_du_adj_type;
boolean auto_tdma_adjust;
boolean pre_ps_tdma_on;
boolean cur_ps_tdma_on;
boolean pre_bt_auto_report;
boolean cur_bt_auto_report;
u8 pre_lps;
u8 cur_lps;
u8 pre_rpwm;
u8 cur_rpwm;
/* sw mechanism */
boolean pre_low_penalty_ra;
boolean cur_low_penalty_ra;
u32 pre_val0x6c0;
u32 cur_val0x6c0;
u32 pre_val0x6c4;
u32 cur_val0x6c4;
u32 pre_val0x6c8;
u32 cur_val0x6c8;
u8 pre_val0x6cc;
u8 cur_val0x6cc;
boolean limited_dig;
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
u16 backup_retry_limit;
u8 backup_ampdu_max_time;
/* algorithm related */
u8 pre_algorithm;
u8 cur_algorithm;
u8 bt_status;
u8 wifi_chnl_info[3];
u32 pre_ra_mask;
u32 cur_ra_mask;
u8 pre_arfr_type;
u8 cur_arfr_type;
u8 pre_retry_limit_type;
u8 cur_retry_limit_type;
u8 pre_ampdu_time_type;
u8 cur_ampdu_time_type;
u32 arp_cnt;
u8 error_condition;
};
struct coex_sta_8192e_1ant {
boolean bt_disabled;
boolean bt_link_exist;
boolean sco_exist;
boolean a2dp_exist;
boolean hid_exist;
boolean pan_exist;
boolean under_lps;
boolean under_ips;
u32 specific_pkt_period_cnt;
u32 high_priority_tx;
u32 high_priority_rx;
u32 low_priority_tx;
u32 low_priority_rx;
s8 bt_rssi;
boolean bt_tx_rx_mask;
u8 pre_bt_rssi_state;
u8 pre_wifi_rssi_state[4];
boolean c2h_bt_info_req_sent;
u8 bt_info_c2h[BT_INFO_SRC_8192E_1ANT_MAX][10];
u32 bt_info_c2h_cnt[BT_INFO_SRC_8192E_1ANT_MAX];
boolean c2h_bt_inquiry_page;
boolean c2h_bt_page; /* Add for win8.1 page out issue */
boolean wifi_is_high_pri_task; /* Add for win8.1 page out issue */
u8 bt_retry_cnt;
u8 bt_info_ext;
u32 pop_event_cnt;
u8 scan_ap_num;
u32 crc_ok_cck;
u32 crc_ok_11g;
u32 crc_ok_11n;
u32 crc_ok_11n_agg;
u32 crc_err_cck;
u32 crc_err_11g;
u32 crc_err_11n;
u32 crc_err_11n_agg;
boolean cck_lock;
boolean pre_ccklock;
u8 coex_table_type;
boolean force_lps_on;
};
/* *******************************************
* The following is interface which will notify coex module.
* ******************************************* */
void ex_halbtc8192e1ant_power_on_setting(IN struct btc_coexist *btcoexist);
void ex_halbtc8192e1ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
void ex_halbtc8192e1ant_init_hw_config(IN struct btc_coexist *btcoexist,
IN boolean wifi_only);
void ex_halbtc8192e1ant_init_coex_dm(IN struct btc_coexist *btcoexist);
void ex_halbtc8192e1ant_ips_notify(IN struct btc_coexist *btcoexist,
IN u8 type);
void ex_halbtc8192e1ant_lps_notify(IN struct btc_coexist *btcoexist,
IN u8 type);
void ex_halbtc8192e1ant_scan_notify(IN struct btc_coexist *btcoexist,
IN u8 type);
void ex_halbtc8192e1ant_connect_notify(IN struct btc_coexist *btcoexist,
IN u8 type);
void ex_halbtc8192e1ant_media_status_notify(IN struct btc_coexist *btcoexist,
IN u8 type);
void ex_halbtc8192e1ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
IN u8 type);
void ex_halbtc8192e1ant_bt_info_notify(IN struct btc_coexist *btcoexist,
IN u8 *tmp_buf, IN u8 length);
void ex_halbtc8192e1ant_rf_status_notify(IN struct btc_coexist *btcoexist,
IN u8 type);
void ex_halbtc8192e1ant_halt_notify(IN struct btc_coexist *btcoexist);
void ex_halbtc8192e1ant_pnp_notify(IN struct btc_coexist *btcoexist,
IN u8 pnp_state);
void ex_halbtc8192e1ant_coex_dm_reset(IN struct btc_coexist *btcoexist);
void ex_halbtc8192e1ant_periodical(IN struct btc_coexist *btcoexist);
void ex_halbtc8192e1ant_display_coex_info(IN struct btc_coexist *btcoexist);
void ex_halbtc8192e1ant_dbg_control(IN struct btc_coexist *btcoexist,
IN u8 op_code, IN u8 op_len, IN u8 *pdata);
#else /* #if (RTL8192E_SUPPORT == 1) */
#define ex_halbtc8192e1ant_power_on_setting(btcoexist)
#define ex_halbtc8192e1ant_pre_load_firmware(btcoexist)
#define ex_halbtc8192e1ant_init_hw_config(btcoexist, wifi_only)
#define ex_halbtc8192e1ant_init_coex_dm(btcoexist)
#define ex_halbtc8192e1ant_ips_notify(btcoexist, type)
#define ex_halbtc8192e1ant_lps_notify(btcoexist, type)
#define ex_halbtc8192e1ant_scan_notify(btcoexist, type)
#define ex_halbtc8192e1ant_connect_notify(btcoexist, type)
#define ex_halbtc8192e1ant_media_status_notify(btcoexist, type)
#define ex_halbtc8192e1ant_specific_packet_notify(btcoexist, type)
#define ex_halbtc8192e1ant_bt_info_notify(btcoexist, tmp_buf, length)
#define ex_halbtc8192e1ant_rf_status_notify(btcoexist, type)
#define ex_halbtc8192e1ant_halt_notify(btcoexist)
#define ex_halbtc8192e1ant_pnp_notify(btcoexist, pnp_state)
#define ex_halbtc8192e1ant_coex_dm_reset(btcoexist)
#define ex_halbtc8192e1ant_periodical(btcoexist)
#define ex_halbtc8192e1ant_display_coex_info(btcoexist)
#define ex_halbtc8192e1ant_dbg_control(btcoexist, op_code, op_len, pdata)
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,230 +0,0 @@
/******************************************************************************
*
* Copyright(c) 2016 - 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.
*
*****************************************************************************/
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
#if (RTL8192E_SUPPORT == 1)
/* *******************************************
* The following is for 8192E 2Ant BT Co-exist definition
* ******************************************* */
#define BT_AUTO_REPORT_ONLY_8192E_2ANT 0
#define BT_INFO_8192E_2ANT_B_FTP BIT(7)
#define BT_INFO_8192E_2ANT_B_A2DP BIT(6)
#define BT_INFO_8192E_2ANT_B_HID BIT(5)
#define BT_INFO_8192E_2ANT_B_SCO_BUSY BIT(4)
#define BT_INFO_8192E_2ANT_B_ACL_BUSY BIT(3)
#define BT_INFO_8192E_2ANT_B_INQ_PAGE BIT(2)
#define BT_INFO_8192E_2ANT_B_SCO_ESCO BIT(1)
#define BT_INFO_8192E_2ANT_B_CONNECTION BIT(0)
#define BTC_RSSI_COEX_THRESH_TOL_8192E_2ANT 2
#define NOISY_AP_NUM_THRESH_8192E 10
enum bt_info_src_8192e_2ant {
BT_INFO_SRC_8192E_2ANT_WIFI_FW = 0x0,
BT_INFO_SRC_8192E_2ANT_BT_RSP = 0x1,
BT_INFO_SRC_8192E_2ANT_BT_ACTIVE_SEND = 0x2,
BT_INFO_SRC_8192E_2ANT_MAX
};
enum bt_8192e_2ant_bt_status {
BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
BT_8192E_2ANT_BT_STATUS_INQ_PAGE = 0x2,
BT_8192E_2ANT_BT_STATUS_ACL_BUSY = 0x3,
BT_8192E_2ANT_BT_STATUS_SCO_BUSY = 0x4,
BT_8192E_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
BT_8192E_2ANT_BT_STATUS_MAX
};
enum bt_8192e_2ant_coex_algo {
BT_8192E_2ANT_COEX_ALGO_UNDEFINED = 0x0,
BT_8192E_2ANT_COEX_ALGO_SCO = 0x1,
BT_8192E_2ANT_COEX_ALGO_SCO_PAN = 0x2,
BT_8192E_2ANT_COEX_ALGO_HID = 0x3,
BT_8192E_2ANT_COEX_ALGO_A2DP = 0x4,
BT_8192E_2ANT_COEX_ALGO_A2DP_PANHS = 0x5,
BT_8192E_2ANT_COEX_ALGO_PANEDR = 0x6,
BT_8192E_2ANT_COEX_ALGO_PANHS = 0x7,
BT_8192E_2ANT_COEX_ALGO_PANEDR_A2DP = 0x8,
BT_8192E_2ANT_COEX_ALGO_PANEDR_HID = 0x9,
BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0xa,
BT_8192E_2ANT_COEX_ALGO_HID_A2DP = 0xb,
BT_8192E_2ANT_COEX_ALGO_MAX = 0xc
};
struct coex_dm_8192e_2ant {
/* fw mechanism */
u8 pre_bt_dec_pwr_lvl;
u8 cur_bt_dec_pwr_lvl;
u8 pre_fw_dac_swing_lvl;
u8 cur_fw_dac_swing_lvl;
boolean cur_ignore_wlan_act;
boolean pre_ignore_wlan_act;
u8 pre_ps_tdma;
u8 cur_ps_tdma;
u8 ps_tdma_para[5];
u8 ps_tdma_du_adj_type;
boolean reset_tdma_adjust;
boolean auto_tdma_adjust;
boolean auto_tdma_adjust_low_rssi;
boolean pre_ps_tdma_on;
boolean cur_ps_tdma_on;
boolean pre_bt_auto_report;
boolean cur_bt_auto_report;
/* sw mechanism */
boolean pre_rf_rx_lpf_shrink;
boolean cur_rf_rx_lpf_shrink;
u32 bt_rf_0x1e_backup;
boolean pre_low_penalty_ra;
boolean cur_low_penalty_ra;
boolean pre_dac_swing_on;
u32 pre_dac_swing_lvl;
boolean cur_dac_swing_on;
u32 cur_dac_swing_lvl;
boolean pre_adc_back_off;
boolean cur_adc_back_off;
boolean pre_agc_table_en;
boolean cur_agc_table_en;
u32 pre_val0x6c0;
u32 cur_val0x6c0;
u32 pre_val0x6c4;
u32 cur_val0x6c4;
u32 pre_val0x6c8;
u32 cur_val0x6c8;
u8 pre_val0x6cc;
u8 cur_val0x6cc;
boolean limited_dig;
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
u16 backup_retry_limit;
u8 backup_ampdu_max_time;
/* algorithm related */
u8 pre_algorithm;
u8 cur_algorithm;
u8 bt_status;
u8 wifi_chnl_info[3];
u8 pre_ss_type;
u8 cur_ss_type;
u8 pre_lps;
u8 cur_lps;
u8 pre_rpwm;
u8 cur_rpwm;
u32 pre_ra_mask;
u32 cur_ra_mask;
u8 cur_ra_mask_type;
u8 pre_arfr_type;
u8 cur_arfr_type;
u8 pre_retry_limit_type;
u8 cur_retry_limit_type;
u8 pre_ampdu_time_type;
u8 cur_ampdu_time_type;
};
struct coex_sta_8192e_2ant {
boolean bt_disabled;
boolean bt_link_exist;
boolean sco_exist;
boolean a2dp_exist;
boolean hid_exist;
boolean pan_exist;
boolean force_lps_on;
boolean under_lps;
boolean under_ips;
u32 high_priority_tx;
u32 high_priority_rx;
u32 low_priority_tx;
u32 low_priority_rx;
u8 bt_rssi;
u8 pre_bt_rssi_state;
u8 pre_wifi_rssi_state[4];
boolean c2h_bt_info_req_sent;
u8 bt_info_c2h[BT_INFO_SRC_8192E_2ANT_MAX][10];
u32 bt_info_c2h_cnt[BT_INFO_SRC_8192E_2ANT_MAX];
boolean c2h_bt_inquiry_page;
u8 bt_retry_cnt;
u8 bt_info_ext;
u8 scan_ap_num;
u32 bt_coex_supported_version;
u32 cnt_setup_link;
u32 cnt_wifi_high_pri;
boolean is_setup_link;
boolean wifi_is_high_pri_task;
u32 crc_ok_cck;
u32 crc_ok_11g;
u32 crc_ok_11n;
u32 crc_ok_11n_vht;
u32 crc_err_cck;
u32 crc_err_11g;
u32 crc_err_11n;
u32 crc_err_11n_vht;
};
/* *******************************************
* The following is interface which will notify coex module.
* ******************************************* */
void ex_halbtc8192e2ant_power_on_setting(IN struct btc_coexist *btcoexist);
void ex_halbtc8192e2ant_init_hw_config(IN struct btc_coexist *btcoexist,
IN boolean wifi_only);
void ex_halbtc8192e2ant_init_coex_dm(IN struct btc_coexist *btcoexist);
void ex_halbtc8192e2ant_ips_notify(IN struct btc_coexist *btcoexist,
IN u8 type);
void ex_halbtc8192e2ant_lps_notify(IN struct btc_coexist *btcoexist,
IN u8 type);
void ex_halbtc8192e2ant_scan_notify(IN struct btc_coexist *btcoexist,
IN u8 type);
void ex_halbtc8192e2ant_connect_notify(IN struct btc_coexist *btcoexist,
IN u8 type);
void ex_halbtc8192e2ant_media_status_notify(IN struct btc_coexist *btcoexist,
IN u8 type);
void ex_halbtc8192e2ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
IN u8 type);
void ex_halbtc8192e2ant_bt_info_notify(IN struct btc_coexist *btcoexist,
IN u8 *tmp_buf, IN u8 length);
void ex_halbtc8192e2ant_halt_notify(IN struct btc_coexist *btcoexist);
void ex_halbtc8192e2ant_periodical(IN struct btc_coexist *btcoexist);
void ex_halbtc8192e2ant_display_coex_info(IN struct btc_coexist *btcoexist);
#else /* #if (RTL8192E_SUPPORT == 1) */
#define ex_halbtc8192e2ant_power_on_setting(btcoexist)
#define ex_halbtc8192e2ant_init_hw_config(btcoexist, wifi_only)
#define ex_halbtc8192e2ant_init_coex_dm(btcoexist)
#define ex_halbtc8192e2ant_ips_notify(btcoexist, type)
#define ex_halbtc8192e2ant_lps_notify(btcoexist, type)
#define ex_halbtc8192e2ant_scan_notify(btcoexist, type)
#define ex_halbtc8192e2ant_connect_notify(btcoexist, type)
#define ex_halbtc8192e2ant_media_status_notify(btcoexist, type)
#define ex_halbtc8192e2ant_specific_packet_notify(btcoexist, type)
#define ex_halbtc8192e2ant_bt_info_notify(btcoexist, tmp_buf, length)
#define ex_halbtc8192e2ant_halt_notify(btcoexist)
#define ex_halbtc8192e2ant_periodical(btcoexist)
#define ex_halbtc8192e2ant_display_coex_info(btcoexist)
#endif
#endif

File diff suppressed because it is too large Load Diff

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