blob: c92c676f1572eccbdd6e2639e500d75db6754a92 [file] [log] [blame]
developer78848c62023-04-06 13:44:00 +08001From 8537ca664de3e26b266e4b11f5b113f76371507c Mon Sep 17 00:00:00 2001
developerf8871e82023-03-08 17:22:32 +08002From: Shayne Chen <shayne.chen@mediatek.com>
3Date: Fri, 10 Feb 2023 17:39:23 +0800
developerd5789dc2023-03-27 11:22:06 +08004Subject: [PATCH 01/29] wifi: mt76: mt7996: add eht rx rate support
developerf8871e82023-03-08 17:22:32 +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
developer78848c62023-04-06 13:44:00 +080017index 87902f4..e53166f 100644
developerf8871e82023-03-08 17:22:32 +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
developer78848c62023-04-06 13:44:00 +080039index 183b0fc..c3d1313 100644
developerf8871e82023-03-08 17:22:32 +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
developer78848c62023-04-06 13:44:00 +080070index 3c3506c..d811b4e 100644
developerf8871e82023-03-08 17:22:32 +080071--- a/mt7996/mac.c
72+++ b/mt7996/mac.c
73@@ -572,11 +572,12 @@ mt7996_mac_fill_rx_rate(struct mt7996_dev *dev,
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--
developer78848c62023-04-06 13:44:00 +0800912.18.0
developerf8871e82023-03-08 17:22:32 +080092