developer | 064da3c | 2023-06-13 15:57:26 +0800 | [diff] [blame] | 1 | From 15d734c77b25451efdf3bb1bcd5e687bc429a852 Mon Sep 17 00:00:00 2001 |
developer | 483388c | 2023-03-08 13:52:15 +0800 | [diff] [blame] | 2 | From: Shayne Chen <shayne.chen@mediatek.com> |
| 3 | Date: Fri, 10 Feb 2023 17:39:23 +0800 |
developer | 064da3c | 2023-06-13 15:57:26 +0800 | [diff] [blame] | 4 | Subject: [PATCH 01/11] wifi: mt76: mt7996: add eht rx rate support |
developer | 483388c | 2023-03-08 13:52:15 +0800 | [diff] [blame] | 5 | |
| 6 | Add support to report eht rx rate. |
| 7 | |
| 8 | Change-Id: Iee067d891bd634a918c942c2ba90ae72cd40c538 |
| 9 | Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> |
| 10 | --- |
| 11 | mac80211.c | 11 ++++++++--- |
| 12 | mt76.h | 18 ++++++++++++++---- |
| 13 | mt7996/mac.c | 9 +++++---- |
| 14 | 3 files changed, 27 insertions(+), 11 deletions(-) |
| 15 | |
| 16 | diff --git a/mac80211.c b/mac80211.c |
developer | de9ecce | 2023-05-22 11:17:16 +0800 | [diff] [blame] | 17 | index 2c4a5290..467afef9 100644 |
developer | 483388c | 2023-03-08 13:52:15 +0800 | [diff] [blame] | 18 | --- a/mac80211.c |
| 19 | +++ b/mac80211.c |
| 20 | @@ -1067,9 +1067,14 @@ mt76_rx_convert(struct mt76_dev *dev, struct sk_buff *skb, |
| 21 | status->enc_flags = mstat.enc_flags; |
| 22 | status->encoding = mstat.encoding; |
| 23 | status->bw = mstat.bw; |
| 24 | - status->he_ru = mstat.he_ru; |
| 25 | - status->he_gi = mstat.he_gi; |
| 26 | - status->he_dcm = mstat.he_dcm; |
| 27 | + if (status->encoding == RX_ENC_EHT) { |
| 28 | + status->eht.ru = mstat.eht.ru; |
| 29 | + status->eht.gi = mstat.eht.gi; |
| 30 | + } else { |
| 31 | + status->he_ru = mstat.he_ru; |
| 32 | + status->he_gi = mstat.he_gi; |
| 33 | + status->he_dcm = mstat.he_dcm; |
| 34 | + } |
| 35 | status->rate_idx = mstat.rate_idx; |
| 36 | status->nss = mstat.nss; |
| 37 | status->band = mstat.band; |
| 38 | diff --git a/mt76.h b/mt76.h |
developer | de9ecce | 2023-05-22 11:17:16 +0800 | [diff] [blame] | 39 | index 8b4635e9..6b07b8fa 100644 |
developer | 483388c | 2023-03-08 13:52:15 +0800 | [diff] [blame] | 40 | --- a/mt76.h |
| 41 | +++ b/mt76.h |
| 42 | @@ -621,12 +621,22 @@ struct mt76_rx_status { |
| 43 | u16 freq; |
| 44 | u32 flag; |
| 45 | u8 enc_flags; |
| 46 | - u8 encoding:2, bw:3, he_ru:3; |
| 47 | - u8 he_gi:2, he_dcm:1; |
| 48 | + u8 encoding:3, bw:4; |
| 49 | + union { |
| 50 | + struct { |
| 51 | + u8 he_ru:3; |
| 52 | + u8 he_gi:2; |
| 53 | + u8 he_dcm:1; |
| 54 | + }; |
| 55 | + struct { |
| 56 | + u8 ru:4; |
| 57 | + u8 gi:2; |
| 58 | + } eht; |
| 59 | + }; |
| 60 | + |
| 61 | u8 amsdu:1, first_amsdu:1, last_amsdu:1; |
| 62 | u8 rate_idx; |
| 63 | - u8 nss; |
| 64 | - u8 band; |
| 65 | + u8 nss:5, band:3; |
| 66 | s8 signal; |
| 67 | u8 chains; |
| 68 | s8 chain_signal[IEEE80211_MAX_CHAINS]; |
| 69 | diff --git a/mt7996/mac.c b/mt7996/mac.c |
developer | de9ecce | 2023-05-22 11:17:16 +0800 | [diff] [blame] | 70 | index 0d51090d..23cbfdde 100644 |
developer | 483388c | 2023-03-08 13:52:15 +0800 | [diff] [blame] | 71 | --- a/mt7996/mac.c |
| 72 | +++ b/mt7996/mac.c |
developer | de9ecce | 2023-05-22 11:17:16 +0800 | [diff] [blame] | 73 | @@ -580,11 +580,12 @@ mt7996_mac_fill_rx_rate(struct mt7996_dev *dev, |
developer | 483388c | 2023-03-08 13:52:15 +0800 | [diff] [blame] | 74 | case MT_PHY_TYPE_EHT_SU: |
| 75 | case MT_PHY_TYPE_EHT_TRIG: |
| 76 | case MT_PHY_TYPE_EHT_MU: |
| 77 | - /* TODO: currently report rx rate with HE rate */ |
| 78 | status->nss = nss; |
| 79 | - status->encoding = RX_ENC_HE; |
| 80 | - bw = min_t(int, bw, IEEE80211_STA_RX_BW_160); |
| 81 | - i = min_t(int, i & 0xf, 11); |
| 82 | + status->encoding = RX_ENC_EHT; |
| 83 | + i &= GENMASK(3, 0); |
| 84 | + |
| 85 | + if (gi <= NL80211_RATE_INFO_EHT_GI_3_2) |
| 86 | + status->eht.gi = gi; |
| 87 | break; |
| 88 | default: |
| 89 | return -EINVAL; |
| 90 | -- |
developer | de9ecce | 2023-05-22 11:17:16 +0800 | [diff] [blame] | 91 | 2.39.2 |
developer | 483388c | 2023-03-08 13:52:15 +0800 | [diff] [blame] | 92 | |