rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
|
|
|
|
/* Copyright(c) 2019-2020 Realtek Corporation
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "cam.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "fw.h"
|
|
|
|
#include "mac.h"
|
2025-05-07 11:12:03 +08:00
|
|
|
#include "ps.h"
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
|
|
|
|
static struct sk_buff *
|
|
|
|
rtw89_cam_get_sec_key_cmd(struct rtw89_dev *rtwdev,
|
|
|
|
struct rtw89_sec_cam_entry *sec_cam,
|
|
|
|
bool ext_key)
|
|
|
|
{
|
|
|
|
struct sk_buff *skb;
|
|
|
|
u32 cmd_len = H2C_SEC_CAM_LEN;
|
|
|
|
u32 key32[4];
|
|
|
|
u8 *cmd;
|
|
|
|
int i, j;
|
|
|
|
|
2022-03-18 10:32:10 +08:00
|
|
|
skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, cmd_len);
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
if (!skb)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
skb_put_zero(skb, cmd_len);
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
j = i * 4;
|
|
|
|
j += ext_key ? 16 : 0;
|
|
|
|
key32[i] = FIELD_PREP(GENMASK(7, 0), sec_cam->key[j + 0]) |
|
|
|
|
FIELD_PREP(GENMASK(15, 8), sec_cam->key[j + 1]) |
|
|
|
|
FIELD_PREP(GENMASK(23, 16), sec_cam->key[j + 2]) |
|
|
|
|
FIELD_PREP(GENMASK(31, 24), sec_cam->key[j + 3]);
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd = skb->data;
|
|
|
|
RTW89_SET_FWCMD_SEC_IDX(cmd, sec_cam->sec_cam_idx + (ext_key ? 1 : 0));
|
|
|
|
RTW89_SET_FWCMD_SEC_OFFSET(cmd, sec_cam->offset);
|
|
|
|
RTW89_SET_FWCMD_SEC_LEN(cmd, sec_cam->len);
|
|
|
|
RTW89_SET_FWCMD_SEC_TYPE(cmd, sec_cam->type);
|
|
|
|
RTW89_SET_FWCMD_SEC_EXT_KEY(cmd, ext_key);
|
|
|
|
RTW89_SET_FWCMD_SEC_SPP_MODE(cmd, sec_cam->spp_mode);
|
|
|
|
RTW89_SET_FWCMD_SEC_KEY0(cmd, key32[0]);
|
|
|
|
RTW89_SET_FWCMD_SEC_KEY1(cmd, key32[1]);
|
|
|
|
RTW89_SET_FWCMD_SEC_KEY2(cmd, key32[2]);
|
|
|
|
RTW89_SET_FWCMD_SEC_KEY3(cmd, key32[3]);
|
|
|
|
|
|
|
|
return skb;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rtw89_cam_send_sec_key_cmd(struct rtw89_dev *rtwdev,
|
|
|
|
struct rtw89_sec_cam_entry *sec_cam)
|
|
|
|
{
|
|
|
|
struct sk_buff *skb, *ext_skb;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
skb = rtw89_cam_get_sec_key_cmd(rtwdev, sec_cam, false);
|
|
|
|
if (!skb) {
|
|
|
|
rtw89_err(rtwdev, "failed to get sec key command\n");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
rtw89_h2c_pkt_set_hdr(rtwdev, skb,
|
|
|
|
FWCMD_TYPE_H2C,
|
|
|
|
H2C_CAT_MAC,
|
|
|
|
H2C_CL_MAC_SEC_CAM,
|
|
|
|
H2C_FUNC_MAC_SEC_UPD, 1, 0,
|
|
|
|
H2C_SEC_CAM_LEN);
|
|
|
|
ret = rtw89_h2c_tx(rtwdev, skb, false);
|
|
|
|
if (ret) {
|
|
|
|
rtw89_err(rtwdev, "failed to send sec key h2c: %d\n", ret);
|
|
|
|
dev_kfree_skb(skb);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!sec_cam->ext_key)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
ext_skb = rtw89_cam_get_sec_key_cmd(rtwdev, sec_cam, true);
|
2021-10-18 11:31:02 +08:00
|
|
|
if (!ext_skb) {
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
rtw89_err(rtwdev, "failed to get ext sec key command\n");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
rtw89_h2c_pkt_set_hdr(rtwdev, ext_skb,
|
|
|
|
FWCMD_TYPE_H2C,
|
|
|
|
H2C_CAT_MAC,
|
|
|
|
H2C_CL_MAC_SEC_CAM,
|
|
|
|
H2C_FUNC_MAC_SEC_UPD,
|
|
|
|
1, 0, H2C_SEC_CAM_LEN);
|
|
|
|
ret = rtw89_h2c_tx(rtwdev, ext_skb, false);
|
|
|
|
if (ret) {
|
|
|
|
rtw89_err(rtwdev, "failed to send ext sec key h2c: %d\n", ret);
|
|
|
|
dev_kfree_skb(ext_skb);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rtw89_cam_get_avail_sec_cam(struct rtw89_dev *rtwdev,
|
|
|
|
u8 *sec_cam_idx, bool ext_key)
|
|
|
|
{
|
|
|
|
const struct rtw89_chip_info *chip = rtwdev->chip;
|
|
|
|
struct rtw89_cam_info *cam_info = &rtwdev->cam_info;
|
|
|
|
u8 sec_cam_num = chip->scam_num;
|
|
|
|
u8 idx = 0;
|
|
|
|
|
|
|
|
if (!ext_key) {
|
|
|
|
idx = find_first_zero_bit(cam_info->sec_cam_map, sec_cam_num);
|
|
|
|
if (idx >= sec_cam_num)
|
|
|
|
return -EBUSY;
|
|
|
|
|
|
|
|
set_bit(idx, cam_info->sec_cam_map);
|
|
|
|
*sec_cam_idx = idx;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
again:
|
|
|
|
idx = find_next_zero_bit(cam_info->sec_cam_map, sec_cam_num, idx);
|
|
|
|
if (idx >= sec_cam_num - 1)
|
|
|
|
return -EBUSY;
|
|
|
|
/* ext keys need two cam entries for 256-bit key */
|
|
|
|
if (test_bit(idx + 1, cam_info->sec_cam_map)) {
|
|
|
|
idx++;
|
|
|
|
goto again;
|
|
|
|
}
|
|
|
|
|
|
|
|
set_bit(idx, cam_info->sec_cam_map);
|
|
|
|
set_bit(idx + 1, cam_info->sec_cam_map);
|
|
|
|
*sec_cam_idx = idx;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rtw89_cam_get_addr_cam_key_idx(struct rtw89_addr_cam_entry *addr_cam,
|
2024-11-20 11:40:52 +08:00
|
|
|
const struct rtw89_sec_cam_entry *sec_cam,
|
|
|
|
const struct ieee80211_key_conf *key,
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
u8 *key_idx)
|
|
|
|
{
|
|
|
|
u8 idx;
|
|
|
|
|
|
|
|
/* RTW89_ADDR_CAM_SEC_NONE : not enabled
|
|
|
|
* RTW89_ADDR_CAM_SEC_ALL_UNI : 0 - 6 unicast
|
|
|
|
* RTW89_ADDR_CAM_SEC_NORMAL : 0 - 1 unicast, 2 - 4 group, 5 - 6 BIP
|
|
|
|
* RTW89_ADDR_CAM_SEC_4GROUP : 0 - 1 unicast, 2 - 5 group, 6 BIP
|
|
|
|
*/
|
|
|
|
switch (addr_cam->sec_ent_mode) {
|
|
|
|
case RTW89_ADDR_CAM_SEC_NONE:
|
|
|
|
return -EINVAL;
|
|
|
|
case RTW89_ADDR_CAM_SEC_ALL_UNI:
|
|
|
|
idx = find_first_zero_bit(addr_cam->sec_cam_map,
|
|
|
|
RTW89_SEC_CAM_IN_ADDR_CAM);
|
|
|
|
if (idx >= RTW89_SEC_CAM_IN_ADDR_CAM)
|
|
|
|
return -EBUSY;
|
|
|
|
*key_idx = idx;
|
|
|
|
break;
|
|
|
|
case RTW89_ADDR_CAM_SEC_NORMAL:
|
|
|
|
if (sec_cam->type == RTW89_SEC_KEY_TYPE_BIP_CCMP128) {
|
|
|
|
idx = find_next_zero_bit(addr_cam->sec_cam_map,
|
|
|
|
RTW89_SEC_CAM_IN_ADDR_CAM, 5);
|
|
|
|
if (idx > 6)
|
|
|
|
return -EBUSY;
|
|
|
|
*key_idx = idx;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) {
|
|
|
|
idx = find_next_zero_bit(addr_cam->sec_cam_map,
|
|
|
|
RTW89_SEC_CAM_IN_ADDR_CAM, 0);
|
|
|
|
if (idx > 1)
|
|
|
|
return -EBUSY;
|
|
|
|
*key_idx = idx;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Group keys */
|
|
|
|
idx = find_next_zero_bit(addr_cam->sec_cam_map,
|
|
|
|
RTW89_SEC_CAM_IN_ADDR_CAM, 2);
|
|
|
|
if (idx > 4)
|
|
|
|
return -EBUSY;
|
|
|
|
*key_idx = idx;
|
|
|
|
break;
|
|
|
|
case RTW89_ADDR_CAM_SEC_4GROUP:
|
|
|
|
if (sec_cam->type == RTW89_SEC_KEY_TYPE_BIP_CCMP128) {
|
|
|
|
if (test_bit(6, addr_cam->sec_cam_map))
|
|
|
|
return -EINVAL;
|
|
|
|
*key_idx = 6;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) {
|
|
|
|
idx = find_next_zero_bit(addr_cam->sec_cam_map,
|
|
|
|
RTW89_SEC_CAM_IN_ADDR_CAM, 0);
|
|
|
|
if (idx > 1)
|
|
|
|
return -EBUSY;
|
|
|
|
*key_idx = idx;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Group keys */
|
|
|
|
idx = find_next_zero_bit(addr_cam->sec_cam_map,
|
|
|
|
RTW89_SEC_CAM_IN_ADDR_CAM, 2);
|
|
|
|
if (idx > 5)
|
|
|
|
return -EBUSY;
|
|
|
|
*key_idx = idx;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
wifi: rtw89: tweak driver architecture for impending MLO support
The drv_priv hooked to mac80211 become as below.
(drv_priv) (instance-0)
+---------------+ +-----------+ +----------------+
| ieee80211_vif | <---> | rtw89_vif | -------> | rtw89_vif_link |
+---------------+ +-----------+ | +----------------+
|
| (instance-1)
| +----------------+
+---> | rtw89_vif_link |
+----------------+
(drv_priv) (instance-0)
+---------------+ +-----------+ +----------------+
| ieee80211_sta | <---> | rtw89_sta | -------> | rtw89_sta_link |
+---------------+ +-----------+ | +----------------+
|
| (instance-1)
| +----------------+
+---> | rtw89_sta_link |
+----------------+
The relation bewteen mac80211 link_id and our link instance is like below.
|\
(link_id) | \
0 -------- | |
1 -------- | | ------ instance-0 (link_id: X) -> work on HW band 0
2 -------- | |
... | | ------ instance-1 (link_id: Y) -> work on HW band 1
14 -------- | |
| /
|/
N.B. For cases of non-MLD connection, we set our link instance-0
active with link_id 0. So, our code flow can be compatible between
non-MLD connection and MLD connection.
Based on above, we tweak entire driver architecture first. But, we don't
dynamically enable multiple links here. That will be handled separately.
Most of the things changed here are changing flows to iterate all active
links and read bss_conf/link_sta data according to target link. And, for
cases of scan, ROC, WOW, we use instance-0 to deal with the request.
There are some things listed below, which work for now but need to extend
before multiple active links.
1. tx path
select suitable link instance among multiple active links
2. rx path
determine rx link by PPDU instead of always link instance-0
3. CAM
apply MLD pairwise key to any active links dynamically
Besides, PS code cannot easily work along with tweaking architecture. With
supporting MLO flag (currently false), we disable PS first and will fix it
by another commit in the following.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20240916053158.47350-8-pkshih@realtek.com
2024-09-16 13:31:58 +08:00
|
|
|
static int __rtw89_cam_detach_sec_cam(struct rtw89_dev *rtwdev,
|
|
|
|
struct rtw89_vif_link *rtwvif_link,
|
|
|
|
struct rtw89_sta_link *rtwsta_link,
|
|
|
|
const struct rtw89_sec_cam_entry *sec_cam,
|
|
|
|
bool inform_fw)
|
2024-05-09 17:06:44 +08:00
|
|
|
{
|
|
|
|
struct rtw89_addr_cam_entry *addr_cam;
|
|
|
|
unsigned int i;
|
|
|
|
int ret = 0;
|
|
|
|
|
2024-09-16 13:31:53 +08:00
|
|
|
addr_cam = rtw89_get_addr_cam_of(rtwvif_link, rtwsta_link);
|
2024-05-09 17:06:44 +08:00
|
|
|
|
|
|
|
for_each_set_bit(i, addr_cam->sec_cam_map, RTW89_SEC_CAM_IN_ADDR_CAM) {
|
|
|
|
if (addr_cam->sec_ent[i] != sec_cam->sec_cam_idx)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
clear_bit(i, addr_cam->sec_cam_map);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (inform_fw) {
|
2024-09-16 13:31:53 +08:00
|
|
|
ret = rtw89_chip_h2c_dctl_sec_cam(rtwdev, rtwvif_link, rtwsta_link);
|
2024-05-09 17:06:44 +08:00
|
|
|
if (ret)
|
|
|
|
rtw89_err(rtwdev,
|
|
|
|
"failed to update dctl cam del key: %d\n", ret);
|
2024-09-16 13:31:53 +08:00
|
|
|
ret = rtw89_fw_h2c_cam(rtwdev, rtwvif_link, rtwsta_link, NULL);
|
2024-05-09 17:06:44 +08:00
|
|
|
if (ret)
|
|
|
|
rtw89_err(rtwdev, "failed to update cam del key: %d\n", ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
wifi: rtw89: tweak driver architecture for impending MLO support
The drv_priv hooked to mac80211 become as below.
(drv_priv) (instance-0)
+---------------+ +-----------+ +----------------+
| ieee80211_vif | <---> | rtw89_vif | -------> | rtw89_vif_link |
+---------------+ +-----------+ | +----------------+
|
| (instance-1)
| +----------------+
+---> | rtw89_vif_link |
+----------------+
(drv_priv) (instance-0)
+---------------+ +-----------+ +----------------+
| ieee80211_sta | <---> | rtw89_sta | -------> | rtw89_sta_link |
+---------------+ +-----------+ | +----------------+
|
| (instance-1)
| +----------------+
+---> | rtw89_sta_link |
+----------------+
The relation bewteen mac80211 link_id and our link instance is like below.
|\
(link_id) | \
0 -------- | |
1 -------- | | ------ instance-0 (link_id: X) -> work on HW band 0
2 -------- | |
... | | ------ instance-1 (link_id: Y) -> work on HW band 1
14 -------- | |
| /
|/
N.B. For cases of non-MLD connection, we set our link instance-0
active with link_id 0. So, our code flow can be compatible between
non-MLD connection and MLD connection.
Based on above, we tweak entire driver architecture first. But, we don't
dynamically enable multiple links here. That will be handled separately.
Most of the things changed here are changing flows to iterate all active
links and read bss_conf/link_sta data according to target link. And, for
cases of scan, ROC, WOW, we use instance-0 to deal with the request.
There are some things listed below, which work for now but need to extend
before multiple active links.
1. tx path
select suitable link instance among multiple active links
2. rx path
determine rx link by PPDU instead of always link instance-0
3. CAM
apply MLD pairwise key to any active links dynamically
Besides, PS code cannot easily work along with tweaking architecture. With
supporting MLO flag (currently false), we disable PS first and will fix it
by another commit in the following.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20240916053158.47350-8-pkshih@realtek.com
2024-09-16 13:31:58 +08:00
|
|
|
static int __rtw89_cam_attach_sec_cam(struct rtw89_dev *rtwdev,
|
|
|
|
struct rtw89_vif_link *rtwvif_link,
|
|
|
|
struct rtw89_sta_link *rtwsta_link,
|
2024-11-20 11:40:52 +08:00
|
|
|
const struct ieee80211_key_conf *key,
|
|
|
|
const struct rtw89_sec_cam_entry *sec_cam)
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
{
|
|
|
|
struct rtw89_addr_cam_entry *addr_cam;
|
|
|
|
u8 key_idx = 0;
|
|
|
|
int ret;
|
|
|
|
|
2024-09-16 13:31:53 +08:00
|
|
|
addr_cam = rtw89_get_addr_cam_of(rtwvif_link, rtwsta_link);
|
2024-05-02 10:25:04 +08:00
|
|
|
|
|
|
|
if (key->cipher == WLAN_CIPHER_SUITE_WEP40 ||
|
|
|
|
key->cipher == WLAN_CIPHER_SUITE_WEP104)
|
|
|
|
addr_cam->sec_ent_mode = RTW89_ADDR_CAM_SEC_ALL_UNI;
|
|
|
|
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
ret = rtw89_cam_get_addr_cam_key_idx(addr_cam, sec_cam, key, &key_idx);
|
|
|
|
if (ret) {
|
|
|
|
rtw89_err(rtwdev, "failed to get addr cam key idx %d, %d\n",
|
|
|
|
addr_cam->sec_ent_mode, sec_cam->type);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
addr_cam->sec_ent_keyid[key_idx] = key->keyidx;
|
|
|
|
addr_cam->sec_ent[key_idx] = sec_cam->sec_cam_idx;
|
|
|
|
set_bit(key_idx, addr_cam->sec_cam_map);
|
2024-09-16 13:31:53 +08:00
|
|
|
ret = rtw89_chip_h2c_dctl_sec_cam(rtwdev, rtwvif_link, rtwsta_link);
|
2022-04-13 09:08:03 +08:00
|
|
|
if (ret) {
|
|
|
|
rtw89_err(rtwdev, "failed to update dctl cam sec entry: %d\n",
|
|
|
|
ret);
|
|
|
|
return ret;
|
|
|
|
}
|
2024-09-16 13:31:53 +08:00
|
|
|
ret = rtw89_fw_h2c_cam(rtwdev, rtwvif_link, rtwsta_link, NULL);
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
if (ret) {
|
|
|
|
rtw89_err(rtwdev, "failed to update addr cam sec entry: %d\n",
|
|
|
|
ret);
|
|
|
|
clear_bit(key_idx, addr_cam->sec_cam_map);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2024-11-20 11:40:52 +08:00
|
|
|
int rtw89_cam_attach_link_sec_cam(struct rtw89_dev *rtwdev,
|
|
|
|
struct rtw89_vif_link *rtwvif_link,
|
|
|
|
struct rtw89_sta_link *rtwsta_link,
|
|
|
|
u8 sec_cam_idx)
|
|
|
|
{
|
|
|
|
struct rtw89_cam_info *cam_info = &rtwdev->cam_info;
|
|
|
|
const struct rtw89_sec_cam_entry *sec_cam;
|
|
|
|
|
|
|
|
sec_cam = cam_info->sec_entries[sec_cam_idx];
|
|
|
|
if (!sec_cam)
|
|
|
|
return -ENOENT;
|
|
|
|
|
|
|
|
return __rtw89_cam_attach_sec_cam(rtwdev, rtwvif_link, rtwsta_link,
|
|
|
|
sec_cam->key_conf, sec_cam);
|
|
|
|
}
|
|
|
|
|
wifi: rtw89: tweak driver architecture for impending MLO support
The drv_priv hooked to mac80211 become as below.
(drv_priv) (instance-0)
+---------------+ +-----------+ +----------------+
| ieee80211_vif | <---> | rtw89_vif | -------> | rtw89_vif_link |
+---------------+ +-----------+ | +----------------+
|
| (instance-1)
| +----------------+
+---> | rtw89_vif_link |
+----------------+
(drv_priv) (instance-0)
+---------------+ +-----------+ +----------------+
| ieee80211_sta | <---> | rtw89_sta | -------> | rtw89_sta_link |
+---------------+ +-----------+ | +----------------+
|
| (instance-1)
| +----------------+
+---> | rtw89_sta_link |
+----------------+
The relation bewteen mac80211 link_id and our link instance is like below.
|\
(link_id) | \
0 -------- | |
1 -------- | | ------ instance-0 (link_id: X) -> work on HW band 0
2 -------- | |
... | | ------ instance-1 (link_id: Y) -> work on HW band 1
14 -------- | |
| /
|/
N.B. For cases of non-MLD connection, we set our link instance-0
active with link_id 0. So, our code flow can be compatible between
non-MLD connection and MLD connection.
Based on above, we tweak entire driver architecture first. But, we don't
dynamically enable multiple links here. That will be handled separately.
Most of the things changed here are changing flows to iterate all active
links and read bss_conf/link_sta data according to target link. And, for
cases of scan, ROC, WOW, we use instance-0 to deal with the request.
There are some things listed below, which work for now but need to extend
before multiple active links.
1. tx path
select suitable link instance among multiple active links
2. rx path
determine rx link by PPDU instead of always link instance-0
3. CAM
apply MLD pairwise key to any active links dynamically
Besides, PS code cannot easily work along with tweaking architecture. With
supporting MLO flag (currently false), we disable PS first and will fix it
by another commit in the following.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20240916053158.47350-8-pkshih@realtek.com
2024-09-16 13:31:58 +08:00
|
|
|
static int rtw89_cam_detach_sec_cam(struct rtw89_dev *rtwdev,
|
|
|
|
struct ieee80211_vif *vif,
|
|
|
|
struct ieee80211_sta *sta,
|
|
|
|
const struct rtw89_sec_cam_entry *sec_cam,
|
|
|
|
bool inform_fw)
|
|
|
|
{
|
|
|
|
struct rtw89_sta *rtwsta = sta_to_rtwsta_safe(sta);
|
|
|
|
struct rtw89_sta_link *rtwsta_link;
|
|
|
|
struct rtw89_vif_link *rtwvif_link;
|
|
|
|
struct rtw89_vif *rtwvif;
|
|
|
|
unsigned int link_id;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (!vif) {
|
|
|
|
rtw89_err(rtwdev, "No iface for deleting sec cam\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
rtwvif = vif_to_rtwvif(vif);
|
|
|
|
|
2024-11-20 11:40:52 +08:00
|
|
|
if (rtwsta)
|
|
|
|
clear_bit(sec_cam->sec_cam_idx, rtwsta->pairwise_sec_cam_map);
|
|
|
|
|
wifi: rtw89: tweak driver architecture for impending MLO support
The drv_priv hooked to mac80211 become as below.
(drv_priv) (instance-0)
+---------------+ +-----------+ +----------------+
| ieee80211_vif | <---> | rtw89_vif | -------> | rtw89_vif_link |
+---------------+ +-----------+ | +----------------+
|
| (instance-1)
| +----------------+
+---> | rtw89_vif_link |
+----------------+
(drv_priv) (instance-0)
+---------------+ +-----------+ +----------------+
| ieee80211_sta | <---> | rtw89_sta | -------> | rtw89_sta_link |
+---------------+ +-----------+ | +----------------+
|
| (instance-1)
| +----------------+
+---> | rtw89_sta_link |
+----------------+
The relation bewteen mac80211 link_id and our link instance is like below.
|\
(link_id) | \
0 -------- | |
1 -------- | | ------ instance-0 (link_id: X) -> work on HW band 0
2 -------- | |
... | | ------ instance-1 (link_id: Y) -> work on HW band 1
14 -------- | |
| /
|/
N.B. For cases of non-MLD connection, we set our link instance-0
active with link_id 0. So, our code flow can be compatible between
non-MLD connection and MLD connection.
Based on above, we tweak entire driver architecture first. But, we don't
dynamically enable multiple links here. That will be handled separately.
Most of the things changed here are changing flows to iterate all active
links and read bss_conf/link_sta data according to target link. And, for
cases of scan, ROC, WOW, we use instance-0 to deal with the request.
There are some things listed below, which work for now but need to extend
before multiple active links.
1. tx path
select suitable link instance among multiple active links
2. rx path
determine rx link by PPDU instead of always link instance-0
3. CAM
apply MLD pairwise key to any active links dynamically
Besides, PS code cannot easily work along with tweaking architecture. With
supporting MLO flag (currently false), we disable PS first and will fix it
by another commit in the following.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20240916053158.47350-8-pkshih@realtek.com
2024-09-16 13:31:58 +08:00
|
|
|
rtw89_vif_for_each_link(rtwvif, rtwvif_link, link_id) {
|
|
|
|
rtwsta_link = rtwsta ? rtwsta->links[link_id] : NULL;
|
|
|
|
if (rtwsta && !rtwsta_link)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
ret = __rtw89_cam_detach_sec_cam(rtwdev, rtwvif_link, rtwsta_link,
|
|
|
|
sec_cam, inform_fw);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rtw89_cam_attach_sec_cam(struct rtw89_dev *rtwdev,
|
|
|
|
struct ieee80211_vif *vif,
|
|
|
|
struct ieee80211_sta *sta,
|
|
|
|
struct ieee80211_key_conf *key,
|
|
|
|
struct rtw89_sec_cam_entry *sec_cam)
|
|
|
|
{
|
|
|
|
struct rtw89_sta *rtwsta = sta_to_rtwsta_safe(sta);
|
|
|
|
struct rtw89_sta_link *rtwsta_link;
|
|
|
|
struct rtw89_vif_link *rtwvif_link;
|
|
|
|
struct rtw89_vif *rtwvif;
|
|
|
|
unsigned int link_id;
|
|
|
|
int key_link_id;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (!vif) {
|
|
|
|
rtw89_err(rtwdev, "No iface for adding sec cam\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
rtwvif = vif_to_rtwvif(vif);
|
|
|
|
|
|
|
|
key_link_id = ieee80211_vif_is_mld(vif) ? key->link_id : 0;
|
|
|
|
if (key_link_id >= 0) {
|
|
|
|
rtwvif_link = rtwvif->links[key_link_id];
|
|
|
|
rtwsta_link = rtwsta ? rtwsta->links[key_link_id] : NULL;
|
|
|
|
|
|
|
|
if (!rtwvif_link || (rtwsta && !rtwsta_link)) {
|
|
|
|
rtw89_err(rtwdev, "No drv link for adding sec cam\n");
|
|
|
|
return -ENOLINK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return __rtw89_cam_attach_sec_cam(rtwdev, rtwvif_link,
|
|
|
|
rtwsta_link, key, sec_cam);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* key_link_id < 0: MLD pairwise key */
|
|
|
|
if (!rtwsta) {
|
|
|
|
rtw89_err(rtwdev, "No sta for adding MLD pairwise sec cam\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
rtw89_sta_for_each_link(rtwsta, rtwsta_link, link_id) {
|
|
|
|
rtwvif_link = rtwsta_link->rtwvif_link;
|
|
|
|
ret = __rtw89_cam_attach_sec_cam(rtwdev, rtwvif_link,
|
|
|
|
rtwsta_link, key, sec_cam);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2024-11-20 11:40:52 +08:00
|
|
|
set_bit(sec_cam->sec_cam_idx, rtwsta->pairwise_sec_cam_map);
|
|
|
|
|
wifi: rtw89: tweak driver architecture for impending MLO support
The drv_priv hooked to mac80211 become as below.
(drv_priv) (instance-0)
+---------------+ +-----------+ +----------------+
| ieee80211_vif | <---> | rtw89_vif | -------> | rtw89_vif_link |
+---------------+ +-----------+ | +----------------+
|
| (instance-1)
| +----------------+
+---> | rtw89_vif_link |
+----------------+
(drv_priv) (instance-0)
+---------------+ +-----------+ +----------------+
| ieee80211_sta | <---> | rtw89_sta | -------> | rtw89_sta_link |
+---------------+ +-----------+ | +----------------+
|
| (instance-1)
| +----------------+
+---> | rtw89_sta_link |
+----------------+
The relation bewteen mac80211 link_id and our link instance is like below.
|\
(link_id) | \
0 -------- | |
1 -------- | | ------ instance-0 (link_id: X) -> work on HW band 0
2 -------- | |
... | | ------ instance-1 (link_id: Y) -> work on HW band 1
14 -------- | |
| /
|/
N.B. For cases of non-MLD connection, we set our link instance-0
active with link_id 0. So, our code flow can be compatible between
non-MLD connection and MLD connection.
Based on above, we tweak entire driver architecture first. But, we don't
dynamically enable multiple links here. That will be handled separately.
Most of the things changed here are changing flows to iterate all active
links and read bss_conf/link_sta data according to target link. And, for
cases of scan, ROC, WOW, we use instance-0 to deal with the request.
There are some things listed below, which work for now but need to extend
before multiple active links.
1. tx path
select suitable link instance among multiple active links
2. rx path
determine rx link by PPDU instead of always link instance-0
3. CAM
apply MLD pairwise key to any active links dynamically
Besides, PS code cannot easily work along with tweaking architecture. With
supporting MLO flag (currently false), we disable PS first and will fix it
by another commit in the following.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20240916053158.47350-8-pkshih@realtek.com
2024-09-16 13:31:58 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
static int rtw89_cam_sec_key_install(struct rtw89_dev *rtwdev,
|
|
|
|
struct ieee80211_vif *vif,
|
|
|
|
struct ieee80211_sta *sta,
|
|
|
|
struct ieee80211_key_conf *key,
|
|
|
|
u8 hw_key_type, bool ext_key)
|
|
|
|
{
|
|
|
|
struct rtw89_sec_cam_entry *sec_cam = NULL;
|
|
|
|
struct rtw89_cam_info *cam_info = &rtwdev->cam_info;
|
|
|
|
u8 sec_cam_idx;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* maximum key length 256-bit */
|
|
|
|
if (key->keylen > 32) {
|
|
|
|
rtw89_err(rtwdev, "invalid sec key length %d\n", key->keylen);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = rtw89_cam_get_avail_sec_cam(rtwdev, &sec_cam_idx, ext_key);
|
|
|
|
if (ret) {
|
|
|
|
rtw89_warn(rtwdev, "no available sec cam: %d ext: %d\n",
|
|
|
|
ret, ext_key);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
sec_cam = kzalloc(sizeof(*sec_cam), GFP_KERNEL);
|
|
|
|
if (!sec_cam) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto err_release_cam;
|
|
|
|
}
|
|
|
|
|
2024-05-09 17:06:44 +08:00
|
|
|
key->hw_key_idx = sec_cam_idx;
|
|
|
|
cam_info->sec_entries[sec_cam_idx] = sec_cam;
|
|
|
|
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
sec_cam->sec_cam_idx = sec_cam_idx;
|
|
|
|
sec_cam->type = hw_key_type;
|
|
|
|
sec_cam->len = RTW89_SEC_CAM_LEN;
|
|
|
|
sec_cam->ext_key = ext_key;
|
|
|
|
memcpy(sec_cam->key, key->key, key->keylen);
|
2024-11-20 11:40:52 +08:00
|
|
|
|
|
|
|
sec_cam->key_conf = key;
|
|
|
|
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
ret = rtw89_cam_send_sec_key_cmd(rtwdev, sec_cam);
|
|
|
|
if (ret) {
|
|
|
|
rtw89_err(rtwdev, "failed to send sec key cmd: %d\n", ret);
|
|
|
|
goto err_release_cam;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* associate with addr cam */
|
|
|
|
ret = rtw89_cam_attach_sec_cam(rtwdev, vif, sta, key, sec_cam);
|
|
|
|
if (ret) {
|
|
|
|
rtw89_err(rtwdev, "failed to attach sec cam: %d\n", ret);
|
|
|
|
goto err_release_cam;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_release_cam:
|
2024-05-09 17:06:44 +08:00
|
|
|
cam_info->sec_entries[sec_cam_idx] = NULL;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
kfree(sec_cam);
|
|
|
|
clear_bit(sec_cam_idx, cam_info->sec_cam_map);
|
|
|
|
if (ext_key)
|
|
|
|
clear_bit(sec_cam_idx + 1, cam_info->sec_cam_map);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
int rtw89_cam_sec_key_add(struct rtw89_dev *rtwdev,
|
|
|
|
struct ieee80211_vif *vif,
|
|
|
|
struct ieee80211_sta *sta,
|
|
|
|
struct ieee80211_key_conf *key)
|
|
|
|
{
|
2022-03-18 10:32:13 +08:00
|
|
|
const struct rtw89_chip_info *chip = rtwdev->chip;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
u8 hw_key_type;
|
|
|
|
bool ext_key = false;
|
|
|
|
int ret;
|
|
|
|
|
2025-04-28 19:24:48 +08:00
|
|
|
if (ieee80211_vif_is_mld(vif) && !chip->hw_mlo_bmc_crypto &&
|
|
|
|
!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE))
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
switch (key->cipher) {
|
|
|
|
case WLAN_CIPHER_SUITE_WEP40:
|
2025-05-07 11:12:03 +08:00
|
|
|
rtw89_leave_ips_by_hwflags(rtwdev);
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
hw_key_type = RTW89_SEC_KEY_TYPE_WEP40;
|
|
|
|
break;
|
|
|
|
case WLAN_CIPHER_SUITE_WEP104:
|
2025-05-07 11:12:03 +08:00
|
|
|
rtw89_leave_ips_by_hwflags(rtwdev);
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
hw_key_type = RTW89_SEC_KEY_TYPE_WEP104;
|
|
|
|
break;
|
2025-02-20 14:23:44 +08:00
|
|
|
case WLAN_CIPHER_SUITE_TKIP:
|
|
|
|
if (!chip->hw_tkip_crypto)
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
hw_key_type = RTW89_SEC_KEY_TYPE_TKIP;
|
|
|
|
key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
|
|
|
|
break;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
case WLAN_CIPHER_SUITE_CCMP:
|
|
|
|
hw_key_type = RTW89_SEC_KEY_TYPE_CCMP128;
|
2024-07-31 15:05:05 +08:00
|
|
|
if (!chip->hw_mgmt_tx_encrypt)
|
|
|
|
key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
break;
|
|
|
|
case WLAN_CIPHER_SUITE_CCMP_256:
|
|
|
|
hw_key_type = RTW89_SEC_KEY_TYPE_CCMP256;
|
2024-07-31 15:05:05 +08:00
|
|
|
if (!chip->hw_mgmt_tx_encrypt)
|
|
|
|
key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
ext_key = true;
|
|
|
|
break;
|
|
|
|
case WLAN_CIPHER_SUITE_GCMP:
|
|
|
|
hw_key_type = RTW89_SEC_KEY_TYPE_GCMP128;
|
2024-07-31 15:05:05 +08:00
|
|
|
if (!chip->hw_mgmt_tx_encrypt)
|
|
|
|
key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
break;
|
|
|
|
case WLAN_CIPHER_SUITE_GCMP_256:
|
|
|
|
hw_key_type = RTW89_SEC_KEY_TYPE_GCMP256;
|
2024-07-31 15:05:05 +08:00
|
|
|
if (!chip->hw_mgmt_tx_encrypt)
|
|
|
|
key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
ext_key = true;
|
|
|
|
break;
|
2024-05-02 10:25:03 +08:00
|
|
|
case WLAN_CIPHER_SUITE_AES_CMAC:
|
|
|
|
hw_key_type = RTW89_SEC_KEY_TYPE_BIP_CCMP128;
|
|
|
|
break;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
default:
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
2022-03-18 10:32:13 +08:00
|
|
|
if (!chip->hw_sec_hdr)
|
|
|
|
key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
|
|
|
|
ret = rtw89_cam_sec_key_install(rtwdev, vif, sta, key, hw_key_type,
|
|
|
|
ext_key);
|
|
|
|
if (ret) {
|
|
|
|
rtw89_err(rtwdev, "failed to install key type %d ext %d: %d\n",
|
|
|
|
hw_key_type, ext_key, ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int rtw89_cam_sec_key_del(struct rtw89_dev *rtwdev,
|
|
|
|
struct ieee80211_vif *vif,
|
|
|
|
struct ieee80211_sta *sta,
|
|
|
|
struct ieee80211_key_conf *key,
|
|
|
|
bool inform_fw)
|
|
|
|
{
|
|
|
|
struct rtw89_cam_info *cam_info = &rtwdev->cam_info;
|
2024-05-09 17:06:44 +08:00
|
|
|
const struct rtw89_sec_cam_entry *sec_cam;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
u8 sec_cam_idx;
|
2024-05-09 17:06:44 +08:00
|
|
|
int ret;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
|
2024-05-09 17:06:44 +08:00
|
|
|
sec_cam_idx = key->hw_key_idx;
|
|
|
|
sec_cam = cam_info->sec_entries[sec_cam_idx];
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
if (!sec_cam)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2024-05-09 17:06:44 +08:00
|
|
|
ret = rtw89_cam_detach_sec_cam(rtwdev, vif, sta, sec_cam, inform_fw);
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
|
|
|
|
/* clear valid bit in addr cam will disable sec cam,
|
|
|
|
* so we don't need to send H2C command again
|
|
|
|
*/
|
2024-05-09 17:06:44 +08:00
|
|
|
cam_info->sec_entries[sec_cam_idx] = NULL;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
clear_bit(sec_cam_idx, cam_info->sec_cam_map);
|
|
|
|
if (sec_cam->ext_key)
|
|
|
|
clear_bit(sec_cam_idx + 1, cam_info->sec_cam_map);
|
|
|
|
|
|
|
|
kfree(sec_cam);
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
rtw89_cam_sec_key_del(rtwdev, vif, sta, key, false);
|
|
|
|
}
|
|
|
|
|
2022-01-07 11:42:32 +08:00
|
|
|
void rtw89_cam_deinit_addr_cam(struct rtw89_dev *rtwdev,
|
|
|
|
struct rtw89_addr_cam_entry *addr_cam)
|
|
|
|
{
|
|
|
|
struct rtw89_cam_info *cam_info = &rtwdev->cam_info;
|
|
|
|
|
|
|
|
addr_cam->valid = false;
|
|
|
|
clear_bit(addr_cam->addr_cam_idx, cam_info->addr_cam_map);
|
|
|
|
}
|
|
|
|
|
2022-06-10 15:26:01 +08:00
|
|
|
void rtw89_cam_deinit_bssid_cam(struct rtw89_dev *rtwdev,
|
|
|
|
struct rtw89_bssid_cam_entry *bssid_cam)
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
{
|
|
|
|
struct rtw89_cam_info *cam_info = &rtwdev->cam_info;
|
2022-06-10 15:26:01 +08:00
|
|
|
|
|
|
|
bssid_cam->valid = false;
|
|
|
|
clear_bit(bssid_cam->bssid_cam_idx, cam_info->bssid_cam_map);
|
|
|
|
}
|
|
|
|
|
2024-09-16 13:31:52 +08:00
|
|
|
void rtw89_cam_deinit(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvif_link)
|
2022-06-10 15:26:01 +08:00
|
|
|
{
|
2024-09-16 13:31:52 +08:00
|
|
|
struct rtw89_addr_cam_entry *addr_cam = &rtwvif_link->addr_cam;
|
|
|
|
struct rtw89_bssid_cam_entry *bssid_cam = &rtwvif_link->bssid_cam;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
|
2022-01-07 11:42:32 +08:00
|
|
|
rtw89_cam_deinit_addr_cam(rtwdev, addr_cam);
|
2022-06-10 15:26:01 +08:00
|
|
|
rtw89_cam_deinit_bssid_cam(rtwdev, bssid_cam);
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
const struct rtw89_chip_info *chip = rtwdev->chip;
|
|
|
|
struct rtw89_cam_info *cam_info = &rtwdev->cam_info;
|
|
|
|
u8 addr_cam_num = chip->acam_num;
|
|
|
|
u8 idx;
|
|
|
|
|
|
|
|
idx = find_first_zero_bit(cam_info->addr_cam_map, addr_cam_num);
|
|
|
|
if (idx >= addr_cam_num)
|
|
|
|
return -EBUSY;
|
|
|
|
|
|
|
|
set_bit(idx, cam_info->addr_cam_map);
|
|
|
|
*addr_cam_idx = idx;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-10-27 09:50:56 +08:00
|
|
|
static u8 rtw89_get_addr_cam_entry_size(struct rtw89_dev *rtwdev)
|
|
|
|
{
|
|
|
|
const struct rtw89_chip_info *chip = rtwdev->chip;
|
|
|
|
|
|
|
|
switch (chip->chip_id) {
|
|
|
|
case RTL8852A:
|
|
|
|
case RTL8852B:
|
|
|
|
case RTL8851B:
|
2024-06-07 15:06:59 +08:00
|
|
|
case RTL8852BT:
|
2023-10-27 09:50:56 +08:00
|
|
|
return ADDR_CAM_ENT_SIZE;
|
|
|
|
default:
|
|
|
|
return ADDR_CAM_ENT_SHORT_SIZE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-07 11:42:32 +08:00
|
|
|
int rtw89_cam_init_addr_cam(struct rtw89_dev *rtwdev,
|
|
|
|
struct rtw89_addr_cam_entry *addr_cam,
|
|
|
|
const struct rtw89_bssid_cam_entry *bssid_cam)
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
{
|
|
|
|
u8 addr_cam_idx;
|
|
|
|
int i;
|
|
|
|
int ret;
|
|
|
|
|
2022-03-14 15:12:43 +08:00
|
|
|
if (unlikely(addr_cam->valid)) {
|
|
|
|
rtw89_debug(rtwdev, RTW89_DBG_FW,
|
|
|
|
"addr cam is already valid; skip init\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
ret = rtw89_cam_get_avail_addr_cam(rtwdev, &addr_cam_idx);
|
|
|
|
if (ret) {
|
|
|
|
rtw89_err(rtwdev, "failed to get available addr cam\n");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
addr_cam->addr_cam_idx = addr_cam_idx;
|
2023-10-27 09:50:56 +08:00
|
|
|
addr_cam->len = rtw89_get_addr_cam_entry_size(rtwdev);
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
addr_cam->offset = 0;
|
|
|
|
addr_cam->valid = true;
|
|
|
|
addr_cam->addr_mask = 0;
|
|
|
|
addr_cam->mask_sel = RTW89_NO_MSK;
|
2022-01-07 11:42:32 +08:00
|
|
|
addr_cam->sec_ent_mode = RTW89_ADDR_CAM_SEC_NORMAL;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
bitmap_zero(addr_cam->sec_cam_map, RTW89_SEC_CAM_IN_ADDR_CAM);
|
|
|
|
|
|
|
|
for (i = 0; i < RTW89_SEC_CAM_IN_ADDR_CAM; i++) {
|
|
|
|
addr_cam->sec_ent_keyid[i] = 0;
|
|
|
|
addr_cam->sec_ent[i] = 0;
|
|
|
|
}
|
|
|
|
|
2022-01-07 11:42:32 +08:00
|
|
|
/* associate addr cam with bssid cam */
|
|
|
|
addr_cam->bssid_cam_idx = bssid_cam->bssid_cam_idx;
|
|
|
|
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rtw89_cam_get_avail_bssid_cam(struct rtw89_dev *rtwdev,
|
|
|
|
u8 *bssid_cam_idx)
|
|
|
|
{
|
|
|
|
const struct rtw89_chip_info *chip = rtwdev->chip;
|
|
|
|
struct rtw89_cam_info *cam_info = &rtwdev->cam_info;
|
|
|
|
u8 bssid_cam_num = chip->bcam_num;
|
|
|
|
u8 idx;
|
|
|
|
|
|
|
|
idx = find_first_zero_bit(cam_info->bssid_cam_map, bssid_cam_num);
|
|
|
|
if (idx >= bssid_cam_num)
|
|
|
|
return -EBUSY;
|
|
|
|
|
|
|
|
set_bit(idx, cam_info->bssid_cam_map);
|
|
|
|
*bssid_cam_idx = idx;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-06-10 15:26:01 +08:00
|
|
|
int rtw89_cam_init_bssid_cam(struct rtw89_dev *rtwdev,
|
2024-09-16 13:31:52 +08:00
|
|
|
struct rtw89_vif_link *rtwvif_link,
|
2022-06-10 15:26:01 +08:00
|
|
|
struct rtw89_bssid_cam_entry *bssid_cam,
|
|
|
|
const u8 *bssid)
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
{
|
|
|
|
u8 bssid_cam_idx;
|
|
|
|
int ret;
|
|
|
|
|
2022-03-14 15:12:43 +08:00
|
|
|
if (unlikely(bssid_cam->valid)) {
|
|
|
|
rtw89_debug(rtwdev, RTW89_DBG_FW,
|
|
|
|
"bssid cam is already valid; skip init\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
ret = rtw89_cam_get_avail_bssid_cam(rtwdev, &bssid_cam_idx);
|
|
|
|
if (ret) {
|
|
|
|
rtw89_err(rtwdev, "failed to get available bssid cam\n");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
bssid_cam->bssid_cam_idx = bssid_cam_idx;
|
2024-09-16 13:31:52 +08:00
|
|
|
bssid_cam->phy_idx = rtwvif_link->phy_idx;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
bssid_cam->len = BSSID_CAM_ENT_SIZE;
|
|
|
|
bssid_cam->offset = 0;
|
|
|
|
bssid_cam->valid = true;
|
2022-06-10 15:26:01 +08:00
|
|
|
ether_addr_copy(bssid_cam->bssid, bssid);
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2024-09-16 13:31:52 +08:00
|
|
|
void rtw89_cam_bssid_changed(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvif_link)
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
{
|
2024-09-16 13:31:52 +08:00
|
|
|
struct rtw89_bssid_cam_entry *bssid_cam = &rtwvif_link->bssid_cam;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
|
2024-09-16 13:31:52 +08:00
|
|
|
ether_addr_copy(bssid_cam->bssid, rtwvif_link->bssid);
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
}
|
|
|
|
|
2024-09-16 13:31:52 +08:00
|
|
|
int rtw89_cam_init(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvif_link)
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
{
|
2024-09-16 13:31:52 +08:00
|
|
|
struct rtw89_addr_cam_entry *addr_cam = &rtwvif_link->addr_cam;
|
|
|
|
struct rtw89_bssid_cam_entry *bssid_cam = &rtwvif_link->bssid_cam;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
int ret;
|
|
|
|
|
2024-09-16 13:31:52 +08:00
|
|
|
ret = rtw89_cam_init_bssid_cam(rtwdev, rtwvif_link, bssid_cam,
|
|
|
|
rtwvif_link->bssid);
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
if (ret) {
|
2022-01-07 11:42:32 +08:00
|
|
|
rtw89_err(rtwdev, "failed to init bssid cam\n");
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2022-01-07 11:42:32 +08:00
|
|
|
ret = rtw89_cam_init_addr_cam(rtwdev, addr_cam, bssid_cam);
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
if (ret) {
|
2022-01-07 11:42:32 +08:00
|
|
|
rtw89_err(rtwdev, "failed to init addr cam\n");
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int rtw89_cam_fill_bssid_cam_info(struct rtw89_dev *rtwdev,
|
2024-09-16 13:31:52 +08:00
|
|
|
struct rtw89_vif_link *rtwvif_link,
|
2024-09-16 13:31:53 +08:00
|
|
|
struct rtw89_sta_link *rtwsta_link, u8 *cmd)
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
{
|
2024-09-16 13:31:52 +08:00
|
|
|
struct rtw89_bssid_cam_entry *bssid_cam = rtw89_get_bssid_cam_of(rtwvif_link,
|
2024-09-16 13:31:53 +08:00
|
|
|
rtwsta_link);
|
2024-09-16 13:31:54 +08:00
|
|
|
struct ieee80211_bss_conf *bss_conf;
|
|
|
|
u8 bss_color;
|
2022-05-30 19:27:43 +08:00
|
|
|
u8 bss_mask;
|
|
|
|
|
2024-09-16 13:31:54 +08:00
|
|
|
rcu_read_lock();
|
|
|
|
|
|
|
|
bss_conf = rtw89_vif_rcu_dereference_link(rtwvif_link, false);
|
|
|
|
bss_color = bss_conf->he_bss_color.color;
|
|
|
|
|
|
|
|
if (bss_conf->nontransmitted)
|
2022-05-30 19:27:43 +08:00
|
|
|
bss_mask = RTW89_BSSID_MATCH_5_BYTES;
|
|
|
|
else
|
|
|
|
bss_mask = RTW89_BSSID_MATCH_ALL;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
|
2024-09-16 13:31:54 +08:00
|
|
|
rcu_read_unlock();
|
|
|
|
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
FWCMD_SET_ADDR_BSSID_IDX(cmd, bssid_cam->bssid_cam_idx);
|
|
|
|
FWCMD_SET_ADDR_BSSID_OFFSET(cmd, bssid_cam->offset);
|
|
|
|
FWCMD_SET_ADDR_BSSID_LEN(cmd, bssid_cam->len);
|
|
|
|
FWCMD_SET_ADDR_BSSID_VALID(cmd, bssid_cam->valid);
|
2022-05-30 19:27:43 +08:00
|
|
|
FWCMD_SET_ADDR_BSSID_MASK(cmd, bss_mask);
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
FWCMD_SET_ADDR_BSSID_BB_SEL(cmd, bssid_cam->phy_idx);
|
|
|
|
FWCMD_SET_ADDR_BSSID_BSS_COLOR(cmd, bss_color);
|
|
|
|
|
|
|
|
FWCMD_SET_ADDR_BSSID_BSSID0(cmd, bssid_cam->bssid[0]);
|
|
|
|
FWCMD_SET_ADDR_BSSID_BSSID1(cmd, bssid_cam->bssid[1]);
|
|
|
|
FWCMD_SET_ADDR_BSSID_BSSID2(cmd, bssid_cam->bssid[2]);
|
|
|
|
FWCMD_SET_ADDR_BSSID_BSSID3(cmd, bssid_cam->bssid[3]);
|
|
|
|
FWCMD_SET_ADDR_BSSID_BSSID4(cmd, bssid_cam->bssid[4]);
|
|
|
|
FWCMD_SET_ADDR_BSSID_BSSID5(cmd, bssid_cam->bssid[5]);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-11-11 10:37:05 +08:00
|
|
|
static u8 rtw89_cam_addr_hash(u8 start, const u8 *addr)
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
{
|
|
|
|
u8 hash = 0;
|
|
|
|
u8 i;
|
|
|
|
|
|
|
|
for (i = start; i < ETH_ALEN; i++)
|
|
|
|
hash ^= addr[i];
|
|
|
|
|
|
|
|
return hash;
|
|
|
|
}
|
|
|
|
|
|
|
|
void rtw89_cam_fill_addr_cam_info(struct rtw89_dev *rtwdev,
|
2024-09-16 13:31:52 +08:00
|
|
|
struct rtw89_vif_link *rtwvif_link,
|
2024-09-16 13:31:53 +08:00
|
|
|
struct rtw89_sta_link *rtwsta_link,
|
2021-11-11 10:37:05 +08:00
|
|
|
const u8 *scan_mac_addr,
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
u8 *cmd)
|
|
|
|
{
|
wifi: rtw89: tweak driver architecture for impending MLO support
The drv_priv hooked to mac80211 become as below.
(drv_priv) (instance-0)
+---------------+ +-----------+ +----------------+
| ieee80211_vif | <---> | rtw89_vif | -------> | rtw89_vif_link |
+---------------+ +-----------+ | +----------------+
|
| (instance-1)
| +----------------+
+---> | rtw89_vif_link |
+----------------+
(drv_priv) (instance-0)
+---------------+ +-----------+ +----------------+
| ieee80211_sta | <---> | rtw89_sta | -------> | rtw89_sta_link |
+---------------+ +-----------+ | +----------------+
|
| (instance-1)
| +----------------+
+---> | rtw89_sta_link |
+----------------+
The relation bewteen mac80211 link_id and our link instance is like below.
|\
(link_id) | \
0 -------- | |
1 -------- | | ------ instance-0 (link_id: X) -> work on HW band 0
2 -------- | |
... | | ------ instance-1 (link_id: Y) -> work on HW band 1
14 -------- | |
| /
|/
N.B. For cases of non-MLD connection, we set our link instance-0
active with link_id 0. So, our code flow can be compatible between
non-MLD connection and MLD connection.
Based on above, we tweak entire driver architecture first. But, we don't
dynamically enable multiple links here. That will be handled separately.
Most of the things changed here are changing flows to iterate all active
links and read bss_conf/link_sta data according to target link. And, for
cases of scan, ROC, WOW, we use instance-0 to deal with the request.
There are some things listed below, which work for now but need to extend
before multiple active links.
1. tx path
select suitable link instance among multiple active links
2. rx path
determine rx link by PPDU instead of always link instance-0
3. CAM
apply MLD pairwise key to any active links dynamically
Besides, PS code cannot easily work along with tweaking architecture. With
supporting MLO flag (currently false), we disable PS first and will fix it
by another commit in the following.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20240916053158.47350-8-pkshih@realtek.com
2024-09-16 13:31:58 +08:00
|
|
|
struct ieee80211_vif *vif = rtwvif_link_to_vif(rtwvif_link);
|
2024-09-16 13:31:52 +08:00
|
|
|
struct rtw89_addr_cam_entry *addr_cam =
|
2024-09-16 13:31:53 +08:00
|
|
|
rtw89_get_addr_cam_of(rtwvif_link, rtwsta_link);
|
wifi: rtw89: tweak driver architecture for impending MLO support
The drv_priv hooked to mac80211 become as below.
(drv_priv) (instance-0)
+---------------+ +-----------+ +----------------+
| ieee80211_vif | <---> | rtw89_vif | -------> | rtw89_vif_link |
+---------------+ +-----------+ | +----------------+
|
| (instance-1)
| +----------------+
+---> | rtw89_vif_link |
+----------------+
(drv_priv) (instance-0)
+---------------+ +-----------+ +----------------+
| ieee80211_sta | <---> | rtw89_sta | -------> | rtw89_sta_link |
+---------------+ +-----------+ | +----------------+
|
| (instance-1)
| +----------------+
+---> | rtw89_sta_link |
+----------------+
The relation bewteen mac80211 link_id and our link instance is like below.
|\
(link_id) | \
0 -------- | |
1 -------- | | ------ instance-0 (link_id: X) -> work on HW band 0
2 -------- | |
... | | ------ instance-1 (link_id: Y) -> work on HW band 1
14 -------- | |
| /
|/
N.B. For cases of non-MLD connection, we set our link instance-0
active with link_id 0. So, our code flow can be compatible between
non-MLD connection and MLD connection.
Based on above, we tweak entire driver architecture first. But, we don't
dynamically enable multiple links here. That will be handled separately.
Most of the things changed here are changing flows to iterate all active
links and read bss_conf/link_sta data according to target link. And, for
cases of scan, ROC, WOW, we use instance-0 to deal with the request.
There are some things listed below, which work for now but need to extend
before multiple active links.
1. tx path
select suitable link instance among multiple active links
2. rx path
determine rx link by PPDU instead of always link instance-0
3. CAM
apply MLD pairwise key to any active links dynamically
Besides, PS code cannot easily work along with tweaking architecture. With
supporting MLO flag (currently false), we disable PS first and will fix it
by another commit in the following.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20240916053158.47350-8-pkshih@realtek.com
2024-09-16 13:31:58 +08:00
|
|
|
struct ieee80211_sta *sta = rtwsta_link_to_sta_safe(rtwsta_link);
|
2024-09-16 13:31:55 +08:00
|
|
|
struct ieee80211_link_sta *link_sta;
|
2024-09-16 13:31:52 +08:00
|
|
|
const u8 *sma = scan_mac_addr ? scan_mac_addr : rtwvif_link->mac_addr;
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
u8 sma_hash, tma_hash, addr_msk_start;
|
|
|
|
u8 sma_start = 0;
|
|
|
|
u8 tma_start = 0;
|
2024-09-16 13:31:55 +08:00
|
|
|
const u8 *tma;
|
|
|
|
|
|
|
|
rcu_read_lock();
|
|
|
|
|
|
|
|
if (sta) {
|
|
|
|
link_sta = rtw89_sta_rcu_dereference_link(rtwsta_link, true);
|
|
|
|
tma = link_sta->addr;
|
|
|
|
} else {
|
|
|
|
tma = rtwvif_link->bssid;
|
|
|
|
}
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
|
|
|
|
if (addr_cam->addr_mask != 0) {
|
|
|
|
addr_msk_start = __ffs(addr_cam->addr_mask);
|
|
|
|
if (addr_cam->mask_sel == RTW89_SMA)
|
|
|
|
sma_start = addr_msk_start;
|
|
|
|
else if (addr_cam->mask_sel == RTW89_TMA)
|
|
|
|
tma_start = addr_msk_start;
|
|
|
|
}
|
2021-11-11 10:37:05 +08:00
|
|
|
sma_hash = rtw89_cam_addr_hash(sma_start, sma);
|
2021-12-01 16:06:06 +08:00
|
|
|
tma_hash = rtw89_cam_addr_hash(tma_start, tma);
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
|
|
|
|
FWCMD_SET_ADDR_IDX(cmd, addr_cam->addr_cam_idx);
|
|
|
|
FWCMD_SET_ADDR_OFFSET(cmd, addr_cam->offset);
|
|
|
|
FWCMD_SET_ADDR_LEN(cmd, addr_cam->len);
|
|
|
|
|
|
|
|
FWCMD_SET_ADDR_VALID(cmd, addr_cam->valid);
|
2024-09-16 13:31:52 +08:00
|
|
|
FWCMD_SET_ADDR_NET_TYPE(cmd, rtwvif_link->net_type);
|
|
|
|
FWCMD_SET_ADDR_BCN_HIT_COND(cmd, rtwvif_link->bcn_hit_cond);
|
|
|
|
FWCMD_SET_ADDR_HIT_RULE(cmd, rtwvif_link->hit_rule);
|
|
|
|
FWCMD_SET_ADDR_BB_SEL(cmd, rtwvif_link->phy_idx);
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
FWCMD_SET_ADDR_ADDR_MASK(cmd, addr_cam->addr_mask);
|
|
|
|
FWCMD_SET_ADDR_MASK_SEL(cmd, addr_cam->mask_sel);
|
|
|
|
FWCMD_SET_ADDR_SMA_HASH(cmd, sma_hash);
|
|
|
|
FWCMD_SET_ADDR_TMA_HASH(cmd, tma_hash);
|
|
|
|
|
|
|
|
FWCMD_SET_ADDR_BSSID_CAM_IDX(cmd, addr_cam->bssid_cam_idx);
|
|
|
|
|
2021-11-11 10:37:05 +08:00
|
|
|
FWCMD_SET_ADDR_SMA0(cmd, sma[0]);
|
|
|
|
FWCMD_SET_ADDR_SMA1(cmd, sma[1]);
|
|
|
|
FWCMD_SET_ADDR_SMA2(cmd, sma[2]);
|
|
|
|
FWCMD_SET_ADDR_SMA3(cmd, sma[3]);
|
|
|
|
FWCMD_SET_ADDR_SMA4(cmd, sma[4]);
|
|
|
|
FWCMD_SET_ADDR_SMA5(cmd, sma[5]);
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
|
2021-12-01 16:06:06 +08:00
|
|
|
FWCMD_SET_ADDR_TMA0(cmd, tma[0]);
|
|
|
|
FWCMD_SET_ADDR_TMA1(cmd, tma[1]);
|
|
|
|
FWCMD_SET_ADDR_TMA2(cmd, tma[2]);
|
|
|
|
FWCMD_SET_ADDR_TMA3(cmd, tma[3]);
|
|
|
|
FWCMD_SET_ADDR_TMA4(cmd, tma[4]);
|
|
|
|
FWCMD_SET_ADDR_TMA5(cmd, tma[5]);
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
|
2024-09-16 13:31:52 +08:00
|
|
|
FWCMD_SET_ADDR_PORT_INT(cmd, rtwvif_link->port);
|
|
|
|
FWCMD_SET_ADDR_TSF_SYNC(cmd, rtwvif_link->port);
|
|
|
|
FWCMD_SET_ADDR_TF_TRS(cmd, rtwvif_link->trigger);
|
|
|
|
FWCMD_SET_ADDR_LSIG_TXOP(cmd, rtwvif_link->lsig_txop);
|
|
|
|
FWCMD_SET_ADDR_TGT_IND(cmd, rtwvif_link->tgt_ind);
|
|
|
|
FWCMD_SET_ADDR_FRM_TGT_IND(cmd, rtwvif_link->frm_tgt_ind);
|
2024-09-16 13:31:53 +08:00
|
|
|
FWCMD_SET_ADDR_MACID(cmd, rtwsta_link ? rtwsta_link->mac_id :
|
|
|
|
rtwvif_link->mac_id);
|
2024-09-16 13:31:52 +08:00
|
|
|
if (rtwvif_link->net_type == RTW89_NET_TYPE_INFRA)
|
wifi: mac80211: move interface config to new struct
We'll use bss_conf for per-link configuration later, so
move out all the non-link-specific data out into a new
struct ieee80211_vif_cfg used in the vif.
Some adjustments were done with the following spatch:
@@
expression sdata;
struct ieee80211_vif *vifp;
identifier var = { assoc, ibss_joined, aid, arp_addr_list, arp_addr_cnt, ssid, ssid_len, s1g, ibss_creator };
@@
(
-sdata->vif.bss_conf.var
+sdata->vif.cfg.var
|
-vifp->bss_conf.var
+vifp->cfg.var
)
@bss_conf@
struct ieee80211_bss_conf *bss_conf;
identifier var = { assoc, ibss_joined, aid, arp_addr_list, arp_addr_cnt, ssid, ssid_len, s1g, ibss_creator };
@@
-bss_conf->var
+vif_cfg->var
(though more manual fixups were needed, e.g. replacing
"vif_cfg->" by "vif->cfg." in many files.)
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-05-10 17:05:04 +02:00
|
|
|
FWCMD_SET_ADDR_AID12(cmd, vif->cfg.aid & 0xfff);
|
2024-09-16 13:31:52 +08:00
|
|
|
else if (rtwvif_link->net_type == RTW89_NET_TYPE_AP_MODE)
|
2021-12-01 16:06:06 +08:00
|
|
|
FWCMD_SET_ADDR_AID12(cmd, sta ? sta->aid & 0xfff : 0);
|
2024-09-16 13:31:52 +08:00
|
|
|
FWCMD_SET_ADDR_WOL_PATTERN(cmd, rtwvif_link->wowlan_pattern);
|
|
|
|
FWCMD_SET_ADDR_WOL_UC(cmd, rtwvif_link->wowlan_uc);
|
|
|
|
FWCMD_SET_ADDR_WOL_MAGIC(cmd, rtwvif_link->wowlan_magic);
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
FWCMD_SET_ADDR_WAPI(cmd, addr_cam->wapi);
|
|
|
|
FWCMD_SET_ADDR_SEC_ENT_MODE(cmd, addr_cam->sec_ent_mode);
|
|
|
|
FWCMD_SET_ADDR_SEC_ENT0_KEYID(cmd, addr_cam->sec_ent_keyid[0]);
|
|
|
|
FWCMD_SET_ADDR_SEC_ENT1_KEYID(cmd, addr_cam->sec_ent_keyid[1]);
|
|
|
|
FWCMD_SET_ADDR_SEC_ENT2_KEYID(cmd, addr_cam->sec_ent_keyid[2]);
|
|
|
|
FWCMD_SET_ADDR_SEC_ENT3_KEYID(cmd, addr_cam->sec_ent_keyid[3]);
|
|
|
|
FWCMD_SET_ADDR_SEC_ENT4_KEYID(cmd, addr_cam->sec_ent_keyid[4]);
|
|
|
|
FWCMD_SET_ADDR_SEC_ENT5_KEYID(cmd, addr_cam->sec_ent_keyid[5]);
|
|
|
|
FWCMD_SET_ADDR_SEC_ENT6_KEYID(cmd, addr_cam->sec_ent_keyid[6]);
|
|
|
|
|
|
|
|
FWCMD_SET_ADDR_SEC_ENT_VALID(cmd, addr_cam->sec_cam_map[0] & 0xff);
|
|
|
|
FWCMD_SET_ADDR_SEC_ENT0(cmd, addr_cam->sec_ent[0]);
|
|
|
|
FWCMD_SET_ADDR_SEC_ENT1(cmd, addr_cam->sec_ent[1]);
|
|
|
|
FWCMD_SET_ADDR_SEC_ENT2(cmd, addr_cam->sec_ent[2]);
|
|
|
|
FWCMD_SET_ADDR_SEC_ENT3(cmd, addr_cam->sec_ent[3]);
|
|
|
|
FWCMD_SET_ADDR_SEC_ENT4(cmd, addr_cam->sec_ent[4]);
|
|
|
|
FWCMD_SET_ADDR_SEC_ENT5(cmd, addr_cam->sec_ent[5]);
|
|
|
|
FWCMD_SET_ADDR_SEC_ENT6(cmd, addr_cam->sec_ent[6]);
|
2024-09-16 13:31:55 +08:00
|
|
|
|
|
|
|
rcu_read_unlock();
|
rtw89: add Realtek 802.11ax driver
This driver named rtw89, which is the next generation of rtw88, supports
Realtek 8852AE 802.11ax 2x2 chip whose new features are OFDMA, DBCC,
Spatial reuse, TWT and BSS coloring; now some of them aren't implemented
though.
The chip architecture is entirely different from the chips supported by
rtw88 like RTL8822CE 802.11ac chip. First of all, register address ranges
are totally redefined, so it's impossible to reuse register definition. To
communicate with firmware, new H2C/C2H format is proposed. In order to have
better utilization, TX DMA flow is changed to two stages DMA. To provide
rich RX status information, additional RX PPDU packets are added.
Since there are so many differences mentioned above, we decide to propose
a new driver. It has many authors, they are listed in alphabetic order:
Chin-Yen Lee <timlee@realtek.com>
Ping-Ke Shih <pkshih@realtek.com>
Po Hao Huang <phhuang@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Vincent Fann <vincent_fann@realtek.com>
Yan-Hsuan Chuang <tony0620emma@gmail.com>
Zong-Zhe Yang <kevin_yang@realtek.com>
Tested-by: Aaron Ma <aaron.ma@canonical.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211008035627.19463-1-pkshih@realtek.com
2021-10-11 14:47:27 +03:00
|
|
|
}
|
2022-04-13 09:08:02 +08:00
|
|
|
|
|
|
|
void rtw89_cam_fill_dctl_sec_cam_info_v1(struct rtw89_dev *rtwdev,
|
2024-09-16 13:31:52 +08:00
|
|
|
struct rtw89_vif_link *rtwvif_link,
|
2024-09-16 13:31:53 +08:00
|
|
|
struct rtw89_sta_link *rtwsta_link,
|
2024-05-02 10:24:58 +08:00
|
|
|
struct rtw89_h2c_dctlinfo_ud_v1 *h2c)
|
2022-04-13 09:08:02 +08:00
|
|
|
{
|
2024-09-16 13:31:52 +08:00
|
|
|
struct rtw89_addr_cam_entry *addr_cam =
|
2024-09-16 13:31:53 +08:00
|
|
|
rtw89_get_addr_cam_of(rtwvif_link, rtwsta_link);
|
2024-05-02 10:25:01 +08:00
|
|
|
struct rtw89_wow_param *rtw_wow = &rtwdev->wow;
|
|
|
|
u8 *ptk_tx_iv = rtw_wow->key_info.ptk_tx_iv;
|
2022-04-13 09:08:02 +08:00
|
|
|
|
2024-09-16 13:31:53 +08:00
|
|
|
h2c->c0 = le32_encode_bits(rtwsta_link ? rtwsta_link->mac_id :
|
|
|
|
rtwvif_link->mac_id,
|
2024-05-02 10:24:58 +08:00
|
|
|
DCTLINFO_V1_C0_MACID) |
|
|
|
|
le32_encode_bits(1, DCTLINFO_V1_C0_OP);
|
|
|
|
|
|
|
|
h2c->w4 = le32_encode_bits(addr_cam->sec_ent_keyid[0],
|
|
|
|
DCTLINFO_V1_W4_SEC_ENT0_KEYID) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent_keyid[1],
|
|
|
|
DCTLINFO_V1_W4_SEC_ENT1_KEYID) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent_keyid[2],
|
|
|
|
DCTLINFO_V1_W4_SEC_ENT2_KEYID) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent_keyid[3],
|
|
|
|
DCTLINFO_V1_W4_SEC_ENT3_KEYID) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent_keyid[4],
|
|
|
|
DCTLINFO_V1_W4_SEC_ENT4_KEYID) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent_keyid[5],
|
|
|
|
DCTLINFO_V1_W4_SEC_ENT5_KEYID) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent_keyid[6],
|
|
|
|
DCTLINFO_V1_W4_SEC_ENT6_KEYID);
|
|
|
|
h2c->m4 = cpu_to_le32(DCTLINFO_V1_W4_SEC_ENT0_KEYID |
|
|
|
|
DCTLINFO_V1_W4_SEC_ENT1_KEYID |
|
|
|
|
DCTLINFO_V1_W4_SEC_ENT2_KEYID |
|
|
|
|
DCTLINFO_V1_W4_SEC_ENT3_KEYID |
|
|
|
|
DCTLINFO_V1_W4_SEC_ENT4_KEYID |
|
|
|
|
DCTLINFO_V1_W4_SEC_ENT5_KEYID |
|
|
|
|
DCTLINFO_V1_W4_SEC_ENT6_KEYID);
|
|
|
|
|
|
|
|
h2c->w5 = le32_encode_bits(addr_cam->sec_cam_map[0] & 0xff,
|
|
|
|
DCTLINFO_V1_W5_SEC_ENT_VALID) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent[0],
|
|
|
|
DCTLINFO_V1_W5_SEC_ENT0) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent[1],
|
|
|
|
DCTLINFO_V1_W5_SEC_ENT1) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent[2],
|
|
|
|
DCTLINFO_V1_W5_SEC_ENT2);
|
|
|
|
h2c->m5 = cpu_to_le32(DCTLINFO_V1_W5_SEC_ENT_VALID |
|
|
|
|
DCTLINFO_V1_W5_SEC_ENT0 |
|
|
|
|
DCTLINFO_V1_W5_SEC_ENT1 |
|
|
|
|
DCTLINFO_V1_W5_SEC_ENT2);
|
|
|
|
|
|
|
|
h2c->w6 = le32_encode_bits(addr_cam->sec_ent[3],
|
|
|
|
DCTLINFO_V1_W6_SEC_ENT3) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent[4],
|
|
|
|
DCTLINFO_V1_W6_SEC_ENT4) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent[5],
|
|
|
|
DCTLINFO_V1_W6_SEC_ENT5) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent[6],
|
|
|
|
DCTLINFO_V1_W6_SEC_ENT6);
|
|
|
|
h2c->m6 = cpu_to_le32(DCTLINFO_V1_W6_SEC_ENT3 |
|
|
|
|
DCTLINFO_V1_W6_SEC_ENT4 |
|
|
|
|
DCTLINFO_V1_W6_SEC_ENT5 |
|
|
|
|
DCTLINFO_V1_W6_SEC_ENT6);
|
2024-05-02 10:25:01 +08:00
|
|
|
|
|
|
|
if (rtw_wow->ptk_alg) {
|
|
|
|
h2c->w0 = le32_encode_bits(ptk_tx_iv[0] | ptk_tx_iv[1] << 8,
|
|
|
|
DCTLINFO_V1_W0_AES_IV_L);
|
|
|
|
h2c->m0 = cpu_to_le32(DCTLINFO_V1_W0_AES_IV_L);
|
|
|
|
|
|
|
|
h2c->w1 = le32_encode_bits(ptk_tx_iv[4] |
|
|
|
|
ptk_tx_iv[5] << 8 |
|
|
|
|
ptk_tx_iv[6] << 16 |
|
|
|
|
ptk_tx_iv[7] << 24,
|
|
|
|
DCTLINFO_V1_W1_AES_IV_H);
|
|
|
|
h2c->m1 = cpu_to_le32(DCTLINFO_V1_W1_AES_IV_H);
|
|
|
|
|
|
|
|
h2c->w4 |= le32_encode_bits(rtw_wow->ptk_keyidx,
|
|
|
|
DCTLINFO_V1_W4_SEC_KEY_ID);
|
|
|
|
h2c->m4 |= cpu_to_le32(DCTLINFO_V1_W4_SEC_KEY_ID);
|
|
|
|
}
|
2022-04-13 09:08:02 +08:00
|
|
|
}
|
2024-01-15 11:37:35 +08:00
|
|
|
|
|
|
|
void rtw89_cam_fill_dctl_sec_cam_info_v2(struct rtw89_dev *rtwdev,
|
2024-09-16 13:31:52 +08:00
|
|
|
struct rtw89_vif_link *rtwvif_link,
|
2024-09-16 13:31:53 +08:00
|
|
|
struct rtw89_sta_link *rtwsta_link,
|
2024-01-15 11:37:35 +08:00
|
|
|
struct rtw89_h2c_dctlinfo_ud_v2 *h2c)
|
|
|
|
{
|
2024-10-22 16:31:03 +08:00
|
|
|
struct ieee80211_sta *sta = rtwsta_link_to_sta_safe(rtwsta_link);
|
|
|
|
struct ieee80211_vif *vif = rtwvif_to_vif(rtwvif_link->rtwvif);
|
|
|
|
struct rtw89_vif *rtwvif = rtwvif_link->rtwvif;
|
2024-09-16 13:31:52 +08:00
|
|
|
struct rtw89_addr_cam_entry *addr_cam =
|
2024-09-16 13:31:53 +08:00
|
|
|
rtw89_get_addr_cam_of(rtwvif_link, rtwsta_link);
|
2024-10-22 16:31:03 +08:00
|
|
|
bool is_mld = sta ? sta->mlo : ieee80211_vif_is_mld(vif);
|
2024-05-02 10:25:01 +08:00
|
|
|
struct rtw89_wow_param *rtw_wow = &rtwdev->wow;
|
|
|
|
u8 *ptk_tx_iv = rtw_wow->key_info.ptk_tx_iv;
|
2024-10-22 16:31:03 +08:00
|
|
|
u8 *mld_sma, *mld_tma, *mld_bssid;
|
2024-01-15 11:37:35 +08:00
|
|
|
|
2024-09-16 13:31:53 +08:00
|
|
|
h2c->c0 = le32_encode_bits(rtwsta_link ? rtwsta_link->mac_id :
|
|
|
|
rtwvif_link->mac_id,
|
2024-01-15 11:37:35 +08:00
|
|
|
DCTLINFO_V2_C0_MACID) |
|
|
|
|
le32_encode_bits(1, DCTLINFO_V2_C0_OP);
|
|
|
|
|
2024-10-22 16:31:03 +08:00
|
|
|
h2c->w2 = le32_encode_bits(is_mld, DCTLINFO_V2_W2_IS_MLD);
|
|
|
|
h2c->m2 = cpu_to_le32(DCTLINFO_V2_W2_IS_MLD);
|
|
|
|
|
2024-01-15 11:37:35 +08:00
|
|
|
h2c->w4 = le32_encode_bits(addr_cam->sec_ent_keyid[0],
|
|
|
|
DCTLINFO_V2_W4_SEC_ENT0_KEYID) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent_keyid[1],
|
|
|
|
DCTLINFO_V2_W4_SEC_ENT1_KEYID) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent_keyid[2],
|
|
|
|
DCTLINFO_V2_W4_SEC_ENT2_KEYID) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent_keyid[3],
|
|
|
|
DCTLINFO_V2_W4_SEC_ENT3_KEYID) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent_keyid[4],
|
|
|
|
DCTLINFO_V2_W4_SEC_ENT4_KEYID) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent_keyid[5],
|
|
|
|
DCTLINFO_V2_W4_SEC_ENT5_KEYID) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent_keyid[6],
|
|
|
|
DCTLINFO_V2_W4_SEC_ENT6_KEYID);
|
|
|
|
h2c->m4 = cpu_to_le32(DCTLINFO_V2_W4_SEC_ENT0_KEYID |
|
|
|
|
DCTLINFO_V2_W4_SEC_ENT1_KEYID |
|
|
|
|
DCTLINFO_V2_W4_SEC_ENT2_KEYID |
|
|
|
|
DCTLINFO_V2_W4_SEC_ENT3_KEYID |
|
|
|
|
DCTLINFO_V2_W4_SEC_ENT4_KEYID |
|
|
|
|
DCTLINFO_V2_W4_SEC_ENT5_KEYID |
|
|
|
|
DCTLINFO_V2_W4_SEC_ENT6_KEYID);
|
|
|
|
|
|
|
|
h2c->w5 = le32_encode_bits(addr_cam->sec_cam_map[0],
|
|
|
|
DCTLINFO_V2_W5_SEC_ENT_VALID_V1) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent[0],
|
|
|
|
DCTLINFO_V2_W5_SEC_ENT0_V1);
|
|
|
|
h2c->m5 = cpu_to_le32(DCTLINFO_V2_W5_SEC_ENT_VALID_V1 |
|
|
|
|
DCTLINFO_V2_W5_SEC_ENT0_V1);
|
|
|
|
|
|
|
|
h2c->w6 = le32_encode_bits(addr_cam->sec_ent[1],
|
|
|
|
DCTLINFO_V2_W6_SEC_ENT1_V1) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent[2],
|
|
|
|
DCTLINFO_V2_W6_SEC_ENT2_V1) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent[3],
|
|
|
|
DCTLINFO_V2_W6_SEC_ENT3_V1) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent[4],
|
|
|
|
DCTLINFO_V2_W6_SEC_ENT4_V1);
|
|
|
|
h2c->m6 = cpu_to_le32(DCTLINFO_V2_W6_SEC_ENT1_V1 |
|
|
|
|
DCTLINFO_V2_W6_SEC_ENT2_V1 |
|
|
|
|
DCTLINFO_V2_W6_SEC_ENT3_V1 |
|
|
|
|
DCTLINFO_V2_W6_SEC_ENT4_V1);
|
|
|
|
|
|
|
|
h2c->w7 = le32_encode_bits(addr_cam->sec_ent[5],
|
|
|
|
DCTLINFO_V2_W7_SEC_ENT5_V1) |
|
|
|
|
le32_encode_bits(addr_cam->sec_ent[6],
|
|
|
|
DCTLINFO_V2_W7_SEC_ENT6_V1);
|
|
|
|
h2c->m7 = cpu_to_le32(DCTLINFO_V2_W7_SEC_ENT5_V1 |
|
|
|
|
DCTLINFO_V2_W7_SEC_ENT6_V1);
|
2024-05-02 10:25:01 +08:00
|
|
|
|
|
|
|
if (rtw_wow->ptk_alg) {
|
|
|
|
h2c->w0 = le32_encode_bits(ptk_tx_iv[0] | ptk_tx_iv[1] << 8,
|
|
|
|
DCTLINFO_V2_W0_AES_IV_L);
|
|
|
|
h2c->m0 = cpu_to_le32(DCTLINFO_V2_W0_AES_IV_L);
|
|
|
|
|
|
|
|
h2c->w1 = le32_encode_bits(ptk_tx_iv[4] |
|
|
|
|
ptk_tx_iv[5] << 8 |
|
|
|
|
ptk_tx_iv[6] << 16 |
|
|
|
|
ptk_tx_iv[7] << 24,
|
|
|
|
DCTLINFO_V2_W1_AES_IV_H);
|
|
|
|
h2c->m1 = cpu_to_le32(DCTLINFO_V2_W1_AES_IV_H);
|
|
|
|
|
|
|
|
h2c->w4 |= le32_encode_bits(rtw_wow->ptk_keyidx,
|
|
|
|
DCTLINFO_V2_W4_SEC_KEY_ID);
|
|
|
|
h2c->m4 |= cpu_to_le32(DCTLINFO_V2_W4_SEC_KEY_ID);
|
|
|
|
}
|
2024-10-22 16:31:03 +08:00
|
|
|
|
|
|
|
if (!is_mld)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (rtwvif_link->net_type == RTW89_NET_TYPE_INFRA) {
|
|
|
|
mld_sma = rtwvif->mac_addr;
|
|
|
|
mld_tma = vif->cfg.ap_addr;
|
|
|
|
mld_bssid = vif->cfg.ap_addr;
|
|
|
|
} else if (rtwvif_link->net_type == RTW89_NET_TYPE_AP_MODE && sta) {
|
|
|
|
mld_sma = rtwvif->mac_addr;
|
|
|
|
mld_tma = sta->addr;
|
|
|
|
mld_bssid = rtwvif->mac_addr;
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
h2c->w8 = le32_encode_bits(mld_sma[0], DCTLINFO_V2_W8_MLD_SMA_0) |
|
|
|
|
le32_encode_bits(mld_sma[1], DCTLINFO_V2_W8_MLD_SMA_1) |
|
|
|
|
le32_encode_bits(mld_sma[2], DCTLINFO_V2_W8_MLD_SMA_2) |
|
|
|
|
le32_encode_bits(mld_sma[3], DCTLINFO_V2_W8_MLD_SMA_3);
|
|
|
|
h2c->m8 = cpu_to_le32(DCTLINFO_V2_W8_ALL);
|
|
|
|
|
|
|
|
h2c->w9 = le32_encode_bits(mld_sma[4], DCTLINFO_V2_W9_MLD_SMA_4) |
|
|
|
|
le32_encode_bits(mld_sma[5], DCTLINFO_V2_W9_MLD_SMA_5) |
|
|
|
|
le32_encode_bits(mld_tma[0], DCTLINFO_V2_W9_MLD_TMA_0) |
|
|
|
|
le32_encode_bits(mld_tma[1], DCTLINFO_V2_W9_MLD_TMA_1);
|
|
|
|
h2c->m9 = cpu_to_le32(DCTLINFO_V2_W9_ALL);
|
|
|
|
|
|
|
|
h2c->w10 = le32_encode_bits(mld_tma[2], DCTLINFO_V2_W10_MLD_TMA_2) |
|
|
|
|
le32_encode_bits(mld_tma[3], DCTLINFO_V2_W10_MLD_TMA_3) |
|
|
|
|
le32_encode_bits(mld_tma[4], DCTLINFO_V2_W10_MLD_TMA_4) |
|
|
|
|
le32_encode_bits(mld_tma[5], DCTLINFO_V2_W10_MLD_TMA_5);
|
|
|
|
h2c->m10 = cpu_to_le32(DCTLINFO_V2_W10_ALL);
|
|
|
|
|
|
|
|
h2c->w11 = le32_encode_bits(mld_bssid[0], DCTLINFO_V2_W11_MLD_BSSID_0) |
|
|
|
|
le32_encode_bits(mld_bssid[1], DCTLINFO_V2_W11_MLD_BSSID_1) |
|
|
|
|
le32_encode_bits(mld_bssid[2], DCTLINFO_V2_W11_MLD_BSSID_2) |
|
|
|
|
le32_encode_bits(mld_bssid[3], DCTLINFO_V2_W11_MLD_BSSID_3);
|
|
|
|
h2c->m11 = cpu_to_le32(DCTLINFO_V2_W11_ALL);
|
|
|
|
|
|
|
|
h2c->w12 = le32_encode_bits(mld_bssid[4], DCTLINFO_V2_W12_MLD_BSSID_4) |
|
|
|
|
le32_encode_bits(mld_bssid[5], DCTLINFO_V2_W12_MLD_BSSID_5);
|
|
|
|
h2c->m12 = cpu_to_le32(DCTLINFO_V2_W12_ALL);
|
2024-01-15 11:37:35 +08:00
|
|
|
}
|