wifi: mt76: move mib_stats structure in mt76.h
Subsystems (2)
Lorenzo Bianconi
maintainercover wifi: mt76: move mib_stats structure in mt76.h
Move mib_stats structure in mt76.h and get rid of private drivers copy.
Lorenzo Bianconi (3):
wifi: mt76: mt7915: move mib_stats structure in mt76.h
wifi: mt76: mt7996: rely on mib_stats shared definition
wifi: mt76: mt7921: rely on mib_stats shared definition
drivers/net/wireless/mediatek/mt76/mt76.h | 63 +++++++++++++++++++ .../wireless/mediatek/mt76/mt7915/debugfs.c | 4 +- .../net/wireless/mediatek/mt76/mt7915/mac.c | 2 +- .../net/wireless/mediatek/mt76/mt7915/main.c | 4 +- .../wireless/mediatek/mt76/mt7915/mt7915.h | 63 +------------------ .../wireless/mediatek/mt76/mt7921/debugfs.c | 2 +- .../net/wireless/mediatek/mt76/mt7921/mac.c | 2 +- .../net/wireless/mediatek/mt76/mt7921/main.c | 4 +- .../wireless/mediatek/mt76/mt7921/mt7921.h | 31 +-------- .../wireless/mediatek/mt76/mt7996/debugfs.c | 4 +- .../net/wireless/mediatek/mt76/mt7996/mac.c | 2 +- .../net/wireless/mediatek/mt76/mt7996/main.c | 4 +- .../wireless/mediatek/mt76/mt7996/mt7996.h | 56 +---------------- 13 files changed, 80 insertions(+), 161 deletions(-)
Signature · 1 line
2.40.1
Lorenzo Bianconi
maintainerPATCH 1/3 wifi: mt76: mt7915: move mib_stats structure in mt76.h
mib_stats structure is shared by mostly all chipsets. Move it to shared code.
--- drivers/net/wireless/mediatek/mt76/mt76.h | 63 +++++++++++++++++++ .../wireless/mediatek/mt76/mt7915/debugfs.c | 4 +- .../net/wireless/mediatek/mt76/mt7915/mac.c | 2 +- .../net/wireless/mediatek/mt76/mt7915/main.c | 4 +- .../wireless/mediatek/mt76/mt7915/mt7915.h | 63 +------------------ 5 files changed, 69 insertions(+), 67 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76.h +63 -0
@@ -857,6 +857,69 @@ struct mt76_dev { }; }; +/* per-phy stats. */ +struct mt76_mib_stats { +u32 ack_fail_cnt; +u32 fcs_err_cnt; +u32 rts_cnt; +u32 rts_retries_cnt; +u32 ba_miss_cnt; +u32 tx_bf_cnt; +u32 tx_mu_bf_cnt; +u32 tx_mu_mpdu_cnt; +u32 tx_mu_acked_mpdu_cnt; +u32 tx_su_acked_mpdu_cnt; +u32 tx_bf_ibf_ppdu_cnt; +u32 tx_bf_ebf_ppdu_cnt; + +u32 tx_bf_rx_fb_all_cnt; +u32 tx_bf_rx_fb_eht_cnt; +u32 tx_bf_rx_fb_he_cnt; +u32 tx_bf_rx_fb_vht_cnt; +u32 tx_bf_rx_fb_ht_cnt; + +u32 tx_bf_rx_fb_bw;/* value of last sample, not cumulative */ +u32 tx_bf_rx_fb_nc_cnt; +u32 tx_bf_rx_fb_nr_cnt; +u32 tx_bf_fb_cpl_cnt; +u32 tx_bf_fb_trig_cnt; + +u32 tx_ampdu_cnt; +u32 tx_stop_q_empty_cnt; +u32 tx_mpdu_attempts_cnt; +u32 tx_mpdu_success_cnt; +u32 tx_pkt_ebf_cnt; +u32 tx_pkt_ibf_cnt; + +u32 tx_rwp_fail_cnt; +u32 tx_rwp_need_cnt; + +/* rx stats */ +u32 rx_fifo_full_cnt; +u32 channel_idle_cnt; +u32 primary_cca_busy_time; +u32 secondary_cca_busy_time; +u32 primary_energy_detect_time; +u32 cck_mdrdy_time; +u32 ofdm_mdrdy_time; +u32 green_mdrdy_time; +u32 rx_vector_mismatch_cnt; +u32 rx_delimiter_fail_cnt; +u32 rx_mrdy_cnt; +u32 rx_len_mismatch_cnt; +u32 rx_mpdu_cnt; +u32 rx_ampdu_cnt; +u32 rx_ampdu_bytes_cnt; +u32 rx_ampdu_valid_subframe_cnt; +u32 rx_ampdu_valid_subframe_bytes_cnt; +u32 rx_pfdrop_cnt; +u32 rx_vec_queue_overflow_drop_cnt; +u32 rx_ba_cnt; + +u32 tx_amsdu[8 ]; +u32 tx_amsdu_cnt; +}; +struct mt76_power_limits {s8 cck[4 ];s8 ofdm[8 ];
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +2 -2
@@ -719,10 +719,10 @@ mt7915_ampdu_stat_read_phy(struct mt7915_phy *phy,static void mt7915_txbf_stat_read_phy (struct mt7915_phy *phy,struct seq_file *s) { +struct mt76_mib_stats *mib = &phy->mib;static const char *const bw[] = {"BW20" ,"BW40" ,"BW80" ,"BW160" }; -struct mib_stats *mib = &phy->mib;/* Tx Beamformer monitor */ seq_puts (s,"\nTx Beamformer applied PPDU counts: " );
@@ -768,7 +768,7 @@ mt7915_tx_stats_show(struct seq_file *file, void *data) {struct mt7915_phy *phy = file->private;struct mt7915_dev *dev = phy->dev; -struct mib_stats *mib = &phy->mib; +struct mt76_mib_stats *mib = &phy->mib;int i;mutex_lock (&dev->mt76.mutex);
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +1 -1
@@ -1747,8 +1747,8 @@ void mt7915_reset(struct mt7915_dev *dev)void mt7915_mac_update_stats (struct mt7915_phy *phy) { +struct mt76_mib_stats *mib = &phy->mib;struct mt7915_dev *dev = phy->dev; -struct mib_stats *mib = &phy->mib;int i, aggr0 =0 , aggr1, cnt;u8 band = phy->mt76->band_idx;u32 val;
drivers/net/wireless/mediatek/mt76/mt7915/main.c +2 -2
@@ -843,7 +843,7 @@ mt7915_get_stats(struct ieee80211_hw *hw, {struct mt7915_phy *phy =mt7915_hw_phy (hw);struct mt7915_dev *dev =mt7915_hw_dev (hw); -struct mib_stats *mib = &phy->mib; +struct mt76_mib_stats *mib = &phy->mib;mutex_lock (&dev->mt76.mutex);
@@ -1327,11 +1327,11 @@ void mt7915_get_et_stats(struct ieee80211_hw *hw,struct mt7915_dev *dev =mt7915_hw_dev (hw);struct mt7915_phy *phy =mt7915_hw_phy (hw);struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; +struct mt76_mib_stats *mib = &phy->mib;struct mt76_ethtool_worker_info wi = { .data = data, .idx = mvif->mt76.idx, }; -struct mib_stats *mib = &phy->mib;/* See mt7915_ampdu_stat_read_phy, etc */ int i, ei =0 , stats_size;
drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +1 -62
75 lines not on this page · raw message
Signature · 1 line
2.40.1
Re: [PATCH 1/3] wifi: mt76: mt7915: move mib_stats structure in mt76.h
Quoted 4 lines · Lorenzo Bianconi
mib_statsstructure is shared by mostly all chipsets. Move it to shared code.Signed-off-by Lorenzo Bianconi <[email protected]>
Re: [PATCH 1/3] wifi: mt76: mt7915: move mib_stats structure in mt76.h
In reply to Lorenzo BianconiQuoted 2 lines · Lorenzo Bianconi
mib_statsstructure is shared by mostly all chipsets. Move it to shared code.
In case this thing hasn't been pushed upstream yet, then a suggestion:
Create a struct mt76_mib_stats_common class that has the common counters, and then per-driver can have that struct as first member of its mib stats.
I have added a lot of per-driver stats that never made it upstream and are not fully shared across different drivers.
Thanks,
Ben
Quoted 21 lines
Signed-off-by Lorenzo Bianconi <[email protected]>--- drivers/net/wireless/mediatek/mt76/mt76.h | 63 +++++++++++++++++++ .../wireless/mediatek/mt76/mt7915/debugfs.c | 4 +- .../net/wireless/mediatek/mt76/mt7915/mac.c | 2 +- .../net/wireless/mediatek/mt76/mt7915/main.c | 4 +- .../wireless/mediatek/mt76/mt7915/mt7915.h | 63 +------------------ 5 files changed, 69 insertions(+), 67 deletions(-)drivers/net/wireless/mediatek/mt76/mt76.h +3
-0@@ -857,6 +857,69 @@ struct mt76_dev { }; }; +/* per-phy stats. */ +struct mt76_mib_stats { +u32 ack_fail_cnt;
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Re: [PATCH 1/3] wifi: mt76: mt7915: move mib_stats structure in mt76.h
Quoted 11 lines · Lorenzo Bianconi
Quoted 2 lines
mib_statsstructure is shared by mostly all chipsets. Move it to shared code.In case this thing hasn't been pushed upstream yet, then a suggestion:
Create a struct
mt76_mib_stats_commonclass that has the common counters, and then per-driver can have that struct as first member of its mib stats.I have added a lot of per-driver stats that never made it upstream and are not fully shared across different drivers.
I would say mt76_mib_stats is quite a general name. I think we can do somothing like (if it is really necessary):
struct mt7915_mib_stats {
struct mt76_mib_stats mt76;
...
};Regards,
Lorenzo
Quoted 30 lines
Thanks,
BenQuoted 20 lines
Signed-off-by Lorenzo Bianconi <[email protected]>--- drivers/net/wireless/mediatek/mt76/mt76.h | 63 +++++++++++++++++++ .../wireless/mediatek/mt76/mt7915/debugfs.c | 4 +- .../net/wireless/mediatek/mt76/mt7915/mac.c | 2 +- .../net/wireless/mediatek/mt76/mt7915/main.c | 4 +- .../wireless/mediatek/mt76/mt7915/mt7915.h | 63 +------------------ 5 files changed, 69 insertions(+), 67 deletions(-)drivers/net/wireless/mediatek/mt76/mt76.h +3
-0@@ -857,6 +857,69 @@ struct mt76_dev { }; }; +/* per-phy stats. */ +struct mt76_mib_stats { +u32 ack_fail_cnt;Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Re: [PATCH 1/3] wifi: mt76: mt7915: move mib_stats structure in mt76.h
Quoted 12 lines · Lorenzo Bianconi
Quoted 11 lines · Lorenzo Bianconi
Quoted 2 lines
mib_statsstructure is shared by mostly all chipsets. Move it to shared code.In case this thing hasn't been pushed upstream yet, then a suggestion:
Create a struct
mt76_mib_stats_commonclass that has the common counters, and then per-driver can have that struct as first member of its mib stats.I have added a lot of per-driver stats that never made it upstream and are not fully shared across different drivers.
Quoted 7 lines
I would say
mt76_mib_statsis quite a general name. I think we can do somothing like (if it is really necessary):struct mt7915_mib_stats { struct mt76_mib_stats mt76; ... };
Maybe:
struct mt7915_mib_stats {
struct mt76_mib_stats common;
...
};I also noticed that Ryder added a few of my patches that extended the stats, so I think there are probably a lot of stats in that struct that are not set on the 7921 driver and probably older drivers too.
To me, unset stats are confusing, so I'd prefer to put stats that are mostly common in a common struct, and have per-driver stats just found in the driver itself.
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Ryder Lee
maintainerRe: [PATCH 1/3] wifi: mt76: mt7915: move mib_stats structure in mt76.h
Quoted 40 lines · Ben Greear
External email : Please do not click links or open attachments until you have verified the sender or the content.
Quoted 2 lines · Lorenzo Bianconi
Quoted 2 lines · Lorenzo Bianconi
Quoted 1 line
mib_statsstructure is shared by mostly all chipsets. Move it toshared
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
code.
In case this thing hasn't been pushed upstream yet, then a
suggestion:
Quoted 2 lines
Quoted 2 lines
Create a struct
mt76_mib_stats_commonclass that has the commoncounters,
Quoted 1 line
Quoted 1 line
and then per-driver can have that struct as first member of its
mib stats.
Quoted 5 lines
Quoted 3 lines
I have added a lot of per-driver stats that never made it upstream and are not fully shared across different drivers.
I would say
mt76_mib_statsis quite a general name. I think we cando somothing
Quoted 6 lines
like (if it is really necessary):
struct
mt7915_mib_stats{
structmt76_mib_statsmt76;
...
};Maybe:
struct
mt7915_mib_stats{
structmt76_mib_statscommon;
...
};I also noticed that Ryder added a few of my patches that extended the stats, so I think there are probably a lot of stats in that struct that are not set on the 7921 driver and probably older drivers too.
Quoted 6 lines
To me, unset stats are confusing, so I'd prefer to put stats that are mostly
common in a common struct, and have per-driver stats just found in the driver
itself.
Myabe you can add a patch for per-driver stuff. I just extended the stat for mt7915 and lore also sent this patch for common struct, but ended up merging together.
Ryder
Lorenzo Bianconi
maintainerPATCH 2/3 wifi: mt76: mt7996: rely on mib_stats shared definition
In reply to Lorenzo BianconiGet rid of private copy of mib_stats structure.
--- .../wireless/mediatek/mt76/mt7996/debugfs.c | 4 +- .../net/wireless/mediatek/mt76/mt7996/mac.c | 2 +- .../net/wireless/mediatek/mt76/mt7996/main.c | 4 +- .../wireless/mediatek/mt76/mt7996/mt7996.h | 56 +------------------ 4 files changed, 6 insertions(+), 60 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c +2 -2
@@ -474,10 +474,10 @@ mt7996_ampdu_stat_read_phy(struct mt7996_phy *phy, struct seq_file *file)static void mt7996_txbf_stat_read_phy (struct mt7996_phy *phy,struct seq_file *s) { +struct mt76_mib_stats *mib = &phy->mib;static const char *const bw[] = {"BW20" ,"BW40" ,"BW80" ,"BW160" }; -struct mib_stats *mib = &phy->mib;/* Tx Beamformer monitor */ seq_puts (s,"\nTx Beamformer applied PPDU counts: " );
@@ -523,7 +523,7 @@ mt7996_tx_stats_show(struct seq_file *file, void *data) {struct mt7996_phy *phy = file->private;struct mt7996_dev *dev = phy->dev; -struct mib_stats *mib = &phy->mib; +struct mt76_mib_stats *mib = &phy->mib;int i;u32 attempts, success, per;
drivers/net/wireless/mediatek/mt76/mt7996/mac.c +1 -1
@@ -2186,8 +2186,8 @@ void mt7996_reset(struct mt7996_dev *dev)void mt7996_mac_update_stats (struct mt7996_phy *phy) { +struct mt76_mib_stats *mib = &phy->mib;struct mt7996_dev *dev = phy->dev; -struct mib_stats *mib = &phy->mib;u8 band_idx = phy->mt76->band_idx;u32 cnt;int i;
drivers/net/wireless/mediatek/mt76/mt7996/main.c +2 -2
@@ -793,7 +793,7 @@ mt7996_get_stats(struct ieee80211_hw *hw, {struct mt7996_phy *phy =mt7996_hw_phy (hw);struct mt7996_dev *dev =mt7996_hw_dev (hw); -struct mib_stats *mib = &phy->mib; +struct mt76_mib_stats *mib = &phy->mib;mutex_lock (&dev->mt76.mutex);
@@ -1198,11 +1198,11 @@ void mt7996_get_et_stats(struct ieee80211_hw *hw,struct mt7996_dev *dev =mt7996_hw_dev (hw);struct mt7996_phy *phy =mt7996_hw_phy (hw);struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; +struct mt76_mib_stats *mib = &phy->mib;struct mt76_ethtool_worker_info wi = { .data = data, .idx = mvif->mt76.idx, }; -struct mib_stats *mib = &phy->mib;/* See mt7996_ampdu_stat_read_phy, etc */ int i, ei =0 ;
drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h +1 -55
68 lines not on this page · raw message
Signature · 1 line
2.40.1
Re: [PATCH 2/3] wifi: mt76: mt7996: rely on mib_stats shared definition
Quoted 3 lines · Lorenzo Bianconi
Get rid of private copy of
mib_statsstructure.Signed-off-by Lorenzo Bianconi <[email protected]>
Lorenzo Bianconi
maintainerPATCH 3/3 wifi: mt76: mt7921: rely on mib_stats shared definition
In reply to Lorenzo BianconiGet rid of private copy of mib_stats structure.
--- .../wireless/mediatek/mt76/mt7921/debugfs.c | 2 +- .../net/wireless/mediatek/mt76/mt7921/mac.c | 2 +- .../net/wireless/mediatek/mt76/mt7921/main.c | 4 +-- .../wireless/mediatek/mt76/mt7921/mt7921.h | 31 +------------------ 4 files changed, 5 insertions(+), 34 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c +1 -1
@@ -95,7 +95,7 @@ mt7921_tx_stats_show(struct seq_file *file, void *data) {struct mt7921_dev *dev = file->private;struct mt7921_phy *phy = &dev->phy; -struct mib_stats *mib = &phy->mib; +struct mt76_mib_stats *mib = &phy->mib;int i;mt7921_mutex_acquire (dev);
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +1 -1
@@ -952,8 +952,8 @@ EXPORT_SYMBOL_GPL(mt7921_reset);void mt7921_mac_update_mib_stats (struct mt7921_phy *phy) { +struct mt76_mib_stats *mib = &phy->mib;struct mt7921_dev *dev = phy->dev; -struct mib_stats *mib = &phy->mib;int i, aggr0 =0 , aggr1;u32 val;
drivers/net/wireless/mediatek/mt76/mt7921/main.c +2 -2
@@ -996,7 +996,7 @@ mt7921_get_stats(struct ieee80211_hw *hw, struct ieee80211_low_level_stats *stats) {struct mt7921_phy *phy =mt7921_hw_phy (hw); -struct mib_stats *mib = &phy->mib; +struct mt76_mib_stats *mib = &phy->mib;mt7921_mutex_acquire (phy->dev);
@@ -1134,7 +1134,7 @@ void mt7921_get_et_stats(struct ieee80211_hw *hw, struct ieee80211_vif *vif,int stats_size =ARRAY_SIZE (mt7921_gstrings_stats);struct mt7921_phy *phy =mt7921_hw_phy (hw);struct mt7921_dev *dev = phy->dev; -struct mib_stats *mib = &phy->mib; +struct mt76_mib_stats *mib = &phy->mib;struct mt76_ethtool_worker_info wi = { .data = data, .idx = mvif->mt76.idx,
drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +1 -30
@@ -179,35 +179,6 @@ struct mt7921_vif {struct ieee80211_chanctx_conf *ctx; }; -struct mib_stats { -u32 ack_fail_cnt; -u32 fcs_err_cnt; -u32 rts_cnt; -u32 rts_retries_cnt; -u32 ba_miss_cnt; - -u32 tx_bf_ibf_ppdu_cnt; -u32 tx_bf_ebf_ppdu_cnt; -u32 tx_bf_rx_fb_all_cnt; -u32 tx_bf_rx_fb_he_cnt; -u32 tx_bf_rx_fb_vht_cnt; -u32 tx_bf_rx_fb_ht_cnt; - -u32 tx_ampdu_cnt; -u32 tx_mpdu_attempts_cnt; -u32 tx_mpdu_success_cnt; -u32 tx_pkt_ebf_cnt; -u32 tx_pkt_ibf_cnt; - -u32 rx_mpdu_cnt; -u32 rx_ampdu_cnt; -u32 rx_ampdu_bytes_cnt; -u32 rx_ba_cnt; - -u32 tx_amsdu[8 ]; -u32 tx_amsdu_cnt; -}; -enum {MT7921_CLC_POWER ,MT7921_CLC_CHAN ,
@@ -247,7 +218,7 @@ struct mt7921_phy {u32 rx_ampdu_ts;u32 ampdu_ref; -struct mib_stats mib; +struct mt76_mib_stats mib;u8 sta_work_count;
Signature · 1 line
2.40.1
Re: [PATCH 3/3] wifi: mt76: mt7921: rely on mib_stats shared definition
Quoted 3 lines · Lorenzo Bianconi
Get rid of private copy of
mib_statsstructure.Signed-off-by Lorenzo Bianconi <[email protected]>