[PATCH] mt76: mt7915: dump SER stats through debugfs
Ryder Lee
ryder.lee at kernel.org
Wed Apr 20 08:59:12 PDT 2022
On Wed, Apr 20, 2022 at 2:05 AM Bo Jiao <bo.jiao at mediatek.com> wrote:
>
> From: Ryder Lee <ryder.lee at mediatek.com>
>
> Grab status of system recovery from firmware.
>
> Signed-off-by: Bo Jiao <Bo.Jiao at mediatek.com>
> Signed-off-by: Ryder Lee <ryder.lee at mediatek.com>
> ---
> .../wireless/mediatek/mt76/mt7915/debugfs.c | 48 +++++++++++++++++--
> .../net/wireless/mediatek/mt76/mt7915/mcu.c | 5 +-
> .../net/wireless/mediatek/mt76/mt7915/mmio.c | 3 ++
> .../net/wireless/mediatek/mt76/mt7915/regs.h | 18 ++++++-
> 4 files changed, 64 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
> index dece0a6..76a6570 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
> @@ -45,7 +45,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(fops_implicit_txbf, mt7915_implicit_txbf_get,
> mt7915_implicit_txbf_set, "%lld\n");
>
> /* test knob of system layer 1/2 error recovery */
> -static int mt7915_ser_trigger_set(void *data, u64 val)
> +static int mt7915_fw_ser_set(void *data, u64 val)
> {
> enum {
> SER_SET_RECOVER_L1 = 1,
> @@ -71,8 +71,47 @@ static int mt7915_ser_trigger_set(void *data, u64 val)
> return ret;
> }
>
> -DEFINE_DEBUGFS_ATTRIBUTE(fops_ser_trigger, NULL,
> - mt7915_ser_trigger_set, "%lld\n");
> +DEFINE_DEBUGFS_ATTRIBUTE(fops_fw_ser, NULL,
> + mt7915_fw_ser_set, "%lld\n");
> +
> +static int
> +mt7915_fw_ser_stats_show(struct seq_file *s, void *data)
> +{
> + struct mt7915_dev *dev = s->private;
> + int ret;
> +
> + /* grab firmware SER stats */
> + ret = mt7915_mcu_set_ser(dev, 0, 0, 0);
> + if (ret)
> + return ret;
> +
> + msleep(100);
> +
> + seq_printf(s, "::E R , SER_STATUS = 0x%08x\n",
> + MT_SWDEF_SER_STATS);
> + seq_printf(s, "::E R , SER_PLE_ERR = 0x%08x\n",
> + MT_SWDEF_PLE_STATS);
> + seq_printf(s, "::E R , SER_PLE_ERR_1 = 0x%08x\n",
> + MT_SWDEF_PLE1_STATS);
> + seq_printf(s, "::E R , SER_PLE_ERR_AMSDU = 0x%08x\n",
> + MT_SWDEF_PLE_AMSDU_STATS);
> + seq_printf(s, "::E R , SER_PSE_ERR = 0x%08x\n",
> + MT_SWDEF_PSE_STATS);
> + seq_printf(s, "::E R , SER_PSE_ERR_1 = 0x%08x\n",
> + MT_SWDEF_PSE1_STATS);
> + seq_printf(s, "::E R , SER_LMAC_WISR6_B0 = 0x%08x\n",
> + MT_SWDEF_LAMC_WISR6_BN0_STATS);
> + seq_printf(s, "::E R , SER_LMAC_WISR6_B1 = 0x%08x\n",
> + MT_SWDEF_LAMC_WISR6_BN1_STATS);
> + seq_printf(s, "::E R , SER_LMAC_WISR7_B0 = 0x%08x\n",
> + MT_SWDEF_LAMC_WISR7_BN0_STATS);
> + seq_printf(s, "::E R , SER_LMAC_WISR7_B1 = 0x%08x\n",
> + MT_SWDEF_LAMC_WISR7_BN1_STATS);
> +
> + return 0;
> +}
> +
> +DEFINE_SHOW_ATTRIBUTE(mt7915_fw_ser_stats);
I'm thinking we can merge this knob fw_ser_stats into fw_ser to make
it more convenient for use.
> static int
> mt7915_radar_trigger(void *data, u64 val)
> @@ -884,6 +923,8 @@ int mt7915_init_debugfs(struct mt7915_phy *phy)
> debugfs_create_file("xmit-queues", 0400, dir, phy,
> &mt7915_xmit_queues_fops);
> debugfs_create_file("tx_stats", 0400, dir, phy, &mt7915_tx_stats_fops);
> + debugfs_create_file("fw_ser", 0200, dir, dev, &fops_fw_ser);
> + debugfs_create_file("fw_ser_stats", 0400, dir, dev, &mt7915_fw_ser_stats_fops);
> debugfs_create_file("fw_debug_wm", 0600, dir, dev, &fops_fw_debug_wm);
> debugfs_create_file("fw_debug_wa", 0600, dir, dev, &fops_fw_debug_wa);
> debugfs_create_file("fw_debug_bin", 0600, dir, dev, &fops_fw_debug_bin);
> @@ -897,7 +938,6 @@ int mt7915_init_debugfs(struct mt7915_phy *phy)
> &mt7915_rate_txpower_fops);
> debugfs_create_devm_seqfile(dev->mt76.dev, "twt_stats", dir,
> mt7915_twt_stats);
> - debugfs_create_file("ser_trigger", 0200, dir, dev, &fops_ser_trigger);
> if (!dev->dbdc_support || phy->band_idx) {
> debugfs_create_u32("dfs_hw_pattern", 0400, dir,
> &dev->hw_pattern);
More information about the Linux-mediatek
mailing list