Skip to content

Commit 646e76b

Browse files
LorenzoBianconijmberg-intel
authored andcommitted
mac80211: parse VHT info in injected frames
Add VHT radiotap parsing support to ieee80211_parse_tx_radiotap(). That capability has been tested using a d-link dir-860l rev b1 running OpenWrt trunk and mt76 driver Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
1 parent 1948b2a commit 646e76b

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

Documentation/networking/mac80211-injection.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ radiotap headers and used to control injection:
4545
number of retries when either IEEE80211_RADIOTAP_RATE or
4646
IEEE80211_RADIOTAP_MCS was used
4747

48+
* IEEE80211_RADIOTAP_VHT
49+
50+
VHT mcs and number of streams used in the transmission (only for devices
51+
without own rate control). Also other fields are parsed
52+
53+
flags field
54+
IEEE80211_RADIOTAP_VHT_FLAG_SGI: use short guard interval
55+
56+
bandwidth field
57+
1: send using 40MHz channel width
58+
4: send using 80MHz channel width
59+
11: send using 160MHz channel width
60+
4861
The injection code can also skip all other currently defined radiotap fields
4962
facilitating replay of captured radiotap headers directly.
5063

net/mac80211/tx.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,6 +1692,8 @@ static bool ieee80211_parse_tx_radiotap(struct ieee80211_local *local,
16921692
u8 rate_retries = 0;
16931693
u16 rate_flags = 0;
16941694
u8 mcs_known, mcs_flags;
1695+
u16 vht_known;
1696+
u8 vht_mcs = 0, vht_nss = 0;
16951697
int i;
16961698

16971699
info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
@@ -1772,6 +1774,32 @@ static bool ieee80211_parse_tx_radiotap(struct ieee80211_local *local,
17721774
rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
17731775
break;
17741776

1777+
case IEEE80211_RADIOTAP_VHT:
1778+
vht_known = get_unaligned_le16(iterator.this_arg);
1779+
rate_found = true;
1780+
1781+
rate_flags = IEEE80211_TX_RC_VHT_MCS;
1782+
if ((vht_known & IEEE80211_RADIOTAP_VHT_KNOWN_GI) &&
1783+
(iterator.this_arg[2] &
1784+
IEEE80211_RADIOTAP_VHT_FLAG_SGI))
1785+
rate_flags |= IEEE80211_TX_RC_SHORT_GI;
1786+
if (vht_known &
1787+
IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH) {
1788+
if (iterator.this_arg[3] == 1)
1789+
rate_flags |=
1790+
IEEE80211_TX_RC_40_MHZ_WIDTH;
1791+
else if (iterator.this_arg[3] == 4)
1792+
rate_flags |=
1793+
IEEE80211_TX_RC_80_MHZ_WIDTH;
1794+
else if (iterator.this_arg[3] == 11)
1795+
rate_flags |=
1796+
IEEE80211_TX_RC_160_MHZ_WIDTH;
1797+
}
1798+
1799+
vht_mcs = iterator.this_arg[4] >> 4;
1800+
vht_nss = iterator.this_arg[4] & 0xF;
1801+
break;
1802+
17751803
/*
17761804
* Please update the file
17771805
* Documentation/networking/mac80211-injection.txt
@@ -1797,6 +1825,9 @@ static bool ieee80211_parse_tx_radiotap(struct ieee80211_local *local,
17971825

17981826
if (rate_flags & IEEE80211_TX_RC_MCS) {
17991827
info->control.rates[0].idx = rate;
1828+
} else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
1829+
ieee80211_rate_set_vht(info->control.rates, vht_mcs,
1830+
vht_nss);
18001831
} else {
18011832
for (i = 0; i < sband->n_bitrates; i++) {
18021833
if (rate * 5 != sband->bitrates[i].bitrate)

0 commit comments

Comments
 (0)