svn commit: r310147 - in head/sys: net net80211

Adrian Chadd adrian at FreeBSD.org
Fri Dec 16 04:43:33 UTC 2016


Author: adrian
Date: Fri Dec 16 04:43:31 2016
New Revision: 310147
URL: https://svnweb.freebsd.org/changeset/base/310147

Log:
  [net80211] start laying down the foundation for 11ac support.
  
  This is a work in progress and some of this stuff may change;
  but hopefully I'm laying down enough stuff and space in fields
  to allow it to grow without another major recompile.
  
  We'll see!
  
  * Add a net80211 PHY type for VHT 2G and VHT 5G.
  
    Note - yes, VHT is supposed to be for 5GHZ, however some vendors
    (*cough* most of them) support some subset of VHT rate support
    in 2GHz.  No - not 80MHz wide channels, but at least some MCS8-9
    support, maybe some beamforming, and maybe some longer A-MPDU
    aggregates.  I don't want to even think about MU-MIMO on 2GHz.
  
  * Add an ifmedia placeholder type for VHT rates.
  
  * Add channel flags for VHT, VHT20/40U/40D/80/80+80/160
  * Add channel macros for the above
  * Add ieee80211_channel fields for the VHT information and flags,
    along with some padding (so this struct definitely grows.)
  * Add a phy type flag for VHT - 'v'
  
  * Bump the number of channels to a much higher amount - until we get
    something like the linux mac80211 chanctx abstraction (where the
    stack provides a current channel configuration via callbacks,
    versus the driver ever checking ic->ic_curchan or similar) we'll
    have to populate VHT+HT combinations.
  
  Eg, there'll likely be a full set of duplicate VHT20/40 channels to match
  HT channels.  There will also be a full set of duplicate VHT80 channels -
  note that for VHT80, its assumed you're doing VHT40 as a base, so we
  don't need a duplicate of VHT80 + 20MHz only primary channels, only
  a duplicate of all the VHT40 combinations.
  
  I don't want to think about VHT80+80 or VHT160 for now - and I won't,
  as the current device I'm doing 11ac bringup on (QCA9880) only does
  VHT80.
  
  I'll likely revisit the channel configuration and scanning related
  stuff after I get VHT20/40 up.
  
  * Add vht flags and the basic MCS rate setup to ieee80211com, ieee80211vap
    and ieee80211_node in preparation for 11ac configuration.
    There is zero code that uses this right now.
  * Whilst here, add some more placeholders in case I need to extend
    out things by some uint32_t flag sized fields.  Hopefully I won't!
  
  What I haven't yet done:
  
  * any of the code that uses this
  * any of the beamforming related fields
  * any of the MU-MIMO fields required for STA/AP operation
  * any of the IE fields in beacon frame / probe request/response handling
    and the calculations required for shifting beacon contents around
    when the TIM grows/shrinks
  
  This will require a full rebuild of net80211 related programs -
  ifconfig, hostapd, wpa_supplicant.

Modified:
  head/sys/net/if_media.h
  head/sys/net80211/_ieee80211.h
  head/sys/net80211/ieee80211_node.h
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/net/if_media.h
==============================================================================
--- head/sys/net/if_media.h	Fri Dec 16 04:38:53 2016	(r310146)
+++ head/sys/net/if_media.h	Fri Dec 16 04:43:31 2016	(r310147)
@@ -264,6 +264,7 @@ uint64_t	ifmedia_baudrate(int);
 #define	IFM_IEEE80211_OFDM27	23	/* OFDM 27Mbps */
 /* NB: not enough bits to express MCS fully */
 #define	IFM_IEEE80211_MCS	24	/* HT MCS rate */
+#define	IFM_IEEE80211_VHT	25	/* HT MCS rate */
 
 #define	IFM_IEEE80211_ADHOC	0x00000100	/* Operate in Adhoc mode */
 #define	IFM_IEEE80211_HOSTAP	0x00000200	/* Operate in Host AP mode */
