mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
wifi: rtw89: debug: add mlo_mode dbgfs
Add an dbgfs mlo_mode to get/set MLO mode. And, support to trigger MLSR switching. Setting it will automatically disable MLO Dynamic Mechanism (DM). Then MLO things can follow commands via dbgfs mlo_mode instead of MLO DM. The disabled DM(s) can be checked/cleared via dbgfs disable_dm. The following is an use example. Read it to show current MLD status. $ cat mlo_mode MLD(s) status: (MLO DM: enable) #0: MLO mode 0, valid 0x6, active 0x2 Write it to switch to MLSR on link id 2. $ echo 0 2 > mlo_mode $ cat mlo_mode MLD(s) status: (MLO DM: disable) #0: MLO mode 0, valid 0x6, active 0x4 Besides, to be safer, add RWLOCK attribute to dbgfs disable_dm. Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20250505072440.45113-11-pkshih@realtek.com
This commit is contained in:
parent
18dab90f56
commit
9dd85e739c
@ -3708,9 +3708,13 @@ select:
|
|||||||
|
|
||||||
static void rtw89_core_mlo_track(struct rtw89_dev *rtwdev)
|
static void rtw89_core_mlo_track(struct rtw89_dev *rtwdev)
|
||||||
{
|
{
|
||||||
|
struct rtw89_hal *hal = &rtwdev->hal;
|
||||||
struct ieee80211_vif *vif;
|
struct ieee80211_vif *vif;
|
||||||
struct rtw89_vif *rtwvif;
|
struct rtw89_vif *rtwvif;
|
||||||
|
|
||||||
|
if (hal->disabled_dm_bitmap & BIT(RTW89_DM_MLO))
|
||||||
|
return;
|
||||||
|
|
||||||
rtw89_for_each_rtwvif(rtwdev, rtwvif) {
|
rtw89_for_each_rtwvif(rtwdev, rtwvif) {
|
||||||
vif = rtwvif_to_vif(rtwvif);
|
vif = rtwvif_to_vif(rtwvif);
|
||||||
if (!vif->cfg.assoc || !ieee80211_vif_is_mld(vif))
|
if (!vif->cfg.assoc || !ieee80211_vif_is_mld(vif))
|
||||||
|
@ -4842,6 +4842,7 @@ enum rtw89_dm_type {
|
|||||||
RTW89_DM_DYNAMIC_EDCCA,
|
RTW89_DM_DYNAMIC_EDCCA,
|
||||||
RTW89_DM_THERMAL_PROTECT,
|
RTW89_DM_THERMAL_PROTECT,
|
||||||
RTW89_DM_TAS,
|
RTW89_DM_TAS,
|
||||||
|
RTW89_DM_MLO,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define RTW89_THERMAL_PROT_LV_MAX 5
|
#define RTW89_THERMAL_PROT_LV_MAX 5
|
||||||
|
@ -85,6 +85,7 @@ struct rtw89_debugfs {
|
|||||||
struct rtw89_debugfs_priv phy_info;
|
struct rtw89_debugfs_priv phy_info;
|
||||||
struct rtw89_debugfs_priv stations;
|
struct rtw89_debugfs_priv stations;
|
||||||
struct rtw89_debugfs_priv disable_dm;
|
struct rtw89_debugfs_priv disable_dm;
|
||||||
|
struct rtw89_debugfs_priv mlo_mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct rtw89_debugfs_iter_data {
|
struct rtw89_debugfs_iter_data {
|
||||||
@ -4136,6 +4137,35 @@ static ssize_t rtw89_debug_priv_stations_get(struct rtw89_dev *rtwdev,
|
|||||||
return p - buf;
|
return p - buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rtw89_debug_disable_dm_cfg_bmap(struct rtw89_dev *rtwdev, u32 new)
|
||||||
|
{
|
||||||
|
struct rtw89_hal *hal = &rtwdev->hal;
|
||||||
|
u32 old = hal->disabled_dm_bitmap;
|
||||||
|
|
||||||
|
if (new == old)
|
||||||
|
return;
|
||||||
|
|
||||||
|
hal->disabled_dm_bitmap = new;
|
||||||
|
|
||||||
|
rtw89_debug(rtwdev, RTW89_DBG_STATE, "Disable DM: 0x%x -> 0x%x\n", old, new);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rtw89_debug_disable_dm_set_flag(struct rtw89_dev *rtwdev, u8 flag)
|
||||||
|
{
|
||||||
|
struct rtw89_hal *hal = &rtwdev->hal;
|
||||||
|
u32 cur = hal->disabled_dm_bitmap;
|
||||||
|
|
||||||
|
rtw89_debug_disable_dm_cfg_bmap(rtwdev, cur | BIT(flag));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rtw89_debug_disable_dm_clr_flag(struct rtw89_dev *rtwdev, u8 flag)
|
||||||
|
{
|
||||||
|
struct rtw89_hal *hal = &rtwdev->hal;
|
||||||
|
u32 cur = hal->disabled_dm_bitmap;
|
||||||
|
|
||||||
|
rtw89_debug_disable_dm_cfg_bmap(rtwdev, cur & ~BIT(flag));
|
||||||
|
}
|
||||||
|
|
||||||
#define DM_INFO(type) {RTW89_DM_ ## type, #type}
|
#define DM_INFO(type) {RTW89_DM_ ## type, #type}
|
||||||
|
|
||||||
static const struct rtw89_disabled_dm_info {
|
static const struct rtw89_disabled_dm_info {
|
||||||
@ -4145,6 +4175,7 @@ static const struct rtw89_disabled_dm_info {
|
|||||||
DM_INFO(DYNAMIC_EDCCA),
|
DM_INFO(DYNAMIC_EDCCA),
|
||||||
DM_INFO(THERMAL_PROTECT),
|
DM_INFO(THERMAL_PROTECT),
|
||||||
DM_INFO(TAS),
|
DM_INFO(TAS),
|
||||||
|
DM_INFO(MLO),
|
||||||
};
|
};
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
@ -4178,7 +4209,6 @@ rtw89_debug_priv_disable_dm_set(struct rtw89_dev *rtwdev,
|
|||||||
struct rtw89_debugfs_priv *debugfs_priv,
|
struct rtw89_debugfs_priv *debugfs_priv,
|
||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
struct rtw89_hal *hal = &rtwdev->hal;
|
|
||||||
u32 conf;
|
u32 conf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -4186,7 +4216,83 @@ rtw89_debug_priv_disable_dm_set(struct rtw89_dev *rtwdev,
|
|||||||
if (ret)
|
if (ret)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
hal->disabled_dm_bitmap = conf;
|
rtw89_debug_disable_dm_cfg_bmap(rtwdev, conf);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rtw89_debug_mlo_mode_set_mlsr(struct rtw89_dev *rtwdev,
|
||||||
|
unsigned int link_id)
|
||||||
|
{
|
||||||
|
struct ieee80211_vif *vif;
|
||||||
|
struct rtw89_vif *rtwvif;
|
||||||
|
|
||||||
|
rtw89_for_each_rtwvif(rtwdev, rtwvif) {
|
||||||
|
vif = rtwvif_to_vif(rtwvif);
|
||||||
|
if (!ieee80211_vif_is_mld(vif))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
rtw89_core_mlsr_switch(rtwdev, rtwvif, link_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
rtw89_debug_priv_mlo_mode_get(struct rtw89_dev *rtwdev,
|
||||||
|
struct rtw89_debugfs_priv *debugfs_priv,
|
||||||
|
char *buf, size_t bufsz)
|
||||||
|
{
|
||||||
|
bool mlo_dm_dis = rtwdev->hal.disabled_dm_bitmap & BIT(RTW89_DM_MLO);
|
||||||
|
char *p = buf, *end = buf + bufsz;
|
||||||
|
struct ieee80211_vif *vif;
|
||||||
|
struct rtw89_vif *rtwvif;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
p += scnprintf(p, end - p, "MLD(s) status: (MLO DM: %s)\n",
|
||||||
|
str_disable_enable(mlo_dm_dis));
|
||||||
|
|
||||||
|
rtw89_for_each_rtwvif(rtwdev, rtwvif) {
|
||||||
|
vif = rtwvif_to_vif(rtwvif);
|
||||||
|
if (!ieee80211_vif_is_mld(vif))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
p += scnprintf(p, end - p,
|
||||||
|
"\t#%u: MLO mode %x, valid 0x%x, active 0x%x\n",
|
||||||
|
count++, rtwvif->mlo_mode, vif->valid_links,
|
||||||
|
vif->active_links);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count == 0)
|
||||||
|
p += scnprintf(p, end - p, "\t(None)\n");
|
||||||
|
|
||||||
|
return p - buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
rtw89_debug_priv_mlo_mode_set(struct rtw89_dev *rtwdev,
|
||||||
|
struct rtw89_debugfs_priv *debugfs_priv,
|
||||||
|
const char *buf, size_t count)
|
||||||
|
{
|
||||||
|
u8 num, mlo_mode;
|
||||||
|
u32 argv;
|
||||||
|
|
||||||
|
num = sscanf(buf, "%hhx %u", &mlo_mode, &argv);
|
||||||
|
if (num != 2)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
rtw89_debug_disable_dm_set_flag(rtwdev, RTW89_DM_MLO);
|
||||||
|
|
||||||
|
rtw89_debug(rtwdev, RTW89_DBG_STATE, "Set MLO mode to %x\n", mlo_mode);
|
||||||
|
|
||||||
|
switch (mlo_mode) {
|
||||||
|
case RTW89_MLO_MODE_MLSR:
|
||||||
|
rtw89_debug_mlo_mode_set_mlsr(rtwdev, argv);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rtw89_debug(rtwdev, RTW89_DBG_STATE, "Unsupported MLO mode\n");
|
||||||
|
rtw89_debug_disable_dm_clr_flag(rtwdev, RTW89_DM_MLO);
|
||||||
|
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@ -4247,7 +4353,8 @@ static const struct rtw89_debugfs rtw89_debugfs_templ = {
|
|||||||
.fw_log_manual = rtw89_debug_priv_set(fw_log_manual, WLOCK),
|
.fw_log_manual = rtw89_debug_priv_set(fw_log_manual, WLOCK),
|
||||||
.phy_info = rtw89_debug_priv_get(phy_info),
|
.phy_info = rtw89_debug_priv_get(phy_info),
|
||||||
.stations = rtw89_debug_priv_get(stations, RLOCK),
|
.stations = rtw89_debug_priv_get(stations, RLOCK),
|
||||||
.disable_dm = rtw89_debug_priv_set_and_get(disable_dm),
|
.disable_dm = rtw89_debug_priv_set_and_get(disable_dm, RWLOCK),
|
||||||
|
.mlo_mode = rtw89_debug_priv_set_and_get(mlo_mode, RWLOCK),
|
||||||
};
|
};
|
||||||
|
|
||||||
#define rtw89_debugfs_add(name, mode, fopname, parent) \
|
#define rtw89_debugfs_add(name, mode, fopname, parent) \
|
||||||
@ -4292,6 +4399,7 @@ void rtw89_debugfs_add_sec1(struct rtw89_dev *rtwdev, struct dentry *debugfs_top
|
|||||||
rtw89_debugfs_add_r(phy_info);
|
rtw89_debugfs_add_r(phy_info);
|
||||||
rtw89_debugfs_add_r(stations);
|
rtw89_debugfs_add_r(stations);
|
||||||
rtw89_debugfs_add_rw(disable_dm);
|
rtw89_debugfs_add_rw(disable_dm);
|
||||||
|
rtw89_debugfs_add_rw(mlo_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtw89_debugfs_init(struct rtw89_dev *rtwdev)
|
void rtw89_debugfs_init(struct rtw89_dev *rtwdev)
|
||||||
|
Loading…
Reference in New Issue
Block a user