include/linux/ieee80211.h
changeset 2 d1f6d8b6f81c
parent 0 aa628870c1d3
equal deleted inserted replaced
1:0056487c491e 2:d1f6d8b6f81c
    10  * This program is free software; you can redistribute it and/or modify
    10  * This program is free software; you can redistribute it and/or modify
    11  * it under the terms of the GNU General Public License version 2 as
    11  * it under the terms of the GNU General Public License version 2 as
    12  * published by the Free Software Foundation.
    12  * published by the Free Software Foundation.
    13  */
    13  */
    14 
    14 
    15 #ifndef IEEE80211_H
    15 #ifndef LINUX_IEEE80211_H
    16 #define IEEE80211_H
    16 #define LINUX_IEEE80211_H
    17 
    17 
    18 #include <linux/types.h>
    18 #include <linux/types.h>
    19 #include <asm/byteorder.h>
    19 #include <asm/byteorder.h>
    20 
    20 
    21 #define FCS_LEN 4
    21 #define FCS_LEN 4
    95 #define IEEE80211_MAX_DATA_LEN		2304
    95 #define IEEE80211_MAX_DATA_LEN		2304
    96 /* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */
    96 /* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */
    97 #define IEEE80211_MAX_FRAME_LEN		2352
    97 #define IEEE80211_MAX_FRAME_LEN		2352
    98 
    98 
    99 #define IEEE80211_MAX_SSID_LEN		32
    99 #define IEEE80211_MAX_SSID_LEN		32
       
   100 
   100 #define IEEE80211_MAX_MESH_ID_LEN	32
   101 #define IEEE80211_MAX_MESH_ID_LEN	32
       
   102 #define IEEE80211_MESH_CONFIG_LEN	19
       
   103 
   101 #define IEEE80211_QOS_CTL_LEN		2
   104 #define IEEE80211_QOS_CTL_LEN		2
   102 #define IEEE80211_QOS_CTL_TID_MASK	0x000F
   105 #define IEEE80211_QOS_CTL_TID_MASK	0x000F
   103 #define IEEE80211_QOS_CTL_TAG1D_MASK	0x0007
   106 #define IEEE80211_QOS_CTL_TAG1D_MASK	0x0007
   104 
   107 
   105 struct ieee80211_hdr {
   108 struct ieee80211_hdr {
   664 	__le16 frame_control;
   667 	__le16 frame_control;
   665 	__le16 duration;
   668 	__le16 duration;
   666 	u8 ra[6];
   669 	u8 ra[6];
   667 } __attribute__ ((packed));
   670 } __attribute__ ((packed));
   668 
   671 
       
   672 struct ieee80211_pspoll {
       
   673 	__le16 frame_control;
       
   674 	__le16 aid;
       
   675 	u8 bssid[6];
       
   676 	u8 ta[6];
       
   677 } __attribute__ ((packed));
       
   678 
   669 /**
   679 /**
   670  * struct ieee80211_bar - HT Block Ack Request
   680  * struct ieee80211_bar - HT Block Ack Request
   671  *
   681  *
   672  * This structure refers to "HT BlockAckReq" as
   682  * This structure refers to "HT BlockAckReq" as
   673  * described in 802.11n draft section 7.2.1.7.1
   683  * described in 802.11n draft section 7.2.1.7.1
   683 
   693 
   684 /* 802.11 BAR control masks */
   694 /* 802.11 BAR control masks */
   685 #define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL     0x0000
   695 #define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL     0x0000
   686 #define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA  0x0004
   696 #define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA  0x0004
   687 
   697 
       
   698 
       
   699 #define IEEE80211_HT_MCS_MASK_LEN		10
       
   700 
       
   701 /**
       
   702  * struct ieee80211_mcs_info - MCS information
       
   703  * @rx_mask: RX mask
       
   704  * @rx_highest: highest supported RX rate
       
   705  * @tx_params: TX parameters
       
   706  */
       
   707 struct ieee80211_mcs_info {
       
   708 	u8 rx_mask[IEEE80211_HT_MCS_MASK_LEN];
       
   709 	__le16 rx_highest;
       
   710 	u8 tx_params;
       
   711 	u8 reserved[3];
       
   712 } __attribute__((packed));
       
   713 
       
   714 /* 802.11n HT capability MSC set */
       
   715 #define IEEE80211_HT_MCS_RX_HIGHEST_MASK	0x3ff
       
   716 #define IEEE80211_HT_MCS_TX_DEFINED		0x01
       
   717 #define IEEE80211_HT_MCS_TX_RX_DIFF		0x02
       
   718 /* value 0 == 1 stream etc */
       
   719 #define IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK	0x0C
       
   720 #define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT	2
       
   721 #define		IEEE80211_HT_MCS_TX_MAX_STREAMS	4
       
   722 #define IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION	0x10
       
   723 
       
   724 /*
       
   725  * 802.11n D5.0 20.3.5 / 20.6 says:
       
   726  * - indices 0 to 7 and 32 are single spatial stream
       
   727  * - 8 to 31 are multiple spatial streams using equal modulation
       
   728  *   [8..15 for two streams, 16..23 for three and 24..31 for four]
       
   729  * - remainder are multiple spatial streams using unequal modulation
       
   730  */
       
   731 #define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START 33
       
   732 #define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE \
       
   733 	(IEEE80211_HT_MCS_UNEQUAL_MODULATION_START / 8)
       
   734 
   688 /**
   735 /**
   689  * struct ieee80211_ht_cap - HT capabilities
   736  * struct ieee80211_ht_cap - HT capabilities
   690  *
   737  *
   691  * This structure refers to "HT capabilities element" as
   738  * This structure is the "HT capabilities element" as
   692  * described in 802.11n draft section 7.3.2.52
   739  * described in 802.11n D5.0 7.3.2.57
   693  */
   740  */
   694 struct ieee80211_ht_cap {
   741 struct ieee80211_ht_cap {
   695 	__le16 cap_info;
   742 	__le16 cap_info;
   696 	u8 ampdu_params_info;
   743 	u8 ampdu_params_info;
   697 	u8 supp_mcs_set[16];
   744 
       
   745 	/* 16 bytes MCS information */
       
   746 	struct ieee80211_mcs_info mcs;
       
   747 
   698 	__le16 extended_ht_cap_info;
   748 	__le16 extended_ht_cap_info;
   699 	__le32 tx_BF_cap_info;
   749 	__le32 tx_BF_cap_info;
   700 	u8 antenna_selection_info;
   750 	u8 antenna_selection_info;
   701 } __attribute__ ((packed));
   751 } __attribute__ ((packed));
   702 
   752 
   703 /**
   753 /* 802.11n HT capabilities masks (for cap_info) */
   704  * struct ieee80211_ht_cap - HT additional information
   754 #define IEEE80211_HT_CAP_LDPC_CODING		0x0001
   705  *
   755 #define IEEE80211_HT_CAP_SUP_WIDTH_20_40	0x0002
   706  * This structure refers to "HT information element" as
   756 #define IEEE80211_HT_CAP_SM_PS			0x000C
   707  * described in 802.11n draft section 7.3.2.53
   757 #define IEEE80211_HT_CAP_GRN_FLD		0x0010
   708  */
   758 #define IEEE80211_HT_CAP_SGI_20			0x0020
   709 struct ieee80211_ht_addt_info {
   759 #define IEEE80211_HT_CAP_SGI_40			0x0040
       
   760 #define IEEE80211_HT_CAP_TX_STBC		0x0080
       
   761 #define IEEE80211_HT_CAP_RX_STBC		0x0300
       
   762 #define IEEE80211_HT_CAP_DELAY_BA		0x0400
       
   763 #define IEEE80211_HT_CAP_MAX_AMSDU		0x0800
       
   764 #define IEEE80211_HT_CAP_DSSSCCK40		0x1000
       
   765 #define IEEE80211_HT_CAP_PSMP_SUPPORT		0x2000
       
   766 #define IEEE80211_HT_CAP_40MHZ_INTOLERANT	0x4000
       
   767 #define IEEE80211_HT_CAP_LSIG_TXOP_PROT		0x8000
       
   768 
       
   769 /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */
       
   770 #define IEEE80211_HT_AMPDU_PARM_FACTOR		0x03
       
   771 #define IEEE80211_HT_AMPDU_PARM_DENSITY		0x1C
       
   772 
       
   773 /**
       
   774  * struct ieee80211_ht_info - HT information
       
   775  *
       
   776  * This structure is the "HT information element" as
       
   777  * described in 802.11n D5.0 7.3.2.58
       
   778  */
       
   779 struct ieee80211_ht_info {
   710 	u8 control_chan;
   780 	u8 control_chan;
   711 	u8 ht_param;
   781 	u8 ht_param;
   712 	__le16 operation_mode;
   782 	__le16 operation_mode;
   713 	__le16 stbc_param;
   783 	__le16 stbc_param;
   714 	u8 basic_set[16];
   784 	u8 basic_set[16];
   715 } __attribute__ ((packed));
   785 } __attribute__ ((packed));
   716 
   786 
   717 /* 802.11n HT capabilities masks */
   787 /* for ht_param */
   718 #define IEEE80211_HT_CAP_SUP_WIDTH		0x0002
   788 #define IEEE80211_HT_PARAM_CHA_SEC_OFFSET		0x03
   719 #define IEEE80211_HT_CAP_SM_PS			0x000C
   789 #define		IEEE80211_HT_PARAM_CHA_SEC_NONE		0x00
   720 #define IEEE80211_HT_CAP_GRN_FLD		0x0010
   790 #define		IEEE80211_HT_PARAM_CHA_SEC_ABOVE	0x01
   721 #define IEEE80211_HT_CAP_SGI_20			0x0020
   791 #define		IEEE80211_HT_PARAM_CHA_SEC_BELOW	0x03
   722 #define IEEE80211_HT_CAP_SGI_40			0x0040
   792 #define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY		0x04
   723 #define IEEE80211_HT_CAP_DELAY_BA		0x0400
   793 #define IEEE80211_HT_PARAM_RIFS_MODE			0x08
   724 #define IEEE80211_HT_CAP_MAX_AMSDU		0x0800
   794 #define IEEE80211_HT_PARAM_SPSMP_SUPPORT		0x10
   725 #define IEEE80211_HT_CAP_DSSSCCK40		0x1000
   795 #define IEEE80211_HT_PARAM_SERV_INTERVAL_GRAN		0xE0
   726 /* 802.11n HT capability AMPDU settings */
   796 
   727 #define IEEE80211_HT_CAP_AMPDU_FACTOR		0x03
   797 /* for operation_mode */
   728 #define IEEE80211_HT_CAP_AMPDU_DENSITY		0x1C
   798 #define IEEE80211_HT_OP_MODE_PROTECTION			0x0003
   729 /* 802.11n HT capability MSC set */
   799 #define		IEEE80211_HT_OP_MODE_PROTECTION_NONE		0
   730 #define IEEE80211_SUPP_MCS_SET_UEQM		4
   800 #define		IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER	1
   731 #define IEEE80211_HT_CAP_MAX_STREAMS		4
   801 #define		IEEE80211_HT_OP_MODE_PROTECTION_20MHZ		2
   732 #define IEEE80211_SUPP_MCS_SET_LEN		10
   802 #define		IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED	3
   733 /* maximum streams the spec allows */
   803 #define IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT		0x0004
   734 #define IEEE80211_HT_CAP_MCS_TX_DEFINED		0x01
   804 #define IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT		0x0010
   735 #define IEEE80211_HT_CAP_MCS_TX_RX_DIFF		0x02
   805 
   736 #define IEEE80211_HT_CAP_MCS_TX_STREAMS		0x0C
   806 /* for stbc_param */
   737 #define IEEE80211_HT_CAP_MCS_TX_UEQM		0x10
   807 #define IEEE80211_HT_STBC_PARAM_DUAL_BEACON		0x0040
   738 /* 802.11n HT IE masks */
   808 #define IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT		0x0080
   739 #define IEEE80211_HT_IE_CHA_SEC_OFFSET		0x03
   809 #define IEEE80211_HT_STBC_PARAM_STBC_BEACON		0x0100
   740 #define IEEE80211_HT_IE_CHA_SEC_NONE	 	0x00
   810 #define IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT	0x0200
   741 #define IEEE80211_HT_IE_CHA_SEC_ABOVE 		0x01
   811 #define IEEE80211_HT_STBC_PARAM_PCO_ACTIVE		0x0400
   742 #define IEEE80211_HT_IE_CHA_SEC_BELOW 		0x03
   812 #define IEEE80211_HT_STBC_PARAM_PCO_PHASE		0x0800
   743 #define IEEE80211_HT_IE_CHA_WIDTH		0x04
   813 
   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 
   814 
   748 /* block-ack parameters */
   815 /* block-ack parameters */
   749 #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
   816 #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
   750 #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
   817 #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
   751 #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
   818 #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
   767 #define WLAN_HT_CAP_SM_PS_DISABLED	3
   834 #define WLAN_HT_CAP_SM_PS_DISABLED	3
   768 
   835 
   769 /* Authentication algorithms */
   836 /* Authentication algorithms */
   770 #define WLAN_AUTH_OPEN 0
   837 #define WLAN_AUTH_OPEN 0
   771 #define WLAN_AUTH_SHARED_KEY 1
   838 #define WLAN_AUTH_SHARED_KEY 1
   772 #define WLAN_AUTH_FAST_BSS_TRANSITION 2
       
   773 #define WLAN_AUTH_LEAP 128
   839 #define WLAN_AUTH_LEAP 128
   774 
   840 
   775 #define WLAN_AUTH_CHALLENGE_LEN 128
   841 #define WLAN_AUTH_CHALLENGE_LEN 128
   776 
   842 
   777 #define WLAN_CAPABILITY_ESS		(1<<0)
   843 #define WLAN_CAPABILITY_ESS		(1<<0)
   947 	/* 802.11g */
  1013 	/* 802.11g */
   948 	WLAN_EID_ERP_INFO = 42,
  1014 	WLAN_EID_ERP_INFO = 42,
   949 	WLAN_EID_EXT_SUPP_RATES = 50,
  1015 	WLAN_EID_EXT_SUPP_RATES = 50,
   950 	/* 802.11n */
  1016 	/* 802.11n */
   951 	WLAN_EID_HT_CAPABILITY = 45,
  1017 	WLAN_EID_HT_CAPABILITY = 45,
   952 	WLAN_EID_HT_EXTRA_INFO = 61,
  1018 	WLAN_EID_HT_INFORMATION = 61,
   953 	/* 802.11i */
  1019 	/* 802.11i */
   954 	WLAN_EID_RSN = 48,
  1020 	WLAN_EID_RSN = 48,
   955 	WLAN_EID_WPA = 221,
  1021 	WLAN_EID_WPA = 221,
   956 	WLAN_EID_GENERIC = 221,
  1022 	WLAN_EID_GENERIC = 221,
   957 	WLAN_EID_VENDOR_SPECIFIC = 221,
  1023 	WLAN_EID_VENDOR_SPECIFIC = 221,
   974 	WLAN_ACTION_SPCT_TPC_REQ = 2,
  1040 	WLAN_ACTION_SPCT_TPC_REQ = 2,
   975 	WLAN_ACTION_SPCT_TPC_RPRT = 3,
  1041 	WLAN_ACTION_SPCT_TPC_RPRT = 3,
   976 	WLAN_ACTION_SPCT_CHL_SWITCH = 4,
  1042 	WLAN_ACTION_SPCT_CHL_SWITCH = 4,
   977 };
  1043 };
   978 
  1044 
       
  1045 /*
       
  1046  * IEEE 802.11-2007 7.3.2.9 Country information element
       
  1047  *
       
  1048  * Minimum length is 8 octets, ie len must be evenly
       
  1049  * divisible by 2
       
  1050  */
       
  1051 
       
  1052 /* Although the spec says 8 I'm seeing 6 in practice */
       
  1053 #define IEEE80211_COUNTRY_IE_MIN_LEN	6
       
  1054 
       
  1055 /*
       
  1056  * For regulatory extension stuff see IEEE 802.11-2007
       
  1057  * Annex I (page 1141) and Annex J (page 1147). Also
       
  1058  * review 7.3.2.9.
       
  1059  *
       
  1060  * When dot11RegulatoryClassesRequired is true and the
       
  1061  * first_channel/reg_extension_id is >= 201 then the IE
       
  1062  * compromises of the 'ext' struct represented below:
       
  1063  *
       
  1064  *  - Regulatory extension ID - when generating IE this just needs
       
  1065  *    to be monotonically increasing for each triplet passed in
       
  1066  *    the IE
       
  1067  *  - Regulatory class - index into set of rules
       
  1068  *  - Coverage class - index into air propagation time (Table 7-27),
       
  1069  *    in microseconds, you can compute the air propagation time from
       
  1070  *    the index by multiplying by 3, so index 10 yields a propagation
       
  1071  *    of 10 us. Valid values are 0-31, values 32-255 are not defined
       
  1072  *    yet. A value of 0 inicates air propagation of <= 1 us.
       
  1073  *
       
  1074  *  See also Table I.2 for Emission limit sets and table
       
  1075  *  I.3 for Behavior limit sets. Table J.1 indicates how to map
       
  1076  *  a reg_class to an emission limit set and behavior limit set.
       
  1077  */
       
  1078 #define IEEE80211_COUNTRY_EXTENSION_ID 201
       
  1079 
       
  1080 /*
       
  1081  *  Channels numbers in the IE must be monotonically increasing
       
  1082  *  if dot11RegulatoryClassesRequired is not true.
       
  1083  *
       
  1084  *  If dot11RegulatoryClassesRequired is true consecutive
       
  1085  *  subband triplets following a regulatory triplet shall
       
  1086  *  have monotonically increasing first_channel number fields.
       
  1087  *
       
  1088  *  Channel numbers shall not overlap.
       
  1089  *
       
  1090  *  Note that max_power is signed.
       
  1091  */
       
  1092 struct ieee80211_country_ie_triplet {
       
  1093 	union {
       
  1094 		struct {
       
  1095 			u8 first_channel;
       
  1096 			u8 num_channels;
       
  1097 			s8 max_power;
       
  1098 		} __attribute__ ((packed)) chans;
       
  1099 		struct {
       
  1100 			u8 reg_extension_id;
       
  1101 			u8 reg_class;
       
  1102 			u8 coverage_class;
       
  1103 		} __attribute__ ((packed)) ext;
       
  1104 	};
       
  1105 } __attribute__ ((packed));
       
  1106 
   979 /* BACK action code */
  1107 /* BACK action code */
   980 enum ieee80211_back_actioncode {
  1108 enum ieee80211_back_actioncode {
   981 	WLAN_ACTION_ADDBA_REQ = 0,
  1109 	WLAN_ACTION_ADDBA_REQ = 0,
   982 	WLAN_ACTION_ADDBA_RESP = 1,
  1110 	WLAN_ACTION_ADDBA_RESP = 1,
   983 	WLAN_ACTION_DELBA = 2,
  1111 	WLAN_ACTION_DELBA = 2,
  1055 		return hdr->addr3;
  1183 		return hdr->addr3;
  1056 	else
  1184 	else
  1057 		return hdr->addr1;
  1185 		return hdr->addr1;
  1058 }
  1186 }
  1059 
  1187 
  1060 #endif /* IEEE80211_H */
  1188 #endif /* LINUX_IEEE80211_H */