@@ -280,6 +281,8 @@ uint64_t	ifmedia_baudrate(int);
 #define	IFM_IEEE80211_FH	0x00040000	/* 2Ghz, GFSK mode */
 #define	IFM_IEEE80211_11NA	0x00050000	/* 5Ghz, HT mode */
 #define	IFM_IEEE80211_11NG	0x00060000	/* 2Ghz, HT mode */
+#define	IFM_IEEE80211_VHT5G	0x00070000	/* 5Ghz, VHT mode */
+#define	IFM_IEEE80211_VHT2G	0x00080000	/* 2Ghz, VHT mode */
 
 /*
  * ATM

Modified: head/sys/net80211/_ieee80211.h
==============================================================================
--- head/sys/net80211/_ieee80211.h	Fri Dec 16 04:38:53 2016	(r310146)
+++ head/sys/net80211/_ieee80211.h	Fri Dec 16 04:43:31 2016	(r310147)
@@ -45,6 +45,7 @@ enum ieee80211_phytype {
 	IEEE80211_T_HT,			/* high throughput */
 	IEEE80211_T_OFDM_HALF,		/* 1/2 rate OFDM */
 	IEEE80211_T_OFDM_QUARTER,	/* 1/4 rate OFDM */
+	IEEE80211_T_VHT,		/* VHT PHY */
 };
 #define	IEEE80211_T_CCK	IEEE80211_T_DS	/* more common nomenclature */
 
@@ -68,8 +69,10 @@ enum ieee80211_phymode {
 	IEEE80211_MODE_11NG	= 9,	/* 2GHz, w/ HT */
 	IEEE80211_MODE_HALF	= 10,	/* OFDM, 1/2x clock */
 	IEEE80211_MODE_QUARTER	= 11,	/* OFDM, 1/4x clock */
+	IEEE80211_MODE_VHT_2GHZ	= 12,	/* 2GHz, VHT */
+	IEEE80211_MODE_VHT_5GHZ	= 13,	/* 5GHz, VHT */
 };
