Skip to content

Commit a8bdf8a

Browse files
authored
Support data rate and MCS (#67)
This commit adds support for 802.11n High Throughput (HT) mode with the following configuration: - PHY: 802.11n (HT) - Modulation: 64-QAM - Data Bandwidth: 20MHz - Spatial Streams: 4 The calculated data rate of 260 Mbps matches the expected value based on the 802.11n modulation table: - Data Subcarriers: 52 - Coded Bits per Subcarrier per Stream: 6 - Coding Rate: 5/6 - OFDM Symbol Duration: 3.2 μs - Guard Interval Duration: 0.8 μs
1 parent d6d83a8 commit a8bdf8a

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

vwifi.c

+31-3
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,9 @@ static int vwifi_get_station(struct wiphy *wiphy,
12191219
BIT_ULL(NL80211_STA_INFO_TX_BYTES) |
12201220
BIT_ULL(NL80211_STA_INFO_RX_BYTES) |
12211221
BIT_ULL(NL80211_STA_INFO_SIGNAL) |
1222-
BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME);
1222+
BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME) |
1223+
BIT_ULL(NL80211_STA_INFO_RX_BITRATE) |
1224+
BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
12231225

12241226
if (vif->sme_state == SME_CONNECTED) {
12251227
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CONNECTED_TIME);
@@ -1245,8 +1247,34 @@ static int vwifi_get_station(struct wiphy *wiphy,
12451247
/* For CFG80211_SIGNAL_TYPE_MBM, value is expressed in dBm */
12461248
sinfo->signal = rand_int_smooth(-100, -30, jiffies);
12471249
sinfo->inactive_time = jiffies_to_msecs(jiffies - vif->active_time);
1248-
/* TODO: Emulate rate and mcs */
1249-
1250+
/*
1251+
* Using 802.11n (HT) as the PHY, configure as follows:
1252+
*
1253+
* Modulation: 64-QAM
1254+
* Data Bandwidth: 20MHz
1255+
* Number of Spatial Streams: 4
1256+
*
1257+
* According to the 802.11n (HT) modulation table, we have:
1258+
*
1259+
* Number of Data Subcarriers: 52
1260+
* Number of Coded Bits per Subcarrier per Stream: 6
1261+
* Coding: 5/6
1262+
* OFDM Symbol Duration: 3.2 µs
1263+
* Guard Interval Duration: 0.8 µs
1264+
* Thus, the data rate is 260 Mbps.
1265+
* MCS table, Data Rate Formula :
1266+
* https://semfionetworks.com/blog/mcs-table-updated-with-80211ax-data-rates/
1267+
* IEEE 802.11n : https://zh.wikipedia.org/zh-tw/IEEE_802.11n
1268+
*/
1269+
sinfo->rxrate.flags |= RATE_INFO_FLAGS_MCS;
1270+
sinfo->rxrate.mcs = 31;
1271+
sinfo->rxrate.bw = RATE_INFO_BW_20;
1272+
sinfo->rxrate.n_bonded_ch = 1;
1273+
1274+
sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS;
1275+
sinfo->txrate.mcs = 31;
1276+
sinfo->txrate.bw = RATE_INFO_BW_20;
1277+
sinfo->txrate.n_bonded_ch = 1;
12501278
return 0;
12511279
}
12521280

0 commit comments

Comments
 (0)