introduce a dedicated mt7915 debugfs sub-dir for ext-phy
Subsystems (2)
Lorenzo Bianconi
maintainerv3 cover introduce a dedicated mt7915 debugfs sub-dir for ext-phy
Introduce a dedicated mt76 debugfs sub-dir for ext-phy in dbdc mode for mt7915 driver. This is a preliminary series to add zero-wait dfs support.
Changes since v2:
- rebase on top of mt76 master
- add patch 3/3
Changes since v1:
- rebase on top of mt76 master
Lorenzo Bianconi (3):
mt76: rely on phy pointer in mt76_register_debugfs_fops routine
signature
mt76: mt7915: introduce mt76 debugfs sub-dir for ext-phy
mt76: mt7915: improve code readability for xmit-queue handler
drivers/net/wireless/mediatek/mt76/debugfs.c | 5 +- drivers/net/wireless/mediatek/mt76/mt76.h | 4 +- .../wireless/mediatek/mt76/mt7615/debugfs.c | 2 +- .../wireless/mediatek/mt76/mt7915/debugfs.c | 159 +++++++++--------- .../net/wireless/mediatek/mt76/mt7915/init.c | 6 +- .../wireless/mediatek/mt76/mt7915/mt7915.h | 2 +- .../wireless/mediatek/mt76/mt7921/debugfs.c | 2 +- 7 files changed, 94 insertions(+), 86 deletions(-)
Signature · 1 line
2.31.1
Lorenzo Bianconi
maintainerPATCH v3 1/3 mt76: rely on phy pointer in mt76_register_debugfs_fops routine signature
This is a preliminary patch to create a mt76 debugfs subir for ext-phy.
--- drivers/net/wireless/mediatek/mt76/debugfs.c | 5 +++-- drivers/net/wireless/mediatek/mt76/mt76.h | 4 ++-- drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/debugfs.c +3 -2
@@ -118,13 +118,14 @@ static int mt76_read_rate_txpower(struct seq_file *s, void *data) }struct dentry * -mt76_register_debugfs_fops (struct mt76_dev *dev, +mt76_register_debugfs_fops (struct mt76_phy *phy,const struct file_operations *ops) {const struct file_operations *fops = ops ? ops : &fops_regval; +struct mt76_dev *dev = phy->dev;struct dentry *dir; - dir =debugfs_create_dir ("mt76" , dev->hw->wiphy->debugfsdir); + dir =debugfs_create_dir ("mt76" , phy->hw->wiphy->debugfsdir);if (!dir)return NULL ;
drivers/net/wireless/mediatek/mt76/mt76.h +2 -2
@@ -888,11 +888,11 @@ struct mt76_phy *mt76_alloc_phy(struct mt76_dev *dev, unsigned int size,int mt76_register_phy (struct mt76_phy *phy,bool vht,struct ieee80211_rate *rates,int n_rates); -struct dentry *mt76_register_debugfs_fops (struct mt76_dev *dev, +struct dentry *mt76_register_debugfs_fops (struct mt76_phy *phy,const struct file_operations *ops);static inline struct dentry *mt76_register_debugfs (struct mt76_dev *dev) { -return mt76_register_debugfs_fops (dev,NULL ); +return mt76_register_debugfs_fops (&dev->phy,NULL ); }int mt76_queues_read (struct seq_file *s,void *data);
drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c +1 -1
@@ -533,7 +533,7 @@ int mt7615_init_debugfs(struct mt7615_dev *dev) {struct dentry *dir; - dir =mt76_register_debugfs_fops (&dev->mt76, &fops_regval); + dir =mt76_register_debugfs_fops (&dev->mphy, &fops_regval);if (!dir)return -ENOMEM ;
drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c +1 -1
@@ -417,7 +417,7 @@ int mt7921_init_debugfs(struct mt7921_dev *dev) {struct dentry *dir; - dir =mt76_register_debugfs_fops (&dev->mt76, &fops_regval); + dir =mt76_register_debugfs_fops (&dev->mphy, &fops_regval);if (!dir)return -ENOMEM ;
Signature · 1 line
2.31.1
Lorenzo Bianconi
maintainerPATCH v3 2/3 mt76: mt7915: introduce mt76 debugfs sub-dir for ext-phy
In reply to Lorenzo BianconiIntroduce a dedicated mt76 debugfs sub-dir for ext-phy in dbdc mode.
--- .../wireless/mediatek/mt76/mt7915/debugfs.c | 157 +++++++++--------- .../net/wireless/mediatek/mt76/mt7915/init.c | 6 +- .../wireless/mediatek/mt76/mt7915/mt7915.h | 2 +- 3 files changed, 86 insertions(+), 79 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +80 -77
@@ -120,7 +120,7 @@ static void mt7915_ampdu_stat_read_phy(struct mt7915_phy *phy, struct seq_file *file) { - struct mt7915_dev *dev = file->private; + struct mt7915_dev *dev = phy->dev;bool ext_phy = phy != &dev->phy;int bound[15 ], range[4 ], i, n;
@@ -205,14 +205,12 @@ mt7915_txbf_stat_read_phy(struct mt7915_phy *phy, struct seq_file *s)static int mt7915_tx_stats_show (struct seq_file *file,void *data) { -struct mt7915_dev *dev = file->private; +struct mt7915_phy *phy = file->private; +struct mt7915_dev *dev = phy->dev;int stat[8 ], i, n; -mt7915_ampdu_stat_read_phy (&dev->phy, file); -mt7915_txbf_stat_read_phy (&dev->phy, file); - -mt7915_ampdu_stat_read_phy (mt7915_ext_phy (dev), file); -mt7915_txbf_stat_read_phy (mt7915_ext_phy (dev), file); +mt7915_ampdu_stat_read_phy (phy, file); +mt7915_txbf_stat_read_phy (phy, file);/* Tx amsdu info */ seq_puts (file,"Tx MSDU statistics:\n" );
@@ -239,7 +237,8 @@ static void mt7915_hw_queue_read(struct seq_file *s, u32 base, u32 size, const struct hw_queue_map *map) { - struct mt7915_dev *dev = dev_get_drvdata(s->private); + struct mt7915_phy *phy = s->private; +struct mt7915_dev *dev = phy->dev;u32 i, val; val =mt76_rr (dev, base +MT_FL_Q_EMPTY );
@@ -294,40 +293,40 @@ mt7915_sta_hw_queue_read(void *data, struct ieee80211_sta *sta) }static int -mt7915_hw_queues_read (struct seq_file *s,void *data) +mt7915_hw_queues_show (struct seq_file *file,void *data) { -struct mt7915_dev *dev =dev_get_drvdata (s->private); -struct mt7915_phy *phy =mt7915_ext_phy (dev); +struct mt7915_phy *phy = file->private; +struct mt7915_dev *dev = phy->dev;static const struct hw_queue_map ple_queue_map[] = { - {"CPU_Q0" ,0 ,1 ,MT_CTX0 }, - {"CPU_Q1" ,1 ,1 ,MT_CTX0 +1 }, - {"CPU_Q2" ,2 ,1 ,MT_CTX0 +2 }, - {"CPU_Q3" ,3 ,1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q3" ,11 ,0 ,MT_HIF0 +3 }, - {"HIF_Q4" ,12 ,0 ,MT_HIF0 +4 }, - {"HIF_Q5" ,13 ,0 ,MT_HIF0 +5 }, - {"LMAC_Q" ,16 ,2 ,0 }, - {"MDP_TXQ" ,17 ,2 ,1 }, - {"MDP_RXQ" ,18 ,2 ,2 }, - {"SEC_TXQ" ,19 ,2 ,3 }, - {"SEC_RXQ" ,20 ,2 ,4 }, + {"CPU Q0" ,0 ,1 ,MT_CTX0 }, + {"CPU Q1" ,1 ,1 ,MT_CTX0 +1 }, + {"CPU Q2" ,2 ,1 ,MT_CTX0 +2 }, + {"CPU Q3" ,3 ,1 ,MT_CTX0 +3 }, + {"HIF_Q0" ,8 ,0 ,MT_HIF0 }, + {"HIF_Q1" ,9 ,0 ,MT_HIF0 +1 }, + {"HIF_Q2" ,10 ,0 ,MT_HIF0 +2 }, + {"HIF_Q3" ,11 ,0 ,MT_HIF0 +3 }, + {"HIF_Q4" ,12 ,0 ,MT_HIF0 +4 }, + {"HIF_Q5" ,13 ,0 ,MT_HIF0 +5 }, + {"LMAC_Q" ,16 ,2 ,0 }, + {"MDP_TXQ" ,17 ,2 ,1 }, + {"MDP_RXQ" ,18 ,2 ,2 }, + {"SEC_TXQ" ,19 ,2 ,3 }, + {"SEC_RXQ" ,20 ,2 ,4 }, };u32 val, head, tail;
@@ -335,49 +334,46 @@ mt7915_hw_queues_read(struct seq_file *s, void *data) val =mt76_rr (dev,MT_PLE_FREEPG_CNT ); head =mt76_get_field (dev,MT_PLE_FREEPG_HEAD_TAIL ,GENMASK (11 ,0 )); tail =mt76_get_field (dev,MT_PLE_FREEPG_HEAD_TAIL ,GENMASK (27 ,16 )); -seq_puts (s,"PLE page info:\n" ); -seq_printf (s,"\tTotal free page: 0x%08x head: 0x%03x tail: 0x%03x\n" , +seq_puts (file,"PLE page info:\n" ); +seq_printf (file, +"\tTotal free page: 0x%08x head: 0x%03x tail: 0x%03x\n" , val, head, tail); val =mt76_rr (dev,MT_PLE_PG_HIF_GROUP ); head =mt76_get_field (dev,MT_PLE_HIF_PG_INFO ,GENMASK (11 ,0 )); tail =mt76_get_field (dev,MT_PLE_HIF_PG_INFO ,GENMASK (27 ,16 )); -seq_printf (s,"\tHIF free page: 0x%03x res: 0x%03x used: 0x%03x\n" , +seq_printf (file,"\tHIF free page: 0x%03x res: 0x%03x used: 0x%03x\n" , val, head, tail); -seq_puts (s,"PLE non-empty queue info:\n" ); -mt7915_hw_queue_read (s,MT_PLE_BASE ,ARRAY_SIZE (ple_queue_map), +seq_puts (file,"PLE non-empty queue info:\n" ); +mt7915_hw_queue_read (file,MT_PLE_BASE ,ARRAY_SIZE (ple_queue_map), &ple_queue_map[0 ]);/* iterate per-sta ple queue */ -ieee80211_iterate_stations_atomic (dev->mphy.hw, - mt7915_sta_hw_queue_read, s); -if (phy) -ieee80211_iterate_stations_atomic (phy->mt76->hw, - mt7915_sta_hw_queue_read, s); - +ieee80211_iterate_stations_atomic (phy->mt76->hw, + mt7915_sta_hw_queue_read, file);/* pse queue */ -seq_puts (s,"PSE non-empty queue info:\n" ); -mt7915_hw_queue_read (s,MT_PSE_BASE ,ARRAY_SIZE (pse_queue_map), +seq_puts (file,"PSE non-empty queue info:\n" ); +mt7915_hw_queue_read (file,MT_PSE_BASE ,ARRAY_SIZE (pse_queue_map), &pse_queue_map[0 ]);return 0 ; } +DEFINE_SHOW_ATTRIBUTE (mt7915_hw_queues); +static int -mt7915_queues_read (struct seq_file *s,void *data) +mt7915_xmit_queues_show (struct seq_file *file,void *data) { -struct mt7915_dev *dev =dev_get_drvdata (s->private); -struct mt76_phy *mphy_ext = dev->mt76.phy2; -struct mt76_queue *ext_q = mphy_ext ? mphy_ext->q_tx[MT_TXQ_BE ] :NULL ; +struct mt7915_phy *phy = file->private; +struct mt7915_dev *dev = phy->dev;struct {struct mt76_queue *q;char *queue; } queue_map[] = { - { dev->mphy.q_tx[MT_TXQ_BE ],"MAIN" }, - { ext_q,"EXT" }, - { dev->mt76.q_mcu[MT_MCUQ_WM ],"MCUWM" }, - { dev->mt76.q_mcu[MT_MCUQ_WA ],"MCUWA" }, + { phy->mt76->q_tx[MT_TXQ_BE ]," MAIN" }, + { dev->mt76.q_mcu[MT_MCUQ_WM ]," MCUWM" }, + { dev->mt76.q_mcu[MT_MCUQ_WA ]," MCUWA" }, { dev->mt76.q_mcu[MT_MCUQ_FWDL ],"MCUFWDL" }, };int i;
@@ -388,7 +384,7 @@ mt7915_queues_read(struct seq_file *s, void *data)if (!q)continue ; -seq_printf (s, +seq_printf (file,"%s: queued=%d head=%d tail=%d\n" , queue_map[i].queue, q->queued, q->head, q->tail);
@@ -397,6 +393,8 @@ mt7915_queues_read(struct seq_file *s, void *data)return 0 ; } +DEFINE_SHOW_ATTRIBUTE (mt7915_xmit_queues); +static void mt7915_puts_rate_txpower (struct seq_file *s,struct mt7915_phy *phy) {
@@ -427,16 +425,17 @@ mt7915_puts_rate_txpower(struct seq_file *s, struct mt7915_phy *phy) }static int -mt7915_read_rate_txpower (struct seq_file *s,void *data) +mt7915_rate_txpower_show (struct seq_file *file,void *data) { -struct mt7915_dev *dev =dev_get_drvdata (s->private); +struct mt7915_phy *phy = file->private; -mt7915_puts_rate_txpower (s, &dev->phy); -mt7915_puts_rate_txpower (s,mt7915_ext_phy (dev)); +mt7915_puts_rate_txpower (file, phy);return 0 ; } +DEFINE_SHOW_ATTRIBUTE (mt7915_rate_txpower); +static int mt7915_twt_stats (struct seq_file *s,void *data) {
@@ -463,31 +462,35 @@ mt7915_twt_stats(struct seq_file *s, void *data)return 0 ; } -int mt7915_init_debugfs (struct mt7915_dev *dev) +int mt7915_init_debugfs (struct mt7915_phy *phy) { +struct mt7915_dev *dev = phy->dev; +bool ext_phy = phy != &dev->phy;struct dentry *dir; - dir =mt76_register_debugfs (&dev->mt76); + dir =mt76_register_debugfs_fops (phy->mt76,NULL );if (!dir)return -ENOMEM ; -debugfs_create_devm_seqfile (dev->mt76.dev,"tx-queues" , dir, - mt7915_queues_read); -debugfs_create_devm_seqfile (dev->mt76.dev,"hw-queues" , dir, - mt7915_hw_queues_read); -debugfs_create_file ("tx_stats" ,0400 , dir, dev, &mt7915_tx_stats_fops); +debugfs_create_file ("hw-queues" ,0400 , dir, phy, + &mt7915_hw_queues_fops); +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_debug" ,0600 , dir, dev, &fops_fw_debug);debugfs_create_file ("implicit_txbf" ,0600 , dir, dev, &fops_implicit_txbf); -debugfs_create_u32 ("dfs_hw_pattern" ,0400 , dir, &dev->hw_pattern); +debugfs_create_file ("txpower_sku" ,0400 , dir, phy, + &mt7915_rate_txpower_fops);debugfs_create_devm_seqfile (dev->mt76.dev,"twt_stats" , dir, mt7915_twt_stats); -/* test knobs */ -debugfs_create_file ("radar_trigger" ,0200 , dir, dev, - &fops_radar_trigger);debugfs_create_file ("ser_trigger" ,0200 , dir, dev, &fops_ser_trigger); -debugfs_create_devm_seqfile (dev->mt76.dev,"txpower_sku" , dir, - mt7915_read_rate_txpower); +if (!dev->dbdc_support || ext_phy) { +debugfs_create_u32 ("dfs_hw_pattern" ,0400 , dir, + &dev->hw_pattern); +debugfs_create_file ("radar_trigger" ,0200 , dir, dev, + &fops_radar_trigger); + }return 0 ; }
drivers/net/wireless/mediatek/mt76/mt7915/init.c +5 -1
@@ -477,6 +477,10 @@ static int mt7915_register_ext_phy(struct mt7915_dev *dev)if (ret) goto error; + ret =mt7915_init_debugfs (phy); +if (ret) + goto error; +return 0 ; error:
@@ -949,7 +953,7 @@ int mt7915_register_device(struct mt7915_dev *dev)if (ret)return ret; -return mt7915_init_debugfs (dev); +return mt7915_init_debugfs (&dev->phy); }void mt7915_unregister_device (struct mt7915_dev *dev)
drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +1 -1
@@ -511,7 +511,7 @@ int mt7915_dfs_init_radar_detector(struct mt7915_phy *phy);void mt7915_set_stream_he_caps (struct mt7915_phy *phy);void mt7915_set_stream_vht_txbf_caps (struct mt7915_phy *phy);void mt7915_update_channel (struct mt76_phy *mphy); -int mt7915_init_debugfs (struct mt7915_dev *dev); +int mt7915_init_debugfs (struct mt7915_phy *phy);#ifdef CONFIG_MAC80211_DEBUGFS void mt7915_sta_add_debugfs (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta,struct dentry *dir);
Signature · 1 line
2.31.1
Lorenzo Bianconi
maintainerPATCH v3 3/3 mt76: mt7915: improve code readability for xmit-queue handler
In reply to Lorenzo BianconiImprove xmit-queue debugfs node readability for mt7915
--- drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +2 -2
@@ -378,14 +378,14 @@ mt7915_xmit_queues_show(struct seq_file *file, void *data) };int i; +seq_puts (file," queue | hw-queued | head | tail |\n" );for (i =0 ; i <ARRAY_SIZE (queue_map); i++) {struct mt76_queue *q = queue_map[i].q;if (!q)continue ; -seq_printf (file, -"%s: queued=%d head=%d tail=%d\n" , +seq_printf (file," %s | %9d | %9d | %9d |\n" , queue_map[i].queue, q->queued, q->head, q->tail); }
Signature · 1 line
2.31.1