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.
263 lines
9.1 KiB
263 lines
9.1 KiB
From ca948c733764cc5e27c0b067e1186aa4a53af585 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 098/142] wifi: rtw89: coex: Add v5 firmware control report
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Bugzilla: https://bugzilla.redhat.com/2207499
|
|
|
|
commit 0c06fd47335ab9bbcbca250267eb22227e98ffa4
|
|
Author: Ching-Te Ku <ku920601@realtek.com>
|
|
Date: Tue Jan 3 22:02:36 2023 +0800
|
|
|
|
wifi: rtw89: coex: Add v5 firmware control report
|
|
|
|
Comparing v5 control report to v4 version, v5 reduce some of variable's
|
|
size to reduce firmware code size. And change the grant signal report
|
|
format.
|
|
|
|
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-6-pkshih@realtek.com
|
|
|
|
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
|
---
|
|
drivers/net/wireless/realtek/rtw89/coex.c | 148 ++++++++++++++++++++++++++++++
|
|
drivers/net/wireless/realtek/rtw89/core.h | 27 ++++++
|
|
2 files changed, 175 insertions(+)
|
|
|
|
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
|
|
index e5aa0d663cdd6..21d1011d50c9d 100644
|
|
--- a/drivers/net/wireless/realtek/rtw89/coex.c
|
|
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
|
|
@@ -968,6 +968,9 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
|
} else if (ver->fcxbtcrpt == 4) {
|
|
pfinfo = &pfwinfo->rpt_ctrl.finfo.v4;
|
|
pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo.v4);
|
|
+ } else if (ver->fcxbtcrpt == 5) {
|
|
+ pfinfo = &pfwinfo->rpt_ctrl.finfo.v5;
|
|
+ pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo.v5);
|
|
} else {
|
|
goto err;
|
|
}
|
|
@@ -1163,6 +1166,33 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
|
bt->rfk_info.map.timeout = 0;
|
|
|
|
dm->error.map.bt_rfk_timeout = bt->rfk_info.map.timeout;
|
|
+ } else if (ver->fcxbtcrpt == 5) {
|
|
+ prpt->v5 = pfwinfo->rpt_ctrl.finfo.v5;
|
|
+ pfwinfo->rpt_en_map = le32_to_cpu(prpt->v5.rpt_info.en);
|
|
+ wl->ver_info.fw_coex = le32_to_cpu(prpt->v5.rpt_info.cx_ver);
|
|
+ wl->ver_info.fw = le32_to_cpu(prpt->v5.rpt_info.fw_ver);
|
|
+ dm->wl_fw_cx_offload = 0;
|
|
+
|
|
+ for (i = RTW89_PHY_0; i < RTW89_PHY_MAX; i++)
|
|
+ memcpy(&dm->gnt.band[i], &prpt->v5.gnt_val[i][0],
|
|
+ sizeof(dm->gnt.band[i]));
|
|
+
|
|
+ btc->cx.cnt_bt[BTC_BCNT_HIPRI_TX] =
|
|
+ le16_to_cpu(prpt->v5.bt_cnt[BTC_BCNT_HI_TX]);
|
|
+ btc->cx.cnt_bt[BTC_BCNT_HIPRI_RX] =
|
|
+ le16_to_cpu(prpt->v5.bt_cnt[BTC_BCNT_HI_RX]);
|
|
+ btc->cx.cnt_bt[BTC_BCNT_LOPRI_TX] =
|
|
+ le16_to_cpu(prpt->v5.bt_cnt[BTC_BCNT_LO_TX]);
|
|
+ btc->cx.cnt_bt[BTC_BCNT_LOPRI_RX] =
|
|
+ le16_to_cpu(prpt->v5.bt_cnt[BTC_BCNT_LO_RX]);
|
|
+ btc->cx.cnt_bt[BTC_BCNT_POLUT] =
|
|
+ le16_to_cpu(prpt->v5.bt_cnt[BTC_BCNT_POLLUTED]);
|
|
+
|
|
+ _chk_btc_err(rtwdev, BTC_DCNT_BTCNT_FREEZE, 0);
|
|
+ _chk_btc_err(rtwdev, BTC_DCNT_RPT_FREEZE,
|
|
+ pfwinfo->event[BTF_EVNT_RPT]);
|
|
+
|
|
+ dm->error.map.bt_rfk_timeout = bt->rfk_info.map.timeout;
|
|
} else {
|
|
goto err;
|
|
}
|
|
@@ -7281,6 +7311,122 @@ static void _show_summary_v4(struct rtw89_dev *rtwdev, struct seq_file *m)
|
|
cnt[BTC_NCNT_CUSTOMERIZE]);
|
|
}
|
|
|
|
+static void _show_summary_v5(struct rtw89_dev *rtwdev, struct seq_file *m)
|
|
+{
|
|
+ struct rtw89_btc *btc = &rtwdev->btc;
|
|
+ struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;
|
|
+ struct rtw89_btc_fbtc_rpt_ctrl_v5 *prptctrl;
|
|
+ struct rtw89_btc_rpt_cmn_info *pcinfo;
|
|
+ struct rtw89_btc_cx *cx = &btc->cx;
|
|
+ struct rtw89_btc_dm *dm = &btc->dm;
|
|
+ struct rtw89_btc_wl_info *wl = &cx->wl;
|
|
+ u32 cnt_sum = 0, *cnt = btc->dm.cnt_notify;
|
|
+ u8 i;
|
|
+
|
|
+ if (!(dm->coex_info_map & BTC_COEX_INFO_SUMMARY))
|
|
+ return;
|
|
+
|
|
+ seq_puts(m, "========== [Statistics] ==========\n");
|
|
+
|
|
+ pcinfo = &pfwinfo->rpt_ctrl.cinfo;
|
|
+ if (pcinfo->valid && !wl->status.map.lps && !wl->status.map.rf_off) {
|
|
+ prptctrl = &pfwinfo->rpt_ctrl.finfo.v5;
|
|
+
|
|
+ seq_printf(m,
|
|
+ " %-15s : h2c_cnt=%d(fail:%d, fw_recv:%d), c2h_cnt=%d(fw_send:%d, len:%d), ",
|
|
+ "[summary]", pfwinfo->cnt_h2c, pfwinfo->cnt_h2c_fail,
|
|
+ le16_to_cpu(prptctrl->rpt_info.cnt_h2c),
|
|
+ pfwinfo->cnt_c2h,
|
|
+ le16_to_cpu(prptctrl->rpt_info.cnt_c2h),
|
|
+ le16_to_cpu(prptctrl->rpt_info.len_c2h));
|
|
+
|
|
+ seq_printf(m,
|
|
+ "rpt_cnt=%d(fw_send:%d), rpt_map=0x%x",
|
|
+ pfwinfo->event[BTF_EVNT_RPT],
|
|
+ le16_to_cpu(prptctrl->rpt_info.cnt),
|
|
+ le32_to_cpu(prptctrl->rpt_info.en));
|
|
+
|
|
+ if (dm->error.map.wl_fw_hang)
|
|
+ seq_puts(m, " (WL FW Hang!!)");
|
|
+ seq_puts(m, "\n");
|
|
+ seq_printf(m,
|
|
+ " %-15s : send_ok:%d, send_fail:%d, recv:%d, ",
|
|
+ "[mailbox]",
|
|
+ le32_to_cpu(prptctrl->bt_mbx_info.cnt_send_ok),
|
|
+ le32_to_cpu(prptctrl->bt_mbx_info.cnt_send_fail),
|
|
+ le32_to_cpu(prptctrl->bt_mbx_info.cnt_recv));
|
|
+
|
|
+ seq_printf(m,
|
|
+ "A2DP_empty:%d(stop:%d, tx:%d, ack:%d, nack:%d)\n",
|
|
+ le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_empty),
|
|
+ le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_flowctrl),
|
|
+ le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_tx),
|
|
+ le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_ack),
|
|
+ le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_nack));
|
|
+
|
|
+ seq_printf(m,
|
|
+ " %-15s : wl_rfk[req:%d/go:%d/reject:%d/tout:%d]",
|
|
+ "[RFK/LPS]", cx->cnt_wl[BTC_WCNT_RFK_REQ],
|
|
+ cx->cnt_wl[BTC_WCNT_RFK_GO],
|
|
+ cx->cnt_wl[BTC_WCNT_RFK_REJECT],
|
|
+ cx->cnt_wl[BTC_WCNT_RFK_TIMEOUT]);
|
|
+
|
|
+ seq_printf(m,
|
|
+ ", bt_rfk[req:%d]",
|
|
+ le16_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_REQ]));
|
|
+
|
|
+ seq_printf(m,
|
|
+ ", AOAC[RF_on:%d/RF_off:%d]",
|
|
+ le16_to_cpu(prptctrl->rpt_info.cnt_aoac_rf_on),
|
|
+ le16_to_cpu(prptctrl->rpt_info.cnt_aoac_rf_off));
|
|
+ } else {
|
|
+ seq_puts(m, "\n");
|
|
+ seq_printf(m,
|
|
+ " %-15s : h2c_cnt=%d(fail:%d), c2h_cnt=%d",
|
|
+ "[summary]", pfwinfo->cnt_h2c,
|
|
+ pfwinfo->cnt_h2c_fail, pfwinfo->cnt_c2h);
|
|
+ }
|
|
+
|
|
+ if (!pcinfo->valid || pfwinfo->len_mismch || pfwinfo->fver_mismch ||
|
|
+ pfwinfo->err[BTFRE_EXCEPTION]) {
|
|
+ seq_puts(m, "\n");
|
|
+ seq_printf(m,
|
|
+ " %-15s : WL FW rpt error!![rpt_ctrl_valid:%d/len:"
|
|
+ "0x%x/ver:0x%x/ex:%d/lps=%d/rf_off=%d]",
|
|
+ "[ERROR]", pcinfo->valid, pfwinfo->len_mismch,
|
|
+ pfwinfo->fver_mismch, pfwinfo->err[BTFRE_EXCEPTION],
|
|
+ wl->status.map.lps, wl->status.map.rf_off);
|
|
+ }
|
|
+
|
|
+ for (i = 0; i < BTC_NCNT_NUM; i++)
|
|
+ cnt_sum += dm->cnt_notify[i];
|
|
+
|
|
+ seq_puts(m, "\n");
|
|
+ seq_printf(m,
|
|
+ " %-15s : total=%d, show_coex_info=%d, power_on=%d, init_coex=%d, ",
|
|
+ "[notify_cnt]",
|
|
+ cnt_sum, cnt[BTC_NCNT_SHOW_COEX_INFO],
|
|
+ cnt[BTC_NCNT_POWER_ON], cnt[BTC_NCNT_INIT_COEX]);
|
|
+
|
|
+ seq_printf(m,
|
|
+ "power_off=%d, radio_state=%d, role_info=%d, wl_rfk=%d, wl_sta=%d",
|
|
+ cnt[BTC_NCNT_POWER_OFF], cnt[BTC_NCNT_RADIO_STATE],
|
|
+ cnt[BTC_NCNT_ROLE_INFO], cnt[BTC_NCNT_WL_RFK],
|
|
+ cnt[BTC_NCNT_WL_STA]);
|
|
+
|
|
+ seq_puts(m, "\n");
|
|
+ seq_printf(m,
|
|
+ " %-15s : scan_start=%d, scan_finish=%d, switch_band=%d, special_pkt=%d, ",
|
|
+ "[notify_cnt]",
|
|
+ cnt[BTC_NCNT_SCAN_START], cnt[BTC_NCNT_SCAN_FINISH],
|
|
+ cnt[BTC_NCNT_SWITCH_BAND], cnt[BTC_NCNT_SPECIAL_PACKET]);
|
|
+
|
|
+ seq_printf(m,
|
|
+ "timer=%d, control=%d, customerize=%d",
|
|
+ cnt[BTC_NCNT_TIMER], cnt[BTC_NCNT_CONTROL],
|
|
+ cnt[BTC_NCNT_CUSTOMERIZE]);
|
|
+}
|
|
+
|
|
void rtw89_btc_dump_info(struct rtw89_dev *rtwdev, struct seq_file *m)
|
|
{
|
|
struct rtw89_fw_suit *fw_suit = &rtwdev->fw.normal;
|
|
@@ -7318,6 +7464,8 @@ void rtw89_btc_dump_info(struct rtw89_dev *rtwdev, struct seq_file *m)
|
|
_show_summary_v1(rtwdev, m);
|
|
else if (ver->fcxbtcrpt == 4)
|
|
_show_summary_v4(rtwdev, m);
|
|
+ else if (ver->fcxbtcrpt == 5)
|
|
+ _show_summary_v5(rtwdev, m);
|
|
}
|
|
|
|
void rtw89_coex_recognize_ver(struct rtw89_dev *rtwdev)
|
|
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
|
index 384eb9cb92240..d0b4c00324572 100644
|
|
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
|
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
|
@@ -1512,6 +1512,20 @@ struct rtw89_btc_fbtc_rpt_ctrl_info {
|
|
__le32 cnt_aoac_rf_off; /* rf-off counter for aoac switch notify */
|
|
} __packed;
|
|
|
|
+struct rtw89_btc_fbtc_rpt_ctrl_info_v5 {
|
|
+ __le32 cx_ver; /* match which driver's coex version */
|
|
+ __le32 fw_ver;
|
|
+ __le32 en; /* report map */
|
|
+
|
|
+ __le16 cnt; /* fw report counter */
|
|
+ __le16 cnt_c2h; /* fw send c2h counter */
|
|
+ __le16 cnt_h2c; /* fw recv h2c counter */
|
|
+ __le16 len_c2h; /* The total length of the last C2H */
|
|
+
|
|
+ __le16 cnt_aoac_rf_on; /* rf-on counter for aoac switch notify */
|
|
+ __le16 cnt_aoac_rf_off; /* rf-off counter for aoac switch notify */
|
|
+} __packed;
|
|
+
|
|
struct rtw89_btc_fbtc_rpt_ctrl_wl_fw_info {
|
|
__le32 cx_ver; /* match which driver's coex version */
|
|
__le32 cx_offload;
|
|
@@ -1544,9 +1558,22 @@ struct rtw89_btc_fbtc_rpt_ctrl_v4 {
|
|
struct rtw89_mac_ax_gnt gnt_val[RTW89_PHY_MAX];
|
|
} __packed;
|
|
|
|
+struct rtw89_btc_fbtc_rpt_ctrl_v5 {
|
|
+ u8 fver;
|
|
+ u8 rsvd;
|
|
+ __le16 rsvd1;
|
|
+
|
|
+ u8 gnt_val[RTW89_PHY_MAX][4];
|
|
+ __le16 bt_cnt[BTC_BCNT_STA_MAX];
|
|
+
|
|
+ struct rtw89_btc_fbtc_rpt_ctrl_info_v5 rpt_info;
|
|
+ struct rtw89_btc_fbtc_rpt_ctrl_bt_mailbox bt_mbx_info;
|
|
+} __packed;
|
|
+
|
|
union rtw89_btc_fbtc_rpt_ctrl_ver_info {
|
|
struct rtw89_btc_fbtc_rpt_ctrl_v1 v1;
|
|
struct rtw89_btc_fbtc_rpt_ctrl_v4 v4;
|
|
+ struct rtw89_btc_fbtc_rpt_ctrl_v5 v5;
|
|
};
|
|
|
|
enum rtw89_fbtc_ext_ctrl_type {
|
|
--
|
|
2.13.6
|
|
|