| From d17884fc654153615c5d6f6ac4192eed3ec34525 Mon Sep 17 00:00:00 2001 |
| From: Shayne Chen <shayne.chen@mediatek.com> |
| Date: Fri, 29 Dec 2023 18:37:41 +0800 |
| Subject: [PATCH 106/116] wifi: mt76: mt7996: implement ieee80211_ops for link |
| debugfs |
| |
| Add .link_sta_add_debugfs and .link_add_debugfs. |
| |
| Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> |
| --- |
| mt7996/debugfs.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ |
| mt7996/mac.c | 4 +-- |
| mt7996/main.c | 2 ++ |
| mt7996/mcu.c | 6 +++-- |
| mt7996/mt7996.h | 5 ++++ |
| 5 files changed, 78 insertions(+), 4 deletions(-) |
| |
| diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c |
| index 56e219231..26927eda9 100644 |
| --- a/mt7996/debugfs.c |
| +++ b/mt7996/debugfs.c |
| @@ -1307,4 +1307,69 @@ void mt7996_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| debugfs_create_file("hw-queues", 0400, dir, sta, &mt7996_queues_fops); |
| } |
| |
| +static int |
| +mt7996_link_sta_info_show(struct seq_file *file, void *data) |
| +{ |
| + struct ieee80211_link_sta *link_sta = file->private; |
| + struct mt7996_sta *msta = (struct mt7996_sta *)link_sta->sta->drv_priv; |
| + struct mt7996_link_sta *mlink; |
| + struct mt7996_dev *dev = msta->vif->dev; |
| + struct rate_info *r; |
| + |
| + mutex_lock(&dev->mt76.mutex); |
| + |
| + mlink = mlink_dereference_protected(msta, link_sta->link_id); |
| + r = &mlink->wcid.rate; |
| + seq_printf(file, "tx rate: flags=0x%x,legacy=%u,mcs=%u,nss=%u,bw=%u,he_gi=%u,he_dcm=%u,he_ru_alloc=%u,eht_gi=%u,eht_ru_alloc=%u\n", |
| + r->flags, r->legacy, r->mcs, r->nss, r->bw, r->he_gi, r->he_dcm, r->he_ru_alloc, r->eht_gi, r->eht_ru_alloc); |
| + seq_printf(file, "tx_bytes=%llu\n", mlink->wcid.stats.tx_bytes); |
| + seq_printf(file, "rx_bytes=%llu\n", mlink->wcid.stats.rx_bytes); |
| + seq_printf(file, "tx_airtime=%llu\n", mlink->wcid.stats.tx_airtime); |
| + seq_printf(file, "rx_airtime=%llu\n", mlink->wcid.stats.rx_airtime); |
| + |
| + mutex_unlock(&dev->mt76.mutex); |
| + |
| + return 0; |
| +} |
| +DEFINE_SHOW_ATTRIBUTE(mt7996_link_sta_info); |
| + |
| +void mt7996_link_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| + struct ieee80211_link_sta *link_sta, |
| + struct dentry *dir) |
| +{ |
| + debugfs_create_file("link_sta_info", 0600, dir, link_sta, |
| + &mt7996_link_sta_info_fops); |
| +} |
| + |
| +static int |
| +mt7996_link_info_show(struct seq_file *file, void *data) |
| +{ |
| + struct ieee80211_bss_conf *conf = file->private; |
| + struct mt7996_vif *mvif = (struct mt7996_vif *)conf->vif->drv_priv; |
| + struct mt7996_sta *msta = &mvif->sta; |
| + struct mt7996_bss_conf *mconf; |
| + struct mt7996_link_sta *mlink; |
| + struct mt7996_dev *dev = mvif->dev; |
| + struct rate_info *r; |
| + |
| + mutex_lock(&dev->mt76.mutex); |
| + |
| + mconf = mconf_dereference_protected(mvif, conf->link_id); |
| + mlink = mlink_dereference_protected(msta, conf->link_id); |
| + r = &mlink->wcid.rate; |
| + seq_printf(file, "band mapping=%u\n", mconf->phy->mt76->band_idx); |
| + seq_printf(file, "tx rate: flags=0x%x,legacy=%u,mcs=%u,nss=%u,bw=%u,he_gi=%u,he_dcm=%u,he_ru_alloc=%u,eht_gi=%u,eht_ru_alloc=%u\n", |
| + r->flags, r->legacy, r->mcs, r->nss, r->bw, r->he_gi, r->he_dcm, r->he_ru_alloc, r->eht_gi, r->eht_ru_alloc); |
| + |
| + mutex_unlock(&dev->mt76.mutex); |
| + |
| + return 0; |
| +} |
| +DEFINE_SHOW_ATTRIBUTE(mt7996_link_info); |
| + |
| +void mt7996_link_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| + struct ieee80211_bss_conf *link_conf, struct dentry *dir) |
| +{ |
| + debugfs_create_file("link_info", 0600, dir, link_conf, &mt7996_link_info_fops); |
| +} |
| #endif |
| diff --git a/mt7996/mac.c b/mt7996/mac.c |
| index e6db1765f..5967b6aeb 100644 |
| --- a/mt7996/mac.c |
| +++ b/mt7996/mac.c |
| @@ -2379,10 +2379,10 @@ void mt7996_mac_work(struct work_struct *work) |
| mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_RATE); |
| mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_AIRTIME); |
| mt7996_mcu_get_rssi(mdev); |
| - if (mtk_wed_device_active(&mdev->mmio.wed)) { |
| + // if (mtk_wed_device_active(&mdev->mmio.wed)) { |
| mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_ADM_STAT); |
| mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_MSDU_COUNT); |
| - } |
| + // } |
| |
| if (mt7996_mcu_wa_cmd(phy->dev, MCU_WA_PARAM_CMD(QUERY), MCU_WA_PARAM_BSS_ACQ_PKT_CNT, |
| BSS_ACQ_PKT_CNT_BSS_BITMAP_ALL | BSS_ACQ_PKT_CNT_READ_CLR, 0)) |
| diff --git a/mt7996/main.c b/mt7996/main.c |
| index b9cc5a2e5..64797f177 100644 |
| --- a/mt7996/main.c |
| +++ b/mt7996/main.c |
| @@ -2602,6 +2602,8 @@ const struct ieee80211_ops mt7996_ops = { |
| CFG80211_TESTMODE_DUMP(mt76_testmode_dump) |
| #ifdef CONFIG_MAC80211_DEBUGFS |
| .sta_add_debugfs = mt7996_sta_add_debugfs, |
| + .link_sta_add_debugfs = mt7996_link_sta_add_debugfs, |
| + // .link_add_debugfs = mt7996_link_add_debugfs, |
| #endif |
| .set_radar_background = mt7996_set_radar_background, |
| #ifdef CONFIG_NET_MEDIATEK_SOC_WED |
| diff --git a/mt7996/mcu.c b/mt7996/mcu.c |
| index 39e353ab2..24489ac27 100644 |
| --- a/mt7996/mcu.c |
| +++ b/mt7996/mcu.c |
| @@ -616,8 +616,10 @@ mt7996_mcu_rx_all_sta_info_event(struct mt7996_dev *dev, struct sk_buff *skb) |
| wcid->stats.tx_packets += tx_packets; |
| wcid->stats.rx_packets += rx_packets; |
| |
| - __mt7996_stat_to_netdev(mphy, wcid, 0, 0, |
| - tx_packets, rx_packets); |
| + if (mtk_wed_device_active(&dev->mt76.mmio.wed)) { |
| + __mt7996_stat_to_netdev(mphy, wcid, 0, 0, |
| + tx_packets, rx_packets); |
| + } |
| break; |
| case UNI_ALL_STA_TXRX_AIRTIME: |
| wlan_idx = le16_to_cpu(res->airtime[i].wlan_idx); |
| diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h |
| index 0444ae58e..dc3cacc3a 100644 |
| --- a/mt7996/mt7996.h |
| +++ b/mt7996/mt7996.h |
| @@ -1138,6 +1138,11 @@ int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap); |
| #ifdef CONFIG_MAC80211_DEBUGFS |
| void mt7996_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| struct ieee80211_sta *sta, struct dentry *dir); |
| +void mt7996_link_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| + struct ieee80211_link_sta *link_sta, |
| + struct dentry *dir); |
| +void mt7996_link_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| + struct ieee80211_bss_conf *link_conf, struct dentry *dir); |
| #endif |
| int mt7996_mmio_wed_init(struct mt7996_dev *dev, void *pdev_ptr, |
| bool hif2, int *irq); |
| -- |
| 2.39.2 |
| |