mirror of
https://github.com/torvalds/linux.git
synced 2026-07-29 02:31:27 +02:00
wifi: rtw89: add debugfs entry of monitor mode options to capture HE-MU packets
To capture HE-MU packets, set BSS color and AID for specific connected station. The writing format: <bss color> <aid> For example, $ echo 0x4 0x16 > monitor_opts Read this entry to get current setting: bss_color=0x4 aid=0x16 By the way, add another sec2() function to create debugfs entries to prevent running smatch timeout. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20260506131000.1706298-11-pkshih@realtek.com
This commit is contained in:
parent
41d78f3f35
commit
cd92d278c1
|
|
@ -93,6 +93,7 @@ struct rtw89_debugfs {
|
|||
struct rtw89_debugfs_priv beacon_info;
|
||||
struct rtw89_debugfs_priv diag_mac;
|
||||
struct rtw89_debugfs_priv diag_bb;
|
||||
struct rtw89_debugfs_priv monitor_opts;
|
||||
};
|
||||
|
||||
struct rtw89_debugfs_iter_data {
|
||||
|
|
@ -5326,6 +5327,54 @@ rtw89_debug_priv_diag_bb_get(struct rtw89_dev *rtwdev,
|
|||
return p - buf;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
rtw89_debug_priv_monitor_opts_get(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_debugfs_priv *debugfs_priv,
|
||||
char *buf, size_t bufsz)
|
||||
{
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
char *p = buf, *end = buf + bufsz;
|
||||
u32 bss_color;
|
||||
u32 aid;
|
||||
|
||||
lockdep_assert_wiphy(rtwdev->hw->wiphy);
|
||||
|
||||
rtw89_leave_ps_mode(rtwdev);
|
||||
|
||||
bss_color = rtw89_phy_read32_idx(rtwdev, chip->bss_clr_map_reg,
|
||||
B_BSS_CLR_MAP_TGT, RTW89_PHY_0);
|
||||
aid = rtw89_phy_read32_idx(rtwdev, chip->bss_clr_map_reg,
|
||||
B_BSS_CLR_MAP_STAID, RTW89_PHY_0);
|
||||
|
||||
p += scnprintf(p, end - p, "bss_color=0x%x aid=0x%x\n", bss_color, aid);
|
||||
|
||||
return p - buf;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
rtw89_debug_priv_monitor_opts_set(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_debugfs_priv *debugfs_priv,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
u32 bss_color;
|
||||
u32 aid;
|
||||
int num;
|
||||
|
||||
lockdep_assert_wiphy(rtwdev->hw->wiphy);
|
||||
|
||||
num = sscanf(buf, "%x %x", &bss_color, &aid);
|
||||
if (num != 2) {
|
||||
rtw89_info(rtwdev, "valid format: <bss color> <aid>\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rtw89_leave_ps_mode(rtwdev);
|
||||
|
||||
__rtw89_phy_set_bss_color(rtwdev, bss_color, aid, RTW89_PHY_0);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
#define rtw89_debug_priv_get(name, opts...) \
|
||||
{ \
|
||||
.cb_read = rtw89_debug_priv_ ##name## _get, \
|
||||
|
|
@ -5390,6 +5439,7 @@ static const struct rtw89_debugfs rtw89_debugfs_templ = {
|
|||
.beacon_info = rtw89_debug_priv_get(beacon_info),
|
||||
.diag_mac = rtw89_debug_priv_get(diag_mac, RSIZE_16K, RLOCK),
|
||||
.diag_bb = rtw89_debug_priv_get(diag_bb, RSIZE_8K, RLOCK),
|
||||
.monitor_opts = rtw89_debug_priv_set_and_get(monitor_opts, RWLOCK),
|
||||
};
|
||||
|
||||
#define rtw89_debugfs_add(name, mode, fopname, parent) \
|
||||
|
|
@ -5435,12 +5485,18 @@ void rtw89_debugfs_add_sec1(struct rtw89_dev *rtwdev, struct dentry *debugfs_top
|
|||
rtw89_debugfs_add_r(phy_info);
|
||||
rtw89_debugfs_add_rw(bb_info);
|
||||
rtw89_debugfs_add_r(stations);
|
||||
}
|
||||
|
||||
static
|
||||
void rtw89_debugfs_add_sec2(struct rtw89_dev *rtwdev, struct dentry *debugfs_topdir)
|
||||
{
|
||||
rtw89_debugfs_add_rw(disable_dm);
|
||||
rtw89_debugfs_add_rw(static_pd_th);
|
||||
rtw89_debugfs_add_rw(mlo_mode);
|
||||
rtw89_debugfs_add_r(beacon_info);
|
||||
rtw89_debugfs_add_r(diag_mac);
|
||||
rtw89_debugfs_add_r(diag_bb);
|
||||
rtw89_debugfs_add_rw(monitor_opts);
|
||||
}
|
||||
|
||||
void rtw89_debugfs_init(struct rtw89_dev *rtwdev)
|
||||
|
|
@ -5457,6 +5513,7 @@ void rtw89_debugfs_init(struct rtw89_dev *rtwdev)
|
|||
|
||||
rtw89_debugfs_add_sec0(rtwdev, debugfs_topdir);
|
||||
rtw89_debugfs_add_sec1(rtwdev, debugfs_topdir);
|
||||
rtw89_debugfs_add_sec2(rtwdev, debugfs_topdir);
|
||||
}
|
||||
|
||||
void rtw89_debugfs_deinit(struct rtw89_dev *rtwdev)
|
||||
|
|
|
|||
|
|
@ -8231,12 +8231,24 @@ void rtw89_phy_dm_init_data(struct rtw89_dev *rtwdev)
|
|||
__rtw89_phy_dm_init_data(rtwdev, bb);
|
||||
}
|
||||
|
||||
void __rtw89_phy_set_bss_color(struct rtw89_dev *rtwdev, u8 bss_color, u16 aid,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
const struct rtw89_reg_def *bss_clr_vld = &chip->bss_clr_vld;
|
||||
|
||||
rtw89_phy_write32_idx(rtwdev, bss_clr_vld->addr, bss_clr_vld->mask, 0x1,
|
||||
phy_idx);
|
||||
rtw89_phy_write32_idx(rtwdev, chip->bss_clr_map_reg, B_BSS_CLR_MAP_TGT,
|
||||
bss_color, phy_idx);
|
||||
rtw89_phy_write32_idx(rtwdev, chip->bss_clr_map_reg, B_BSS_CLR_MAP_STAID,
|
||||
aid, phy_idx);
|
||||
}
|
||||
|
||||
void rtw89_phy_set_bss_color(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_vif_link *rtwvif_link)
|
||||
{
|
||||
struct ieee80211_vif *vif = rtwvif_link_to_vif(rtwvif_link);
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
const struct rtw89_reg_def *bss_clr_vld = &chip->bss_clr_vld;
|
||||
enum rtw89_phy_idx phy_idx = rtwvif_link->phy_idx;
|
||||
struct ieee80211_bss_conf *bss_conf;
|
||||
u8 bss_color;
|
||||
|
|
@ -8253,12 +8265,7 @@ void rtw89_phy_set_bss_color(struct rtw89_dev *rtwdev,
|
|||
|
||||
rcu_read_unlock();
|
||||
|
||||
rtw89_phy_write32_idx(rtwdev, bss_clr_vld->addr, bss_clr_vld->mask, 0x1,
|
||||
phy_idx);
|
||||
rtw89_phy_write32_idx(rtwdev, chip->bss_clr_map_reg, B_BSS_CLR_MAP_TGT,
|
||||
bss_color, phy_idx);
|
||||
rtw89_phy_write32_idx(rtwdev, chip->bss_clr_map_reg, B_BSS_CLR_MAP_STAID,
|
||||
vif->cfg.aid, phy_idx);
|
||||
__rtw89_phy_set_bss_color(rtwdev, bss_color, vif->cfg.aid, phy_idx);
|
||||
}
|
||||
|
||||
static bool rfk_chan_validate_desc(const struct rtw89_rfk_chan_desc *desc)
|
||||
|
|
|
|||
|
|
@ -1128,6 +1128,8 @@ void rtw89_phy_antdiv_track(struct rtw89_dev *rtwdev);
|
|||
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_set_bss_color(struct rtw89_dev *rtwdev, u8 bss_color, u16 aid,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
void rtw89_phy_tssi_ctrl_set_bandedge_cfg(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_mac_idx mac_idx,
|
||||
enum rtw89_tssi_bandedge_cfg bandedge_cfg);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user