Commit ae775faa authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

wifi: rtw89: add to display hardware rates v1 histogram in debugfs

The upcoming WiFi 7 chips support EHT rates, and hardware rate codes are
changed too, so modify to adapt the changes. (EHT counters are still zeros
in below example)

RX count:
   Legacy: [0, 0, 0, 0]
     OFDM: [0, 0, 0, 0, 0, 0, 0, 0]
     HT 0: [0, 0, 0, 0, 0, 0, 0, 0]
     HT 1: [0, 0, 0, 0, 0, 0, 0, 0]
  VHT 1SS: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0]
  VHT 2SS: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0]
   HE 1SS: [0, 0, 42, 0, 43, 90, 75, 0, 26, 20, 260, 7]
   HE 2SS: [0, 96, 232, 84, 125, 184, 52, 0, 0, 0, 0, 0]
  EHT 1SS: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0]
  EHT 2SS: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230728070252.66525-10-pkshih@realtek.com
parent 5c152231
...@@ -584,6 +584,7 @@ enum rtw89_hw_rate { ...@@ -584,6 +584,7 @@ enum rtw89_hw_rate {
RTW89_HW_RATE_V1_EHT_NSS4_MCS13 = 0x46D, RTW89_HW_RATE_V1_EHT_NSS4_MCS13 = 0x46D,
RTW89_HW_RATE_NR, RTW89_HW_RATE_NR,
RTW89_HW_RATE_INVAL,
RTW89_HW_RATE_MASK_MOD = GENMASK(8, 7), RTW89_HW_RATE_MASK_MOD = GENMASK(8, 7),
RTW89_HW_RATE_MASK_VAL = GENMASK(6, 0), RTW89_HW_RATE_MASK_VAL = GENMASK(6, 0),
......
...@@ -3325,20 +3325,26 @@ rtw89_debug_append_rx_rate(struct seq_file *m, struct rtw89_pkt_stat *pkt_stat, ...@@ -3325,20 +3325,26 @@ rtw89_debug_append_rx_rate(struct seq_file *m, struct rtw89_pkt_stat *pkt_stat,
pkt_stat->rx_rate_cnt[first_rate + i]); pkt_stat->rx_rate_cnt[first_rate + i]);
} }
#define FIRST_RATE_SAME(rate) {RTW89_HW_RATE_ ## rate, RTW89_HW_RATE_ ## rate}
#define FIRST_RATE_ENUM(rate) {RTW89_HW_RATE_ ## rate, RTW89_HW_RATE_V1_ ## rate}
#define FIRST_RATE_GEV1(rate) {RTW89_HW_RATE_INVAL, RTW89_HW_RATE_V1_ ## rate}
static const struct rtw89_rx_rate_cnt_info { static const struct rtw89_rx_rate_cnt_info {
enum rtw89_hw_rate first_rate; enum rtw89_hw_rate first_rate[RTW89_CHIP_GEN_NUM];
int len; int len;
int ext; int ext;
const char *rate_mode; const char *rate_mode;
} rtw89_rx_rate_cnt_infos[] = { } rtw89_rx_rate_cnt_infos[] = {
{RTW89_HW_RATE_CCK1, 4, 0, "Legacy:"}, {FIRST_RATE_SAME(CCK1), 4, 0, "Legacy:"},
{RTW89_HW_RATE_OFDM6, 8, 0, "OFDM:"}, {FIRST_RATE_SAME(OFDM6), 8, 0, "OFDM:"},
{RTW89_HW_RATE_MCS0, 8, 0, "HT 0:"}, {FIRST_RATE_ENUM(MCS0), 8, 0, "HT 0:"},
{RTW89_HW_RATE_MCS8, 8, 0, "HT 1:"}, {FIRST_RATE_ENUM(MCS8), 8, 0, "HT 1:"},
{RTW89_HW_RATE_VHT_NSS1_MCS0, 10, 2, "VHT 1SS:"}, {FIRST_RATE_ENUM(VHT_NSS1_MCS0), 10, 2, "VHT 1SS:"},
{RTW89_HW_RATE_VHT_NSS2_MCS0, 10, 2, "VHT 2SS:"}, {FIRST_RATE_ENUM(VHT_NSS2_MCS0), 10, 2, "VHT 2SS:"},
{RTW89_HW_RATE_HE_NSS1_MCS0, 12, 0, "HE 1SS:"}, {FIRST_RATE_ENUM(HE_NSS1_MCS0), 12, 0, "HE 1SS:"},
{RTW89_HW_RATE_HE_NSS2_MCS0, 12, 0, "HE 2ss:"}, {FIRST_RATE_ENUM(HE_NSS2_MCS0), 12, 0, "HE 2SS:"},
{FIRST_RATE_GEV1(EHT_NSS1_MCS0), 14, 2, "EHT 1SS:"},
{FIRST_RATE_GEV1(EHT_NSS2_MCS0), 14, 0, "EHT 2SS:"},
}; };
static int rtw89_debug_priv_phy_info_get(struct seq_file *m, void *v) static int rtw89_debug_priv_phy_info_get(struct seq_file *m, void *v)
...@@ -3347,7 +3353,9 @@ static int rtw89_debug_priv_phy_info_get(struct seq_file *m, void *v) ...@@ -3347,7 +3353,9 @@ static int rtw89_debug_priv_phy_info_get(struct seq_file *m, void *v)
struct rtw89_dev *rtwdev = debugfs_priv->rtwdev; struct rtw89_dev *rtwdev = debugfs_priv->rtwdev;
struct rtw89_traffic_stats *stats = &rtwdev->stats; struct rtw89_traffic_stats *stats = &rtwdev->stats;
struct rtw89_pkt_stat *pkt_stat = &rtwdev->phystat.last_pkt_stat; struct rtw89_pkt_stat *pkt_stat = &rtwdev->phystat.last_pkt_stat;
const struct rtw89_chip_info *chip = rtwdev->chip;
const struct rtw89_rx_rate_cnt_info *info; const struct rtw89_rx_rate_cnt_info *info;
enum rtw89_hw_rate first_rate;
int i; int i;
seq_printf(m, "TP TX: %u [%u] Mbps (lv: %d), RX: %u [%u] Mbps (lv: %d)\n", seq_printf(m, "TP TX: %u [%u] Mbps (lv: %d), RX: %u [%u] Mbps (lv: %d)\n",
...@@ -3359,15 +3367,20 @@ static int rtw89_debug_priv_phy_info_get(struct seq_file *m, void *v) ...@@ -3359,15 +3367,20 @@ static int rtw89_debug_priv_phy_info_get(struct seq_file *m, void *v)
stats->rx_avg_len); stats->rx_avg_len);
seq_puts(m, "RX count:\n"); seq_puts(m, "RX count:\n");
for (i = 0; i < ARRAY_SIZE(rtw89_rx_rate_cnt_infos); i++) { for (i = 0; i < ARRAY_SIZE(rtw89_rx_rate_cnt_infos); i++) {
info = &rtw89_rx_rate_cnt_infos[i]; info = &rtw89_rx_rate_cnt_infos[i];
first_rate = info->first_rate[chip->chip_gen];
if (first_rate >= RTW89_HW_RATE_NR)
continue;
seq_printf(m, "%10s [", info->rate_mode); seq_printf(m, "%10s [", info->rate_mode);
rtw89_debug_append_rx_rate(m, pkt_stat, rtw89_debug_append_rx_rate(m, pkt_stat,
info->first_rate, info->len); first_rate, info->len);
if (info->ext) { if (info->ext) {
seq_puts(m, "]["); seq_puts(m, "][");
rtw89_debug_append_rx_rate(m, pkt_stat, rtw89_debug_append_rx_rate(m, pkt_stat,
info->first_rate + info->len, info->ext); first_rate + info->len, info->ext);
} }
seq_puts(m, "]\n"); seq_puts(m, "]\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment