diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-10-09 06:13:49 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-10-31 19:00:06 -0400 |
commit | d9fe60dea7779d412b34679f1177c5ca1940ea8d (patch) | |
tree | a51e16b013f7c1d16ded502cb32c03872bcbfcaa /include | |
parent | 40333e4fb476014cdd939d27e20eb54573172b32 (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')
-rw-r--r-- | include/linux/ieee80211.h | 133 | ||||
-rw-r--r-- | include/net/mac80211.h | 12 | ||||
-rw-r--r-- | include/net/wireless.h | 15 |
3 files changed, 109 insertions, 51 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 | */ | ||
697 | struct 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 | */ |
694 | struct ieee80211_ht_cap { | 731 | struct 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 | */ |
709 | struct ieee80211_ht_addt_info { | 769 | struct 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, |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index d1466e7a47b8..2870f3973f1a 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -191,7 +191,7 @@ enum ieee80211_bss_change { | |||
191 | * @beacon_int: beacon interval | 191 | * @beacon_int: beacon interval |
192 | * @assoc_capability: capabilities taken from assoc resp | 192 | * @assoc_capability: capabilities taken from assoc resp |
193 | * @assoc_ht: association in HT mode | 193 | * @assoc_ht: association in HT mode |
194 | * @ht_conf: ht capabilities | 194 | * @ht_cap: ht capabilities |
195 | * @ht_bss_conf: ht extended capabilities | 195 | * @ht_bss_conf: ht extended capabilities |
196 | * @basic_rates: bitmap of basic rates, each bit stands for an | 196 | * @basic_rates: bitmap of basic rates, each bit stands for an |
197 | * index into the rate table configured by the driver in | 197 | * index into the rate table configured by the driver in |
@@ -212,7 +212,7 @@ struct ieee80211_bss_conf { | |||
212 | u64 basic_rates; | 212 | u64 basic_rates; |
213 | /* ht related data */ | 213 | /* ht related data */ |
214 | bool assoc_ht; | 214 | bool assoc_ht; |
215 | struct ieee80211_ht_info *ht_conf; | 215 | struct ieee80211_sta_ht_cap *ht_cap; |
216 | struct ieee80211_ht_bss_info *ht_bss_conf; | 216 | struct ieee80211_ht_bss_info *ht_bss_conf; |
217 | }; | 217 | }; |
218 | 218 | ||
@@ -477,7 +477,7 @@ static inline int __deprecated __IEEE80211_CONF_SHORT_SLOT_TIME(void) | |||
477 | * @antenna_sel_tx: transmit antenna selection, 0: default/diversity, | 477 | * @antenna_sel_tx: transmit antenna selection, 0: default/diversity, |
478 | * 1/2: antenna 0/1 | 478 | * 1/2: antenna 0/1 |
479 | * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx | 479 | * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx |
480 | * @ht_conf: describes current self configuration of 802.11n HT capabilies | 480 | * @ht_cap: describes current self configuration of 802.11n HT capabilities |
481 | * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters | 481 | * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters |
482 | * @channel: the channel to tune to | 482 | * @channel: the channel to tune to |
483 | */ | 483 | */ |
@@ -493,7 +493,7 @@ struct ieee80211_conf { | |||
493 | 493 | ||
494 | struct ieee80211_channel *channel; | 494 | struct ieee80211_channel *channel; |
495 | 495 | ||
496 | struct ieee80211_ht_info ht_conf; | 496 | struct ieee80211_sta_ht_cap ht_cap; |
497 | struct ieee80211_ht_bss_info ht_bss_conf; | 497 | struct ieee80211_ht_bss_info ht_bss_conf; |
498 | }; | 498 | }; |
499 | 499 | ||
@@ -687,7 +687,7 @@ enum set_key_cmd { | |||
687 | * @addr: MAC address | 687 | * @addr: MAC address |
688 | * @aid: AID we assigned to the station if we're an AP | 688 | * @aid: AID we assigned to the station if we're an AP |
689 | * @supp_rates: Bitmap of supported rates (per band) | 689 | * @supp_rates: Bitmap of supported rates (per band) |
690 | * @ht_info: HT capabilities of this STA | 690 | * @ht_cap: HT capabilities of this STA |
691 | * @drv_priv: data area for driver use, will always be aligned to | 691 | * @drv_priv: data area for driver use, will always be aligned to |
692 | * sizeof(void *), size is determined in hw information. | 692 | * sizeof(void *), size is determined in hw information. |
693 | */ | 693 | */ |
@@ -695,7 +695,7 @@ struct ieee80211_sta { | |||
695 | u64 supp_rates[IEEE80211_NUM_BANDS]; | 695 | u64 supp_rates[IEEE80211_NUM_BANDS]; |
696 | u8 addr[ETH_ALEN]; | 696 | u8 addr[ETH_ALEN]; |
697 | u16 aid; | 697 | u16 aid; |
698 | struct ieee80211_ht_info ht_info; | 698 | struct ieee80211_sta_ht_cap ht_cap; |
699 | 699 | ||
700 | /* must be last */ | 700 | /* must be last */ |
701 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); | 701 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); |
diff --git a/include/net/wireless.h b/include/net/wireless.h index 721efb363db7..c0aa0fb8db5e 100644 --- a/include/net/wireless.h +++ b/include/net/wireless.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/netdevice.h> | 10 | #include <linux/netdevice.h> |
11 | #include <linux/debugfs.h> | 11 | #include <linux/debugfs.h> |
12 | #include <linux/list.h> | 12 | #include <linux/list.h> |
13 | #include <linux/ieee80211.h> | ||
13 | #include <net/cfg80211.h> | 14 | #include <net/cfg80211.h> |
14 | 15 | ||
15 | /** | 16 | /** |
@@ -133,23 +134,23 @@ struct ieee80211_rate { | |||
133 | }; | 134 | }; |
134 | 135 | ||
135 | /** | 136 | /** |
136 | * struct ieee80211_ht_info - describing STA's HT capabilities | 137 | * struct ieee80211_sta_ht_cap - STA's HT capabilities |
137 | * | 138 | * |
138 | * This structure describes most essential parameters needed | 139 | * This structure describes most essential parameters needed |
139 | * to describe 802.11n HT capabilities for an STA. | 140 | * to describe 802.11n HT capabilities for an STA. |
140 | * | 141 | * |
141 | * @ht_supported: is HT supported by STA, 0: no, 1: yes | 142 | * @ht_supported: is HT supported by the STA |
142 | * @cap: HT capabilities map as described in 802.11n spec | 143 | * @cap: HT capabilities map as described in 802.11n spec |
143 | * @ampdu_factor: Maximum A-MPDU length factor | 144 | * @ampdu_factor: Maximum A-MPDU length factor |
144 | * @ampdu_density: Minimum A-MPDU spacing | 145 | * @ampdu_density: Minimum A-MPDU spacing |
145 | * @supp_mcs_set: Supported MCS set as described in 802.11n spec | 146 | * @mcs: Supported MCS rates |
146 | */ | 147 | */ |
147 | struct ieee80211_ht_info { | 148 | struct ieee80211_sta_ht_cap { |
148 | u16 cap; /* use IEEE80211_HT_CAP_ */ | 149 | u16 cap; /* use IEEE80211_HT_CAP_ */ |
149 | u8 ht_supported; | 150 | bool ht_supported; |
150 | u8 ampdu_factor; | 151 | u8 ampdu_factor; |
151 | u8 ampdu_density; | 152 | u8 ampdu_density; |
152 | u8 supp_mcs_set[16]; | 153 | struct ieee80211_mcs_info mcs; |
153 | }; | 154 | }; |
154 | 155 | ||
155 | /** | 156 | /** |
@@ -173,7 +174,7 @@ struct ieee80211_supported_band { | |||
173 | enum ieee80211_band band; | 174 | enum ieee80211_band band; |
174 | int n_channels; | 175 | int n_channels; |
175 | int n_bitrates; | 176 | int n_bitrates; |
176 | struct ieee80211_ht_info ht_info; | 177 | struct ieee80211_sta_ht_cap ht_cap; |
177 | }; | 178 | }; |
178 | 179 | ||
179 | /** | 180 | /** |