Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Jun 2021 16:35:51 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: b5d37e5a20ab - main - net80211/LinuxKPI: add more radiotap definitions
Message-ID:  <202106051635.155GZpgA009041@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=b5d37e5a20ab1b189499e2824dc269d998c31989

commit b5d37e5a20ab1b189499e2824dc269d998c31989
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2021-06-04 17:38:38 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2021-06-05 16:21:49 +0000

    net80211/LinuxKPI: add more radiotap definitions
    
    Add more raditap definitions based on "names" found in actual drivers
    and based on documentation from radiotap.org (where avail).
    
    Leave one specific "duplicate" in the LinuxKPI implementation but
    otherwise manage it all in net80211.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      10 days
    Reviewed by:    hselasky, adrian, sam
    Differential Revision: https://reviews.freebsd.org/D30641
---
 .../common/include/net/ieee80211_radiotap.h        |  55 +++++++++
 sys/net80211/ieee80211_radiotap.h                  | 134 +++++++++++++++++++++
 2 files changed, 189 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/net/ieee80211_radiotap.h b/sys/compat/linuxkpi/common/include/net/ieee80211_radiotap.h
new file mode 100644
index 000000000000..9c22e3e06988
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/net/ieee80211_radiotap.h
@@ -0,0 +1,55 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2020-2021 The FreeBSD Foundation
+ *
+ * This software was developed by Björn Zeeb under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef	__LKPI_NET_IEEE80211_RADIOTAP_H
+#define	__LKPI_NET_IEEE80211_RADIOTAP_H
+
+/* Any possibly duplicate content is only maintained in one place now. */
+#include <net80211/ieee80211_radiotap.h>
+
+/*
+ * This structure deviates from
+ * 'https://www.radiotap.org/fields/Vendor%20Namespace.html'
+ * and the net80211::ieee80211_radiotap_vendor_header version.
+ * We consider it LinuxKPI specific so it stays here.
+ */
+struct ieee80211_vendor_radiotap {
+	u32		present;
+	u8		align;
+	u8		oui[3];
+	u8		subns;
+	u8		pad;
+	__le16		len;
+	u8		data[0];
+};
+
+#endif	/* __LKPI_NET_IEEE80211_RADIOTAP_H */
diff --git a/sys/net80211/ieee80211_radiotap.h b/sys/net80211/ieee80211_radiotap.h
index f6e76e9fe8aa..bee1c633b53c 100644
--- a/sys/net80211/ieee80211_radiotap.h
+++ b/sys/net80211/ieee80211_radiotap.h
@@ -367,4 +367,138 @@ enum ieee80211_radiotap_type {
 #define	IEEE80211_RADIOTAP_VHT_BW_20UUL		24
 #define	IEEE80211_RADIOTAP_VHT_BW_20UUU		25
 
+/*
+ * These are found in various drivers already so use them rather than
+ * going by our own names and changing everything.
+ */
+
+/* https://www.radiotap.org/fields/VHT.html */
+#define	IEEE80211_RADIOTAP_VHT_KNOWN_STBC			0x0001	/* net80211::IEEE80211_RADIOTAP_VHT_HAVE_STBC */
+#define	IEEE80211_RADIOTAP_VHT_KNOWN_BEAMFORMED			0x0020	/* net80211::IEEE80211_RADIOTAP_VHT_HAVE_BF */
+
+/* https://www.radiotap.org/fields/0-length-PSDU.html */
+#define	IEEE80211_RADIOTAP_ZERO_LEN_PSDU_SOUNDING		0x00
+#define	IEEE80211_RADIOTAP_ZERO_LEN_PSDU_NOT_CAPTURED		0x01
+#define	IEEE80211_RADIOTAP_ZERO_LEN_PSDU_VENDOR			0xFF
+
+/* https://www.radiotap.org/fields/HE.html */
+struct ieee80211_radiotap_he {
+	uint16_t	data1, data2, data3, data4, data5, data6;
+};
+
+#define	IEEE80211_RADIOTAP_HE_DATA1_FORMAT_SU			0x0000
+#define	IEEE80211_RADIOTAP_HE_DATA1_FORMAT_EXT_SU		0x0001
+#define	IEEE80211_RADIOTAP_HE_DATA1_FORMAT_MU			0x0002
+#define	IEEE80211_RADIOTAP_HE_DATA1_FORMAT_TRIG			0x0003
+#define	IEEE80211_RADIOTAP_HE_DATA1_BSS_COLOR_KNOWN		0x0004
+#define	IEEE80211_RADIOTAP_HE_DATA1_BEAM_CHANGE_KNOWN		0x0008
+#define	IEEE80211_RADIOTAP_HE_DATA1_UL_DL_KNOWN			0x0010
+#define	IEEE80211_RADIOTAP_HE_DATA1_DATA_MCS_KNOWN		0x0020
+#define	IEEE80211_RADIOTAP_HE_DATA1_DATA_DCM_KNOWN		0x0040
+#define	IEEE80211_RADIOTAP_HE_DATA1_CODING_KNOWN		0x0080
+#define	IEEE80211_RADIOTAP_HE_DATA1_LDPC_XSYMSEG_KNOWN		0x0100
+#define	IEEE80211_RADIOTAP_HE_DATA1_STBC_KNOWN			0x0200
+#define	IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE_KNOWN		0x0400
+#define	IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE2_KNOWN		0x0800
+#define	IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE3_KNOWN		0x1000
+#define	IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE4_KNOWN		0x2000
+#define	IEEE80211_RADIOTAP_HE_DATA1_BW_RU_ALLOC_KNOWN		0x4000
+#define	IEEE80211_RADIOTAP_HE_DATA1_DOPPLER_KNOWN		0x8000
+
+#define	IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_KNOWN		0x0001
+#define	IEEE80211_RADIOTAP_HE_DATA2_GI_KNOWN			0x0002
+#define	IEEE80211_RADIOTAP_HE_DATA2_NUM_LTF_SYMS_KNOWN		0x0004
+#define	IEEE80211_RADIOTAP_HE_DATA2_PRE_FEC_PAD_KNOWN		0x0008
+#define	IEEE80211_RADIOTAP_HE_DATA2_TXBF_KNOWN			0x0010
+#define	IEEE80211_RADIOTAP_HE_DATA2_PE_DISAMBIG_KNOWN		0x0020
+#define	IEEE80211_RADIOTAP_HE_DATA2_TXOP_KNOWN			0x0040
+/* #define	IEEE80211_RADIOTAP_HE_DATA2_ midamble periodicity _KNOWN 0x0080 */
+#define	IEEE80211_RADIOTAP_HE_DATA2_RU_OFFSET			0x3F00
+#define	IEEE80211_RADIOTAP_HE_DATA2_RU_OFFSET_KNOWN		0x4000
+#define	IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_SEC		0x8000
+
+#define	IEEE80211_RADIOTAP_HE_DATA3_BSS_COLOR			0x003F
+#define	IEEE80211_RADIOTAP_HE_DATA3_BEAM_CHANGE			0x0040
+#define	IEEE80211_RADIOTAP_HE_DATA3_UL_DL			0x0080
+/* #deifne	IEEE80211_RADIOTAP_HE_DATA3_data_MCS		0x0F00 */
+/* #define	IEEE80211_RADIOTAP_HE_DATA3_data_DCM		0x1000 */
+/* #define	IEEE80211_RADIOTAP_HE_DATA3_Coding		0x2000 */
+#define	IEEE80211_RADIOTAP_HE_DATA3_LDPC_XSYMSEG		0x4000
+/* #define	IEEE80211_RADIOTAP_HE_DATA3_STBC		0x8000 */
+
+#define	IEEE80211_RADIOTAP_HE_DATA4_SU_MU_SPTL_REUSE		0x000F
+#define	IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE1		0x000F
+#define	IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE2		0x00F0
+#define	IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE3		0x0F00
+#define	IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE4		0xF000
+
+#define	IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE			0x00C0
+#define	IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE_1X			0x1
+#define	IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE_2X			0x2
+#define	IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE_4X			0x3
+#define	IEEE80211_RADIOTAP_HE_DATA5_NUM_LTF_SYMS		0x0700
+#define	IEEE80211_RADIOTAP_HE_DATA5_PRE_FEC_PAD			0x3000
+#define	IEEE80211_RADIOTAP_HE_DATA5_TXBF			0x4000
+#define	IEEE80211_RADIOTAP_HE_DATA5_PE_DISAMBIG			0x8000
+
+#define	IEEE80211_RADIOTAP_HE_DATA6_DOPPLER			0x0010
+/* 0x00e0 	(reserved) ; use these for the following undocumented. */
+#define	IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_KNOWN		0x0020
+#define	IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW			0x00C0
+#define	IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_20MHZ		0x0
+#define	IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_40MHZ		0x1
+#define	IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_80MHZ		0x2
+#define	IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_160MHZ		0x3
+#define	IEEE80211_RADIOTAP_HE_DATA6_TXOP			0x7F00
+
+/* https://www.radiotap.org/fields/HE-MU.html */
+struct ieee80211_radiotap_he_mu {
+	uint16_t	flags1;
+	uint16_t	flags2;
+	uint8_t		ru_ch1[4];
+	uint8_t		ru_ch2[4];
+};
+
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_MCS		0x000F
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_MCS_KNOWN		0x0010
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_DCM		0x0020
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_DCM_KNOWN		0x0040
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH2_CTR_26T_RU_KNOWN	0x0080
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_RU_KNOWN		0x0100
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH2_RU_KNOWN		0x0200
+/* reserved 							0x0C00 */
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_CTR_26T_RU_KNOWN	0x1000
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_CTR_26T_RU		0x2000
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_COMP_KNOWN	0x4000
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_SYMS_USERS_KNOWN	0x8000
+
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW	0x0003
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_20MHZ	0x0000
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_40MHZ	0x0001
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_80MHZ	0x0002
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_160MHZ	0x0003
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_KNOWN	0x0004
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_SIG_B_COMP		0x0008
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_SIG_B_SYMS_USERS	0x00F0
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_PUNC_FROM_SIG_A_BW	0x0300
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_PUNC_FROM_SIG_A_BW_KNOWN 0x0400
+#define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_CH2_CTR_26T_RU		0x0800
+
+/* https://www.radiotap.org/fields/L-SIG.html */
+struct ieee80211_radiotap_lsig {
+	uint16_t	data1;
+	uint16_t	data2;
+};
+#define	IEEE80211_RADIOTAP_LSIG_DATA1_LENGTH_KNOWN		0x0002
+
+#define	IEEE80211_RADIOTAP_LSIG_DATA2_LENGTH			0xFFF0
+
+/* https://www.radiotap.org/fields/MCS.html */
+#define	IEEE80211_RADIOTAP_MCS_HAVE_FEC				0x10
+#define	IEEE80211_RADIOTAP_MCS_HAVE_STBC			0x20
+
+/* https://www.radiotap.org/fields/timestamp.html */
+#define	IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US			0x01
+#define	IEEE80211_RADIOTAP_TIMESTAMP_SPOS_PLCP_SIG_ACQ		0x10
+
 #endif /* !_NET80211_IEEE80211_RADIOTAP_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106051635.155GZpgA009041>