Skip to content

Commit c3d1f87

Browse files
striebitjmberg-intel
authored andcommitted
mac80211: support reporting 0-length PSDU in radiotap
For certain sounding frames, it may be useful to report them to userspace even though they don't have a PSDU in order to determine the PHY parameters (e.g. VHT rate/stream config.) Add support for this to mac80211. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 62872a9 commit c3d1f87

3 files changed

Lines changed: 24 additions & 1 deletion

File tree

‎include/net/ieee80211_radiotap.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ enum ieee80211_radiotap_presence {
7575
IEEE80211_RADIOTAP_TIMESTAMP = 22,
7676
IEEE80211_RADIOTAP_HE = 23,
7777
IEEE80211_RADIOTAP_HE_MU = 24,
78+
IEEE80211_RADIOTAP_ZERO_LEN_PSDU = 26,
7879
IEEE80211_RADIOTAP_LSIG = 27,
7980

8081
/* valid in every it_present bitmap, even vendor namespaces */
@@ -340,6 +341,11 @@ struct ieee80211_radiotap_lsig {
340341
__le16 data1, data2;
341342
};
342343

344+
enum ieee80211_radiotap_zero_len_psdu_type {
345+
IEEE80211_RADIOTAP_ZERO_LEN_PSDU_SOUNDING = 0,
346+
IEEE80211_RADIOTAP_ZERO_LEN_PSDU_VENDOR = 0xff,
347+
};
348+
343349
/**
344350
* ieee80211_get_radiotap_len - get radiotap header length
345351
*/

‎include/net/mac80211.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,10 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
11421142
* @RX_FLAG_RADIOTAP_HE_MU: HE MU radiotap data is present
11431143
* (&struct ieee80211_radiotap_he_mu)
11441144
* @RX_FLAG_RADIOTAP_LSIG: L-SIG radiotap data is present
1145+
* @RX_FLAG_NO_PSDU: use the frame only for radiotap reporting, with
1146+
* the "0-length PSDU" field included there. The value for it is
1147+
* in &struct ieee80211_rx_status. Note that if this value isn't
1148+
* known the frame shouldn't be reported.
11451149
*/
11461150
enum mac80211_rx_flags {
11471151
RX_FLAG_MMIC_ERROR = BIT(0),
@@ -1173,6 +1177,7 @@ enum mac80211_rx_flags {
11731177
RX_FLAG_RADIOTAP_HE = BIT(26),
11741178
RX_FLAG_RADIOTAP_HE_MU = BIT(27),
11751179
RX_FLAG_RADIOTAP_LSIG = BIT(28),
1180+
RX_FLAG_NO_PSDU = BIT(29),
11761181
};
11771182

11781183
/**
@@ -1245,6 +1250,7 @@ enum mac80211_rx_encoding {
12451250
* @ampdu_reference: A-MPDU reference number, must be a different value for
12461251
* each A-MPDU but the same for each subframe within one A-MPDU
12471252
* @ampdu_delimiter_crc: A-MPDU delimiter CRC
1253+
* @zero_length_psdu_type: radiotap type of the 0-length PSDU
12481254
*/
12491255
struct ieee80211_rx_status {
12501256
u64 mactime;
@@ -1265,6 +1271,7 @@ struct ieee80211_rx_status {
12651271
u8 chains;
12661272
s8 chain_signal[IEEE80211_MAX_CHAINS];
12671273
u8 ampdu_delimiter_crc;
1274+
u8 zero_length_psdu_type;
12681275
};
12691276

12701277
/**

‎net/mac80211/rx.c‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ static inline bool should_drop_frame(struct sk_buff *skb, int present_fcs_len,
115115

116116
if (status->flag & (RX_FLAG_FAILED_FCS_CRC |
117117
RX_FLAG_FAILED_PLCP_CRC |
118-
RX_FLAG_ONLY_MONITOR))
118+
RX_FLAG_ONLY_MONITOR |
119+
RX_FLAG_NO_PSDU))
119120
return true;
120121

121122
if (unlikely(skb->len < 16 + present_fcs_len + rtap_space))
@@ -189,6 +190,9 @@ ieee80211_rx_radiotap_hdrlen(struct ieee80211_local *local,
189190
BUILD_BUG_ON(sizeof(struct ieee80211_radiotap_he_mu) != 12);
190191
}
191192

193+
if (status->flag & RX_FLAG_NO_PSDU)
194+
len += 1;
195+
192196
if (status->flag & RX_FLAG_RADIOTAP_LSIG) {
193197
len = ALIGN(len, 2);
194198
len += 4;
@@ -642,6 +646,12 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
642646
pos += sizeof(he_mu);
643647
}
644648

649+
if (status->flag & RX_FLAG_NO_PSDU) {
650+
rthdr->it_present |=
651+
cpu_to_le32(1 << IEEE80211_RADIOTAP_ZERO_LEN_PSDU);
652+
*pos++ = status->zero_length_psdu_type;
653+
}
654+
645655
if (status->flag & RX_FLAG_RADIOTAP_LSIG) {
646656
/* ensure 2 byte alignment */
647657
while ((pos - (u8 *)rthdr) & 1)

0 commit comments

Comments
 (0)