diff --git a/sys/net/if_media.h b/sys/net/if_media.h index 86439950c32..19bf4686937 100644 --- a/sys/net/if_media.h +++ b/sys/net/if_media.h @@ -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 diff --git a/sys/net80211/_ieee80211.h b/sys/net80211/_ieee80211.h index 7a33b53a232..0faeeb4c8f9 100644 --- a/sys/net80211/_ieee80211.h +++ b/sys/net80211/_ieee80211.h @@ -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 */ diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h index 699247d658e..7a706731bb6 100644 --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -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]; diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index d8e20c2d631..358f2601188 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -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];