wifi: rtw89: switch to wiphy lock and work
Ping-Ke Shih
maintainercover wifi: rtw89: switch to wiphy lock and work
The driver mutex is to synchronize ieee80211_ops and works, but it isn't easy to mange and causes AB-BA locks problem, which we have adjusted to avoid but the code isn't smooth.
Nowaday, wiphy lock can make thing simple and easy, and also switch to wiphy lock is easy by reference of ath12k [1]. The debugfs neeeds special treatments to use wiphy_lock [2], and debugfs_short_fops [3] can save some spaces.
The plans in this patchset is to switch from (A) to (B) and to (C) as below. Current code has two patterns (A) and (B), so fist step is to change (A) to (B), and then just remove mutex_lock() of driver to get (C).
(A) (B) (C)
wiphy_lock() wiphy_lock()
... ...
mutex_lock() mutex_lock() ... ... ... mutex_unlock() mutex_unlock()
... ...
wiphy_unlock() wiphy_unlock()
The patches 1/10 and 2/10 are to change (A) to (B) for the codes except to debugfs.
The patches 3/10 to 6/10 are related to debugfs. Originally, rtw89 uses seq_file to output data, so we convert to use generic file_ops::read/write with scnprintf() to be compatible with wiphy_locked_debugfs_{read,write}(). This is also good to specify output buffer size to avoid duplicate IO during debugging.
After patches 1/10 to 6/10, all have become (B), so remove driver mutex by patches 7/10 to 9/10. Among them, patch 8/10 is a manually comsmetic patch to be expected.
The last one patch is a special deal to early_h2c, which is a list of H2C commands for debug purpose.
This patchset has structural dependency with existing two patchset:
- wifi: rtw89: enhance dynamic mechanism per PHY
- wifi: rtw89: cleanup unused rtwdev::roc_work
[1] ath12k switch to wiphy_lock: https://lore.kernel.org/linux-wireless/[email protected]/
[2] wiphy_lock for debugfs: https://lore.kernel.org/linux-wireless/[email protected]/
[3] debugfs_short_fops: https://lore.kernel.org/linux-wireless/20241009181339.0b1a6eaef573.Ia80b55e934bbfc45ce0df42a3233d34b35508046@changeid/
Ping-Ke Shih (10):
wifi: rtw89: add wiphy_lock() to work that isn't held wiphy_lock() yet
wifi: rtw89: use wiphy_work() to replace ieee802111_work()
wifi: rtw89: debugfs: implement file_ops::read/write to replace
seq_file
wifi: rtw89: debugfs: specify buffer size allocated by devm_kazlloc()
for reading
wifi: rtw89: debugfs: use wiphy_locked_debugfs_{read,write}() if
needed
wifi: rtw89: debugfs: use debugfs_short_fops
wifi: rtw89: remove consumers of driver mutex
wifi: rtw89: manual cosmetic along lockdep_assert_wiphy()
wifi: rtw89: remove definition of driver mutex
wifi: rtw89: pci: not assert wiphy_lock to free early_h2c for PCI
probe/remove
drivers/net/wireless/realtek/rtw89/chan.c | 28 +- drivers/net/wireless/realtek/rtw89/chan.h | 2 +- drivers/net/wireless/realtek/rtw89/coex.c | 2805 +++++++++-------- drivers/net/wireless/realtek/rtw89/coex.h | 16 +- drivers/net/wireless/realtek/rtw89/core.c | 145 +- drivers/net/wireless/realtek/rtw89/core.h | 38 +- drivers/net/wireless/realtek/rtw89/debug.c | 2062 ++++++------ drivers/net/wireless/realtek/rtw89/fw.c | 23 +- drivers/net/wireless/realtek/rtw89/fw.h | 3 +- drivers/net/wireless/realtek/rtw89/mac80211.c | 281 +- drivers/net/wireless/realtek/rtw89/phy.c | 45 +- drivers/net/wireless/realtek/rtw89/phy.h | 8 +- drivers/net/wireless/realtek/rtw89/ps.c | 6 +- drivers/net/wireless/realtek/rtw89/regd.c | 6 +- drivers/net/wireless/realtek/rtw89/sar.c | 60 +- drivers/net/wireless/realtek/rtw89/sar.h | 5 +- drivers/net/wireless/realtek/rtw89/ser.c | 17 +- drivers/net/wireless/realtek/rtw89/util.c | 11 + drivers/net/wireless/realtek/rtw89/util.h | 5 +- drivers/net/wireless/realtek/rtw89/wow.c | 7 +- 20 files changed, 2988 insertions(+), 2585 deletions(-)
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 1/10 wifi: rtw89: add wiphy_lock() to work that isn't held wiphy_lock() yet
To ensure where are protected by driver mutex can also be protected by wiphy_lock(), so afterward we can remove driver mutex safely.
--- drivers/net/wireless/realtek/rtw89/regd.c | 2 ++ drivers/net/wireless/realtek/rtw89/ser.c | 4 ++++ 2 files changed, 6 insertions(+)
drivers/net/wireless/realtek/rtw89/regd.c +2 -0
@@ -720,6 +720,7 @@ void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *requeststruct ieee80211_hw *hw =wiphy_to_ieee80211_hw (wiphy);struct rtw89_dev *rtwdev = hw->priv; +wiphy_lock (wiphy);mutex_lock (&rtwdev->mutex);rtw89_leave_ps_mode (rtwdev);
@@ -737,6 +738,7 @@ void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *request exit:mutex_unlock (&rtwdev->mutex); +wiphy_unlock (wiphy); }/* Maximum Transmit Power field (@raw) can be EIRP or PSD.
drivers/net/wireless/realtek/rtw89/ser.c +4 -0
@@ -156,9 +156,11 @@ static void ser_state_run(struct rtw89_ser *ser, u8 evt)rtw89_debug (rtwdev,RTW89_DBG_SER ,"ser: %s receive %s\n" ,ser_st_name (ser),ser_ev_name (ser, evt)); +wiphy_lock (rtwdev->hw->wiphy);mutex_lock (&rtwdev->mutex);rtw89_leave_lps (rtwdev);mutex_unlock (&rtwdev->mutex); +wiphy_unlock (rtwdev->hw->wiphy); ser->st_tbl[ser->state].st_func (ser, evt); }
@@ -708,9 +710,11 @@ static void ser_l2_reset_st_hdl(struct rtw89_ser *ser, u8 evt)switch (evt) {case SER_EV_STATE_IN : +wiphy_lock (rtwdev->hw->wiphy);mutex_lock (&rtwdev->mutex);ser_l2_reset_st_pre_hdl (ser);mutex_unlock (&rtwdev->mutex); +wiphy_unlock (rtwdev->hw->wiphy);ieee80211_restart_hw (rtwdev->hw);ser_set_alarm (ser,SER_RECFG_TIMEOUT ,SER_EV_L2_RECFG_TIMEOUT );
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerRe: [PATCH 01/10] wifi: rtw89: add wiphy_lock() to work that isn't held wiphy_lock() yet
Quoted 4 lines · Ping-Ke Shih
To ensure where are protected by driver mutex can also be protected by
wiphy_lock(), so afterward we can remove driver mutex safely.Signed-off-by Ping-Ke Shih <[email protected]>
10 patch(es) applied to rtw-next branch of rtw.git, thanks.
ebfc9199df05 wifi: rtw89: add wiphy_lock() to work that isn't held wiphy_lock() yet 4afde17d2667 wifi: rtw89: use wiphy_work() to replace ieee802111_work() 831cceed3baf wifi: rtw89: debugfs: implement file_ops::read/write to replace seq_file 01fd45d9e102 wifi: rtw89: debugfs: specify buffer size allocated by devm_kazlloc() for reading 8fdf78f3cd5f wifi: rtw89: debugfs: use wiphy_locked_debugfs_{read,write}() if needed bdf874dc3c76 wifi: rtw89: debugfs: use debugfs_short_fops6ee1937d8bc9 wifi: rtw89: remove consumers of driver mutexed114a7ac636 wifi: rtw89: manual cosmetic along lockdep_assert_wiphy() 2345f351c7f5 wifi: rtw89: remove definition of driver mutex8afa4ff99a00 wifi: rtw89: pci: not assert wiphy_lock to free early_h2c for PCI probe/remove
Ping-Ke Shih
maintainerPATCH 2/10 wifi: rtw89: use wiphy_work() to replace ieee802111_work()
In reply to Ping-Ke ShihFor certain works protected by driver mutex, use wiphy_work() directly to have wiphy lock held naturally. Then every this kind of works is protected by both wiphy lock and driver mutex.
--- drivers/net/wireless/realtek/rtw89/chan.c | 6 +- drivers/net/wireless/realtek/rtw89/chan.h | 2 +- drivers/net/wireless/realtek/rtw89/coex.c | 38 ++++---- drivers/net/wireless/realtek/rtw89/coex.h | 14 +-- drivers/net/wireless/realtek/rtw89/core.c | 96 ++++++++++--------- drivers/net/wireless/realtek/rtw89/core.h | 36 +++---- drivers/net/wireless/realtek/rtw89/fw.c | 4 +- drivers/net/wireless/realtek/rtw89/fw.h | 2 +- drivers/net/wireless/realtek/rtw89/mac80211.c | 21 ++-- drivers/net/wireless/realtek/rtw89/phy.c | 18 ++-- drivers/net/wireless/realtek/rtw89/phy.h | 4 +- drivers/net/wireless/realtek/rtw89/ser.c | 9 +- 12 files changed, 128 insertions(+), 122 deletions(-)
drivers/net/wireless/realtek/rtw89/chan.c +3 -3
@@ -2390,7 +2390,7 @@ static void rtw89_mcc_update_limit(struct rtw89_dev *rtwdev)rtw89_iterate_mcc_roles (rtwdev, rtw89_mcc_upd_lmt_iterator,NULL ); } -void rtw89_chanctx_work (struct work_struct *work) +void rtw89_chanctx_work (struct wiphy *wiphy,struct wiphy_work *work) { struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev, chanctx_work.work);
@@ -2477,8 +2477,8 @@ void rtw89_queue_chanctx_change(struct rtw89_dev *rtwdev,rtw89_debug (rtwdev,RTW89_DBG_CHAN ,"queue chanctx work for mode %d with delay %d us\n" , mode, delay); -ieee80211_queue_delayed_work (rtwdev->hw, &rtwdev->chanctx_work, -usecs_to_jiffies (delay)); +wiphy_delayed_work_queue (rtwdev->hw->wiphy, &rtwdev->chanctx_work, +usecs_to_jiffies (delay)); }void rtw89_queue_chanctx_work (struct rtw89_dev *rtwdev)
drivers/net/wireless/realtek/rtw89/chan.h +1 -1
@@ -99,7 +99,7 @@ void rtw89_config_roc_chandef(struct rtw89_dev *rtwdev, const struct cfg80211_chan_def *chandef);void rtw89_entity_init (struct rtw89_dev *rtwdev);enum rtw89_entity_mode rtw89_entity_recalc (struct rtw89_dev *rtwdev); -void rtw89_chanctx_work (struct work_struct *work); +void rtw89_chanctx_work (struct wiphy *wiphy,struct wiphy_work *work);void rtw89_queue_chanctx_work (struct rtw89_dev *rtwdev);void rtw89_queue_chanctx_change (struct rtw89_dev *rtwdev,enum rtw89_chanctx_changes change);
drivers/net/wireless/realtek/rtw89/coex.c +20 -18
@@ -6712,7 +6712,7 @@ static void _update_wl_info_v8(struct rtw89_dev *rtwdev, u8 role_id, u8 rlink_id_fw_set_drv_info (rtwdev,CXDRVINFO_ROLE ); } -void rtw89_coex_act1_work (struct work_struct *work) +void rtw89_coex_act1_work (struct wiphy *wiphy,struct wiphy_work *work) { struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev, coex_act1_work.work);
@@ -6733,7 +6733,7 @@ void rtw89_coex_act1_work(struct work_struct *work)mutex_unlock (&rtwdev->mutex); } -void rtw89_coex_bt_devinfo_work (struct work_struct *work) +void rtw89_coex_bt_devinfo_work (struct wiphy *wiphy,struct wiphy_work *work) { struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev, coex_bt_devinfo_work.work);
@@ -6749,7 +6749,7 @@ void rtw89_coex_bt_devinfo_work(struct work_struct *work)mutex_unlock (&rtwdev->mutex); } -void rtw89_coex_rfk_chk_work (struct work_struct *work) +void rtw89_coex_rfk_chk_work (struct wiphy *wiphy,struct wiphy_work *work) { struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev, coex_rfk_chk_work.work);
@@ -7278,7 +7278,7 @@ void rtw89_btc_ntfy_specific_packet(struct rtw89_dev *rtwdev,"[BTC], %s(): EAPOL_End cnt=%d\n" , __func__, cnt); wl->status.map._4way = false; -cancel_delayed_work (&rtwdev->coex_act1_work); +wiphy_delayed_work_cancel (rtwdev->hw->wiphy, &rtwdev->coex_act1_work);break ;case PACKET_ARP : cnt = ++cx->cnt_wl[BTC_WCNT_ARP ];
@@ -7297,16 +7297,16 @@ void rtw89_btc_ntfy_specific_packet(struct rtw89_dev *rtwdev, }if (delay_work) { -cancel_delayed_work (&rtwdev->coex_act1_work); -ieee80211_queue_delayed_work (rtwdev->hw, - &rtwdev->coex_act1_work, delay); +wiphy_delayed_work_cancel (rtwdev->hw->wiphy, &rtwdev->coex_act1_work); +wiphy_delayed_work_queue (rtwdev->hw->wiphy, + &rtwdev->coex_act1_work, delay); } btc->dm.cnt_notify[BTC_NCNT_SPECIAL_PACKET ]++;_run_coex (rtwdev,BTC_RSN_NTFY_SPECIFIC_PACKET ); } -void rtw89_btc_ntfy_eapol_packet_work (struct work_struct *work) +void rtw89_btc_ntfy_eapol_packet_work (struct wiphy *wiphy,struct wiphy_work *work) { struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev, btc.eapol_notify_work);
@@ -7317,7 +7317,7 @@ void rtw89_btc_ntfy_eapol_packet_work(struct work_struct *work)mutex_unlock (&rtwdev->mutex); } -void rtw89_btc_ntfy_arp_packet_work (struct work_struct *work) +void rtw89_btc_ntfy_arp_packet_work (struct wiphy *wiphy,struct wiphy_work *work) { struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev, btc.arp_notify_work);
@@ -7327,7 +7327,7 @@ void rtw89_btc_ntfy_arp_packet_work(struct work_struct *work)mutex_unlock (&rtwdev->mutex); } -void rtw89_btc_ntfy_dhcp_packet_work (struct work_struct *work) +void rtw89_btc_ntfy_dhcp_packet_work (struct wiphy *wiphy,struct wiphy_work *work) { struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev, btc.dhcp_notify_work);
@@ -7338,7 +7338,7 @@ void rtw89_btc_ntfy_dhcp_packet_work(struct work_struct *work)mutex_unlock (&rtwdev->mutex); } -void rtw89_btc_ntfy_icmp_packet_work (struct work_struct *work) +void rtw89_btc_ntfy_icmp_packet_work (struct wiphy *wiphy,struct wiphy_work *work) { struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev, btc.icmp_notify_work);
@@ -7525,9 +7525,9 @@ static void _update_bt_info(struct rtw89_dev *rtwdev, u8 *buf, u32 len) a2dp->vendor_id =0 ; a2dp->flush_time =0 ; a2dp->play_latency =1 ; -ieee80211_queue_delayed_work (rtwdev->hw, - &rtwdev->coex_bt_devinfo_work, -RTW89_COEX_BT_DEVINFO_WORK_PERIOD ); +wiphy_delayed_work_queue (rtwdev->hw->wiphy, + &rtwdev->coex_bt_devinfo_work, +RTW89_COEX_BT_DEVINFO_WORK_PERIOD ); }_run_coex (rtwdev,BTC_RSN_UPDATE_BT_INFO );
@@ -7776,7 +7776,7 @@ static bool _ntfy_wl_rfk(struct rtw89_dev *rtwdev, u8 phy_path, wl->rfk_info.state =BTC_WRFK_STOP ;_write_scbd (rtwdev,BTC_WSCB_WLRFK , false); -cancel_delayed_work (&rtwdev->coex_rfk_chk_work); +wiphy_delayed_work_cancel (rtwdev->hw->wiphy, &rtwdev->coex_rfk_chk_work);break ;default : rtw89_debug(rtwdev, RTW89_DBG_BTC,
@@ -7790,9 +7790,9 @@ static bool _ntfy_wl_rfk(struct rtw89_dev *rtwdev, u8 phy_path,_run_coex (rtwdev,BTC_RSN_NTFY_WL_RFK );if (wl->rfk_info.state ==BTC_WRFK_START ) -ieee80211_queue_delayed_work (rtwdev->hw, - &rtwdev->coex_rfk_chk_work, -RTW89_COEX_RFK_CHK_WORK_PERIOD ); +wiphy_delayed_work_queue (rtwdev->hw->wiphy, + &rtwdev->coex_rfk_chk_work, +RTW89_COEX_RFK_CHK_WORK_PERIOD ); } rtw89_debug(rtwdev, RTW89_DBG_BTC,
@@ -7810,6 +7810,8 @@ void rtw89_btc_ntfy_wl_rfk(struct rtw89_dev *rtwdev, u8 phy_map,bool allow;int ret; +lockdep_assert_wiphy (rtwdev->hw->wiphy); + band =FIELD_GET (BTC_RFK_BAND_MAP , phy_map); rtw89_debug(rtwdev, RTW89_DBG_RFK,
drivers/net/wireless/realtek/rtw89/coex.h +7 -7
@@ -267,10 +267,10 @@ void rtw89_btc_ntfy_scan_finish(struct rtw89_dev *rtwdev, u8 phy_idx);void rtw89_btc_ntfy_switch_band (struct rtw89_dev *rtwdev,u8 phy_idx,u8 band);void rtw89_btc_ntfy_specific_packet (struct rtw89_dev *rtwdev,enum btc_pkt_type pkt_type); -void rtw89_btc_ntfy_eapol_packet_work (struct work_struct *work); -void rtw89_btc_ntfy_arp_packet_work (struct work_struct *work); -void rtw89_btc_ntfy_dhcp_packet_work (struct work_struct *work); -void rtw89_btc_ntfy_icmp_packet_work (struct work_struct *work); +void rtw89_btc_ntfy_eapol_packet_work (struct wiphy *wiphy,struct wiphy_work *work); +void rtw89_btc_ntfy_arp_packet_work (struct wiphy *wiphy,struct wiphy_work *work); +void rtw89_btc_ntfy_dhcp_packet_work (struct wiphy *wiphy,struct wiphy_work *work); +void rtw89_btc_ntfy_icmp_packet_work (struct wiphy *wiphy,struct wiphy_work *work); void rtw89_btc_ntfy_role_info(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvif_link, struct rtw89_sta_link *rtwsta_link,
@@ -283,9 +283,9 @@ void rtw89_btc_ntfy_wl_sta(struct rtw89_dev *rtwdev);void rtw89_btc_c2h_handle (struct rtw89_dev *rtwdev,struct sk_buff *skb,u32 len,u8 class,u8 func);void rtw89_btc_dump_info (struct rtw89_dev *rtwdev,struct seq_file *m); -void rtw89_coex_act1_work (struct work_struct *work); -void rtw89_coex_bt_devinfo_work (struct work_struct *work); -void rtw89_coex_rfk_chk_work (struct work_struct *work); +void rtw89_coex_act1_work (struct wiphy *wiphy,struct wiphy_work *work); +void rtw89_coex_bt_devinfo_work (struct wiphy *wiphy,struct wiphy_work *work); +void rtw89_coex_rfk_chk_work (struct wiphy *wiphy,struct wiphy_work *work);void rtw89_coex_power_on (struct rtw89_dev *rtwdev);void rtw89_btc_set_policy (struct rtw89_dev *rtwdev,u16 policy_type);void rtw89_btc_set_policy_v1 (struct rtw89_dev *rtwdev,u16 policy_type);
drivers/net/wireless/realtek/rtw89/core.c +49 -47
218 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/core.h +18 -18
@@ -3175,10 +3175,10 @@ struct rtw89_btc {struct rtw89_btc_btf_fwinfo fwinfo;struct rtw89_btc_dbg dbg; -struct work_struct eapol_notify_work; -struct work_struct arp_notify_work; -struct work_struct dhcp_notify_work; -struct work_struct icmp_notify_work; +struct wiphy_work eapol_notify_work; +struct wiphy_work arp_notify_work; +struct wiphy_work dhcp_notify_work; +struct wiphy_work icmp_notify_work;u32 bt_req_len;
@@ -3445,7 +3445,7 @@ enum rtw89_roc_state {struct rtw89_roc {struct ieee80211_channel chan; -struct delayed_work roc_work; +struct wiphy_delayed_work roc_work;enum ieee80211_roc_type type;enum rtw89_roc_state state;int duration;
@@ -3515,7 +3515,7 @@ struct rtw89_vif_link {bool pre_pwr_diff_en;bool pwr_diff_en;u8 def_tri_idx; -struct work_struct update_beacon_work; +struct wiphy_work update_beacon_work;struct rtw89_addr_cam_entry addr_cam;struct rtw89_bssid_cam_entry bssid_cam;struct ieee80211_tx_queue_params tx_params[IEEE80211_NUM_ACS ];
@@ -5652,10 +5652,10 @@ struct rtw89_dev {struct rtw89_cam_info cam_info;struct sk_buff_head c2h_queue; -struct work_struct c2h_work; -struct work_struct ips_work; +struct wiphy_work c2h_work; +struct wiphy_work ips_work; +struct wiphy_work cancel_6ghz_probe_work;struct work_struct load_firmware_work; -struct work_struct cancel_6ghz_probe_work;struct list_head early_h2c_list;
@@ -5700,14 +5700,14 @@ struct rtw89_dev {struct rtw89_edcca_bak edcca_bak; } bbs[RTW89_PHY_NUM ]; -struct delayed_work track_work; -struct delayed_work chanctx_work; -struct delayed_work coex_act1_work; -struct delayed_work coex_bt_devinfo_work; -struct delayed_work coex_rfk_chk_work; -struct delayed_work cfo_track_work; +struct wiphy_delayed_work track_work; +struct wiphy_delayed_work chanctx_work; +struct wiphy_delayed_work coex_act1_work; +struct wiphy_delayed_work coex_bt_devinfo_work; +struct wiphy_delayed_work coex_rfk_chk_work; +struct wiphy_delayed_work cfo_track_work;struct delayed_work forbid_ba_work; -struct delayed_work antdiv_work; +struct wiphy_delayed_work antdiv_work;struct rtw89_ppdu_sts_info ppdu_sts;u8 total_sta_assoc;bool scanning;
@@ -7150,8 +7150,8 @@ void rtw89_complete_cond(struct rtw89_wait_info *wait, unsigned int cond, const struct rtw89_completion_data *data);int rtw89_core_start (struct rtw89_dev *rtwdev);void rtw89_core_stop (struct rtw89_dev *rtwdev); -void rtw89_core_update_beacon_work (struct work_struct *work); -void rtw89_roc_work (struct work_struct *work); +void rtw89_core_update_beacon_work (struct wiphy *wiphy,struct wiphy_work *work); +void rtw89_roc_work (struct wiphy *wiphy,struct wiphy_work *work);void rtw89_roc_start (struct rtw89_dev *rtwdev,struct rtw89_vif *rtwvif);void rtw89_roc_end (struct rtw89_dev *rtwdev,struct rtw89_vif *rtwvif); void rtw89_core_scan_start(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvif_link,
drivers/net/wireless/realtek/rtw89/fw.c +2 -2
@@ -6059,7 +6059,7 @@ void rtw89_fw_c2h_irqsafe(struct rtw89_dev *rtwdev, struct sk_buff *c2h) enqueue:skb_queue_tail (&rtwdev->c2h_queue, c2h); -ieee80211_queue_work (rtwdev->hw, &rtwdev->c2h_work); +wiphy_work_queue (rtwdev->hw->wiphy, &rtwdev->c2h_work); } static void rtw89_fw_c2h_cmd_handle(struct rtw89_dev *rtwdev,
@@ -6097,7 +6097,7 @@ static void rtw89_fw_c2h_cmd_handle(struct rtw89_dev *rtwdev,rtw89_hex_dump (rtwdev,RTW89_DBG_FW ,"C2H: " , skb->data, skb->len); } -void rtw89_fw_c2h_work (struct work_struct *work) +void rtw89_fw_c2h_work (struct wiphy *wiphy,struct wiphy_work *work) { struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev, c2h_work);
drivers/net/wireless/realtek/rtw89/fw.h +1 -1
@@ -4588,7 +4588,7 @@ int rtw89_fw_h2c_dctl_sec_cam_v2(struct rtw89_dev *rtwdev,struct rtw89_vif_link *rtwvif_link, struct rtw89_sta_link *rtwsta_link);void rtw89_fw_c2h_irqsafe (struct rtw89_dev *rtwdev,struct sk_buff *c2h); -void rtw89_fw_c2h_work (struct work_struct *work); +void rtw89_fw_c2h_work (struct wiphy *wiphy,struct wiphy_work *work); int rtw89_fw_h2c_role_maintain(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvif_link, struct rtw89_sta_link *rtwsta_link,
drivers/net/wireless/realtek/rtw89/mac80211.c +10 -11
@@ -80,7 +80,7 @@ static int rtw89_ops_config(struct ieee80211_hw *hw, u32 changed)struct rtw89_dev *rtwdev = hw->priv;/* let previous ips work finish to ensure we don't leave ips twice */ -cancel_work_sync (&rtwdev->ips_work); +wiphy_work_cancel (hw->wiphy, &rtwdev->ips_work);mutex_lock (&rtwdev->mutex);rtw89_leave_ps_mode (rtwdev);
@@ -115,7 +115,7 @@ static int __rtw89_ops_add_iface_link(struct rtw89_dev *rtwdev,rtw89_vif_type_mapping (rtwvif_link, false); -INIT_WORK (&rtwvif_link->update_beacon_work, rtw89_core_update_beacon_work); +wiphy_work_init (&rtwvif_link->update_beacon_work, rtw89_core_update_beacon_work);INIT_LIST_HEAD (&rtwvif_link->general_pkt_list); rtwvif_link->hit_rule =0 ;
@@ -143,7 +143,7 @@ static void __rtw89_ops_remove_iface_link(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvif_link) {mutex_unlock (&rtwdev->mutex); -cancel_work_sync (&rtwvif_link->update_beacon_work); +wiphy_work_cancel (rtwdev->hw->wiphy, &rtwvif_link->update_beacon_work);mutex_lock (&rtwdev->mutex);rtw89_leave_ps_mode (rtwdev);
@@ -198,7 +198,7 @@ static int rtw89_ops_add_interface(struct ieee80211_hw *hw, rtwvif->offchan = false; rtwvif->roc.state =RTW89_ROC_IDLE ; -INIT_DELAYED_WORK (&rtwvif->roc.roc_work, rtw89_roc_work); +wiphy_delayed_work_init (&rtwvif->roc.roc_work, rtw89_roc_work);rtw89_traffic_stats_init (rtwdev, &rtwvif->stats);
@@ -242,7 +242,7 @@ static void rtw89_ops_remove_interface(struct ieee80211_hw *hw,rtw89_debug (rtwdev,RTW89_DBG_STATE ,"remove vif %pM type %d p2p %d\n" , vif->addr, vif->type, vif->p2p); -cancel_delayed_work_sync (&rtwvif->roc.roc_work); +wiphy_delayed_work_cancel (hw->wiphy, &rtwvif->roc.roc_work);mutex_lock (&rtwdev->mutex);
@@ -853,14 +853,13 @@ void rtw89_ops_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,static int rtw89_ops_set_tim (struct ieee80211_hw *hw,struct ieee80211_sta *sta,bool set) { -struct rtw89_dev *rtwdev = hw->priv;struct rtw89_sta *rtwsta =sta_to_rtwsta (sta);struct rtw89_vif *rtwvif = rtwsta->rtwvif;struct rtw89_vif_link *rtwvif_link;unsigned int link_id;rtw89_vif_for_each_link (rtwvif, rtwvif_link, link_id) -ieee80211_queue_work (rtwdev->hw, &rtwvif_link->update_beacon_work); +wiphy_work_queue (hw->wiphy, &rtwvif_link->update_beacon_work);return 0 ; }
@@ -1453,7 +1452,7 @@ static int rtw89_ops_cancel_remain_on_channel(struct ieee80211_hw *hw,if (!rtwvif)return -EINVAL ; -cancel_delayed_work_sync (&rtwvif->roc.roc_work); +wiphy_delayed_work_cancel (hw->wiphy, &rtwvif->roc.roc_work);mutex_lock (&rtwdev->mutex);rtw89_roc_end (rtwdev, rtwvif);
@@ -1751,7 +1750,7 @@ static int rtw89_ops_suspend(struct ieee80211_hw *hw,int ret;set_bit (RTW89_FLAG_FORBIDDEN_TRACK_WROK , rtwdev->flags); -cancel_delayed_work_sync (&rtwdev->track_work); +wiphy_delayed_work_cancel (hw->wiphy, &rtwdev->track_work);mutex_lock (&rtwdev->mutex); ret =rtw89_wow_suspend (rtwdev, wowlan);
@@ -1778,8 +1777,8 @@ static int rtw89_ops_resume(struct ieee80211_hw *hw)mutex_unlock (&rtwdev->mutex);clear_bit (RTW89_FLAG_FORBIDDEN_TRACK_WROK , rtwdev->flags); -ieee80211_queue_delayed_work (rtwdev->hw, &rtwdev->track_work, -RTW89_TRACK_WORK_PERIOD ); +wiphy_delayed_work_queue (hw->wiphy, &rtwdev->track_work, +RTW89_TRACK_WORK_PERIOD );return ret ?1 :0 ; }
drivers/net/wireless/realtek/rtw89/phy.c +9 -9
@@ -4651,7 +4651,7 @@ static void rtw89_phy_cfo_dm(struct rtw89_dev *rtwdev)rtw89_phy_cfo_statistics_reset (rtwdev); } -void rtw89_phy_cfo_track_work (struct work_struct *work) +void rtw89_phy_cfo_track_work (struct wiphy *wiphy,struct wiphy_work *work) { struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev, cfo_track_work.work);
@@ -4662,8 +4662,8 @@ void rtw89_phy_cfo_track_work(struct work_struct *work) goto out;rtw89_leave_ps_mode (rtwdev);rtw89_phy_cfo_dm (rtwdev); -ieee80211_queue_delayed_work (rtwdev->hw, &rtwdev->cfo_track_work, -msecs_to_jiffies (cfo->cfo_timer_ms)); +wiphy_delayed_work_queue (wiphy, &rtwdev->cfo_track_work, +msecs_to_jiffies (cfo->cfo_timer_ms)); out:mutex_unlock (&rtwdev->mutex); }
@@ -4672,8 +4672,8 @@ static void rtw89_phy_cfo_start_work(struct rtw89_dev *rtwdev) {struct rtw89_cfo_tracking_info *cfo = &rtwdev->cfo_tracking; -ieee80211_queue_delayed_work (rtwdev->hw, &rtwdev->cfo_track_work, -msecs_to_jiffies (cfo->cfo_timer_ms)); +wiphy_delayed_work_queue (rtwdev->hw->wiphy, &rtwdev->cfo_track_work, +msecs_to_jiffies (cfo->cfo_timer_ms)); }void rtw89_phy_cfo_track (struct rtw89_dev *rtwdev)
@@ -6523,11 +6523,11 @@ static void rtw89_phy_antdiv_training_state(struct rtw89_dev *rtwdev) } antdiv->training_count++; -ieee80211_queue_delayed_work (rtwdev->hw, &rtwdev->antdiv_work, - state_period); +wiphy_delayed_work_queue (rtwdev->hw->wiphy, &rtwdev->antdiv_work, + state_period); } -void rtw89_phy_antdiv_work (struct work_struct *work) +void rtw89_phy_antdiv_work (struct wiphy *wiphy,struct wiphy_work *work) { struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev, antdiv_work.work);
@@ -6563,7 +6563,7 @@ void rtw89_phy_antdiv_track(struct rtw89_dev *rtwdev)return ; antdiv->training_count =0 ; -ieee80211_queue_delayed_work (rtwdev->hw, &rtwdev->antdiv_work,0 ); +wiphy_delayed_work_queue (rtwdev->hw->wiphy, &rtwdev->antdiv_work,0 ); } static void __rtw89_phy_env_monitor_init(struct rtw89_dev *rtwdev,
drivers/net/wireless/realtek/rtw89/phy.h +2 -2
@@ -978,7 +978,7 @@ void rtw89_phy_rfk_tssi_fill_fwcmd_tmeter_tbl(struct rtw89_dev *rtwdev,const struct rtw89_chan *chan, struct rtw89_h2c_rf_tssi *h2c);void rtw89_phy_cfo_track (struct rtw89_dev *rtwdev); -void rtw89_phy_cfo_track_work (struct work_struct *work); +void rtw89_phy_cfo_track_work (struct wiphy *wiphy,struct wiphy_work *work);void rtw89_phy_cfo_parse (struct rtw89_dev *rtwdev,s16 cfo_val,struct rtw89_rx_phy_ppdu *phy_ppdu);void rtw89_phy_stat_track (struct rtw89_dev *rtwdev);
@@ -991,7 +991,7 @@ void rtw89_phy_tx_path_div_track(struct rtw89_dev *rtwdev);void rtw89_phy_antdiv_parse (struct rtw89_dev *rtwdev,struct rtw89_rx_phy_ppdu *phy_ppdu);void rtw89_phy_antdiv_track (struct rtw89_dev *rtwdev); -void rtw89_phy_antdiv_work (struct work_struct *work); +void rtw89_phy_antdiv_work (struct wiphy *wiphy,struct wiphy_work *work);void rtw89_phy_set_bss_color (struct rtw89_dev *rtwdev,struct rtw89_vif_link *rtwvif_link); void rtw89_phy_tssi_ctrl_set_bandedge_cfg(struct rtw89_dev *rtwdev,
drivers/net/wireless/realtek/rtw89/ser.c +6 -3
@@ -485,10 +485,13 @@ static void ser_l1_reset_pre_st_hdl(struct rtw89_ser *ser, u8 evt)static void ser_reset_trx_st_hdl (struct rtw89_ser *ser,u8 evt) { struct rtw89_dev *rtwdev = container_of(ser, struct rtw89_dev, ser); +struct wiphy *wiphy = rtwdev->hw->wiphy;switch (evt) {case SER_EV_STATE_IN : -cancel_delayed_work_sync (&rtwdev->track_work); +wiphy_lock (wiphy); +wiphy_delayed_work_cancel (wiphy, &rtwdev->track_work); +wiphy_unlock (wiphy);drv_stop_tx (ser);if (hal_stop_dma (ser)) {
@@ -519,8 +522,8 @@ static void ser_reset_trx_st_hdl(struct rtw89_ser *ser, u8 evt)hal_enable_dma (ser);drv_resume_rx (ser);drv_resume_tx (ser); -ieee80211_queue_delayed_work (rtwdev->hw, &rtwdev->track_work, -RTW89_TRACK_WORK_PERIOD ); +wiphy_delayed_work_queue (wiphy, &rtwdev->track_work, +RTW89_TRACK_WORK_PERIOD );break ;default :
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 3/10 wifi: rtw89: debugfs: implement file_ops::read/write to replace seq_file
In reply to Ping-Ke ShihSince debugfs needs wiphy lock held, wiphy_locked_debugfs_{read,write}() will be adopted, so implmenet file_ops::read/write along with their arguments.
For reading part, it needs lots of changes because seq_file is not suitable for wiphy_locked_debugfs_{read,write}(), so use spatch script below to convert basically, and manually implement the functions.
@ rule1 @
identifier m;
@@
- seq_printf(m,
+ p += scnprintf(p, end - p,
...)
@ rule2 @
identifier m;
@@
- seq_puts(m,
+ p += scnprintf(p, end - p,
...)
For current version, only 4K buffer to output. To note ourselves, add ellipsis symbol "..." to trailing if buffer is full. Later, add an option to specify buffer size needed by a debugfs entry.
--- drivers/net/wireless/realtek/rtw89/coex.c | 2737 +++++++++++--------- drivers/net/wireless/realtek/rtw89/coex.h | 2 +- drivers/net/wireless/realtek/rtw89/debug.c | 1917 ++++++++------ drivers/net/wireless/realtek/rtw89/phy.c | 16 +- drivers/net/wireless/realtek/rtw89/phy.h | 4 +- drivers/net/wireless/realtek/rtw89/sar.c | 40 +- drivers/net/wireless/realtek/rtw89/sar.h | 5 +- drivers/net/wireless/realtek/rtw89/util.c | 11 + drivers/net/wireless/realtek/rtw89/util.h | 1 + 9 files changed, 2584 insertions(+), 2149 deletions(-)
drivers/net/wireless/realtek/rtw89/coex.c +1465 -1272
@@ -8153,7 +8153,7 @@ void rtw89_btc_c2h_handle(struct rtw89_dev *rtwdev, struct sk_buff *skb,#define BTC_CX_FW_OFFLOAD 0 -static void _show_cx_info (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_cx_info (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {union rtw89_btc_module_info *md = &rtwdev->btc.mdinfo;const struct rtw89_chip_info *chip = rtwdev->chip;
@@ -8165,40 +8165,43 @@ static void _show_cx_info(struct rtw89_dev *rtwdev, struct seq_file *m)struct rtw89_btc_wl_info *wl = &btc->cx.wl;u32 ver_main =0 , ver_sub =0 , ver_hotfix =0 , id_branch =0 ;u8 cv, rfe, iso, ant_num, ant_single_pos; +char *p = buf, *end = buf + bufsz;if (!(dm->coex_info_map &BTC_COEX_INFO_CX )) -return ; +return 0 ; dm->cnt_notify[BTC_NCNT_SHOW_COEX_INFO ]++; -seq_printf (m,"========== [BTC COEX INFO (%d)] ==========\n" , - chip->chip_id); + p +=scnprintf (p, end - p, +"========== [BTC COEX INFO (%d)] ==========\n" , + chip->chip_id); ver_main =FIELD_GET (GENMASK (31 ,24 ),RTW89_COEX_VERSION ); ver_sub =FIELD_GET (GENMASK (23 ,16 ),RTW89_COEX_VERSION ); ver_hotfix =FIELD_GET (GENMASK (15 ,8 ),RTW89_COEX_VERSION ); id_branch =FIELD_GET (GENMASK (7 ,0 ),RTW89_COEX_VERSION ); -seq_printf (m," %-15s : Coex:%d.%d.%d(branch:%d), " , -"[coex_version]" , ver_main, ver_sub, ver_hotfix, id_branch); + p +=scnprintf (p, end - p," %-15s : Coex:%d.%d.%d(branch:%d), " , +"[coex_version]" , ver_main, ver_sub, ver_hotfix, + id_branch); ver_main =FIELD_GET (GENMASK (31 ,24 ), wl->ver_info.fw_coex); ver_sub =FIELD_GET (GENMASK (23 ,16 ), wl->ver_info.fw_coex); ver_hotfix =FIELD_GET (GENMASK (15 ,8 ), wl->ver_info.fw_coex); id_branch =FIELD_GET (GENMASK (7 ,0 ), wl->ver_info.fw_coex); -seq_printf (m,"WL_FW_coex:%d.%d.%d(branch:%d)" , - ver_main, ver_sub, ver_hotfix, id_branch); + p +=scnprintf (p, end - p,"WL_FW_coex:%d.%d.%d(branch:%d)" , + ver_main, ver_sub, ver_hotfix, id_branch); ver_main =FIELD_GET (GENMASK (31 ,24 ), chip->wlcx_desired); ver_sub =FIELD_GET (GENMASK (23 ,16 ), chip->wlcx_desired); ver_hotfix =FIELD_GET (GENMASK (15 ,8 ), chip->wlcx_desired); -seq_printf (m,"(%s, desired:%d.%d.%d), " , - (wl->ver_info.fw_coex >= chip->wlcx_desired ? -"Match" :"Mismatch" ), ver_main, ver_sub, ver_hotfix); + p +=scnprintf (p, end - p,"(%s, desired:%d.%d.%d), " , + (wl->ver_info.fw_coex >= chip->wlcx_desired ? +"Match" :"Mismatch" ), ver_main, ver_sub, ver_hotfix); -seq_printf (m,"BT_FW_coex:%d(%s, desired:%d)\n" , - bt->ver_info.fw_coex, - (bt->ver_info.fw_coex >= chip->btcx_desired ? -"Match" :"Mismatch" ), chip->btcx_desired); + p +=scnprintf (p, end - p,"BT_FW_coex:%d(%s, desired:%d)\n" , + bt->ver_info.fw_coex, + (bt->ver_info.fw_coex >= chip->btcx_desired ? +"Match" :"Mismatch" ), chip->btcx_desired);if (bt->enable.now && bt->ver_info.fw ==0 )rtw89_btc_fw_en_rpt (rtwdev,RPT_EN_BT_VER_INFO , true);
@@ -8209,10 +8212,11 @@ static void _show_cx_info(struct rtw89_dev *rtwdev, struct seq_file *m) ver_sub =FIELD_GET (GENMASK (23 ,16 ), wl->ver_info.fw); ver_hotfix =FIELD_GET (GENMASK (15 ,8 ), wl->ver_info.fw); id_branch =FIELD_GET (GENMASK (7 ,0 ), wl->ver_info.fw); -seq_printf (m," %-15s : WL_FW:%d.%d.%d.%d, BT_FW:0x%x(%s)\n" , -"[sub_module]" , - ver_main, ver_sub, ver_hotfix, id_branch, - bt->ver_info.fw, bt->run_patch_code ?"patch" :"ROM" ); + p +=scnprintf (p, end - p, +" %-15s : WL_FW:%d.%d.%d.%d, BT_FW:0x%x(%s)\n" , +"[sub_module]" , + ver_main, ver_sub, ver_hotfix, id_branch, + bt->ver_info.fw, bt->run_patch_code ?"patch" :"ROM" );if (ver->fcxinit ==7 ) { cv = md->md_v7.kt_ver;
@@ -8228,36 +8232,41 @@ static void _show_cx_info(struct rtw89_dev *rtwdev, struct seq_file *m) ant_single_pos = md->md.ant.single_pos; } -seq_printf (m," %-15s : cv:%x, rfe_type:0x%x, ant_iso:%d, ant_pg:%d, %s" , -"[hw_info]" , cv, rfe, iso, ant_num, - ant_num >1 ?"" : - ant_single_pos ?"1Ant_Pos:S1, " :"1Ant_Pos:S0, " ); + p +=scnprintf (p, end - p, +" %-15s : cv:%x, rfe_type:0x%x, ant_iso:%d, ant_pg:%d, %s" , +"[hw_info]" , cv, rfe, iso, ant_num, + ant_num >1 ?"" : + ant_single_pos ?"1Ant_Pos:S1, " :"1Ant_Pos:S0, " ); -seq_printf (m,"3rd_coex:%d, dbcc:%d, tx_num:%d, rx_num:%d\n" , - btc->cx.other.type, rtwdev->dbcc_en, hal->tx_nss, - hal->rx_nss); + p +=scnprintf (p, end - p, +"3rd_coex:%d, dbcc:%d, tx_num:%d, rx_num:%d\n" , + btc->cx.other.type, rtwdev->dbcc_en, hal->tx_nss, + hal->rx_nss); + +return p - buf; } -static void _show_wl_role_info (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_wl_role_info (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_wl_link_info *plink =NULL ;struct rtw89_btc_wl_info *wl = &btc->cx.wl;struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info;struct rtw89_traffic_stats *t; +char *p = buf, *end = buf + bufsz;u8 i;if (rtwdev->dbcc_en) { -seq_printf (m, -" %-15s : PHY0_band(op:%d/scan:%d/real:%d), " , -"[dbcc_info]" , wl_dinfo->op_band[RTW89_PHY_0 ], - wl_dinfo->scan_band[RTW89_PHY_0 ], - wl_dinfo->real_band[RTW89_PHY_0 ]); -seq_printf (m, -"PHY1_band(op:%d/scan:%d/real:%d)\n" , - wl_dinfo->op_band[RTW89_PHY_1 ], - wl_dinfo->scan_band[RTW89_PHY_1 ], - wl_dinfo->real_band[RTW89_PHY_1 ]); + p +=scnprintf (p, end - p, +" %-15s : PHY0_band(op:%d/scan:%d/real:%d), " , +"[dbcc_info]" , wl_dinfo->op_band[RTW89_PHY_0 ], + wl_dinfo->scan_band[RTW89_PHY_0 ], + wl_dinfo->real_band[RTW89_PHY_0 ]); + p +=scnprintf (p, end - p, +"PHY1_band(op:%d/scan:%d/real:%d)\n" , + wl_dinfo->op_band[RTW89_PHY_1 ], + wl_dinfo->scan_band[RTW89_PHY_1 ], + wl_dinfo->real_band[RTW89_PHY_1 ]); }for (i =0 ; i <RTW89_PORT_NUM ; i++) {
@@ -8269,38 +8278,41 @@ static void _show_wl_role_info(struct rtw89_dev *rtwdev, struct seq_file *m)if (!plink->active)continue ; -seq_printf (m, -" [port_%d] : role=%d(phy-%d), connect=%d(client_cnt=%d), mode=%d, center_ch=%d, bw=%d" , - plink->pid, (u32 )plink->role, plink->phy, - (u32 )plink->connected, plink->client_cnt -1 , - (u32 )plink->mode, plink->ch, (u32 )plink->bw); + p +=scnprintf (p, end - p, +" [port_%d] : role=%d(phy-%d), connect=%d(client_cnt=%d), mode=%d, center_ch=%d, bw=%d" , + plink->pid, (u32 )plink->role, plink->phy, + (u32 )plink->connected, plink->client_cnt -1 , + (u32 )plink->mode, plink->ch, (u32 )plink->bw);if (plink->connected ==MLME_NO_LINK )continue ; -seq_printf (m, -", mac_id=%d, max_tx_time=%dus, max_tx_retry=%d\n" , - plink->mac_id, plink->tx_time, plink->tx_retry); + p +=scnprintf (p, end - p, +", mac_id=%d, max_tx_time=%dus, max_tx_retry=%d\n" , + plink->mac_id, plink->tx_time, plink->tx_retry); -seq_printf (m, -" [port_%d] : rssi=-%ddBm(%d), busy=%d, dir=%s, " , - plink->pid,110 - plink->stat.rssi, - plink->stat.rssi, plink->busy, - plink->dir ==RTW89_TFC_UL ?"UL" :"DL" ); + p +=scnprintf (p, end - p, +" [port_%d] : rssi=-%ddBm(%d), busy=%d, dir=%s, " , + plink->pid,110 - plink->stat.rssi, + plink->stat.rssi, plink->busy, + plink->dir ==RTW89_TFC_UL ?"UL" :"DL" ); t = &plink->stat.traffic; -seq_printf (m, -"tx[rate:%d/busy_level:%d], " , - (u32 )t->tx_rate, t->tx_tfc_lv); + p +=scnprintf (p, end - p, +"tx[rate:%d/busy_level:%d], " , + (u32 )t->tx_rate, t->tx_tfc_lv); -seq_printf (m,"rx[rate:%d/busy_level:%d/drop:%d]\n" , - (u32 )t->rx_rate, - t->rx_tfc_lv, plink->rx_rate_drop_cnt); + p +=scnprintf (p, end - p, +"rx[rate:%d/busy_level:%d/drop:%d]\n" , + (u32 )t->rx_rate, + t->rx_tfc_lv, plink->rx_rate_drop_cnt); } + +return p - buf; } -static void _show_wl_info (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_wl_info (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;const struct rtw89_btc_ver *ver = btc->ver;
@@ -8311,12 +8323,13 @@ static void _show_wl_info(struct rtw89_dev *rtwdev, struct seq_file *m)struct rtw89_btc_wl_role_info_v2 *wl_rinfo_v2 = &wl->role_info_v2;struct rtw89_btc_wl_role_info_v7 *wl_rinfo_v7 = &wl->role_info_v7;struct rtw89_btc_wl_role_info_v8 *wl_rinfo_v8 = &wl->role_info_v8; +char *p = buf, *end = buf + bufsz;u8 mode;if (!(btc->dm.coex_info_map &BTC_COEX_INFO_WL )) -return ; +return 0 ; -seq_puts (m,"========== [WL Status] ==========\n" ); + p +=scnprintf (p, end - p,"========== [WL Status] ==========\n" );if (ver->fwlrole ==0 ) mode = wl_rinfo->link_mode;
@@ -8329,24 +8342,28 @@ static void _show_wl_info(struct rtw89_dev *rtwdev, struct seq_file *m)else if (ver->fwlrole ==8 ) mode = wl_rinfo_v8->link_mode;else -return ; + goto out; + + p +=scnprintf (p, end - p," %-15s : link_mode:%d, " ,"[status]" , + mode); -seq_printf (m," %-15s : link_mode:%d, " ,"[status]" , mode); + p +=scnprintf (p, end - p, +"rf_off:%d, power_save:%d, scan:%s(band:%d/phy_map:0x%x), " , + wl->status.map.rf_off, wl->status.map.lps, + wl->status.map.scan ?"Y" :"N" , + wl->scan_info.band[RTW89_PHY_0 ], wl->scan_info.phy_map); -seq_printf (m, -"rf_off:%d, power_save:%d, scan:%s(band:%d/phy_map:0x%x), " , - wl->status.map.rf_off, wl->status.map.lps, - wl->status.map.scan ?"Y" :"N" , - wl->scan_info.band[RTW89_PHY_0 ], wl->scan_info.phy_map); + p +=scnprintf (p, end - p, +"connecting:%s, roam:%s, 4way:%s, init_ok:%s\n" , + wl->status.map.connecting ?"Y" :"N" , + wl->status.map.roaming ?"Y" :"N" , + wl->status.map._4way ?"Y" :"N" , + wl->status.map.init_ok ?"Y" :"N" ); -seq_printf (m, -"connecting:%s, roam:%s, 4way:%s, init_ok:%s\n" , - wl->status.map.connecting ?"Y" :"N" , - wl->status.map.roaming ?"Y" :"N" , - wl->status.map._4way ?"Y" :"N" , - wl->status.map.init_ok ?"Y" :"N" ); + p +=_show_wl_role_info (rtwdev, p, end - p); -_show_wl_role_info (rtwdev, m); +out: +return p - buf; } enum btc_bt_a2dp_type {
@@ -8355,7 +8372,7 @@ enum btc_bt_a2dp_type { BTC_A2DP_TWS_RELAY = 2, }; -static void _show_bt_profile_info (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_bt_profile_info (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_bt_link_info *bt_linfo = &btc->cx.bt.link_info;
@@ -8363,50 +8380,55 @@ static void _show_bt_profile_info(struct rtw89_dev *rtwdev, struct seq_file *m)struct rtw89_btc_bt_hid_desc hid = bt_linfo->hid_desc;struct rtw89_btc_bt_a2dp_desc a2dp = bt_linfo->a2dp_desc;struct rtw89_btc_bt_pan_desc pan = bt_linfo->pan_desc; +char *p = buf, *end = buf + bufsz;if (hfp.exist) { -seq_printf (m," %-15s : type:%s, sut_pwr:%d, golden-rx:%d" , -"[HFP]" , (hfp.type ==0 ?"SCO" :"eSCO" ), - bt_linfo->sut_pwr_level[0 ], - bt_linfo->golden_rx_shift[0 ]); + p +=scnprintf (p, end - p, +" %-15s : type:%s, sut_pwr:%d, golden-rx:%d" , +"[HFP]" , (hfp.type ==0 ?"SCO" :"eSCO" ), + bt_linfo->sut_pwr_level[0 ], + bt_linfo->golden_rx_shift[0 ]); }if (hid.exist) { -seq_printf (m, -"\n\r %-15s : type:%s%s%s%s%s pair-cnt:%d, sut_pwr:%d, golden-rx:%d\n" , -"[HID]" , - hid.type &BTC_HID_218 ?"2/18," :"" , - hid.type &BTC_HID_418 ?"4/18," :"" , - hid.type &BTC_HID_BLE ?"BLE," :"" , - hid.type &BTC_HID_RCU ?"RCU," :"" , - hid.type &BTC_HID_RCU_VOICE ?"RCU-Voice," :"" , - hid.pair_cnt, bt_linfo->sut_pwr_level[1 ], - bt_linfo->golden_rx_shift[1 ]); + p +=scnprintf (p, end - p, +"\n\r %-15s : type:%s%s%s%s%s pair-cnt:%d, sut_pwr:%d, golden-rx:%d\n" , +"[HID]" , + hid.type &BTC_HID_218 ?"2/18," :"" , + hid.type &BTC_HID_418 ?"4/18," :"" , + hid.type &BTC_HID_BLE ?"BLE," :"" , + hid.type &BTC_HID_RCU ?"RCU," :"" , + hid.type &BTC_HID_RCU_VOICE ?"RCU-Voice," :"" , + hid.pair_cnt, bt_linfo->sut_pwr_level[1 ], + bt_linfo->golden_rx_shift[1 ]); }if (a2dp.exist) { -seq_printf (m, -" %-15s : type:%s, bit-pool:%d, flush-time:%d, " , -"[A2DP]" , - a2dp.type ==BTC_A2DP_LEGACY ?"Legacy" :"TWS" , - a2dp.bitpool, a2dp.flush_time); + p +=scnprintf (p, end - p, +" %-15s : type:%s, bit-pool:%d, flush-time:%d, " , +"[A2DP]" , + a2dp.type ==BTC_A2DP_LEGACY ?"Legacy" :"TWS" , + a2dp.bitpool, a2dp.flush_time); -seq_printf (m, -"vid:0x%x, Dev-name:0x%x, sut_pwr:%d, golden-rx:%d\n" , - a2dp.vendor_id, a2dp.device_name, - bt_linfo->sut_pwr_level[2 ], - bt_linfo->golden_rx_shift[2 ]); + p +=scnprintf (p, end - p, +"vid:0x%x, Dev-name:0x%x, sut_pwr:%d, golden-rx:%d\n" , + a2dp.vendor_id, a2dp.device_name, + bt_linfo->sut_pwr_level[2 ], + bt_linfo->golden_rx_shift[2 ]); }if (pan.exist) { -seq_printf (m," %-15s : sut_pwr:%d, golden-rx:%d\n" , -"[PAN]" , - bt_linfo->sut_pwr_level[3 ], - bt_linfo->golden_rx_shift[3 ]); + p +=scnprintf (p, end - p, +" %-15s : sut_pwr:%d, golden-rx:%d\n" , +"[PAN]" , + bt_linfo->sut_pwr_level[3 ], + bt_linfo->golden_rx_shift[3 ]); } + +return p - buf; } -static void _show_bt_info (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_bt_info (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;const struct rtw89_btc_ver *ver = btc->ver;
@@ -8415,129 +8437,136 @@ static void _show_bt_info(struct rtw89_dev *rtwdev, struct seq_file *m)struct rtw89_btc_wl_info *wl = &cx->wl;struct rtw89_btc_bt_link_info *bt_linfo = &bt->link_info;union rtw89_btc_module_info *md = &btc->mdinfo; +char *p = buf, *end = buf + bufsz;u8 *afh = bt_linfo->afh_map;u8 *afh_le = bt_linfo->afh_map_le;u8 bt_pos;if (!(btc->dm.coex_info_map &BTC_COEX_INFO_BT )) -return ; +return 0 ;if (ver->fcxinit ==7 ) bt_pos = md->md_v7.bt_pos;else bt_pos = md->md.bt_pos; -seq_puts (m,"========== [BT Status] ==========\n" ); - -seq_printf (m," %-15s : enable:%s, btg:%s%s, connect:%s, " , -"[status]" , bt->enable.now ?"Y" :"N" , - bt->btg_type ?"Y" :"N" , - (bt->enable.now && (bt->btg_type != bt_pos) ? -"(efuse-mismatch!!)" :"" ), - (bt_linfo->status.map.connect ?"Y" :"N" )); - -seq_printf (m,"igno_wl:%s, mailbox_avl:%s, rfk_state:0x%x\n" , - bt->igno_wl ?"Y" :"N" , - bt->mbx_avl ?"Y" :"N" , bt->rfk_info.val); - -seq_printf (m," %-15s : profile:%s%s%s%s%s " , -"[profile]" , - (bt_linfo->profile_cnt.now ==0 ) ?"None," :"" , - bt_linfo->hfp_desc.exist ?"HFP," :"" , - bt_linfo->hid_desc.exist ?"HID," :"" , - bt_linfo->a2dp_desc.exist ? - (bt_linfo->a2dp_desc.sink ?"A2DP_sink," :"A2DP," ) :"" , - bt_linfo->pan_desc.exist ?"PAN," :"" ); - -seq_printf (m, -"multi-link:%s, role:%s, ble-connect:%s, CQDDR:%s, A2DP_active:%s, PAN_active:%s\n" , - bt_linfo->multi_link.now ?"Y" :"N" , - bt_linfo->slave_role ?"Slave" :"Master" , - bt_linfo->status.map.ble_connect ?"Y" :"N" , - bt_linfo->cqddr ?"Y" :"N" , - bt_linfo->a2dp_desc.active ?"Y" :"N" , - bt_linfo->pan_desc.active ?"Y" :"N" ); - -seq_printf (m, -" %-15s : rssi:%ddBm(lvl:%d), tx_rate:%dM, %s%s%s" , -"[link]" , bt_linfo->rssi -100 , - bt->rssi_level, - bt_linfo->tx_3m ?3 :2 , - bt_linfo->status.map.inq_pag ?" inq-page!!" :"" , - bt_linfo->status.map.acl_busy ?" acl_busy!!" :"" , - bt_linfo->status.map.mesh_busy ?" mesh_busy!!" :"" ); - -seq_printf (m, -"%s afh_map[%02x%02x_%02x%02x_%02x%02x_%02x%02x_%02x%02x], " , - bt_linfo->relink.now ?" ReLink!!" :"" , - afh[0 ], afh[1 ], afh[2 ], afh[3 ], afh[4 ], - afh[5 ], afh[6 ], afh[7 ], afh[8 ], afh[9 ]); + p +=scnprintf (p, end - p,"========== [BT Status] ==========\n" ); + + p +=scnprintf (p, end - p, +" %-15s : enable:%s, btg:%s%s, connect:%s, " , +"[status]" , bt->enable.now ?"Y" :"N" , + bt->btg_type ?"Y" :"N" , + (bt->enable.now && (bt->btg_type != bt_pos) ? +"(efuse-mismatch!!)" :"" ), + (bt_linfo->status.map.connect ?"Y" :"N" )); + + p +=scnprintf (p, end - p, +"igno_wl:%s, mailbox_avl:%s, rfk_state:0x%x\n" , + bt->igno_wl ?"Y" :"N" , + bt->mbx_avl ?"Y" :"N" , bt->rfk_info.val); + + p +=scnprintf (p, end - p," %-15s : profile:%s%s%s%s%s " , +"[profile]" , + (bt_linfo->profile_cnt.now ==0 ) ?"None," :"" , + bt_linfo->hfp_desc.exist ?"HFP," :"" , + bt_linfo->hid_desc.exist ?"HID," :"" , + bt_linfo->a2dp_desc.exist ? + (bt_linfo->a2dp_desc.sink ?"A2DP_sink," :"A2DP," ) :"" , + bt_linfo->pan_desc.exist ?"PAN," :"" ); + + p +=scnprintf (p, end - p, +"multi-link:%s, role:%s, ble-connect:%s, CQDDR:%s, A2DP_active:%s, PAN_active:%s\n" , + bt_linfo->multi_link.now ?"Y" :"N" , + bt_linfo->slave_role ?"Slave" :"Master" , + bt_linfo->status.map.ble_connect ?"Y" :"N" , + bt_linfo->cqddr ?"Y" :"N" , + bt_linfo->a2dp_desc.active ?"Y" :"N" , + bt_linfo->pan_desc.active ?"Y" :"N" ); + + p +=scnprintf (p, end - p, +" %-15s : rssi:%ddBm(lvl:%d), tx_rate:%dM, %s%s%s" , +"[link]" , bt_linfo->rssi -100 , + bt->rssi_level, + bt_linfo->tx_3m ?3 :2 , + bt_linfo->status.map.inq_pag ?" inq-page!!" :"" , + bt_linfo->status.map.acl_busy ?" acl_busy!!" :"" , + bt_linfo->status.map.mesh_busy ?" mesh_busy!!" :"" ); + + p +=scnprintf (p, end - p, +"%s afh_map[%02x%02x_%02x%02x_%02x%02x_%02x%02x_%02x%02x], " , + bt_linfo->relink.now ?" ReLink!!" :"" , + afh[0 ], afh[1 ], afh[2 ], afh[3 ], afh[4 ], + afh[5 ], afh[6 ], afh[7 ], afh[8 ], afh[9 ]);if (ver->fcxbtafh ==2 && bt_linfo->status.map.ble_connect) -seq_printf (m, -"LE[%02x%02x_%02x_%02x%02x]" , - afh_le[0 ], afh_le[1 ], afh_le[2 ], - afh_le[3 ], afh_le[4 ]); - -seq_printf (m,"wl_ch_map[en:%d/ch:%d/bw:%d]\n" , - wl->afh_info.en, wl->afh_info.ch, wl->afh_info.bw); - -seq_printf (m, -" %-15s : retry:%d, relink:%d, rate_chg:%d, reinit:%d, reenable:%d, " , -"[stat_cnt]" , cx->cnt_bt[BTC_BCNT_RETRY ], - cx->cnt_bt[BTC_BCNT_RELINK ], cx->cnt_bt[BTC_BCNT_RATECHG ], - cx->cnt_bt[BTC_BCNT_REINIT ], cx->cnt_bt[BTC_BCNT_REENABLE ]); - -seq_printf (m, -"role-switch:%d, afh:%d, inq_page:%d(inq:%d/page:%d), igno_wl:%d\n" , - cx->cnt_bt[BTC_BCNT_ROLESW ], cx->cnt_bt[BTC_BCNT_AFH ], - cx->cnt_bt[BTC_BCNT_INQPAG ], cx->cnt_bt[BTC_BCNT_INQ ], - cx->cnt_bt[BTC_BCNT_PAGE ], cx->cnt_bt[BTC_BCNT_IGNOWL ]); - -_show_bt_profile_info (rtwdev, m); - -seq_printf (m, -" %-15s : raw_data[%02x %02x %02x %02x %02x %02x] (type:%s/cnt:%d/same:%d)\n" , -"[bt_info]" , bt->raw_info[2 ], bt->raw_info[3 ], - bt->raw_info[4 ], bt->raw_info[5 ], bt->raw_info[6 ], - bt->raw_info[7 ], - bt->raw_info[0 ] ==BTC_BTINFO_AUTO ?"auto" :"reply" , - cx->cnt_bt[BTC_BCNT_INFOUPDATE ], - cx->cnt_bt[BTC_BCNT_INFOSAME ]); - -seq_printf (m, -" %-15s : Hi-rx = %d, Hi-tx = %d, Lo-rx = %d, Lo-tx = %d (bt_polut_wl_tx = %d)" , -"[trx_req_cnt]" , cx->cnt_bt[BTC_BCNT_HIPRI_RX ], - cx->cnt_bt[BTC_BCNT_HIPRI_TX ], cx->cnt_bt[BTC_BCNT_LOPRI_RX ], - cx->cnt_bt[BTC_BCNT_LOPRI_TX ], cx->cnt_bt[BTC_BCNT_POLUT ]); + p +=scnprintf (p, end - p, +"LE[%02x%02x_%02x_%02x%02x]" , + afh_le[0 ], afh_le[1 ], afh_le[2 ], + afh_le[3 ], afh_le[4 ]); + + p +=scnprintf (p, end - p,"wl_ch_map[en:%d/ch:%d/bw:%d]\n" , + wl->afh_info.en, wl->afh_info.ch, wl->afh_info.bw); + + p +=scnprintf (p, end - p, +" %-15s : retry:%d, relink:%d, rate_chg:%d, reinit:%d, reenable:%d, " , +"[stat_cnt]" , cx->cnt_bt[BTC_BCNT_RETRY ], + cx->cnt_bt[BTC_BCNT_RELINK ], + cx->cnt_bt[BTC_BCNT_RATECHG ], + cx->cnt_bt[BTC_BCNT_REINIT ], + cx->cnt_bt[BTC_BCNT_REENABLE ]); + + p +=scnprintf (p, end - p, +"role-switch:%d, afh:%d, inq_page:%d(inq:%d/page:%d), igno_wl:%d\n" , + cx->cnt_bt[BTC_BCNT_ROLESW ], cx->cnt_bt[BTC_BCNT_AFH ], + cx->cnt_bt[BTC_BCNT_INQPAG ], cx->cnt_bt[BTC_BCNT_INQ ], + cx->cnt_bt[BTC_BCNT_PAGE ], cx->cnt_bt[BTC_BCNT_IGNOWL ]); + + p +=_show_bt_profile_info (rtwdev, p, end - p); + + p +=scnprintf (p, end - p, +" %-15s : raw_data[%02x %02x %02x %02x %02x %02x] (type:%s/cnt:%d/same:%d)\n" , +"[bt_info]" , bt->raw_info[2 ], bt->raw_info[3 ], + bt->raw_info[4 ], bt->raw_info[5 ], bt->raw_info[6 ], + bt->raw_info[7 ], + bt->raw_info[0 ] ==BTC_BTINFO_AUTO ?"auto" :"reply" , + cx->cnt_bt[BTC_BCNT_INFOUPDATE ], + cx->cnt_bt[BTC_BCNT_INFOSAME ]); + + p +=scnprintf (p, end - p, +" %-15s : Hi-rx = %d, Hi-tx = %d, Lo-rx = %d, Lo-tx = %d (bt_polut_wl_tx = %d)" , +"[trx_req_cnt]" , cx->cnt_bt[BTC_BCNT_HIPRI_RX ], + cx->cnt_bt[BTC_BCNT_HIPRI_TX ], + cx->cnt_bt[BTC_BCNT_LOPRI_RX ], + cx->cnt_bt[BTC_BCNT_LOPRI_TX ], + cx->cnt_bt[BTC_BCNT_POLUT ]);if (!bt->scan_info_update) {rtw89_btc_fw_en_rpt (rtwdev,RPT_EN_BT_SCAN_INFO , true); -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); }else {rtw89_btc_fw_en_rpt (rtwdev,RPT_EN_BT_SCAN_INFO , false);if (ver->fcxbtscan ==1 ) { -seq_printf (m, -"(INQ:%d-%d/PAGE:%d-%d/LE:%d-%d/INIT:%d-%d)" , -le16_to_cpu (bt->scan_info_v1[BTC_SCAN_INQ ].win), -le16_to_cpu (bt->scan_info_v1[BTC_SCAN_INQ ].intvl), -le16_to_cpu (bt->scan_info_v1[BTC_SCAN_PAGE ].win), -le16_to_cpu (bt->scan_info_v1[BTC_SCAN_PAGE ].intvl), -le16_to_cpu (bt->scan_info_v1[BTC_SCAN_BLE ].win), -le16_to_cpu (bt->scan_info_v1[BTC_SCAN_BLE ].intvl), -le16_to_cpu (bt->scan_info_v1[BTC_SCAN_INIT ].win), -le16_to_cpu (bt->scan_info_v1[BTC_SCAN_INIT ].intvl)); + p +=scnprintf (p, end - p, +"(INQ:%d-%d/PAGE:%d-%d/LE:%d-%d/INIT:%d-%d)" , +le16_to_cpu (bt->scan_info_v1[BTC_SCAN_INQ ].win), +le16_to_cpu (bt->scan_info_v1[BTC_SCAN_INQ ].intvl), +le16_to_cpu (bt->scan_info_v1[BTC_SCAN_PAGE ].win), +le16_to_cpu (bt->scan_info_v1[BTC_SCAN_PAGE ].intvl), +le16_to_cpu (bt->scan_info_v1[BTC_SCAN_BLE ].win), +le16_to_cpu (bt->scan_info_v1[BTC_SCAN_BLE ].intvl), +le16_to_cpu (bt->scan_info_v1[BTC_SCAN_INIT ].win), +le16_to_cpu (bt->scan_info_v1[BTC_SCAN_INIT ].intvl)); }else if (ver->fcxbtscan ==2 ) { -seq_printf (m, -"(BG:%d-%d/INIT:%d-%d/LE:%d-%d)" , -le16_to_cpu (bt->scan_info_v2[CXSCAN_BG ].win), -le16_to_cpu (bt->scan_info_v2[CXSCAN_BG ].intvl), -le16_to_cpu (bt->scan_info_v2[CXSCAN_INIT ].win), -le16_to_cpu (bt->scan_info_v2[CXSCAN_INIT ].intvl), -le16_to_cpu (bt->scan_info_v2[CXSCAN_LE ].win), -le16_to_cpu (bt->scan_info_v2[CXSCAN_LE ].intvl)); + p +=scnprintf (p, end - p, +"(BG:%d-%d/INIT:%d-%d/LE:%d-%d)" , +le16_to_cpu (bt->scan_info_v2[CXSCAN_BG ].win), +le16_to_cpu (bt->scan_info_v2[CXSCAN_BG ].intvl), +le16_to_cpu (bt->scan_info_v2[CXSCAN_INIT ].win), +le16_to_cpu (bt->scan_info_v2[CXSCAN_INIT ].intvl), +le16_to_cpu (bt->scan_info_v2[CXSCAN_LE ].win), +le16_to_cpu (bt->scan_info_v2[CXSCAN_LE ].intvl)); } -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); }if (bt_linfo->profile_cnt.now || bt_linfo->status.map.ble_connect)
@@ -8557,6 +8586,8 @@ static void _show_bt_info(struct rtw89_dev *rtwdev, struct seq_file *m)rtw89_btc_fw_en_rpt (rtwdev,RPT_EN_BT_DEVICE_INFO , true); elsertw89_btc_fw_en_rpt (rtwdev ,RPT_EN_BT_DEVICE_INFO ,false ); + +return p - buf; }#define CASE_BTC_RSN_STR (e) case BTC_RSN_ ## e: return #e
@@ -8850,114 +8881,132 @@ static const char *id_to_ant(u32 id) }static -void seq_print_segment (struct seq_file *m,const char *prefix,u16 *data, -u8 len,u8 seg_len,u8 start_idx,u8 ring_len) +int scnprintf_segment (char *buf,size_t bufsz,const char *prefix,const u16 *data, +u8 len,u8 seg_len,u8 start_idx,u8 ring_len) { -u8 i; +char *p = buf, *end = buf + bufsz;u8 cur_index; +u8 i;for (i =0 ; i < len ; i++) {if ((i % seg_len) ==0 ) -seq_printf (m," %-15s : " , prefix); + p +=scnprintf (p, end - p," %-15s : " , prefix); cur_index = (start_idx + i) % ring_len;if (i %3 ==0 ) -seq_printf (m,"-> %-20s" , -steps_to_str (*(data + cur_index))); + p +=scnprintf (p, end - p,"-> %-20s" , +steps_to_str (*(data + cur_index)));else if (i %3 ==1 ) -seq_printf (m,"-> %-15s" , -steps_to_str (*(data + cur_index))); + p +=scnprintf (p, end - p,"-> %-15s" , +steps_to_str (*(data + cur_index)));else -seq_printf (m,"-> %-13s" , -steps_to_str (*(data + cur_index))); + p +=scnprintf (p, end - p,"-> %-13s" , +steps_to_str (*(data + cur_index)));if (i == (len -1 ) || (i % seg_len) == (seg_len -1 )) -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); } + +return p - buf; } -static void _show_dm_step (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_dm_step (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_dm *dm = &btc->dm; +char *p = buf, *end = buf + bufsz;u8 start_idx;u8 len; len = dm->dm_step.step_ov ?RTW89_BTC_DM_MAXSTEP : dm->dm_step.step_pos; start_idx = dm->dm_step.step_ov ? dm->dm_step.step_pos :0 ; -seq_print_segment (m,"[dm_steps]" , dm->dm_step.step, len,6 , start_idx, -ARRAY_SIZE (dm->dm_step.step)); + p +=scnprintf_segment (p, end - p,"[dm_steps]" , dm->dm_step.step, len, +6 , start_idx,ARRAY_SIZE (dm->dm_step.step)); + +return p - buf; } -static void _show_dm_info (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_dm_info (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;const struct rtw89_btc_ver *ver = btc->ver;struct rtw89_btc_dm *dm = &btc->dm;struct rtw89_btc_wl_info *wl = &btc->cx.wl;struct rtw89_btc_bt_info *bt = &btc->cx.bt; +char *p = buf, *end = buf + bufsz;u8 igno_bt;if (!(dm->coex_info_map &BTC_COEX_INFO_DM )) -return ; +return 0 ; -seq_printf (m,"========== [Mechanism Status %s] ==========\n" , - (btc->manual_ctrl ?"(Manual)" :"(Auto)" )); + p +=scnprintf (p, end - p, +"========== [Mechanism Status %s] ==========\n" , + (btc->manual_ctrl ?"(Manual)" :"(Auto)" )); -seq_printf (m, -" %-15s : type:%s, reason:%s(), action:%s(), ant_path:%s, init_mode:%s, run_cnt:%d\n" , -"[status]" , - btc->ant_type ==BTC_ANT_SHARED ?"shared" :"dedicated" , -steps_to_str (dm->run_reason), -steps_to_str (dm->run_action |BTC_ACT_EXT_BIT ), -id_to_ant (FIELD_GET (GENMASK (7 ,0 ), dm->set_ant_path)), -id_to_mode (wl->coex_mode), - dm->cnt_dm[BTC_DCNT_RUN ]); + p +=scnprintf (p, end - p, +" %-15s : type:%s, reason:%s(), action:%s(), ant_path:%s, init_mode:%s, run_cnt:%d\n" , +"[status]" , + btc->ant_type ==BTC_ANT_SHARED ?"shared" :"dedicated" , +steps_to_str (dm->run_reason), +steps_to_str (dm->run_action |BTC_ACT_EXT_BIT ), +id_to_ant (FIELD_GET (GENMASK (7 ,0 ), dm->set_ant_path)), +id_to_mode (wl->coex_mode), + dm->cnt_dm[BTC_DCNT_RUN ]); -_show_dm_step (rtwdev, m); + p +=_show_dm_step (rtwdev, p, end - p);if (ver->fcxctrl ==7 ) igno_bt = btc->ctrl.ctrl_v7.igno_bt;else igno_bt = btc->ctrl.ctrl.igno_bt; -seq_printf (m," %-15s : wl_only:%d, bt_only:%d, igno_bt:%d, free_run:%d, wl_ps_ctrl:%d, wl_mimo_ps:%d, " , -"[dm_flag]" , dm->wl_only, dm->bt_only, igno_bt, - dm->freerun, btc->lps, dm->wl_mimo_ps); + p +=scnprintf (p, end - p, +" %-15s : wl_only:%d, bt_only:%d, igno_bt:%d, free_run:%d, wl_ps_ctrl:%d, wl_mimo_ps:%d, " , +"[dm_flag]" , dm->wl_only, dm->bt_only, igno_bt, + dm->freerun, btc->lps, dm->wl_mimo_ps); -seq_printf (m,"leak_ap:%d, fw_offload:%s%s\n" , dm->leak_ap, - (BTC_CX_FW_OFFLOAD ?"Y" :"N" ), - (dm->wl_fw_cx_offload ==BTC_CX_FW_OFFLOAD ? -"" :"(Mismatch!!)" )); + p +=scnprintf (p, end - p,"leak_ap:%d, fw_offload:%s%s\n" , + dm->leak_ap, + (BTC_CX_FW_OFFLOAD ?"Y" :"N" ), + (dm->wl_fw_cx_offload ==BTC_CX_FW_OFFLOAD ? +"" :"(Mismatch!!)" ));if (dm->rf_trx_para.wl_tx_power ==0xff ) -seq_printf (m, -" %-15s : wl_rssi_lvl:%d, para_lvl:%d, wl_tx_pwr:orig, " , -"[trx_ctrl]" , wl->rssi_level, dm->trx_para_level); + p +=scnprintf (p, end - p, +" %-15s : wl_rssi_lvl:%d, para_lvl:%d, wl_tx_pwr:orig, " , +"[trx_ctrl]" , wl->rssi_level, + dm->trx_para_level);else -seq_printf (m, -" %-15s : wl_rssi_lvl:%d, para_lvl:%d, wl_tx_pwr:%d, " , -"[trx_ctrl]" , wl->rssi_level, dm->trx_para_level, - dm->rf_trx_para.wl_tx_power); + p +=scnprintf (p, end - p, +" %-15s : wl_rssi_lvl:%d, para_lvl:%d, wl_tx_pwr:%d, " , +"[trx_ctrl]" , wl->rssi_level, + dm->trx_para_level, + dm->rf_trx_para.wl_tx_power); + + p +=scnprintf (p, end - p, +"wl_rx_lvl:%d, bt_tx_pwr_dec:%d, bt_rx_lna:%d(%s-tbl), wl_btg_rx:%d\n" , + dm->rf_trx_para.wl_rx_gain, + dm->rf_trx_para.bt_tx_power, + dm->rf_trx_para.bt_rx_gain, + (bt->hi_lna_rx ?"Hi" :"Ori" ), dm->wl_btg_rx); -seq_printf (m, -"wl_rx_lvl:%d, bt_tx_pwr_dec:%d, bt_rx_lna:%d(%s-tbl), wl_btg_rx:%d\n" , - dm->rf_trx_para.wl_rx_gain, dm->rf_trx_para.bt_tx_power, - dm->rf_trx_para.bt_rx_gain, - (bt->hi_lna_rx ?"Hi" :"Ori" ), dm->wl_btg_rx); + p +=scnprintf (p, end - p, +" %-15s : wl_tx_limit[en:%d/max_t:%dus/max_retry:%d], bt_slot_reg:%d-TU, bt_scan_rx_low_pri:%d\n" , +"[dm_ctrl]" , dm->wl_tx_limit.enable, + dm->wl_tx_limit.tx_time, + dm->wl_tx_limit.tx_retry, btc->bt_req_len, + bt->scan_rx_low_pri); -seq_printf (m, -" %-15s : wl_tx_limit[en:%d/max_t:%dus/max_retry:%d], bt_slot_reg:%d-TU, bt_scan_rx_low_pri:%d\n" , -"[dm_ctrl]" , dm->wl_tx_limit.enable, dm->wl_tx_limit.tx_time, - dm->wl_tx_limit.tx_retry, btc->bt_req_len, bt->scan_rx_low_pri); +return p - buf; } -static void _show_error (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_error (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;const struct rtw89_btc_ver *ver = btc->ver;struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;union rtw89_btc_fbtc_cysta_info *pcysta; +char *p = buf, *end = buf + bufsz;u32 except_cnt, exception_map; pcysta = &pfwinfo->rpt_fbtc_cysta.finfo;
@@ -8982,81 +9031,87 @@ static void _show_error(struct rtw89_dev *rtwdev, struct seq_file *m) except_cnt = pcysta->v7.except_cnt; exception_map =le32_to_cpu (pcysta->v7.except_map); }else { -return ; +return 0 ; }if (pfwinfo->event[BTF_EVNT_BUF_OVERFLOW ] ==0 && except_cnt ==0 && !pfwinfo->len_mismch && !pfwinfo->fver_mismch) -return ; +return 0 ; -seq_printf (m," %-15s : " ,"[error]" ); + p +=scnprintf (p, end - p," %-15s : " ,"[error]" );if (pfwinfo->event[BTF_EVNT_BUF_OVERFLOW ]) { -seq_printf (m, -"overflow-cnt: %d, " , - pfwinfo->event[BTF_EVNT_BUF_OVERFLOW ]); + p +=scnprintf (p, end - p, +"overflow-cnt: %d, " , + pfwinfo->event[BTF_EVNT_BUF_OVERFLOW ]); }if (pfwinfo->len_mismch) { -seq_printf (m, -"len-mismatch: 0x%x, " , - pfwinfo->len_mismch); + p +=scnprintf (p, end - p, +"len-mismatch: 0x%x, " , + pfwinfo->len_mismch); }if (pfwinfo->fver_mismch) { -seq_printf (m, -"fver-mismatch: 0x%x, " , - pfwinfo->fver_mismch); + p +=scnprintf (p, end - p, +"fver-mismatch: 0x%x, " , + pfwinfo->fver_mismch); }/* cycle statistics exceptions */ if (exception_map || except_cnt) { -seq_printf (m, -"exception-type: 0x%x, exception-cnt = %d" , - exception_map, except_cnt); + p +=scnprintf (p, end - p, +"exception-type: 0x%x, exception-cnt = %d" , + exception_map, except_cnt); } -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); + +return p - buf; } -static void _show_fbtc_tdma (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_fbtc_tdma (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;const struct rtw89_btc_ver *ver = btc->ver;struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;struct rtw89_btc_rpt_cmn_info *pcinfo =NULL ;struct rtw89_btc_fbtc_tdma *t =NULL ; +char *p = buf, *end = buf + bufsz; pcinfo = &pfwinfo->rpt_fbtc_tdma.cinfo;if (!pcinfo->valid) -return ; +return 0 ;if (ver->fcxtdma ==1 ) t = &pfwinfo->rpt_fbtc_tdma.finfo.v1;else t = &pfwinfo->rpt_fbtc_tdma.finfo.v3.tdma; -seq_printf (m, -" %-15s : " ,"[tdma_policy]" ); -seq_printf (m, -"type:%d, rx_flow_ctrl:%d, tx_pause:%d, " , - (u32 )t->type, - t->rxflctrl, t->txpause); + p +=scnprintf (p, end - p, +" %-15s : " ,"[tdma_policy]" ); + p +=scnprintf (p, end - p, +"type:%d, rx_flow_ctrl:%d, tx_pause:%d, " , + (u32 )t->type, + t->rxflctrl, t->txpause); + + p +=scnprintf (p, end - p, +"wl_toggle_n:%d, leak_n:%d, ext_ctrl:%d, " , + t->wtgle_n, t->leak_n, t->ext_ctrl); -seq_printf (m, -"wl_toggle_n:%d, leak_n:%d, ext_ctrl:%d, " , - t->wtgle_n, t->leak_n, t->ext_ctrl); + p +=scnprintf (p, end - p, +"policy_type:%d" , + (u32 )btc->policy_type); -seq_printf (m, -"policy_type:%d" , - (u32 )btc->policy_type); + p +=scnprintf (p, end - p,"\n" ); -seq_puts (m,"\n" ); +return p - buf; } -static void _show_fbtc_slots (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_fbtc_slots (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_dm *dm = &btc->dm; +char *p = buf, *end = buf + bufsz;u16 dur, cxtype;u32 tbl;u8 i =0 ;
@@ -9071,28 +9126,30 @@ static void _show_fbtc_slots(struct rtw89_dev *rtwdev, struct seq_file *m) tbl =le32_to_cpu (dm->slot_now.v7[i].cxtbl); cxtype =le16_to_cpu (dm->slot_now.v7[i].cxtype); }else { -return ; +return 0 ; }if (i %5 ==0 ) -seq_printf (m, -" %-15s : %5s[%03d/0x%x/%d]" , -"[slot_list]" , -id_to_slot ((u32 )i), - dur, tbl, cxtype); + p +=scnprintf (p, end - p, +" %-15s : %5s[%03d/0x%x/%d]" , +"[slot_list]" , +id_to_slot ((u32 )i), + dur, tbl, cxtype);else -seq_printf (m, -", %5s[%03d/0x%x/%d]" , -id_to_slot ((u32 )i), - dur, tbl, cxtype); + p +=scnprintf (p, end - p, +", %5s[%03d/0x%x/%d]" , +id_to_slot ((u32 )i), + dur, tbl, cxtype);if (i %5 ==4 ) -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); } -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); + +return p - buf; } -static void _show_fbtc_cysta_v2 (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_fbtc_cysta_v2 (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;
@@ -9101,63 +9158,64 @@ static void _show_fbtc_cysta_v2(struct rtw89_dev *rtwdev, struct seq_file *m)struct rtw89_btc_rpt_cmn_info *pcinfo =NULL ;struct rtw89_btc_fbtc_cysta_v2 *pcysta_le32 =NULL ;union rtw89_btc_fbtc_rxflct r; -u8 i, cnt =0 , slot_pair;u16 cycle, c_begin, c_end, store_index; +char *p = buf, *end = buf + bufsz; +u8 i, cnt =0 , slot_pair; pcinfo = &pfwinfo->rpt_fbtc_cysta.cinfo;if (!pcinfo->valid) -return ; +return 0 ; pcysta_le32 = &pfwinfo->rpt_fbtc_cysta.finfo.v2; -seq_printf (m, -" %-15s : cycle:%d, bcn[all:%d/all_ok:%d/bt:%d/bt_ok:%d]" , -"[cycle_cnt]" , -le16_to_cpu (pcysta_le32->cycles), -le32_to_cpu (pcysta_le32->bcn_cnt[CXBCN_ALL ]), -le32_to_cpu (pcysta_le32->bcn_cnt[CXBCN_ALL_OK ]), -le32_to_cpu (pcysta_le32->bcn_cnt[CXBCN_BT_SLOT ]), -le32_to_cpu (pcysta_le32->bcn_cnt[CXBCN_BT_OK ])); + p +=scnprintf (p, end - p, +" %-15s : cycle:%d, bcn[all:%d/all_ok:%d/bt:%d/bt_ok:%d]" , +"[cycle_cnt]" , +le16_to_cpu (pcysta_le32->cycles), +le32_to_cpu (pcysta_le32->bcn_cnt[CXBCN_ALL ]), +le32_to_cpu (pcysta_le32->bcn_cnt[CXBCN_ALL_OK ]), +le32_to_cpu (pcysta_le32->bcn_cnt[CXBCN_BT_SLOT ]), +le32_to_cpu (pcysta_le32->bcn_cnt[CXBCN_BT_OK ]));for (i =0 ; i <CXST_MAX ; i++) {if (!le32_to_cpu (pcysta_le32->slot_cnt[i]))continue ; -seq_printf (m,", %s:%d" ,id_to_slot ((u32 )i), -le32_to_cpu (pcysta_le32->slot_cnt[i])); + p +=scnprintf (p, end - p,", %s:%d" ,id_to_slot ((u32 )i), +le32_to_cpu (pcysta_le32->slot_cnt[i])); }if (dm->tdma_now.rxflctrl) { -seq_printf (m,", leak_rx:%d" , -le32_to_cpu (pcysta_le32->leakrx_cnt)); + p +=scnprintf (p, end - p,", leak_rx:%d" , +le32_to_cpu (pcysta_le32->leakrx_cnt)); }if (le32_to_cpu (pcysta_le32->collision_cnt)) { -seq_printf (m,", collision:%d" , -le32_to_cpu (pcysta_le32->collision_cnt)); + p +=scnprintf (p, end - p,", collision:%d" , +le32_to_cpu (pcysta_le32->collision_cnt)); }if (le32_to_cpu (pcysta_le32->skip_cnt)) { -seq_printf (m,", skip:%d" , -le32_to_cpu (pcysta_le32->skip_cnt)); - } -seq_puts (m,"\n" ); - -seq_printf (m," %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]" , -"[cycle_time]" , -le16_to_cpu (pcysta_le32->tavg_cycle[CXT_WL ]), -le16_to_cpu (pcysta_le32->tavg_cycle[CXT_BT ]), -le16_to_cpu (pcysta_le32->tavg_lk) /1000 , -le16_to_cpu (pcysta_le32->tavg_lk) %1000 ); -seq_printf (m,", max_t[wl:%d/bt:%d/lk:%d.%03d]" , -le16_to_cpu (pcysta_le32->tmax_cycle[CXT_WL ]), -le16_to_cpu (pcysta_le32->tmax_cycle[CXT_BT ]), -le16_to_cpu (pcysta_le32->tmax_lk) /1000 , -le16_to_cpu (pcysta_le32->tmax_lk) %1000 ); -seq_printf (m,", maxdiff_t[wl:%d/bt:%d]\n" , -le16_to_cpu (pcysta_le32->tmaxdiff_cycle[CXT_WL ]), -le16_to_cpu (pcysta_le32->tmaxdiff_cycle[CXT_BT ])); + p +=scnprintf (p, end - p,", skip:%d" , +le32_to_cpu (pcysta_le32->skip_cnt)); + } + p +=scnprintf (p, end - p,"\n" ); + + p +=scnprintf (p, end - p," %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]" , +"[cycle_time]" , +le16_to_cpu (pcysta_le32->tavg_cycle[CXT_WL ]), +le16_to_cpu (pcysta_le32->tavg_cycle[CXT_BT ]), +le16_to_cpu (pcysta_le32->tavg_lk) /1000 , +le16_to_cpu (pcysta_le32->tavg_lk) %1000 ); + p +=scnprintf (p, end - p,", max_t[wl:%d/bt:%d/lk:%d.%03d]" , +le16_to_cpu (pcysta_le32->tmax_cycle[CXT_WL ]), +le16_to_cpu (pcysta_le32->tmax_cycle[CXT_BT ]), +le16_to_cpu (pcysta_le32->tmax_lk) /1000 , +le16_to_cpu (pcysta_le32->tmax_lk) %1000 ); + p +=scnprintf (p, end - p,", maxdiff_t[wl:%d/bt:%d]\n" , +le16_to_cpu (pcysta_le32->tmaxdiff_cycle[CXT_WL ]), +le16_to_cpu (pcysta_le32->tmaxdiff_cycle[CXT_BT ]));if (le16_to_cpu (pcysta_le32->cycles) <=1 ) -return ; + goto out;/* 1 cycle record 1 wl-slot and 1 bt-slot */ slot_pair =BTC_CYCLE_SLOT_MAX /2 ;
@@ -9174,53 +9232,57 @@ static void _show_fbtc_cysta_v2(struct rtw89_dev *rtwdev, struct seq_file *m) store_index = ((cycle -1 ) % slot_pair) *2 ;if (cnt % (BTC_CYCLE_SLOT_MAX /4 ) ==1 ) -seq_printf (m, -" %-15s : ->b%02d->w%02d" ,"[cycle_step]" , -le16_to_cpu (pcysta_le32->tslot_cycle[store_index]), -le16_to_cpu (pcysta_le32->tslot_cycle[store_index +1 ])); + p +=scnprintf (p, end - p, +" %-15s : ->b%02d->w%02d" , +"[cycle_step]" , +le16_to_cpu (pcysta_le32->tslot_cycle[store_index]), +le16_to_cpu (pcysta_le32->tslot_cycle[store_index +1 ]));else -seq_printf (m, -"->b%02d->w%02d" , -le16_to_cpu (pcysta_le32->tslot_cycle[store_index]), -le16_to_cpu (pcysta_le32->tslot_cycle[store_index +1 ])); + p +=scnprintf (p, end - p, +"->b%02d->w%02d" , +le16_to_cpu (pcysta_le32->tslot_cycle[store_index]), +le16_to_cpu (pcysta_le32->tslot_cycle[store_index +1 ]));if (cnt % (BTC_CYCLE_SLOT_MAX /4 ) ==0 || cnt == c_end) -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); }if (a2dp->exist) { -seq_printf (m, -" %-15s : a2dp_ept:%d, a2dp_late:%d" , -"[a2dp_t_sta]" , -le16_to_cpu (pcysta_le32->a2dpept), -le16_to_cpu (pcysta_le32->a2dpeptto)); - -seq_printf (m, -", avg_t:%d, max_t:%d" , -le16_to_cpu (pcysta_le32->tavg_a2dpept), -le16_to_cpu (pcysta_le32->tmax_a2dpept)); + p +=scnprintf (p, end - p, +" %-15s : a2dp_ept:%d, a2dp_late:%d" , +"[a2dp_t_sta]" , +le16_to_cpu (pcysta_le32->a2dpept), +le16_to_cpu (pcysta_le32->a2dpeptto)); + + p +=scnprintf (p, end - p, +", avg_t:%d, max_t:%d" , +le16_to_cpu (pcysta_le32->tavg_a2dpept), +le16_to_cpu (pcysta_le32->tmax_a2dpept)); r.val = dm->tdma_now.rxflctrl;if (r.type && r.tgln_n) { -seq_printf (m, -", cycle[PSTDMA:%d/TDMA:%d], " , -le16_to_cpu (pcysta_le32->cycles_a2dp[CXT_FLCTRL_ON ]), -le16_to_cpu (pcysta_le32->cycles_a2dp[CXT_FLCTRL_OFF ])); - -seq_printf (m, -"avg_t[PSTDMA:%d/TDMA:%d], " , -le16_to_cpu (pcysta_le32->tavg_a2dp[CXT_FLCTRL_ON ]), -le16_to_cpu (pcysta_le32->tavg_a2dp[CXT_FLCTRL_OFF ])); - -seq_printf (m, -"max_t[PSTDMA:%d/TDMA:%d]" , -le16_to_cpu (pcysta_le32->tmax_a2dp[CXT_FLCTRL_ON ]), -le16_to_cpu (pcysta_le32->tmax_a2dp[CXT_FLCTRL_OFF ])); + p +=scnprintf (p, end - p, +", cycle[PSTDMA:%d/TDMA:%d], " , +le16_to_cpu (pcysta_le32->cycles_a2dp[CXT_FLCTRL_ON ]), +le16_to_cpu (pcysta_le32->cycles_a2dp[CXT_FLCTRL_OFF ])); + + p +=scnprintf (p, end - p, +"avg_t[PSTDMA:%d/TDMA:%d], " , +le16_to_cpu (pcysta_le32->tavg_a2dp[CXT_FLCTRL_ON ]), +le16_to_cpu (pcysta_le32->tavg_a2dp[CXT_FLCTRL_OFF ])); + + p +=scnprintf (p, end - p, +"max_t[PSTDMA:%d/TDMA:%d]" , +le16_to_cpu (pcysta_le32->tmax_a2dp[CXT_FLCTRL_ON ]), +le16_to_cpu (pcysta_le32->tmax_a2dp[CXT_FLCTRL_OFF ])); } -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); } + +out: +return p - buf; } -static void _show_fbtc_cysta_v3 (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_fbtc_cysta_v3 (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_bt_a2dp_desc *a2dp = &btc->cx.bt.link_info.a2dp_desc;
@@ -9231,60 +9293,64 @@ static void _show_fbtc_cysta_v3(struct rtw89_dev *rtwdev, struct seq_file *m)struct rtw89_btc_rpt_cmn_info *pcinfo;u8 i, cnt =0 , slot_pair, divide_cnt;u16 cycle, c_begin, c_end, store_index; +char *p = buf, *end = buf + bufsz; pcinfo = &pfwinfo->rpt_fbtc_cysta.cinfo;if (!pcinfo->valid) -return ; +return 0 ; pcysta = &pfwinfo->rpt_fbtc_cysta.finfo.v3; -seq_printf (m, -" %-15s : cycle:%d, bcn[all:%d/all_ok:%d/bt:%d/bt_ok:%d]" , -"[cycle_cnt]" , -le16_to_cpu (pcysta->cycles), -le32_to_cpu (pcysta->bcn_cnt[CXBCN_ALL ]), -le32_to_cpu (pcysta->bcn_cnt[CXBCN_ALL_OK ]), -le32_to_cpu (pcysta->bcn_cnt[CXBCN_BT_SLOT ]), -le32_to_cpu (pcysta->bcn_cnt[CXBCN_BT_OK ])); + p +=scnprintf (p, end - p, +" %-15s : cycle:%d, bcn[all:%d/all_ok:%d/bt:%d/bt_ok:%d]" , +"[cycle_cnt]" , +le16_to_cpu (pcysta->cycles), +le32_to_cpu (pcysta->bcn_cnt[CXBCN_ALL ]), +le32_to_cpu (pcysta->bcn_cnt[CXBCN_ALL_OK ]), +le32_to_cpu (pcysta->bcn_cnt[CXBCN_BT_SLOT ]), +le32_to_cpu (pcysta->bcn_cnt[CXBCN_BT_OK ]));for (i =0 ; i <CXST_MAX ; i++) {if (!le32_to_cpu (pcysta->slot_cnt[i]))continue ; -seq_printf (m,", %s:%d" ,id_to_slot (i), -le32_to_cpu (pcysta->slot_cnt[i])); + p +=scnprintf (p, end - p,", %s:%d" ,id_to_slot (i), +le32_to_cpu (pcysta->slot_cnt[i])); }if (dm->tdma_now.rxflctrl) -seq_printf (m,", leak_rx:%d" ,le32_to_cpu (pcysta->leak_slot.cnt_rximr)); + p +=scnprintf (p, end - p,", leak_rx:%d" , +le32_to_cpu (pcysta->leak_slot.cnt_rximr));if (le32_to_cpu (pcysta->collision_cnt)) -seq_printf (m,", collision:%d" ,le32_to_cpu (pcysta->collision_cnt)); + p +=scnprintf (p, end - p,", collision:%d" , +le32_to_cpu (pcysta->collision_cnt));if (le32_to_cpu (pcysta->skip_cnt)) -seq_printf (m,", skip:%d" ,le32_to_cpu (pcysta->skip_cnt)); - -seq_puts (m,"\n" ); - -seq_printf (m," %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]" , -"[cycle_time]" , -le16_to_cpu (pcysta->cycle_time.tavg[CXT_WL ]), -le16_to_cpu (pcysta->cycle_time.tavg[CXT_BT ]), -le16_to_cpu (pcysta->leak_slot.tavg) /1000 , -le16_to_cpu (pcysta->leak_slot.tavg) %1000 ); -seq_printf (m, -", max_t[wl:%d/bt:%d/lk:%d.%03d]" , -le16_to_cpu (pcysta->cycle_time.tmax[CXT_WL ]), -le16_to_cpu (pcysta->cycle_time.tmax[CXT_BT ]), -le16_to_cpu (pcysta->leak_slot.tmax) /1000 , -le16_to_cpu (pcysta->leak_slot.tmax) %1000 ); -seq_printf (m, -", maxdiff_t[wl:%d/bt:%d]\n" , -le16_to_cpu (pcysta->cycle_time.tmaxdiff[CXT_WL ]), -le16_to_cpu (pcysta->cycle_time.tmaxdiff[CXT_BT ])); + p +=scnprintf (p, end - p,", skip:%d" , +le32_to_cpu (pcysta->skip_cnt)); + + p +=scnprintf (p, end - p,"\n" ); + + p +=scnprintf (p, end - p," %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]" , +"[cycle_time]" , +le16_to_cpu (pcysta->cycle_time.tavg[CXT_WL ]), +le16_to_cpu (pcysta->cycle_time.tavg[CXT_BT ]), +le16_to_cpu (pcysta->leak_slot.tavg) /1000 , +le16_to_cpu (pcysta->leak_slot.tavg) %1000 ); + p +=scnprintf (p, end - p, +", max_t[wl:%d/bt:%d/lk:%d.%03d]" , +le16_to_cpu (pcysta->cycle_time.tmax[CXT_WL ]), +le16_to_cpu (pcysta->cycle_time.tmax[CXT_BT ]), +le16_to_cpu (pcysta->leak_slot.tmax) /1000 , +le16_to_cpu (pcysta->leak_slot.tmax) %1000 ); + p +=scnprintf (p, end - p, +", maxdiff_t[wl:%d/bt:%d]\n" , +le16_to_cpu (pcysta->cycle_time.tmaxdiff[CXT_WL ]), +le16_to_cpu (pcysta->cycle_time.tmaxdiff[CXT_BT ])); cycle =le16_to_cpu (pcysta->cycles);if (cycle <=1 ) -return ; + goto out;/* 1 cycle record 1 wl-slot and 1 bt-slot */ slot_pair =BTC_CYCLE_SLOT_MAX /2 ;
@@ -9306,51 +9372,56 @@ static void _show_fbtc_cysta_v3(struct rtw89_dev *rtwdev, struct seq_file *m) store_index = ((cycle -1 ) % slot_pair) *2 ;if (cnt % divide_cnt ==1 ) -seq_printf (m," %-15s : " ,"[cycle_step]" ); + p +=scnprintf (p, end - p," %-15s : " , +"[cycle_step]" ); -seq_printf (m,"->b%02d" , -le16_to_cpu (pcysta->slot_step_time[store_index])); + p +=scnprintf (p, end - p,"->b%02d" , +le16_to_cpu (pcysta->slot_step_time[store_index]));if (a2dp->exist) { a2dp_trx = &pcysta->a2dp_trx[store_index]; -seq_printf (m,"(%d/%d/%dM/%d/%d/%d)" , - a2dp_trx->empty_cnt, - a2dp_trx->retry_cnt, - a2dp_trx->tx_rate ?3 :2 , - a2dp_trx->tx_cnt, - a2dp_trx->ack_cnt, - a2dp_trx->nack_cnt); + p +=scnprintf (p, end - p,"(%d/%d/%dM/%d/%d/%d)" , + a2dp_trx->empty_cnt, + a2dp_trx->retry_cnt, + a2dp_trx->tx_rate ?3 :2 , + a2dp_trx->tx_cnt, + a2dp_trx->ack_cnt, + a2dp_trx->nack_cnt); } -seq_printf (m,"->w%02d" , -le16_to_cpu (pcysta->slot_step_time[store_index +1 ])); + p +=scnprintf (p, end - p,"->w%02d" , +le16_to_cpu (pcysta->slot_step_time[store_index +1 ]));if (a2dp->exist) { a2dp_trx = &pcysta->a2dp_trx[store_index +1 ]; -seq_printf (m,"(%d/%d/%dM/%d/%d/%d)" , - a2dp_trx->empty_cnt, - a2dp_trx->retry_cnt, - a2dp_trx->tx_rate ?3 :2 , - a2dp_trx->tx_cnt, - a2dp_trx->ack_cnt, - a2dp_trx->nack_cnt); + p +=scnprintf (p, end - p,"(%d/%d/%dM/%d/%d/%d)" , + a2dp_trx->empty_cnt, + a2dp_trx->retry_cnt, + a2dp_trx->tx_rate ?3 :2 , + a2dp_trx->tx_cnt, + a2dp_trx->ack_cnt, + a2dp_trx->nack_cnt); }if (cnt % divide_cnt ==0 || cnt == c_end) -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); }if (a2dp->exist) { -seq_printf (m," %-15s : a2dp_ept:%d, a2dp_late:%d" , -"[a2dp_t_sta]" , -le16_to_cpu (pcysta->a2dp_ept.cnt), -le16_to_cpu (pcysta->a2dp_ept.cnt_timeout)); + p +=scnprintf (p, end - p, +" %-15s : a2dp_ept:%d, a2dp_late:%d" , +"[a2dp_t_sta]" , +le16_to_cpu (pcysta->a2dp_ept.cnt), +le16_to_cpu (pcysta->a2dp_ept.cnt_timeout)); -seq_printf (m,", avg_t:%d, max_t:%d" , -le16_to_cpu (pcysta->a2dp_ept.tavg), -le16_to_cpu (pcysta->a2dp_ept.tmax)); + p +=scnprintf (p, end - p,", avg_t:%d, max_t:%d" , +le16_to_cpu (pcysta->a2dp_ept.tavg), +le16_to_cpu (pcysta->a2dp_ept.tmax)); -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); } + +out: +return p - buf; } -static void _show_fbtc_cysta_v4 (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_fbtc_cysta_v4 (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_bt_a2dp_desc *a2dp = &btc->cx.bt.link_info.a2dp_desc;
@@ -9361,62 +9432,64 @@ static void _show_fbtc_cysta_v4(struct rtw89_dev *rtwdev, struct seq_file *m)struct rtw89_btc_rpt_cmn_info *pcinfo;u8 i, cnt =0 , slot_pair, divide_cnt;u16 cycle, c_begin, c_end, store_index; +char *p = buf, *end = buf + bufsz; pcinfo = &pfwinfo->rpt_fbtc_cysta.cinfo;if (!pcinfo->valid) -return ; +return 0 ; pcysta = &pfwinfo->rpt_fbtc_cysta.finfo.v4; -seq_printf (m, -" %-15s : cycle:%d, bcn[all:%d/all_ok:%d/bt:%d/bt_ok:%d]" , -"[cycle_cnt]" , -le16_to_cpu (pcysta->cycles), -le16_to_cpu (pcysta->bcn_cnt[CXBCN_ALL ]), -le16_to_cpu (pcysta->bcn_cnt[CXBCN_ALL_OK ]), -le16_to_cpu (pcysta->bcn_cnt[CXBCN_BT_SLOT ]), -le16_to_cpu (pcysta->bcn_cnt[CXBCN_BT_OK ])); + p +=scnprintf (p, end - p, +" %-15s : cycle:%d, bcn[all:%d/all_ok:%d/bt:%d/bt_ok:%d]" , +"[cycle_cnt]" , +le16_to_cpu (pcysta->cycles), +le16_to_cpu (pcysta->bcn_cnt[CXBCN_ALL ]), +le16_to_cpu (pcysta->bcn_cnt[CXBCN_ALL_OK ]), +le16_to_cpu (pcysta->bcn_cnt[CXBCN_BT_SLOT ]), +le16_to_cpu (pcysta->bcn_cnt[CXBCN_BT_OK ]));for (i =0 ; i <CXST_MAX ; i++) {if (!le16_to_cpu (pcysta->slot_cnt[i]))continue ; -seq_printf (m,", %s:%d" ,id_to_slot (i), -le16_to_cpu (pcysta->slot_cnt[i])); + p +=scnprintf (p, end - p,", %s:%d" ,id_to_slot (i), +le16_to_cpu (pcysta->slot_cnt[i])); }if (dm->tdma_now.rxflctrl) -seq_printf (m,", leak_rx:%d" , -le32_to_cpu (pcysta->leak_slot.cnt_rximr)); + p +=scnprintf (p, end - p,", leak_rx:%d" , +le32_to_cpu (pcysta->leak_slot.cnt_rximr));if (pcysta->collision_cnt) -seq_printf (m,", collision:%d" , pcysta->collision_cnt); + p +=scnprintf (p, end - p,", collision:%d" , + pcysta->collision_cnt);if (le16_to_cpu (pcysta->skip_cnt)) -seq_printf (m,", skip:%d" , -le16_to_cpu (pcysta->skip_cnt)); - -seq_puts (m,"\n" ); - -seq_printf (m," %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]" , -"[cycle_time]" , -le16_to_cpu (pcysta->cycle_time.tavg[CXT_WL ]), -le16_to_cpu (pcysta->cycle_time.tavg[CXT_BT ]), -le16_to_cpu (pcysta->leak_slot.tavg) /1000 , -le16_to_cpu (pcysta->leak_slot.tavg) %1000 ); -seq_printf (m, -", max_t[wl:%d/bt:%d/lk:%d.%03d]" , -le16_to_cpu (pcysta->cycle_time.tmax[CXT_WL ]), -le16_to_cpu (pcysta->cycle_time.tmax[CXT_BT ]), -le16_to_cpu (pcysta->leak_slot.tmax) /1000 , -le16_to_cpu (pcysta->leak_slot.tmax) %1000 ); -seq_printf (m, -", maxdiff_t[wl:%d/bt:%d]\n" , -le16_to_cpu (pcysta->cycle_time.tmaxdiff[CXT_WL ]), -le16_to_cpu (pcysta->cycle_time.tmaxdiff[CXT_BT ])); + p +=scnprintf (p, end - p,", skip:%d" , +le16_to_cpu (pcysta->skip_cnt)); + + p +=scnprintf (p, end - p,"\n" ); + + p +=scnprintf (p, end - p," %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]" , +"[cycle_time]" , +le16_to_cpu (pcysta->cycle_time.tavg[CXT_WL ]), +le16_to_cpu (pcysta->cycle_time.tavg[CXT_BT ]), +le16_to_cpu (pcysta->leak_slot.tavg) /1000 , +le16_to_cpu (pcysta->leak_slot.tavg) %1000 ); + p +=scnprintf (p, end - p, +", max_t[wl:%d/bt:%d/lk:%d.%03d]" , +le16_to_cpu (pcysta->cycle_time.tmax[CXT_WL ]), +le16_to_cpu (pcysta->cycle_time.tmax[CXT_BT ]), +le16_to_cpu (pcysta->leak_slot.tmax) /1000 , +le16_to_cpu (pcysta->leak_slot.tmax) %1000 ); + p +=scnprintf (p, end - p, +", maxdiff_t[wl:%d/bt:%d]\n" , +le16_to_cpu (pcysta->cycle_time.tmaxdiff[CXT_WL ]), +le16_to_cpu (pcysta->cycle_time.tmaxdiff[CXT_BT ])); cycle =le16_to_cpu (pcysta->cycles);if (cycle <=1 ) -return ; + goto out;/* 1 cycle record 1 wl-slot and 1 bt-slot */ slot_pair =BTC_CYCLE_SLOT_MAX /2 ;
@@ -9438,51 +9511,56 @@ static void _show_fbtc_cysta_v4(struct rtw89_dev *rtwdev, struct seq_file *m) store_index = ((cycle -1 ) % slot_pair) *2 ;if (cnt % divide_cnt ==1 ) -seq_printf (m," %-15s : " ,"[cycle_step]" ); + p +=scnprintf (p, end - p," %-15s : " , +"[cycle_step]" ); -seq_printf (m,"->b%02d" , -le16_to_cpu (pcysta->slot_step_time[store_index])); + p +=scnprintf (p, end - p,"->b%02d" , +le16_to_cpu (pcysta->slot_step_time[store_index]));if (a2dp->exist) { a2dp_trx = &pcysta->a2dp_trx[store_index]; -seq_printf (m,"(%d/%d/%dM/%d/%d/%d)" , - a2dp_trx->empty_cnt, - a2dp_trx->retry_cnt, - a2dp_trx->tx_rate ?3 :2 , - a2dp_trx->tx_cnt, - a2dp_trx->ack_cnt, - a2dp_trx->nack_cnt); + p +=scnprintf (p, end - p,"(%d/%d/%dM/%d/%d/%d)" , + a2dp_trx->empty_cnt, + a2dp_trx->retry_cnt, + a2dp_trx->tx_rate ?3 :2 , + a2dp_trx->tx_cnt, + a2dp_trx->ack_cnt, + a2dp_trx->nack_cnt); } -seq_printf (m,"->w%02d" , -le16_to_cpu (pcysta->slot_step_time[store_index +1 ])); + p +=scnprintf (p, end - p,"->w%02d" , +le16_to_cpu (pcysta->slot_step_time[store_index +1 ]));if (a2dp->exist) { a2dp_trx = &pcysta->a2dp_trx[store_index +1 ]; -seq_printf (m,"(%d/%d/%dM/%d/%d/%d)" , - a2dp_trx->empty_cnt, - a2dp_trx->retry_cnt, - a2dp_trx->tx_rate ?3 :2 , - a2dp_trx->tx_cnt, - a2dp_trx->ack_cnt, - a2dp_trx->nack_cnt); + p +=scnprintf (p, end - p,"(%d/%d/%dM/%d/%d/%d)" , + a2dp_trx->empty_cnt, + a2dp_trx->retry_cnt, + a2dp_trx->tx_rate ?3 :2 , + a2dp_trx->tx_cnt, + a2dp_trx->ack_cnt, + a2dp_trx->nack_cnt); }if (cnt % divide_cnt ==0 || cnt == c_end) -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); }if (a2dp->exist) { -seq_printf (m," %-15s : a2dp_ept:%d, a2dp_late:%d" , -"[a2dp_t_sta]" , -le16_to_cpu (pcysta->a2dp_ept.cnt), -le16_to_cpu (pcysta->a2dp_ept.cnt_timeout)); + p +=scnprintf (p, end - p, +" %-15s : a2dp_ept:%d, a2dp_late:%d" , +"[a2dp_t_sta]" , +le16_to_cpu (pcysta->a2dp_ept.cnt), +le16_to_cpu (pcysta->a2dp_ept.cnt_timeout)); -seq_printf (m,", avg_t:%d, max_t:%d" , -le16_to_cpu (pcysta->a2dp_ept.tavg), -le16_to_cpu (pcysta->a2dp_ept.tmax)); + p +=scnprintf (p, end - p,", avg_t:%d, max_t:%d" , +le16_to_cpu (pcysta->a2dp_ept.tavg), +le16_to_cpu (pcysta->a2dp_ept.tmax)); -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); } + +out: +return p - buf; } -static void _show_fbtc_cysta_v5 (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_fbtc_cysta_v5 (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_bt_a2dp_desc *a2dp = &btc->cx.bt.link_info.a2dp_desc;
@@ -9493,58 +9571,60 @@ static void _show_fbtc_cysta_v5(struct rtw89_dev *rtwdev, struct seq_file *m)struct rtw89_btc_rpt_cmn_info *pcinfo;u8 i, cnt =0 , slot_pair, divide_cnt;u16 cycle, c_begin, c_end, store_index; +char *p = buf, *end = buf + bufsz; pcinfo = &pfwinfo->rpt_fbtc_cysta.cinfo;if (!pcinfo->valid) -return ; +return 0 ; pcysta = &pfwinfo->rpt_fbtc_cysta.finfo.v5; -seq_printf (m, -" %-15s : cycle:%d, bcn[all:%d/all_ok:%d/bt:%d/bt_ok:%d]" , -"[cycle_cnt]" , -le16_to_cpu (pcysta->cycles), -le16_to_cpu (pcysta->bcn_cnt[CXBCN_ALL ]), -le16_to_cpu (pcysta->bcn_cnt[CXBCN_ALL_OK ]), -le16_to_cpu (pcysta->bcn_cnt[CXBCN_BT_SLOT ]), -le16_to_cpu (pcysta->bcn_cnt[CXBCN_BT_OK ])); + p +=scnprintf (p, end - p, +" %-15s : cycle:%d, bcn[all:%d/all_ok:%d/bt:%d/bt_ok:%d]" , +"[cycle_cnt]" , +le16_to_cpu (pcysta->cycles), +le16_to_cpu (pcysta->bcn_cnt[CXBCN_ALL ]), +le16_to_cpu (pcysta->bcn_cnt[CXBCN_ALL_OK ]), +le16_to_cpu (pcysta->bcn_cnt[CXBCN_BT_SLOT ]), +le16_to_cpu (pcysta->bcn_cnt[CXBCN_BT_OK ]));for (i =0 ; i <CXST_MAX ; i++) {if (!le16_to_cpu (pcysta->slot_cnt[i]))continue ; -seq_printf (m,", %s:%d" ,id_to_slot (i), -le16_to_cpu (pcysta->slot_cnt[i])); + p +=scnprintf (p, end - p,", %s:%d" ,id_to_slot (i), +le16_to_cpu (pcysta->slot_cnt[i])); }if (dm->tdma_now.rxflctrl) -seq_printf (m,", leak_rx:%d" , -le32_to_cpu (pcysta->leak_slot.cnt_rximr)); + p +=scnprintf (p, end - p,", leak_rx:%d" , +le32_to_cpu (pcysta->leak_slot.cnt_rximr));if (pcysta->collision_cnt) -seq_printf (m,", collision:%d" , pcysta->collision_cnt); + p +=scnprintf (p, end - p,", collision:%d" , + pcysta->collision_cnt);if (le16_to_cpu (pcysta->skip_cnt)) -seq_printf (m,", skip:%d" , -le16_to_cpu (pcysta->skip_cnt)); - -seq_puts (m,"\n" ); - -seq_printf (m," %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]" , -"[cycle_time]" , -le16_to_cpu (pcysta->cycle_time.tavg[CXT_WL ]), -le16_to_cpu (pcysta->cycle_time.tavg[CXT_BT ]), -le16_to_cpu (pcysta->leak_slot.tavg) /1000 , -le16_to_cpu (pcysta->leak_slot.tavg) %1000 ); -seq_printf (m, -", max_t[wl:%d/bt:%d/lk:%d.%03d]\n" , -le16_to_cpu (pcysta->cycle_time.tmax[CXT_WL ]), -le16_to_cpu (pcysta->cycle_time.tmax[CXT_BT ]), -le16_to_cpu (pcysta->leak_slot.tmax) /1000 , -le16_to_cpu (pcysta->leak_slot.tmax) %1000 ); + p +=scnprintf (p, end - p,", skip:%d" , +le16_to_cpu (pcysta->skip_cnt)); + + p +=scnprintf (p, end - p,"\n" ); + + p +=scnprintf (p, end - p," %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]" , +"[cycle_time]" , +le16_to_cpu (pcysta->cycle_time.tavg[CXT_WL ]), +le16_to_cpu (pcysta->cycle_time.tavg[CXT_BT ]), +le16_to_cpu (pcysta->leak_slot.tavg) /1000 , +le16_to_cpu (pcysta->leak_slot.tavg) %1000 ); + p +=scnprintf (p, end - p, +", max_t[wl:%d/bt:%d/lk:%d.%03d]\n" , +le16_to_cpu (pcysta->cycle_time.tmax[CXT_WL ]), +le16_to_cpu (pcysta->cycle_time.tmax[CXT_BT ]), +le16_to_cpu (pcysta->leak_slot.tmax) /1000 , +le16_to_cpu (pcysta->leak_slot.tmax) %1000 ); cycle =le16_to_cpu (pcysta->cycles);if (cycle <=1 ) -return ; + goto out;/* 1 cycle record 1 wl-slot and 1 bt-slot */ slot_pair =BTC_CYCLE_SLOT_MAX /2 ;
@@ -9562,58 +9642,63 @@ static void _show_fbtc_cysta_v5(struct rtw89_dev *rtwdev, struct seq_file *m) divide_cnt =BTC_CYCLE_SLOT_MAX /4 ;if (c_begin > c_end) -return ; + goto out;for (cycle = c_begin; cycle <= c_end; cycle++) { cnt++; store_index = ((cycle -1 ) % slot_pair) *2 ;if (cnt % divide_cnt ==1 ) -seq_printf (m," %-15s : " ,"[cycle_step]" ); + p +=scnprintf (p, end - p," %-15s : " , +"[cycle_step]" ); -seq_printf (m,"->b%02d" , -le16_to_cpu (pcysta->slot_step_time[store_index])); + p +=scnprintf (p, end - p,"->b%02d" , +le16_to_cpu (pcysta->slot_step_time[store_index]));if (a2dp->exist) { a2dp_trx = &pcysta->a2dp_trx[store_index]; -seq_printf (m,"(%d/%d/%dM/%d/%d/%d)" , - a2dp_trx->empty_cnt, - a2dp_trx->retry_cnt, - a2dp_trx->tx_rate ?3 :2 , - a2dp_trx->tx_cnt, - a2dp_trx->ack_cnt, - a2dp_trx->nack_cnt); + p +=scnprintf (p, end - p,"(%d/%d/%dM/%d/%d/%d)" , + a2dp_trx->empty_cnt, + a2dp_trx->retry_cnt, + a2dp_trx->tx_rate ?3 :2 , + a2dp_trx->tx_cnt, + a2dp_trx->ack_cnt, + a2dp_trx->nack_cnt); } -seq_printf (m,"->w%02d" , -le16_to_cpu (pcysta->slot_step_time[store_index +1 ])); + p +=scnprintf (p, end - p,"->w%02d" , +le16_to_cpu (pcysta->slot_step_time[store_index +1 ]));if (a2dp->exist) { a2dp_trx = &pcysta->a2dp_trx[store_index +1 ]; -seq_printf (m,"(%d/%d/%dM/%d/%d/%d)" , - a2dp_trx->empty_cnt, - a2dp_trx->retry_cnt, - a2dp_trx->tx_rate ?3 :2 , - a2dp_trx->tx_cnt, - a2dp_trx->ack_cnt, - a2dp_trx->nack_cnt); + p +=scnprintf (p, end - p,"(%d/%d/%dM/%d/%d/%d)" , + a2dp_trx->empty_cnt, + a2dp_trx->retry_cnt, + a2dp_trx->tx_rate ?3 :2 , + a2dp_trx->tx_cnt, + a2dp_trx->ack_cnt, + a2dp_trx->nack_cnt); }if (cnt % divide_cnt ==0 || cnt == c_end) -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); }if (a2dp->exist) { -seq_printf (m," %-15s : a2dp_ept:%d, a2dp_late:%d" , -"[a2dp_t_sta]" , -le16_to_cpu (pcysta->a2dp_ept.cnt), -le16_to_cpu (pcysta->a2dp_ept.cnt_timeout)); + p +=scnprintf (p, end - p, +" %-15s : a2dp_ept:%d, a2dp_late:%d" , +"[a2dp_t_sta]" , +le16_to_cpu (pcysta->a2dp_ept.cnt), +le16_to_cpu (pcysta->a2dp_ept.cnt_timeout)); -seq_printf (m,", avg_t:%d, max_t:%d" , -le16_to_cpu (pcysta->a2dp_ept.tavg), -le16_to_cpu (pcysta->a2dp_ept.tmax)); + p +=scnprintf (p, end - p,", avg_t:%d, max_t:%d" , +le16_to_cpu (pcysta->a2dp_ept.tavg), +le16_to_cpu (pcysta->a2dp_ept.tmax)); -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); } + +out: +return p - buf; } -static void _show_fbtc_cysta_v7 (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_fbtc_cysta_v7 (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc_bt_info *bt = &rtwdev->btc.cx.bt;struct rtw89_btc_bt_a2dp_desc *a2dp = &bt->link_info.a2dp_desc;
@@ -9621,68 +9706,75 @@ static void _show_fbtc_cysta_v7(struct rtw89_dev *rtwdev, struct seq_file *m)struct rtw89_btc_fbtc_cysta_v7 *pcysta =NULL ;struct rtw89_btc_dm *dm = &rtwdev->btc.dm;struct rtw89_btc_rpt_cmn_info *pcinfo; +char *p = buf, *end = buf + bufsz;u16 cycle, c_begin, c_end, s_id;u8 i, cnt =0 , divide_cnt;u8 slot_pair; pcinfo = &pfwinfo->rpt_fbtc_cysta.cinfo;if (!pcinfo->valid) -return ; +return 0 ; pcysta = &pfwinfo->rpt_fbtc_cysta.finfo.v7; -seq_printf (m,"\n\r %-15s : cycle:%d" ,"[slot_stat]" , -le16_to_cpu (pcysta->cycles)); + p +=scnprintf (p, end - p,"\n\r %-15s : cycle:%d" ,"[slot_stat]" , +le16_to_cpu (pcysta->cycles));for (i =0 ; i <CXST_MAX ; i++) {if (!le16_to_cpu (pcysta->slot_cnt[i]))continue ; -seq_printf (m,", %s:%d" , -id_to_slot (i),le16_to_cpu (pcysta->slot_cnt[i])); + p +=scnprintf (p, end - p,", %s:%d" , +id_to_slot (i), +le16_to_cpu (pcysta->slot_cnt[i])); }if (dm->tdma_now.rxflctrl) -seq_printf (m,", leak_rx:%d" , -le32_to_cpu (pcysta->leak_slot.cnt_rximr)); + p +=scnprintf (p, end - p,", leak_rx:%d" , +le32_to_cpu (pcysta->leak_slot.cnt_rximr));if (pcysta->collision_cnt) -seq_printf (m,", collision:%d" , pcysta->collision_cnt); + p +=scnprintf (p, end - p,", collision:%d" , + pcysta->collision_cnt);if (pcysta->skip_cnt) -seq_printf (m,", skip:%d" ,le16_to_cpu (pcysta->skip_cnt)); - -seq_printf (m,"\n\r %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]" , -"[cycle_stat]" , -le16_to_cpu (pcysta->cycle_time.tavg[CXT_WL ]), -le16_to_cpu (pcysta->cycle_time.tavg[CXT_BT ]), -le16_to_cpu (pcysta->leak_slot.tavg) /1000 , -le16_to_cpu (pcysta->leak_slot.tavg) %1000 ); -seq_printf (m,", max_t[wl:%d/bt:%d(>%dms:%d)/lk:%d.%03d]" , -le16_to_cpu (pcysta->cycle_time.tmax[CXT_WL ]), -le16_to_cpu (pcysta->cycle_time.tmax[CXT_BT ]), - dm->bt_slot_flood, dm->cnt_dm[BTC_DCNT_BT_SLOT_FLOOD ], -le16_to_cpu (pcysta->leak_slot.tamx) /1000 , -le16_to_cpu (pcysta->leak_slot.tamx) %1000 ); -seq_printf (m,", bcn[all:%d/ok:%d/in_bt:%d/in_bt_ok:%d]" , -le16_to_cpu (pcysta->bcn_cnt[CXBCN_ALL ]), -le16_to_cpu (pcysta->bcn_cnt[CXBCN_ALL_OK ]), -le16_to_cpu (pcysta->bcn_cnt[CXBCN_BT_SLOT ]), -le16_to_cpu (pcysta->bcn_cnt[CXBCN_BT_OK ])); + p +=scnprintf (p, end - p,", skip:%d" , +le16_to_cpu (pcysta->skip_cnt)); + + p +=scnprintf (p, end - p, +"\n\r %-15s : avg_t[wl:%d/bt:%d/lk:%d.%03d]" , +"[cycle_stat]" , +le16_to_cpu (pcysta->cycle_time.tavg[CXT_WL ]), +le16_to_cpu (pcysta->cycle_time.tavg[CXT_BT ]), +le16_to_cpu (pcysta->leak_slot.tavg) /1000 , +le16_to_cpu (pcysta->leak_slot.tavg) %1000 ); + p +=scnprintf (p, end - p, +", max_t[wl:%d/bt:%d(>%dms:%d)/lk:%d.%03d]" , +le16_to_cpu (pcysta->cycle_time.tmax[CXT_WL ]), +le16_to_cpu (pcysta->cycle_time.tmax[CXT_BT ]), + dm->bt_slot_flood, dm->cnt_dm[BTC_DCNT_BT_SLOT_FLOOD ], +le16_to_cpu (pcysta->leak_slot.tamx) /1000 , +le16_to_cpu (pcysta->leak_slot.tamx) %1000 ); + p +=scnprintf (p, end - p,", bcn[all:%d/ok:%d/in_bt:%d/in_bt_ok:%d]" , +le16_to_cpu (pcysta->bcn_cnt[CXBCN_ALL ]), +le16_to_cpu (pcysta->bcn_cnt[CXBCN_ALL_OK ]), +le16_to_cpu (pcysta->bcn_cnt[CXBCN_BT_SLOT ]), +le16_to_cpu (pcysta->bcn_cnt[CXBCN_BT_OK ]));if (a2dp->exist) { -seq_printf (m, -"\n\r %-15s : a2dp_ept:%d, a2dp_late:%d(streak 2S:%d/max:%d)" , -"[a2dp_stat]" , -le16_to_cpu (pcysta->a2dp_ept.cnt), -le16_to_cpu (pcysta->a2dp_ept.cnt_timeout), - a2dp->no_empty_streak_2s, a2dp->no_empty_streak_max); + p +=scnprintf (p, end - p, +"\n\r %-15s : a2dp_ept:%d, a2dp_late:%d(streak 2S:%d/max:%d)" , +"[a2dp_stat]" , +le16_to_cpu (pcysta->a2dp_ept.cnt), +le16_to_cpu (pcysta->a2dp_ept.cnt_timeout), + a2dp->no_empty_streak_2s, + a2dp->no_empty_streak_max); -seq_printf (m,", avg_t:%d, max_t:%d" , -le16_to_cpu (pcysta->a2dp_ept.tavg), -le16_to_cpu (pcysta->a2dp_ept.tmax)); + p +=scnprintf (p, end - p,", avg_t:%d, max_t:%d" , +le16_to_cpu (pcysta->a2dp_ept.tavg), +le16_to_cpu (pcysta->a2dp_ept.tmax)); }if (le16_to_cpu (pcysta->cycles) <=1 ) -return ; + goto out;/* 1 cycle = 1 wl-slot + 1 bt-slot */ slot_pair =BTC_CYCLE_SLOT_MAX /2 ;
@@ -9700,7 +9792,7 @@ static void _show_fbtc_cysta_v7(struct rtw89_dev *rtwdev, struct seq_file *m) divide_cnt =6 ;if (c_begin > c_end) -return ; + goto out;for (cycle = c_begin; cycle <= c_end; cycle++) { cnt++;
@@ -9708,129 +9800,142 @@ static void _show_fbtc_cysta_v7(struct rtw89_dev *rtwdev, struct seq_file *m)if (cnt % divide_cnt ==1 ) {if (a2dp->exist) -seq_printf (m,"\n\r %-15s : " ,"[slotT_wermtan]" ); + p +=scnprintf (p, end - p,"\n\r %-15s : " , +"[slotT_wermtan]" );else -seq_printf (m,"\n\r %-15s : " ,"[slotT_rxerr]" ); + p +=scnprintf (p, end - p,"\n\r %-15s : " , +"[slotT_rxerr]" ); } -seq_printf (m,"->b%d" ,le16_to_cpu (pcysta->slot_step_time[s_id])); + p +=scnprintf (p, end - p,"->b%d" , +le16_to_cpu (pcysta->slot_step_time[s_id]));if (a2dp->exist) -seq_printf (m,"(%d/%d/%d/%dM/%d/%d/%d)" , - pcysta->wl_rx_err_ratio[s_id], - pcysta->a2dp_trx[s_id].empty_cnt, - pcysta->a2dp_trx[s_id].retry_cnt, - (pcysta->a2dp_trx[s_id].tx_rate ?3 :2 ), - pcysta->a2dp_trx[s_id].tx_cnt, - pcysta->a2dp_trx[s_id].ack_cnt, - pcysta->a2dp_trx[s_id].nack_cnt); + p +=scnprintf (p, end - p,"(%d/%d/%d/%dM/%d/%d/%d)" , + pcysta->wl_rx_err_ratio[s_id], + pcysta->a2dp_trx[s_id].empty_cnt, + pcysta->a2dp_trx[s_id].retry_cnt, + (pcysta->a2dp_trx[s_id].tx_rate ?3 :2 ), + pcysta->a2dp_trx[s_id].tx_cnt, + pcysta->a2dp_trx[s_id].ack_cnt, + pcysta->a2dp_trx[s_id].nack_cnt);else -seq_printf (m,"(%d)" , pcysta->wl_rx_err_ratio[s_id]); + p +=scnprintf (p, end - p,"(%d)" , + pcysta->wl_rx_err_ratio[s_id]); -seq_printf (m,"->w%d" ,le16_to_cpu (pcysta->slot_step_time[s_id +1 ])); + p +=scnprintf (p, end - p,"->w%d" , +le16_to_cpu (pcysta->slot_step_time[s_id +1 ]));if (a2dp->exist) -seq_printf (m,"(%d/%d/%d/%dM/%d/%d/%d)" , - pcysta->wl_rx_err_ratio[s_id +1 ], - pcysta->a2dp_trx[s_id +1 ].empty_cnt, - pcysta->a2dp_trx[s_id +1 ].retry_cnt, - (pcysta->a2dp_trx[s_id +1 ].tx_rate ?3 :2 ), - pcysta->a2dp_trx[s_id +1 ].tx_cnt, - pcysta->a2dp_trx[s_id +1 ].ack_cnt, - pcysta->a2dp_trx[s_id +1 ].nack_cnt); + p +=scnprintf (p, end - p,"(%d/%d/%d/%dM/%d/%d/%d)" , + pcysta->wl_rx_err_ratio[s_id +1 ], + pcysta->a2dp_trx[s_id +1 ].empty_cnt, + pcysta->a2dp_trx[s_id +1 ].retry_cnt, + (pcysta->a2dp_trx[s_id +1 ].tx_rate ?3 :2 ), + pcysta->a2dp_trx[s_id +1 ].tx_cnt, + pcysta->a2dp_trx[s_id +1 ].ack_cnt, + pcysta->a2dp_trx[s_id +1 ].nack_cnt);else -seq_printf (m,"(%d)" , pcysta->wl_rx_err_ratio[s_id +1 ]); + p +=scnprintf (p, end - p,"(%d)" , + pcysta->wl_rx_err_ratio[s_id +1 ]); } + +out: +return p - buf; } -static void _show_fbtc_nullsta (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_fbtc_nullsta (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;const struct rtw89_btc_ver *ver = btc->ver;struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;struct rtw89_btc_rpt_cmn_info *pcinfo;union rtw89_btc_fbtc_cynullsta_info *ns; +char *p = buf, *end = buf + bufsz;u8 i =0 ;if (!btc->dm.tdma_now.rxflctrl) -return ; +return 0 ; pcinfo = &pfwinfo->rpt_fbtc_nullsta.cinfo;if (!pcinfo->valid) -return ; +return 0 ; ns = &pfwinfo->rpt_fbtc_nullsta.finfo;if (ver->fcxnullsta ==1 ) {for (i =0 ; i <2 ; i++) { -seq_printf (m," %-15s : " ,"[NULL-STA]" ); -seq_printf (m,"null-%d" , i); -seq_printf (m,"[ok:%d/" , -le32_to_cpu (ns->v1.result[i][1 ])); -seq_printf (m,"fail:%d/" , -le32_to_cpu (ns->v1.result[i][0 ])); -seq_printf (m,"on_time:%d/" , -le32_to_cpu (ns->v1.result[i][2 ])); -seq_printf (m,"retry:%d/" , -le32_to_cpu (ns->v1.result[i][3 ])); -seq_printf (m,"avg_t:%d.%03d/" , -le32_to_cpu (ns->v1.avg_t[i]) /1000 , -le32_to_cpu (ns->v1.avg_t[i]) %1000 ); -seq_printf (m,"max_t:%d.%03d]\n" , -le32_to_cpu (ns->v1.max_t[i]) /1000 , -le32_to_cpu (ns->v1.max_t[i]) %1000 ); + p +=scnprintf (p, end - p," %-15s : " ,"[NULL-STA]" ); + p +=scnprintf (p, end - p,"null-%d" , i); + p +=scnprintf (p, end - p,"[ok:%d/" , +le32_to_cpu (ns->v1.result[i][1 ])); + p +=scnprintf (p, end - p,"fail:%d/" , +le32_to_cpu (ns->v1.result[i][0 ])); + p +=scnprintf (p, end - p,"on_time:%d/" , +le32_to_cpu (ns->v1.result[i][2 ])); + p +=scnprintf (p, end - p,"retry:%d/" , +le32_to_cpu (ns->v1.result[i][3 ])); + p +=scnprintf (p, end - p,"avg_t:%d.%03d/" , +le32_to_cpu (ns->v1.avg_t[i]) /1000 , +le32_to_cpu (ns->v1.avg_t[i]) %1000 ); + p +=scnprintf (p, end - p,"max_t:%d.%03d]\n" , +le32_to_cpu (ns->v1.max_t[i]) /1000 , +le32_to_cpu (ns->v1.max_t[i]) %1000 ); } }else if (ver->fcxnullsta ==7 ) {for (i =0 ; i <2 ; i++) { -seq_printf (m," %-15s : " ,"[NULL-STA]" ); -seq_printf (m,"null-%d" , i); -seq_printf (m,"[Tx:%d/" , -le32_to_cpu (ns->v7.result[i][4 ])); -seq_printf (m,"[ok:%d/" , -le32_to_cpu (ns->v7.result[i][1 ])); -seq_printf (m,"fail:%d/" , -le32_to_cpu (ns->v7.result[i][0 ])); -seq_printf (m,"on_time:%d/" , -le32_to_cpu (ns->v7.result[i][2 ])); -seq_printf (m,"retry:%d/" , -le32_to_cpu (ns->v7.result[i][3 ])); -seq_printf (m,"avg_t:%d.%03d/" , -le32_to_cpu (ns->v7.tavg[i]) /1000 , -le32_to_cpu (ns->v7.tavg[i]) %1000 ); -seq_printf (m,"max_t:%d.%03d]\n" , -le32_to_cpu (ns->v7.tmax[i]) /1000 , -le32_to_cpu (ns->v7.tmax[i]) %1000 ); + p +=scnprintf (p, end - p," %-15s : " ,"[NULL-STA]" ); + p +=scnprintf (p, end - p,"null-%d" , i); + p +=scnprintf (p, end - p,"[Tx:%d/" , +le32_to_cpu (ns->v7.result[i][4 ])); + p +=scnprintf (p, end - p,"[ok:%d/" , +le32_to_cpu (ns->v7.result[i][1 ])); + p +=scnprintf (p, end - p,"fail:%d/" , +le32_to_cpu (ns->v7.result[i][0 ])); + p +=scnprintf (p, end - p,"on_time:%d/" , +le32_to_cpu (ns->v7.result[i][2 ])); + p +=scnprintf (p, end - p,"retry:%d/" , +le32_to_cpu (ns->v7.result[i][3 ])); + p +=scnprintf (p, end - p,"avg_t:%d.%03d/" , +le32_to_cpu (ns->v7.tavg[i]) /1000 , +le32_to_cpu (ns->v7.tavg[i]) %1000 ); + p +=scnprintf (p, end - p,"max_t:%d.%03d]\n" , +le32_to_cpu (ns->v7.tmax[i]) /1000 , +le32_to_cpu (ns->v7.tmax[i]) %1000 ); } }else {for (i =0 ; i <2 ; i++) { -seq_printf (m," %-15s : " ,"[NULL-STA]" ); -seq_printf (m,"null-%d" , i); -seq_printf (m,"[Tx:%d/" , -le32_to_cpu (ns->v2.result[i][4 ])); -seq_printf (m,"[ok:%d/" , -le32_to_cpu (ns->v2.result[i][1 ])); -seq_printf (m,"fail:%d/" , -le32_to_cpu (ns->v2.result[i][0 ])); -seq_printf (m,"on_time:%d/" , -le32_to_cpu (ns->v2.result[i][2 ])); -seq_printf (m,"retry:%d/" , -le32_to_cpu (ns->v2.result[i][3 ])); -seq_printf (m,"avg_t:%d.%03d/" , -le32_to_cpu (ns->v2.avg_t[i]) /1000 , -le32_to_cpu (ns->v2.avg_t[i]) %1000 ); -seq_printf (m,"max_t:%d.%03d]\n" , -le32_to_cpu (ns->v2.max_t[i]) /1000 , -le32_to_cpu (ns->v2.max_t[i]) %1000 ); + p +=scnprintf (p, end - p," %-15s : " ,"[NULL-STA]" ); + p +=scnprintf (p, end - p,"null-%d" , i); + p +=scnprintf (p, end - p,"[Tx:%d/" , +le32_to_cpu (ns->v2.result[i][4 ])); + p +=scnprintf (p, end - p,"[ok:%d/" , +le32_to_cpu (ns->v2.result[i][1 ])); + p +=scnprintf (p, end - p,"fail:%d/" , +le32_to_cpu (ns->v2.result[i][0 ])); + p +=scnprintf (p, end - p,"on_time:%d/" , +le32_to_cpu (ns->v2.result[i][2 ])); + p +=scnprintf (p, end - p,"retry:%d/" , +le32_to_cpu (ns->v2.result[i][3 ])); + p +=scnprintf (p, end - p,"avg_t:%d.%03d/" , +le32_to_cpu (ns->v2.avg_t[i]) /1000 , +le32_to_cpu (ns->v2.avg_t[i]) %1000 ); + p +=scnprintf (p, end - p,"max_t:%d.%03d]\n" , +le32_to_cpu (ns->v2.max_t[i]) /1000 , +le32_to_cpu (ns->v2.max_t[i]) %1000 ); } } + +return p - buf; } -static void _show_fbtc_step_v2 (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_fbtc_step_v2 (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;struct rtw89_btc_rpt_cmn_info *pcinfo =NULL ;struct rtw89_btc_fbtc_steps_v2 *pstep =NULL ;const struct rtw89_btc_ver *ver = btc->ver; +char *p = buf, *end = buf + bufsz;u8 type, val, cnt =0 , state =0 ;bool outloop = false;u16 i, diff_t, n_start =0 , n_stop =0 ;
@@ -9838,14 +9943,14 @@ static void _show_fbtc_step_v2(struct rtw89_dev *rtwdev, struct seq_file *m) pcinfo = &pfwinfo->rpt_fbtc_step.cinfo;if (!pcinfo->valid) -return ; +return 0 ; pstep = &pfwinfo->rpt_fbtc_step.finfo.v2; pos_old =le16_to_cpu (pstep->pos_old); pos_new =le16_to_cpu (pstep->pos_new);if (pcinfo->req_fver != pstep->fver) -return ; +return 0 ;/* store step info by using ring instead of FIFO*/ do {
@@ -9874,13 +9979,15 @@ static void _show_fbtc_step_v2(struct rtw89_dev *rtwdev, struct seq_file *m)continue ;if (cnt %10 ==0 ) -seq_printf (m," %-15s : " ,"[steps]" ); + p +=scnprintf (p, end - p, +" %-15s : " ,"[steps]" ); -seq_printf (m,"-> %s(%02d)(%02d)" , - (type ==CXSTEP_SLOT ?"SLT" : -"EVT" ), (u32 )val, diff_t); + p +=scnprintf (p, end - p, +"-> %s(%02d)(%02d)" , + (type ==CXSTEP_SLOT ?"SLT" : +"EVT" ), (u32 )val, diff_t);if (cnt %10 ==9 ) -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); cnt++; }
@@ -9897,29 +10004,32 @@ static void _show_fbtc_step_v2(struct rtw89_dev *rtwdev, struct seq_file *m)break ; } }while (!outloop); + +return p - buf; } -static void _show_fbtc_step_v3 (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_fbtc_step_v3 (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;struct rtw89_btc_rpt_cmn_info *pcinfo;struct rtw89_btc_fbtc_steps_v3 *pstep;u32 i, n_begin, n_end, array_idx, cnt =0 ; +char *p = buf, *end = buf + bufsz;u8 type, val;u16 diff_t;if ((pfwinfo->rpt_en_map &rtw89_btc_fw_rpt_ver (rtwdev,RPT_EN_FW_STEP_INFO )) ==0 ) -return ; +return 0 ; pcinfo = &pfwinfo->rpt_fbtc_step.cinfo;if (!pcinfo->valid) -return ; +return 0 ; pstep = &pfwinfo->rpt_fbtc_step.finfo.v3;if (pcinfo->req_fver != pstep->fver) -return ; +return 0 ;if (le32_to_cpu (pstep->cnt) <=FCXDEF_STEP ) n_begin =1 ;
@@ -9929,7 +10039,7 @@ static void _show_fbtc_step_v3(struct rtw89_dev *rtwdev, struct seq_file *m) n_end =le32_to_cpu (pstep->cnt);if (n_begin > n_end) -return ; +return 0 ;/* restore step info by using ring instead of FIFO */ for (i = n_begin; i <= n_end; i++) {
@@ -9942,50 +10052,55 @@ static void _show_fbtc_step_v3(struct rtw89_dev *rtwdev, struct seq_file *m)continue ;if (cnt %10 ==0 ) -seq_printf (m," %-15s : " ,"[steps]" ); + p +=scnprintf (p, end - p," %-15s : " ,"[steps]" ); -seq_printf (m,"-> %s(%02d)" , - (type ==CXSTEP_SLOT ? -id_to_slot ((u32 )val) : -id_to_evt ((u32 )val)), diff_t); + p +=scnprintf (p, end - p,"-> %s(%02d)" , + (type ==CXSTEP_SLOT ? +id_to_slot ((u32 )val) : +id_to_evt ((u32 )val)), diff_t);if (cnt %10 ==9 ) -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); cnt++; } + +return p - buf; } -static void _show_fw_dm_msg (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_fw_dm_msg (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;const struct rtw89_btc_ver *ver = btc->ver; +char *p = buf, *end = buf + bufsz;if (!(btc->dm.coex_info_map &BTC_COEX_INFO_DM )) -return ; + goto out; -_show_error (rtwdev, m); -_show_fbtc_tdma (rtwdev, m); -_show_fbtc_slots (rtwdev, m); + p +=_show_error (rtwdev, p, end - p); + p +=_show_fbtc_tdma (rtwdev, p, end - p); + p +=_show_fbtc_slots (rtwdev, p, end - p);if (ver->fcxcysta ==2 ) -_show_fbtc_cysta_v2 (rtwdev, m); + p +=_show_fbtc_cysta_v2 (rtwdev, p, end - p);else if (ver->fcxcysta ==3 ) -_show_fbtc_cysta_v3 (rtwdev, m); + p +=_show_fbtc_cysta_v3 (rtwdev, p, end - p);else if (ver->fcxcysta ==4 ) -_show_fbtc_cysta_v4 (rtwdev, m); + p +=_show_fbtc_cysta_v4 (rtwdev, p, end - p);else if (ver->fcxcysta ==5 ) -_show_fbtc_cysta_v5 (rtwdev, m); + p +=_show_fbtc_cysta_v5 (rtwdev, p, end - p);else if (ver->fcxcysta ==7 ) -_show_fbtc_cysta_v7 (rtwdev, m); + p +=_show_fbtc_cysta_v7 (rtwdev, p, end - p); -_show_fbtc_nullsta (rtwdev, m); + p +=_show_fbtc_nullsta (rtwdev, p, end - p);if (ver->fcxstep ==2 ) -_show_fbtc_step_v2 (rtwdev, m); + p +=_show_fbtc_step_v2 (rtwdev, p, end - p);else if (ver->fcxstep ==3 ) -_show_fbtc_step_v3 (rtwdev, m); + p +=_show_fbtc_step_v3 (rtwdev, p, end - p); +out: +return p - buf; }static void _get_gnt (struct rtw89_dev *rtwdev,struct rtw89_mac_ax_coex_gnt *gnt_cfg)
@@ -10030,12 +10145,13 @@ static void _get_gnt(struct rtw89_dev *rtwdev, struct rtw89_mac_ax_coex_gnt *gnt } } -static void _show_gpio_dbg (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_gpio_dbg (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc_btf_fwinfo *pfwinfo = &rtwdev->btc.fwinfo;const struct rtw89_btc_ver *ver = rtwdev->btc.ver;struct rtw89_btc_rpt_cmn_info *pcinfo =NULL ;union rtw89_btc_fbtc_gpio_dbg *gdbg =NULL ; +char *p = buf, *end = buf + bufsz;u8 *gpio_map, i;u32 en_map;
@@ -10045,8 +10161,8 @@ static void _show_gpio_dbg(struct rtw89_dev *rtwdev, struct seq_file *m)rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC], %s(): stop due rpt_fbtc_gpio_dbg.cinfo\n" , __func__); -seq_puts (m,"\n" ); -return ; + p +=scnprintf (p, end - p,"\n" ); + goto out; }if (ver->fcxgpiodbg ==7 ) {
@@ -10058,20 +10174,24 @@ static void _show_gpio_dbg(struct rtw89_dev *rtwdev, struct seq_file *m) }if (!en_map) -return ; + goto out; -seq_printf (m," %-15s : enable_map:0x%08x" , -"[gpio_dbg]" , en_map); + p +=scnprintf (p, end - p," %-15s : enable_map:0x%08x" , +"[gpio_dbg]" , en_map);for (i =0 ; i <BTC_DBG_MAX1 ; i++) {if (!(en_map &BIT (i)))continue ; -seq_printf (m,", %s->GPIO%d" ,id_to_gdbg (i), gpio_map[i]); + p +=scnprintf (p, end - p,", %s->GPIO%d" ,id_to_gdbg (i), + gpio_map[i]); } -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); + +out: +return p - buf; } -static void _show_mreg_v1 (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_mreg_v1 (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {const struct rtw89_chip_info *chip = rtwdev->chip;struct rtw89_btc *btc = &rtwdev->btc;
@@ -10083,45 +10203,47 @@ static void _show_mreg_v1(struct rtw89_dev *rtwdev, struct seq_file *m)struct rtw89_btc_bt_info *bt = &btc->cx.bt;struct rtw89_mac_ax_coex_gnt gnt_cfg = {};struct rtw89_mac_ax_gnt gnt; +char *p = buf, *end = buf + bufsz;u8 i =0 , type =0 , cnt =0 ;u32 val, offset;if (!(btc->dm.coex_info_map &BTC_COEX_INFO_MREG )) -return ; +return 0 ; -seq_puts (m,"========== [HW Status] ==========\n" ); + p +=scnprintf (p, end - p,"========== [HW Status] ==========\n" ); -seq_printf (m, -" %-15s : WL->BT:0x%08x(cnt:%d), BT->WL:0x%08x(total:%d, bt_update:%d)\n" , -"[scoreboard]" , wl->scbd, cx->cnt_wl[BTC_WCNT_SCBDUPDATE ], - bt->scbd, cx->cnt_bt[BTC_BCNT_SCBDREAD ], - cx->cnt_bt[BTC_BCNT_SCBDUPDATE ]); + p +=scnprintf (p, end - p, +" %-15s : WL->BT:0x%08x(cnt:%d), BT->WL:0x%08x(total:%d, bt_update:%d)\n" , +"[scoreboard]" , wl->scbd, + cx->cnt_wl[BTC_WCNT_SCBDUPDATE ], + bt->scbd, cx->cnt_bt[BTC_BCNT_SCBDREAD ], + cx->cnt_bt[BTC_BCNT_SCBDUPDATE ]); btc->dm.pta_owner =rtw89_mac_get_ctrl_path (rtwdev);_get_gnt (rtwdev, &gnt_cfg); gnt = gnt_cfg.band[0 ]; -seq_printf (m, -" %-15s : pta_owner:%s, phy-0[gnt_wl:%s-%d/gnt_bt:%s-%d], " , -"[gnt_status]" , - chip->chip_id ==RTL8852C ?"HW" : - btc->dm.pta_owner ==BTC_CTRL_BY_WL ?"WL" :"BT" , - gnt.gnt_wl_sw_en ?"SW" :"HW" , gnt.gnt_wl, - gnt.gnt_bt_sw_en ?"SW" :"HW" , gnt.gnt_bt); + p +=scnprintf (p, end - p, +" %-15s : pta_owner:%s, phy-0[gnt_wl:%s-%d/gnt_bt:%s-%d], " , +"[gnt_status]" , + chip->chip_id ==RTL8852C ?"HW" : + btc->dm.pta_owner ==BTC_CTRL_BY_WL ?"WL" :"BT" , + gnt.gnt_wl_sw_en ?"SW" :"HW" , gnt.gnt_wl, + gnt.gnt_bt_sw_en ?"SW" :"HW" , gnt.gnt_bt); gnt = gnt_cfg.band[1 ]; -seq_printf (m,"phy-1[gnt_wl:%s-%d/gnt_bt:%s-%d]\n" , - gnt.gnt_wl_sw_en ?"SW" :"HW" , - gnt.gnt_wl, - gnt.gnt_bt_sw_en ?"SW" :"HW" , - gnt.gnt_bt); + p +=scnprintf (p, end - p,"phy-1[gnt_wl:%s-%d/gnt_bt:%s-%d]\n" , + gnt.gnt_wl_sw_en ?"SW" :"HW" , + gnt.gnt_wl, + gnt.gnt_bt_sw_en ?"SW" :"HW" , + gnt.gnt_bt); pcinfo = &pfwinfo->rpt_fbtc_mregval.cinfo;if (!pcinfo->valid) {rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC], %s(): stop due rpt_fbtc_mregval.cinfo\n" , __func__); -return ; + goto out; } pmreg = &pfwinfo->rpt_fbtc_mregval.finfo.v1;
@@ -10135,21 +10257,26 @@ static void _show_mreg_v1(struct rtw89_dev *rtwdev, struct seq_file *m) val =le32_to_cpu (pmreg->mreg_val[i]);if (cnt %6 ==0 ) -seq_printf (m," %-15s : %d_0x%04x=0x%08x" , -"[reg]" , (u32 )type, offset, val); + p +=scnprintf (p, end - p, +" %-15s : %d_0x%04x=0x%08x" , +"[reg]" , (u32 )type, offset, val);else -seq_printf (m,", %d_0x%04x=0x%08x" , (u32 )type, - offset, val); + p +=scnprintf (p, end - p,", %d_0x%04x=0x%08x" , + (u32 )type, + offset, val);if (cnt %6 ==5 ) -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); cnt++;if (i >= pmreg->reg_num) -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); } + +out: +return p - buf; } -static void _show_mreg_v2 (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_mreg_v2 (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {const struct rtw89_chip_info *chip = rtwdev->chip;struct rtw89_btc *btc = &rtwdev->btc;
@@ -10161,46 +10288,48 @@ static void _show_mreg_v2(struct rtw89_dev *rtwdev, struct seq_file *m)struct rtw89_btc_bt_info *bt = &btc->cx.bt;struct rtw89_mac_ax_coex_gnt gnt_cfg = {};struct rtw89_mac_ax_gnt gnt; +char *p = buf, *end = buf + bufsz;u8 i =0 , type =0 , cnt =0 ;u32 val, offset;if (!(btc->dm.coex_info_map &BTC_COEX_INFO_MREG )) -return ; +return 0 ; -seq_puts (m,"========== [HW Status] ==========\n" ); + p +=scnprintf (p, end - p,"========== [HW Status] ==========\n" ); -seq_printf (m, -" %-15s : WL->BT:0x%08x(cnt:%d), BT->WL:0x%08x(total:%d, bt_update:%d)\n" , -"[scoreboard]" , wl->scbd, cx->cnt_wl[BTC_WCNT_SCBDUPDATE ], - bt->scbd, cx->cnt_bt[BTC_BCNT_SCBDREAD ], - cx->cnt_bt[BTC_BCNT_SCBDUPDATE ]); + p +=scnprintf (p, end - p, +" %-15s : WL->BT:0x%08x(cnt:%d), BT->WL:0x%08x(total:%d, bt_update:%d)\n" , +"[scoreboard]" , wl->scbd, + cx->cnt_wl[BTC_WCNT_SCBDUPDATE ], + bt->scbd, cx->cnt_bt[BTC_BCNT_SCBDREAD ], + cx->cnt_bt[BTC_BCNT_SCBDUPDATE ]); btc->dm.pta_owner =rtw89_mac_get_ctrl_path (rtwdev);_get_gnt (rtwdev, &gnt_cfg); gnt = gnt_cfg.band[0 ]; -seq_printf (m, -" %-15s : pta_owner:%s, phy-0[gnt_wl:%s-%d/gnt_bt:%s-%d], polut_type:%s" , -"[gnt_status]" , - chip->chip_id ==RTL8852C ?"HW" : - btc->dm.pta_owner ==BTC_CTRL_BY_WL ?"WL" :"BT" , - gnt.gnt_wl_sw_en ?"SW" :"HW" , gnt.gnt_wl, - gnt.gnt_bt_sw_en ?"SW" :"HW" , gnt.gnt_bt, -id_to_polut (wl->bt_polut_type[wl->pta_req_mac])); + p +=scnprintf (p, end - p, +" %-15s : pta_owner:%s, phy-0[gnt_wl:%s-%d/gnt_bt:%s-%d], polut_type:%s" , +"[gnt_status]" , + chip->chip_id ==RTL8852C ?"HW" : + btc->dm.pta_owner ==BTC_CTRL_BY_WL ?"WL" :"BT" , + gnt.gnt_wl_sw_en ?"SW" :"HW" , gnt.gnt_wl, + gnt.gnt_bt_sw_en ?"SW" :"HW" , gnt.gnt_bt, +id_to_polut (wl->bt_polut_type[wl->pta_req_mac])); gnt = gnt_cfg.band[1 ]; -seq_printf (m,"phy-1[gnt_wl:%s-%d/gnt_bt:%s-%d]\n" , - gnt.gnt_wl_sw_en ?"SW" :"HW" , - gnt.gnt_wl, - gnt.gnt_bt_sw_en ?"SW" :"HW" , - gnt.gnt_bt); + p +=scnprintf (p, end - p,"phy-1[gnt_wl:%s-%d/gnt_bt:%s-%d]\n" , + gnt.gnt_wl_sw_en ?"SW" :"HW" , + gnt.gnt_wl, + gnt.gnt_bt_sw_en ?"SW" :"HW" , + gnt.gnt_bt); pcinfo = &pfwinfo->rpt_fbtc_mregval.cinfo;if (!pcinfo->valid) {rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC], %s(): stop due rpt_fbtc_mregval.cinfo\n" , __func__); -return ; + goto out; } pmreg = &pfwinfo->rpt_fbtc_mregval.finfo.v2;
@@ -10214,21 +10343,26 @@ static void _show_mreg_v2(struct rtw89_dev *rtwdev, struct seq_file *m) val =le32_to_cpu (pmreg->mreg_val[i]);if (cnt %6 ==0 ) -seq_printf (m," %-15s : %d_0x%04x=0x%08x" , -"[reg]" , (u32 )type, offset, val); + p +=scnprintf (p, end - p, +" %-15s : %d_0x%04x=0x%08x" , +"[reg]" , (u32 )type, offset, val);else -seq_printf (m,", %d_0x%04x=0x%08x" , (u32 )type, - offset, val); + p +=scnprintf (p, end - p,", %d_0x%04x=0x%08x" , + (u32 )type, + offset, val);if (cnt %6 ==5 ) -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); cnt++;if (i >= pmreg->reg_num) -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); } + +out: +return p - buf; } -static void _show_mreg_v7 (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_mreg_v7 (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;
@@ -10239,46 +10373,50 @@ static void _show_mreg_v7(struct rtw89_dev *rtwdev, struct seq_file *m)struct rtw89_btc_bt_info *bt = &cx->bt;struct rtw89_mac_ax_gnt *gnt =NULL ;struct rtw89_btc_dm *dm = &btc->dm; +char *p = buf, *end = buf + bufsz;u8 i, type, cnt =0 ;u32 val, offset;if (!(dm->coex_info_map &BTC_COEX_INFO_MREG )) -return ; +return 0 ; -seq_puts (m,"\n\r========== [HW Status] ==========" ); + p +=scnprintf (p, end - p,"\n\r========== [HW Status] ==========" ); -seq_printf (m, -"\n\r %-15s : WL->BT:0x%08x(cnt:%d), BT->WL:0x%08x(total:%d, bt_update:%d)" , -"[scoreboard]" , wl->scbd, cx->cnt_wl[BTC_WCNT_SCBDUPDATE ], - bt->scbd, cx->cnt_bt[BTC_BCNT_SCBDREAD ], - cx->cnt_bt[BTC_BCNT_SCBDUPDATE ]); + p +=scnprintf (p, end - p, +"\n\r %-15s : WL->BT:0x%08x(cnt:%d), BT->WL:0x%08x(total:%d, bt_update:%d)" , +"[scoreboard]" , wl->scbd, + cx->cnt_wl[BTC_WCNT_SCBDUPDATE ], + bt->scbd, cx->cnt_bt[BTC_BCNT_SCBDREAD ], + cx->cnt_bt[BTC_BCNT_SCBDUPDATE ]);/* To avoid I/O if WL LPS or power-off */ dm->pta_owner =rtw89_mac_get_ctrl_path (rtwdev); -seq_printf (m, -"\n\r %-15s : pta_owner:%s, pta_req_mac:MAC%d, rf_gnt_source: polut_type:%s" , -"[gnt_status]" , - rtwdev->chip->para_ver &BTC_FEAT_PTA_ONOFF_CTRL ?"HW" : - dm->pta_owner ==BTC_CTRL_BY_WL ?"WL" :"BT" , - wl->pta_req_mac,id_to_polut (wl->bt_polut_type[wl->pta_req_mac])); + p +=scnprintf (p, end - p, +"\n\r %-15s : pta_owner:%s, pta_req_mac:MAC%d, rf_gnt_source: polut_type:%s" , +"[gnt_status]" , + rtwdev->chip->para_ver &BTC_FEAT_PTA_ONOFF_CTRL ?"HW" : + dm->pta_owner ==BTC_CTRL_BY_WL ?"WL" :"BT" , + wl->pta_req_mac, +id_to_polut (wl->bt_polut_type[wl->pta_req_mac])); gnt = &dm->gnt.band[RTW89_PHY_0 ]; -seq_printf (m,", phy-0[gnt_wl:%s-%d/gnt_bt:%s-%d]" , - gnt->gnt_wl_sw_en ?"SW" :"HW" , gnt->gnt_wl, - gnt->gnt_bt_sw_en ?"SW" :"HW" , gnt->gnt_bt); + p +=scnprintf (p, end - p,", phy-0[gnt_wl:%s-%d/gnt_bt:%s-%d]" , + gnt->gnt_wl_sw_en ?"SW" :"HW" , gnt->gnt_wl, + gnt->gnt_bt_sw_en ?"SW" :"HW" , gnt->gnt_bt);if (rtwdev->dbcc_en) { gnt = &dm->gnt.band[RTW89_PHY_1 ]; -seq_printf (m,", phy-1[gnt_wl:%s-%d/gnt_bt:%s-%d]" , - gnt->gnt_wl_sw_en ?"SW" :"HW" , gnt->gnt_wl, - gnt->gnt_bt_sw_en ?"SW" :"HW" , gnt->gnt_bt); + p +=scnprintf (p, end - p, +", phy-1[gnt_wl:%s-%d/gnt_bt:%s-%d]" , + gnt->gnt_wl_sw_en ?"SW" :"HW" , gnt->gnt_wl, + gnt->gnt_bt_sw_en ?"SW" :"HW" , gnt->gnt_bt); } pcinfo = &pfwinfo->rpt_fbtc_mregval.cinfo;if (!pcinfo->valid) -return ; + goto out; pmreg = &pfwinfo->rpt_fbtc_mregval.finfo.v7;
@@ -10288,17 +10426,21 @@ static void _show_mreg_v7(struct rtw89_dev *rtwdev, struct seq_file *m) val =le32_to_cpu (pmreg->mreg_val[i]);if (cnt %6 ==0 ) -seq_printf (m,"\n\r %-15s : %s_0x%x=0x%x" ,"[reg]" , -id_to_regtype (type), offset, val); + p +=scnprintf (p, end - p, +"\n\r %-15s : %s_0x%x=0x%x" ,"[reg]" , +id_to_regtype (type), offset, val);else -seq_printf (m,", %s_0x%x=0x%x" , -id_to_regtype (type), offset, val); + p +=scnprintf (p, end - p,", %s_0x%x=0x%x" , +id_to_regtype (type), offset, val); cnt++; } -seq_puts (m,"\n" ); + p +=scnprintf (p, end - p,"\n" ); + +out: +return p - buf; } -static void _show_summary_v1 (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_summary_v1 (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;
@@ -10309,56 +10451,59 @@ static void _show_summary_v1(struct rtw89_dev *rtwdev, struct seq_file *m)struct rtw89_btc_wl_info *wl = &cx->wl;struct rtw89_btc_bt_info *bt = &cx->bt;u32 cnt_sum =0 , *cnt = btc->dm.cnt_notify; +char *p = buf, *end = buf + bufsz;u8 i;if (!(dm->coex_info_map &BTC_COEX_INFO_SUMMARY )) -return ; +return 0 ; -seq_puts (m,"========== [Statistics] ==========\n" ); + p +=scnprintf (p, end - p,"========== [Statistics] ==========\n" ); pcinfo = &pfwinfo->rpt_ctrl.cinfo;if (pcinfo->valid && !wl->status.map.lps && !wl->status.map.rf_off) { prptctrl = &pfwinfo->rpt_ctrl.finfo.v1; -seq_printf (m, -" %-15s : h2c_cnt=%d(fail:%d, fw_recv:%d), c2h_cnt=%d(fw_send:%d), " , -"[summary]" , pfwinfo->cnt_h2c, - pfwinfo->cnt_h2c_fail, prptctrl->h2c_cnt, - pfwinfo->cnt_c2h, prptctrl->c2h_cnt); + p +=scnprintf (p, end - p, +" %-15s : h2c_cnt=%d(fail:%d, fw_recv:%d), c2h_cnt=%d(fw_send:%d), " , +"[summary]" , pfwinfo->cnt_h2c, + pfwinfo->cnt_h2c_fail, prptctrl->h2c_cnt, + pfwinfo->cnt_c2h, prptctrl->c2h_cnt); -seq_printf (m, -"rpt_cnt=%d(fw_send:%d), rpt_map=0x%x, dm_error_map:0x%x" , - pfwinfo->event[BTF_EVNT_RPT ], prptctrl->rpt_cnt, - prptctrl->rpt_enable, dm->error.val); + p +=scnprintf (p, end - p, +"rpt_cnt=%d(fw_send:%d), rpt_map=0x%x, dm_error_map:0x%x" , + pfwinfo->event[BTF_EVNT_RPT ], + prptctrl->rpt_cnt, + prptctrl->rpt_enable, dm->error.val);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]" , prptctrl->mb_send_ok_cnt, - prptctrl->mb_send_fail_cnt, prptctrl->mb_recv_cnt); - -seq_printf (m, -"(A2DP_empty:%d, A2DP_flowstop:%d, A2DP_full:%d)\n" , - prptctrl->mb_a2dp_empty_cnt, - prptctrl->mb_a2dp_flct_cnt, - prptctrl->mb_a2dp_full_cnt); - -seq_printf (m, -" %-15s : wl_rfk[req:%d/go:%d/reject:%d/timeout:%d]" , -"[RFK]" , 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/go:%d/reject:%d/timeout:%d/fail:%d]\n" , - prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_REQ ], - prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_GO ], - prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_REJECT ], - prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_TIMEOUT ], - prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_FAIL ]); + p +=scnprintf (p, end - p," (WL FW Hang!!)" ); + p +=scnprintf (p, end - p,"\n" ); + p +=scnprintf (p, end - p, +" %-15s : send_ok:%d, send_fail:%d, recv:%d" , +"[mailbox]" , prptctrl->mb_send_ok_cnt, + prptctrl->mb_send_fail_cnt, + prptctrl->mb_recv_cnt); + + p +=scnprintf (p, end - p, +"(A2DP_empty:%d, A2DP_flowstop:%d, A2DP_full:%d)\n" , + prptctrl->mb_a2dp_empty_cnt, + prptctrl->mb_a2dp_flct_cnt, + prptctrl->mb_a2dp_full_cnt); + + p +=scnprintf (p, end - p, +" %-15s : wl_rfk[req:%d/go:%d/reject:%d/timeout:%d]" , +"[RFK]" , 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 ]); + + p +=scnprintf (p, end - p, +", bt_rfk[req:%d/go:%d/reject:%d/timeout:%d/fail:%d]\n" , + prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_REQ ], + prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_GO ], + prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_REJECT ], + prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_TIMEOUT ], + prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_FAIL ]);if (prptctrl->bt_rfk_cnt[BTC_BCNT_RFK_TIMEOUT ] >0 ) bt->rfk_info.map.timeout =1 ;
@@ -10367,42 +10512,44 @@ static void _show_summary_v1(struct rtw89_dev *rtwdev, struct seq_file *m) dm->error.map.wl_rfk_timeout = bt->rfk_info.map.timeout; }else { -seq_printf (m, -" %-15s : h2c_cnt=%d(fail:%d), c2h_cnt=%d, rpt_cnt=%d, rpt_map=0x%x" , -"[summary]" , pfwinfo->cnt_h2c, - pfwinfo->cnt_h2c_fail, pfwinfo->cnt_c2h, - pfwinfo->event[BTF_EVNT_RPT ], - btc->fwinfo.rpt_en_map); -seq_puts (m," (WL FW report invalid!!)\n" ); + p +=scnprintf (p, end - p, +" %-15s : h2c_cnt=%d(fail:%d), c2h_cnt=%d, rpt_cnt=%d, rpt_map=0x%x" , +"[summary]" , pfwinfo->cnt_h2c, + pfwinfo->cnt_h2c_fail, pfwinfo->cnt_c2h, + pfwinfo->event[BTF_EVNT_RPT ], + btc->fwinfo.rpt_en_map); + p +=scnprintf (p, end - p," (WL FW report invalid!!)\n" ); }for (i =0 ; i <BTC_NCNT_NUM ; i++) cnt_sum += dm->cnt_notify[i]; -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 ]); + p +=scnprintf (p, end - p, +" %-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 ]); + + p +=scnprintf (p, end - p, +"power_off=%d, radio_state=%d, role_info=%d, wl_rfk=%d, wl_sta=%d\n" , + 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_printf (m, -"power_off=%d, radio_state=%d, role_info=%d, wl_rfk=%d, wl_sta=%d\n" , - 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 ]); + p +=scnprintf (p, end - p, +" %-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, -" %-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 ]); + p +=scnprintf (p, end - p, +"timer=%d, control=%d, customerize=%d\n" , + cnt[BTC_NCNT_TIMER ], cnt[BTC_NCNT_CONTROL ], + cnt[BTC_NCNT_CUSTOMERIZE ]); -seq_printf (m, -"timer=%d, control=%d, customerize=%d\n" , - cnt[BTC_NCNT_TIMER ], cnt[BTC_NCNT_CONTROL ], - cnt[BTC_NCNT_CUSTOMERIZE ]); +return p - buf; } -static void _show_summary_v4 (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_summary_v4 (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;
@@ -10413,64 +10560,65 @@ static void _show_summary_v4(struct rtw89_dev *rtwdev, struct seq_file *m)struct rtw89_btc_wl_info *wl = &cx->wl;struct rtw89_btc_bt_info *bt = &cx->bt;u32 cnt_sum =0 , *cnt = btc->dm.cnt_notify; +char *p = buf, *end = buf + bufsz;u8 i;if (!(dm->coex_info_map &BTC_COEX_INFO_SUMMARY )) -return ; +return 0 ; -seq_puts (m,"========== [Statistics] ==========\n" ); + p +=scnprintf (p, end - p,"========== [Statistics] ==========\n" ); pcinfo = &pfwinfo->rpt_ctrl.cinfo;if (pcinfo->valid && !wl->status.map.lps && !wl->status.map.rf_off) { prptctrl = &pfwinfo->rpt_ctrl.finfo.v4; -seq_printf (m, -" %-15s : h2c_cnt=%d(fail:%d, fw_recv:%d), c2h_cnt=%d(fw_send:%d), " , -"[summary]" , pfwinfo->cnt_h2c, - pfwinfo->cnt_h2c_fail, -le32_to_cpu (prptctrl->rpt_info.cnt_h2c), - pfwinfo->cnt_c2h, -le32_to_cpu (prptctrl->rpt_info.cnt_c2h)); - -seq_printf (m, -"rpt_cnt=%d(fw_send:%d), rpt_map=0x%x, dm_error_map:0x%x" , - pfwinfo->event[BTF_EVNT_RPT ], -le32_to_cpu (prptctrl->rpt_info.cnt), -le32_to_cpu (prptctrl->rpt_info.en), - dm->error.val); + p +=scnprintf (p, end - p, +" %-15s : h2c_cnt=%d(fail:%d, fw_recv:%d), c2h_cnt=%d(fw_send:%d), " , +"[summary]" , pfwinfo->cnt_h2c, + pfwinfo->cnt_h2c_fail, +le32_to_cpu (prptctrl->rpt_info.cnt_h2c), + pfwinfo->cnt_c2h, +le32_to_cpu (prptctrl->rpt_info.cnt_c2h)); + + p +=scnprintf (p, end - p, +"rpt_cnt=%d(fw_send:%d), rpt_map=0x%x, dm_error_map:0x%x" , + pfwinfo->event[BTF_EVNT_RPT ], +le32_to_cpu (prptctrl->rpt_info.cnt), +le32_to_cpu (prptctrl->rpt_info.en), + dm->error.val);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/timeout:%d]" , -"[RFK]" , 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/go:%d/reject:%d/timeout:%d/fail:%d]\n" , -le32_to_cpu (prptctrl->bt_cnt[BTC_BCNT_RFK_REQ ]), -le32_to_cpu (prptctrl->bt_cnt[BTC_BCNT_RFK_GO ]), -le32_to_cpu (prptctrl->bt_cnt[BTC_BCNT_RFK_REJECT ]), -le32_to_cpu (prptctrl->bt_cnt[BTC_BCNT_RFK_TIMEOUT ]), -le32_to_cpu (prptctrl->bt_cnt[BTC_BCNT_RFK_FAIL ])); + p +=scnprintf (p, end - p," (WL FW Hang!!)" ); + p +=scnprintf (p, end - p,"\n" ); + p +=scnprintf (p, end - p, +" %-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)); + + p +=scnprintf (p, end - p, +"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)); + + p +=scnprintf (p, end - p, +" %-15s : wl_rfk[req:%d/go:%d/reject:%d/timeout:%d]" , +"[RFK]" , 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 ]); + + p +=scnprintf (p, end - p, +", bt_rfk[req:%d/go:%d/reject:%d/timeout:%d/fail:%d]\n" , +le32_to_cpu (prptctrl->bt_cnt[BTC_BCNT_RFK_REQ ]), +le32_to_cpu (prptctrl->bt_cnt[BTC_BCNT_RFK_GO ]), +le32_to_cpu (prptctrl->bt_cnt[BTC_BCNT_RFK_REJECT ]), +le32_to_cpu (prptctrl->bt_cnt[BTC_BCNT_RFK_TIMEOUT ]), +le32_to_cpu (prptctrl->bt_cnt[BTC_BCNT_RFK_FAIL ]));if (le32_to_cpu (prptctrl->bt_cnt[BTC_BCNT_RFK_TIMEOUT ]) >0 ) bt->rfk_info.map.timeout =1 ;
@@ -10479,42 +10627,44 @@ static void _show_summary_v4(struct rtw89_dev *rtwdev, struct seq_file *m) dm->error.map.wl_rfk_timeout = bt->rfk_info.map.timeout; }else { -seq_printf (m, -" %-15s : h2c_cnt=%d(fail:%d), c2h_cnt=%d, rpt_cnt=%d, rpt_map=0x%x" , -"[summary]" , pfwinfo->cnt_h2c, - pfwinfo->cnt_h2c_fail, pfwinfo->cnt_c2h, - pfwinfo->event[BTF_EVNT_RPT ], - btc->fwinfo.rpt_en_map); -seq_puts (m," (WL FW report invalid!!)\n" ); + p +=scnprintf (p, end - p, +" %-15s : h2c_cnt=%d(fail:%d), c2h_cnt=%d, rpt_cnt=%d, rpt_map=0x%x" , +"[summary]" , pfwinfo->cnt_h2c, + pfwinfo->cnt_h2c_fail, pfwinfo->cnt_c2h, + pfwinfo->event[BTF_EVNT_RPT ], + btc->fwinfo.rpt_en_map); + p +=scnprintf (p, end - p," (WL FW report invalid!!)\n" ); }for (i =0 ; i <BTC_NCNT_NUM ; i++) cnt_sum += dm->cnt_notify[i]; -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 ]); + p +=scnprintf (p, end - p, +" %-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\n" , - 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 ]); + p +=scnprintf (p, end - p, +"power_off=%d, radio_state=%d, role_info=%d, wl_rfk=%d, wl_sta=%d\n" , + 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_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 ]); + p +=scnprintf (p, end - p, +" %-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\n" , - cnt[BTC_NCNT_TIMER ], cnt[BTC_NCNT_CONTROL ], - cnt[BTC_NCNT_CUSTOMERIZE ]); + p +=scnprintf (p, end - p, +"timer=%d, control=%d, customerize=%d\n" , + cnt[BTC_NCNT_TIMER ], cnt[BTC_NCNT_CONTROL ], + cnt[BTC_NCNT_CUSTOMERIZE ]); + +return p - buf; } -static void _show_summary_v5 (struct rtw89_dev *rtwdev,struct seq_file *m) +static int _show_summary_v5 (struct rtw89_dev *rtwdev,char *buf,size_t bufsz) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;
@@ -10524,112 +10674,118 @@ static void _show_summary_v5(struct rtw89_dev *rtwdev, struct seq_file *m)struct rtw89_btc_dm *dm = &btc->dm;struct rtw89_btc_wl_info *wl = &cx->wl;u32 cnt_sum =0 , *cnt = btc->dm.cnt_notify; +char *p = buf, *end = buf + bufsz;u8 i;if (!(dm->coex_info_map &BTC_COEX_INFO_SUMMARY )) -return ; +return 0 ; -seq_puts (m,"========== [Statistics] ==========\n" ); + p +=scnprintf (p, end - p,"========== [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)); + p +=scnprintf (p, end - p, +" %-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)); + + p +=scnprintf (p, end - p, +"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)); + p +=scnprintf (p, end - p," (WL FW Hang!!)" ); + p +=scnprintf (p, end - p,"\n" ); + p +=scnprintf (p, end - p, +" %-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)); + + p +=scnprintf (p, end - p, +"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)); + + p +=scnprintf (p, end - p, +" %-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 ]); + + p +=scnprintf (p, end - p, +", bt_rfk[req:%d]" , +le16_to_cpu (prptctrl->bt_cnt[BTC_BCNT_RFK_REQ ])); + + p +=scnprintf (p, end - p, +", 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_printf (m, -" %-15s : h2c_cnt=%d(fail:%d), c2h_cnt=%d" , -"[summary]" , pfwinfo->cnt_h2c, - pfwinfo->cnt_h2c_fail, pfwinfo->cnt_c2h); + p += scnprintf(p, end - p, + " %-15s : h2c_cnt=%d(fail:%d), c2h_cnt=%d", + "[summary]", pfwinfo->cnt_h2c,
Lines of this file are not shown. View the raw message.
drivers/net/wireless/realtek/rtw89/coex.h +1 -1
Lines of this file are not shown. View the raw message.
drivers/net/wireless/realtek/rtw89/debug.c +1065 -852
1,917 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/phy.c +10 -6
Lines of this file are not shown. View the raw message.
drivers/net/wireless/realtek/rtw89/phy.h +2 -2
Lines of this file are not shown. View the raw message.
drivers/net/wireless/realtek/rtw89/sar.c +26 -14
Lines of this file are not shown. View the raw message.
drivers/net/wireless/realtek/rtw89/sar.h +3 -2
Lines of this file are not shown. View the raw message.
drivers/net/wireless/realtek/rtw89/util.c +11 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/realtek/rtw89/util.h +1 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.25.1
Part of the diff is not shown here. View the raw message.
Ping-Ke Shih
maintainerPATCH 4/10 wifi: rtw89: debugfs: specify buffer size allocated by devm_kazlloc() for reading
In reply to Ping-Ke ShihSome debufs entries need output buffer over default size 4K. Since reading of many debugfs entries is to access IO, it costs time to dynamically re-allocate larger buffer and access IO again and again. Add an option to specify the size it needs.
--- drivers/net/wireless/realtek/rtw89/debug.c | 62 ++++++++++++++++------ 1 file changed, 45 insertions(+), 17 deletions(-)
drivers/net/wireless/realtek/rtw89/debug.c +45 -17
@@ -23,6 +23,10 @@ MODULE_PARM_DESC(debug_mask, "Debugging mask");#endif #ifdef CONFIG_RTW89_DEBUGFS +struct rtw89_debugfs_priv_opt { + size_t rsize; +}; + struct rtw89_debugfs_priv { struct rtw89_dev *rtwdev; ssize_t (*cb_read)(struct rtw89_dev *rtwdev,
@@ -31,6 +35,7 @@ struct rtw89_debugfs_priv {ssize_t (*cb_write)(struct rtw89_dev *rtwdev,struct rtw89_debugfs_priv *debugfs_priv,const char *buf,size_t count); +struct rtw89_debugfs_priv_opt opt; union { u32 cb_data; struct {
@@ -55,6 +60,8 @@ struct rtw89_debugfs_priv {u8 sel; } mac_mem; }; +ssize_t rused; +char *rbuf; };struct rtw89_debugfs {
@@ -120,23 +127,31 @@ static ssize_t rtw89_debugfs_file_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { struct rtw89_debugfs_priv *debugfs_priv = file->private_data; +struct rtw89_debugfs_priv_opt *opt = &debugfs_priv->opt;struct rtw89_dev *rtwdev = debugfs_priv->rtwdev; -size_t bufsz =PAGE_SIZE ; +size_t bufsz = opt->rsize ? opt->rsize :PAGE_SIZE ;char *buf;ssize_t n; - buf =kvmalloc (bufsz,GFP_KERNEL ); +if (!debugfs_priv->rbuf) + debugfs_priv->rbuf =devm_kzalloc (rtwdev->dev, bufsz,GFP_KERNEL ); + + buf = debugfs_priv->rbuf;if (!buf) -return 0 ; +return -ENOMEM ; + +if (*ppos) { + n = debugfs_priv->rused; + goto out; + } n = debugfs_priv->cb_read (rtwdev, debugfs_priv, buf, bufsz);rtw89_might_trailing_ellipsis (buf, bufsz, n); - n =simple_read_from_buffer (userbuf, count, ppos, buf, n); - -kvfree (buf); + debugfs_priv->rused = n; -return n; +out: +return simple_read_from_buffer (userbuf, count, ppos, buf, n); } static ssize_t rtw89_debugfs_file_write(struct file *file,
@@ -4157,42 +4172,55 @@ rtw89_debug_priv_disable_dm_set(struct rtw89_dev *rtwdev,return count; } -#define rtw89_debug_priv_get (name) \ +#define rtw89_debug_priv_get(name, opts...) \ { \ .cb_read = rtw89_debug_priv_ ##name## _get, \ + .opt = { opts }, \ } -#define rtw89_debug_priv_set (name) \ +#define rtw89_debug_priv_set(name, opts...) \ { \ .cb_write = rtw89_debug_priv_ ##name## _set, \ + .opt = { opts }, \ } -#define rtw89_debug_priv_select_and_get (name) \ +#define rtw89_debug_priv_select_and_get(name, opts...) \ { \ .cb_write = rtw89_debug_priv_ ##name## _select, \ .cb_read = rtw89_debug_priv_ ##name## _get, \ + .opt = { opts }, \ } -#define rtw89_debug_priv_set_and_get (name) \ +#define rtw89_debug_priv_set_and_get(name, opts...) \ { \ .cb_write = rtw89_debug_priv_ ##name## _set, \ .cb_read = rtw89_debug_priv_ ##name## _get, \ + .opt = { opts }, \ } +#define RSIZE_8K .rsize = 0x2000 +#define RSIZE_12K .rsize = 0x3000 +#define RSIZE_16K .rsize = 0x4000 +#define RSIZE_20K .rsize = 0x5000 +#define RSIZE_32K .rsize = 0x8000 +#define RSIZE_64K .rsize = 0x10000 +#define RSIZE_128K .rsize = 0x20000 +#define RSIZE_1M .rsize = 0x100000 +static const struct rtw89_debugfs rtw89_debugfs_templ = { .read_reg =rtw89_debug_priv_select_and_get (read_reg), .write_reg =rtw89_debug_priv_set (write_reg), .read_rf =rtw89_debug_priv_select_and_get (read_rf), .write_rf =rtw89_debug_priv_set (write_rf), - .rf_reg_dump =rtw89_debug_priv_get (rf_reg_dump), - .txpwr_table =rtw89_debug_priv_get (txpwr_table), - .mac_reg_dump =rtw89_debug_priv_select_and_get (mac_reg_dump), - .mac_mem_dump =rtw89_debug_priv_select_and_get (mac_mem_dump), - .mac_dbg_port_dump =rtw89_debug_priv_select_and_get (mac_dbg_port_dump), + .rf_reg_dump =rtw89_debug_priv_get (rf_reg_dump,RSIZE_8K ), + .txpwr_table =rtw89_debug_priv_get (txpwr_table,RSIZE_20K ), + .mac_reg_dump =rtw89_debug_priv_select_and_get (mac_reg_dump,RSIZE_128K ), + .mac_mem_dump =rtw89_debug_priv_select_and_get (mac_mem_dump,RSIZE_16K ), + .mac_dbg_port_dump =rtw89_debug_priv_select_and_get (mac_dbg_port_dump,RSIZE_1M ), .send_h2c =rtw89_debug_priv_set (send_h2c), .early_h2c =rtw89_debug_priv_set_and_get (early_h2c), .fw_crash =rtw89_debug_priv_set_and_get (fw_crash), - .btc_info =rtw89_debug_priv_get (btc_info), + .btc_info =rtw89_debug_priv_get (btc_info,RSIZE_12K ), .btc_manual =rtw89_debug_priv_set (btc_manual), .fw_log_manual =rtw89_debug_priv_set (fw_log_manual), .phy_info =rtw89_debug_priv_get (phy_info),
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 5/10 wifi: rtw89: debugfs: use wiphy_locked_debugfs_{read,write}() if needed
In reply to Ping-Ke ShihIf a debugfs entry takes driver mutex now, let it uses wiphy_locked_debugfs_{read,write}() to take both driver mutex and wiphy lock. Add rwlock option to support this.
--- drivers/net/wireless/realtek/rtw89/debug.c | 63 +++++++++++++++++++--- 1 file changed, 55 insertions(+), 8 deletions(-)
drivers/net/wireless/realtek/rtw89/debug.c +55 -8
@@ -24,6 +24,8 @@ MODULE_PARM_DESC(debug_mask, "Debugging mask");#ifdef CONFIG_RTW89_DEBUGFS struct rtw89_debugfs_priv_opt { +bool rlock:1 ; +bool wlock:1 ;size_t rsize; };
@@ -123,6 +125,19 @@ static u16 rtw89_rate_info_bw_to_mhz(enum rate_info_bw bw)return 0 ; } +static ssize_t rtw89_debugfs_file_read_helper (struct wiphy *wiphy,struct file *file, +char *buf,size_t bufsz,void *data) +{ +struct rtw89_debugfs_priv *debugfs_priv = data; +struct rtw89_dev *rtwdev = debugfs_priv->rtwdev; +ssize_t n; + + n = debugfs_priv->cb_read (rtwdev, debugfs_priv, buf, bufsz); +rtw89_might_trailing_ellipsis (buf, bufsz, n); + +return n; +} +static ssize_t rtw89_debugfs_file_read (struct file *file,char __user *userbuf,size_t count,loff_t *ppos) {
@@ -145,26 +160,55 @@ static ssize_t rtw89_debugfs_file_read(struct file *file, char __user *userbuf, goto out; } - n = debugfs_priv->cb_read (rtwdev, debugfs_priv, buf, bufsz); -rtw89_might_trailing_ellipsis (buf, bufsz, n); +if (opt->rlock) { + n =wiphy_locked_debugfs_read (rtwdev->hw->wiphy, file, buf, bufsz, + userbuf, count, ppos, + rtw89_debugfs_file_read_helper, + debugfs_priv); + debugfs_priv->rused = n; +return n; + } + + n =rtw89_debugfs_file_read_helper (rtwdev->hw->wiphy, file, buf, bufsz, + debugfs_priv); debugfs_priv->rused = n; out:return simple_read_from_buffer (userbuf, count, ppos, buf, n); } +static ssize_t rtw89_debugfs_file_write_helper (struct wiphy *wiphy,struct file *file, +char *buf,size_t count,void *data) +{ +struct rtw89_debugfs_priv *debugfs_priv = data; +struct rtw89_dev *rtwdev = debugfs_priv->rtwdev; + +return debugfs_priv->cb_write (rtwdev, debugfs_priv, buf, count); +} +static ssize_t rtw89_debugfs_file_write (struct file *file,const char __user *userbuf,size_t count,loff_t *loff) {struct rtw89_debugfs_priv *debugfs_priv = file->private_data; +struct rtw89_debugfs_priv_opt *opt = &debugfs_priv->opt;struct rtw89_dev *rtwdev = debugfs_priv->rtwdev; char *buf __free(kfree) = kmalloc(count + 1, GFP_KERNEL); +ssize_t n;if (!buf)return -ENOMEM ; +if (opt->wlock) { + n =wiphy_locked_debugfs_write (rtwdev->hw->wiphy, + file, buf, count +1 , + userbuf, count, + rtw89_debugfs_file_write_helper, + debugfs_priv); +return n; + } +if (copy_from_user (buf, userbuf, count))return -EFAULT ;
@@ -4206,6 +4250,9 @@ rtw89_debug_priv_disable_dm_set(struct rtw89_dev *rtwdev,#define RSIZE_64K .rsize = 0x10000#define RSIZE_128K .rsize = 0x20000#define RSIZE_1M .rsize = 0x100000 +#define RLOCK .rlock = 1 +#define WLOCK .wlock = 1 +#define RWLOCK RLOCK, WLOCKstatic const struct rtw89_debugfs rtw89_debugfs_templ = { .read_reg =rtw89_debug_priv_select_and_get (read_reg),
@@ -4213,18 +4260,18 @@ static const struct rtw89_debugfs rtw89_debugfs_templ = { .read_rf = rtw89_debug_priv_select_and_get(read_rf), .write_rf = rtw89_debug_priv_set(write_rf), .rf_reg_dump = rtw89_debug_priv_get(rf_reg_dump, RSIZE_8K), - .txpwr_table = rtw89_debug_priv_get(txpwr_table, RSIZE_20K), + .txpwr_table = rtw89_debug_priv_get(txpwr_table, RSIZE_20K, RLOCK), .mac_reg_dump = rtw89_debug_priv_select_and_get(mac_reg_dump, RSIZE_128K), - .mac_mem_dump = rtw89_debug_priv_select_and_get(mac_mem_dump, RSIZE_16K), + .mac_mem_dump = rtw89_debug_priv_select_and_get(mac_mem_dump, RSIZE_16K, RLOCK), .mac_dbg_port_dump = rtw89_debug_priv_select_and_get(mac_dbg_port_dump, RSIZE_1M), .send_h2c = rtw89_debug_priv_set(send_h2c), - .early_h2c = rtw89_debug_priv_set_and_get(early_h2c), - .fw_crash = rtw89_debug_priv_set_and_get(fw_crash), + .early_h2c = rtw89_debug_priv_set_and_get(early_h2c, RWLOCK), + .fw_crash = rtw89_debug_priv_set_and_get(fw_crash, WLOCK), .btc_info = rtw89_debug_priv_get(btc_info, RSIZE_12K), .btc_manual = rtw89_debug_priv_set(btc_manual), - .fw_log_manual = rtw89_debug_priv_set(fw_log_manual), + .fw_log_manual = rtw89_debug_priv_set(fw_log_manual, WLOCK), .phy_info = rtw89_debug_priv_get(phy_info), - .stations = rtw89_debug_priv_get(stations), + .stations = rtw89_debug_priv_get(stations, RLOCK), .disable_dm = rtw89_debug_priv_set_and_get(disable_dm), };
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 6/10 wifi: rtw89: debugfs: use debugfs_short_fops
In reply to Ping-Ke ShihWith this change, the object code size can reduce 768 bytes.
text data bss dec hex filename 77257 4262 4 81523 13e73 debug.o (before) 76489 4262 4 80755 13b73 debug.o (after)
--- drivers/net/wireless/realtek/rtw89/debug.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/net/wireless/realtek/rtw89/debug.c +3 -9
@@ -217,25 +217,19 @@ static ssize_t rtw89_debugfs_file_write(struct file *file,return debugfs_priv->cb_write (rtwdev, debugfs_priv, buf, count); } -static const struct file_operations file_ops_single_r = { - .owner =THIS_MODULE , +static const struct debugfs_short_fops file_ops_single_r = { .read = rtw89_debugfs_file_read, - .open = simple_open, .llseek = generic_file_llseek, }; -static const struct file_operations file_ops_common_rw = { - .owner =THIS_MODULE , +static const struct debugfs_short_fops file_ops_common_rw = { .read = rtw89_debugfs_file_read, .write = rtw89_debugfs_file_write, - .open = simple_open, .llseek = generic_file_llseek, }; -static const struct file_operations file_ops_single_w = { - .owner =THIS_MODULE , +static const struct debugfs_short_fops file_ops_single_w = { .write = rtw89_debugfs_file_write, - .open = simple_open, .llseek = generic_file_llseek, };
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 7/10 wifi: rtw89: remove consumers of driver mutex
In reply to Ping-Ke ShihAll need lock have taken both driver mutex and wiphy lock, so we can remove driver mutex safely by below spatch script. Also, check every lockdep_assert_wiphy() is executed without locks warning at runtime.
@ rule1_1 @
@@
- lockdep_assert_held(&rtwdev->mutex);
+ lockdep_assert_wiphy(rtwdev->hw->wiphy);
@ rule1_2 @
@@
- guard(mutex)(&rtwdev->mutex);
+ lockdep_assert_wiphy(rtwdev->hw->wiphy);
@ rule2_1 @
@@
- mutex_lock(&rtwdev->mutex);
+ lockdep_assert_wiphy(rtwdev->hw->wiphy);
...
- mutex_unlock(&rtwdev->mutex);
@ rule2_2 @
@@
- mutex_unlock(&rtwdev->mutex);
+ lockdep_assert_wiphy(rtwdev->hw->wiphy);
...
- mutex_lock(&rtwdev->mutex);
@ rule3_1 @
type t;
identifier fn;
@@
t fn(struct wiphy *wiphy, ...)
{
...
- lockdep_assert_wiphy(rtwdev->hw->wiphy);
+ lockdep_assert_wiphy(wiphy);
...
}
@ rule3_1_1 @
type t;
identifier fn;
@@
t fn(...)
{
...
struct wiphy *wiphy = ...;
...
- lockdep_assert_wiphy(rtwdev->hw->wiphy);
+ lockdep_assert_wiphy(wiphy);
...
}
@ rule3_2 @
type t;
identifier fn;
@@
t fn(struct ieee80211_hw *hw, ...)
{
...
- lockdep_assert_wiphy(rtwdev->hw->wiphy);
+ lockdep_assert_wiphy(hw->wiphy);
...
}
@ rule3_2_1 @
type t;
identifier fn;
@@
t fn(...)
{
...
struct ieee80211_hw *hw = ...;
...
- lockdep_assert_wiphy(rtwdev->hw->wiphy);
+ lockdep_assert_wiphy(hw->wiphy);
...
}
The compiler warnings will be fixed manually by latter patch:
rtw89/mac80211.c:371:1: warning: statement expected after label
--- drivers/net/wireless/realtek/rtw89/chan.c | 19 ++- drivers/net/wireless/realtek/rtw89/coex.c | 23 ++- drivers/net/wireless/realtek/rtw89/core.c | 28 ++-- drivers/net/wireless/realtek/rtw89/debug.c | 24 +--- drivers/net/wireless/realtek/rtw89/fw.c | 7 +- drivers/net/wireless/realtek/rtw89/mac80211.c | 131 ++++++------------ drivers/net/wireless/realtek/rtw89/phy.c | 7 +- drivers/net/wireless/realtek/rtw89/ps.c | 6 +- drivers/net/wireless/realtek/rtw89/regd.c | 5 +- drivers/net/wireless/realtek/rtw89/sar.c | 9 +- drivers/net/wireless/realtek/rtw89/ser.c | 6 +- drivers/net/wireless/realtek/rtw89/util.h | 2 +- drivers/net/wireless/realtek/rtw89/wow.c | 3 +- 13 files changed, 92 insertions(+), 178 deletions(-)
drivers/net/wireless/realtek/rtw89/chan.c +8 -11
@@ -155,7 +155,7 @@ int rtw89_iterate_entity_chan(struct rtw89_dev *rtwdev,int ret;u8 idx; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);for_each_set_bit (idx, hal->entity_map,NUM_OF_RTW89_CHANCTX ) { chan =rtw89_chan_get (rtwdev, idx);
@@ -310,7 +310,7 @@ const struct rtw89_chan *__rtw89_mgnt_chan_get(struct rtw89_dev *rtwdev,enum rtw89_entity_mode mode;u8 role_index; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);if (unlikely (link_index >= __RTW89_MLD_MAX_LINK_NUM)) { WARN(1, "link index %u is invalid (max link inst num: %d)\n",
@@ -366,7 +366,7 @@ static void rtw89_entity_recalc_mgnt_roles(struct rtw89_dev *rtwdev)u8 pos =0 ;int i, j; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);for (i =0 ; i <RTW89_MAX_INTERFACE_NUM ; i++) mgnt->active_roles[i] =NULL ;
@@ -427,7 +427,7 @@ enum rtw89_entity_mode rtw89_entity_recalc(struct rtw89_dev *rtwdev)struct rtw89_chan chan;u8 idx; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);bitmap_copy (recalc_map, hal->entity_map,NUM_OF_RTW89_CHANCTX );
@@ -2401,10 +2401,9 @@ void rtw89_chanctx_work(struct wiphy *wiphy, struct wiphy_work *work)int ret;int i; -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (wiphy);if (hal->entity_pause) { -mutex_unlock (&rtwdev->mutex);return ; }
@@ -2445,8 +2444,6 @@ void rtw89_chanctx_work(struct wiphy *wiphy, struct wiphy_work *work)default :break ; } - -mutex_unlock (&rtwdev->mutex); } void rtw89_queue_chanctx_change(struct rtw89_dev *rtwdev,
@@ -2491,7 +2488,7 @@ void rtw89_chanctx_track(struct rtw89_dev *rtwdev)struct rtw89_hal *hal = &rtwdev->hal;enum rtw89_entity_mode mode; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);if (hal->entity_pause)return ;
@@ -2512,7 +2509,7 @@ void rtw89_chanctx_pause(struct rtw89_dev *rtwdev,struct rtw89_hal *hal = &rtwdev->hal;enum rtw89_entity_mode mode; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);if (hal->entity_pause)return ;
@@ -2555,7 +2552,7 @@ void rtw89_chanctx_proceed(struct rtw89_dev *rtwdev,enum rtw89_entity_mode mode;int ret; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);if (unlikely (!hal->entity_pause)) {rtw89_chanctx_proceed_cb (rtwdev, cb_parm);
drivers/net/wireless/realtek/rtw89/coex.c +8 -15
@@ -6721,7 +6721,7 @@ void rtw89_coex_act1_work(struct wiphy *wiphy, struct wiphy_work *work)struct rtw89_btc_cx *cx = &btc->cx;struct rtw89_btc_wl_info *wl = &cx->wl; -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (wiphy);rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC], %s(): enter\n" , __func__); dm->cnt_notify[BTC_NCNT_TIMER ]++;if (wl->status.map._4way)
@@ -6730,7 +6730,6 @@ void rtw89_coex_act1_work(struct wiphy *wiphy, struct wiphy_work *work) wl->status.map.connecting = false;_run_coex (rtwdev,BTC_RSN_ACT1_WORK ); -mutex_unlock (&rtwdev->mutex); }void rtw89_coex_bt_devinfo_work (struct wiphy *wiphy,struct wiphy_work *work)
@@ -6741,12 +6740,11 @@ void rtw89_coex_bt_devinfo_work(struct wiphy *wiphy, struct wiphy_work *work)struct rtw89_btc_dm *dm = &rtwdev->btc.dm;struct rtw89_btc_bt_a2dp_desc *a2dp = &btc->cx.bt.link_info.a2dp_desc; -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (wiphy);rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC], %s(): enter\n" , __func__); dm->cnt_notify[BTC_NCNT_TIMER ]++; a2dp->play_latency =0 ;_run_coex (rtwdev,BTC_RSN_BT_DEVINFO_WORK ); -mutex_unlock (&rtwdev->mutex); }void rtw89_coex_rfk_chk_work (struct wiphy *wiphy,struct wiphy_work *work)
@@ -6758,7 +6756,7 @@ void rtw89_coex_rfk_chk_work(struct wiphy *wiphy, struct wiphy_work *work)struct rtw89_btc_cx *cx = &btc->cx;struct rtw89_btc_wl_info *wl = &cx->wl; -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (wiphy);rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC], %s(): enter\n" , __func__); dm->cnt_notify[BTC_NCNT_TIMER ]++;if (wl->rfk_info.state !=BTC_WRFK_STOP ) {
@@ -6770,7 +6768,6 @@ void rtw89_coex_rfk_chk_work(struct wiphy *wiphy, struct wiphy_work *work)_write_scbd (rtwdev,BTC_WSCB_WLRFK , false);_run_coex (rtwdev,BTC_RSN_RFK_CHK_WORK ); } -mutex_unlock (&rtwdev->mutex); }static void _update_bt_scbd (struct rtw89_dev *rtwdev,bool only_update)
@@ -6874,7 +6871,7 @@ void _run_coex(struct rtw89_dev *rtwdev, enum btc_reason_and_action reason)struct rtw89_btc_wl_role_info_v8 *wl_rinfo_v8 = &wl->role_info_v8;u8 mode, igno_bt, always_freerun; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy); dm->run_reason = reason;_update_dm_step (rtwdev, reason);
@@ -7311,10 +7308,9 @@ void rtw89_btc_ntfy_eapol_packet_work(struct wiphy *wiphy, struct wiphy_work *wo struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev, btc.eapol_notify_work); -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (wiphy);rtw89_leave_ps_mode (rtwdev);rtw89_btc_ntfy_specific_packet (rtwdev,PACKET_EAPOL ); -mutex_unlock (&rtwdev->mutex); }void rtw89_btc_ntfy_arp_packet_work (struct wiphy *wiphy,struct wiphy_work *work)
@@ -7322,9 +7318,8 @@ void rtw89_btc_ntfy_arp_packet_work(struct wiphy *wiphy, struct wiphy_work *work struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev, btc.arp_notify_work); -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (wiphy);rtw89_btc_ntfy_specific_packet (rtwdev,PACKET_ARP ); -mutex_unlock (&rtwdev->mutex); }void rtw89_btc_ntfy_dhcp_packet_work (struct wiphy *wiphy,struct wiphy_work *work)
@@ -7332,10 +7327,9 @@ void rtw89_btc_ntfy_dhcp_packet_work(struct wiphy *wiphy, struct wiphy_work *wor struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev, btc.dhcp_notify_work); -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (wiphy);rtw89_leave_ps_mode (rtwdev);rtw89_btc_ntfy_specific_packet (rtwdev,PACKET_DHCP ); -mutex_unlock (&rtwdev->mutex); }void rtw89_btc_ntfy_icmp_packet_work (struct wiphy *wiphy,struct wiphy_work *work)
@@ -7343,10 +7337,9 @@ void rtw89_btc_ntfy_icmp_packet_work(struct wiphy *wiphy, struct wiphy_work *wor struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev, btc.icmp_notify_work); -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (wiphy);rtw89_leave_ps_mode (rtwdev);rtw89_btc_ntfy_specific_packet (rtwdev,PACKET_ICMP ); -mutex_unlock (&rtwdev->mutex); }static u8 _update_bt_rssi_level (struct rtw89_dev *rtwdev,u8 rssi)
drivers/net/wireless/realtek/rtw89/core.c +10 -18
@@ -2079,7 +2079,7 @@ static void rtw89_cancel_6ghz_probe_work(struct wiphy *wiphy, struct wiphy_workstruct list_head *pkt_list = rtwdev->scan_info.pkt_list;struct rtw89_pktofld_info *info; -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (wiphy);if (!rtwdev->scanning) goto out;
@@ -2097,7 +2097,6 @@ static void rtw89_cancel_6ghz_probe_work(struct wiphy *wiphy, struct wiphy_work } out: -mutex_unlock (&rtwdev->mutex); } static void rtw89_core_cancel_6ghz_probe_tx(struct rtw89_dev *rtwdev,
@@ -3148,9 +3147,8 @@ static void rtw89_ips_work(struct wiphy *wiphy, struct wiphy_work *work) { struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev, ips_work); -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (wiphy);rtw89_enter_ips_by_hwflags (rtwdev); -mutex_unlock (&rtwdev->mutex); }static void rtw89_core_txq_work (struct work_struct *w)
@@ -3292,7 +3290,7 @@ void rtw89_roc_start(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)u32 reg;int ret; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (hw->wiphy);rtw89_leave_ips_by_hwflags (rtwdev);rtw89_leave_lps (rtwdev);
@@ -3346,7 +3344,7 @@ void rtw89_roc_end(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)u32 reg;int ret; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (hw->wiphy);ieee80211_remain_on_channel_expired (hw);
@@ -3389,7 +3387,7 @@ void rtw89_roc_work(struct wiphy *wiphy, struct wiphy_work *work)struct rtw89_dev *rtwdev = rtwvif->rtwdev;struct rtw89_roc *roc = &rtwvif->roc; -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (wiphy);switch (roc->state) {case RTW89_ROC_IDLE :
@@ -3402,8 +3400,6 @@ void rtw89_roc_work(struct wiphy *wiphy, struct wiphy_work *work)default :break ; } - -mutex_unlock (&rtwdev->mutex); } static enum rtw89_tfc_lv rtw89_get_traffic_level(struct rtw89_dev *rtwdev,
@@ -3543,7 +3539,7 @@ static void rtw89_track_work(struct wiphy *wiphy, struct wiphy_work *work)if (test_bit (RTW89_FLAG_FORBIDDEN_TRACK_WROK , rtwdev->flags))return ; -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (wiphy);if (!test_bit (RTW89_FLAG_RUNNING , rtwdev->flags)) goto out;
@@ -3580,7 +3576,6 @@ static void rtw89_track_work(struct wiphy *wiphy, struct wiphy_work *work)rtw89_enter_lps_track (rtwdev); out: -mutex_unlock (&rtwdev->mutex); }u8 rtw89_core_acquire_bit_map (unsigned long *addr,unsigned long size)
@@ -3614,7 +3609,7 @@ int rtw89_core_acquire_sta_ba_entry(struct rtw89_dev *rtwdev,u8 idx;int i; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy); idx =rtw89_core_acquire_bit_map (cam_info->ba_cam_map, chip->bacam_num);if (idx == chip->bacam_num) {
@@ -3658,7 +3653,7 @@ int rtw89_core_release_sta_ba_entry(struct rtw89_dev *rtwdev,struct rtw89_ba_cam_entry *entry =NULL , *tmp;u8 idx; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);list_for_each_entry_safe (entry, tmp, &rtwsta_link->ba_cam_list, list) {if (entry->tid != tid)
@@ -4450,9 +4445,8 @@ void rtw89_core_update_beacon_work(struct wiphy *wiphy, struct wiphy_work *work) rtwdev = rtwvif_link->rtwvif->rtwdev; -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (wiphy);rtw89_chip_h2c_update_beacon (rtwdev, rtwvif_link); -mutex_unlock (&rtwdev->mutex); }int rtw89_wait_for_cond (struct rtw89_wait_info *wait,unsigned int cond)
@@ -4595,7 +4589,7 @@ void rtw89_core_stop(struct rtw89_dev *rtwdev)clear_bit (RTW89_FLAG_RUNNING , rtwdev->flags); -mutex_unlock (&rtwdev->mutex); +lockdep_assert_wiphy (wiphy);wiphy_work_cancel (wiphy, &rtwdev->c2h_work);wiphy_work_cancel (wiphy, &rtwdev->cancel_6ghz_probe_work);
@@ -4613,8 +4607,6 @@ void rtw89_core_stop(struct rtw89_dev *rtwdev)cancel_delayed_work_sync (&rtwdev->forbid_ba_work);wiphy_delayed_work_cancel (wiphy, &rtwdev->antdiv_work); -mutex_lock (&rtwdev->mutex); -rtw89_btc_ntfy_poweroff (rtwdev);rtw89_hci_flush_queues (rtwdev,BIT (rtwdev->hw->queues) -1 , true);rtw89_mac_flush_txq (rtwdev,BIT (rtwdev->hw->queues) -1 , true);
drivers/net/wireless/realtek/rtw89/debug.c +7 -17
@@ -954,7 +954,7 @@ ssize_t rtw89_debug_priv_txpwr_table_get(struct rtw89_dev *rtwdev,char *p = buf, *end = buf + bufsz;ssize_t n; -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);rtw89_leave_ps_mode (rtwdev); chan =rtw89_chan_get (rtwdev,RTW89_CHANCTX_0 );
@@ -993,12 +993,9 @@ ssize_t rtw89_debug_priv_txpwr_table_get(struct rtw89_dev *rtwdev, goto err; p += n; -mutex_unlock (&rtwdev->mutex); -return p - buf; err: -mutex_unlock (&rtwdev->mutex);return n; }
@@ -1201,7 +1198,7 @@ rtw89_debug_priv_mac_mem_dump_get(struct rtw89_dev *rtwdev, } } -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);rtw89_leave_ps_mode (rtwdev);if (grant_read)rtw89_write32_set (rtwdev,R_AX_TCR1 ,B_AX_TCR_FORCE_READ_TXDFIFO );
@@ -1211,7 +1208,6 @@ rtw89_debug_priv_mac_mem_dump_get(struct rtw89_dev *rtwdev, debugfs_priv->mac_mem.len);if (grant_read)rtw89_write32_clr (rtwdev,R_AX_TCR1 ,B_AX_TCR_FORCE_READ_TXDFIFO ); -mutex_unlock (&rtwdev->mutex);return p - buf; }
@@ -3518,11 +3514,10 @@ rtw89_debug_priv_early_h2c_get(struct rtw89_dev *rtwdev,char *p = buf, *end = buf + bufsz;int seq =0 ; -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);list_for_each_entry (early_h2c, &rtwdev->early_h2c_list, list) p +=scnprintf (p, end - p,"%d: %*ph\n" , ++seq, early_h2c->h2c_len, early_h2c->h2c); -mutex_unlock (&rtwdev->mutex);return p - buf; }
@@ -3555,9 +3550,8 @@ rtw89_debug_priv_early_h2c_set(struct rtw89_dev *rtwdev, early_h2c->h2c = h2c; early_h2c->h2c_len = h2c_len; -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);list_add_tail (&early_h2c->list, &rtwdev->early_h2c_list); -mutex_unlock (&rtwdev->mutex); out:return count;
@@ -3633,10 +3627,9 @@ rtw89_debug_priv_fw_crash_set(struct rtw89_dev *rtwdev,return -EINVAL ; } -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);set_bit (RTW89_FLAG_CRASH_SIMULATING , rtwdev->flags); ret =sim (rtwdev); -mutex_unlock (&rtwdev->mutex);if (ret)return ret;
@@ -3681,12 +3674,11 @@ static ssize_t rtw89_debug_priv_fw_log_manual_set(struct rtw89_dev *rtwdev,if (kstrtobool (buf, &fw_log_manual)) goto out; -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy); log->enable = fw_log_manual;if (log->enable)rtw89_fw_log_prepare (rtwdev);rtw89_fw_h2c_fw_log (rtwdev, fw_log_manual); -mutex_unlock (&rtwdev->mutex); out:return count; }
@@ -4113,7 +4105,7 @@ static ssize_t rtw89_debug_priv_stations_get(struct rtw89_dev *rtwdev,char *p = buf, *end = buf + bufsz;u8 idx; -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy); p +=scnprintf (p, end - p,"map:\n" ); p += scnprintf(p, end - p, "\tmac_id: %*ph\n",
@@ -4151,8 +4143,6 @@ static ssize_t rtw89_debug_priv_stations_get(struct rtw89_dev *rtwdev,ieee80211_iterate_stations_atomic (rtwdev->hw, rtw89_sta_ids_get_iter, &iter_data); p += iter_data.written_sz; -mutex_unlock (&rtwdev->mutex); -return p - buf; }
drivers/net/wireless/realtek/rtw89/fw.c +3 -4
@@ -5998,7 +5998,7 @@ void rtw89_fw_send_all_early_h2c(struct rtw89_dev *rtwdev) {struct rtw89_early_h2c *early_h2c; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);list_for_each_entry (early_h2c, &rtwdev->early_h2c_list, list) {rtw89_fw_h2c_raw (rtwdev, early_h2c->h2c, early_h2c->h2c_len);
@@ -6105,9 +6105,8 @@ void rtw89_fw_c2h_work(struct wiphy *wiphy, struct wiphy_work *work) skb_queue_walk_safe(&rtwdev->c2h_queue, skb, tmp) {skb_unlink (skb, &rtwdev->c2h_queue); -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);rtw89_fw_c2h_cmd_handle (rtwdev, skb); -mutex_unlock (&rtwdev->mutex);dev_kfree_skb_any (skb); } }
@@ -6188,7 +6187,7 @@ int rtw89_fw_msg_reg(struct rtw89_dev *rtwdev,u32 ret;if (h2c_info && h2c_info->id !=RTW89_FWCMD_H2CREG_FUNC_GET_FEATURE ) -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);if (!h2c_info && !c2h_info)return -EINVAL ;
drivers/net/wireless/realtek/rtw89/mac80211.c +41 -90
539 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/phy.c +2 -5
@@ -4661,7 +4661,7 @@ void rtw89_phy_cfo_track_work(struct wiphy *wiphy, struct wiphy_work *work) cfo_track_work.work);struct rtw89_cfo_tracking_info *cfo = &rtwdev->cfo_tracking; -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (wiphy);if (!cfo->cfo_trig_by_timer_en) goto out;rtw89_leave_ps_mode (rtwdev);
@@ -4669,7 +4669,6 @@ void rtw89_phy_cfo_track_work(struct wiphy *wiphy, struct wiphy_work *work)wiphy_delayed_work_queue (wiphy, &rtwdev->cfo_track_work,msecs_to_jiffies (cfo->cfo_timer_ms)); out: -mutex_unlock (&rtwdev->mutex); }static void rtw89_phy_cfo_start_work (struct rtw89_dev *rtwdev)
@@ -6537,7 +6536,7 @@ void rtw89_phy_antdiv_work(struct wiphy *wiphy, struct wiphy_work *work) antdiv_work.work);struct rtw89_antdiv_info *antdiv = &rtwdev->antdiv; -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (wiphy);if (antdiv->training_count <=ANTDIV_TRAINNING_CNT ) {rtw89_phy_antdiv_training_state (rtwdev);
@@ -6545,8 +6544,6 @@ void rtw89_phy_antdiv_work(struct wiphy *wiphy, struct wiphy_work *work)rtw89_phy_antdiv_decision_state (rtwdev);rtw89_phy_antdiv_set_ant (rtwdev); } - -mutex_unlock (&rtwdev->mutex); }void rtw89_phy_antdiv_track (struct rtw89_dev *rtwdev)
drivers/net/wireless/realtek/rtw89/ps.c +3 -3
@@ -113,7 +113,7 @@ static void __rtw89_leave_lps(struct rtw89_dev *rtwdev,void rtw89_leave_ps_mode (struct rtw89_dev *rtwdev) { -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);__rtw89_leave_ps_mode (rtwdev); }
@@ -125,7 +125,7 @@ void rtw89_enter_lps(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,bool can_ps_mode = true;unsigned int link_id; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);if (test_and_set_bit (RTW89_FLAG_LEISURE_PS , rtwdev->flags))return ;
@@ -162,7 +162,7 @@ void rtw89_leave_lps(struct rtw89_dev *rtwdev)struct rtw89_vif *rtwvif;unsigned int link_id; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);if (!test_and_clear_bit (RTW89_FLAG_LEISURE_PS , rtwdev->flags))return ;
drivers/net/wireless/realtek/rtw89/regd.c +2 -3
@@ -721,7 +721,7 @@ void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *requeststruct rtw89_dev *rtwdev = hw->priv;wiphy_lock (wiphy); -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (wiphy);rtw89_leave_ps_mode (rtwdev);if (wiphy->regd) {
@@ -737,7 +737,6 @@ void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *requestrtw89_core_set_chip_txpwr (rtwdev); exit: -mutex_unlock (&rtwdev->mutex);wiphy_unlock (wiphy); }
@@ -988,7 +987,7 @@ int rtw89_reg_6ghz_recalc(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwviunsigned int changed =0 ;int ret; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);/* The result of reg_6ghz_tpe may depend on reg_6ghz_power type, * so must do reg_6ghz_tpe_recalc() after reg_6ghz_power_recalc().
drivers/net/wireless/realtek/rtw89/sar.c +4 -5
@@ -150,7 +150,7 @@ s8 rtw89_query_sar(struct rtw89_dev *rtwdev, u32 center_freq)s32 cfg;u8 fct; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);if (src ==RTW89_SAR_SOURCE_NONE )return RTW89_SAR_TXPWR_MAC_MAX ;
@@ -190,7 +190,7 @@ int rtw89_print_sar(struct rtw89_dev *rtwdev, char *buf, size_t bufsz,s32 cfg;u8 fct; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);if (src ==RTW89_SAR_SOURCE_NONE ) { p +=scnprintf (p, end - p,"no SAR is applied\n" );
@@ -241,7 +241,7 @@ static int rtw89_apply_sar_common(struct rtw89_dev *rtwdev,enum rtw89_sar_sources src;int ret =0 ; -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy); src = rtwdev->sar.src;if (src !=RTW89_SAR_SOURCE_NONE && src !=RTW89_SAR_SOURCE_COMMON ) {
@@ -254,7 +254,6 @@ static int rtw89_apply_sar_common(struct rtw89_dev *rtwdev,rtw89_core_set_chip_txpwr (rtwdev); exit: -mutex_unlock (&rtwdev->mutex);return ret; }
@@ -328,7 +327,7 @@ static void rtw89_tas_state_update(struct rtw89_dev *rtwdev)const struct rtw89_chan *chan;int ret; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);if (src ==RTW89_SAR_SOURCE_NONE )return ;
drivers/net/wireless/realtek/rtw89/ser.c +2 -4
@@ -157,9 +157,8 @@ static void ser_state_run(struct rtw89_ser *ser, u8 evt) ser_st_name(ser), ser_ev_name(ser, evt));wiphy_lock (rtwdev->hw->wiphy); -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);rtw89_leave_lps (rtwdev); -mutex_unlock (&rtwdev->mutex);wiphy_unlock (rtwdev->hw->wiphy); ser->st_tbl[ser->state].st_func (ser, evt);
@@ -714,9 +713,8 @@ static void ser_l2_reset_st_hdl(struct rtw89_ser *ser, u8 evt)switch (evt) {case SER_EV_STATE_IN :wiphy_lock (rtwdev->hw->wiphy); -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);ser_l2_reset_st_pre_hdl (ser); -mutex_unlock (&rtwdev->mutex);wiphy_unlock (rtwdev->hw->wiphy);ieee80211_restart_hw (rtwdev->hw);
drivers/net/wireless/realtek/rtw89/util.h +1 -1
@@ -25,7 +25,7 @@ static inline bool rtw89_rtwvif_in_list(struct rtw89_dev *rtwdev, {struct rtw89_vif *rtwvif; -lockdep_assert_held (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);rtw89_for_each_rtwvif (rtwdev, rtwvif)if (rtwvif == new)
drivers/net/wireless/realtek/rtw89/wow.c +1 -2
@@ -619,12 +619,11 @@ static struct ieee80211_key_conf *rtw89_wow_gtk_rekey(struct rtw89_dev *rtwdev,/* ieee80211_gtk_rekey_add() will call set_key(), therefore we * need to unlock mutex */ -mutex_unlock (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy);if (ieee80211_vif_is_mld (wow_vif)) key =ieee80211_gtk_rekey_add (wow_vif, rekey_conf, rtwvif_link->link_id);else key =ieee80211_gtk_rekey_add (wow_vif, rekey_conf,-1 ); -mutex_lock (&rtwdev->mutex);kfree (rekey_conf);if (IS_ERR (key)) {
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 8/10 wifi: rtw89: manual cosmetic along lockdep_assert_wiphy()
In reply to Ping-Ke ShihWith spatch script, already remove most driver mutex and generate lockdep_assert_wiphy(), and some are needed to refine manually further to be expected:
- lockdep_assert_wiphy() always be the first statement in function
- return directly rather than unnecessary goto
- change assert from mutex to wiphy lock, which script can't convert automatically.
--- drivers/net/wireless/realtek/rtw89/chan.c | 3 +- drivers/net/wireless/realtek/rtw89/coex.c | 7 + drivers/net/wireless/realtek/rtw89/core.c | 23 ++- drivers/net/wireless/realtek/rtw89/debug.c | 30 ++-- drivers/net/wireless/realtek/rtw89/fw.c | 7 +- drivers/net/wireless/realtek/rtw89/mac80211.c | 157 +++++++----------- drivers/net/wireless/realtek/rtw89/phy.c | 4 +- drivers/net/wireless/realtek/rtw89/regd.c | 1 - drivers/net/wireless/realtek/rtw89/sar.c | 11 +- drivers/net/wireless/realtek/rtw89/ser.c | 2 - drivers/net/wireless/realtek/rtw89/util.h | 2 +- drivers/net/wireless/realtek/rtw89/wow.c | 6 +- 12 files changed, 112 insertions(+), 141 deletions(-)
drivers/net/wireless/realtek/rtw89/chan.c +1 -2
@@ -2403,9 +2403,8 @@ void rtw89_chanctx_work(struct wiphy *wiphy, struct wiphy_work *work)lockdep_assert_wiphy (wiphy); -if (hal->entity_pause) { +if (hal->entity_pause)return ; - }for (i =0 ; i <NUM_OF_RTW89_CHANCTX_CHANGES ; i++) {if (test_and_clear_bit (i, hal->changes))
drivers/net/wireless/realtek/rtw89/coex.c +7 -0
@@ -6722,6 +6722,7 @@ void rtw89_coex_act1_work(struct wiphy *wiphy, struct wiphy_work *work)struct rtw89_btc_wl_info *wl = &cx->wl;lockdep_assert_wiphy (wiphy); +rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC], %s(): enter\n" , __func__); dm->cnt_notify[BTC_NCNT_TIMER ]++;if (wl->status.map._4way)
@@ -6741,6 +6742,7 @@ void rtw89_coex_bt_devinfo_work(struct wiphy *wiphy, struct wiphy_work *work)struct rtw89_btc_bt_a2dp_desc *a2dp = &btc->cx.bt.link_info.a2dp_desc;lockdep_assert_wiphy (wiphy); +rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC], %s(): enter\n" , __func__); dm->cnt_notify[BTC_NCNT_TIMER ]++; a2dp->play_latency =0 ;
@@ -6757,6 +6759,7 @@ void rtw89_coex_rfk_chk_work(struct wiphy *wiphy, struct wiphy_work *work)struct rtw89_btc_wl_info *wl = &cx->wl;lockdep_assert_wiphy (wiphy); +rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC], %s(): enter\n" , __func__); dm->cnt_notify[BTC_NCNT_TIMER ]++;if (wl->rfk_info.state !=BTC_WRFK_STOP ) {
@@ -7309,6 +7312,7 @@ void rtw89_btc_ntfy_eapol_packet_work(struct wiphy *wiphy, struct wiphy_work *wo btc.eapol_notify_work);lockdep_assert_wiphy (wiphy); +rtw89_leave_ps_mode (rtwdev);rtw89_btc_ntfy_specific_packet (rtwdev,PACKET_EAPOL ); }
@@ -7319,6 +7323,7 @@ void rtw89_btc_ntfy_arp_packet_work(struct wiphy *wiphy, struct wiphy_work *work btc.arp_notify_work);lockdep_assert_wiphy (wiphy); +rtw89_btc_ntfy_specific_packet (rtwdev,PACKET_ARP ); }
@@ -7328,6 +7333,7 @@ void rtw89_btc_ntfy_dhcp_packet_work(struct wiphy *wiphy, struct wiphy_work *wor btc.dhcp_notify_work);lockdep_assert_wiphy (wiphy); +rtw89_leave_ps_mode (rtwdev);rtw89_btc_ntfy_specific_packet (rtwdev,PACKET_DHCP ); }
@@ -7338,6 +7344,7 @@ void rtw89_btc_ntfy_icmp_packet_work(struct wiphy *wiphy, struct wiphy_work *wor btc.icmp_notify_work);lockdep_assert_wiphy (wiphy); +rtw89_leave_ps_mode (rtwdev);rtw89_btc_ntfy_specific_packet (rtwdev,PACKET_ICMP ); }
drivers/net/wireless/realtek/rtw89/core.c +11 -12
@@ -2082,7 +2082,7 @@ static void rtw89_cancel_6ghz_probe_work(struct wiphy *wiphy, struct wiphy_worklockdep_assert_wiphy (wiphy);if (!rtwdev->scanning) - goto out; +return ;list_for_each_entry (info, &pkt_list[NL80211_BAND_6GHZ ], list) {if (!info->cancel || !test_bit (info->id, rtwdev->pkt_offload))
@@ -2095,8 +2095,6 @@ static void rtw89_cancel_6ghz_probe_work(struct wiphy *wiphy, struct wiphy_work* since if during scanning, pkt_list is accessed in bottom half. */ } - -out: } static void rtw89_core_cancel_6ghz_probe_tx(struct rtw89_dev *rtwdev,
@@ -3147,7 +3145,9 @@ static void rtw89_ips_work(struct wiphy *wiphy, struct wiphy_work *work) { struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev, ips_work); +lockdep_assert_wiphy (wiphy); +rtw89_enter_ips_by_hwflags (rtwdev); }
@@ -3536,20 +3536,20 @@ static void rtw89_track_work(struct wiphy *wiphy, struct wiphy_work *work) track_work.work);bool tfc_changed; +lockdep_assert_wiphy (wiphy); +if (test_bit (RTW89_FLAG_FORBIDDEN_TRACK_WROK , rtwdev->flags))return ; -lockdep_assert_wiphy (wiphy); -if (!test_bit (RTW89_FLAG_RUNNING , rtwdev->flags)) - goto out; +return ;wiphy_delayed_work_queue (wiphy, &rtwdev->track_work,RTW89_TRACK_WORK_PERIOD ); tfc_changed =rtw89_traffic_stats_track (rtwdev);if (rtwdev->scanning) - goto out; +return ;rtw89_leave_lps (rtwdev);
@@ -3574,8 +3574,6 @@ static void rtw89_track_work(struct wiphy *wiphy, struct wiphy_work *work)if (rtwdev->lps_enabled && !rtwdev->btc.lps)rtw89_enter_lps_track (rtwdev); - -out: }u8 rtw89_core_acquire_bit_map (unsigned long *addr,unsigned long size)
@@ -4440,12 +4438,13 @@ void rtw89_core_update_beacon_work(struct wiphy *wiphy, struct wiphy_work *work) struct rtw89_vif_link *rtwvif_link = container_of(work, struct rtw89_vif_link, update_beacon_work); +lockdep_assert_wiphy (wiphy); +if (rtwvif_link->net_type !=RTW89_NET_TYPE_AP_MODE )return ; rtwdev = rtwvif_link->rtwvif->rtwdev; -lockdep_assert_wiphy (wiphy);rtw89_chip_h2c_update_beacon (rtwdev, rtwvif_link); }
@@ -4581,6 +4580,8 @@ void rtw89_core_stop(struct rtw89_dev *rtwdev)struct wiphy *wiphy = rtwdev->hw->wiphy;struct rtw89_btc *btc = &rtwdev->btc; +lockdep_assert_wiphy (wiphy); +/* Prvent to stop twice; enter_ips and ops_stop */ if (!test_bit (RTW89_FLAG_RUNNING , rtwdev->flags))return ;
@@ -4589,8 +4590,6 @@ void rtw89_core_stop(struct rtw89_dev *rtwdev)clear_bit (RTW89_FLAG_RUNNING , rtwdev->flags); -lockdep_assert_wiphy (wiphy); -wiphy_work_cancel (wiphy, &rtwdev->c2h_work);wiphy_work_cancel (wiphy, &rtwdev->cancel_6ghz_probe_work);wiphy_work_cancel (wiphy, &btc->eapol_notify_work);
drivers/net/wireless/realtek/rtw89/debug.c +15 -15
@@ -955,6 +955,7 @@ ssize_t rtw89_debug_priv_txpwr_table_get(struct rtw89_dev *rtwdev,ssize_t n;lockdep_assert_wiphy (rtwdev->hw->wiphy); +rtw89_leave_ps_mode (rtwdev); chan =rtw89_chan_get (rtwdev,RTW89_CHANCTX_0 );
@@ -970,34 +971,28 @@ ssize_t rtw89_debug_priv_txpwr_table_get(struct rtw89_dev *rtwdev, p +=rtw89_print_ant_gain (rtwdev, p, end - p, chan); tbl = dbgfs_txpwr_tables[chip_gen]; -if (!tbl) { - n = -EOPNOTSUPP ; - goto err; - } +if (!tbl) +return -EOPNOTSUPP ; p +=scnprintf (p, end - p,"\n[TX power byrate]\n" ); n =__print_txpwr_map (rtwdev, p, end - p, tbl->byr);if (n <0 ) - goto err; +return n; p += n; p +=scnprintf (p, end - p,"\n[TX power limit]\n" ); n =__print_txpwr_map (rtwdev, p, end - p, tbl->lmt);if (n <0 ) - goto err; +return n; p += n; p +=scnprintf (p, end - p,"\n[TX power limit_ru]\n" ); n =__print_txpwr_map (rtwdev, p, end - p, tbl->lmt_ru);if (n <0 ) - goto err; +return n; p += n;return p - buf; - -err: - -return n; } static ssize_t
@@ -1182,6 +1177,8 @@ rtw89_debug_priv_mac_mem_dump_get(struct rtw89_dev *rtwdev,char *p = buf, *end = buf + bufsz;bool grant_read = false; +lockdep_assert_wiphy (rtwdev->hw->wiphy); +if (debugfs_priv->mac_mem.sel >=RTW89_MAC_MEM_NUM )return -ENOENT ;
@@ -1198,7 +1195,6 @@ rtw89_debug_priv_mac_mem_dump_get(struct rtw89_dev *rtwdev, } } -lockdep_assert_wiphy (rtwdev->hw->wiphy);rtw89_leave_ps_mode (rtwdev);if (grant_read)rtw89_write32_set (rtwdev,R_AX_TCR1 ,B_AX_TCR_FORCE_READ_TXDFIFO );
@@ -3515,6 +3511,7 @@ rtw89_debug_priv_early_h2c_get(struct rtw89_dev *rtwdev,int seq =0 ;lockdep_assert_wiphy (rtwdev->hw->wiphy); +list_for_each_entry (early_h2c, &rtwdev->early_h2c_list, list) p +=scnprintf (p, end - p,"%d: %*ph\n" , ++seq, early_h2c->h2c_len, early_h2c->h2c);
@@ -3531,6 +3528,8 @@ rtw89_debug_priv_early_h2c_set(struct rtw89_dev *rtwdev,u8 *h2c;u16 h2c_len = count /2 ; +lockdep_assert_wiphy (rtwdev->hw->wiphy); + h2c =rtw89_hex2bin (rtwdev, buf, count);if (IS_ERR (h2c))return -EFAULT ;
@@ -3550,7 +3549,6 @@ rtw89_debug_priv_early_h2c_set(struct rtw89_dev *rtwdev, early_h2c->h2c = h2c; early_h2c->h2c_len = h2c_len; -lockdep_assert_wiphy (rtwdev->hw->wiphy);list_add_tail (&early_h2c->list, &rtwdev->early_h2c_list); out:
@@ -3610,6 +3608,8 @@ rtw89_debug_priv_fw_crash_set(struct rtw89_dev *rtwdev,u8 crash_type;int ret; +lockdep_assert_wiphy (rtwdev->hw->wiphy); + ret =kstrtou8 (buf,0 , &crash_type);if (ret)return -EINVAL ;
@@ -3627,7 +3627,6 @@ rtw89_debug_priv_fw_crash_set(struct rtw89_dev *rtwdev,return -EINVAL ; } -lockdep_assert_wiphy (rtwdev->hw->wiphy);set_bit (RTW89_FLAG_CRASH_SIMULATING , rtwdev->flags); ret =sim (rtwdev);
@@ -3671,10 +3670,11 @@ static ssize_t rtw89_debug_priv_fw_log_manual_set(struct rtw89_dev *rtwdev,struct rtw89_fw_log *log = &rtwdev->fw.log;bool fw_log_manual; +lockdep_assert_wiphy (rtwdev->hw->wiphy); +if (kstrtobool (buf, &fw_log_manual)) goto out; -lockdep_assert_wiphy (rtwdev->hw->wiphy); log->enable = fw_log_manual;if (log->enable)rtw89_fw_log_prepare (rtwdev);
drivers/net/wireless/realtek/rtw89/fw.c +4 -3
@@ -6009,13 +6009,13 @@ void rtw89_fw_free_all_early_h2c(struct rtw89_dev *rtwdev) {struct rtw89_early_h2c *early_h2c, *tmp; -mutex_lock (&rtwdev->mutex); +lockdep_assert_wiphy (rtwdev->hw->wiphy); +list_for_each_entry_safe (early_h2c, tmp, &rtwdev->early_h2c_list, list) {list_del (&early_h2c->list);kfree (early_h2c->h2c);kfree (early_h2c); } -mutex_unlock (&rtwdev->mutex); }static void rtw89_fw_c2h_parse_attr (struct sk_buff *c2h)
@@ -6103,9 +6103,10 @@ void rtw89_fw_c2h_work(struct wiphy *wiphy, struct wiphy_work *work) c2h_work);struct sk_buff *skb, *tmp; +lockdep_assert_wiphy (rtwdev->hw->wiphy); + skb_queue_walk_safe(&rtwdev->c2h_queue, skb, tmp) {skb_unlink (skb, &rtwdev->c2h_queue); -lockdep_assert_wiphy (rtwdev->hw->wiphy);rtw89_fw_c2h_cmd_handle (rtwdev, skb);dev_kfree_skb_any (skb); }
drivers/net/wireless/realtek/rtw89/mac80211.c +64 -93
551 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/phy.c +2 -2
@@ -4662,13 +4662,13 @@ void rtw89_phy_cfo_track_work(struct wiphy *wiphy, struct wiphy_work *work)struct rtw89_cfo_tracking_info *cfo = &rtwdev->cfo_tracking;lockdep_assert_wiphy (wiphy); +if (!cfo->cfo_trig_by_timer_en) - goto out; +return ;rtw89_leave_ps_mode (rtwdev);rtw89_phy_cfo_dm (rtwdev);wiphy_delayed_work_queue (wiphy, &rtwdev->cfo_track_work,msecs_to_jiffies (cfo->cfo_timer_ms)); -out: }static void rtw89_phy_cfo_start_work (struct rtw89_dev *rtwdev)
drivers/net/wireless/realtek/rtw89/regd.c +0 -1
@@ -721,7 +721,6 @@ void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *requeststruct rtw89_dev *rtwdev = hw->priv;wiphy_lock (wiphy); -lockdep_assert_wiphy (wiphy);rtw89_leave_ps_mode (rtwdev);if (wiphy->regd) {
drivers/net/wireless/realtek/rtw89/sar.c +5 -6
@@ -99,7 +99,7 @@ struct rtw89_sar_handler rtw89_sar_handlers[RTW89_SAR_SOURCE_NR] = {typeof (_dev) _d = (_dev); \BUILD_BUG_ON (!rtw89_sar_handlers[_s].descr_sar_source); \BUILD_BUG_ON (!rtw89_sar_handlers[_s].query_sar_config); \ -lockdep_assert_held (&_d->mutex); \ +lockdep_assert_wiphy (_d->hw->wiphy); \ _d->sar._cfg_name = *(_cfg_data); \ _d->sar.src = _s; \ }while (0 )
@@ -239,22 +239,19 @@ static int rtw89_apply_sar_common(struct rtw89_dev *rtwdev, const struct rtw89_sar_cfg_common *sar) {enum rtw89_sar_sources src; -int ret =0 ;lockdep_assert_wiphy (rtwdev->hw->wiphy); src = rtwdev->sar.src;if (src !=RTW89_SAR_SOURCE_NONE && src !=RTW89_SAR_SOURCE_COMMON ) {rtw89_warn (rtwdev,"SAR source: %d is in use" , src); - ret = -EBUSY ; - goto exit; +return -EBUSY ; }rtw89_sar_set_src (rtwdev,RTW89_SAR_SOURCE_COMMON , cfg_common, sar);rtw89_core_set_chip_txpwr (rtwdev); -exit: -return ret; +return 0 ; }static const struct cfg80211_sar_freq_ranges rtw89_common_sar_freq_ranges[] = {
@@ -290,6 +287,8 @@ int rtw89_ops_set_sar_specs(struct ieee80211_hw *hw,s32 power;u32 i, idx; +lockdep_assert_wiphy (rtwdev->hw->wiphy); +if (sar->type !=NL80211_SAR_TYPE_POWER )return -EINVAL ;
drivers/net/wireless/realtek/rtw89/ser.c +0 -2
@@ -157,7 +157,6 @@ static void ser_state_run(struct rtw89_ser *ser, u8 evt) ser_st_name(ser), ser_ev_name(ser, evt));wiphy_lock (rtwdev->hw->wiphy); -lockdep_assert_wiphy (rtwdev->hw->wiphy);rtw89_leave_lps (rtwdev);wiphy_unlock (rtwdev->hw->wiphy);
@@ -713,7 +712,6 @@ static void ser_l2_reset_st_hdl(struct rtw89_ser *ser, u8 evt)switch (evt) {case SER_EV_STATE_IN :wiphy_lock (rtwdev->hw->wiphy); -lockdep_assert_wiphy (rtwdev->hw->wiphy);ser_l2_reset_st_pre_hdl (ser);wiphy_unlock (rtwdev->hw->wiphy);
drivers/net/wireless/realtek/rtw89/util.h +1 -1
@@ -12,7 +12,7 @@ieee80211_iterate_active_interfaces_atomic ((rtwdev)->hw, \IEEE80211_IFACE_ITER_NORMAL , iterator, data) -/* call this function with rtwdev->mutex is held */ +/* call this function with wiphy mutex is held */#define rtw89_for_each_rtwvif (rtwdev, rtwvif) \ list_for_each_entry(rtwvif, &(rtwdev)->rtwvifs_list, list)
drivers/net/wireless/realtek/rtw89/wow.c +2 -4
@@ -604,6 +604,8 @@ static struct ieee80211_key_conf *rtw89_wow_gtk_rekey(struct rtw89_dev *rtwdev,struct ieee80211_key_conf *key;u8 sz; +lockdep_assert_wiphy (rtwdev->hw->wiphy); + cipher_info =rtw89_cipher_alg_recognize (cipher); sz =struct_size (rekey_conf, key, cipher_info->len); rekey_conf =kmalloc (sz,GFP_KERNEL );
@@ -616,10 +618,6 @@ static struct ieee80211_key_conf *rtw89_wow_gtk_rekey(struct rtw89_dev *rtwdev,memcpy (rekey_conf->key, gtk,flex_array_size (rekey_conf, key, cipher_info->len)); -/* ieee80211_gtk_rekey_add() will call set_key(), therefore we -* need to unlock mutex -*/ -lockdep_assert_wiphy (rtwdev->hw->wiphy);if (ieee80211_vif_is_mld (wow_vif)) key =ieee80211_gtk_rekey_add (wow_vif, rekey_conf, rtwvif_link->link_id);else
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 9/10 wifi: rtw89: remove definition of driver mutex
In reply to Ping-Ke ShihNo consumers of driver mutex now, so remove definition eventually.
--- drivers/net/wireless/realtek/rtw89/core.c | 2 -- drivers/net/wireless/realtek/rtw89/core.h | 2 -- 2 files changed, 4 deletions(-)
drivers/net/wireless/realtek/rtw89/core.c +0 -2
@@ -4831,7 +4831,6 @@ int rtw89_core_init(struct rtw89_dev *rtwdev)return -ENOMEM ;spin_lock_init (&rtwdev->ba_lock);spin_lock_init (&rtwdev->rpwm_lock); -mutex_init (&rtwdev->mutex);mutex_init (&rtwdev->rf_mutex); rtwdev->total_sta_assoc =0 ;
@@ -4890,7 +4889,6 @@ void rtw89_core_deinit(struct rtw89_dev *rtwdev)destroy_workqueue (rtwdev->txq_wq);mutex_destroy (&rtwdev->rf_mutex); -mutex_destroy (&rtwdev->mutex); }EXPORT_SYMBOL (rtw89_core_deinit);
drivers/net/wireless/realtek/rtw89/core.h +0 -2
@@ -5631,8 +5631,6 @@ struct rtw89_dev {struct rtw89_sta_link __rcu *assoc_link_on_macid[RTW89_MAX_MAC_ID_NUM ];refcount_t refcount_ap_info; -/* ensures exclusive access from mac80211 callbacks */ -struct mutex mutex;struct list_head rtwvifs_list;/* used to protect rf read write */ struct mutex rf_mutex;
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 10/10 wifi: rtw89: pci: not assert wiphy_lock to free early_h2c for PCI probe/remove
In reply to Ping-Ke ShihExcept probe/remove flow, the consumers of early_h2c list are interface start and debugfs. There must be no race between probe/remove flow and interface start. The failed probe flow is to free early_h2c list as well as remove flow, at these two moments debugfs doesn't present. Thus, it is safe to free early_h2c list without held wiphy_lock in these situations.
--- drivers/net/wireless/realtek/rtw89/core.c | 2 +- drivers/net/wireless/realtek/rtw89/fw.c | 11 ++++++++--- drivers/net/wireless/realtek/rtw89/fw.h | 1 + 3 files changed, 10 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtw89/core.c +1 -1
@@ -4885,7 +4885,7 @@ void rtw89_core_deinit(struct rtw89_dev *rtwdev) {rtw89_ser_deinit (rtwdev);rtw89_unload_firmware (rtwdev); -rtw89_fw_free_all_early_h2c (rtwdev); +__rtw89_fw_free_all_early_h2c (rtwdev);destroy_workqueue (rtwdev->txq_wq);mutex_destroy (&rtwdev->rf_mutex);
drivers/net/wireless/realtek/rtw89/fw.c +8 -3
@@ -6005,12 +6005,10 @@ void rtw89_fw_send_all_early_h2c(struct rtw89_dev *rtwdev) } } -void rtw89_fw_free_all_early_h2c (struct rtw89_dev *rtwdev) +void __rtw89_fw_free_all_early_h2c (struct rtw89_dev *rtwdev) {struct rtw89_early_h2c *early_h2c, *tmp; -lockdep_assert_wiphy (rtwdev->hw->wiphy); -list_for_each_entry_safe (early_h2c, tmp, &rtwdev->early_h2c_list, list) {list_del (&early_h2c->list);kfree (early_h2c->h2c);
@@ -6018,6 +6016,13 @@ void rtw89_fw_free_all_early_h2c(struct rtw89_dev *rtwdev) } } +void rtw89_fw_free_all_early_h2c (struct rtw89_dev *rtwdev) +{ +lockdep_assert_wiphy (rtwdev->hw->wiphy); + +__rtw89_fw_free_all_early_h2c (rtwdev); +} +static void rtw89_fw_c2h_parse_attr (struct sk_buff *c2h) {const struct rtw89_c2h_hdr *hdr = (const struct rtw89_c2h_hdr *)c2h->data;
drivers/net/wireless/realtek/rtw89/fw.h +1 -0
@@ -4654,6 +4654,7 @@ int rtw89_fw_h2c_raw_with_hdr(struct rtw89_dev *rtwdev, bool rack, bool dack);int rtw89_fw_h2c_raw (struct rtw89_dev *rtwdev,const u8 *buf,u16 len);void rtw89_fw_send_all_early_h2c (struct rtw89_dev *rtwdev); +void __rtw89_fw_free_all_early_h2c (struct rtw89_dev *rtwdev);void rtw89_fw_free_all_early_h2c (struct rtw89_dev *rtwdev);int rtw89_fw_h2c_general_pkt (struct rtw89_dev *rtwdev,struct rtw89_vif_link *rtwvif_link,u8 macid);
Signature · 1 line
2.25.1