aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ieee80211.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-10-09 06:13:49 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:00:06 -0400
commitd9fe60dea7779d412b34679f1177c5ca1940ea8d (patch)
treea51e16b013f7c1d16ded502cb32c03872bcbfcaa /include/linux/ieee80211.h
parent40333e4fb476014cdd939d27e20eb54573172b32 (diff)
802.11: clean up/fix HT support
This patch cleans up a number of things: * the unusable definition of the HT capabilities/HT information information elements * variable names that are hard to understand * mac80211: move ieee80211_handle_ht to ht.c and remove the unused enable_ht parameter * mac80211: fix bug with MCS rate 32 in ieee80211_handle_ht * mac80211: fix bug with casting the result of ieee80211_bss_get_ie to an information element _contents_ rather than the whole element, add size checking (another out-of-bounds access bug fixed!) * mac80211: remove some unused return values in favour of BUG_ON checking * a few minor other things Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include/linux/ieee80211.h')
-rw-r--r--include/linux/ieee80211.h133
1 files changed, 95 insertions, 38 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 14126bc36641..64a4abce6d91 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -685,28 +685,88 @@ struct ieee80211_bar {
685#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000 685#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
686#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004 686#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
687 687
688
689#define IEEE80211_HT_MCS_MASK_LEN 10
690
691/**
692 * struct ieee80211_mcs_info - MCS information
693 * @rx_mask: RX mask
694 * @rx_highest: highest supported RX rate
695 * @tx_params: TX parameters
696 */
697struct ieee80211_mcs_info {
698 u8 rx_mask[IEEE80211_HT_MCS_MASK_LEN];
699 __le16 rx_highest;
700 u8 tx_params;
701 u8 reserved[3];
702} __attribute__((packed));
703
704/* 802.11n HT capability MSC set */
705#define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3ff
706#define IEEE80211_HT_MCS_TX_DEFINED 0x01
707#define IEEE80211_HT_MCS_TX_RX_DIFF 0x02
708/* value 0 == 1 stream etc */
709#define IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK 0x0C
710#define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT 2
711#define IEEE80211_HT_MCS_TX_MAX_STREAMS 4
712#define IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION 0x10
713
714/*
715 * 802.11n D5.0 20.3.5 / 20.6 says:
716 * - indices 0 to 7 and 32 are single spatial stream
717 * - 8 to 31 are multiple spatial streams using equal modulation
718 * [8..15 for two streams, 16..23 for three and 24..31 for four]
719 * - remainder are multiple spatial streams using unequal modulation
720 */
721#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START 33
722#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE \
723 (IEEE80211_HT_MCS_UNEQUAL_MODULATION_START / 8)
724
688/** 725/**
689 * struct ieee80211_ht_cap - HT capabilities 726 * struct ieee80211_ht_cap - HT capabilities
690 * 727 *
691 * This structure refers to "HT capabilities element" as 728 * This structure is the "HT capabilities element" as
692 * described in 802.11n draft section 7.3.2.52 729 * described in 802.11n D5.0 7.3.2.57
693 */ 730 */
694struct ieee80211_ht_cap { 731struct ieee80211_ht_cap {
695 __le16 cap_info; 732 __le16 cap_info;
696 u8 ampdu_params_info; 733 u8 ampdu_params_info;
697 u8 supp_mcs_set[16]; 734
735 /* 16 bytes MCS information */
736 struct ieee80211_mcs_info mcs;
737
698 __le16 extended_ht_cap_info; 738 __le16 extended_ht_cap_info;
699 __le32 tx_BF_cap_info; 739 __le32 tx_BF_cap_info;
700 u8 antenna_selection_info; 740 u8 antenna_selection_info;
701} __attribute__ ((packed)); 741} __attribute__ ((packed));
702 742
743/* 802.11n HT capabilities masks (for cap_info) */
744#define IEEE80211_HT_CAP_LDPC_CODING 0x0001
745#define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002
746#define IEEE80211_HT_CAP_SM_PS 0x000C
747#define IEEE80211_HT_CAP_GRN_FLD 0x0010
748#define IEEE80211_HT_CAP_SGI_20 0x0020
749#define IEEE80211_HT_CAP_SGI_40 0x0040
750#define IEEE80211_HT_CAP_TX_STBC 0x0080
751#define IEEE80211_HT_CAP_RX_STBC 0x0300
752#define IEEE80211_HT_CAP_DELAY_BA 0x0400
753#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
754#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
755#define IEEE80211_HT_CAP_PSMP_SUPPORT 0x2000
756#define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000
757#define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000
758
759/* 802.11n HT capability AMPDU settings (for ampdu_params_info) */
760#define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03
761#define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C
762
703/** 763/**
704 * struct ieee80211_ht_cap - HT additional information 764 * struct ieee80211_ht_info - HT information
705 * 765 *
706 * This structure refers to "HT information element" as 766 * This structure is the "HT information element" as
707 * described in 802.11n draft section 7.3.2.53 767 * described in 802.11n D5.0 7.3.2.58
708 */ 768 */
709struct ieee80211_ht_addt_info { 769struct ieee80211_ht_info {
710 u8 control_chan; 770 u8 control_chan;
711 u8 ht_param; 771 u8 ht_param;
712 __le16 operation_mode; 772 __le16 operation_mode;
@@ -714,36 +774,33 @@ struct ieee80211_ht_addt_info {
714 u8 basic_set[16]; 774 u8 basic_set[16];
715} __attribute__ ((packed)); 775} __attribute__ ((packed));
716 776
717/* 802.11n HT capabilities masks */ 777/* for ht_param */
718#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002 778#define IEEE80211_HT_PARAM_CHA_SEC_OFFSET 0x03
719#define IEEE80211_HT_CAP_SM_PS 0x000C 779#define IEEE80211_HT_PARAM_CHA_SEC_NONE 0x00
720#define IEEE80211_HT_CAP_GRN_FLD 0x0010 780#define IEEE80211_HT_PARAM_CHA_SEC_ABOVE 0x01
721#define IEEE80211_HT_CAP_SGI_20 0x0020 781#define IEEE80211_HT_PARAM_CHA_SEC_BELOW 0x03
722#define IEEE80211_HT_CAP_SGI_40 0x0040 782#define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY 0x04
723#define IEEE80211_HT_CAP_DELAY_BA 0x0400 783#define IEEE80211_HT_PARAM_RIFS_MODE 0x08
724#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 784#define IEEE80211_HT_PARAM_SPSMP_SUPPORT 0x10
725#define IEEE80211_HT_CAP_DSSSCCK40 0x1000 785#define IEEE80211_HT_PARAM_SERV_INTERVAL_GRAN 0xE0
726/* 802.11n HT capability AMPDU settings */ 786
727#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 787/* for operation_mode */
728#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C 788#define IEEE80211_HT_OP_MODE_PROTECTION 0x0003
729/* 802.11n HT capability MSC set */ 789#define IEEE80211_HT_OP_MODE_PROTECTION_NONE 0
730#define IEEE80211_SUPP_MCS_SET_UEQM 4 790#define IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER 1
731#define IEEE80211_HT_CAP_MAX_STREAMS 4 791#define IEEE80211_HT_OP_MODE_PROTECTION_20MHZ 2
732#define IEEE80211_SUPP_MCS_SET_LEN 10 792#define IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED 3
733/* maximum streams the spec allows */ 793#define IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT 0x0004
734#define IEEE80211_HT_CAP_MCS_TX_DEFINED 0x01 794#define IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT 0x0010
735#define IEEE80211_HT_CAP_MCS_TX_RX_DIFF 0x02 795
736#define IEEE80211_HT_CAP_MCS_TX_STREAMS 0x0C 796/* for stbc_param */
737#define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10 797#define IEEE80211_HT_STBC_PARAM_DUAL_BEACON 0x0040
738/* 802.11n HT IE masks */ 798#define IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT 0x0080
739#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03 799#define IEEE80211_HT_STBC_PARAM_STBC_BEACON 0x0100
740#define IEEE80211_HT_IE_CHA_SEC_NONE 0x00 800#define IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT 0x0200
741#define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01 801#define IEEE80211_HT_STBC_PARAM_PCO_ACTIVE 0x0400
742#define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03 802#define IEEE80211_HT_STBC_PARAM_PCO_PHASE 0x0800
743#define IEEE80211_HT_IE_CHA_WIDTH 0x04 803
744#define IEEE80211_HT_IE_HT_PROTECTION 0x0003
745#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
746#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
747 804
748/* block-ack parameters */ 805/* block-ack parameters */
749#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 806#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
@@ -949,7 +1006,7 @@ enum ieee80211_eid {
949 WLAN_EID_EXT_SUPP_RATES = 50, 1006 WLAN_EID_EXT_SUPP_RATES = 50,
950 /* 802.11n */ 1007 /* 802.11n */
951 WLAN_EID_HT_CAPABILITY = 45, 1008 WLAN_EID_HT_CAPABILITY = 45,
952 WLAN_EID_HT_EXTRA_INFO = 61, 1009 WLAN_EID_HT_INFORMATION = 61,
953 /* 802.11i */ 1010 /* 802.11i */
954 WLAN_EID_RSN = 48, 1011 WLAN_EID_RSN = 48,
955 WLAN_EID_WPA = 221, 1012 WLAN_EID_WPA = 221,