You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
175 lines
6.4 KiB
175 lines
6.4 KiB
1 year ago
|
From df4e46aa49418fbcb942607bf55f022619bd93a8 Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||
|
Date: Wed, 24 May 2023 15:00:35 +0200
|
||
|
Subject: [PATCH 100/142] wifi: rtw89: coex: Update WiFi role info H2C report
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
Bugzilla: https://bugzilla.redhat.com/2207499
|
||
|
|
||
|
commit 3f625adc61a0f015c2ce982bc49a84e163094a0c
|
||
|
Author: Ching-Te Ku <ku920601@realtek.com>
|
||
|
Date: Tue Jan 3 22:02:38 2023 +0800
|
||
|
|
||
|
wifi: rtw89: coex: Update WiFi role info H2C report
|
||
|
|
||
|
Change style to feature version separate. And because there are
|
||
|
different WiFi roles number in the firmware, it will make structure
|
||
|
length longer or shorter, so update the length calculator to cover
|
||
|
the difference.
|
||
|
|
||
|
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
|
||
|
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||
|
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||
|
Link: https://lore.kernel.org/r/20230103140238.15601-8-pkshih@realtek.com
|
||
|
|
||
|
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||
|
---
|
||
|
drivers/net/wireless/realtek/rtw89/coex.c | 7 +++---
|
||
|
drivers/net/wireless/realtek/rtw89/fw.c | 36 ++++++++++++++++++++-----------
|
||
|
2 files changed, 27 insertions(+), 16 deletions(-)
|
||
|
|
||
|
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
|
||
|
index 21d1011d50c9d..f97ddbcb51046 100644
|
||
|
--- a/drivers/net/wireless/realtek/rtw89/coex.c
|
||
|
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
|
||
|
@@ -1772,16 +1772,17 @@ static void _fw_set_policy(struct rtw89_dev *rtwdev, u16 policy_type,
|
||
|
|
||
|
static void _fw_set_drv_info(struct rtw89_dev *rtwdev, u8 type)
|
||
|
{
|
||
|
- const struct rtw89_chip_info *chip = rtwdev->chip;
|
||
|
+ struct rtw89_btc *btc = &rtwdev->btc;
|
||
|
+ const struct rtw89_btc_ver *ver = btc->ver;
|
||
|
|
||
|
switch (type) {
|
||
|
case CXDRVINFO_INIT:
|
||
|
rtw89_fw_h2c_cxdrv_init(rtwdev);
|
||
|
break;
|
||
|
case CXDRVINFO_ROLE:
|
||
|
- if (chip->chip_id == RTL8852A)
|
||
|
+ if (ver->fwlrole == 0)
|
||
|
rtw89_fw_h2c_cxdrv_role(rtwdev);
|
||
|
- else
|
||
|
+ else if (ver->fwlrole == 1)
|
||
|
rtw89_fw_h2c_cxdrv_role_v1(rtwdev);
|
||
|
break;
|
||
|
case CXDRVINFO_CTRL:
|
||
|
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
|
||
|
index 466d8273bc2b1..98cfadda8f45e 100644
|
||
|
--- a/drivers/net/wireless/realtek/rtw89/fw.c
|
||
|
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
|
||
|
@@ -1818,33 +1818,36 @@ int rtw89_fw_h2c_cxdrv_init(struct rtw89_dev *rtwdev)
|
||
|
|
||
|
#define PORT_DATA_OFFSET 4
|
||
|
#define H2C_LEN_CXDRVINFO_ROLE_DBCC_LEN 12
|
||
|
-#define H2C_LEN_CXDRVINFO_ROLE (4 + 12 * RTW89_PORT_NUM + H2C_LEN_CXDRVHDR)
|
||
|
-#define H2C_LEN_CXDRVINFO_ROLE_V1 (4 + 16 * RTW89_PORT_NUM + \
|
||
|
- H2C_LEN_CXDRVINFO_ROLE_DBCC_LEN + \
|
||
|
- H2C_LEN_CXDRVHDR)
|
||
|
+#define H2C_LEN_CXDRVINFO_ROLE_SIZE(max_role_num) \
|
||
|
+ (4 + 12 * (max_role_num) + H2C_LEN_CXDRVHDR)
|
||
|
+
|
||
|
int rtw89_fw_h2c_cxdrv_role(struct rtw89_dev *rtwdev)
|
||
|
{
|
||
|
struct rtw89_btc *btc = &rtwdev->btc;
|
||
|
+ const struct rtw89_btc_ver *ver = btc->ver;
|
||
|
struct rtw89_btc_wl_info *wl = &btc->cx.wl;
|
||
|
struct rtw89_btc_wl_role_info *role_info = &wl->role_info;
|
||
|
struct rtw89_btc_wl_role_info_bpos *bpos = &role_info->role_map.role;
|
||
|
struct rtw89_btc_wl_active_role *active = role_info->active_role;
|
||
|
struct sk_buff *skb;
|
||
|
+ u32 len;
|
||
|
u8 offset = 0;
|
||
|
u8 *cmd;
|
||
|
int ret;
|
||
|
int i;
|
||
|
|
||
|
- skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, H2C_LEN_CXDRVINFO_ROLE);
|
||
|
+ len = H2C_LEN_CXDRVINFO_ROLE_SIZE(ver->max_role_num);
|
||
|
+
|
||
|
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len);
|
||
|
if (!skb) {
|
||
|
rtw89_err(rtwdev, "failed to alloc skb for h2c cxdrv_role\n");
|
||
|
return -ENOMEM;
|
||
|
}
|
||
|
- skb_put(skb, H2C_LEN_CXDRVINFO_ROLE);
|
||
|
+ skb_put(skb, len);
|
||
|
cmd = skb->data;
|
||
|
|
||
|
RTW89_SET_FWCMD_CXHDR_TYPE(cmd, CXDRVINFO_ROLE);
|
||
|
- RTW89_SET_FWCMD_CXHDR_LEN(cmd, H2C_LEN_CXDRVINFO_ROLE - H2C_LEN_CXDRVHDR);
|
||
|
+ RTW89_SET_FWCMD_CXHDR_LEN(cmd, len - H2C_LEN_CXDRVHDR);
|
||
|
|
||
|
RTW89_SET_FWCMD_CXROLE_CONNECT_CNT(cmd, role_info->connect_cnt);
|
||
|
RTW89_SET_FWCMD_CXROLE_LINK_MODE(cmd, role_info->link_mode);
|
||
|
@@ -1881,7 +1884,7 @@ int rtw89_fw_h2c_cxdrv_role(struct rtw89_dev *rtwdev)
|
||
|
rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||
|
H2C_CAT_OUTSRC, BTFC_SET,
|
||
|
SET_DRV_INFO, 0, 0,
|
||
|
- H2C_LEN_CXDRVINFO_ROLE);
|
||
|
+ len);
|
||
|
|
||
|
ret = rtw89_h2c_tx(rtwdev, skb, false);
|
||
|
if (ret) {
|
||
|
@@ -1896,28 +1899,35 @@ int rtw89_fw_h2c_cxdrv_role(struct rtw89_dev *rtwdev)
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
+#define H2C_LEN_CXDRVINFO_ROLE_SIZE_V1(max_role_num) \
|
||
|
+ (4 + 16 * (max_role_num) + H2C_LEN_CXDRVINFO_ROLE_DBCC_LEN + H2C_LEN_CXDRVHDR)
|
||
|
+
|
||
|
int rtw89_fw_h2c_cxdrv_role_v1(struct rtw89_dev *rtwdev)
|
||
|
{
|
||
|
struct rtw89_btc *btc = &rtwdev->btc;
|
||
|
+ const struct rtw89_btc_ver *ver = btc->ver;
|
||
|
struct rtw89_btc_wl_info *wl = &btc->cx.wl;
|
||
|
struct rtw89_btc_wl_role_info_v1 *role_info = &wl->role_info_v1;
|
||
|
struct rtw89_btc_wl_role_info_bpos *bpos = &role_info->role_map.role;
|
||
|
struct rtw89_btc_wl_active_role_v1 *active = role_info->active_role_v1;
|
||
|
struct sk_buff *skb;
|
||
|
+ u32 len;
|
||
|
u8 *cmd, offset;
|
||
|
int ret;
|
||
|
int i;
|
||
|
|
||
|
- skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, H2C_LEN_CXDRVINFO_ROLE_V1);
|
||
|
+ len = H2C_LEN_CXDRVINFO_ROLE_SIZE_V1(ver->max_role_num);
|
||
|
+
|
||
|
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len);
|
||
|
if (!skb) {
|
||
|
rtw89_err(rtwdev, "failed to alloc skb for h2c cxdrv_role\n");
|
||
|
return -ENOMEM;
|
||
|
}
|
||
|
- skb_put(skb, H2C_LEN_CXDRVINFO_ROLE_V1);
|
||
|
+ skb_put(skb, len);
|
||
|
cmd = skb->data;
|
||
|
|
||
|
RTW89_SET_FWCMD_CXHDR_TYPE(cmd, CXDRVINFO_ROLE);
|
||
|
- RTW89_SET_FWCMD_CXHDR_LEN(cmd, H2C_LEN_CXDRVINFO_ROLE_V1 - H2C_LEN_CXDRVHDR);
|
||
|
+ RTW89_SET_FWCMD_CXHDR_LEN(cmd, len - H2C_LEN_CXDRVHDR);
|
||
|
|
||
|
RTW89_SET_FWCMD_CXROLE_CONNECT_CNT(cmd, role_info->connect_cnt);
|
||
|
RTW89_SET_FWCMD_CXROLE_LINK_MODE(cmd, role_info->link_mode);
|
||
|
@@ -1953,7 +1963,7 @@ int rtw89_fw_h2c_cxdrv_role_v1(struct rtw89_dev *rtwdev)
|
||
|
RTW89_SET_FWCMD_CXROLE_ACT_NOA_DUR(cmd, active->noa_duration, i, offset);
|
||
|
}
|
||
|
|
||
|
- offset = H2C_LEN_CXDRVINFO_ROLE_V1 - H2C_LEN_CXDRVINFO_ROLE_DBCC_LEN;
|
||
|
+ offset = len - H2C_LEN_CXDRVINFO_ROLE_DBCC_LEN;
|
||
|
RTW89_SET_FWCMD_CXROLE_MROLE_TYPE(cmd, role_info->mrole_type, offset);
|
||
|
RTW89_SET_FWCMD_CXROLE_MROLE_NOA(cmd, role_info->mrole_noa_duration, offset);
|
||
|
RTW89_SET_FWCMD_CXROLE_DBCC_EN(cmd, role_info->dbcc_en, offset);
|
||
|
@@ -1964,7 +1974,7 @@ int rtw89_fw_h2c_cxdrv_role_v1(struct rtw89_dev *rtwdev)
|
||
|
rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||
|
H2C_CAT_OUTSRC, BTFC_SET,
|
||
|
SET_DRV_INFO, 0, 0,
|
||
|
- H2C_LEN_CXDRVINFO_ROLE_V1);
|
||
|
+ len);
|
||
|
|
||
|
ret = rtw89_h2c_tx(rtwdev, skb, false);
|
||
|
if (ret) {
|
||
|
--
|
||
|
2.13.6
|
||
|
|