-#define	IEEE80211_MODE_MAX	(IEEE80211_MODE_QUARTER+1)
+#define	IEEE80211_MODE_MAX	(IEEE80211_MODE_VHT_5GHZ+1)
 #define	IEEE80211_MODE_BYTES	howmany(IEEE80211_MODE_MAX, NBBY)
 
 /*
@@ -134,7 +137,7 @@ enum ieee80211_roamingmode {
  */
 struct ieee80211_channel {
 	uint32_t	ic_flags;	/* see below */
-	uint16_t	ic_freq;	/* setting in MHz */
+	uint16_t	ic_freq;	/* primary centre frequency in MHz */
 	uint8_t		ic_ieee;	/* IEEE channel number */
 	int8_t		ic_maxregpower;	/* maximum regulatory tx power in dBm */
 	int8_t		ic_maxpower;	/* maximum tx power in .5 dBm */
@@ -144,9 +147,17 @@ struct ieee80211_channel {
 	int8_t		ic_maxantgain;	/* maximum antenna gain in .5 dBm */
 	uint8_t		ic_pad;
 	uint16_t	ic_devdata;	/* opaque device/driver data */
+	uint8_t		ic_vht_ch_freq1; /* VHT primary freq1 IEEE value */
+	uint8_t		ic_vht_ch_freq2; /* VHT secondary 80MHz freq2 IEEE value */
+	uint16_t	ic_freq2;	/* VHT secondary 80MHz freq2 MHz */
 };
 
-#define	IEEE80211_CHAN_MAX	256
+/*
+ * Note: for VHT operation we will need significantly more than
+ * IEEE80211_CHAN_MAX channels because of the combinations of
+ * VHT20, VHT40, VHT80, VHT80+80 and VHT160.
+ */
+#define	IEEE80211_CHAN_MAX	1024
 #define	IEEE80211_CHAN_BYTES	howmany(IEEE80211_CHAN_MAX, NBBY)
 #define	IEEE80211_CHAN_ANY	0xffff	/* token for ``any channel'' */
 #define	IEEE80211_CHAN_ANYC \
@@ -177,14 +188,26 @@ struct ieee80211_channel {
 #define	IEEE80211_CHAN_NOADHOC	0x00200000 /* adhoc mode not allowed */
 #define	IEEE80211_CHAN_NOHOSTAP	0x00400000 /* hostap mode not allowed */
 #define	IEEE80211_CHAN_11D	0x00800000 /* 802.11d required */
+#define	IEEE80211_CHAN_VHT20	0x01000000 /* VHT20 channel */
+#define	IEEE80211_CHAN_VHT40U	0x02000000 /* VHT40 channel, ext above */
+#define	IEEE80211_CHAN_VHT40D	0x04000000 /* VHT40 channel, ext below */
+#define	IEEE80211_CHAN_VHT80	0x08000000 /* VHT80 channel */
+#define	IEEE80211_CHAN_VHT80_80	0x10000000 /* VHT80+80 channel */
+#define	IEEE80211_CHAN_VHT160	0x20000000 /* VHT160 channel */
 
 #define	IEEE80211_CHAN_HT40	(IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D)
 #define	IEEE80211_CHAN_HT	(IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40)
 
+#define	IEEE80211_CHAN_VHT40	(IEEE80211_CHAN_VHT40U | IEEE80211_CHAN_VHT40D)
+#define	IEEE80211_CHAN_VHT	(IEEE80211_CHAN_VHT20 | IEEE80211_CHAN_VHT40 \
+				| IEEE80211_CHAN_VHT80 | IEEE80211_CHAN_VHT80_80 \
+				| IEEE80211_CHAN_VHT160)
+
 #define	IEEE80211_CHAN_BITS \
 	"\20\1PRIV0\2PRIV2\3PRIV3\4PRIV4\5TURBO\6CCK\7OFDM\0102GHZ\0115GHZ" \
 	"\12PASSIVE\13DYN\14GFSK\15GSM\16STURBO\17HALF\20QUARTER\21HT20" \
 	"\22HT40U\23HT40D\24DFS\0254MSXMIT\26NOADHOC\27NOHOSTAP\03011D"
+/* XXX TODO: add VHT bits */
 
 /*
  * Useful combinations of channel characteristics.
@@ -210,7 +233,7 @@ struct ieee80211_channel {
 	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_GFSK | \
 	 IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN | \
 	 IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER | \
-	 IEEE80211_CHAN_HT)
+	 IEEE80211_CHAN_HT | IEEE80211_CHAN_VHT)
 #define	IEEE80211_CHAN_ALLTURBO \
 	(IEEE80211_CHAN_ALL | IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)
 
@@ -287,6 +310,29 @@ struct ieee80211_channel {
 #define	IEEE80211_IS_CHAN_11D(_c) \
 	(((_c)->ic_flags & IEEE80211_CHAN_11D) != 0)
 
+#define	IEEE80211_IS_CHAN_VHT(_c) \
+	(((_c)->ic_flags & IEEE80211_CHAN_VHT) != 0)
+#define	IEEE80211_IS_CHAN_VHT20(_c) \
+	(((_c)->ic_flags & IEEE80211_CHAN_VHT20) != 0)
+#define	IEEE80211_IS_CHAN_VHT40(_c) \
+	(((_c)->ic_flags & IEEE80211_CHAN_VHT40) != 0)
+#define	IEEE80211_IS_CHAN_VHT40U(_c) \
+	(((_c)->ic_flags & IEEE80211_CHAN_VHT40U) != 0)
+#define	IEEE80211_IS_CHAN_VHT40D(_c) \
+	(((_c)->ic_flags & IEEE80211_CHAN_VHT40D) != 0)
+#define	IEEE80211_IS_CHAN_VHTA(_c) \
+	(IEEE80211_IS_CHAN_5GHZ(_c) && \
+	 ((_c)->ic_flags & IEEE80211_CHAN_VHT) != 0)
+#define	IEEE80211_IS_CHAN_VHTG(_c) \
+	(IEEE80211_IS_CHAN_2GHZ(_c) && \
+	 ((_c)->ic_flags & IEEE80211_CHAN_VHT) != 0)
+#define	IEEE80211_IS_CHAN_VHT80(_c) \
+	(((_c)->ic_flags & IEEE80211_CHAN_VHT80) != 0)
+#define	IEEE80211_IS_CHAN_VHT80_80(_c) \
+	(((_c)->ic_flags & IEEE80211_CHAN_VHT80_80) != 0)
+#define	IEEE80211_IS_CHAN_VHT160(_c) \
+	(((_c)->ic_flags & IEEE80211_CHAN_VHT160) != 0)
+
 #define	IEEE80211_CHAN2IEEE(_c)		(_c)->ic_ieee
 
 /* dynamic state */

Modified: head/sys/net80211/ieee80211_node.h
==============================================================================
--- head/sys/net80211/ieee80211_node.h	Fri Dec 16 04:38:53 2016	(r310146)
+++ head/sys/net80211/ieee80211_node.h	Fri Dec 16 04:43:31 2016	(r310147)
@@ -224,6 +224,15 @@ struct ieee80211_node {
 	struct ieee80211_tx_ampdu ni_tx_ampdu[WME_NUM_TID];
 	struct ieee80211_rx_ampdu ni_rx_ampdu[WME_NUM_TID];
 
+	/* VHT state */
+	uint32_t		ni_vhtcap;
+	uint32_t		ni_vhtinfo;
+	struct ieee80211_vht_mcs_info	ni_vht_mcsinfo;
+	uint8_t			ni_vht_chan1;	/* 20/40/80/160 - VHT chan1 */
+	uint8_t			ni_vht_chan2;	/* 80+80 - VHT chan2 */
+	uint16_t		ni_vht_pad1;
+	uint32_t		ni_vht_spare[8];
+
 	/* fast-frames state */
 	struct mbuf *		ni_tx_superg[WME_NUM_TID];
 

Modified: head/sys/net80211/ieee80211_var.h
==============================================================================
--- head/sys/net80211/ieee80211_var.h	Fri Dec 16 04:38:53 2016	(r310146)
+++ head/sys/net80211/ieee80211_var.h	Fri Dec 16 04:43:31 2016	(r310147)
@@ -229,6 +229,12 @@ struct ieee80211com {
 	uint8_t			ic_rxstream;    /* # RX streams */
 	uint8_t			ic_txstream;    /* # TX streams */
 
+	/* VHT information */
+	uint32_t		ic_vhtcaps;	/* VHT capabilities */
+	uint32_t		ic_vhtextcaps;	/* VHT extended capabilities (TODO) */
+	struct ieee80211_vht_mcs_info	iv_vht_mcsinfo; /* Support TX/RX VHT MCS */
+	uint32_t		ic_vht_spare[4];
+
 	/* optional state for Atheros SuperG protocol extensions */
 	struct ieee80211_superg	*ic_superg;
 
@@ -390,6 +396,13 @@ struct ieee80211vap {
 	int			iv_inact_run;	/* authorized setting */
 	int			iv_inact_probe;	/* inactive probe time */
 
+	/* VHT flags */
+	uint32_t		iv_flags_vht;	/* VHT state flags */
+	uint32_t		iv_vhtcaps;	/* VHT capabilities */
+	uint32_t		iv_vhtextcaps;	/* VHT extended capabilities (TODO) */
+	struct ieee80211_vht_mcs_info	iv_vht_mcsinfo;
+	uint32_t		iv_vht_spare[4];
+
 	int			iv_des_nssid;	/* # desired ssids */
 	struct ieee80211_scan_ssid iv_des_ssid[1];/* desired ssid table */
 	uint8_t			iv_des_bssid[IEEE80211_ADDR_LEN];


More information about the svn-src-head mailing list