mirror of
https://github.com/chinawrj/rtl8812au
synced 2024-11-09 23:57:10 +00:00
commit
8edb9b8460
16
Makefile
16
Makefile
@ -196,17 +196,11 @@ ifeq ($(CONFIG_PCI_HCI), y)
|
||||
HCI_NAME = pci
|
||||
endif
|
||||
|
||||
#ifeq ($(RTL8814), 1)
|
||||
#CONFIG_RTL8812A = n
|
||||
#CONFIG_RTL8821A = n
|
||||
#CONFIG_RTL8814A = y
|
||||
#endif
|
||||
|
||||
#ifeq ($(RTL8821), 1)
|
||||
#CONFIG_RTL8812A = y
|
||||
#CONFIG_RTL8821A = y
|
||||
#CONFIG_RTL8814A = n
|
||||
#endif
|
||||
ifeq ($(RTL8814), 1)
|
||||
CONFIG_RTL8812A = y
|
||||
CONFIG_RTL8821A = y
|
||||
CONFIG_RTL8814A = y
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_USB2_EXTERNAL_POWER), y)
|
||||
EXTRA_CFLAGS += -DCONFIG_USE_EXTERNAL_POWER
|
||||
|
127
README.md
127
README.md
@ -1,30 +1,37 @@
|
||||
# rtl8812au
|
||||
# RTL8812AU/21AU and RTL8814AU drivers
|
||||
# with monitor mode and frame injection
|
||||
|
||||
## Realtek 8812AU driver v5.2.20.2 with monitor mode and frame injection
|
||||
|
||||
This driver supports 8812au & 8821au chipsets, not the 8814au chipset at this moment.
|
||||
|
||||
### Building / Installing
|
||||
|
||||
To build and install module manually:
|
||||
## DKMS
|
||||
This driver can be installed using [DKMS]. This is a system which will automatically recompile and install a kernel module when a new kernel gets installed or updated. To make use of DKMS, install the `dkms` package, which on Debian (based) systems is done like this:
|
||||
```
|
||||
$ sudo make
|
||||
$ sudo make install
|
||||
sudo apt install dkms
|
||||
```
|
||||
|
||||
To use DKMS install:
|
||||
|
||||
## Installation of Driver
|
||||
In order to install the driver open a terminal in the directory with the source code and execute the following command:
|
||||
```
|
||||
$ sudo ./dkms-install.sh
|
||||
sudo ./dkms-install.sh
|
||||
```
|
||||
|
||||
To use DKMS uninstall and remove:
|
||||
|
||||
## Removal of Driver
|
||||
In order to remove the driver from your system open a terminal in the directory with the source code and execute the following command:
|
||||
```
|
||||
$ sudo ./dkms-remove.sh
|
||||
sudo ./dkms-remove.sh
|
||||
```
|
||||
|
||||
### Notes
|
||||
## Make
|
||||
For building & installing the rtl8812au/rtl8821au driver with 'make' use
|
||||
```
|
||||
make
|
||||
make install
|
||||
```
|
||||
and for building & installing the rtl8814au driver with 'make' use
|
||||
```
|
||||
make RTL8814=1
|
||||
make install RTL8814=1
|
||||
```
|
||||
|
||||
## Notes
|
||||
Download
|
||||
```
|
||||
git clone -b v5.2.20 https://github.com/aircrack-ng/rtl8812au.git
|
||||
@ -35,72 +42,45 @@ Package / Build dependencies (Kali)
|
||||
sudo apt-get install build-essential
|
||||
sudo apt-get install bc
|
||||
sudo apt-get install libelf-dev
|
||||
sudo apt-get install dkms
|
||||
sudo apt-get install linux-headers-`uname -r`
|
||||
```
|
||||
Building for Raspberry (RPI) also needs
|
||||
For Raspberry (RPI)
|
||||
```
|
||||
sudo apt install raspberrypi-kernel-headers
|
||||
```
|
||||
|
||||
### For setting monitor mode
|
||||
1. Fix problematic interference in monitor mode.
|
||||
For setting monitor mode
|
||||
1. Fix problematic interference in monitor mode.
|
||||
```
|
||||
airmon-ng check kill
|
||||
```
|
||||
You may also uncheck the box "Automatically connect to this network when it is avaiable" in nm-connection-editor. This only works if you have a saved wifi connection.
|
||||
|
||||
2. Set interface down
|
||||
```
|
||||
sudo ip link set wlan0 down
|
||||
```
|
||||
3. Set monitor mode
|
||||
```
|
||||
sudo iw dev wlan0 set type monitor
|
||||
```
|
||||
4. Set interface up
|
||||
```
|
||||
sudo ip link set wlan0 up
|
||||
```
|
||||
For setting TX power
|
||||
```
|
||||
airmon-ng check kill
|
||||
```
|
||||
You may also uncheck the box "Automatically connect to this network when it is avaiable" in nm-connection-editor. This only works if you have a saved wifi connection.
|
||||
|
||||
2. Set interface down
|
||||
```
|
||||
sudo ip link set wlan0 down
|
||||
```
|
||||
3. Set monitor mode
|
||||
```
|
||||
sudo iw dev wlan0 set type monitor
|
||||
```
|
||||
4. Set interface up
|
||||
```
|
||||
sudo ip link set wlan0 up
|
||||
sudo iw wlan0 set txpower fixed 3000
|
||||
```
|
||||
|
||||
### TX Power Control
|
||||
|
||||
The txpower may be adjusted with these commands
|
||||
```
|
||||
ifconfig <adapter> down
|
||||
iwconfig <adapter> txpower 30
|
||||
## LED Parameter
|
||||
```
|
||||
We've added the "realtek-leds.conf" in build directory,
|
||||
with this you may change the leds to
|
||||
"2: Allways On", "1: Normal" or "0: Allways Off" with placing the file in "/etc/modprobe.d/
|
||||
|
||||
### LED control
|
||||
|
||||
#### You can now control LED behaviour statically by Makefile, for example:
|
||||
|
||||
```sh
|
||||
CONFIG_LED_ENABLE = n
|
||||
```
|
||||
value can be y or n
|
||||
|
||||
#### statically by module parameter in /etc/modprobe.d/8812au.conf or wherever, for example:
|
||||
|
||||
```sh
|
||||
options 8812au rtw_led_enable=0
|
||||
```
|
||||
value can be 0 or 1
|
||||
|
||||
#### or dynamically by writing to /proc/net/rtl8812au/$(your interface name)/led_enable, for example:
|
||||
|
||||
```sh
|
||||
$ echo "0" > /proc/net/rtl8812au/$(your interface name)/led_enable
|
||||
```
|
||||
value can be 0 or 1
|
||||
|
||||
#### check current value:
|
||||
|
||||
```sh
|
||||
$ cat /proc/net/rtl8812au/$(your interface name)/led_enable
|
||||
```
|
||||
|
||||
### NetworkManager
|
||||
Manual modprobe will override this file if option value also included at the command line, e.g.,
|
||||
$ sudo modprobe -r 8812au
|
||||
$ sudo modprobe 8812au rtw_led_ctrl=1
|
||||
|
||||
Newer versions of NetworkManager switches to random MAC address. Some users would prefer to use a fixed address.
|
||||
Simply add these lines below
|
||||
@ -111,3 +91,4 @@ wifi.scan-rand-mac-address=no
|
||||
at the end of file /etc/NetworkManager/NetworkManager.conf and restart NetworkManager with the command:
|
||||
```
|
||||
sudo service NetworkManager restart
|
||||
```
|
||||
|
11
dkms.conf
11
dkms.conf
@ -1,10 +1,11 @@
|
||||
PACKAGE_NAME="realtek-rtl88xxau"
|
||||
PACKAGE_VERSION="5.2.20.2~20180717"
|
||||
BUILT_MODULE_NAME[0]="8812au"
|
||||
PACKAGE_VERSION="5.2.20.2~20180804"
|
||||
CLEAN="make clean"
|
||||
BUILT_MODULE_NAME[0]=8812au
|
||||
PROCS_NUM=`nproc`
|
||||
[ $PROCS_NUM -gt 16 ] && PROCS_NUM=16
|
||||
MAKE="'make' -j$PROCS_NUM KVER=${kernelver} KSRC=/lib/modules/${kernelver}/build"
|
||||
CLEAN="'make' clean"
|
||||
DEST_MODULE_LOCATION[0]="/updates"
|
||||
MAKE[0]="'make' -j$PROCS_NUM KVER=${kernelver} && 'make' -j$PROCS_NUM RTL8814=1 KVER=${kernelver}"
|
||||
BUILT_MODULE_NAME[1]=8814au
|
||||
DEST_MODULE_LOCATION[1]="/updates"
|
||||
AUTOINSTALL="yes"
|
||||
REMAKE_INITRD=no
|
||||
|
@ -28,7 +28,8 @@ rtw_led_control(
|
||||
{
|
||||
do
|
||||
{
|
||||
(adapter)->ledpriv.LedControlHandler((adapter), (LedAction));
|
||||
if((adapter)->ledpriv.LedControlHandler)
|
||||
(adapter)->ledpriv.LedControlHandler((adapter), (LedAction));
|
||||
}
|
||||
while(0);
|
||||
}
|
||||
|
@ -325,13 +325,13 @@ hal_com_txbf_rate_work_item_callback(
|
||||
|
||||
PHYDM_DBG(p_dm, DBG_TXBF, ("[%s] Start!\n", __func__));
|
||||
|
||||
if (p_dm->support_ic_type & ODM_RTL8812)
|
||||
if (p_dm->support_ic_type & ODM_RTL8812) {
|
||||
hal_txbf_8812a_set_ndpa_rate(p_dm, BW, rate);
|
||||
else if (p_dm->support_ic_type & ODM_RTL8192E)
|
||||
} else if (p_dm->support_ic_type & ODM_RTL8192E) {
|
||||
hal_txbf_8192e_set_ndpa_rate(p_dm, BW, rate);
|
||||
else if (p_dm->support_ic_type & ODM_RTL8814A)
|
||||
} else if (p_dm->support_ic_type & ODM_RTL8814A) {
|
||||
hal_txbf_8814a_set_ndpa_rate(p_dm, BW, rate);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -410,9 +410,9 @@ hal_com_txbf_reset_tx_path_work_item_callback(
|
||||
|
||||
u8 idx = p_txbf_info->txbf_idx;
|
||||
|
||||
if (p_dm->support_ic_type & ODM_RTL8814A)
|
||||
if (p_dm->support_ic_type & ODM_RTL8814A) {
|
||||
hal_txbf_8814a_reset_tx_path(p_dm, idx);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -431,8 +431,9 @@ hal_com_txbf_get_tx_rate_work_item_callback(
|
||||
struct PHY_DM_STRUCT *p_dm = (struct PHY_DM_STRUCT *)p_dm_void;
|
||||
#endif
|
||||
|
||||
if (p_dm->support_ic_type & ODM_RTL8814A)
|
||||
if (p_dm->support_ic_type & ODM_RTL8814A) {
|
||||
hal_txbf_8814a_get_tx_rate(p_dm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -344,7 +344,7 @@ void rtl8812_init_dm_priv(IN PADAPTER Adapter)
|
||||
|
||||
Init_ODM_ComInfo_8812(Adapter);
|
||||
odm_init_all_timers(podmpriv);
|
||||
pHalData->CurrentTxPwrIdx = 13;
|
||||
pHalData->CurrentTxPwrIdx = 18;
|
||||
}
|
||||
|
||||
void rtl8812_deinit_dm_priv(IN PADAPTER Adapter)
|
||||
|
@ -5891,7 +5891,7 @@ u8 GetHalDefVar8812A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval)
|
||||
break;
|
||||
|
||||
case HAL_DEF_RX_STBC:
|
||||
*(u8 *)pval = 1;
|
||||
*(u8 *)pval = 2;
|
||||
break;
|
||||
|
||||
case HAL_DEF_EXPLICIT_BEAMFORMER:
|
||||
|
@ -65,6 +65,10 @@
|
||||
#include <linux/limits.h>
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0))
|
||||
#include <linux/sched/signal.h>
|
||||
#endif
|
||||
|
||||
#ifdef RTK_DMP_PLATFORM
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 12))
|
||||
#include <linux/pageremap.h>
|
||||
|
@ -31,4 +31,11 @@ enum country_code_type_t {
|
||||
int rtw_regd_init(_adapter *padapter);
|
||||
void rtw_reg_notify_by_driver(_adapter *adapter);
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0))
|
||||
#define ieee80211_band nl80211_band
|
||||
#define IEEE80211_BAND_2GHZ NL80211_BAND_2GHZ
|
||||
#define IEEE80211_BAND_5GHZ NL80211_BAND_5GHZ
|
||||
#define IEEE80211_NUM_BANDS NUM_NL80211_BANDS
|
||||
#endif
|
||||
|
||||
#endif /* __RTW_WIFI_REGD_H__ */
|
||||
|
@ -22,10 +22,24 @@
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
|
||||
#define STATION_INFO_SIGNAL BIT(NL80211_STA_INFO_SIGNAL)
|
||||
#define STATION_INFO_TX_BITRATE BIT(NL80211_STA_INFO_TX_BITRATE)
|
||||
#define STATION_INFO_TX_BITRATE_BW_5 BIT(RATE_INFO_BW_5)
|
||||
#define STATION_INFO_TX_BITRATE_BW_10 BIT(RATE_INFO_BW_10)
|
||||
#define STATION_INFO_TX_BITRATE_BW_20 BIT(RATE_INFO_BW_20)
|
||||
#define STATION_INFO_TX_BITRATE_BW_40 BIT(RATE_INFO_BW_40)
|
||||
#define STATION_INFO_TX_BITRATE_BW_80 BIT(RATE_INFO_BW_80)
|
||||
#define STATION_INFO_TX_BITRATE_BW_160 BIT(RATE_INFO_BW_160)
|
||||
#define STATION_INFO_RX_PACKETS BIT(NL80211_STA_INFO_RX_PACKETS)
|
||||
#define STATION_INFO_TX_PACKETS BIT(NL80211_STA_INFO_TX_PACKETS)
|
||||
#define STATION_INFO_TX_FAILED BIT(NL80211_STA_INFO_TX_FAILED)
|
||||
#define STATION_INFO_RX_BYTES BIT(NL80211_STA_INFO_RX_BYTES)
|
||||
#define STATION_INFO_TX_BYTES BIT(NL80211_STA_INFO_TX_BYTES)
|
||||
#define STATION_INFO_ASSOC_REQ_IES 0
|
||||
#define STATION_INFO_BSS_PARAM BIT(NL80211_STA_INFO_BSS_PARAM)
|
||||
#define STATION_INFO_BSS_PARAM_CTS_PROT BIT(NL80211_STA_BSS_PARAM_CTS_PROT)
|
||||
#define STATION_INFO_BSS_PARAM_SHORT_PREAMBLE BIT(NL80211_STA_BSS_PARAM_SHORT_PREAMBLE)
|
||||
#define STATION_INFO_BSS_PARAM_SHORT_SLOT_TIME BIT(NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME)
|
||||
#define STATION_INFO_BSS_PARAM_DTIM_PERIOD BIT(NL80211_STA_BSS_PARAM_DTIM_PERIOD)
|
||||
#define STATION_INFO_BSS_PARAM_BEACON_INTERVAL BIT(NL80211_STA_BSS_PARAM_BEACON_INTERVAL)
|
||||
#endif /* Linux kernel >= 4.0.0 */
|
||||
|
||||
#include <rtw_wifi_regd.h>
|
||||
@ -1922,33 +1936,78 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy,
|
||||
RTW_INFO(FUNC_NDEV_FMT" mac="MAC_FMT"\n", FUNC_NDEV_ARG(ndev), MAC_ARG(mac));
|
||||
#endif
|
||||
|
||||
/* for infra./P2PClient mode */
|
||||
/* for infra./P2PClient mode */
|
||||
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)
|
||||
&& check_fwstate(pmlmepriv, _FW_LINKED)
|
||||
) {
|
||||
struct wlan_network *cur_network = &(pmlmepriv->cur_network);
|
||||
struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter);
|
||||
|
||||
if (_rtw_memcmp((u8 *)mac, cur_network->network.MacAddress, ETH_ALEN) == _FALSE) {
|
||||
RTW_INFO("%s, mismatch bssid="MAC_FMT"\n", __func__, MAC_ARG(cur_network->network.MacAddress));
|
||||
ret = -ENOENT;
|
||||
goto exit;
|
||||
}
|
||||
if (_rtw_memcmp((u8 *)mac, cur_network->network.MacAddress, ETH_ALEN) == _FALSE) {
|
||||
RTW_INFO("%s, mismatch bssid="MAC_FMT"\n", __func__, MAC_ARG(cur_network->network.MacAddress));
|
||||
ret = -ENOENT;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
sinfo->filled |= STATION_INFO_SIGNAL;
|
||||
sinfo->signal = translate_percentage_to_dbm(padapter->recvpriv.signal_strength);
|
||||
sinfo->filled |= STATION_INFO_SIGNAL;
|
||||
sinfo->signal = translate_percentage_to_dbm(padapter->recvpriv.signal_strength);
|
||||
|
||||
sinfo->filled |= STATION_INFO_TX_BITRATE;
|
||||
sinfo->txrate.legacy = rtw_get_cur_max_rate(padapter);
|
||||
sinfo->filled |= STATION_INFO_TX_BITRATE;
|
||||
sinfo->txrate.legacy = rtw_get_cur_max_rate(padapter);
|
||||
|
||||
sinfo->filled |= STATION_INFO_RX_PACKETS;
|
||||
sinfo->rx_packets = sta_rx_data_pkts(psta);
|
||||
/* to-do set the txrate flags */
|
||||
// for example something like:
|
||||
//sinfo->txrate.flags |= NL80211_RATE_INFO_VHT_NSS;
|
||||
//sinfo->txrate.nss = rtw_vht_mcsmap_to_nss(psta->vhtpriv.vht_mcs_map);
|
||||
|
||||
sinfo->filled |= STATION_INFO_TX_PACKETS;
|
||||
sinfo->tx_packets = psta->sta_stats.tx_pkts;
|
||||
|
||||
/* bw_mode is more delicate
|
||||
sinfo->txrate.bw is flagged
|
||||
psta->bw_mode */
|
||||
|
||||
/*
|
||||
sinfo->txrate.bw = psta->bw_mode;
|
||||
sinfo->txrate.flags |= psta->bw_mode;
|
||||
printk("rtw_get_current_tx_sgi: %i", rtw_get_current_tx_sgi(padapter, mac));
|
||||
printk("NSS: %i", rtw_vht_mcsmap_to_nss(psta->vhtpriv.vht_mcs_map));
|
||||
printk("BW MODE: %i", psta->bw_mode);
|
||||
printk("5 10 20 40 80 160: %i %i %i %i %i %i", STATION_INFO_TX_BITRATE_BW_5, STATION_INFO_TX_BITRATE_BW_10, STATION_INFO_TX_BITRATE_BW_20, STATION_INFO_TX_BITRATE_BW_40, STATION_INFO_TX_BITRATE_BW_80, STATION_INFO_TX_BITRATE_BW_160);
|
||||
printk("5 10 20 40 80 160: %i %i %i %i %i %i", RATE_INFO_BW_5, RATE_INFO_BW_10, RATE_INFO_BW_20, RATE_INFO_BW_40, RATE_INFO_BW_80, RATE_INFO_BW_160);
|
||||
*/
|
||||
|
||||
sinfo->filled |= STATION_INFO_RX_BYTES;
|
||||
sinfo->rx_bytes = psta->sta_stats.rx_bytes;
|
||||
|
||||
sinfo->filled |= STATION_INFO_TX_BYTES;
|
||||
sinfo->tx_bytes = psta->sta_stats.tx_bytes;
|
||||
|
||||
sinfo->filled |= STATION_INFO_RX_PACKETS;
|
||||
sinfo->rx_packets = sta_rx_data_pkts(psta);
|
||||
|
||||
sinfo->filled |= STATION_INFO_TX_PACKETS;
|
||||
sinfo->tx_packets = psta->sta_stats.tx_pkts;
|
||||
|
||||
sinfo->filled |= STATION_INFO_TX_FAILED;
|
||||
sinfo->tx_failed = psta->sta_stats.tx_fail_cnt;
|
||||
|
||||
sinfo->filled |= STATION_INFO_BSS_PARAM;
|
||||
|
||||
if (!psta->no_short_preamble_set)
|
||||
sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_SHORT_PREAMBLE;
|
||||
|
||||
if (!psta->no_short_slot_time_set)
|
||||
sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_SHORT_SLOT_TIME;
|
||||
|
||||
/* no idea how to check this yet */
|
||||
if (0)
|
||||
sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_CTS_PROT;
|
||||
|
||||
/* is this actually the dtim_period? */
|
||||
sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_DTIM_PERIOD;
|
||||
sinfo->bss_param.dtim_period = pwrctl->dtim;
|
||||
|
||||
sinfo->bss_param.beacon_interval = get_beacon_interval(&cur_network->network);
|
||||
|
||||
}
|
||||
|
||||
/* for Ad-Hoc/AP mode */
|
||||
@ -4747,6 +4806,116 @@ static int cfg80211_rtw_change_bss(struct wiphy *wiphy, struct net_device *ndev,
|
||||
|
||||
}
|
||||
|
||||
static int cfg80211_rtw_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev, struct cfg80211_chan_def *chandef){
|
||||
_adapter *padapter= wiphy_to_adapter(wiphy);
|
||||
int channel;
|
||||
int control_freq;
|
||||
int center_freq;
|
||||
int center_freq2=0;
|
||||
int width;
|
||||
int band;
|
||||
int bandWidth;
|
||||
int offset;
|
||||
|
||||
struct dvobj_priv *dvobj;
|
||||
struct net_device *ndev = wdev->netdev;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
if (!ndev)
|
||||
return -ENODEV;
|
||||
|
||||
offset = rtw_get_oper_choffset(padapter);
|
||||
channel = adapter_to_dvobj(padapter)->oper_channel;
|
||||
if (channel >= 1) {
|
||||
switch (pHalData->current_band_type) {
|
||||
case 0:
|
||||
band = NL80211_BAND_2GHZ;
|
||||
break;
|
||||
case 1:
|
||||
band = NL80211_BAND_5GHZ;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
|
||||
}
|
||||
control_freq = ieee80211_channel_to_frequency(channel, band);
|
||||
|
||||
dvobj=adapter_to_dvobj(padapter);
|
||||
if (dvobj!=NULL) {
|
||||
bandWidth = adapter_to_dvobj(padapter)->oper_bwmode;
|
||||
//DBG_871X("%s bw %d\n", __func__,adapter_to_dvobj(padapter)->oper_bwmode);
|
||||
} else {
|
||||
bandWidth = pHalData->current_channel;
|
||||
//DBG_871X("%s dvobj null\n", __func__);
|
||||
}
|
||||
switch(pHalData->current_channel){
|
||||
case CHANNEL_WIDTH_20:
|
||||
//DBG_871X("%s width 20\n", __func__);
|
||||
width = NL80211_CHAN_WIDTH_20;
|
||||
center_freq = control_freq;
|
||||
break;
|
||||
case CHANNEL_WIDTH_40:
|
||||
//DBG_871X("%s width 40\n", __func__);
|
||||
width = NL80211_CHAN_WIDTH_40;
|
||||
if (offset==HAL_PRIME_CHNL_OFFSET_LOWER) {
|
||||
center_freq = control_freq +10;
|
||||
} else {
|
||||
center_freq = control_freq -10;
|
||||
}
|
||||
break;
|
||||
case CHANNEL_WIDTH_80:
|
||||
//DBG_871X("%s width 80\n", __func__);
|
||||
width = NL80211_CHAN_WIDTH_80;
|
||||
if (offset==HAL_PRIME_CHNL_OFFSET_LOWER) {
|
||||
center_freq = control_freq +30;
|
||||
} else {
|
||||
center_freq = control_freq -30;
|
||||
}
|
||||
break;
|
||||
case CHANNEL_WIDTH_160:
|
||||
//DBG_871X("%s width 160\n", __func__);
|
||||
width = NL80211_CHAN_WIDTH_160;
|
||||
if (offset==HAL_PRIME_CHNL_OFFSET_LOWER) {
|
||||
center_freq = control_freq +50;
|
||||
} else {
|
||||
center_freq = control_freq -50;
|
||||
}
|
||||
break;
|
||||
case CHANNEL_WIDTH_80_80:
|
||||
//DBG_871X("%s width 80x80\n", __func__);
|
||||
width = NL80211_CHAN_WIDTH_80P80;
|
||||
if (offset==HAL_PRIME_CHNL_OFFSET_LOWER) {
|
||||
center_freq = control_freq +30;
|
||||
center_freq2=center_freq+80;
|
||||
} else {
|
||||
center_freq = control_freq -30;
|
||||
center_freq2=center_freq-80;
|
||||
}
|
||||
break;
|
||||
case CHANNEL_WIDTH_MAX:
|
||||
//DBG_871X("%s width max\n", __func__);
|
||||
width = NL80211_CHAN_WIDTH_160;
|
||||
break;
|
||||
}
|
||||
chandef->chan = ieee80211_get_channel(wiphy, control_freq);
|
||||
if (chandef->chan == NULL) {
|
||||
chandef->chan = ieee80211_get_channel(wiphy, ieee80211_channel_to_frequency(channel, band));
|
||||
//DBG_871X("%s chan null\n", __func__);
|
||||
if (chandef->chan == NULL) {
|
||||
//DBG_871X("%s chan null\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
chandef->width = width;
|
||||
chandef->center_freq1 = center_freq;
|
||||
chandef->center_freq2 = center_freq2;
|
||||
//DBG_871X("%s : channel %d width %d freq1 %d freq2 %d center_freq %d offset %d\n", __func__, channel, width, chandef->center_freq1, chandef->center_freq2, chandef->chan->center_freq,rtw_get_oper_choffset(padapter));
|
||||
} else {
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
static int cfg80211_rtw_set_channel(struct wiphy *wiphy
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
, struct net_device *ndev
|
||||
@ -6899,7 +7068,13 @@ static void rtw_cfg80211_init_ht_capab(_adapter *padapter, struct ieee80211_sta_
|
||||
|
||||
ht_cap->ht_supported = _TRUE;
|
||||
|
||||
ht_cap->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
|
||||
/* According to the comment in rtw_ap.c:
|
||||
* "Note: currently we switch to the MIXED op mode if HT non-greenfield
|
||||
* station is associated. Probably it's a theoretical case, since
|
||||
* it looks like all known HT STAs support greenfield."
|
||||
* Therefore Greenfield is added to ht_cap
|
||||
*/
|
||||
ht_cap->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_GRN_FLD |
|
||||
IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_20 |
|
||||
IEEE80211_HT_CAP_DSSSCCK40 | IEEE80211_HT_CAP_MAX_AMSDU;
|
||||
rtw_cfg80211_init_ht_capab_ex(padapter, ht_cap, band, rf_type);
|
||||
@ -7011,15 +7186,24 @@ static void rtw_cfg80211_init_vht_capab(_adapter *padapter, struct ieee80211_sta
|
||||
}
|
||||
|
||||
/* B8 B9 B10 Rx STBC */
|
||||
if(TEST_FLAG(pvhtpriv->stbc_cap, STBC_VHT_ENABLE_RX)) {
|
||||
rtw_hal_get_def_var(padapter, HAL_DEF_RX_STBC, (u8 *)(&rx_stbc_nss));
|
||||
|
||||
if (rx_stbc_nss == 1)
|
||||
vht_cap->cap |= IEEE80211_VHT_CAP_RXSTBC_1;
|
||||
else if (rx_stbc_nss == 2)
|
||||
vht_cap->cap |= IEEE80211_VHT_CAP_RXSTBC_2;
|
||||
else if (rx_stbc_nss == 3)
|
||||
vht_cap->cap |= IEEE80211_VHT_CAP_RXSTBC_3;
|
||||
if (TEST_FLAG(pvhtpriv->stbc_cap, STBC_VHT_ENABLE_RX)) {
|
||||
switch (rf_type) {
|
||||
case RF_1T1R:
|
||||
vht_cap->cap |= IEEE80211_VHT_CAP_RXSTBC_1;/*RX STBC One spatial stream*/
|
||||
break;
|
||||
case RF_2T2R:
|
||||
case RF_1T2R:
|
||||
vht_cap->cap |= IEEE80211_VHT_CAP_RXSTBC_2;/*RX STBC Two spatial streams*/
|
||||
break;
|
||||
case RF_3T3R:
|
||||
case RF_3T4R:
|
||||
case RF_4T4R:
|
||||
vht_cap->cap |= IEEE80211_VHT_CAP_RXSTBC_3;/*RX STBC Three spatial streams*/
|
||||
break;
|
||||
default:
|
||||
/* DBG_871X("[warning] rf_type %d is not expected\n", rf_type); */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* B11 SU Beamformer Capable */
|
||||
@ -7056,22 +7240,101 @@ static void rtw_cfg80211_init_vht_capab(_adapter *padapter, struct ieee80211_sta
|
||||
else
|
||||
vht_cap->cap |= 7 << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT;
|
||||
|
||||
// Link Adaptation not supported
|
||||
/* B26 27 VHT Link Adaptation Capable */
|
||||
|
||||
/* find the largest bw supported by both registry and hal */
|
||||
/* this is taken from core/rtw_vht.c */
|
||||
bw = hal_largest_bw(padapter, REGSTY_BW_5G(pregistrypriv));
|
||||
|
||||
HighestRate = VHT_MCS_DATA_RATE[bw][pvhtpriv->sgi_80m][((pvhtpriv->vht_highest_rate - MGN_VHT1SS_MCS0)&0x3f)];
|
||||
HighestRate = rtw_vht_mcs_to_data_rate(bw, pvhtpriv->sgi_80m, pvhtpriv->vht_highest_rate);
|
||||
HighestRate = (HighestRate+1) >> 1;
|
||||
|
||||
|
||||
vht_cap->vht_mcs.tx_highest = HighestRate;
|
||||
vht_cap->vht_mcs.rx_highest = HighestRate;
|
||||
|
||||
RTW_INFO("[VHT] Highest rate value: %d\n", HighestRate);
|
||||
}
|
||||
#endif //CONFIG_VHT_EXTRAS
|
||||
|
||||
static void rtw_cfg80211_init_vht_capab_ex(_adapter *padapter, struct ieee80211_sta_vht_cap *vht_cap, u8 rf_type)
|
||||
{
|
||||
//todo: Support for other bandwidths
|
||||
|
||||
/* NSS = Number of Spatial Streams */
|
||||
#define MAX_BIT_RATE_80MHZ_NSS3 1300 /* Mbps */
|
||||
#define MAX_BIT_RATE_80MHZ_NSS2 867 /* Mbps */
|
||||
#define MAX_BIT_RATE_80MHZ_NSS1 434 /* Mbps */
|
||||
|
||||
struct registry_priv *pregistrypriv = &padapter->registrypriv;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv;
|
||||
|
||||
rtw_vht_use_default_setting(padapter);
|
||||
|
||||
/* RX LDPC */
|
||||
if (TEST_FLAG(pvhtpriv->ldpc_cap, LDPC_VHT_ENABLE_RX))
|
||||
vht_cap->cap |= IEEE80211_VHT_CAP_RXLDPC;
|
||||
|
||||
/* TX STBC */
|
||||
if (TEST_FLAG(pvhtpriv->stbc_cap, STBC_VHT_ENABLE_TX))
|
||||
vht_cap->cap |= IEEE80211_VHT_CAP_TXSTBC;
|
||||
|
||||
/* RX STBC */
|
||||
if (TEST_FLAG(pvhtpriv->stbc_cap, STBC_VHT_ENABLE_RX)) {
|
||||
switch (rf_type) {
|
||||
case RF_1T1R:
|
||||
vht_cap->cap |= IEEE80211_VHT_CAP_RXSTBC_1;/*RX STBC One spatial stream*/
|
||||
break;
|
||||
case RF_2T2R:
|
||||
case RF_1T2R:
|
||||
vht_cap->cap |= IEEE80211_VHT_CAP_RXSTBC_2;/*RX STBC Two spatial streams*/
|
||||
break;
|
||||
case RF_3T3R:
|
||||
case RF_3T4R:
|
||||
case RF_4T4R:
|
||||
vht_cap->cap |= IEEE80211_VHT_CAP_RXSTBC_3;/*RX STBC Three spatial streams*/
|
||||
break;
|
||||
default:
|
||||
/* DBG_871X("[warning] rf_type %d is not expected\n", rf_type); */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* switch (rf_type) {
|
||||
case RF_1T1R:
|
||||
vht_cap->vht_mcs.tx_highest = MAX_BIT_RATE_80MHZ_NSS1;
|
||||
vht_cap->vht_mcs.rx_highest = MAX_BIT_RATE_80MHZ_NSS1;
|
||||
break;
|
||||
case RF_2T2R:
|
||||
case RF_1T2R:
|
||||
vht_cap->vht_mcs.tx_highest = MAX_BIT_RATE_80MHZ_NSS2;
|
||||
vht_cap->vht_mcs.rx_highest = MAX_BIT_RATE_80MHZ_NSS2;
|
||||
break;
|
||||
case RF_3T3R:
|
||||
case RF_3T4R:
|
||||
case RF_4T4R:
|
||||
vht_cap->vht_mcs.tx_highest = MAX_BIT_RATE_80MHZ_NSS3;
|
||||
vht_cap->vht_mcs.rx_highest = MAX_BIT_RATE_80MHZ_NSS3;
|
||||
break;
|
||||
default:
|
||||
DBG_871X("[warning] rf_type %d is not expected\n", rf_type);
|
||||
break;
|
||||
} */
|
||||
|
||||
/* MCS map */
|
||||
vht_cap->vht_mcs.tx_mcs_map = pvhtpriv->vht_mcs_map[0] | (pvhtpriv->vht_mcs_map[1] << 8);
|
||||
vht_cap->vht_mcs.rx_mcs_map = vht_cap->vht_mcs.tx_mcs_map;
|
||||
|
||||
if (rf_type == RF_1T1R) {
|
||||
vht_cap->vht_mcs.tx_highest = MAX_BIT_RATE_80MHZ_NSS1;
|
||||
vht_cap->vht_mcs.rx_highest = MAX_BIT_RATE_80MHZ_NSS1;
|
||||
}
|
||||
|
||||
if (pvhtpriv->sgi_80m)
|
||||
vht_cap->cap |= IEEE80211_VHT_CAP_SHORT_GI_80;
|
||||
|
||||
vht_cap->cap |= (pvhtpriv->ampdu_len << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT);
|
||||
}
|
||||
|
||||
void rtw_cfg80211_init_wiphy(_adapter *padapter)
|
||||
{
|
||||
u8 rf_type;
|
||||
@ -7524,6 +7787,7 @@ static struct cfg80211_ops rtw_cfg80211_ops = {
|
||||
.suspend = cfg80211_rtw_suspend,
|
||||
.resume = cfg80211_rtw_resume,
|
||||
#endif /* CONFIG_PNO_SUPPORT */
|
||||
.get_channel = cfg80211_rtw_get_channel,
|
||||
#ifdef CONFIG_RFKILL_POLL
|
||||
.rfkill_poll = cfg80211_rtw_rfkill_poll,
|
||||
#endif
|
||||
|
@ -306,7 +306,7 @@ int rtw_drv_ant_band_switch = 1; /* 0:OFF , 1:ON, Driver control antenna band sw
|
||||
int rtw_single_ant_path; /*0:main ant , 1:aux ant , Fixed single antenna path, default main ant*/
|
||||
|
||||
/* 0: doesn't switch, 1: switch from usb2.0 to usb 3.0 2: switch from usb3.0 to usb 2.0 */
|
||||
int rtw_switch_usb_mode = 0;
|
||||
int rtw_switch_usb_mode = 1;
|
||||
|
||||
#ifdef CONFIG_USB_AUTOSUSPEND
|
||||
int rtw_enusbss = 1;/* 0:disable,1:enable */
|
||||
@ -1352,6 +1352,7 @@ static u8 is_rtw_ndev(struct net_device *ndev)
|
||||
static int rtw_ndev_notifier_call(struct notifier_block *nb, unsigned long state, void *ptr)
|
||||
{
|
||||
struct net_device *ndev;
|
||||
_adapter *adapter = rtw_netdev_priv(ndev);
|
||||
|
||||
if (ptr == NULL)
|
||||
return NOTIFY_DONE;
|
||||
@ -1373,6 +1374,8 @@ static int rtw_ndev_notifier_call(struct notifier_block *nb, unsigned long state
|
||||
switch (state) {
|
||||
case NETDEV_CHANGENAME:
|
||||
rtw_adapter_proc_replace(ndev);
|
||||
strncpy(adapter->old_ifname, ndev->name, IFNAMSIZ);
|
||||
adapter->old_ifname[IFNAMSIZ-1] = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -693,7 +693,25 @@ static int usb_reprobe_switch_usb_mode(PADAPTER Adapter)
|
||||
if (registry_par->switch_usb_mode == 0)
|
||||
goto exit;
|
||||
|
||||
#if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) || defined(CONFIG_RTL8814A)
|
||||
if (IS_HIGH_SPEED_USB(Adapter)) {
|
||||
if ((rtw_read8(Adapter, 0x74) & (BIT(2)|BIT(3))) != BIT(3)) {
|
||||
rtw_write8(Adapter, 0x74, 0x8);
|
||||
rtw_write8(Adapter, 0x70, 0x2);
|
||||
rtw_write8(Adapter, 0x3e, 0x1);
|
||||
rtw_write8(Adapter, 0x3d, 0x3);
|
||||
/* usb disconnect */
|
||||
rtw_write8(Adapter, 0x5, 0x80);
|
||||
ret = _TRUE;
|
||||
}
|
||||
|
||||
} else if (IS_SUPER_SPEED_USB(Adapter)) {
|
||||
rtw_write8(Adapter, 0x70, rtw_read8(Adapter, 0x70) & (~BIT(1)));
|
||||
rtw_write8(Adapter, 0x3e, rtw_read8(Adapter, 0x3e) & (~BIT(0)));
|
||||
}
|
||||
#else
|
||||
rtw_hal_set_hwreg(Adapter, HW_VAR_USB_MODE, &ret);
|
||||
#endif
|
||||
|
||||
exit:
|
||||
return ret;
|
||||
|
@ -334,8 +334,13 @@ static void _rtw_reg_apply_flags(struct wiphy *wiphy)
|
||||
if (ch)
|
||||
ch->flags &= ~(IEEE80211_CHAN_DISABLED|IEEE80211_CHAN_NO_HT40PLUS|
|
||||
IEEE80211_CHAN_NO_HT40MINUS|IEEE80211_CHAN_NO_80MHZ|
|
||||
IEEE80211_CHAN_NO_160MHZ);
|
||||
//ch->flags = IEEE80211_CHAN_DISABLED;
|
||||
IEEE80211_CHAN_NO_160MHZ|
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
|
||||
IEEE80211_CHAN_NO_IBSS|IEEE80211_CHAN_PASSIVE_SCAN);
|
||||
#else
|
||||
IEEE80211_CHAN_NO_IR);
|
||||
#endif
|
||||
//ch->flags = IEEE80211_CHAN_DISABLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user