blob: c927e1adbbaec72c54809ee283c81e6dac3ff061 [file] [log] [blame]
developerde9ecce2023-05-22 11:17:16 +08001From 31a7471ec1e183deafd9b28fd62cca3c25f79633 Mon Sep 17 00:00:00 2001
developer483388c2023-03-08 13:52:15 +08002From: Shayne Chen <shayne.chen@mediatek.com>
3Date: Fri, 10 Feb 2023 17:39:23 +0800
developerde9ecce2023-05-22 11:17:16 +08004Subject: [PATCH 01/22] wifi: mt76: mt7996: add eht rx rate support
developer483388c2023-03-08 13:52:15 +08005
6Add support to report eht rx rate.
7
8Change-Id: Iee067d891bd634a918c942c2ba90ae72cd40c538
9Signed-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
16diff --git a/mac80211.c b/mac80211.c
developerde9ecce2023-05-22 11:17:16 +080017index 2c4a5290..467afef9 100644
developer483388c2023-03-08 13:52:15 +080018--- 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;
38diff --git a/mt76.h b/mt76.h
developerde9ecce2023-05-22 11:17:16 +080039index 8b4635e9..6b07b8fa 100644
developer483388c2023-03-08 13:52:15 +080040--- 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];
69diff --git a/mt7996/mac.c b/mt7996/mac.c
developerde9ecce2023-05-22 11:17:16 +080070index 0d51090d..23cbfdde 100644
developer483388c2023-03-08 13:52:15 +080071--- a/mt7996/mac.c
72+++ b/mt7996/mac.c
developerde9ecce2023-05-22 11:17:16 +080073@@ -580,11 +580,12 @@ mt7996_mac_fill_rx_rate(struct mt7996_dev *dev,
developer483388c2023-03-08 13:52:15 +080074 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--
developerde9ecce2023-05-22 11:17:16 +0800912.39.2
developer483388c2023-03-08 13:52:15 +080092