Skip to content

Commit

Permalink
rtw89: Update driver to v5
Browse files Browse the repository at this point in the history
This version is the latest released by Realtek and has a number of improvements
over v4. I now have the chip and have run extensive tests on this version. For
me, it has been stable and will handle up to 600 Mbps using a 5G connection to
a Wifi 6 AP with a theoretical maximum throughput of 750 Mbps.

Signed-off-by: Larry Finger <[email protected]>
  • Loading branch information
lwfinger committed Jul 3, 2021
1 parent 8f6b38f commit ac7ec50
Show file tree
Hide file tree
Showing 32 changed files with 3,244 additions and 739 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ rtw89core-y += core.o \
regd.o \
coex.o \
ps.o \
ser.o
sar.o \
ser.o \
util.o

obj-m += rtw89pci.o
rtw89pci-y := pci.o
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
rtw89
rtw89 v5
===========
### A repo for the newest Realtek rtlwifi codes.

This branch has v5 of the code, which is latest from Realtek.

This code will build on any kernel 5.7 and newer as long as the distro has not modified
any of the kernel APIs. IF YOU RUN UBUNTU, YOU CAN BE ASSURED THAT THE APIs HAVE CHANGED.
NO, I WILL NOT MODIFY THE SOURCE FOR YOU. YOU ARE ON YOUR OWN!!!!!

I am working on fixing builds on older kernels.

This repository includes drivers for the following cards:
This repository includes drivers for the following card:

Realtek 8852AE

Expand All @@ -25,12 +27,12 @@ You can install them with the following command, on **Ubuntu**:
sudo apt-get update
sudo apt-get install make gcc linux-headers-$(uname -r) build-essential git
```
If any of the packets above are not found check if your distro installs them like that.
If any of the packages above are not found check if your distro installs them like that.

##### Installation
For all distros:
```bash
git clone https://github.com/lwfinger/rtw89.git
git clone https://github.com/lwfinger/rtw89.git -b v5
cd rtw89
make
sudo make install
Expand All @@ -53,6 +55,8 @@ options <device_name> <<driver_option_name>>=<value>
The available options for rtw89pci are disable_clkreq, disable_aspm, and disable_aspm
The available options for rtw89core are debug_mask, and disable_ps_mode
Normally, none of these will be needed.
***********************************************************************************************
When your kernel changes, then you need to do the following:
Expand Down
38 changes: 29 additions & 9 deletions cam.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,6 @@ int rtw89_cam_sec_key_add(struct rtw89_dev *rtwdev,
case WLAN_CIPHER_SUITE_WEP104:
hw_key_type = RTW89_SEC_KEY_TYPE_WEP104;
break;
case WLAN_CIPHER_SUITE_TKIP:
hw_key_type = RTW89_SEC_KEY_TYPE_TKIP;
key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
break;
case WLAN_CIPHER_SUITE_CCMP:
hw_key_type = RTW89_SEC_KEY_TYPE_CCMP128;
key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX;
Expand All @@ -352,6 +348,7 @@ int rtw89_cam_sec_key_add(struct rtw89_dev *rtwdev,
key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX;
ext_key = true;
break;
case WLAN_CIPHER_SUITE_TKIP:
case WLAN_CIPHER_SUITE_AES_CMAC:
case WLAN_CIPHER_SUITE_BIP_CMAC_256:
case WLAN_CIPHER_SUITE_BIP_GMAC_128:
Expand All @@ -378,15 +375,16 @@ int rtw89_cam_sec_key_add(struct rtw89_dev *rtwdev,
int rtw89_cam_sec_key_del(struct rtw89_dev *rtwdev,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct ieee80211_key_conf *key)
struct ieee80211_key_conf *key,
bool inform_fw)
{
struct rtw89_cam_info *cam_info = &rtwdev->cam_info;
struct rtw89_vif *rtwvif;
struct rtw89_addr_cam_entry *addr_cam;
struct rtw89_sec_cam_entry *sec_cam;
u8 key_idx = key->hw_key_idx;
u8 sec_cam_idx;
int ret;
int ret = 0;

if (!vif) {
rtw89_err(rtwdev, "No iface for deleting sec cam\n");
Expand All @@ -400,9 +398,11 @@ int rtw89_cam_sec_key_del(struct rtw89_dev *rtwdev,
/* detach sec cam from addr cam */
clear_bit(key_idx, addr_cam->sec_cam_map);
addr_cam->sec_entries[key_idx] = NULL;
ret = rtw89_fw_h2c_cam(rtwdev, rtwvif);
if (ret)
rtw89_err(rtwdev, "failed to update cam del key: %d\n", ret);
if (inform_fw) {
ret = rtw89_fw_h2c_cam(rtwdev, rtwvif);
if (ret)
rtw89_err(rtwdev, "failed to update cam del key: %d\n", ret);
}

/* clear valid bit in addr cam will disable sec cam,
* so we don't need to send H2C command again
Expand All @@ -417,6 +417,19 @@ int rtw89_cam_sec_key_del(struct rtw89_dev *rtwdev,
return ret;
}

static void rtw89_cam_reset_key_iter(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct ieee80211_key_conf *key,
void *data)
{
struct rtw89_dev *rtwdev = (struct rtw89_dev *)data;
struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;

rtw89_cam_sec_key_del(rtwdev, vif, sta, key, false);
rtw89_cam_deinit(rtwdev, rtwvif);
}

void rtw89_cam_deinit(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
{
struct rtw89_cam_info *cam_info = &rtwdev->cam_info;
Expand All @@ -429,6 +442,13 @@ void rtw89_cam_deinit(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
clear_bit(bssid_cam->bssid_cam_idx, cam_info->bssid_cam_map);
}

void rtw89_cam_reset_keys(struct rtw89_dev *rtwdev)
{
rcu_read_lock();
ieee80211_iter_keys_rcu(rtwdev->hw, NULL, rtw89_cam_reset_key_iter, rtwdev);
rcu_read_unlock();
}

static int rtw89_cam_get_avail_addr_cam(struct rtw89_dev *rtwdev,
u8 *addr_cam_idx)
{
Expand Down
5 changes: 3 additions & 2 deletions cam.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,9 @@ int rtw89_cam_sec_key_add(struct rtw89_dev *rtwdev,
int rtw89_cam_sec_key_del(struct rtw89_dev *rtwdev,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct ieee80211_key_conf *key);
struct ieee80211_key_conf *key,
bool inform_fw);
void rtw89_cam_bssid_changed(struct rtw89_dev *rtwdev,
struct rtw89_vif *rtwvif);

void rtw89_cam_reset_keys(struct rtw89_dev *rtwdev);
#endif
Loading

0 comments on commit ac7ec50

Please sign in to comment.