diff --git a/sys/compat/linuxkpi/common/include/linux/ieee80211.h b/sys/compat/linuxkpi/common/include/linux/ieee80211.h index 4259018a179a..9c65b4045cbe 100644 --- a/sys/compat/linuxkpi/common/include/linux/ieee80211.h +++ b/sys/compat/linuxkpi/common/include/linux/ieee80211.h @@ -1,743 +1,742 @@ /*- * Copyright (c) 2020-2021 The FreeBSD Foundation * * This software was developed by Björn Zeeb under sponsorship from * the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _LINUXKPI_LINUX_IEEE80211_H #define _LINUXKPI_LINUX_IEEE80211_H #include #include #include #include #include /* 9.4.2.55 Management MIC element (CMAC-256, GMAC-128, and GMAC-256). */ struct ieee80211_mmie_16 { uint8_t element_id; uint8_t length; uint16_t key_id; uint8_t ipn[6]; uint8_t mic[16]; }; #define IEEE80211_CCMP_HDR_LEN 8 /* 802.11i .. net80211 comment */ #define IEEE80211_CCMP_PN_LEN 6 #define IEEE80211_CCMP_MIC_LEN 8 /* || 16 */ #define IEEE80211_CCMP_256_HDR_LEN 8 #define IEEE80211_CCMP_256_MIC_LEN 16 #define IEEE80211_GCMP_HDR_LEN 8 #define IEEE80211_GCMP_MIC_LEN 16 #define IEEE80211_GCMP_PN_LEN 6 #define IEEE80211_GMAC_PN_LEN 6 #define IEEE80211_MAX_PN_LEN 16 #define IEEE80211_INVAL_HW_QUEUE ((uint8_t)-1) #define IEEE80211_MAX_AMPDU_BUF_HT 0x40 #define IEEE80211_MAX_AMPDU_BUF 256 /* for HE? */ #define IEEE80211_MAX_AMPDU_BUF_HE 256 #define IEEE80211_MAX_FRAME_LEN 2352 #define IEEE80211_MAX_DATA_LEN (2300 + IEEE80211_CRC_LEN) #define IEEE80211_MAX_MPDU_LEN_HT_BA 4095 /* 9.3.2.1 Format of Data frames; non-VHT non-DMG STA */ #define IEEE80211_MAX_MPDU_LEN_HT_3839 3839 #define IEEE80211_MAX_MPDU_LEN_HT_7935 7935 #define IEEE80211_MAX_MPDU_LEN_VHT_3895 3895 #define IEEE80211_MAX_MPDU_LEN_VHT_7991 7991 #define IEEE80211_MAX_MPDU_LEN_VHT_11454 11454 #define IEEE80211_MAX_RTS_THRESHOLD 2346 /* net80211::IEEE80211_RTS_MAX */ #define IEEE80211_MIN_ACTION_SIZE 23 /* ? */ /* Wi-Fi Peer-to-Peer (P2P) Technical Specification */ #define IEEE80211_P2P_OPPPS_CTWINDOW_MASK 0x7f #define IEEE80211_P2P_OPPPS_ENABLE_BIT BIT(7) /* 802.11-2016, 9.2.4.5.1, Table 9-6 QoS Control Field */ #define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 #define IEEE80211_QOS_CTL_TID_MASK IEEE80211_QOS_TID #define IEEE80211_QOS_CTL_EOSP 0x0010 #define IEEE80211_QOS_CTL_A_MSDU_PRESENT 0x0080 #define IEEE80211_QOS_CTL_ACK_POLICY_MASK 0x0060 #define IEEE80211_QOS_CTL_ACK_POLICY_NOACK 0x0020 #define IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT 0x0100 #define IEEE80211_RATE_SHORT_PREAMBLE BIT(0) enum ieee80211_rate_control_changed_flags { IEEE80211_RC_BW_CHANGED = BIT(0), IEEE80211_RC_NSS_CHANGED = BIT(1), IEEE80211_RC_SUPP_RATES_CHANGED = BIT(2), IEEE80211_RC_SMPS_CHANGED = BIT(3), }; #define IEEE80211_SCTL_FRAG IEEE80211_SEQ_FRAG_MASK #define IEEE80211_SCTL_SEQ IEEE80211_SEQ_SEQ_MASK #define IEEE80211_TKIP_ICV_LEN 4 #define IEEE80211_TKIP_IV_LEN 8 /* WEP + KID + EXT */ #define IEEE80211_VHT_EXT_NSS_BW_CAPABLE (1 << 13) /* assigned to tx_highest */ #define IEEE80211_VHT_MAX_AMPDU_1024K 7 /* 9.4.2.56.3 A-MPDU Parameters field, Table 9-163 */ #define IEEE80211_WEP_IV_LEN 3 /* net80211: IEEE80211_WEP_IVLEN */ #define IEEE80211_WEP_ICV_LEN 4 #define WLAN_AUTH_OPEN __LINE__ /* TODO FIXME brcmfmac */ #define WLAN_CAPABILITY_IBSS __LINE__ /* TODO FIXME no longer used? */ #define WLAN_CAPABILITY_SHORT_PREAMBLE __LINE__ /* TODO FIXME brcmfmac */ #define WLAN_CAPABILITY_SHORT_SLOT_TIME __LINE__ /* TODO FIXME brcmfmac */ enum wlan_ht_cap_sm_ps { WLAN_HT_CAP_SM_PS_STATIC = 0, WLAN_HT_CAP_SM_PS_DYNAMIC, WLAN_HT_CAP_SM_PS_INVALID, WLAN_HT_CAP_SM_PS_DISABLED, }; #define WLAN_MAX_KEY_LEN 32 /* TODO FIXME brcmfmac */ #define WLAN_PMKID_LEN 16 /* TODO FIXME brcmfmac */ #define WLAN_KEY_LEN_WEP40 5 #define WLAN_KEY_LEN_WEP104 13 +#define WLAN_KEY_LEN_TKIP 32 #define WLAN_KEY_LEN_CCMP 16 +#define WLAN_KEY_LEN_GCMP 16 #define WLAN_KEY_LEN_GCMP_256 32 /* 802.11-2020, 9.4.2.55.3, Table 9-185 Subfields of the A-MPDU Parameters field */ enum ieee80211_min_mpdu_start_spacing { IEEE80211_HT_MPDU_DENSITY_NONE = 0, #if 0 IEEE80211_HT_MPDU_DENSITY_XXX = 1, /* 1/4 us */ IEEE80211_HT_MPDU_DENSITY_YYY = 2, /* 1/2 us */ #endif IEEE80211_HT_MPDU_DENSITY_1 = 3, /* 1 us */ IEEE80211_HT_MPDU_DENSITY_2 = 4, /* 2 us */ IEEE80211_HT_MPDU_DENSITY_4 = 5, /* 4us */ IEEE80211_HT_MPDU_DENSITY_8 = 6, /* 8us */ IEEE80211_HT_MPDU_DENSITY_16 = 7, /* 16us */ }; /* 9.4.2.57, Table 9-168, HT Operation element fields and subfields */ #define IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT 0x0080 /* B24.. */ #define IEEE80211_FCTL_FTYPE IEEE80211_FC0_TYPE_MASK #define IEEE80211_FCTL_STYPE IEEE80211_FC0_SUBTYPE_MASK #define IEEE80211_FCTL_ORDER (IEEE80211_FC1_ORDER << 8) #define IEEE80211_FCTL_PROTECTED (IEEE80211_FC1_PROTECTED << 8) #define IEEE80211_FCTL_FROMDS (IEEE80211_FC1_DIR_FROMDS << 8) #define IEEE80211_FCTL_TODS (IEEE80211_FC1_DIR_TODS << 8) #define IEEE80211_FCTL_MOREFRAGS (IEEE80211_FC1_MORE_FRAG << 8) #define IEEE80211_FTYPE_MGMT IEEE80211_FC0_TYPE_MGT #define IEEE80211_FTYPE_CTL IEEE80211_FC0_TYPE_CTL #define IEEE80211_FTYPE_DATA IEEE80211_FC0_TYPE_DATA #define IEEE80211_STYPE_ASSOC_REQ IEEE80211_FC0_SUBTYPE_ASSOC_REQ #define IEEE80211_STYPE_REASSOC_REQ IEEE80211_FC0_SUBTYPE_REASSOC_REQ #define IEEE80211_STYPE_PROBE_REQ IEEE80211_FC0_SUBTYPE_PROBE_REQ #define IEEE80211_STYPE_DISASSOC IEEE80211_FC0_SUBTYPE_DISASSOC #define IEEE80211_STYPE_AUTH IEEE80211_FC0_SUBTYPE_AUTH #define IEEE80211_STYPE_DEAUTH IEEE80211_FC0_SUBTYPE_DEAUTH #define IEEE80211_STYPE_ACTION IEEE80211_FC0_SUBTYPE_ACTION #define IEEE80211_STYPE_QOS_DATA IEEE80211_FC0_SUBTYPE_QOS_DATA #define IEEE80211_NUM_ACS 4 /* net8021::WME_NUM_AC */ #define IEEE80211_MAX_SSID_LEN 32 /* 9.4.2.2 SSID element, net80211: IEEE80211_NWID_LEN */ /* Figure 9-27, BAR Control field */ #define IEEE80211_BAR_CTRL_TID_INFO_MASK 0xf000 #define IEEE80211_BAR_CTRL_TID_INFO_SHIFT 12 #define IEEE80211_PPE_THRES_INFO_PPET_SIZE 1 /* TODO FIXME ax? */ #define IEEE80211_PPE_THRES_NSS_MASK 2 /* TODO FIXME ax? */ #define IEEE80211_PPE_THRES_RU_INDEX_BITMASK_POS 3 /* TODO FIXME ax? */ #define IEEE80211_PPE_THRES_RU_INDEX_BITMASK_MASK 8 /* TODO FIXME ax? */ #define IEEE80211_HE_PPE_THRES_INFO_HEADER_SIZE 16 /* TODO FIXME ax? */ #define IEEE80211_HT_OP_MODE_PROTECTION 0x03 /* MASK */ #define IEEE80211_HT_OP_MODE_PROTECTION_NONE 0x00 #define IEEE80211_HT_OP_MODE_PROTECTION_20MHZ 0x01 #define IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED 0x02 #define IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER 0x03 /* 9.6.13.1, Table 9-342 TDLS Action field values. */ enum ieee80211_tdls_action_code { WLAN_TDLS_SETUP_REQUEST = 0, WLAN_TDLS_SETUP_RESPONSE = 1, WLAN_TDLS_SETUP_CONFIRM = 2, WLAN_TDLS_TEARDOWN = 3, WLAN_TDLS_PEER_TRAFFIC_INDICATION = 4, WLAN_TDLS_CHANNEL_SWITCH_REQUEST = 5, WLAN_TDLS_CHANNEL_SWITCH_RESPONSE = 6, WLAN_TDLS_PEER_PSM_REQUEST = 7, WLAN_TDLS_PEER_PSM_RESPONSE = 8, WLAN_TDLS_PEER_TRAFFIC_RESPONSE = 9, WLAN_TDLS_DISCOVERY_REQUEST = 10, /* 11-255 reserved */ }; /* 9.4.2.27, Table 9-135. Extended Capabilities field. */ /* This is split up into octets CAPA1 = octet 1, ... */ #define WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING BIT(2 % 8) #define WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT BIT(22 % 8) #define WLAN_EXT_CAPA8_OPMODE_NOTIF BIT(62 % 8) #define WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT BIT(5) /* XXX */ #define WLAN_EXT_CAPA10_OBSS_NARROW_BW_RU_TOLERANCE_SUPPORT BIT(7) /* XXX */ #define WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT BIT(6) /* XXX */ /* iwlwifi/mvm/utils:: for (ac = IEEE80211_AC_VO; ac <= IEEE80211_AC_VI; ac++) */ /* Would be so much easier if we'd define constants to the same. */ enum ieee80211_ac_numbers { IEEE80211_AC_VO = 0, /* net80211::WME_AC_VO */ IEEE80211_AC_VI = 1, /* net80211::WME_AC_VI */ IEEE80211_AC_BE = 2, /* net80211::WME_AC_BE */ IEEE80211_AC_BK = 3, /* net80211::WME_AC_BK */ }; #define IEEE80211_MAX_QUEUES 16 /* Assume IEEE80211_NUM_TIDS for the moment. */ #define IEEE80211_WMM_IE_STA_QOSINFO_AC_VO 1 #define IEEE80211_WMM_IE_STA_QOSINFO_AC_VI 2 #define IEEE80211_WMM_IE_STA_QOSINFO_AC_BK 4 #define IEEE80211_WMM_IE_STA_QOSINFO_AC_BE 8 #define IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL 0xf /* XXX net80211 calls these IEEE80211_HTCAP_* */ #define IEEE80211_HT_CAP_LDPC_CODING 0x0001 /* IEEE80211_HTCAP_LDPC */ #define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002 /* IEEE80211_HTCAP_CHWIDTH40 */ +#define IEEE80211_HT_CAP_SM_PS 0x000c /* IEEE80211_HTCAP_SMPS */ +#define IEEE80211_HT_CAP_SM_PS_SHIFT 2 #define IEEE80211_HT_CAP_GRN_FLD 0x0010 /* IEEE80211_HTCAP_GREENFIELD */ #define IEEE80211_HT_CAP_SGI_20 0x0020 /* IEEE80211_HTCAP_SHORTGI20 */ #define IEEE80211_HT_CAP_SGI_40 0x0040 /* IEEE80211_HTCAP_SHORTGI40 */ #define IEEE80211_HT_CAP_TX_STBC 0x0080 /* IEEE80211_HTCAP_TXSTBC */ #define IEEE80211_HT_CAP_RX_STBC 0x0100 /* IEEE80211_HTCAP_RXSTBC */ #define IEEE80211_HT_CAP_RX_STBC_SHIFT 8 /* IEEE80211_HTCAP_RXSTBC_S */ #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 /* IEEE80211_HTCAP_MAXAMSDU */ #define IEEE80211_HT_CAP_DSSSCCK40 0x1000 /* IEEE80211_HTCAP_DSSSCCK40 */ -#define IEEE80211_HT_CAP_SM_PS 0x000c /* IEEE80211_HTCAP_SMPS */ -#define IEEE80211_HT_CAP_SM_PS_SHIFT 2 #define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000 /* IEEE80211_HTCAP_LSIGTXOPPROT */ #define IEEE80211_HT_MCS_TX_DEFINED 0x0001 #define IEEE80211_HT_MCS_TX_RX_DIFF 0x0002 #define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT 2 #define IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK 0x0c #define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3ff #define IEEE80211_HT_MCS_MASK_LEN 10 struct ieee80211_mcs_info { uint8_t rx_mask[IEEE80211_HT_MCS_MASK_LEN]; uint16_t rx_highest; uint8_t tx_params; uint8_t __reserved[3]; }; -struct vht_mcs { - uint16_t rx_mcs_map; - uint16_t rx_highest; - uint16_t tx_mcs_map; - uint16_t tx_highest; -}; - /* 802.11-2020, 9.4.2.55.1 HT Capabilities element structure */ struct ieee80211_ht_cap { uint16_t cap_info; uint8_t ampdu_params_info; struct ieee80211_mcs_info mcs; uint16_t extended_ht_cap_info; uint32_t tx_BF_cap_info; uint8_t antenna_selection_info; }; -struct ieee80211_vht_cap { - __le32 vht_cap_info; - struct vht_mcs supp_mcs; -}; - #define IEEE80211_HT_MAX_AMPDU_FACTOR 13 enum ieee80211_ht_max_ampdu_len { IEEE80211_HT_MAX_AMPDU_64K }; enum ieee80211_ampdu_mlme_action { IEEE80211_AMPDU_RX_START, IEEE80211_AMPDU_RX_STOP, IEEE80211_AMPDU_TX_OPERATIONAL, IEEE80211_AMPDU_TX_START, IEEE80211_AMPDU_TX_STOP_CONT, IEEE80211_AMPDU_TX_STOP_FLUSH, IEEE80211_AMPDU_TX_STOP_FLUSH_CONT }; #define IEEE80211_AMPDU_TX_START_IMMEDIATE 1 #define IEEE80211_AMPDU_TX_START_DELAY_ADDBA 2 enum ieee80211_chanctx_switch_mode { CHANCTX_SWMODE_REASSIGN_VIF, CHANCTX_SWMODE_SWAP_CONTEXTS, }; enum ieee80211_chanctx_change_flags { IEEE80211_CHANCTX_CHANGE_MIN_WIDTH = BIT(0), IEEE80211_CHANCTX_CHANGE_RADAR = BIT(1), IEEE80211_CHANCTX_CHANGE_RX_CHAINS = BIT(2), IEEE80211_CHANCTX_CHANGE_WIDTH = BIT(3), IEEE80211_CHANCTX_CHANGE_CHANNEL = BIT(4), }; enum ieee80211_frame_release_type { IEEE80211_FRAME_RELEASE_PSPOLL = 1, IEEE80211_FRAME_RELEASE_UAPSD = 2, }; enum ieee80211_p2p_attr_ids { IEEE80211_P2P_ATTR_DEVICE_ID, IEEE80211_P2P_ATTR_DEVICE_INFO, IEEE80211_P2P_ATTR_GROUP_ID, IEEE80211_P2P_ATTR_LISTEN_CHANNEL, IEEE80211_P2P_ATTR_ABSENCE_NOTICE, }; enum ieee80211_reconfig_type { IEEE80211_RECONFIG_TYPE_RESTART, IEEE80211_RECONFIG_TYPE_SUSPEND, }; enum ieee80211_roc_type { IEEE80211_ROC_TYPE_MGMT_TX, IEEE80211_ROC_TYPE_NORMAL, }; enum ieee80211_smps_mode { IEEE80211_SMPS_OFF, IEEE80211_SMPS_STATIC, IEEE80211_SMPS_DYNAMIC, IEEE80211_SMPS_AUTOMATIC, IEEE80211_SMPS_NUM_MODES, }; /* net80211::IEEE80211_S_* different but represents the state machine. */ /* Note: order here is important! */ enum ieee80211_sta_state { IEEE80211_STA_NOTEXIST, IEEE80211_STA_NONE, IEEE80211_STA_AUTH, IEEE80211_STA_ASSOC, IEEE80211_STA_AUTHORIZED, /* 802.1x */ }; enum ieee80211_sta_rx_bw { IEEE80211_STA_RX_BW_20, IEEE80211_STA_RX_BW_40, IEEE80211_STA_RX_BW_80, IEEE80211_STA_RX_BW_160, IEEE80211_STA_RX_BW_320, }; enum ieee80211_tx_info_flags { /* XXX TODO .. right shift numbers - not sure where that came from? */ IEEE80211_TX_CTL_AMPDU = BIT(0), IEEE80211_TX_CTL_ASSIGN_SEQ = BIT(1), IEEE80211_TX_CTL_NO_ACK = BIT(2), IEEE80211_TX_CTL_SEND_AFTER_DTIM = BIT(3), IEEE80211_TX_CTL_TX_OFFCHAN = BIT(4), IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(5), IEEE80211_TX_STATUS_EOSP = BIT(6), IEEE80211_TX_STAT_ACK = BIT(7), IEEE80211_TX_STAT_AMPDU = BIT(8), IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(9), IEEE80211_TX_STAT_TX_FILTERED = BIT(10), IEEE80211_TX_STAT_NOACK_TRANSMITTED = BIT(11), IEEE80211_TX_CTL_FIRST_FRAGMENT = BIT(12), IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(13), IEEE80211_TX_CTL_NO_CCK_RATE = BIT(14), IEEE80211_TX_CTL_INJECTED = BIT(15), IEEE80211_TX_CTL_HW_80211_ENCAP = BIT(16), IEEE80211_TX_CTL_USE_MINRATE = BIT(17), IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(18), }; enum ieee80211_tx_control_flags { /* XXX TODO .. right shift numbers */ IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0), IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1), }; enum ieee80211_tx_rate_flags { /* XXX TODO .. right shift numbers */ IEEE80211_TX_RC_40_MHZ_WIDTH = BIT(0), IEEE80211_TX_RC_80_MHZ_WIDTH = BIT(1), IEEE80211_TX_RC_160_MHZ_WIDTH = BIT(2), IEEE80211_TX_RC_GREEN_FIELD = BIT(3), IEEE80211_TX_RC_MCS = BIT(4), IEEE80211_TX_RC_SHORT_GI = BIT(5), IEEE80211_TX_RC_VHT_MCS = BIT(6), IEEE80211_TX_RC_USE_SHORT_PREAMBLE = BIT(7), }; #define IEEE80211_HT_CTL_LEN 4 struct ieee80211_hdr { /* net80211::ieee80211_frame_addr4 */ __le16 frame_control; __le16 duration_id; uint8_t addr1[ETH_ALEN]; uint8_t addr2[ETH_ALEN]; uint8_t addr3[ETH_ALEN]; __le16 seq_ctrl; uint8_t addr4[ETH_ALEN]; }; struct ieee80211_hdr_3addr { /* net80211::ieee80211_frame */ __le16 frame_control; __le16 duration_id; uint8_t addr1[ETH_ALEN]; uint8_t addr2[ETH_ALEN]; uint8_t addr3[ETH_ALEN]; __le16 seq_ctrl; }; struct ieee80211_vendor_ie { }; /* 802.11-2020, Table 9-359-Block Ack Action field values */ enum ieee80211_back { WLAN_ACTION_ADDBA_REQ = 0, }; /* 802.11-2020, Table 9-51-Category values */ enum ieee80211_category { WLAN_CATEGORY_BACK = 3, }; -/* 9.3.3.2 Format of Management frames */ +/* 80211-2020 9.3.3.2 Format of Management frames */ struct ieee80211_mgmt { __le16 frame_control; __le16 duration_id; uint8_t da[ETH_ALEN]; uint8_t sa[ETH_ALEN]; uint8_t bssid[ETH_ALEN]; __le16 seq_ctrl; union { /* 9.3.3.3 Beacon frame format */ struct { uint64_t timestamp; uint16_t beacon_int; uint16_t capab_info; uint8_t variable[0]; } beacon; /* 9.3.3.10 Probe Request frame format */ struct { uint8_t variable[0]; } probe_req; /* 9.3.3.11 Probe Response frame format */ struct { uint64_t timestamp; uint16_t beacon_int; uint16_t capab_info; uint8_t variable[0]; } probe_resp; /* 9.3.3.14 Action frame format */ struct { /* 9.4.1.11 Action field */ uint8_t category; /* 9.6.8 Public Action details */ union { + /* 9.6.2.5 TPC Report frame format */ + struct { + uint8_t spec_mgmt; + uint8_t dialog_token; + /* uint32_t tpc_rep_elem:: */ + uint8_t tpc_elem_id; + uint8_t tpc_elem_length; + uint8_t tpc_elem_tx_power; + uint8_t tpc_elem_link_margin; + } tpc_report; /* 9.6.8.33 Fine Timing Measurement frame format */ struct { uint8_t dialog_token; uint8_t follow_up; uint8_t tod[6]; uint8_t toa[6]; uint16_t tod_error; uint16_t toa_error; uint8_t variable[0]; } ftm; /* 802.11-2016, 9.6.5.2 ADDBA Request frame format */ struct { uint8_t action_code; uint8_t dialog_token; uint16_t capab; uint16_t timeout; uint16_t start_seq_num; /* Optional follows... */ uint8_t variable[0]; } addba_req; } u; } action; } u; }; #define MHZ_TO_KHZ(_f) ((_f) * 1000) #define DBI_TO_MBI(_g) ((_g) * 100) #define MBI_TO_DBI(_x) ((_x) / 100) #define DBM_TO_MBM(_g) ((_g) * 100) #define MBM_TO_DBM(_x) ((_x) / 100) #define IEEE80211_SEQ_TO_SN(_seqn) (((_seqn) & IEEE80211_SEQ_SEQ_MASK) >> \ IEEE80211_SEQ_SEQ_SHIFT) /* Time unit (TU) to .. See net80211: IEEE80211_DUR_TU */ #define TU_TO_JIFFIES(_tu) (usecs_to_jiffies(_tu) * 1024) #define TU_TO_EXP_TIME(_tu) (jiffies + TU_TO_JIFFIES(_tu)) /* 9.4.2.21.1, Table 9-82. */ #define IEEE80211_SPCT_MSR_RPRT_TYPE_LCI 8 #define IEEE80211_SPCT_MSR_RPRT_TYPE_CIVIC 11 /* 9.4.2.1, Table 9-77. Element IDs. */ enum ieee80211_eid { WLAN_EID_SSID = 0, WLAN_EID_SUPP_RATES = 1, WLAN_EID_DS_PARAMS = 3, WLAN_EID_TIM = 5, WLAN_EID_COUNTRY = 7, /* IEEE80211_ELEMID_COUNTRY */ WLAN_EID_REQUEST = 10, WLAN_EID_CHANNEL_SWITCH = 37, WLAN_EID_MEASURE_REPORT = 39, WLAN_EID_HT_CAPABILITY = 45, /* IEEE80211_ELEMID_HTCAP */ WLAN_EID_RSN = 48, /* IEEE80211_ELEMID_RSN */ WLAN_EID_EXT_SUPP_RATES = 50, WLAN_EID_EXT_CHANSWITCH_ANN = 60, WLAN_EID_MULTIPLE_BSSID = 71, /* IEEE80211_ELEMID_MULTIBSSID */ WLAN_EID_MULTI_BSSID_IDX = 85, WLAN_EID_EXT_CAPABILITY = 127, WLAN_EID_VHT_CAPABILITY = 191, /* IEEE80211_ELEMID_VHT_CAP */ WLAN_EID_VENDOR_SPECIFIC = 221, }; enum ieee80211_eid_ext { WLAN_EID_EXT_HE_CAPABILITY = 35, }; #define for_each_element(_elem, _data, _len) \ for (_elem = (const struct element *)(_data); \ (((const uint8_t *)(_data) + (_len) - (const uint8_t *)_elem) >= sizeof(*_elem)) && \ (((const uint8_t *)(_data) + (_len) - (const uint8_t *)_elem) >= (sizeof(*_elem) + _elem->datalen)); \ _elem = (const struct element *)(_elem->data + _elem->datalen)) #define for_each_element_id(_elem, _eid, _data, _len) \ for_each_element(_elem, _data, _len) \ if (_elem->id == (_eid)) /* 9.4.1.7, Table 9-45. Reason codes. */ enum ieee80211_reason_code { /* reserved = 0, */ WLAN_REASON_UNSPECIFIED = 1, WLAN_REASON_DEAUTH_LEAVING = 3, /* LEAVING_NETWORK_DEAUTH */ WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE = 25, WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED = 26, }; /* 9.4.1.9, Table 9-46. Status codes. */ enum ieee80211_status_code { WLAN_STATUS_SUCCESS = 0, WLAN_STATUS_AUTH_TIMEOUT = 16, /* REJECTED_SEQUENCE_TIMEOUT */ }; /* 9.3.1.22 Trigger frame format; 80211ax-2021 */ struct ieee80211_trigger { __le16 frame_control; __le16 duration_id; uint8_t ra[ETH_ALEN]; uint8_t ta[ETH_ALEN]; __le64 common_info; /* 8+ really */ uint8_t variable[]; }; /* Table 9-29c-Trigger Type subfield encoding */ enum { IEEE80211_TRIGGER_TYPE_BASIC = 0x0, #if 0 /* Not seen yet. */ BFRP = 0x1, MU-BAR = 0x2, MU-RTS = 0x3, BSRP = 0x4, GCR MU-BAR = 0x5, BQRP = 0x6, NFRP = 0x7, /* 0x8..0xf reserved */ #endif IEEE80211_TRIGGER_TYPE_MASK = 0xf }; /* 802.11-2020, Figure 9-687-Control field format; 802.11ax-2021 */ #define IEEE80211_TWT_CONTROL_NEG_TYPE_BROADCAST BIT(3) #define IEEE80211_TWT_CONTROL_RX_DISABLED BIT(4) #define IEEE80211_TWT_CONTROL_WAKE_DUR_UNIT BIT(5) /* 802.11-2020, Figure 9-688-Request Type field format; 802.11ax-2021 */ #define IEEE80211_TWT_REQTYPE_SETUP_CMD (BIT(1) | BIT(2) | BIT(3)) #define IEEE80211_TWT_REQTYPE_TRIGGER BIT(4) #define IEEE80211_TWT_REQTYPE_IMPLICIT BIT(5) #define IEEE80211_TWT_REQTYPE_FLOWTYPE BIT(6) #define IEEE80211_TWT_REQTYPE_FLOWID (BIT(7) | BIT(8) | BIT(9)) #define IEEE80211_TWT_REQTYPE_WAKE_INT_EXP (BIT(10) | BIT(11) | BIT(12) | BIT(13) | BIT(14)) #define IEEE80211_TWT_REQTYPE_PROTECTION BIT(15) struct ieee80211_twt_params { int mantissa, min_twt_dur, twt; uint16_t req_type; }; struct ieee80211_twt_setup { int control; struct ieee80211_twt_params *params; }; /* 802.11-2020, Table 9-297-TWT Setup Command field values */ enum ieee80211_twt_setup_cmd { TWT_SETUP_CMD_REQUEST = 0, TWT_SETUP_CMD_SUGGEST = 1, /* DEMAND = 2, */ /* GROUPING = 3, */ TWT_SETUP_CMD_ACCEPT = 4, /* ALTERNATE = 5 */ TWT_SETUP_CMD_DICTATE = 6, TWT_SETUP_CMD_REJECT = 7, }; struct ieee80211_bssid_index { int bssid_index; }; /* net80211: IEEE80211_IS_CTL() */ static __inline bool ieee80211_is_ctl(__le16 fc) { __le16 v; fc &= htole16(IEEE80211_FC0_TYPE_MASK); v = htole16(IEEE80211_FC0_TYPE_CTL); return (fc == v); } /* net80211: IEEE80211_IS_DATA() */ static __inline bool ieee80211_is_data(__le16 fc) { __le16 v; fc &= htole16(IEEE80211_FC0_TYPE_MASK); v = htole16(IEEE80211_FC0_TYPE_DATA); return (fc == v); } /* net80211: IEEE80211_IS_QOSDATA() */ static __inline bool ieee80211_is_data_qos(__le16 fc) { __le16 v; - fc &= htole16(IEEE80211_FC0_SUBTYPE_QOS_DATA | IEEE80211_FC0_TYPE_MASK | - IEEE80211_FC0_VERSION_MASK); - v = htole16(IEEE80211_FC0_QOSDATA); + fc &= htole16(IEEE80211_FC0_SUBTYPE_QOS_DATA | IEEE80211_FC0_TYPE_MASK); + v = htole16(IEEE80211_FC0_SUBTYPE_QOS_DATA | IEEE80211_FC0_TYPE_DATA); return (fc == v); } /* net80211: IEEE80211_IS_MGMT() */ static __inline bool ieee80211_is_mgmt(__le16 fc) { __le16 v; fc &= htole16(IEEE80211_FC0_TYPE_MASK); v = htole16(IEEE80211_FC0_TYPE_MGT); return (fc == v); } /* Derived from net80211::ieee80211_anyhdrsize. */ static __inline unsigned int ieee80211_hdrlen(__le16 fc) { unsigned int size; if (ieee80211_is_ctl(fc)) { switch (fc & htole16(IEEE80211_FC0_SUBTYPE_MASK)) { case htole16(IEEE80211_FC0_SUBTYPE_CTS): case htole16(IEEE80211_FC0_SUBTYPE_ACK): return sizeof(struct ieee80211_frame_ack); case htole16(IEEE80211_FC0_SUBTYPE_BAR): return sizeof(struct ieee80211_frame_bar); } return (sizeof(struct ieee80211_frame_min)); } size = sizeof(struct ieee80211_frame); if (ieee80211_is_data(fc)) { if ((fc & htole16(IEEE80211_FC1_DIR_MASK << 8)) == htole16(IEEE80211_FC1_DIR_DSTODS << 8)) size += IEEE80211_ADDR_LEN; if ((fc & htole16(IEEE80211_FC0_SUBTYPE_QOS_DATA | IEEE80211_FC0_TYPE_MASK)) == htole16(IEEE80211_FC0_SUBTYPE_QOS_DATA | IEEE80211_FC0_TYPE_DATA)) size += sizeof(uint16_t); } if (ieee80211_is_mgmt(fc)) { #ifdef __notyet__ printf("XXX-BZ %s: TODO? fc %#04x size %u\n", __func__, fc, size); #endif ; } return (size); } static inline bool ieee80211_is_trigger(__le16 fc) { __le16 v; fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); v = htole16(IEEE80211_FC0_SUBTYPE_TRIGGER | IEEE80211_FC0_TYPE_CTL); return (fc == v); } #endif /* _LINUXKPI_LINUX_IEEE80211_H */ diff --git a/sys/compat/linuxkpi/common/include/linux/nl80211.h b/sys/compat/linuxkpi/common/include/linux/nl80211.h index a85abfc10453..c4c46fbd90cb 100644 --- a/sys/compat/linuxkpi/common/include/linux/nl80211.h +++ b/sys/compat/linuxkpi/common/include/linux/nl80211.h @@ -1,372 +1,374 @@ /*- * Copyright (c) 2020-2021 The FreeBSD Foundation * * This software was developed by Björn Zeeb under sponsorship from * the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _LINUXKPI_LINUX_NL80211_H #define _LINUXKPI_LINUX_NL80211_H #include enum nl80211_feature_flags { NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE = BIT(0), NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES = BIT(1), NL80211_FEATURE_HT_IBSS = BIT(2), NL80211_FEATURE_LOW_PRIORITY_SCAN = BIT(3), NL80211_FEATURE_ND_RANDOM_MAC_ADDR = BIT(4), NL80211_FEATURE_P2P_GO_CTWIN = BIT(5), NL80211_FEATURE_P2P_GO_OPPPS = BIT(6), NL80211_FEATURE_QUIET = BIT(7), NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR = BIT(8), NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR = BIT(9), NL80211_FEATURE_DYNAMIC_SMPS = BIT(10), NL80211_FEATURE_STATIC_SMPS = BIT(11), NL80211_FEATURE_SUPPORTS_WMM_ADMISSION = BIT(12), NL80211_FEATURE_TDLS_CHANNEL_SWITCH = BIT(13), NL80211_FEATURE_TX_POWER_INSERTION = BIT(14), NL80211_FEATURE_WFA_TPC_IE_IN_PROBES = BIT(15), NL80211_FEATURE_AP_SCAN = BIT(16), NL80211_FEATURE_ACTIVE_MONITOR = BIT(17), }; enum nl80211_pmsr_ftm_failure_flags { NL80211_PMSR_FTM_FAILURE_NO_RESPONSE = BIT(0), NL80211_PMSR_FTM_FAILURE_PEER_BUSY = BIT(1), NL80211_PMSR_FTM_FAILURE_UNSPECIFIED = BIT(2), }; enum nl80211_pmsr_status_flags { NL80211_PMSR_STATUS_FAILURE = BIT(0), NL80211_PMSR_STATUS_SUCCESS = BIT(1), NL80211_PMSR_STATUS_TIMEOUT = BIT(2), }; #define NL80211_PMSR_TYPE_FTM 1 enum nl80211_reg_rule_flags { NL80211_RRF_AUTO_BW = BIT(0), NL80211_RRF_DFS = BIT(1), NL80211_RRF_GO_CONCURRENT = BIT(2), NL80211_RRF_NO_IR = BIT(3), NL80211_RRF_NO_OUTDOOR = BIT(4), NL80211_RRF_NO_HT40MINUS = BIT(5), NL80211_RRF_NO_HT40PLUS = BIT(6), NL80211_RRF_NO_80MHZ = BIT(7), NL80211_RRF_NO_160MHZ = BIT(8), NL80211_RRF_NO_HE = BIT(9), NL80211_RRF_NO_OFDM = BIT(10), }; #define NL80211_RRF_NO_HT40 (NL80211_RRF_NO_HT40MINUS|NL80211_RRF_NO_HT40PLUS) enum nl80211_scan_flags { NL80211_SCAN_FLAG_FILS_MAX_CHANNEL_TIME = BIT(0), NL80211_SCAN_FLAG_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION = BIT(1), NL80211_SCAN_FLAG_OCE_PROBE_REQ_HIGH_TX_RATE = BIT(2), NL80211_SCAN_FLAG_RANDOM_ADDR = BIT(3), NL80211_SCAN_FLAG_COLOCATED_6GHZ = BIT(4), NL80211_SCAN_FLAG_RANDOM_SN = BIT(5), NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP = BIT(6), }; #define NL80211_MAX_SUPP_REG_RULES 512 /* TODO FIXME, random */ #define NL80211_BSS_CHAN_WIDTH_20 __LINE__ /* TODO FIXME, brcmfmac */ enum nl80211_wpa_versions { NL80211_WPA_VERSION_1 = 1, NL80211_WPA_VERSION_2, NL80211_WPA_VERSION_3, }; enum nl80211_bss_select_attr { __NL80211_BSS_SELECT_ATTR_INVALID = 0, NL80211_BSS_SELECT_ATTR_BAND_PREF, NL80211_BSS_SELECT_ATTR_RSSI, NL80211_BSS_SELECT_ATTR_RSSI_ADJUST, }; enum nl80211_sta_flag { /* XXX TODO */ NL80211_STA_FLAG_ASSOCIATED, NL80211_STA_FLAG_AUTHENTICATED, NL80211_STA_FLAG_AUTHORIZED, NL80211_STA_FLAG_TDLS_PEER, NL80211_STA_FLAG_WME, }; enum nl80211_band { /* XXX TODO */ NL80211_BAND_2GHZ = 0, NL80211_BAND_5GHZ, NL80211_BAND_60GHZ, NL80211_BAND_6GHZ, /* Keep this last. */ NUM_NL80211_BANDS }; enum nl80211_chan_flags { /* XXX TODO */ NL80211_CHAN_NO_HT, }; enum nl80211_chan_width { /* XXX TODO */ NL80211_CHAN_WIDTH_20_NOHT, NL80211_CHAN_WIDTH_20, NL80211_CHAN_WIDTH_40, NL80211_CHAN_WIDTH_80, NL80211_CHAN_WIDTH_80P80, NL80211_CHAN_WIDTH_160, NL80211_CHAN_WIDTH_5, NL80211_CHAN_WIDTH_10, }; enum nl80211_iftype { /* XXX TODO */ NL80211_IFTYPE_UNSPECIFIED, NL80211_IFTYPE_ADHOC, NL80211_IFTYPE_STATION, NL80211_IFTYPE_AP, NL80211_IFTYPE_AP_VLAN, NL80211_IFTYPE_MONITOR, NL80211_IFTYPE_P2P_CLIENT, NL80211_IFTYPE_P2P_DEVICE, NL80211_IFTYPE_P2P_GO, NL80211_IFTYPE_MESH_POINT, NL80211_IFTYPE_WDS, NL80211_IFTYPE_OCB, /* Keep this last. */ NUM_NL80211_IFTYPES }; enum nl80211_preamble { /* XXX TODO */ NL80211_PREAMBLE_LEGACY, NL80211_PREAMBLE_HT, NL80211_PREAMBLE_VHT, NL80211_PREAMBLE_HE, }; enum nl80211_tdls_operation { /* XXX TODO */ NL80211_TDLS_SETUP, NL80211_TDLS_TEARDOWN, NL80211_TDLS_ENABLE_LINK, NL80211_TDLS_DISABLE_LINK, NL80211_TDLS_DISCOVERY_REQ, NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY, NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY, }; enum nl80211_cqm_rssi_threshold_event { /* XXX TODO */ NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH, }; enum nl80211_ext_feature { /* XXX TODO */ NL80211_EXT_FEATURE_ACCEPT_BCAST_PROBE_RESP, NL80211_EXT_FEATURE_BSS_PARENT_TSF, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0, NL80211_EXT_FEATURE_DFS_OFFLOAD, NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER, NL80211_EXT_FEATURE_EXT_KEY_ID, NL80211_EXT_FEATURE_FILS_MAX_CHANNEL_TIME, NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER, NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION, NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE, NL80211_EXT_FEATURE_PROTECTED_TWT, NL80211_EXT_FEATURE_SAE_OFFLOAD, NL80211_EXT_FEATURE_SCAN_START_TIME, NL80211_EXT_FEATURE_SET_SCAN_DWELL, NL80211_EXT_FEATURE_VHT_IBSS, NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X, NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK, NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT, NL80211_EXT_FEATURE_SCAN_RANDOM_SN, NL80211_EXT_FEATURE_STA_TX_PWR, NL80211_EXT_FEATURE_CQM_RSSI_LIST, NL80211_EXT_FEATURE_AQL, NL80211_EXT_FEATURE_AIRTIME_FAIRNESS, NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT, NL80211_EXT_FEATURE_BEACON_RATE_LEGACY, NL80211_EXT_FEATURE_BEACON_RATE_HT, NL80211_EXT_FEATURE_BEACON_RATE_VHT, NL80211_EXT_FEATURE_BEACON_RATE_HE, NL80211_EXT_FEATURE_BSS_COLOR, NL80211_EXT_FEATURE_FILS_DISCOVERY, NL80211_EXT_FEATURE_RADAR_BACKGROUND, NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP, /* Keep this last. */ NUM_NL80211_EXT_FEATURES }; enum nl80211_sta_info { /* XXX TODO */ NL80211_STA_INFO_BEACON_RX, NL80211_STA_INFO_BEACON_SIGNAL_AVG, NL80211_STA_INFO_BSS_PARAM, NL80211_STA_INFO_CHAIN_SIGNAL, NL80211_STA_INFO_CONNECTED_TIME, NL80211_STA_INFO_INACTIVE_TIME, NL80211_STA_INFO_SIGNAL, NL80211_STA_INFO_SIGNAL_AVG, NL80211_STA_INFO_STA_FLAGS, NL80211_STA_INFO_RX_BITRATE, NL80211_STA_INFO_RX_PACKETS, NL80211_STA_INFO_RX_BYTES, NL80211_STA_INFO_RX_DROP_MISC, NL80211_STA_INFO_TX_BITRATE, NL80211_STA_INFO_TX_PACKETS, NL80211_STA_INFO_TX_BYTES, NL80211_STA_INFO_TX_FAILED, NL80211_STA_INFO_TX_RETRIES, NL80211_STA_INFO_RX_DURATION, NL80211_STA_INFO_TX_DURATION, }; enum nl80211_ftm_stats { /* XXX TODO */ NL80211_FTM_STATS_ASAP_NUM, NL80211_FTM_STATS_FAILED_NUM, NL80211_FTM_STATS_NON_ASAP_NUM, NL80211_FTM_STATS_OUT_OF_WINDOW_TRIGGERS_NUM, NL80211_FTM_STATS_PARTIAL_NUM, NL80211_FTM_STATS_RESCHEDULE_REQUESTS_NUM, NL80211_FTM_STATS_SUCCESS_NUM, NL80211_FTM_STATS_TOTAL_DURATION_MSEC, NL80211_FTM_STATS_UNKNOWN_TRIGGERS_NUM, }; enum nl80211_reg_initiator { /* XXX TODO */ NL80211_REGDOM_SET_BY_USER, NL80211_REGDOM_SET_BY_DRIVER, NL80211_REGDOM_SET_BY_CORE, NL80211_REGDOM_SET_BY_COUNTRY_IE, }; struct nl80211_sta_flag_update { /* XXX TODO */ int mask, set; }; enum nl80211_tx_power_setting { /* XXX TODO */ NL80211_TX_POWER_AUTOMATIC, NL80211_TX_POWER_FIXED, NL80211_TX_POWER_LIMITED, }; enum nl80211_crit_proto_id { /* XXX TODO */ NL80211_CRIT_PROTO_DHCP, }; enum nl80211_auth_type { NL80211_AUTHTYPE_AUTOMATIC, NL80211_AUTHTYPE_OPEN_SYSTEM, NL80211_AUTHTYPE_SHARED_KEY, NL80211_AUTHTYPE_SAE, }; enum nl80211_key_type { NL80211_KEYTYPE_GROUP, NL80211_KEYTYPE_PAIRWISE, }; enum nl80211_he_ru_alloc { NL80211_RATE_INFO_HE_RU_ALLOC_26, NL80211_RATE_INFO_HE_RU_ALLOC_52, NL80211_RATE_INFO_HE_RU_ALLOC_106, NL80211_RATE_INFO_HE_RU_ALLOC_242, NL80211_RATE_INFO_HE_RU_ALLOC_484, NL80211_RATE_INFO_HE_RU_ALLOC_996, NL80211_RATE_INFO_HE_RU_ALLOC_2x996, }; enum nl80211_he_gi { NL80211_RATE_INFO_HE_GI_0_8, NL80211_RATE_INFO_HE_GI_1_6, NL80211_RATE_INFO_HE_GI_3_2, }; enum nl80211_dfs_regions { NL80211_DFS_UNSET, NL80211_DFS_FCC, NL80211_DFS_ETSI, NL80211_DFS_JP, }; enum nl80211_sar_type { NL80211_SAR_TYPE_POWER, }; #define NL80211_VHT_NSS_MAX 8 enum nl80211_tid_cfg_attr { NL80211_TID_CONFIG_ATTR_NOACK, NL80211_TID_CONFIG_ATTR_RETRY_SHORT, NL80211_TID_CONFIG_ATTR_TX_RATE_TYPE, NL80211_TID_CONFIG_ATTR_TX_RATE, NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL, NL80211_TID_CONFIG_ATTR_RETRY_LONG, NL80211_TID_CONFIG_ATTR_AMPDU_CTRL, }; enum nl80211_tid_config { NL80211_TID_CONFIG_ENABLE, }; enum nl80211_tx_rate_setting { NL80211_TX_RATE_AUTOMATIC, NL80211_TX_RATE_FIXED, NL80211_TX_RATE_LIMITED, }; enum nl80211_txrate_gi { NL80211_TXRATE_DEFAULT_GI, NL80211_TXRATE_FORCE_SGI, NL80211_TXRATE_FORCE_LGI, }; enum nl80211_probe_resp_offload_support { NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2, NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS, NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P, }; #define NL80211_KCK_LEN 16 +#define NL80211_KCK_EXT_LEN 24 #define NL80211_KEK_LEN 16 +#define NL80211_KEK_EXT_LEN 32 #define NL80211_REPLAY_CTR_LEN 8 #endif /* _LINUXKPI_LINUX_NL80211_H */ diff --git a/sys/compat/linuxkpi/common/include/net/cfg80211.h b/sys/compat/linuxkpi/common/include/net/cfg80211.h index e7301e7b85cb..89b7af916573 100644 --- a/sys/compat/linuxkpi/common/include/net/cfg80211.h +++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h @@ -1,1699 +1,1731 @@ /*- * Copyright (c) 2020-2021 The FreeBSD Foundation * Copyright (c) 2021-2022 Bjoern A. Zeeb * * This software was developed by Björn Zeeb under sponsorship from * the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _LINUXKPI_NET_CFG80211_H #define _LINUXKPI_NET_CFG80211_H #include #include #include #include #include #include #include #include #include #include /* linux_80211.c */ extern int linuxkpi_debug_80211; #ifndef D80211_TODO #define D80211_TODO 0x1 #endif #ifndef D80211_IMPROVE #define D80211_IMPROVE 0x2 #endif -#define TODO() if (linuxkpi_debug_80211 & D80211_TODO) \ +#define TODO(...) if (linuxkpi_debug_80211 & D80211_TODO) \ printf("%s:%d: XXX LKPI80211 TODO\n", __func__, __LINE__) #define IMPROVE(...) if (linuxkpi_debug_80211 & D80211_IMPROVE) \ printf("%s:%d: XXX LKPI80211 IMPROVE\n", __func__, __LINE__) enum rfkill_hard_block_reasons { RFKILL_HARD_BLOCK_NOT_OWNER = BIT(0), }; #define WIPHY_PARAM_FRAG_THRESHOLD __LINE__ /* TODO FIXME brcmfmac */ #define WIPHY_PARAM_RETRY_LONG __LINE__ /* TODO FIXME brcmfmac */ #define WIPHY_PARAM_RETRY_SHORT __LINE__ /* TODO FIXME brcmfmac */ #define WIPHY_PARAM_RTS_THRESHOLD __LINE__ /* TODO FIXME brcmfmac */ #define CFG80211_SIGNAL_TYPE_MBM __LINE__ /* TODO FIXME brcmfmac */ #define UPDATE_ASSOC_IES 1 #define IEEE80211_MAX_CHAINS 4 /* net80211: IEEE80211_MAX_CHAINS copied */ enum cfg80211_rate_info_flags { RATE_INFO_FLAGS_SHORT_GI = BIT(0), RATE_INFO_FLAGS_MCS = BIT(1), RATE_INFO_FLAGS_VHT_MCS = BIT(2), RATE_INFO_FLAGS_HE_MCS = BIT(3), + /* Max 8 bits as used in struct rate_info. */ }; extern const uint8_t rfc1042_header[6]; extern const uint8_t bridge_tunnel_header[6]; enum ieee80211_privacy { IEEE80211_PRIVACY_ANY, }; enum ieee80211_bss_type { IEEE80211_BSS_TYPE_ANY, }; enum cfg80211_bss_frame_type { CFG80211_BSS_FTYPE_UNKNOWN, CFG80211_BSS_FTYPE_BEACON, CFG80211_BSS_FTYPE_PRESP, }; enum ieee80211_channel_flags { IEEE80211_CHAN_DISABLED = BIT(0), IEEE80211_CHAN_INDOOR_ONLY = BIT(1), IEEE80211_CHAN_IR_CONCURRENT = BIT(2), IEEE80211_CHAN_RADAR = BIT(3), IEEE80211_CHAN_NO_IR = BIT(4), IEEE80211_CHAN_NO_HT40MINUS = BIT(5), IEEE80211_CHAN_NO_HT40PLUS = BIT(6), IEEE80211_CHAN_NO_80MHZ = BIT(7), IEEE80211_CHAN_NO_160MHZ = BIT(8), IEEE80211_CHAN_NO_OFDM = BIT(9), }; #define IEEE80211_CHAN_NO_HT40 (IEEE80211_CHAN_NO_HT40MINUS|IEEE80211_CHAN_NO_HT40PLUS) struct ieee80211_txrx_stypes { uint16_t tx; uint16_t rx; }; /* XXX net80211 has an ieee80211_channel as well. */ struct linuxkpi_ieee80211_channel { /* TODO FIXME */ uint32_t hw_value; /* ic_ieee */ uint32_t center_freq; /* ic_freq */ enum ieee80211_channel_flags flags; /* ic_flags */ enum nl80211_band band; int8_t max_power; /* ic_maxpower */ bool beacon_found; int max_antenna_gain, max_reg_power; int orig_flags; int dfs_cac_ms, dfs_state; int orig_mpwr; }; struct cfg80211_bitrate_mask { /* TODO FIXME */ - /* This is so weird but nothing else works out...*/ struct { - uint64_t legacy; /* XXX? */ + uint32_t legacy; uint8_t ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; - uint16_t vht_mcs[16]; /* XXX? */ - uint16_t he_mcs[16]; /* XXX? */ + uint16_t vht_mcs[8]; + uint16_t he_mcs[8]; enum nl80211_txrate_gi gi; enum nl80211_he_gi he_gi; - uint8_t he_ltf; + uint8_t he_ltf; /* XXX enum? */ } control[NUM_NL80211_BANDS]; }; enum rate_info_bw { RATE_INFO_BW_20 = 0, RATE_INFO_BW_5, RATE_INFO_BW_10, RATE_INFO_BW_40, RATE_INFO_BW_80, RATE_INFO_BW_160, RATE_INFO_BW_HE_RU, }; struct rate_info { - /* TODO FIXME */ - int bw, flags, he_dcm, he_gi, he_ru_alloc, legacy, mcs, nss; + uint8_t flags; /* enum cfg80211_rate_info_flags */ + uint8_t bw; + uint16_t legacy; + uint8_t mcs; + uint8_t nss; + uint8_t he_dcm; + uint8_t he_gi; + uint8_t he_ru_alloc; }; struct ieee80211_rate { /* TODO FIXME */ uint32_t bitrate; uint32_t hw_value; uint32_t hw_value_short; uint32_t flags; }; struct ieee80211_sta_ht_cap { /* TODO FIXME */ int ampdu_density, ampdu_factor; bool ht_supported; uint16_t cap; struct ieee80211_mcs_info mcs; }; /* XXX net80211 calls these IEEE80211_VHTCAP_* */ #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_3895 */ #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001 /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_7991 */ #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002 /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_11454 */ #define IEEE80211_VHT_CAP_MAX_MPDU_MASK 0x00000003 /* IEEE80211_VHTCAP_MAX_MPDU_MASK */ #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160MHZ << IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S) #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160_80P80MHZ << IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S) #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK 0x0000000c /* IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK */ #define IEEE80211_VHT_CAP_RXLDPC 0x00000010 /* IEEE80211_VHTCAP_RXLDPC */ #define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020 /* IEEE80211_VHTCAP_SHORT_GI_80 */ #define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040 /* IEEE80211_VHTCAP_SHORT_GI_160 */ #define IEEE80211_VHT_CAP_TXSTBC 0x00000080 /* IEEE80211_VHTCAP_TXSTBC */ #define IEEE80211_VHT_CAP_RXSTBC_1 0x00000100 /* IEEE80211_VHTCAP_RXSTBC_1 */ #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700 /* IEEE80211_VHTCAP_RXSTBC_MASK */ #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 /* IEEE80211_VHTCAP_SU_BEAMFORMER_CAPABLE */ #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 /* IEEE80211_VHTCAP_SU_BEAMFORMEE_CAPABLE */ #define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000 /* IEEE80211_VHTCAP_MU_BEAMFORMER_CAPABLE */ #define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000 /* IEEE80211_VHTCAP_MU_BEAMFORMEE_CAPABLE */ #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13 /* IEEE80211_VHTCAP_BEAMFORMEE_STS_SHIFT */ #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK (7 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT) /* IEEE80211_VHTCAP_BEAMFORMEE_STS_MASK */ #define IEEE80211_VHT_CAP_HTC_VHT 0x00400000 /* IEEE80211_VHTCAP_HTC_VHT */ #define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000 /* IEEE80211_VHTCAP_RX_ANTENNA_PATTERN */ #define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000 /* IEEE80211_VHTCAP_TX_ANTENNA_PATTERN */ #define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB 0x0c000000 /* IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB */ #define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 /* IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT */ #define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK \ (7 << IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT) /* IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_MASK */ #define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT 23 /* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT */ #define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ (7 << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT) /* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK */ struct ieee80211_sta_vht_cap { /* TODO FIXME */ - bool vht_supported; - uint32_t cap; - struct vht_mcs vht_mcs; + bool vht_supported; + uint32_t cap; + struct ieee80211_vht_mcs_info vht_mcs; }; enum ieee80211_vht_opmode { IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT = 4, }; struct cfg80211_connect_resp_params { /* XXX TODO */ uint8_t *bssid; const uint8_t *req_ie; const uint8_t *resp_ie; uint32_t req_ie_len; uint32_t resp_ie_len; int status; }; struct cfg80211_inform_bss { /* XXX TODO */ int boottime_ns, scan_width, signal; struct linuxkpi_ieee80211_channel *chan; }; struct cfg80211_roam_info { /* XXX TODO */ uint8_t *bssid; const uint8_t *req_ie; const uint8_t *resp_ie; uint32_t req_ie_len; uint32_t resp_ie_len; struct linuxkpi_ieee80211_channel *channel; }; struct cfg80211_bss_ies { /* XXX TODO, type is best guess. Fix if more info. */ uint8_t *data; int len; }; struct cfg80211_bss { /* XXX TODO */ struct cfg80211_bss_ies *ies; }; struct cfg80211_chan_def { /* XXX TODO */ struct linuxkpi_ieee80211_channel *chan; enum nl80211_chan_width width; uint32_t center_freq1; uint32_t center_freq2; }; struct cfg80211_ftm_responder_stats { /* XXX TODO */ int asap_num, failed_num, filled, non_asap_num, out_of_window_triggers_num, partial_num, reschedule_requests_num, success_num, total_duration_ms, unknown_triggers_num; }; struct cfg80211_pmsr_capabilities { /* XXX TODO */ int max_peers, randomize_mac_addr, report_ap_tsf; struct { int asap, bandwidths, max_bursts_exponent, max_ftms_per_burst, non_asap, non_trigger_based, preambles, request_civicloc, request_lci, supported, trigger_based; } ftm; }; struct cfg80211_pmsr_ftm_request { /* XXX TODO */ int asap, burst_period, ftmr_retries, ftms_per_burst, non_trigger_based, num_bursts_exp, request_civicloc, request_lci, trigger_based; uint8_t bss_color; bool lmr_feedback; }; struct cfg80211_pmsr_request_peer { /* XXX TODO */ struct cfg80211_chan_def chandef; struct cfg80211_pmsr_ftm_request ftm; uint8_t addr[ETH_ALEN]; int report_ap_tsf; }; struct cfg80211_pmsr_request { /* XXX TODO */ int cookie, n_peers, timeout; uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN]; struct cfg80211_pmsr_request_peer peers[]; }; struct cfg80211_pmsr_ftm_result { /* XXX TODO */ int burst_index, busy_retry_time, failure_reason; int num_ftmr_successes, rssi_avg, rssi_avg_valid, rssi_spread, rssi_spread_valid, rtt_avg, rtt_avg_valid, rtt_spread, rtt_spread_valid, rtt_variance, rtt_variance_valid; uint8_t *lci; uint8_t *civicloc; int lci_len; int civicloc_len; }; struct cfg80211_pmsr_result { /* XXX TODO */ int ap_tsf, ap_tsf_valid, final, host_time, status, type; uint8_t addr[ETH_ALEN]; struct cfg80211_pmsr_ftm_result ftm; }; struct cfg80211_sar_freq_ranges { uint32_t start_freq; uint32_t end_freq; }; struct cfg80211_sar_sub_specs { uint32_t freq_range_index; int power; }; struct cfg80211_sar_specs { enum nl80211_sar_type type; uint32_t num_sub_specs; struct cfg80211_sar_sub_specs sub_specs[]; }; struct cfg80211_sar_capa { enum nl80211_sar_type type; uint32_t num_freq_ranges; const struct cfg80211_sar_freq_ranges *freq_ranges; }; struct cfg80211_ssid { int ssid_len; uint8_t ssid[IEEE80211_MAX_SSID_LEN]; }; struct cfg80211_scan_6ghz_params { /* XXX TODO */ uint8_t *bssid; int channel_idx, psc_no_listen, short_ssid, short_ssid_valid, unsolicited_probe; }; struct cfg80211_match_set { uint8_t bssid[ETH_ALEN]; struct cfg80211_ssid ssid; int rssi_thold; }; struct cfg80211_scan_request { /* XXX TODO */ int duration, duration_mandatory, flags; bool no_cck; bool scan_6ghz; struct wireless_dev *wdev; struct wiphy *wiphy; int ie_len; uint8_t *ie; uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN]; uint8_t bssid[ETH_ALEN]; int n_ssids; int n_6ghz_params; int n_channels; struct cfg80211_ssid *ssids; struct cfg80211_scan_6ghz_params *scan_6ghz_params; struct linuxkpi_ieee80211_channel *channels[0]; }; struct cfg80211_sched_scan_plan { /* XXX TODO */ int interval, iterations; }; struct cfg80211_sched_scan_request { /* XXX TODO */ int delay, flags; uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN]; uint64_t reqid; int n_match_sets; int n_scan_plans; int n_ssids; int n_channels; int ie_len; uint8_t *ie; struct cfg80211_match_set *match_sets; struct cfg80211_sched_scan_plan *scan_plans; struct cfg80211_ssid *ssids; struct linuxkpi_ieee80211_channel *channels[0]; }; struct cfg80211_scan_info { uint64_t scan_start_tsf; uint8_t tsf_bssid[ETH_ALEN]; bool aborted; }; struct cfg80211_beacon_data { /* XXX TODO */ const uint8_t *head; const uint8_t *tail; uint32_t head_len; uint32_t tail_len; const uint8_t *proberesp_ies; const uint8_t *assocresp_ies; uint32_t proberesp_ies_len; uint32_t assocresp_ies_len; }; struct cfg80211_ap_settings { /* XXX TODO */ int auth_type, beacon_interval, dtim_period, hidden_ssid, inactivity_timeout; const uint8_t *ssid; size_t ssid_len; struct cfg80211_beacon_data beacon; struct cfg80211_chan_def chandef; }; struct cfg80211_bss_selection { /* XXX TODO */ enum nl80211_bss_select_attr behaviour; union { enum nl80211_band band_pref; struct { enum nl80211_band band; uint8_t delta; } adjust; } param; }; struct cfg80211_crypto { /* XXX made up name */ /* XXX TODO */ enum nl80211_wpa_versions wpa_versions; uint32_t cipher_group; /* WLAN_CIPHER_SUITE_* */ uint32_t *akm_suites; uint32_t *ciphers_pairwise; const uint8_t *sae_pwd; const uint8_t *psk; int n_akm_suites; int n_ciphers_pairwise; int sae_pwd_len; }; struct cfg80211_connect_params { /* XXX TODO */ struct linuxkpi_ieee80211_channel *channel; uint8_t *bssid; const uint8_t *ie; const uint8_t *ssid; uint32_t ie_len; uint32_t ssid_len; const void *key; uint32_t key_len; int auth_type, key_idx, privacy, want_1x; struct cfg80211_bss_selection bss_select; struct cfg80211_crypto crypto; }; enum bss_param_flags { /* Used as bitflags. XXX FIXME values? */ BSS_PARAM_FLAGS_CTS_PROT = 0x01, BSS_PARAM_FLAGS_SHORT_PREAMBLE = 0x02, BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 0x04, }; struct cfg80211_ibss_params { /* XXX TODO */ int basic_rates, beacon_interval; int channel_fixed, ie, ie_len, privacy; int dtim_period; uint8_t *ssid; uint8_t *bssid; int ssid_len; struct cfg80211_chan_def chandef; enum bss_param_flags flags; }; struct cfg80211_mgmt_tx_params { /* XXX TODO */ struct linuxkpi_ieee80211_channel *chan; const uint8_t *buf; size_t len; int wait; }; struct cfg80211_pmk_conf { /* XXX TODO */ const uint8_t *pmk; uint8_t pmk_len; }; struct cfg80211_pmksa { /* XXX TODO */ const uint8_t *bssid; const uint8_t *pmkid; }; -struct cfg80211_wowlan_nd_match { - /* XXX TODO */ - struct cfg80211_ssid ssid; - int n_channels; - uint32_t channels[0]; /* freq! = ieee80211_channel_to_frequency() */ -}; - -struct cfg80211_wowlan_nd_info { - /* XXX TODO */ - int n_matches; - struct cfg80211_wowlan_nd_match *matches[0]; -}; - -enum wiphy_wowlan_support_flags { - WIPHY_WOWLAN_DISCONNECT, - WIPHY_WOWLAN_GTK_REKEY_FAILURE, - WIPHY_WOWLAN_MAGIC_PKT, - WIPHY_WOWLAN_SUPPORTS_GTK_REKEY, - WIPHY_WOWLAN_NET_DETECT, -}; - -struct wiphy_wowlan_support { - /* XXX TODO */ - enum wiphy_wowlan_support_flags flags; - int max_nd_match_sets, max_pkt_offset, n_patterns, pattern_max_len, pattern_min_len; -}; - struct station_del_parameters { /* XXX TODO */ const uint8_t *mac; uint32_t reason_code; /* elsewhere uint16_t? */ }; struct station_info { /* TODO FIXME */ int assoc_req_ies_len, connected_time; int generation, inactive_time, rx_bytes, rx_dropped_misc, rx_packets, signal, tx_bytes, tx_packets; int filled, rx_beacon, rx_beacon_signal_avg, signal_avg; int rx_duration, tx_failed, tx_retries; int chains; uint8_t chain_signal[IEEE80211_MAX_CHAINS]; uint8_t chain_signal_avg[IEEE80211_MAX_CHAINS]; uint8_t *assoc_req_ies; struct rate_info rxrate; struct rate_info txrate; struct cfg80211_ibss_params bss_param; struct nl80211_sta_flag_update sta_flags; }; struct station_parameters { /* XXX TODO */ int sta_flags_mask, sta_flags_set; }; struct key_params { /* XXX TODO */ const uint8_t *key; const uint8_t *seq; int key_len; int seq_len; uint32_t cipher; /* WLAN_CIPHER_SUITE_* */ }; struct mgmt_frame_regs { /* XXX TODO */ int interface_stypes; }; struct vif_params { /* XXX TODO */ uint8_t macaddr[ETH_ALEN]; }; /* That the world needs so many different structs for this is amazing. */ struct mac_address { uint8_t addr[ETH_ALEN]; }; struct ieee80211_reg_rule { /* TODO FIXME */ uint32_t flags; struct freq_range { int start_freq_khz; int end_freq_khz; int max_bandwidth_khz; } freq_range; struct power_rule { int max_antenna_gain; int max_eirp; } power_rule; }; struct linuxkpi_ieee80211_regdomain { /* TODO FIXME */ uint8_t alpha2[2]; int dfs_region; int n_reg_rules; struct ieee80211_reg_rule reg_rules[]; }; /* XXX-BZ this are insensible values probably ... */ #define IEEE80211_HE_MAC_CAP0_HTC_HE 0x1 #define IEEE80211_HE_MAC_CAP0_TWT_REQ 0x2 #define IEEE80211_HE_MAC_CAP0_TWT_RES 0x4 #define IEEE80211_HE_MAC_CAP1_LINK_ADAPTATION 0x1 #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8 0x2 #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US 0x4 #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_MASK 0x8 #define IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP 0x1 #define IEEE80211_HE_MAC_CAP2_ACK_EN 0x2 #define IEEE80211_HE_MAC_CAP2_BSR 0x4 #define IEEE80211_HE_MAC_CAP2_LINK_ADAPTATION 0x8 #define IEEE80211_HE_MAC_CAP2_BCAST_TWT 0x10 #define IEEE80211_HE_MAC_CAP2_ALL_ACK 0x20 #define IEEE80211_HE_MAC_CAP2_MU_CASCADING 0x40 #define IEEE80211_HE_MAC_CAP2_TRS 0x80 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2 0x1 #define IEEE80211_HE_MAC_CAP3_OMI_CONTROL 0x2 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_1 0x10 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_2 0x20 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3 0x40 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK 0x70 #define IEEE80211_HE_MAC_CAP3_RX_CTRL_FRAME_TO_MULTIBSS 0x80 #define IEEE80211_HE_MAC_CAP3_FLEX_TWT_SCHED 0x80 #define IEEE80211_HE_MAC_CAP3_OFDMA_RA 0x80 #define IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU 0x1 #define IEEE80211_HE_MAC_CAP4_BQR 0x2 #define IEEE80211_HE_MAC_CAP4_MULTI_TID_AGG_TX_QOS_B39 0x4 #define IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU 0x8 #define IEEE80211_HE_MAC_CAP4_OPS 0x10 #define IEEE80211_HE_MAC_CAP4_BSRP_BQRP_A_MPDU_AGG 0x20 #define IEEE80211_HE_MAC_CAP5_HE_DYNAMIC_SM_PS 0x1 #define IEEE80211_HE_MAC_CAP5_HT_VHT_TRIG_FRAME_RX 0x2 #define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B40 0x4 #define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B41 0x8 #define IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU 0x10 #define IEEE80211_HE_MAC_CAP5_OM_CTRL_UL_MU_DATA_DIS_RX 0x20 #define IEEE80211_HE_MAC_CAP5_PUNCTURED_SOUNDING 0x40 #define IEEE80211_HE_MAC_CAP5_SUBCHAN_SELECTIVE_TRANSMISSION 0x80 #define IEEE80211_HE_MCS_NOT_SUPPORTED 0x0 #define IEEE80211_HE_MCS_SUPPORT_0_7 0x1 #define IEEE80211_HE_MCS_SUPPORT_0_9 0x2 #define IEEE80211_HE_MCS_SUPPORT_0_11 0x4 #define IEEE80211_HE_6GHZ_CAP_TX_ANTPAT_CONS 0x01 #define IEEE80211_HE_6GHZ_CAP_RX_ANTPAT_CONS 0x02 #define IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START 0x04 #define IEEE80211_HE_6GHZ_CAP_MAX_MPDU_LEN 0x08 #define IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP 0x10 #define IEEE80211_HE_6GHZ_CAP_SM_PS 0x20 #define IEEE80211_HE_6GHZ_MAX_AMPDU_FACTOR 0x40 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G 0x1 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G 0x2 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G 0x4 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G 0x8 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_2G 0x10 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_5G 0x20 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK 0x40 #define IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A 0x1 #define IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD 0x2 #define IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS 0x4 #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK 0x8 #define IEEE80211_HE_PHY_CAP1_HE_LTF_AND_GI_FOR_HE_PPDUS_0_8US 0x10 #define IEEE80211_HE_PHY_CAP2_MIDAMBLE_RX_TX_MAX_NSTS 0x1 #define IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US 0x2 #define IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ 0x4 #define IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ 0x8 #define IEEE80211_HE_PHY_CAP2_DOPPLER_TX 0x10 #define IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO 0x20 #define IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO 0x40 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK 0x1 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_NO_DCM 0x2 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_NO_DCM 0x4 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1 0x8 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_1 0x10 #define IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER 0x20 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM 0x40 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_16_QAM 0x80 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_2 0x10 #define IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU 0x20 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_BPSK 0x40 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_BPSK 0x80 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK 0x80 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_QPSK 0x80 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_QPSK 0x80 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_2 0x80 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_8 0x1 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_8 0x2 #define IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE 0x4 #define IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER 0x8 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_4 0x10 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_4 0x20 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_MASK 0x40 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_MASK 0x80 #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2 0x1 #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2 0x2 #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK 0x4 #define IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK 0x8 #define IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK 0x10 #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_MASK 0x20 #define IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT 0x1 #define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB 0x2 #define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB 0x4 #define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB 0x8 #define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB 0x20 #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU 0x40 #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU 0x80 #define IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE 0x80 #define IEEE80211_HE_PHY_CAP6_TRIG_CQI_FB 0x80 #define IEEE80211_HE_PHY_CAP6_PARTIAL_BANDWIDTH_DL_MUMIMO 0x80 #define IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI 0x1 #define IEEE80211_HE_PHY_CAP7_MAX_NC_1 0x2 #define IEEE80211_HE_PHY_CAP7_MAX_NC_2 0x4 #define IEEE80211_HE_PHY_CAP7_MAX_NC_MASK 0x6 #define IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR 0x8 #define IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP 0x10 #define IEEE80211_HE_PHY_CAP7_STBC_RX_ABOVE_80MHZ 0x20 #define IEEE80211_HE_PHY_CAP7_STBC_TX_ABOVE_80MHZ 0x40 #define IEEE80211_HE_PHY_CAP7_PSR_BASED_SR 0x80 #define IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU 0x1 #define IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G 0x2 #define IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU 0x4 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_242 0x8 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_484 0x10 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_996 0x18 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_2x996 0x20 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_MASK 0x28 #define IEEE80211_HE_PHY_CAP8_HE_ER_SU_PPDU_4XLTF_AND_08_US_GI 0x40 #define IEEE80211_HE_PHY_CAP8_HE_ER_SU_1XLTF_AND_08_US_GI 0x80 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_0US 0x1 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US 0x2 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_8US 0x4 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK 0x8 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_RESERVED 0x10 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_POS 0x0 #define IEEE80211_HE_PHY_CAP9_NON_TRIGGERED_CQI_FEEDBACK 0x20 #define IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB 0x4 #define IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB 0x8 #define IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_THAN_242_TONE_RU 0x10 #define IEEE80211_HE_PHY_CAP9_TX_1024_QAM_LESS_THAN_242_TONE_RU 0x20 #define IEEE80211_HE_PHY_CAP9_LONGER_THAN_16_SIGB_OFDM_SYM 0x40 #define IEEE80211_HE_PHY_CAP10_HE_MU_M1RU_MAX_LTF 0x1 #define VENDOR_CMD_RAW_DATA (void *)(uintptr_t)(-ENOENT) struct ieee80211_he_cap_elem { u8 mac_cap_info[6]; u8 phy_cap_info[11]; } __packed; struct ieee80211_he_mcs_nss_supp { /* TODO FIXME */ uint32_t rx_mcs_80; uint32_t tx_mcs_80; uint32_t rx_mcs_160; uint32_t tx_mcs_160; uint32_t rx_mcs_80p80; uint32_t tx_mcs_80p80; }; #define IEEE80211_STA_HE_CAP_PPE_THRES_MAX 32 struct ieee80211_sta_he_cap { /* TODO FIXME */ int has_he; struct ieee80211_he_cap_elem he_cap_elem; struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp; uint8_t ppe_thres[IEEE80211_STA_HE_CAP_PPE_THRES_MAX]; }; struct cfg80211_he_bss_color { int color, enabled; }; struct ieee80211_he_obss_pd { bool enable; }; struct ieee80211_sta_he_6ghz_capa { /* TODO FIXME */ int capa; }; struct ieee80211_sband_iftype_data { /* TODO FIXME */ enum nl80211_iftype types_mask; struct ieee80211_sta_he_cap he_cap; struct ieee80211_sta_he_6ghz_capa he_6ghz_capa; struct { const uint8_t *data; size_t len; } vendor_elems; }; struct ieee80211_supported_band { /* TODO FIXME */ struct linuxkpi_ieee80211_channel *channels; struct ieee80211_rate *bitrates; struct ieee80211_sband_iftype_data *iftype_data; int n_channels; int n_bitrates; int n_iftype_data; enum nl80211_band band; struct ieee80211_sta_ht_cap ht_cap; struct ieee80211_sta_vht_cap vht_cap; }; struct cfg80211_pkt_pattern { /* XXX TODO */ uint8_t *mask; uint8_t *pattern; int pattern_len; int pkt_offset; }; +struct cfg80211_wowlan_nd_match { + /* XXX TODO */ + struct cfg80211_ssid ssid; + int n_channels; + uint32_t channels[0]; /* freq! = ieee80211_channel_to_frequency() */ +}; + +struct cfg80211_wowlan_nd_info { + /* XXX TODO */ + int n_matches; + struct cfg80211_wowlan_nd_match *matches[0]; +}; + +enum wiphy_wowlan_support_flags { + WIPHY_WOWLAN_DISCONNECT, + WIPHY_WOWLAN_GTK_REKEY_FAILURE, + WIPHY_WOWLAN_MAGIC_PKT, + WIPHY_WOWLAN_SUPPORTS_GTK_REKEY, + WIPHY_WOWLAN_NET_DETECT, +}; + +struct wiphy_wowlan_support { + /* XXX TODO */ + enum wiphy_wowlan_support_flags flags; + int max_nd_match_sets, max_pkt_offset, n_patterns, pattern_max_len, pattern_min_len; +}; + +struct cfg80211_wowlan_wakeup { + /* XXX TODO */ + uint16_t pattern_idx; + bool disconnect; + bool eap_identity_req; + bool four_way_handshake; + bool gtk_rekey_failure; + bool magic_pkt; + bool rfkill_release; + bool tcp_connlost; + bool tcp_nomoretokens; + bool tcp_match; + bool packet_80211; + struct cfg80211_wowlan_nd_info *net_detect; + uint8_t *packet; + uint16_t packet_len; + uint16_t packet_present_len; +}; + struct cfg80211_wowlan { /* XXX TODO */ int disconnect, gtk_rekey_failure, magic_pkt; + int eap_identity_req, four_way_handshake, rfkill_release, tcp, any; int n_patterns; struct cfg80211_sched_scan_request *nd_config; struct cfg80211_pkt_pattern *patterns; }; struct cfg80211_gtk_rekey_data { /* XXX TODO */ - int kck, kek, replay_ctr; + const uint8_t *kck, *kek, *replay_ctr; + uint32_t akm; + uint8_t kck_len, kek_len; }; struct cfg80211_tid_cfg { /* XXX TODO */ int mask, noack, retry_long, rtscts, tids; enum nl80211_tx_rate_setting txrate_type; struct cfg80211_bitrate_mask txrate_mask; }; struct cfg80211_tid_config { /* XXX TODO */ int n_tid_conf; struct cfg80211_tid_cfg tid_conf[0]; }; struct ieee80211_iface_limit { /* TODO FIXME */ int max, types; }; struct ieee80211_iface_combination { /* TODO FIXME */ const struct ieee80211_iface_limit *limits; int n_limits; int max_interfaces, num_different_channels; int beacon_int_infra_match, beacon_int_min_gcd; int radar_detect_widths; }; struct iface_combination_params { int num_different_channels; int iftype_num[NUM_NL80211_IFTYPES]; }; struct regulatory_request { /* XXX TODO */ uint8_t alpha2[2]; int initiator, dfs_region; }; enum wiphy_vendor_cmd_need_flags { WIPHY_VENDOR_CMD_NEED_NETDEV = 0x01, WIPHY_VENDOR_CMD_NEED_RUNNING = 0x02, WIPHY_VENDOR_CMD_NEED_WDEV = 0x04, }; struct wiphy_vendor_command { struct { uint32_t vendor_id; uint32_t subcmd; }; uint32_t flags; void *policy; int (*doit)(struct wiphy *, struct wireless_dev *, const void *, int); }; struct wiphy_iftype_ext_capab { /* TODO FIXME */ enum nl80211_iftype iftype; const uint8_t *extended_capabilities; const uint8_t *extended_capabilities_mask; uint8_t extended_capabilities_len; }; struct tid_config_support { /* TODO FIXME */ uint64_t vif; /* enum nl80211_tid_cfg_attr */ uint64_t peer; /* enum nl80211_tid_cfg_attr */ }; enum cfg80211_regulatory { REGULATORY_CUSTOM_REG = BIT(0), REGULATORY_STRICT_REG = BIT(1), REGULATORY_DISABLE_BEACON_HINTS = BIT(2), REGULATORY_ENABLE_RELAX_NO_IR = BIT(3), REGULATORY_WIPHY_SELF_MANAGED = BIT(4), REGULATORY_COUNTRY_IE_IGNORE = BIT(5), REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(6), }; enum wiphy_flags { WIPHY_FLAG_AP_UAPSD = BIT(0), WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(1), WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(2), WIPHY_FLAG_HAVE_AP_SME = BIT(3), WIPHY_FLAG_IBSS_RSN = BIT(4), WIPHY_FLAG_NETNS_OK = BIT(5), WIPHY_FLAG_OFFCHAN_TX = BIT(6), WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(7), WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(8), WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(9), WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(10), WIPHY_FLAG_SUPPORTS_TDLS = BIT(11), WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(12), WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(13), WIPHY_FLAG_4ADDR_AP = BIT(14), WIPHY_FLAG_4ADDR_STATION = BIT(15), }; struct wiphy { struct device *dev; struct mac_address *addresses; int n_addresses; uint32_t flags; struct ieee80211_supported_band *bands[NUM_NL80211_BANDS]; uint8_t perm_addr[ETH_ALEN]; + uint16_t max_scan_ie_len; /* XXX TODO */ const struct cfg80211_pmsr_capabilities *pmsr_capa; const struct cfg80211_sar_capa *sar_capa; const struct wiphy_iftype_ext_capab *iftype_ext_capab; const struct linuxkpi_ieee80211_regdomain *regd; char fw_version[ETHTOOL_FWVERS_LEN]; const struct ieee80211_iface_combination *iface_combinations; const uint32_t *cipher_suites; int n_iface_combinations; int n_cipher_suites; void(*reg_notifier)(struct wiphy *, struct regulatory_request *); enum cfg80211_regulatory regulatory_flags; int n_vendor_commands; const struct wiphy_vendor_command *vendor_commands; const struct ieee80211_txrx_stypes *mgmt_stypes; uint32_t rts_threshold; uint32_t frag_threshold; struct tid_config_support tid_config_support; int available_antennas_rx, available_antennas_tx; int features, hw_version; - int interface_modes, max_match_sets, max_remain_on_channel_duration, max_scan_ie_len, max_scan_ssids, max_sched_scan_ie_len, max_sched_scan_plan_interval, max_sched_scan_plan_iterations, max_sched_scan_plans, max_sched_scan_reqs, max_sched_scan_ssids; + int interface_modes, max_match_sets, max_remain_on_channel_duration, max_scan_ssids, max_sched_scan_ie_len, max_sched_scan_plan_interval, max_sched_scan_plan_iterations, max_sched_scan_plans, max_sched_scan_reqs, max_sched_scan_ssids; int num_iftype_ext_capab; int max_ap_assoc_sta, probe_resp_offload, software_iftypes; int bss_select_support, max_num_pmkids, retry_long, retry_short, signal_type; int max_data_retry_count; int tx_queue_len, rfkill; int mbssid_max_interfaces; unsigned long ext_features[BITS_TO_LONGS(NUM_NL80211_EXT_FEATURES)]; struct dentry *debugfsdir; struct cfg80211_wowlan_support *wowlan; /* Lower layer (driver/mac80211) specific data. */ /* Must stay last. */ uint8_t priv[0] __aligned(CACHE_LINE_SIZE); }; struct wireless_dev { /* XXX TODO, like ic? */ int iftype; int address; struct net_device *netdev; struct wiphy *wiphy; }; struct cfg80211_ops { /* XXX TODO */ struct wireless_dev *(*add_virtual_intf)(struct wiphy *, const char *, unsigned char, enum nl80211_iftype, struct vif_params *); int (*del_virtual_intf)(struct wiphy *, struct wireless_dev *); s32 (*change_virtual_intf)(struct wiphy *, struct net_device *, enum nl80211_iftype, struct vif_params *); s32 (*scan)(struct wiphy *, struct cfg80211_scan_request *); s32 (*set_wiphy_params)(struct wiphy *, u32); s32 (*join_ibss)(struct wiphy *, struct net_device *, struct cfg80211_ibss_params *); s32 (*leave_ibss)(struct wiphy *, struct net_device *); s32 (*get_station)(struct wiphy *, struct net_device *, const u8 *, struct station_info *); int (*dump_station)(struct wiphy *, struct net_device *, int, u8 *, struct station_info *); s32 (*set_tx_power)(struct wiphy *, struct wireless_dev *, enum nl80211_tx_power_setting, s32); s32 (*get_tx_power)(struct wiphy *, struct wireless_dev *, s32 *); s32 (*add_key)(struct wiphy *, struct net_device *, u8, bool, const u8 *, struct key_params *); s32 (*del_key)(struct wiphy *, struct net_device *, u8, bool, const u8 *); s32 (*get_key)(struct wiphy *, struct net_device *, u8, bool, const u8 *, void *, void(*)(void *, struct key_params *)); s32 (*set_default_key)(struct wiphy *, struct net_device *, u8, bool, bool); s32 (*set_default_mgmt_key)(struct wiphy *, struct net_device *, u8); s32 (*set_power_mgmt)(struct wiphy *, struct net_device *, bool, s32); s32 (*connect)(struct wiphy *, struct net_device *, struct cfg80211_connect_params *); s32 (*disconnect)(struct wiphy *, struct net_device *, u16); s32 (*suspend)(struct wiphy *, struct cfg80211_wowlan *); s32 (*resume)(struct wiphy *); s32 (*set_pmksa)(struct wiphy *, struct net_device *, struct cfg80211_pmksa *); s32 (*del_pmksa)(struct wiphy *, struct net_device *, struct cfg80211_pmksa *); s32 (*flush_pmksa)(struct wiphy *, struct net_device *); s32 (*start_ap)(struct wiphy *, struct net_device *, struct cfg80211_ap_settings *); int (*stop_ap)(struct wiphy *, struct net_device *); s32 (*change_beacon)(struct wiphy *, struct net_device *, struct cfg80211_beacon_data *); int (*del_station)(struct wiphy *, struct net_device *, struct station_del_parameters *); int (*change_station)(struct wiphy *, struct net_device *, const u8 *, struct station_parameters *); int (*sched_scan_start)(struct wiphy *, struct net_device *, struct cfg80211_sched_scan_request *); int (*sched_scan_stop)(struct wiphy *, struct net_device *, u64); void (*update_mgmt_frame_registrations)(struct wiphy *, struct wireless_dev *, struct mgmt_frame_regs *); int (*mgmt_tx)(struct wiphy *, struct wireless_dev *, struct cfg80211_mgmt_tx_params *, u64 *); int (*cancel_remain_on_channel)(struct wiphy *, struct wireless_dev *, u64); int (*get_channel)(struct wiphy *, struct wireless_dev *, struct cfg80211_chan_def *); int (*crit_proto_start)(struct wiphy *, struct wireless_dev *, enum nl80211_crit_proto_id, u16); void (*crit_proto_stop)(struct wiphy *, struct wireless_dev *); int (*tdls_oper)(struct wiphy *, struct net_device *, const u8 *, enum nl80211_tdls_operation); int (*update_connect_params)(struct wiphy *, struct net_device *, struct cfg80211_connect_params *, u32); int (*set_pmk)(struct wiphy *, struct net_device *, const struct cfg80211_pmk_conf *); int (*del_pmk)(struct wiphy *, struct net_device *, const u8 *); int (*remain_on_channel)(struct wiphy *, struct wireless_dev *, struct linuxkpi_ieee80211_channel *, unsigned int, u64 *); int (*start_p2p_device)(struct wiphy *, struct wireless_dev *); void (*stop_p2p_device)(struct wiphy *, struct wireless_dev *); }; /* -------------------------------------------------------------------------- */ /* linux_80211.c */ struct wiphy *linuxkpi_wiphy_new(const struct cfg80211_ops *, size_t); void linuxkpi_wiphy_free(struct wiphy *wiphy); int linuxkpi_regulatory_set_wiphy_regd_sync(struct wiphy *wiphy, struct linuxkpi_ieee80211_regdomain *regd); uint32_t linuxkpi_ieee80211_channel_to_frequency(uint32_t, enum nl80211_band); uint32_t linuxkpi_ieee80211_frequency_to_channel(uint32_t, uint32_t); struct linuxkpi_ieee80211_channel * linuxkpi_ieee80211_get_channel(struct wiphy *, uint32_t); void linuxkpi_cfg80211_bss_flush(struct wiphy *); /* -------------------------------------------------------------------------- */ static __inline struct wiphy * wiphy_new(const struct cfg80211_ops *ops, size_t priv_len) { return (linuxkpi_wiphy_new(ops, priv_len)); } static __inline void wiphy_free(struct wiphy *wiphy) { linuxkpi_wiphy_free(wiphy); } static __inline void * wiphy_priv(struct wiphy *wiphy) { return (wiphy->priv); } static __inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) { wiphy->dev = dev; } static __inline struct device * wiphy_dev(struct wiphy *wiphy) { return (wiphy->dev); } #define wiphy_err(_wiphy, _fmt, ...) \ dev_err((_wiphy)->dev, _fmt, __VA_ARGS__) static __inline const struct linuxkpi_ieee80211_regdomain * wiphy_dereference(struct wiphy *wiphy, const struct linuxkpi_ieee80211_regdomain *regd) { TODO(); return (NULL); } static __inline void wiphy_lock(struct wiphy *wiphy) { TODO(); } static __inline void wiphy_unlock(struct wiphy *wiphy) { TODO(); } static __inline void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked, enum rfkill_hard_block_reasons reason) { TODO(); } /* -------------------------------------------------------------------------- */ static __inline bool rfkill_blocked(int rfkill) /* argument type? */ { TODO(); return (false); } static __inline bool rfkill_soft_blocked(int rfkill) { TODO(); return (false); } static __inline int reg_query_regdb_wmm(uint8_t *alpha2, uint32_t center_freq, struct ieee80211_reg_rule *rule) { /* ETSI has special rules. FreeBSD regdb needs to learn about them. */ TODO(); return (-ENXIO); } static __inline const u8 * cfg80211_find_ie_match(uint32_t f, const u8 *ies, size_t ies_len, const u8 *match, int x, int y) { TODO(); return (NULL); } static __inline const u8 * cfg80211_find_ie(uint8_t eid, const uint8_t *ie, uint32_t ielen) { TODO(); return (NULL); } static __inline void cfg80211_pmsr_complete(struct wireless_dev *wdev, struct cfg80211_pmsr_request *req, gfp_t gfp) { TODO(); } static __inline void cfg80211_pmsr_report(struct wireless_dev *wdev, struct cfg80211_pmsr_request *req, struct cfg80211_pmsr_result *result, gfp_t gfp) { TODO(); } static __inline void cfg80211_chandef_create(struct cfg80211_chan_def *chandef, struct linuxkpi_ieee80211_channel *chan, enum nl80211_chan_flags chan_flag) { KASSERT(chandef != NULL, ("%s: chandef is NULL\n", __func__)); KASSERT(chan != NULL, ("%s: chan is NULL\n", __func__)); memset(chandef, 0, sizeof(*chandef)); chandef->chan = chan; chandef->center_freq2 = 0; /* Set here and only overwrite if needed. */ switch (chan_flag) { case NL80211_CHAN_NO_HT: chandef->width = NL80211_CHAN_WIDTH_20_NOHT; chandef->center_freq1 = chan->center_freq; break; default: + IMPROVE("Also depends on our manual settings"); if (chan->flags & IEEE80211_CHAN_NO_HT40) chandef->width = NL80211_CHAN_WIDTH_20; else if (chan->flags & IEEE80211_CHAN_NO_80MHZ) chandef->width = NL80211_CHAN_WIDTH_40; else if (chan->flags & IEEE80211_CHAN_NO_160MHZ) chandef->width = NL80211_CHAN_WIDTH_80; else { chandef->width = NL80211_CHAN_WIDTH_160; IMPROVE("80P80 and 320 ..."); } chandef->center_freq1 = chan->center_freq; break; }; } static __inline void cfg80211_bss_iter(struct wiphy *wiphy, struct cfg80211_chan_def *chandef, void (*iterfunc)(struct wiphy *, struct cfg80211_bss *, void *), void *data) { TODO(); } struct element { uint8_t id; uint8_t datalen; uint8_t data[0]; } __packed; static __inline const struct element * cfg80211_find_elem(enum ieee80211_eid eid, uint8_t *data, size_t len) { TODO(); return (NULL); } static __inline uint32_t cfg80211_calculate_bitrate(struct rate_info *rate) { TODO(); return (-1); } static __inline uint32_t ieee80211_channel_to_frequency(uint32_t channel, enum nl80211_band band) { return (linuxkpi_ieee80211_channel_to_frequency(channel, band)); } static __inline uint32_t ieee80211_frequency_to_channel(uint32_t freq) { return (linuxkpi_ieee80211_frequency_to_channel(freq, 0)); } static __inline int regulatory_set_wiphy_regd_sync(struct wiphy *wiphy, struct linuxkpi_ieee80211_regdomain *regd) { IMPROVE(); return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd)); } static __inline int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy, struct linuxkpi_ieee80211_regdomain *regd) { IMPROVE(); return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd)); } static __inline int regulatory_set_wiphy_regd(struct wiphy *wiphy, struct linuxkpi_ieee80211_regdomain *regd) { IMPROVE(); if (regd == NULL) return (EINVAL); /* XXX-BZ wild guessing here based on brcmfmac. */ if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) wiphy->regd = regd; else return (EPERM); /* XXX FIXME, do we have to do anything with reg_notifier? */ return (0); } static __inline int regulatory_hint(struct wiphy *wiphy, const uint8_t *alpha2) { TODO(); return (-ENXIO); } static __inline const char * reg_initiator_name(enum nl80211_reg_initiator initiator) { TODO(); return (NULL); } static __inline struct linuxkpi_ieee80211_regdomain * rtnl_dereference(const struct linuxkpi_ieee80211_regdomain *regd) { TODO(); return (NULL); } static __inline struct ieee80211_reg_rule * freq_reg_info(struct wiphy *wiphy, uint32_t center_freq) { TODO(); return (NULL); } static __inline struct cfg80211_bss * cfg80211_get_bss(struct wiphy *wiphy, struct linuxkpi_ieee80211_channel *chan, - uint8_t *bssid, void *p, int x, uint32_t f1, uint32_t f2) + const uint8_t *bssid, void *p, int x, uint32_t f1, uint32_t f2) { TODO(); return (NULL); } static __inline void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss) { TODO(); } static __inline void wiphy_apply_custom_regulatory(struct wiphy *wiphy, const struct linuxkpi_ieee80211_regdomain *regd) { TODO(); } static __inline char * wiphy_name(struct wiphy *wiphy) { if (wiphy != NULL && wiphy->dev != NULL) return dev_name(wiphy->dev); else { IMPROVE("wlanNA"); return ("wlanNA"); } } static __inline void wiphy_read_of_freq_limits(struct wiphy *wiphy) { #ifdef FDT TODO(); #endif } static __inline uint8_t * cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, uint8_t *data, size_t len) { TODO(); return (NULL); } static __inline void wiphy_ext_feature_set(struct wiphy *wiphy, enum nl80211_ext_feature ef) { set_bit(ef, wiphy->ext_features); } static __inline void * wiphy_net(struct wiphy *wiphy) { TODO(); return (NULL); /* XXX passed to dev_net_set() */ } static __inline int wiphy_register(struct wiphy *wiphy) { TODO(); return (0); } static __inline void wiphy_unregister(struct wiphy *wiphy) { TODO(); } static __inline void wiphy_warn(struct wiphy *wiphy, const char *fmt, ...) { TODO(); } static __inline int cfg80211_check_combinations(struct wiphy *wiphy, struct iface_combination_params *params) { TODO(); return (-ENOENT); } static __inline uint8_t cfg80211_classify8021d(struct sk_buff *skb, void *p) { TODO(); return (0); } static __inline void cfg80211_connect_done(struct net_device *ndev, struct cfg80211_connect_resp_params *conn_params, gfp_t gfp) { TODO(); } static __inline void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp) { TODO(); } static __inline void cfg80211_disconnected(struct net_device *ndev, uint16_t reason, void *p, int x, bool locally_generated, gfp_t gfp) { TODO(); } static __inline int cfg80211_get_p2p_attr(const u8 *ie, u32 ie_len, enum ieee80211_p2p_attr_ids attr, u8 *p, size_t p_len) { TODO(); return (-1); } static __inline void cfg80211_ibss_joined(struct net_device *ndev, const uint8_t *addr, struct linuxkpi_ieee80211_channel *chan, gfp_t gfp) { TODO(); } static __inline struct cfg80211_bss * cfg80211_inform_bss(struct wiphy *wiphy, struct linuxkpi_ieee80211_channel *channel, enum cfg80211_bss_frame_type bss_ftype, const uint8_t *bss, int _x, uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len, int signal, gfp_t gfp) { TODO(); return (NULL); } static __inline struct cfg80211_bss * cfg80211_inform_bss_data(struct wiphy *wiphy, struct cfg80211_inform_bss *bss_data, enum cfg80211_bss_frame_type bss_ftype, const uint8_t *bss, int _x, uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len, gfp_t gfp) { TODO(); return (NULL); } static __inline void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, uint64_t cookie, const u8 *buf, size_t len, bool ack, gfp_t gfp) { TODO(); } static __inline void cfg80211_michael_mic_failure(struct net_device *ndev, const uint8_t *addr, enum nl80211_key_type key_type, int _x, void *p, gfp_t gfp) { TODO(); } static __inline void cfg80211_new_sta(struct net_device *ndev, const uint8_t *addr, struct station_info *sinfo, gfp_t gfp) { TODO(); } static __inline void cfg80211_del_sta(struct net_device *ndev, const uint8_t *addr, gfp_t gfp) { TODO(); } static __inline void cfg80211_port_authorized(struct net_device *ndev, const uint8_t *bssid, gfp_t gfp) { TODO(); } static __inline void cfg80211_ready_on_channel(struct wireless_dev *wdev, uint64_t cookie, struct linuxkpi_ieee80211_channel *channel, unsigned int duration, gfp_t gfp) { TODO(); } static __inline void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, uint64_t cookie, struct linuxkpi_ieee80211_channel *channel, gfp_t gfp) { TODO(); } static __inline void cfg80211_report_wowlan_wakeup(void) { TODO(); } static __inline void cfg80211_roamed(struct net_device *ndev, struct cfg80211_roam_info *roam_info, gfp_t gfp) { TODO(); } static __inline void cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int _x, uint8_t *p, size_t p_len, int _x2) { TODO(); } static __inline void cfg80211_scan_done(struct cfg80211_scan_request *scan_request, struct cfg80211_scan_info *info) { TODO(); } static __inline void cfg80211_sched_scan_results(struct wiphy *wiphy, uint64_t reqid) { TODO(); } static __inline void cfg80211_sched_scan_stopped(struct wiphy *wiphy, int _x) { TODO(); } static __inline void cfg80211_unregister_wdev(struct wireless_dev *wdev) { TODO(); } static __inline struct sk_buff * cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, unsigned int len) { TODO(); return (NULL); } static __inline int cfg80211_vendor_cmd_reply(struct sk_buff *skb) { TODO(); return (-ENXIO); } static __inline struct linuxkpi_ieee80211_channel * ieee80211_get_channel(struct wiphy *wiphy, uint32_t freq) { return (linuxkpi_ieee80211_get_channel(wiphy, freq)); } static __inline size_t ieee80211_get_hdrlen_from_skb(struct sk_buff *skb) { TODO(); return (-1); } static __inline void cfg80211_bss_flush(struct wiphy *wiphy) { linuxkpi_cfg80211_bss_flush(wiphy); } static __inline bool cfg80211_channel_is_psc(struct linuxkpi_ieee80211_channel *channel) { /* Only 6Ghz. */ if (channel->band != NL80211_BAND_6GHZ) return (false); TODO(); return (false); } static __inline int cfg80211_get_ies_channel_number(const uint8_t *ie, size_t len, enum nl80211_band band, enum cfg80211_bss_frame_type ftype) { TODO(); return (-1); } /* Used for scanning at least. */ static __inline void get_random_mask_addr(uint8_t *dst, const uint8_t *addr, const uint8_t *mask) { int i; /* Get a completely random address and then overlay what we want. */ get_random_bytes(dst, ETH_ALEN); for (i = 0; i < ETH_ALEN; i++) dst[i] = (dst[i] & ~(mask[i])) | (addr[i] & mask[i]); } static __inline void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy) { TODO(); } static __inline bool cfg80211_reg_can_beacon(struct wiphy *wiphy, struct cfg80211_chan_def *chandef, enum nl80211_iftype iftype) { TODO(); return (false); } static __inline void cfg80211_background_radar_event(struct wiphy *wiphy, struct cfg80211_chan_def *chandef, gfp_t gfp) { TODO(); } static __inline const u8 * cfg80211_find_ext_ie(uint8_t eid, uint8_t *p, size_t len) { TODO(); return (NULL); } static __inline bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef) { TODO(); return (false); } #define wiphy_info(wiphy, fmt, ...) \ printf("%s:%d XXX TODO " fmt, __func__, __LINE__, __VA_ARGS__) #ifndef LINUXKPI_NET80211 #define ieee80211_channel linuxkpi_ieee80211_channel #define ieee80211_regdomain linuxkpi_ieee80211_regdomain #endif +#include + #endif /* _LINUXKPI_NET_CFG80211_H */ diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h index 659101dec689..33379900b625 100644 --- a/sys/compat/linuxkpi/common/include/net/mac80211.h +++ b/sys/compat/linuxkpi/common/include/net/mac80211.h @@ -1,2320 +1,2435 @@ /*- * Copyright (c) 2020-2022 The FreeBSD Foundation * Copyright (c) 2020-2022 Bjoern A. Zeeb * * This software was developed by Björn Zeeb under sponsorship from * the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _LINUXKPI_NET_MAC80211_H #define _LINUXKPI_NET_MAC80211_H #include #include #include #include #include #include #include #include #include #define ARPHRD_IEEE80211_RADIOTAP __LINE__ /* XXX TODO brcmfmac */ #define WLAN_OUI_MICROSOFT (0x0050F2) #define WLAN_OUI_TYPE_MICROSOFT_WPA (1) #define WLAN_OUI_TYPE_MICROSOFT_TPC (8) #define WLAN_OUI_TYPE_WFA_P2P (9) #define WLAN_OUI_WFA (0x506F9A) /* hw->conf.flags */ enum ieee80211_hw_conf_flags { IEEE80211_CONF_IDLE = BIT(0), IEEE80211_CONF_PS = BIT(1), IEEE80211_CONF_MONITOR = BIT(2), IEEE80211_CONF_OFFCHANNEL = BIT(3), }; /* (*ops->config()) */ enum ieee80211_hw_conf_changed_flags { IEEE80211_CONF_CHANGE_CHANNEL = BIT(0), IEEE80211_CONF_CHANGE_IDLE = BIT(1), IEEE80211_CONF_CHANGE_PS = BIT(2), IEEE80211_CONF_CHANGE_MONITOR = BIT(3), IEEE80211_CONF_CHANGE_POWER = BIT(4), }; #define CFG80211_TESTMODE_CMD(_x) /* XXX TODO */ #define CFG80211_TESTMODE_DUMP(_x) /* XXX TODO */ #define FCS_LEN 4 /* ops.configure_filter() */ enum mcast_filter_flags { FIF_ALLMULTI = BIT(0), FIF_PROBE_REQ = BIT(1), FIF_BCN_PRBRESP_PROMISC = BIT(2), FIF_FCSFAIL = BIT(3), FIF_OTHER_BSS = BIT(4), FIF_PSPOLL = BIT(5), FIF_CONTROL = BIT(6), }; enum ieee80211_bss_changed { BSS_CHANGED_ARP_FILTER = BIT(0), BSS_CHANGED_ASSOC = BIT(1), BSS_CHANGED_BANDWIDTH = BIT(2), BSS_CHANGED_BEACON = BIT(3), BSS_CHANGED_BEACON_ENABLED = BIT(4), BSS_CHANGED_BEACON_INFO = BIT(5), BSS_CHANGED_BEACON_INT = BIT(6), BSS_CHANGED_BSSID = BIT(7), BSS_CHANGED_CQM = BIT(8), BSS_CHANGED_ERP_CTS_PROT = BIT(9), BSS_CHANGED_ERP_SLOT = BIT(10), BSS_CHANGED_FTM_RESPONDER = BIT(11), BSS_CHANGED_HT = BIT(12), BSS_CHANGED_IDLE = BIT(13), BSS_CHANGED_MU_GROUPS = BIT(14), BSS_CHANGED_P2P_PS = BIT(15), BSS_CHANGED_PS = BIT(16), BSS_CHANGED_QOS = BIT(17), BSS_CHANGED_TXPOWER = BIT(18), BSS_CHANGED_HE_BSS_COLOR = BIT(19), BSS_CHANGED_AP_PROBE_RESP = BIT(20), BSS_CHANGED_BASIC_RATES = BIT(21), BSS_CHANGED_ERP_PREAMBLE = BIT(22), BSS_CHANGED_IBSS = BIT(23), BSS_CHANGED_MCAST_RATE = BIT(24), BSS_CHANGED_SSID = BIT(25), BSS_CHANGED_FILS_DISCOVERY = BIT(26), BSS_CHANGED_HE_OBSS_PD = BIT(27), BSS_CHANGED_TWT = BIT(28), BSS_CHANGED_UNSOL_BCAST_PROBE_RESP = BIT(30), }; /* 802.11 Figure 9-256 Suite selector format. [OUI(3), SUITE TYPE(1)] */ #define WLAN_CIPHER_SUITE_OUI(_oui, _x) (((_oui) << 8) | ((_x) & 0xff)) /* 802.11 Table 9-131 Cipher suite selectors. */ /* 802.1x suite B 11 */ #define WLAN_CIPHER_SUITE(_x) WLAN_CIPHER_SUITE_OUI(0x000fac, _x) /* Use group 0 */ #define WLAN_CIPHER_SUITE_WEP40 WLAN_CIPHER_SUITE(1) #define WLAN_CIPHER_SUITE_TKIP WLAN_CIPHER_SUITE(2) /* Reserved 3 */ #define WLAN_CIPHER_SUITE_CCMP WLAN_CIPHER_SUITE(4) /* CCMP-128 */ #define WLAN_CIPHER_SUITE_WEP104 WLAN_CIPHER_SUITE(5) #define WLAN_CIPHER_SUITE_AES_CMAC WLAN_CIPHER_SUITE(6) /* BIP-CMAC-128 */ /* Group addressed traffic not allowed 7 */ #define WLAN_CIPHER_SUITE_GCMP WLAN_CIPHER_SUITE(8) #define WLAN_CIPHER_SUITE_GCMP_256 WLAN_CIPHER_SUITE(9) #define WLAN_CIPHER_SUITE_CCMP_256 WLAN_CIPHER_SUITE(10) #define WLAN_CIPHER_SUITE_BIP_GMAC_128 WLAN_CIPHER_SUITE(11) #define WLAN_CIPHER_SUITE_BIP_GMAC_256 WLAN_CIPHER_SUITE(12) #define WLAN_CIPHER_SUITE_BIP_CMAC_256 WLAN_CIPHER_SUITE(13) /* Reserved 14-255 */ /* See ISO/IEC JTC 1 N 9880 Table 11 */ #define WLAN_CIPHER_SUITE_SMS4 WLAN_CIPHER_SUITE_OUI(0x001472, 1) /* 802.11 Table 9-133 AKM suite selectors. */ #define WLAN_AKM_SUITE(_x) WLAN_CIPHER_SUITE_OUI(0x000fac, _x) /* Reserved 0 */ #define WLAN_AKM_SUITE_8021X WLAN_AKM_SUITE(1) #define WLAN_AKM_SUITE_PSK WLAN_AKM_SUITE(2) #define WLAN_AKM_SUITE_FT_8021X WLAN_AKM_SUITE(3) #define WLAN_AKM_SUITE_FT_PSK WLAN_AKM_SUITE(4) #define WLAN_AKM_SUITE_8021X_SHA256 WLAN_AKM_SUITE(5) #define WLAN_AKM_SUITE_PSK_SHA256 WLAN_AKM_SUITE(6) /* TDLS 7 */ #define WLAN_AKM_SUITE_SAE WLAN_AKM_SUITE(8) /* FToSAE 9 */ /* AP peer key 10 */ /* 802.1x suite B 11 */ /* 802.1x suite B 384 12 */ /* FTo802.1x 384 13 */ /* Reserved 14-255 */ /* Apparently 11ax defines more. Seen (19,20) mentioned. */ +#define TKIP_PN_TO_IV16(_x) ((uint16_t)(_x & 0xffff)) +#define TKIP_PN_TO_IV32(_x) ((uint32_t)((_x >> 16) & 0xffffffff)) struct ieee80211_sta; /* 802.11-2020 9.4.2.55.3 A-MPDU Parameters field */ #define IEEE80211_HT_AMPDU_PARM_FACTOR 0x3 #define IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT 2 #define IEEE80211_HT_AMPDU_PARM_DENSITY (0x7 << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT) struct ieee80211_ampdu_params { /* TODO FIXME */ struct ieee80211_sta *sta; uint8_t tid; uint16_t ssn; int action, amsdu, buf_size, timeout; }; struct ieee80211_bar { /* TODO FIXME */ int control, start_seq_num; uint8_t *ra; uint16_t frame_control; }; struct ieee80211_p2p_noa_desc { uint32_t count; /* uint8_t ? */ uint32_t duration; uint32_t interval; uint32_t start_time; }; struct ieee80211_p2p_noa_attr { uint8_t index; uint8_t oppps_ctwindow; struct ieee80211_p2p_noa_desc desc[4]; }; struct ieee80211_mutable_offsets { /* TODO FIXME */ uint16_t tim_offset; uint16_t cntdwn_counter_offs[2]; int mbssid_off; }; struct mac80211_fils_discovery { uint32_t max_interval; }; #define WLAN_MEMBERSHIP_LEN (8) #define WLAN_USER_POSITION_LEN (16) struct ieee80211_bss_conf { /* TODO FIXME */ const uint8_t *bssid; uint8_t transmitter_bssid[ETH_ALEN]; struct ieee80211_ftm_responder_params *ftmr_params; struct ieee80211_p2p_noa_attr p2p_noa_attr; struct cfg80211_chan_def chandef; __be32 arp_addr_list[1]; /* XXX TODO */ struct ieee80211_rate *beacon_rate; struct { uint8_t membership[WLAN_MEMBERSHIP_LEN]; uint8_t position[WLAN_USER_POSITION_LEN]; } mu_group; struct cfg80211_he_bss_color he_bss_color; struct ieee80211_he_obss_pd he_obss_pd; size_t ssid_len; uint8_t ssid[IEEE80211_NWID_LEN]; uint16_t aid; uint16_t ht_operation_mode; int arp_addr_cnt; uint8_t dtim_period; uint8_t sync_dtim_count; bool assoc; bool idle; bool qos; bool ps; bool twt_broadcast; bool use_cts_prot; bool use_short_preamble; bool use_short_slot; bool he_support; bool csa_active; uint32_t sync_device_ts; uint64_t sync_tsf; uint16_t beacon_int; int16_t txpower; uint32_t basic_rates; int mcast_rate[NUM_NL80211_BANDS]; struct cfg80211_bitrate_mask beacon_tx_rate; struct mac80211_fils_discovery fils_discovery; int ack_enabled, bssid_index, bssid_indicator, cqm_rssi_hyst, cqm_rssi_thold, ema_ap, frame_time_rts_th, ftm_responder; int htc_trig_based_pkt_ext; int multi_sta_back_32bit, nontransmitted; int profile_periodicity; int twt_requester, uora_exists, uora_ocw_range; int assoc_capability, enable_beacon, hidden_ssid, ibss_joined, twt_protected; int he_oper, twt_responder, unsol_bcast_probe_resp_interval; int color_change_active; }; struct ieee80211_chanctx_conf { /* TODO FIXME */ int rx_chains_dynamic, rx_chains_static; bool radar_enabled; struct cfg80211_chan_def def; struct cfg80211_chan_def min_def; /* Must stay last. */ uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE); }; struct ieee80211_channel_switch { /* TODO FIXME */ int block_tx, count, delay, device_timestamp, timestamp; struct cfg80211_chan_def chandef; }; struct ieee80211_cipher_scheme { uint32_t cipher; uint8_t iftype; /* We do not know the size of this. */ uint8_t hdr_len; uint8_t pn_len; uint8_t pn_off; uint8_t key_idx_off; uint8_t key_idx_mask; uint8_t key_idx_shift; uint8_t mic_len; }; enum ieee80211_event_type { BA_FRAME_TIMEOUT, BAR_RX_EVENT, MLME_EVENT, RSSI_EVENT, }; enum ieee80211_rssi_event_data { RSSI_EVENT_LOW, RSSI_EVENT_HIGH, }; enum ieee80211_mlme_event_data { ASSOC_EVENT, AUTH_EVENT, DEAUTH_RX_EVENT, DEAUTH_TX_EVENT, }; enum ieee80211_mlme_event_status { MLME_DENIED, MLME_TIMEOUT, }; struct ieee80211_mlme_event { enum ieee80211_mlme_event_data data; enum ieee80211_mlme_event_status status; int reason; }; struct ieee80211_event { /* TODO FIXME */ enum ieee80211_event_type type; union { struct { int ssn; struct ieee80211_sta *sta; uint8_t tid; } ba; struct ieee80211_mlme_event mlme; } u; }; struct ieee80211_ftm_responder_params { /* TODO FIXME */ uint8_t *lci; uint8_t *civicloc; int lci_len; int civicloc_len; }; struct ieee80211_he_mu_edca_param_ac_rec { /* TODO FIXME */ int aifsn, ecw_min_max, mu_edca_timer; }; struct ieee80211_conf { int dynamic_ps_timeout; int power_level; uint32_t listen_interval; bool radar_enabled; enum ieee80211_hw_conf_flags flags; struct cfg80211_chan_def chandef; }; enum ieee80211_hw_flags { IEEE80211_HW_AMPDU_AGGREGATION, IEEE80211_HW_AP_LINK_PS, IEEE80211_HW_BUFF_MMPDU_TXQ, IEEE80211_HW_CHANCTX_STA_CSA, IEEE80211_HW_CONNECTION_MONITOR, IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP, IEEE80211_HW_HAS_RATE_CONTROL, IEEE80211_HW_MFP_CAPABLE, IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR, IEEE80211_HW_REPORTS_TX_ACK_STATUS, IEEE80211_HW_RX_INCLUDES_FCS, IEEE80211_HW_SIGNAL_DBM, IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS, IEEE80211_HW_SPECTRUM_MGMT, IEEE80211_HW_STA_MMPDU_TXQ, IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU, IEEE80211_HW_SUPPORTS_CLONED_SKBS, IEEE80211_HW_SUPPORTS_DYNAMIC_PS, IEEE80211_HW_SUPPORTS_MULTI_BSSID, IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID, IEEE80211_HW_SUPPORTS_PS, IEEE80211_HW_SUPPORTS_REORDERING_BUFFER, IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW, IEEE80211_HW_SUPPORT_FAST_XMIT, IEEE80211_HW_TDLS_WIDER_BW, IEEE80211_HW_TIMING_BEACON_ONLY, IEEE80211_HW_TX_AMPDU_SETUP_IN_HW, IEEE80211_HW_TX_AMSDU, IEEE80211_HW_TX_FRAG_LIST, IEEE80211_HW_USES_RSS, IEEE80211_HW_WANT_MONITOR_VIF, IEEE80211_HW_SW_CRYPTO_CONTROL, IEEE80211_HW_SUPPORTS_TX_FRAG, IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA, IEEE80211_HW_SUPPORTS_PER_STA_GTK, IEEE80211_HW_REPORTS_LOW_ACK, IEEE80211_HW_QUEUE_CONTROL, IEEE80211_HW_SUPPORTS_RX_DECAP_OFFLOAD, IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD, IEEE80211_HW_SUPPORTS_RC_TABLE, /* Keep last. */ NUM_IEEE80211_HW_FLAGS }; struct ieee80211_hw { struct wiphy *wiphy; /* TODO FIXME */ int max_rx_aggregation_subframes, max_tx_aggregation_subframes; int extra_tx_headroom, weight_multiplier; int max_rate_tries, max_rates, max_report_rates; struct ieee80211_cipher_scheme *cipher_schemes; int n_cipher_schemes; const char *rate_control_algorithm; struct { uint16_t units_pos; /* radiotap "spec" is .. inconsistent. */ uint16_t accuracy; } radiotap_timestamp; size_t sta_data_size; size_t vif_data_size; size_t chanctx_data_size; size_t txq_data_size; uint16_t radiotap_mcs_details; uint16_t radiotap_vht_details; uint16_t queues; uint16_t offchannel_tx_hw_queue; uint16_t uapsd_max_sp_len; uint16_t uapsd_queues; uint16_t max_tx_fragments; uint16_t max_listen_interval; netdev_features_t netdev_features; unsigned long flags[BITS_TO_LONGS(NUM_IEEE80211_HW_FLAGS)]; struct ieee80211_conf conf; #if 0 /* leave here for documentation purposes. This does NOT work. */ /* Must stay last. */ uint8_t priv[0] __aligned(CACHE_LINE_SIZE); #else void *priv; #endif }; enum ieee802111_key_flag { IEEE80211_KEY_FLAG_GENERATE_IV = BIT(0), IEEE80211_KEY_FLAG_GENERATE_MMIC = BIT(1), IEEE80211_KEY_FLAG_PAIRWISE = BIT(2), IEEE80211_KEY_FLAG_PUT_IV_SPACE = BIT(3), IEEE80211_KEY_FLAG_PUT_MIC_SPACE = BIT(4), IEEE80211_KEY_FLAG_SW_MGMT_TX = BIT(5), IEEE80211_KEY_FLAG_GENERATE_IV_MGMT = BIT(6), IEEE80211_KEY_FLAG_GENERATE_MMIE = BIT(7), }; struct ieee80211_key_conf { atomic64_t tx_pn; uint32_t cipher; uint8_t icv_len; /* __unused nowadays? */ uint8_t iv_len; uint8_t hw_key_idx; /* Set by drv. */ uint8_t keyidx; uint16_t flags; uint8_t keylen; uint8_t key[0]; }; struct ieee80211_key_seq { /* TODO FIXME */ union { struct { uint8_t seq[IEEE80211_MAX_PN_LEN]; uint8_t seq_len; } hw; struct { uint8_t pn[IEEE80211_CCMP_PN_LEN]; } ccmp; struct { uint8_t pn[IEEE80211_CCMP_PN_LEN]; } aes_cmac; struct { uint32_t iv32; uint16_t iv16; } tkip; }; }; enum ieee80211_rx_status_flags { RX_FLAG_ALLOW_SAME_PN = BIT(0), RX_FLAG_AMPDU_DETAILS = BIT(1), RX_FLAG_AMPDU_EOF_BIT = BIT(2), RX_FLAG_AMPDU_EOF_BIT_KNOWN = BIT(3), RX_FLAG_DECRYPTED = BIT(4), RX_FLAG_DUP_VALIDATED = BIT(5), RX_FLAG_FAILED_FCS_CRC = BIT(6), RX_FLAG_ICV_STRIPPED = BIT(7), RX_FLAG_MACTIME_PLCP_START = BIT(8), RX_FLAG_MACTIME_START = BIT(9), RX_FLAG_MIC_STRIPPED = BIT(10), RX_FLAG_MMIC_ERROR = BIT(11), RX_FLAG_MMIC_STRIPPED = BIT(12), RX_FLAG_NO_PSDU = BIT(13), RX_FLAG_PN_VALIDATED = BIT(14), RX_FLAG_RADIOTAP_HE = BIT(15), RX_FLAG_RADIOTAP_HE_MU = BIT(16), RX_FLAG_RADIOTAP_LSIG = BIT(17), RX_FLAG_RADIOTAP_VENDOR_DATA = BIT(18), RX_FLAG_NO_SIGNAL_VAL = BIT(19), RX_FLAG_IV_STRIPPED = BIT(20), RX_FLAG_AMPDU_IS_LAST = BIT(21), RX_FLAG_AMPDU_LAST_KNOWN = BIT(22), RX_FLAG_AMSDU_MORE = BIT(23), RX_FLAG_MACTIME_END = BIT(24), RX_FLAG_ONLY_MONITOR = BIT(25), RX_FLAG_SKIP_MONITOR = BIT(26), RX_FLAG_8023 = BIT(27), }; enum mac80211_rx_encoding { RX_ENC_LEGACY = 0, RX_ENC_HT, RX_ENC_VHT, RX_ENC_HE }; struct ieee80211_rx_status { /* TODO FIXME, this is too large. Over-reduce types to u8 where possible. */ uint64_t boottime_ns; uint64_t mactime; uint32_t device_timestamp; enum ieee80211_rx_status_flags flag; uint16_t freq; uint8_t encoding:2, bw:3, he_ru:3; /* enum mac80211_rx_encoding, rate_info_bw */ /* See mt76.h */ uint8_t ampdu_reference; uint8_t band; uint8_t chains; int8_t chain_signal[IEEE80211_MAX_CHAINS]; int8_t signal; uint8_t enc_flags; uint8_t he_dcm; uint8_t he_gi; uint8_t zero_length_psdu_type; uint8_t nss; uint8_t rate_idx; }; struct ieee80211_tx_rate_status { }; struct ieee80211_tx_status { struct ieee80211_sta *sta; struct ieee80211_tx_info *info; u8 n_rates; struct ieee80211_tx_rate_status *rates; struct sk_buff *skb; struct list_head *free_list; }; struct ieee80211_scan_ies { /* TODO FIXME */ int common_ie_len; int len[NUM_NL80211_BANDS]; uint8_t *common_ies; uint8_t *ies[NUM_NL80211_BANDS]; }; struct ieee80211_scan_request { struct ieee80211_scan_ies ies; struct cfg80211_scan_request req; }; struct ieee80211_txq { struct ieee80211_sta *sta; struct ieee80211_vif *vif; int ac; uint8_t tid; /* Must stay last. */ uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE); }; struct ieee80211_sta_rates { /* XXX TODO */ /* XXX some _rcu thing */ struct { int idx; int flags; } rate[1]; /* XXX what is the real number? */ }; struct ieee80211_sta_txpwr { /* XXX TODO */ enum nl80211_tx_power_setting type; short power; }; struct ieee80211_link_sta { uint32_t supp_rates[NUM_NL80211_BANDS]; struct ieee80211_sta_ht_cap ht_cap; struct ieee80211_sta_vht_cap vht_cap; struct ieee80211_sta_he_cap he_cap; struct ieee80211_sta_he_6ghz_capa he_6ghz_capa; uint8_t rx_nss; enum ieee80211_sta_rx_bw bandwidth; struct ieee80211_sta_txpwr txpwr; }; #define IEEE80211_NUM_TIDS 16 /* net80211::WME_NUM_TID */ struct ieee80211_sta { /* TODO FIXME */ int max_amsdu_len, max_amsdu_subframes, max_rc_amsdu_len, max_sp; int mfp, smps_mode, tdls, tdls_initiator, uapsd_queues, wme; struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1]; /* iwlwifi: 8 and adds +1 to tid_data, net80211::IEEE80211_TID_SIZE */ struct ieee80211_sta_rates *rates; /* some rcu thing? */ uint32_t max_tid_amsdu_len[IEEE80211_NUM_TIDS]; uint8_t addr[ETH_ALEN]; uint16_t aid; struct ieee80211_link_sta deflink; /* Must stay last. */ uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE); }; struct ieee80211_tdls_ch_sw_params { /* TODO FIXME */ int action_code, ch_sw_tm_ie, status, switch_time, switch_timeout, timestamp; struct ieee80211_sta *sta; struct cfg80211_chan_def *chandef; struct sk_buff *tmpl_skb; }; struct ieee80211_tx_control { /* TODO FIXME */ struct ieee80211_sta *sta; }; struct ieee80211_tx_queue_params { /* These types are based on iwlwifi FW structs. */ uint16_t cw_min; uint16_t cw_max; uint16_t txop; uint8_t aifs; /* TODO FIXME */ int acm, mu_edca, uapsd; struct ieee80211_he_mu_edca_param_ac_rec mu_edca_param_rec; }; struct ieee80211_tx_rate { uint8_t idx; uint16_t count:5, flags:11; }; enum ieee80211_vif_driver_flags { IEEE80211_VIF_BEACON_FILTER = BIT(0), IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1), IEEE80211_VIF_SUPPORTS_UAPSD = BIT(2), }; #define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4 struct ieee80211_vif_cfg { uint16_t aid; bool assoc; int arp_addr_cnt; uint32_t arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; /* big endian */ }; struct ieee80211_vif { /* TODO FIXME */ enum nl80211_iftype type; int csa_active, mu_mimo_owner; int cab_queue; int color_change_active, offload_flags; enum ieee80211_vif_driver_flags driver_flags; bool p2p; bool probe_req_reg; uint8_t addr[ETH_ALEN]; struct ieee80211_vif_cfg cfg; struct ieee80211_chanctx_conf *chanctx_conf; struct ieee80211_txq *txq; struct ieee80211_bss_conf bss_conf; uint8_t hw_queue[IEEE80211_NUM_ACS]; /* Must stay last. */ uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE); }; struct ieee80211_vif_chanctx_switch { struct ieee80211_chanctx_conf *old_ctx, *new_ctx; struct ieee80211_vif *vif; }; struct ieee80211_prep_tx_info { u16 duration; bool success; }; /* XXX-BZ too big, over-reduce size to u8, and array sizes to minuimum to fit in skb->cb. */ /* Also warning: some sizes change by pointer size! This is 64bit only. */ struct ieee80211_tx_info { enum ieee80211_tx_info_flags flags; /* TODO FIXME */ u8 band; u8 hw_queue; bool tx_time_est; union { struct { struct ieee80211_tx_rate rates[4]; bool use_rts; struct ieee80211_vif *vif; struct ieee80211_key_conf *hw_key; enum ieee80211_tx_control_flags flags; } control; struct { struct ieee80211_tx_rate rates[4]; uint32_t ack_signal; uint8_t ampdu_ack_len; uint8_t ampdu_len; uint8_t antenna; uint16_t tx_time; bool is_valid_ack_signal; void *status_driver_data[16 / sizeof(void *)]; /* XXX TODO */ } status; #define IEEE80211_TX_INFO_DRIVER_DATA_SIZE (5 * sizeof(void *)) /* XXX TODO 5? */ void *driver_data[IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)]; }; }; /* net80211 conflict */ struct linuxkpi_ieee80211_tim_ie { uint8_t dtim_count; uint8_t dtim_period; uint8_t bitmap_ctrl; uint8_t *virtual_map; }; #define ieee80211_tim_ie linuxkpi_ieee80211_tim_ie struct survey_info { /* net80211::struct ieee80211_channel_survey */ /* TODO FIXME */ uint32_t filled; #define SURVEY_INFO_TIME 0x0001 #define SURVEY_INFO_TIME_RX 0x0002 #define SURVEY_INFO_TIME_SCAN 0x0004 #define SURVEY_INFO_TIME_TX 0x0008 #define SURVEY_INFO_TIME_BSS_RX 0x0010 #define SURVEY_INFO_TIME_BUSY 0x0020 #define SURVEY_INFO_IN_USE 0x0040 #define SURVEY_INFO_NOISE_DBM 0x0080 uint32_t noise; uint64_t time; uint64_t time_bss_rx; uint64_t time_busy; uint64_t time_rx; uint64_t time_scan; uint64_t time_tx; struct ieee80211_channel *channel; }; enum ieee80211_iface_iter { IEEE80211_IFACE_ITER_NORMAL = BIT(0), IEEE80211_IFACE_ITER_RESUME_ALL = BIT(1), IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER = BIT(2), /* seems to be an iter flag */ /* Internal flags only. */ /* ieee80211_iterate_active_interfaces*(). */ IEEE80211_IFACE_ITER__ATOMIC = BIT(6), IEEE80211_IFACE_ITER__ACTIVE = BIT(7), + IEEE80211_IFACE_ITER__MTX = BIT(8), }; enum set_key_cmd { SET_KEY, DISABLE_KEY, }; /* 802.11-2020, 9.4.2.55.2 HT Capability Information field. */ enum rx_enc_flags { RX_ENC_FLAG_SHORTPRE = BIT(0), RX_ENC_FLAG_SHORT_GI = BIT(2), RX_ENC_FLAG_HT_GF = BIT(3), RX_ENC_FLAG_STBC_MASK = BIT(4) | BIT(5), #define RX_ENC_FLAG_STBC_SHIFT 4 RX_ENC_FLAG_LDPC = BIT(6), RX_ENC_FLAG_BF = BIT(7), }; enum sta_notify_cmd { STA_NOTIFY_AWAKE, STA_NOTIFY_SLEEP, }; struct ieee80211_low_level_stats { /* Can we make them uint64_t? */ uint32_t dot11ACKFailureCount; uint32_t dot11FCSErrorCount; uint32_t dot11RTSFailureCount; uint32_t dot11RTSSuccessCount; }; enum ieee80211_offload_flags { IEEE80211_OFFLOAD_ENCAP_4ADDR, }; struct ieee80211_ops { /* TODO FIXME */ int (*start)(struct ieee80211_hw *); void (*stop)(struct ieee80211_hw *); int (*config)(struct ieee80211_hw *, u32); void (*reconfig_complete)(struct ieee80211_hw *, enum ieee80211_reconfig_type); int (*add_interface)(struct ieee80211_hw *, struct ieee80211_vif *); void (*remove_interface)(struct ieee80211_hw *, struct ieee80211_vif *); int (*change_interface)(struct ieee80211_hw *, struct ieee80211_vif *, enum nl80211_iftype, bool); void (*sw_scan_start)(struct ieee80211_hw *, struct ieee80211_vif *, const u8 *); void (*sw_scan_complete)(struct ieee80211_hw *, struct ieee80211_vif *); int (*sched_scan_start)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_sched_scan_request *, struct ieee80211_scan_ies *); int (*sched_scan_stop)(struct ieee80211_hw *, struct ieee80211_vif *); int (*hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_scan_request *); void (*cancel_hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *); int (*conf_tx)(struct ieee80211_hw *, struct ieee80211_vif *, u32, u16, const struct ieee80211_tx_queue_params *); void (*tx)(struct ieee80211_hw *, struct ieee80211_tx_control *, struct sk_buff *); int (*tx_last_beacon)(struct ieee80211_hw *); void (*wake_tx_queue)(struct ieee80211_hw *, struct ieee80211_txq *); void (*mgd_prepare_tx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_prep_tx_info *); void (*mgd_complete_tx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_prep_tx_info *); void (*mgd_protect_tdls_discover)(struct ieee80211_hw *, struct ieee80211_vif *); void (*flush)(struct ieee80211_hw *, struct ieee80211_vif *, u32, bool); int (*set_frag_threshold)(struct ieee80211_hw *, u32); void (*sync_rx_queues)(struct ieee80211_hw *); void (*allow_buffered_frames)(struct ieee80211_hw *, struct ieee80211_sta *, u16, int, enum ieee80211_frame_release_type, bool); void (*release_buffered_frames)(struct ieee80211_hw *, struct ieee80211_sta *, u16, int, enum ieee80211_frame_release_type, bool); int (*sta_add)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); int (*sta_remove)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); int (*sta_set_txpwr)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); void (*sta_statistics)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct station_info *); void (*sta_pre_rcu_remove)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); int (*sta_state)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, enum ieee80211_sta_state, enum ieee80211_sta_state); void (*sta_notify)(struct ieee80211_hw *, struct ieee80211_vif *, enum sta_notify_cmd, struct ieee80211_sta *); void (*sta_rc_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u32); void (*sta_rate_tbl_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); void (*sta_set_4addr)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, bool); void (*sta_set_decap_offload)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, bool); u64 (*prepare_multicast)(struct ieee80211_hw *, struct netdev_hw_addr_list *); int (*ampdu_action)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_ampdu_params *); bool (*can_aggregate_in_amsdu)(struct ieee80211_hw *, struct sk_buff *, struct sk_buff *); int (*pre_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *); int (*post_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *); void (*channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *); void (*channel_switch_beacon)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_chan_def *); void (*abort_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *); void (*channel_switch_rx_beacon)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *); int (*tdls_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u8, struct cfg80211_chan_def *, struct sk_buff *, u32); void (*tdls_cancel_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); void (*tdls_recv_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_tdls_ch_sw_params *); int (*add_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *); void (*remove_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *); void (*change_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, u32); int (*assign_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *); void (*unassign_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *); int (*switch_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif_chanctx_switch *, int, enum ieee80211_chanctx_switch_mode); int (*get_antenna)(struct ieee80211_hw *, u32 *, u32 *); int (*set_antenna)(struct ieee80211_hw *, u32, u32); int (*remain_on_channel)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel *, int, enum ieee80211_roc_type); int (*cancel_remain_on_channel)(struct ieee80211_hw *, struct ieee80211_vif *); void (*configure_filter)(struct ieee80211_hw *, unsigned int, unsigned int *, u64); void (*config_iface_filter)(struct ieee80211_hw *, struct ieee80211_vif *, unsigned int, unsigned int); void (*bss_info_changed)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, u64); int (*set_rts_threshold)(struct ieee80211_hw *, u32); void (*event_callback)(struct ieee80211_hw *, struct ieee80211_vif *, const struct ieee80211_event *); int (*get_survey)(struct ieee80211_hw *, int, struct survey_info *); int (*get_ftm_responder_stats)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_ftm_responder_stats *); uint64_t (*get_tsf)(struct ieee80211_hw *, struct ieee80211_vif *); void (*set_tsf)(struct ieee80211_hw *, struct ieee80211_vif *, uint64_t); void (*offset_tsf)(struct ieee80211_hw *, struct ieee80211_vif *, s64); int (*set_bitrate_mask)(struct ieee80211_hw *, struct ieee80211_vif *, const struct cfg80211_bitrate_mask *); void (*set_coverage_class)(struct ieee80211_hw *, s16); int (*set_tim)(struct ieee80211_hw *, struct ieee80211_sta *, bool); int (*set_key)(struct ieee80211_hw *, enum set_key_cmd, struct ieee80211_vif *, struct ieee80211_sta *, struct ieee80211_key_conf *); void (*set_default_unicast_key)(struct ieee80211_hw *, struct ieee80211_vif *, int); void (*update_tkip_key)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_key_conf *, struct ieee80211_sta *, u32, u16 *); int (*start_pmsr)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_pmsr_request *); void (*abort_pmsr)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_pmsr_request *); int (*start_ap)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *link_conf); void (*stop_ap)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *link_conf); int (*join_ibss)(struct ieee80211_hw *, struct ieee80211_vif *); void (*leave_ibss)(struct ieee80211_hw *, struct ieee80211_vif *); int (*set_sar_specs)(struct ieee80211_hw *, const struct cfg80211_sar_specs *); int (*set_tid_config)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct cfg80211_tid_config *); int (*reset_tid_config)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u8); int (*get_et_sset_count)(struct ieee80211_hw *, struct ieee80211_vif *, int); void (*get_et_stats)(struct ieee80211_hw *, struct ieee80211_vif *, struct ethtool_stats *, u64 *); void (*get_et_strings)(struct ieee80211_hw *, struct ieee80211_vif *, u32, u8 *); void (*update_vif_offload)(struct ieee80211_hw *, struct ieee80211_vif *); int (*get_txpower)(struct ieee80211_hw *, struct ieee80211_vif *, int *); int (*get_stats)(struct ieee80211_hw *, struct ieee80211_low_level_stats *); int (*set_radar_background)(struct ieee80211_hw *, struct cfg80211_chan_def *); void (*add_twt_setup)(struct ieee80211_hw *, struct ieee80211_sta *, struct ieee80211_twt_setup *); void (*twt_teardown_request)(struct ieee80211_hw *, struct ieee80211_sta *, u8); }; /* -------------------------------------------------------------------------- */ /* linux_80211.c */ extern const struct cfg80211_ops linuxkpi_mac80211cfgops; struct ieee80211_hw *linuxkpi_ieee80211_alloc_hw(size_t, const struct ieee80211_ops *); void linuxkpi_ieee80211_iffree(struct ieee80211_hw *); void linuxkpi_set_ieee80211_dev(struct ieee80211_hw *, char *); int linuxkpi_ieee80211_ifattach(struct ieee80211_hw *); void linuxkpi_ieee80211_ifdetach(struct ieee80211_hw *); struct ieee80211_hw * linuxkpi_wiphy_to_ieee80211_hw(struct wiphy *); void linuxkpi_ieee80211_iterate_interfaces( struct ieee80211_hw *hw, enum ieee80211_iface_iter flags, void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *), void *); void linuxkpi_ieee80211_iterate_keys(struct ieee80211_hw *, struct ieee80211_vif *, void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct ieee80211_key_conf *, void *), void *); void linuxkpi_ieee80211_iterate_chan_contexts(struct ieee80211_hw *, void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, void *), void *); void linuxkpi_ieee80211_iterate_stations_atomic(struct ieee80211_hw *, void (*iterfunc)(void *, struct ieee80211_sta *), void *); void linuxkpi_ieee80211_scan_completed(struct ieee80211_hw *, struct cfg80211_scan_info *); void linuxkpi_ieee80211_rx(struct ieee80211_hw *, struct sk_buff *, struct ieee80211_sta *, struct napi_struct *); uint8_t linuxkpi_ieee80211_get_tid(struct ieee80211_hdr *, bool); struct ieee80211_sta *linuxkpi_ieee80211_find_sta(struct ieee80211_vif *, const u8 *); struct ieee80211_sta *linuxkpi_ieee80211_find_sta_by_ifaddr( struct ieee80211_hw *, const uint8_t *, const uint8_t *); struct sk_buff *linuxkpi_ieee80211_tx_dequeue(struct ieee80211_hw *, struct ieee80211_txq *); bool linuxkpi_ieee80211_is_ie_id_in_ie_buf(const u8, const u8 *, size_t); bool linuxkpi_ieee80211_ie_advance(size_t *, const u8 *, size_t); void linuxkpi_ieee80211_free_txskb(struct ieee80211_hw *, struct sk_buff *, int); void linuxkpi_ieee80211_queue_delayed_work(struct ieee80211_hw *, struct delayed_work *, int); void linuxkpi_ieee80211_queue_work(struct ieee80211_hw *, struct work_struct *); struct sk_buff *linuxkpi_ieee80211_pspoll_get(struct ieee80211_hw *, struct ieee80211_vif *); struct sk_buff *linuxkpi_ieee80211_nullfunc_get(struct ieee80211_hw *, struct ieee80211_vif *, bool); void linuxkpi_ieee80211_txq_get_depth(struct ieee80211_txq *, unsigned long *, unsigned long *); struct wireless_dev *linuxkpi_ieee80211_vif_to_wdev(struct ieee80211_vif *); void linuxkpi_ieee80211_connection_loss(struct ieee80211_vif *); void linuxkpi_ieee80211_beacon_loss(struct ieee80211_vif *); struct sk_buff *linuxkpi_ieee80211_probereq_get(struct ieee80211_hw *, uint8_t *, uint8_t *, size_t, size_t); void linuxkpi_ieee80211_tx_status(struct ieee80211_hw *, struct sk_buff *); /* -------------------------------------------------------------------------- */ static __inline void _ieee80211_hw_set(struct ieee80211_hw *hw, enum ieee80211_hw_flags flag) { set_bit(flag, hw->flags); } static __inline bool __ieee80211_hw_check(struct ieee80211_hw *hw, enum ieee80211_hw_flags flag) { return (test_bit(flag, hw->flags)); } /* They pass in shortened flag names; how confusingly inconsistent. */ #define ieee80211_hw_set(_hw, _flag) \ _ieee80211_hw_set(_hw, IEEE80211_HW_ ## _flag) #define ieee80211_hw_check(_hw, _flag) \ __ieee80211_hw_check(_hw, IEEE80211_HW_ ## _flag) /* XXX-BZ add CTASSERTS that size of struct is <= sizeof skb->cb. */ CTASSERT(sizeof(struct ieee80211_tx_info) <= sizeof(((struct sk_buff *)0)->cb)); #define IEEE80211_SKB_CB(_skb) \ ((struct ieee80211_tx_info *)((_skb)->cb)) CTASSERT(sizeof(struct ieee80211_rx_status) <= sizeof(((struct sk_buff *)0)->cb)); #define IEEE80211_SKB_RXCB(_skb) \ ((struct ieee80211_rx_status *)((_skb)->cb)) static __inline void ieee80211_free_hw(struct ieee80211_hw *hw) { linuxkpi_ieee80211_iffree(hw); if (hw->wiphy != NULL) wiphy_free(hw->wiphy); /* Note that *hw is not valid any longer after this. */ IMPROVE(); } static __inline struct ieee80211_hw * ieee80211_alloc_hw(size_t priv_len, const struct ieee80211_ops *ops) { return (linuxkpi_ieee80211_alloc_hw(priv_len, ops)); } static __inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev) { set_wiphy_dev(hw->wiphy, dev); linuxkpi_set_ieee80211_dev(hw, dev_name(dev)); IMPROVE(); } static __inline int ieee80211_register_hw(struct ieee80211_hw *hw) { int error; error = wiphy_register(hw->wiphy); if (error != 0) return (error); /* * At this point the driver has set all the options, flags, bands, * ciphers, hw address(es), ... basically mac80211/cfg80211 hw/wiphy * setup is done. * We need to replicate a lot of information from here into net80211. */ error = linuxkpi_ieee80211_ifattach(hw); IMPROVE(); return (error); } static __inline void ieee80211_unregister_hw(struct ieee80211_hw *hw) { wiphy_unregister(hw->wiphy); linuxkpi_ieee80211_ifdetach(hw); IMPROVE(); } static __inline struct ieee80211_hw * wiphy_to_ieee80211_hw(struct wiphy *wiphy) { return (linuxkpi_wiphy_to_ieee80211_hw(wiphy)); } /* -------------------------------------------------------------------------- */ static __inline bool ieee80211_is_action(__le16 fc) { __le16 v; fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); v = htole16(IEEE80211_FC0_SUBTYPE_ACTION | IEEE80211_FC0_TYPE_MGT); return (fc == v); } static __inline bool ieee80211_is_probe_resp(__le16 fc) { __le16 v; fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); v = htole16(IEEE80211_FC0_SUBTYPE_PROBE_RESP | IEEE80211_FC0_TYPE_MGT); return (fc == v); } static __inline bool ieee80211_is_auth(__le16 fc) { __le16 v; fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); v = htole16(IEEE80211_FC0_SUBTYPE_AUTH | IEEE80211_FC0_TYPE_MGT); return (fc == v); } static __inline bool ieee80211_is_assoc_req(__le16 fc) { __le16 v; fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); v = htole16(IEEE80211_FC0_SUBTYPE_ASSOC_REQ | IEEE80211_FC0_TYPE_MGT); return (fc == v); } static __inline bool ieee80211_is_assoc_resp(__le16 fc) { __le16 v; fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); v = htole16(IEEE80211_FC0_SUBTYPE_ASSOC_RESP | IEEE80211_FC0_TYPE_MGT); return (fc == v); } static __inline bool ieee80211_is_reassoc_req(__le16 fc) { __le16 v; fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); v = htole16(IEEE80211_FC0_SUBTYPE_REASSOC_REQ | IEEE80211_FC0_TYPE_MGT); return (fc == v); } static __inline bool ieee80211_is_reassoc_resp(__le16 fc) { __le16 v; fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); v = htole16(IEEE80211_FC0_SUBTYPE_REASSOC_RESP | IEEE80211_FC0_TYPE_MGT); return (fc == v); } static __inline bool ieee80211_is_disassoc(__le16 fc) { __le16 v; fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); v = htole16(IEEE80211_FC0_SUBTYPE_DISASSOC | IEEE80211_FC0_TYPE_MGT); return (fc == v); } static __inline bool ieee80211_is_data_present(__le16 fc) { __le16 v; /* If it is a data frame and NODATA is not present. */ fc &= htole16(IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_NODATA); v = htole16(IEEE80211_FC0_TYPE_DATA); return (fc == v); } static __inline bool ieee80211_is_deauth(__le16 fc) { __le16 v; fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); v = htole16(IEEE80211_FC0_SUBTYPE_DEAUTH | IEEE80211_FC0_TYPE_MGT); return (fc == v); } static __inline bool ieee80211_is_beacon(__le16 fc) { __le16 v; /* * For as much as I get it this comes in LE and unlike FreeBSD * where we get the entire frame header and u8[], here we get the * 9.2.4.1 Frame Control field only. Mask and compare. */ fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); v = htole16(IEEE80211_FC0_SUBTYPE_BEACON | IEEE80211_FC0_TYPE_MGT); return (fc == v); } static __inline bool ieee80211_is_probe_req(__le16 fc) { __le16 v; fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); v = htole16(IEEE80211_FC0_SUBTYPE_PROBE_REQ | IEEE80211_FC0_TYPE_MGT); return (fc == v); } static __inline bool ieee80211_has_protected(__le16 fc) { return (fc & htole16(IEEE80211_FC1_PROTECTED << 8)); } static __inline bool ieee80211_is_back_req(__le16 fc) { __le16 v; fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); v = htole16(IEEE80211_FC0_SUBTYPE_BAR | IEEE80211_FC0_TYPE_CTL); return (fc == v); } static __inline bool ieee80211_is_bufferable_mmpdu(__le16 fc) { /* 11.2.2 Bufferable MMPDUs, 80211-2020. */ /* XXX we do not care about IBSS yet. */ if (!ieee80211_is_mgmt(fc)) return (false); if (ieee80211_is_action(fc)) /* XXX FTM? */ return (true); if (ieee80211_is_disassoc(fc)) return (true); if (ieee80211_is_deauth(fc)) return (true); return (false); } static __inline bool ieee80211_is_nullfunc(__le16 fc) { __le16 v; fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); v = htole16(IEEE80211_FC0_SUBTYPE_NODATA | IEEE80211_FC0_TYPE_DATA); return (fc == v); } static __inline bool ieee80211_is_qos_nullfunc(__le16 fc) { __le16 v; fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); v = htole16(IEEE80211_FC0_SUBTYPE_QOS_NULL | IEEE80211_FC0_TYPE_DATA); return (fc == v); } static __inline bool ieee80211_is_any_nullfunc(__le16 fc) { return (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc)); } static __inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) { TODO(); return (false); } static __inline bool ieee80211_is_frag(struct ieee80211_hdr *hdr) { TODO(); return (false); } static __inline bool ieee80211_is_first_frag(__le16 fc) { TODO(); return (false); } static __inline bool ieee80211_is_pspoll(__le16 fc) { TODO(); return (false); } static __inline bool ieee80211_is_robust_mgmt_frame(struct sk_buff *skb) { TODO(); return (false); } static __inline bool ieee80211_has_pm(__le16 fc) { TODO(); return (false); } static __inline bool ieee80211_has_a4(__le16 fc) { __le16 v; fc &= htole16((IEEE80211_FC1_DIR_TODS | IEEE80211_FC1_DIR_FROMDS) << 8); v = htole16((IEEE80211_FC1_DIR_TODS | IEEE80211_FC1_DIR_FROMDS) << 8); return (fc == v); } static __inline bool ieee80211_has_order(__le16 fc) { return (fc & htole16(IEEE80211_FC1_ORDER << 8)); } static __inline bool ieee80211_has_retry(__le16 fc) { return (fc & htole16(IEEE80211_FC1_RETRY << 8)); } static __inline bool ieee80211_has_fromds(__le16 fc) { return (fc & htole16(IEEE80211_FC1_DIR_FROMDS << 8)); } static __inline bool ieee80211_has_tods(__le16 fc) { return (fc & htole16(IEEE80211_FC1_DIR_TODS << 8)); } static __inline uint8_t * ieee80211_get_SA(struct ieee80211_hdr *hdr) { if (ieee80211_has_a4(hdr->frame_control)) return (hdr->addr4); if (ieee80211_has_fromds(hdr->frame_control)) return (hdr->addr3); return (hdr->addr2); } static __inline uint8_t * ieee80211_get_DA(struct ieee80211_hdr *hdr) { if (ieee80211_has_tods(hdr->frame_control)) return (hdr->addr3); return (hdr->addr1); } static __inline bool ieee80211_has_morefrags(__le16 fc) { fc &= htole16(IEEE80211_FC1_MORE_FRAG << 8); return (fc != 0); } static __inline u8 * ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr) { if (ieee80211_has_a4(hdr->frame_control)) return (u8 *)hdr + 30; else return (u8 *)hdr + 24; } /* -------------------------------------------------------------------------- */ /* Receive functions (air/driver to mac80211/net80211). */ static __inline void ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *sta, struct sk_buff *skb, struct napi_struct *napi) { linuxkpi_ieee80211_rx(hw, skb, sta, napi); } static __inline void ieee80211_rx_ni(struct ieee80211_hw *hw, struct sk_buff *skb) { linuxkpi_ieee80211_rx(hw, skb, NULL, NULL); } static __inline void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) { linuxkpi_ieee80211_rx(hw, skb, NULL, NULL); } /* -------------------------------------------------------------------------- */ static __inline uint8_t ieee80211_get_tid(struct ieee80211_hdr *hdr) { return (linuxkpi_ieee80211_get_tid(hdr, false)); } static __inline struct sk_buff * ieee80211_beacon_get_tim(struct ieee80211_hw *hw, struct ieee80211_vif *vif, uint16_t *tim_offset, uint16_t *tim_len, uint32_t link_id) { if (tim_offset != NULL) *tim_offset = 0; if (tim_len != NULL) *tim_len = 0; TODO(); return (NULL); } static __inline void ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw, enum ieee80211_iface_iter flags, void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *), void *arg) { flags |= IEEE80211_IFACE_ITER__ATOMIC; flags |= IEEE80211_IFACE_ITER__ACTIVE; linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg); } static __inline void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, enum ieee80211_iface_iter flags, void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *), void *arg) { flags |= IEEE80211_IFACE_ITER__ACTIVE; linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg); } +static __inline void +ieee80211_iterate_active_interfaces_mtx(struct ieee80211_hw *hw, + enum ieee80211_iface_iter flags, + void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *), + void *arg) +{ + flags |= IEEE80211_IFACE_ITER__ACTIVE; + flags |= IEEE80211_IFACE_ITER__MTX; + linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg); +} + static __inline void ieee80211_iterate_interfaces(struct ieee80211_hw *hw, enum ieee80211_iface_iter flags, void (*iterfunc)(void *, uint8_t *, struct ieee80211_vif *), void *arg) { linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg); } static __inline void ieee80211_iter_keys(struct ieee80211_hw *hw, struct ieee80211_vif *vif, void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct ieee80211_key_conf *, void *), void *arg) { linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg); } static __inline void ieee80211_iter_keys_rcu(struct ieee80211_hw *hw, struct ieee80211_vif *vif, void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct ieee80211_key_conf *, void *), void *arg) { IMPROVE(); /* "rcu" */ linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg); } static __inline void ieee80211_iter_chan_contexts_atomic(struct ieee80211_hw *hw, void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, void *), void *arg) { linuxkpi_ieee80211_iterate_chan_contexts(hw, iterfunc, arg); } static __inline void ieee80211_iterate_stations_atomic(struct ieee80211_hw *hw, void (*iterfunc)(void *, struct ieee80211_sta *), void *arg) { linuxkpi_ieee80211_iterate_stations_atomic(hw, iterfunc, arg); } static __inline struct wireless_dev * ieee80211_vif_to_wdev(struct ieee80211_vif *vif) { return (linuxkpi_ieee80211_vif_to_wdev(vif)); } static __inline struct sk_buff * ieee80211_beacon_get_template(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_mutable_offsets *offs, uint32_t link_id) { TODO(); return (NULL); } static __inline void ieee80211_beacon_loss(struct ieee80211_vif *vif) { linuxkpi_ieee80211_beacon_loss(vif); } static __inline void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool t) { TODO(); } static __inline bool ieee80211_csa_is_complete(struct ieee80211_vif *vif) { TODO(); return (false); } static __inline void ieee80211_csa_set_counter(struct ieee80211_vif *vif, uint8_t counter) { TODO(); } static __inline int ieee80211_csa_update_counter(struct ieee80211_vif *vif) { TODO(); return (-1); } static __inline void ieee80211_csa_finish(struct ieee80211_vif *vif) { TODO(); } static __inline enum nl80211_iftype ieee80211_vif_type_p2p(struct ieee80211_vif *vif) { /* If we are not p2p enabled, just return the type. */ if (!vif->p2p) return (vif->type); /* If we are p2p, depending on side, return type. */ switch (vif->type) { case NL80211_IFTYPE_AP: return (NL80211_IFTYPE_P2P_GO); case NL80211_IFTYPE_STATION: return (NL80211_IFTYPE_P2P_CLIENT); default: fallthrough; } return (vif->type); } static __inline unsigned long ieee80211_tu_to_usec(unsigned long tu) { return (tu * IEEE80211_DUR_TU); } -static __inline int +static __inline bool ieee80211_action_contains_tpc(struct sk_buff *skb) { - TODO(); - return (0); + struct ieee80211_mgmt *mgmt; + + mgmt = (struct ieee80211_mgmt *)skb->data; + + /* Check that this is a mgmt/action frame? */ + if (!ieee80211_is_action(mgmt->frame_control)) + return (false); + + /* + * This is a bit convoluted but according to docs both actions + * are checked for this. Kind-of makes sense for the only consumer + * (iwlwifi) I am aware off given the txpower fields are at the + * same location so firmware can update the value. + */ + /* 80211-2020 9.6.2 Spectrum Management Action frames */ + /* 80211-2020 9.6.2.5 TPC Report frame format */ + /* 80211-2020 9.6.6 Radio Measurement action details */ + /* 80211-2020 9.6.6.4 Link Measurement Report frame format */ + /* Check that it is Spectrum Management or Radio Measurement? */ + if (mgmt->u.action.category != IEEE80211_ACTION_CAT_SM && + mgmt->u.action.category != IEEE80211_ACTION_CAT_RADIO_MEASUREMENT) + return (false); + + /* Check that it is TPC Report or Link Measurement Report? */ + KASSERT(IEEE80211_ACTION_SM_TPCREP == IEEE80211_ACTION_RADIO_MEASUREMENT_LMREP, + ("%s: SM_TPCREP %d != RADIO_MEASUREMENT_LMREP %d\n", __func__, + IEEE80211_ACTION_SM_TPCREP, IEEE80211_ACTION_RADIO_MEASUREMENT_LMREP)); + if (mgmt->u.action.u.tpc_report.spec_mgmt != IEEE80211_ACTION_SM_TPCREP) + return (false); + + /* 80211-2020 9.4.2.16 TPC Report element */ + /* Check that the ELEMID and length are correct? */ + if (mgmt->u.action.u.tpc_report.tpc_elem_id != IEEE80211_ELEMID_TPCREP || + mgmt->u.action.u.tpc_report.tpc_elem_length != 4) + return (false); + + /* All the right fields in the right place. */ + return (true); } static __inline void ieee80211_connection_loss(struct ieee80211_vif *vif) { linuxkpi_ieee80211_connection_loss(vif); } static __inline struct ieee80211_sta * ieee80211_find_sta(struct ieee80211_vif *vif, const u8 *peer) { return (linuxkpi_ieee80211_find_sta(vif, peer)); } static __inline struct ieee80211_sta * ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw, const uint8_t *addr, const uint8_t *ourvifaddr) { return (linuxkpi_ieee80211_find_sta_by_ifaddr(hw, addr, ourvifaddr)); } static __inline void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf, struct sk_buff *skb_frag, u8 *key) { TODO(); } static __inline void ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf, const u8 *addr, uint32_t iv32, u16 *p1k) { TODO(); } static __inline size_t ieee80211_ie_split(const u8 *ies, size_t ies_len, const u8 *ie_ids, size_t ie_ids_len, size_t start) { size_t x; x = start; /* XXX FIXME, we need to deal with "Element ID Extension" */ while (x < ies_len) { /* Is this IE[s] one of the ie_ids? */ if (!linuxkpi_ieee80211_is_ie_id_in_ie_buf(ies[x], ie_ids, ie_ids_len)) break; if (!linuxkpi_ieee80211_ie_advance(&x, ies, ies_len)) break; } return (x); } static __inline void ieee80211_request_smps(struct ieee80211_vif *vif, enum ieee80211_smps_mode smps) { static const char *smps_mode_name[] = { "SMPS_OFF", "SMPS_STATIC", "SMPS_DYNAMIC", "SMPS_AUTOMATIC", "SMPS_NUM_MODES" }; if (linuxkpi_debug_80211 & D80211_TODO) printf("%s:%d: XXX LKPI80211 TODO smps %d %s\n", __func__, __LINE__, smps, smps_mode_name[smps]); } static __inline void ieee80211_tdls_oper_request(struct ieee80211_vif *vif, uint8_t *addr, enum nl80211_tdls_operation oper, enum ieee80211_reason_code code, gfp_t gfp) { TODO(); } static __inline void ieee80211_stop_queues(struct ieee80211_hw *hw) { TODO(); } static __inline void ieee80211_wake_queues(struct ieee80211_hw *hw) { TODO(); } static __inline void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool state) { TODO(); } static __inline void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb) { IMPROVE(); /* * This is called on transmit failure. * Use a not-so-random random high status error so we can distinguish * it from normal low values flying around in net80211 ("ETX"). */ linuxkpi_ieee80211_free_txskb(hw, skb, 0x455458); } static __inline void ieee80211_restart_hw(struct ieee80211_hw *hw) { TODO(); } static __inline void ieee80211_ready_on_channel(struct ieee80211_hw *hw) { TODO(); /* XXX-BZ We need to see that. */ } static __inline void ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw) { TODO(); } static __inline void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif, enum nl80211_cqm_rssi_threshold_event crte, int sig, gfp_t gfp) { TODO(); } static __inline void ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *sta, uint8_t tid, uint32_t ssn, uint64_t bitmap, uint16_t received_mpdu) { TODO(); } static __inline bool ieee80211_sn_less(uint16_t sn1, uint16_t sn2) { TODO(); return (false); } static __inline uint16_t ieee80211_sn_inc(uint16_t sn) { TODO(); return (sn + 1); } static __inline uint16_t ieee80211_sn_add(uint16_t sn, uint16_t a) { TODO(); return (sn + a); } static __inline void ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, uint32_t x, uint8_t *addr) { TODO(); } static __inline void ieee80211_rate_set_vht(struct ieee80211_tx_rate *r, uint32_t f1, uint32_t f2) { TODO(); } static __inline void ieee80211_reserve_tid(struct ieee80211_sta *sta, uint8_t tid) { TODO(); } static __inline void ieee80211_unreserve_tid(struct ieee80211_sta *sta, uint8_t tid) { TODO(); } static __inline void ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif, uint8_t *addr, uint8_t tid) { TODO(); } static __inline void ieee80211_send_eosp_nullfunc(struct ieee80211_sta *sta, uint8_t tid) { TODO(); } static __inline uint16_t ieee80211_sn_sub(uint16_t sa, uint16_t sb) { return ((sa - sb) & (IEEE80211_SEQ_SEQ_MASK >> IEEE80211_SEQ_SEQ_SHIFT)); } static __inline void ieee80211_sta_block_awake(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool disable) { TODO(); } static __inline void ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool sleeping) { TODO(); } static __inline void ieee80211_sta_pspoll(struct ieee80211_sta *sta) { TODO(); } static __inline void ieee80211_sta_uapsd_trigger(struct ieee80211_sta *sta, int ntids) { TODO(); } -static __inline void -ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr, - uint8_t tid) -{ - TODO(); -} - static __inline void ieee80211_tkip_add_iv(u8 *crypto_hdr, struct ieee80211_key_conf *keyconf, uint64_t pn) { TODO(); } static __inline struct sk_buff * ieee80211_tx_dequeue(struct ieee80211_hw *hw, struct ieee80211_txq *txq) { return (linuxkpi_ieee80211_tx_dequeue(hw, txq)); } static __inline void ieee80211_update_mu_groups(struct ieee80211_vif *vif, uint8_t *ms, uint8_t *up) { TODO(); } static __inline void ieee80211_sta_set_buffered(struct ieee80211_sta *sta, uint8_t tid, bool t) { TODO(); } static __inline void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) { linuxkpi_ieee80211_tx_status(hw, skb); } static __inline void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, uint8_t tid, struct ieee80211_key_seq *seq) { TODO(); } static __inline void ieee80211_sched_scan_results(struct ieee80211_hw *hw) { TODO(); } static __inline void ieee80211_sta_eosp(struct ieee80211_sta *sta) { TODO(); } +static __inline int +ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid, int x) +{ + TODO("rtw8x"); + return (-EINVAL); +} + +static __inline int +ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid) +{ + TODO("rtw89"); + return (-EINVAL); +} + +static __inline void +ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr, + uint8_t tid) +{ + TODO("iwlwifi"); +} + static __inline void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr, uint8_t tid) { - TODO(); + TODO("iwlwifi/rtw8x/..."); } static __inline void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw) { TODO(); } static __inline void ieee80211_scan_completed(struct ieee80211_hw *hw, struct cfg80211_scan_info *info) { linuxkpi_ieee80211_scan_completed(hw, info); } static __inline struct sk_buff * -ieee80211_beacon_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif) +ieee80211_beacon_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + uint32_t link_id) { TODO(); return (NULL); } static __inline struct sk_buff * ieee80211_pspoll_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { /* Only STA needs this. Otherwise return NULL and panic bad drivers. */ if (vif->type != NL80211_IFTYPE_STATION) return (NULL); return (linuxkpi_ieee80211_pspoll_get(hw, vif)); } static __inline struct sk_buff * ieee80211_proberesp_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { TODO(); return (NULL); } static __inline struct sk_buff * ieee80211_nullfunc_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, bool qos) { /* Only STA needs this. Otherwise return NULL and panic bad drivers. */ if (vif->type != NL80211_IFTYPE_STATION) return (NULL); return (linuxkpi_ieee80211_nullfunc_get(hw, vif, qos)); } static __inline struct sk_buff * ieee80211_probereq_get(struct ieee80211_hw *hw, uint8_t *addr, uint8_t *ssid, size_t ssid_len, size_t tailroom) { return (linuxkpi_ieee80211_probereq_get(hw, addr, ssid, ssid_len, tailroom)); } static __inline void ieee80211_queue_delayed_work(struct ieee80211_hw *hw, struct delayed_work *w, int delay) { linuxkpi_ieee80211_queue_delayed_work(hw, w, delay); } static __inline void ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *w) { linuxkpi_ieee80211_queue_work(hw, w); } static __inline void ieee80211_stop_queue(struct ieee80211_hw *hw, uint16_t q) { TODO(); } static __inline void ieee80211_wake_queue(struct ieee80211_hw *hw, uint16_t q) { TODO(); } static __inline void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) { IMPROVE(); ieee80211_tx_status(hw, skb); } static __inline void ieee80211_tx_status_ni(struct ieee80211_hw *hw, struct sk_buff *skb) { IMPROVE(); ieee80211_tx_status(hw, skb); } -static __inline int -ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid, int x) -{ - TODO(); - return (-EINVAL); -} - -static __inline int -ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid) -{ - TODO(); - return (-EINVAL); -} - static __inline void ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) { int i; /* * Apparently clearing flags and some other fields is not right. * Given the function is called "status" we work on that part of * the union. */ for (i = 0; i < nitems(info->status.rates); i++) info->status.rates[i].count = 0; /* * Unclear if ack_signal should be included or not but we clear the * "valid" bool so this field is no longer valid. */ memset(&info->status.ack_signal, 0, sizeof(*info) - offsetof(struct ieee80211_tx_info, status.ack_signal)); } static __inline void ieee80211_txq_get_depth(struct ieee80211_txq *txq, unsigned long *frame_cnt, unsigned long *byte_cnt) { if (frame_cnt == NULL && byte_cnt == NULL) return; linuxkpi_ieee80211_txq_get_depth(txq, frame_cnt, byte_cnt); } static __inline int rate_lowest_index(struct ieee80211_supported_band *band, struct ieee80211_sta *sta) { IMPROVE(); return (0); } static __inline void SET_IEEE80211_PERM_ADDR (struct ieee80211_hw *hw, uint8_t *addr) { ether_addr_copy(hw->wiphy->perm_addr, addr); } static __inline uint8_t * ieee80211_bss_get_ie(struct cfg80211_bss *bss, uint32_t eid) { TODO(); return (NULL); } static __inline void ieee80211_report_low_ack(struct ieee80211_sta *sta, int x) { TODO(); } static __inline void ieee80211_start_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr, uint8_t tid) { TODO(); } static __inline void ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr, uint8_t tid) { TODO(); } static __inline struct sk_buff * ieee80211_tx_dequeue_ni(struct ieee80211_hw *hw, struct ieee80211_txq *txq) { TODO(); return (NULL); } static __inline void ieee80211_tx_rate_update(struct ieee80211_hw *hw, struct ieee80211_sta *sta, struct ieee80211_tx_info *info) { TODO(); } static __inline bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq) { TODO(); return (false); } -static __inline struct ieee80211_txq * -ieee80211_next_txq(struct ieee80211_hw *hw, uint32_t ac) -{ - TODO(); - return (NULL); -} - static __inline void ieee80211_radar_detected(struct ieee80211_hw *hw) { TODO(); } static __inline void ieee80211_sta_register_airtime(struct ieee80211_sta *sta, uint8_t tid, uint32_t duration, int x) { TODO(); } static __inline void -ieee80211_return_txq(struct ieee80211_hw *hw, - struct ieee80211_txq *txq, bool _t) +ieee80211_txq_schedule_start(struct ieee80211_hw *hw, uint8_t ac) { TODO(); } static __inline void -ieee80211_txq_schedule_end(struct ieee80211_hw *hw, uint32_t ac) +ieee80211_txq_schedule_end(struct ieee80211_hw *hw, uint8_t ac) { + /* DO_NADA; */ +} + +static __inline struct ieee80211_txq * +ieee80211_next_txq(struct ieee80211_hw *hw, uint8_t ac) +{ + TODO(); + return (NULL); } static __inline void -ieee80211_txq_schedule_start(struct ieee80211_hw *hw, uint32_t ac) +ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) { TODO(); } static __inline void -ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) +ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq, + bool withoutpkts) { TODO(); } + static __inline void ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter) { TODO(); } static __inline int ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif) { TODO(); return (-1); } static __inline int ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *vht_cap, uint32_t chanwidth, int x, bool t, int nss) { TODO(); return (-1); } static __inline bool ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif) { TODO(); return (true); } static __inline void ieee80211_disconnect(struct ieee80211_vif *vif, bool _x) { TODO(); } static __inline void ieee80211_channel_switch_disconnect(struct ieee80211_vif *vif, bool _x) { TODO(); } static __inline const struct ieee80211_sta_he_cap * ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *band, enum nl80211_iftype type) { TODO(); return (NULL); } static __inline void ieee80211_key_mic_failure(struct ieee80211_key_conf *key) { TODO(); } static __inline void ieee80211_key_replay(struct ieee80211_key_conf *key) { TODO(); } static __inline uint32_t ieee80211_calc_rx_airtime(struct ieee80211_hw *hw, struct ieee80211_rx_status *rxstat, int len) { TODO(); return (0); } static __inline void ieee80211_get_tx_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct sk_buff *skb, struct ieee80211_tx_rate *txrate, int nrates) { TODO(); } static __inline void ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *sta, struct sk_buff *skb, struct list_head *list) { TODO(); } static __inline void ieee80211_tx_status_ext(struct ieee80211_hw *hw, struct ieee80211_tx_status *txstat) { TODO(); } static __inline const struct element * ieee80211_bss_get_elem(struct cfg80211_bss *bss, uint32_t eid) { TODO(); return (NULL); } static __inline void ieee80211_color_change_finish(struct ieee80211_vif *vif) { TODO(); } static __inline struct sk_buff * ieee80211_get_fils_discovery_tmpl(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { TODO(); return (NULL); } static __inline struct sk_buff * ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { TODO(); return (NULL); } static __inline void linuxkpi_ieee80211_send_bar(struct ieee80211_vif *vif, uint8_t *ra, uint16_t tid, uint16_t ssn) { TODO(); } +static __inline void +ieee80211_resume_disconnect(struct ieee80211_vif *vif) +{ + TODO(); + return; +} + +static __inline int +ieee80211_data_to_8023(struct sk_buff *skb, const uint8_t *addr, + enum nl80211_iftype iftype) +{ + TODO(); + return (-1); +} + +static __inline void +ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *key, + uint32_t iv32, uint16_t *p1k) +{ + TODO(); + return; +} + +static __inline struct ieee80211_key_conf * +ieee80211_gtk_rekey_add(struct ieee80211_vif *vif, + struct ieee80211_key_conf *key) +{ + TODO(); + return (NULL); +} + +static __inline void +ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const uint8_t *bssid, + const uint8_t *replay_ctr, gfp_t gfp) +{ + TODO(); + return; +} + +static __inline void +ieee80211_remove_key(struct ieee80211_key_conf *key) +{ + TODO(); + return; +} + +static __inline void +ieee80211_set_key_rx_seq(struct ieee80211_key_conf *key, int tid, + struct ieee80211_key_seq *seq) +{ + TODO(); + return; +} + +static __inline void +ieee80211_report_wowlan_wakeup(struct ieee80211_vif *vif, + struct cfg80211_wowlan_wakeup *wakeup, gfp_t gfp) +{ + TODO(); + return; +} + #define ieee80211_send_bar(_v, _r, _t, _s) \ linuxkpi_ieee80211_send_bar(_v, _r, _t, _s) #endif /* _LINUXKPI_NET_MAC80211_H */ diff --git a/sys/net80211/ieee80211.h b/sys/net80211/ieee80211.h index f4efc90dfb22..42f864e8aed0 100644 --- a/sys/net80211/ieee80211.h +++ b/sys/net80211/ieee80211.h @@ -1,1551 +1,1557 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _NET80211_IEEE80211_H_ #define _NET80211_IEEE80211_H_ /* * 802.11 protocol definitions. */ #define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */ /* is 802.11 address multicast/broadcast? */ #define IEEE80211_IS_MULTICAST(_a) (*(_a) & 0x01) #ifdef _KERNEL extern const uint8_t ieee80211broadcastaddr[]; #endif typedef uint16_t ieee80211_seq; /* IEEE 802.11 PLCP header */ struct ieee80211_plcp_hdr { uint16_t i_sfd; uint8_t i_signal; uint8_t i_service; uint16_t i_length; uint16_t i_crc; } __packed; #define IEEE80211_PLCP_SFD 0xF3A0 #define IEEE80211_PLCP_SERVICE 0x00 #define IEEE80211_PLCP_SERVICE_LOCKED 0x04 #define IEEE80211_PLCL_SERVICE_PBCC 0x08 #define IEEE80211_PLCP_SERVICE_LENEXT5 0x20 #define IEEE80211_PLCP_SERVICE_LENEXT6 0x40 #define IEEE80211_PLCP_SERVICE_LENEXT7 0x80 /* * generic definitions for IEEE 802.11 frames */ struct ieee80211_frame { uint8_t i_fc[2]; uint8_t i_dur[2]; uint8_t i_addr1[IEEE80211_ADDR_LEN]; uint8_t i_addr2[IEEE80211_ADDR_LEN]; uint8_t i_addr3[IEEE80211_ADDR_LEN]; uint8_t i_seq[2]; /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ /* see below */ } __packed; struct ieee80211_qosframe { uint8_t i_fc[2]; uint8_t i_dur[2]; uint8_t i_addr1[IEEE80211_ADDR_LEN]; uint8_t i_addr2[IEEE80211_ADDR_LEN]; uint8_t i_addr3[IEEE80211_ADDR_LEN]; uint8_t i_seq[2]; uint8_t i_qos[2]; /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ /* see below */ } __packed; struct ieee80211_qoscntl { uint8_t i_qos[2]; }; struct ieee80211_frame_addr4 { uint8_t i_fc[2]; uint8_t i_dur[2]; uint8_t i_addr1[IEEE80211_ADDR_LEN]; uint8_t i_addr2[IEEE80211_ADDR_LEN]; uint8_t i_addr3[IEEE80211_ADDR_LEN]; uint8_t i_seq[2]; uint8_t i_addr4[IEEE80211_ADDR_LEN]; } __packed; struct ieee80211_qosframe_addr4 { uint8_t i_fc[2]; uint8_t i_dur[2]; uint8_t i_addr1[IEEE80211_ADDR_LEN]; uint8_t i_addr2[IEEE80211_ADDR_LEN]; uint8_t i_addr3[IEEE80211_ADDR_LEN]; uint8_t i_seq[2]; uint8_t i_addr4[IEEE80211_ADDR_LEN]; uint8_t i_qos[2]; } __packed; #define IEEE80211_FC0_VERSION_MASK 0x03 #define IEEE80211_FC0_VERSION_SHIFT 0 #define IEEE80211_FC0_VERSION_0 0x00 #define IEEE80211_FC0_TYPE_MASK 0x0c #define IEEE80211_FC0_TYPE_SHIFT 2 #define IEEE80211_FC0_TYPE_MGT 0x00 /* Management */ #define IEEE80211_FC0_TYPE_CTL 0x04 /* Control */ #define IEEE80211_FC0_TYPE_DATA 0x08 /* Data */ #define IEEE80211_FC0_TYPE_EXT 0x0c /* Extension */ #define IEEE80211_FC0_SUBTYPE_MASK 0xf0 #define IEEE80211_FC0_SUBTYPE_SHIFT 4 /* 802.11-2020 Table 9-1-Valid type and subtype combinations */ /* For type 00 Management (IEEE80211_FC0_TYPE_MGT) */ #define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00 /* Association Request */ #define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10 /* Association Response */ #define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20 /* Reassociation Request */ #define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30 /* Reassociation Response */ #define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40 /* Probe Request */ #define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50 /* Probe Response */ #define IEEE80211_FC0_SUBTYPE_TIMING_ADV 0x60 /* Timing Advertisement */ /* 0111 Reserved 0x70 */ #define IEEE80211_FC0_SUBTYPE_BEACON 0x80 /* Beacon */ #define IEEE80211_FC0_SUBTYPE_ATIM 0x90 /* ATIM */ #define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0 /* Disassociation */ #define IEEE80211_FC0_SUBTYPE_AUTH 0xb0 /* Authentication */ #define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0 /* Deauthentication */ #define IEEE80211_FC0_SUBTYPE_ACTION 0xd0 /* Action */ #define IEEE80211_FC0_SUBTYPE_ACTION_NOACK 0xe0 /* Action No Ack */ /* 1111 Reserved 0xf0 */ /* For type 01 Control (IEEE80211_FC0_TYPE_CTL) */ /* 0000-0001 Reserved 0x00-0x10 */ #define IEEE80211_FC0_SUBTYPE_TRIGGER 0x20 /* Trigger, 80211ax-2021 */ #define IEEE80211_FC0_SUBTYPE_TACK 0x30 /* TACK */ #define IEEE80211_FC0_SUBTYPE_BF_REPORT_POLL 0x40 /* Beamforming Report Poll */ #define IEEE80211_FC0_SUBTYPE_VHT_HE_NDP 0x50 /* VHT/HE NDP Announcement, 80211ac/ax-2013/2021 */ #define IEEE80211_FC0_SUBTYPE_CTL_EXT 0x60 /* Control Frame Extension */ #define IEEE80211_FC0_SUBTYPE_CONTROL_WRAP 0x70 /* Control Wrapper */ #define IEEE80211_FC0_SUBTYPE_BAR 0x80 /* Block Ack Request (BlockAckReq) */ #define IEEE80211_FC0_SUBTYPE_BA 0x90 /* Block Ack (BlockAck) */ #define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0 /* PS-Poll */ #define IEEE80211_FC0_SUBTYPE_RTS 0xb0 /* RTS */ #define IEEE80211_FC0_SUBTYPE_CTS 0xc0 /* CTS */ #define IEEE80211_FC0_SUBTYPE_ACK 0xd0 /* Ack */ #define IEEE80211_FC0_SUBTYPE_CF_END 0xe0 /* CF-End */ #define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0 /* 1111 Reserved - what was CF_END_ACK? */ /* For type 10 Data (IEEE80211_FC0_TYPE_DATA) */ #define IEEE80211_FC0_SUBTYPE_DATA 0x00 /* Data */ /* 0001-0011 Reserved 0x10-0x30 */ /* Were: CF_ACK, CF_POLL, CF_ACPL */ #define IEEE80211_FC0_SUBTYPE_NODATA 0x40 /* Null */ /* 0101-0111 Reserved 0x50-0x70 */ /* Were: CFACK, CFPOLL, CF_ACK_CF_ACK */ #define IEEE80211_FC0_SUBTYPE_QOS_DATA 0x80 /* QoS Data */ #define IEEE80211_FC0_SUBTYPE_QOS_DATA_CFACK 0x90 /* QoS Data +CF-Ack */ #define IEEE80211_FC0_SUBTYPE_QOS_DATA_CFPOLL 0xa0 /* QoS Data +CF-Poll */ #define IEEE80211_FC0_SUBTYPE_QOS_DATA_CFACKPOLL 0xb0 /* QoS Data +CF-Ack +CF-Poll */ #define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0 /* QoS Null */ /* 1101 Reserved 0xd0 */ #define IEEE80211_FC0_SUBTYPE_QOS_CFPOLL 0xe0 /* QoS CF-Poll */ #define IEEE80211_FC0_SUBTYPE_QOS_CFACKPOLL 0xf0 /* QoS CF-Ack +CF-Poll */ /* For type 11 Extension (IEEE80211_FC0_TYPE_EXT) */ #define IEEE80211_FC0_SUBTYPE_DMG_BEACON 0x00 /* DMG Beacon */ #define IEEE80211_FC0_SUBTYPE_S1G_BEACON 0x10 /* S1G Beacon */ /* 0010-1111 Reserved 0x20-0xff */ /* 802.11-2020 Table 9-2-Control Frame Extension */ /* Reusing B11..B8, part of FC1 */ #define IEEE80211_CTL_EXT_SECTOR_ACK 0x00 /* Sector Ack, 80211ay-2021 */ #define IEEE80211_CTL_EXT_BA_SCHED 0x01 /* Block Ack Schedule, 80211ay-2021 */ #define IEEE80211_CTL_EXT_POLL 0x02 /* Poll */ #define IEEE80211_CTL_EXT_SPR 0x03 /* SPR */ #define IEEE80211_CTL_EXT_GRANT 0x04 /* Grant */ #define IEEE80211_CTL_EXT_DMG_CTS 0x05 /* DMG CTS */ #define IEEE80211_CTL_EXT_DMG_DTS 0x06 /* DMG DTS */ #define IEEE80211_CTL_EXT_GRANT_ACK 0x07 /* Grant Ack */ #define IEEE80211_CTL_EXT_SSW 0x08 /* SSW */ #define IEEE80211_CTL_EXT_SSW_FBACK 0x09 /* SSW-Feedback */ #define IEEE80211_CTL_EXT_SSW_ACK 0x0a /* SSW-Ack */ #define IEEE80211_CTL_EXT_TDD_BF 0x0b /* TDD Beamforming, 80211ay-2021 */ /* 1100-1111 Reserved 0xc-0xf */ #define IEEE80211_IS_MGMT(wh) \ (!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK) \ == IEEE80211_FC0_TYPE_MGT)) #define IEEE80211_IS_CTL(wh) \ (!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK) \ == IEEE80211_FC0_TYPE_CTL)) #define IEEE80211_IS_DATA(wh) \ (!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK) \ == IEEE80211_FC0_TYPE_DATA)) #define IEEE80211_IS_EXT(wh) \ (!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK) \ == IEEE80211_FC0_TYPE_EXT)) #define IEEE80211_FC0_QOSDATA \ (IEEE80211_FC0_TYPE_DATA|IEEE80211_FC0_SUBTYPE_QOS_DATA|IEEE80211_FC0_VERSION_0) #define IEEE80211_IS_QOSDATA(wh) \ ((wh)->i_fc[0] == IEEE80211_FC0_QOSDATA) #define IEEE80211_FC1_DIR_MASK 0x03 #define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */ #define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */ #define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */ #define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */ #define IEEE80211_IS_DSTODS(wh) \ (((wh)->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS) #define IEEE80211_FC1_MORE_FRAG 0x04 #define IEEE80211_FC1_RETRY 0x08 #define IEEE80211_FC1_PWR_MGT 0x10 #define IEEE80211_FC1_MORE_DATA 0x20 #define IEEE80211_FC1_PROTECTED 0x40 #define IEEE80211_FC1_ORDER 0x80 #define IEEE80211_IS_PROTECTED(wh) \ ((wh)->i_fc[1] & IEEE80211_FC1_PROTECTED) #define IEEE80211_HAS_SEQ(type, subtype) \ ((type) != IEEE80211_FC0_TYPE_CTL && \ !((type) == IEEE80211_FC0_TYPE_DATA && \ ((subtype) & IEEE80211_FC0_SUBTYPE_QOS_NULL) == \ IEEE80211_FC0_SUBTYPE_QOS_NULL)) #define IEEE80211_SEQ_FRAG_MASK 0x000f #define IEEE80211_SEQ_FRAG_SHIFT 0 #define IEEE80211_SEQ_SEQ_MASK 0xfff0 #define IEEE80211_SEQ_SEQ_SHIFT 4 #define IEEE80211_SEQ_RANGE 4096 #define IEEE80211_SEQ_ADD(seq, incr) \ (((seq) + (incr)) & (IEEE80211_SEQ_RANGE-1)) #define IEEE80211_SEQ_INC(seq) IEEE80211_SEQ_ADD(seq,1) #define IEEE80211_SEQ_SUB(a, b) \ (((a) + IEEE80211_SEQ_RANGE - (b)) & (IEEE80211_SEQ_RANGE-1)) #define IEEE80211_SEQ_BA_RANGE 2048 /* 2^11 */ #define IEEE80211_SEQ_BA_BEFORE(a, b) \ (IEEE80211_SEQ_SUB(b, a+1) < IEEE80211_SEQ_BA_RANGE-1) #define IEEE80211_NWID_LEN 32 #define IEEE80211_MESHID_LEN 32 #define IEEE80211_QOS_CTL_LEN 2 #define IEEE80211_QOS_TXOP 0x00ff /* bit 8 is reserved */ #define IEEE80211_QOS_AMSDU 0x80 #define IEEE80211_QOS_AMSDU_S 7 #define IEEE80211_QOS_ACKPOLICY 0x60 #define IEEE80211_QOS_ACKPOLICY_S 5 #define IEEE80211_QOS_ACKPOLICY_NOACK 0x20 /* No ACK required */ #define IEEE80211_QOS_ACKPOLICY_BA 0x60 /* Block ACK */ #define IEEE80211_QOS_EOSP 0x10 /* EndOfService Period*/ #define IEEE80211_QOS_EOSP_S 4 #define IEEE80211_QOS_TID 0x0f /* qos[1] byte used for all frames sent by mesh STAs in a mesh BSS */ #define IEEE80211_QOS_MC 0x01 /* Mesh control */ /* Mesh power save level*/ #define IEEE80211_QOS_MESH_PSL 0x02 /* Mesh Receiver Service Period Initiated */ #define IEEE80211_QOS_RSPI 0x04 /* bits 11 to 15 reserved */ /* does frame have QoS sequence control data */ #define IEEE80211_QOS_HAS_SEQ(wh) \ (((wh)->i_fc[0] & \ (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS_DATA)) == \ (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS_DATA)) /* * WME/802.11e information element. */ struct ieee80211_wme_info { uint8_t wme_id; /* IEEE80211_ELEMID_VENDOR */ uint8_t wme_len; /* length in bytes */ uint8_t wme_oui[3]; /* 0x00, 0x50, 0xf2 */ uint8_t wme_type; /* OUI type */ uint8_t wme_subtype; /* OUI subtype */ uint8_t wme_version; /* spec revision */ uint8_t wme_info; /* QoS info */ } __packed; /* * WME/802.11e Tspec Element */ struct ieee80211_wme_tspec { uint8_t ts_id; uint8_t ts_len; uint8_t ts_oui[3]; uint8_t ts_oui_type; uint8_t ts_oui_subtype; uint8_t ts_version; uint8_t ts_tsinfo[3]; uint8_t ts_nom_msdu[2]; uint8_t ts_max_msdu[2]; uint8_t ts_min_svc[4]; uint8_t ts_max_svc[4]; uint8_t ts_inactv_intv[4]; uint8_t ts_susp_intv[4]; uint8_t ts_start_svc[4]; uint8_t ts_min_rate[4]; uint8_t ts_mean_rate[4]; uint8_t ts_max_burst[4]; uint8_t ts_min_phy[4]; uint8_t ts_peak_rate[4]; uint8_t ts_delay[4]; uint8_t ts_surplus[2]; uint8_t ts_medium_time[2]; } __packed; /* * WME AC parameter field */ struct ieee80211_wme_acparams { uint8_t acp_aci_aifsn; uint8_t acp_logcwminmax; uint16_t acp_txop; } __packed; #define WME_NUM_AC 4 /* 4 AC categories */ #define WME_NUM_TID 16 /* 16 tids */ #define WME_PARAM_ACI 0x60 /* Mask for ACI field */ #define WME_PARAM_ACI_S 5 /* Shift for ACI field */ #define WME_PARAM_ACM 0x10 /* Mask for ACM bit */ #define WME_PARAM_ACM_S 4 /* Shift for ACM bit */ #define WME_PARAM_AIFSN 0x0f /* Mask for aifsn field */ #define WME_PARAM_AIFSN_S 0 /* Shift for aifsn field */ #define WME_PARAM_LOGCWMIN 0x0f /* Mask for CwMin field (in log) */ #define WME_PARAM_LOGCWMIN_S 0 /* Shift for CwMin field */ #define WME_PARAM_LOGCWMAX 0xf0 /* Mask for CwMax field (in log) */ #define WME_PARAM_LOGCWMAX_S 4 /* Shift for CwMax field */ #define WME_AC_TO_TID(_ac) ( \ ((_ac) == WME_AC_VO) ? 6 : \ ((_ac) == WME_AC_VI) ? 5 : \ ((_ac) == WME_AC_BK) ? 1 : \ 0) #define TID_TO_WME_AC(_tid) ( \ ((_tid) == 0 || (_tid) == 3) ? WME_AC_BE : \ ((_tid) < 3) ? WME_AC_BK : \ ((_tid) < 6) ? WME_AC_VI : \ WME_AC_VO) /* * WME Parameter Element */ struct ieee80211_wme_param { uint8_t param_id; uint8_t param_len; uint8_t param_oui[3]; uint8_t param_oui_type; uint8_t param_oui_subtype; uint8_t param_version; uint8_t param_qosInfo; #define WME_QOSINFO_COUNT 0x0f /* Mask for param count field */ uint8_t param_reserved; struct ieee80211_wme_acparams params_acParams[WME_NUM_AC]; } __packed; /* * WME U-APSD qos info field defines */ #define WME_CAPINFO_UAPSD_EN 0x00000080 #define WME_CAPINFO_UAPSD_VO 0x00000001 #define WME_CAPINFO_UAPSD_VI 0x00000002 #define WME_CAPINFO_UAPSD_BK 0x00000004 #define WME_CAPINFO_UAPSD_BE 0x00000008 #define WME_CAPINFO_UAPSD_ACFLAGS_SHIFT 0 #define WME_CAPINFO_UAPSD_ACFLAGS_MASK 0xF #define WME_CAPINFO_UAPSD_MAXSP_SHIFT 5 #define WME_CAPINFO_UAPSD_MAXSP_MASK 0x3 #define WME_CAPINFO_IE_OFFSET 8 #define WME_UAPSD_MAXSP(_qosinfo) \ (((_qosinfo) >> WME_CAPINFO_UAPSD_MAXSP_SHIFT) & \ WME_CAPINFO_UAPSD_MAXSP_MASK) #define WME_UAPSD_AC_ENABLED(_ac, _qosinfo) \ ((1 << (3 - (_ac))) & ( \ ((_qosinfo) >> WME_CAPINFO_UAPSD_ACFLAGS_SHIFT) & \ WME_CAPINFO_UAPSD_ACFLAGS_MASK)) /* * Management Notification Frame */ struct ieee80211_mnf { uint8_t mnf_category; uint8_t mnf_action; uint8_t mnf_dialog; uint8_t mnf_status; } __packed; #define MNF_SETUP_REQ 0 #define MNF_SETUP_RESP 1 #define MNF_TEARDOWN 2 /* * 802.11n Management Action Frames */ /* generic frame format */ struct ieee80211_action { uint8_t ia_category; uint8_t ia_action; } __packed; /* 80211-2020 Table 9-51-Category values */ #define IEEE80211_ACTION_CAT_SM 0 /* 9.6.2 Spectrum Management */ #define IEEE80211_ACTION_CAT_QOS 1 /* 9.6.3 QoS */ /* Reserved 2 was IEEE80211_ACTION_CAT_DLS */ #define IEEE80211_ACTION_CAT_BA 3 /* 9.6.4 Block Ack */ #define IEEE80211_ACTION_CAT_PUBLIC 4 /* 9.6.7 Public */ #define IEEE80211_ACTION_CAT_RADIO_MEASUREMENT 5 /* 9.6.6 Radio Measurement */ #define IEEE80211_ACTION_CAT_FAST_BBS_TRANSITION 6 /* 9.6.8 Fast BSS Transition */ #define IEEE80211_ACTION_CAT_HT 7 /* 9.6.11 HT */ #define IEEE80211_ACTION_CAT_SA_QUERY 8 /* 9.6.9 SA Query */ #define IEEE80211_ACTION_CAT_PROTECTED_DUAL_OF_PUBLIC_ACTION 9 /* 9.6.10 Protected Dual of Public Action */ #define IEEE80211_ACTION_CAT_WNM 10 /* 9.6.13 WNM */ #define IEEE80211_ACTION_CAT_UNPROTECTED_WNM 11 /* 9.6.14 Unprotected WNM */ #define IEEE80211_ACTION_CAT_TDLS 12 /* 9.6.12 TDLS */ #define IEEE80211_ACTION_CAT_MESH 13 /* 9.6.16 Mesh */ #define IEEE80211_ACTION_CAT_MULTIHOP 14 /* 9.6.17 Multihop */ #define IEEE80211_ACTION_CAT_SELF_PROT 15 /* 9.6.15 Self-protected */ #define IEEE80211_ACTION_CAT_DMG 16 /* 9.6.19 DMG */ /* Reserved 17 (R)Wi-Fi Alliance */ #define IEEE80211_ACTION_CAT_FAST_SESSION_TRANSFER 18 /* 9.6.20 Fast Session Transfer */ #define IEEE80211_ACTION_CAT_ROBUST_AV_STREAMING 19 /* 9.6.18 Robust AV Streaming */ #define IEEE80211_ACTION_CAT_UNPROTECTED_DMG 20 /* 9.6.21 Unprotected DMG */ #define IEEE80211_ACTION_CAT_VHT 21 /* 9.6.22 VHT */ #define IEEE80211_ACTION_CAT_UNPROTECTED_S1G 22 /* 9.6.24 Unprotected S1G */ #define IEEE80211_ACTION_CAT_S1G 23 /* 9.6.25 S1G */ #define IEEE80211_ACTION_CAT_FLOW_CONTROL 24 /* 9.6.26 Flow Control */ #define IEEE80211_ACTION_CAT_CTL_RESP_MCS_NEG 25 /* 9.6.27 Control Response MCS Negotiation */ #define IEEE80211_ACTION_CAT_FILS 26 /* 9.6.23 FILS */ #define IEEE80211_ACTION_CAT_CDMG 27 /* 9.6.28 CDMG */ #define IEEE80211_ACTION_CAT_CMMG 28 /* 9.6.29 CMMG */ #define IEEE80211_ACTION_CAT_GLK 29 /* 9.6.30 GLK */ #define IEEE80211_ACTION_CAT_HE 30 /* 9.6.31 HE, 80211ax-2021 */ #define IEEE80211_ACTION_CAT_PROTECTED_HE 31 /* 9.6.32 Protected HE, 80211ax-2021 */ /* Reserved 32-125 */ #define IEEE80211_ACTION_CAT_VENDOR_SPECIFIC_PROTECTED 126 /* 9.6.5 Vendor-specific Protected */ #define IEEE80211_ACTION_CAT_VENDOR 127 /* 9.6.5 Vendor-specific */ /* Error 128-255 */ /* 80211-2020 Table 9-346-Spectrum Management Action field values */ enum ieee80211_action_sm { IEEE80211_ACTION_SM_SMREQ = 0, /* Spectrum Measurement Request */ IEEE80211_ACTION_SM_SMREP = 1, /* Spectrum Measurement Report */ IEEE80211_ACTION_SM_TPCREQ = 2, /* TPC Request */ IEEE80211_ACTION_SM_TPCREP = 3, /* TPC Report */ IEEE80211_ACTION_SM_CSA = 4, /* Channel Switch Announcement */ /* Reserved = 5-255 */ }; /* 80211-2020 Table 9-363-Radio Measurement Action field values */ enum ieee80211_action_radio_measurement { IEEE80211_ACTION_RADIO_MEASUREMENT_RMREQ = 0, /* Radio Measurement Request */ IEEE80211_ACTION_RADIO_MEASUREMENT_RMREP = 1, /* Radio Measurement Report */ IEEE80211_ACTION_RADIO_MEASUREMENT_LMREQ = 2, /* Link Measurement Request */ IEEE80211_ACTION_RADIO_MEASUREMENT_LMREP = 3, /* Link Measurement Report */ IEEE80211_ACTION_RADIO_MEASUREMENT_NRREQ = 4, /* Neighbor Report Request */ IEEE80211_ACTION_RADIO_MEASUREMENT_NRRESP = 5, /* Neighbor Report Response */ /* Reserved = 6-255 */ }; #define IEEE80211_ACTION_HT_TXCHWIDTH 0 /* recommended xmit chan width*/ #define IEEE80211_ACTION_HT_MIMOPWRSAVE 1 /* MIMO power save */ /* HT - recommended transmission channel width */ struct ieee80211_action_ht_txchwidth { struct ieee80211_action at_header; uint8_t at_chwidth; } __packed; #define IEEE80211_A_HT_TXCHWIDTH_20 0 #define IEEE80211_A_HT_TXCHWIDTH_2040 1 /* HT - MIMO Power Save (NB: D2.04) */ struct ieee80211_action_ht_mimopowersave { struct ieee80211_action am_header; uint8_t am_control; } __packed; #define IEEE80211_A_HT_MIMOPWRSAVE_ENA 0x01 /* PS enabled */ #define IEEE80211_A_HT_MIMOPWRSAVE_MODE 0x02 #define IEEE80211_A_HT_MIMOPWRSAVE_MODE_S 1 #define IEEE80211_A_HT_MIMOPWRSAVE_DYNAMIC 0x02 /* Dynamic Mode */ #define IEEE80211_A_HT_MIMOPWRSAVE_STATIC 0x00 /* no SM packets */ /* bits 2-7 reserved */ /* Block Ack actions */ #define IEEE80211_ACTION_BA_ADDBA_REQUEST 0 /* ADDBA request */ #define IEEE80211_ACTION_BA_ADDBA_RESPONSE 1 /* ADDBA response */ #define IEEE80211_ACTION_BA_DELBA 2 /* DELBA */ /* Block Ack Parameter Set */ #define IEEE80211_BAPS_BUFSIZ 0xffc0 /* buffer size */ #define IEEE80211_BAPS_BUFSIZ_S 6 #define IEEE80211_BAPS_TID 0x003c /* TID */ #define IEEE80211_BAPS_TID_S 2 #define IEEE80211_BAPS_POLICY 0x0002 /* block ack policy */ #define IEEE80211_BAPS_POLICY_S 1 #define IEEE80211_BAPS_AMSDU 0x0001 /* A-MSDU permitted */ #define IEEE80211_BAPS_AMSDU_S 0 #define IEEE80211_BAPS_POLICY_DELAYED (0<= \ IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160MHZ) #define IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160_80P80MHZ(_vhtcaps) \ (_IEEE80211_MASKSHIFT(_vhtcaps, IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) == \ IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160_80P80MHZ) #define IEEE80211_VHTCAP_RXLDPC 0x00000010 #define IEEE80211_VHTCAP_RXLDPC_S 4 #define IEEE80211_VHTCAP_SHORT_GI_80 0x00000020 #define IEEE80211_VHTCAP_SHORT_GI_80_S 5 #define IEEE80211_VHTCAP_SHORT_GI_160 0x00000040 #define IEEE80211_VHTCAP_SHORT_GI_160_S 6 #define IEEE80211_VHTCAP_TXSTBC 0x00000080 #define IEEE80211_VHTCAP_TXSTBC_S 7 #define IEEE80211_VHTCAP_RXSTBC_1 0x00000100 #define IEEE80211_VHTCAP_RXSTBC_2 0x00000200 #define IEEE80211_VHTCAP_RXSTBC_3 0x00000300 #define IEEE80211_VHTCAP_RXSTBC_4 0x00000400 #define IEEE80211_VHTCAP_RXSTBC_MASK 0x00000700 #define IEEE80211_VHTCAP_RXSTBC_MASK_S 8 #define IEEE80211_VHTCAP_SU_BEAMFORMER_CAPABLE 0x00000800 #define IEEE80211_VHTCAP_SU_BEAMFORMER_CAPABLE_S 11 #define IEEE80211_VHTCAP_SU_BEAMFORMEE_CAPABLE 0x00001000 #define IEEE80211_VHTCAP_SU_BEAMFORMEE_CAPABLE_S 12 #define IEEE80211_VHTCAP_BEAMFORMEE_STS_SHIFT 13 #define IEEE80211_VHTCAP_BEAMFORMEE_STS_MASK \ (7 << IEEE80211_VHTCAP_BEAMFORMEE_STS_SHIFT) #define IEEE80211_VHTCAP_BEAMFORMEE_STS_MASK_S 13 #define IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT 16 #define IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_MASK \ (7 << IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT) #define IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_MASK_S 16 #define IEEE80211_VHTCAP_MU_BEAMFORMER_CAPABLE 0x00080000 #define IEEE80211_VHTCAP_MU_BEAMFORMER_CAPABLE_S 19 #define IEEE80211_VHTCAP_MU_BEAMFORMEE_CAPABLE 0x00100000 #define IEEE80211_VHTCAP_MU_BEAMFORMEE_CAPABLE_S 20 #define IEEE80211_VHTCAP_VHT_TXOP_PS 0x00200000 #define IEEE80211_VHTCAP_VHT_TXOP_PS_S 21 #define IEEE80211_VHTCAP_HTC_VHT 0x00400000 #define IEEE80211_VHTCAP_HTC_VHT_S 22 #define IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT 23 #define IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ (7 << IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT) #define IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_S 23 #define IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_MASK 0x0c000000 #define IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB 0x08000000 #define IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB 0x0c000000 #define IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_MASK_S 26 #define IEEE80211_VHTCAP_RX_ANTENNA_PATTERN 0x10000000 #define IEEE80211_VHTCAP_RX_ANTENNA_PATTERN_S 28 #define IEEE80211_VHTCAP_TX_ANTENNA_PATTERN 0x20000000 #define IEEE80211_VHTCAP_TX_ANTENNA_PATTERN_S 29 /* * XXX TODO: add the rest of the bits */ #define IEEE80211_VHTCAP_BITS \ "\20\1MPDU7991\2MPDU11454\3CHAN160\4CHAN8080\5RXLDPC\6SHORTGI80" \ "\7SHORTGI160\10RXSTBC1\11RXSTBC2\12RXSTBC3\13RXSTBC4\14BFERCAP" \ "\15BFEECAP\27VHT\37RXANTPTN\40TXANTPTN" /* * VHT Transmit Power Envelope element - 802.11ac-2013 8.4.2.164 * * This defines the maximum transmit power for various bandwidths. */ /* * Count is how many elements follow and what they're for: * * 0 - 20 MHz * 1 - 20+40 MHz * 2 - 20+40+80 MHz * 3 - 20+40+80+(160, 80+80) MHz */ #define IEEE80211_VHT_TXPWRENV_INFO_COUNT_SHIFT 0 #define IEEE80211_VHT_TXPWRENV_INFO_COUNT_MASK 0x07 /* * Unit is the tx power representation. It should be EIRP for now; * other values are reserved. */ #define IEEE80211_VHT_TXPWRENV_UNIT_MASK 0x38 #define IEEE80211_VHT_TXPWRENV_UNIT_SHIFT 3 /* This value is within the unit mask/shift above */ #define IEEE80211_VHT_TXPWRENV_UNIT_EIRP 0 struct ieee80211_ie_vht_txpwrenv { uint8_t ie; uint8_t len; uint8_t tx_info; int8_t tx_elem[0]; /* TX power elements, 1/2 dB, signed */ }; /* VHT action codes */ #define WLAN_ACTION_VHT_COMPRESSED_BF 0 #define WLAN_ACTION_VHT_GROUPID_MGMT 1 #define WLAN_ACTION_VHT_OPMODE_NOTIF 2 /* * Management information element payloads. */ enum { IEEE80211_ELEMID_SSID = 0, IEEE80211_ELEMID_RATES = 1, IEEE80211_ELEMID_FHPARMS = 2, IEEE80211_ELEMID_DSPARMS = 3, IEEE80211_ELEMID_CFPARMS = 4, IEEE80211_ELEMID_TIM = 5, IEEE80211_ELEMID_IBSSPARMS = 6, IEEE80211_ELEMID_COUNTRY = 7, IEEE80211_ELEMID_BSSLOAD = 11, IEEE80211_ELEMID_TSPEC = 13, IEEE80211_ELEMID_TCLAS = 14, IEEE80211_ELEMID_CHALLENGE = 16, /* 17-31 reserved for challenge text extension */ IEEE80211_ELEMID_PWRCNSTR = 32, IEEE80211_ELEMID_PWRCAP = 33, IEEE80211_ELEMID_TPCREQ = 34, IEEE80211_ELEMID_TPCREP = 35, IEEE80211_ELEMID_SUPPCHAN = 36, IEEE80211_ELEMID_CSA = 37, IEEE80211_ELEMID_MEASREQ = 38, IEEE80211_ELEMID_MEASREP = 39, IEEE80211_ELEMID_QUIET = 40, IEEE80211_ELEMID_IBSSDFS = 41, IEEE80211_ELEMID_ERP = 42, IEEE80211_ELEMID_HTCAP = 45, IEEE80211_ELEMID_QOS = 46, IEEE80211_ELEMID_RESERVED_47 = 47, IEEE80211_ELEMID_RSN = 48, IEEE80211_ELEMID_XRATES = 50, IEEE80211_ELEMID_APCHANREP = 51, IEEE80211_ELEMID_MOBILITY_DOMAIN = 54, IEEE80211_ELEMID_HTINFO = 61, IEEE80211_ELEMID_SECCHAN_OFFSET = 62, IEEE80211_ELEMID_RRM_ENACAPS = 70, IEEE80211_ELEMID_MULTIBSSID = 71, IEEE80211_ELEMID_COEX_2040 = 72, IEEE80211_ELEMID_INTOL_CHN_REPORT = 73, IEEE80211_ELEMID_OVERLAP_BSS_SCAN_PARAM = 74, IEEE80211_ELEMID_TSF_REQ = 91, IEEE80211_ELEMID_TSF_RESP = 92, IEEE80211_ELEMID_WNM_SLEEP_MODE = 93, IEEE80211_ELEMID_TIM_BCAST_REQ = 94, IEEE80211_ELEMID_TIM_BCAST_RESP = 95, IEEE80211_ELEMID_TPC = 150, IEEE80211_ELEMID_CCKM = 156, IEEE80211_ELEMID_VENDOR = 221, /* vendor private */ /* * 802.11s IEs * NB: On vanilla Linux still IEEE80211_ELEMID_MESHPEER = 55, * but they defined a new with id 117 called PEER_MGMT. * NB: complies with open80211 */ IEEE80211_ELEMID_MESHCONF = 113, IEEE80211_ELEMID_MESHID = 114, IEEE80211_ELEMID_MESHLINK = 115, IEEE80211_ELEMID_MESHCNGST = 116, IEEE80211_ELEMID_MESHPEER = 117, IEEE80211_ELEMID_MESHCSA = 118, IEEE80211_ELEMID_MESHTIM = 39, /* XXX: remove */ IEEE80211_ELEMID_MESHAWAKEW = 119, IEEE80211_ELEMID_MESHBEACONT = 120, /* 121-124 MMCAOP not implemented yet */ IEEE80211_ELEMID_MESHGANN = 125, IEEE80211_ELEMID_MESHRANN = 126, /* 127 Extended Capabilities */ IEEE80211_ELEMID_EXTCAP = 127, /* 128-129 reserved */ IEEE80211_ELEMID_MESHPREQ = 130, IEEE80211_ELEMID_MESHPREP = 131, IEEE80211_ELEMID_MESHPERR = 132, /* 133-136 reserved */ IEEE80211_ELEMID_MESHPXU = 137, IEEE80211_ELEMID_MESHPXUC = 138, IEEE80211_ELEMID_MESHAH = 60, /* XXX: remove */ /* 802.11ac-2013, Table 8-54-Element IDs */ IEEE80211_ELEMID_VHT_CAP = 191, IEEE80211_ELEMID_VHT_OPMODE = 192, IEEE80211_ELEMID_EXTENDED_BSS_LOAD = 193, IEEE80211_ELEMID_WIDE_BW_CHANNEL_SWITCH = 194, IEEE80211_ELEMID_VHT_PWR_ENV = 195, IEEE80211_ELEMID_CHANNEL_SWITCH_WRAPPER = 196, IEEE80211_ELEMID_AID = 197, IEEE80211_ELEMID_QUIET_CHANNEL = 198, IEEE80211_ELEMID_OPMODE_NOTIF = 199, }; struct ieee80211_tim_ie { uint8_t tim_ie; /* IEEE80211_ELEMID_TIM */ uint8_t tim_len; uint8_t tim_count; /* DTIM count */ uint8_t tim_period; /* DTIM period */ uint8_t tim_bitctl; /* bitmap control */ uint8_t tim_bitmap[1]; /* variable-length bitmap */ } __packed; struct ieee80211_country_ie { uint8_t ie; /* IEEE80211_ELEMID_COUNTRY */ uint8_t len; uint8_t cc[3]; /* ISO CC+(I)ndoor/(O)utdoor */ struct { uint8_t schan; /* starting channel */ uint8_t nchan; /* number channels */ uint8_t maxtxpwr; /* tx power cap */ } __packed band[1]; /* sub bands (NB: var size) */ } __packed; #define IEEE80211_COUNTRY_MAX_BANDS 84 /* max possible bands */ #define IEEE80211_COUNTRY_MAX_SIZE \ (sizeof(struct ieee80211_country_ie) + 3*(IEEE80211_COUNTRY_MAX_BANDS-1)) struct ieee80211_bss_load_ie { uint8_t ie; uint8_t len; uint16_t sta_count; /* station count */ uint8_t chan_load; /* channel utilization */ uint8_t aac; /* available admission capacity */ } __packed; struct ieee80211_ap_chan_report_ie { uint8_t ie; uint8_t len; uint8_t i_class; /* operating class */ /* Annex E, E.1 Country information and operating classes */ uint8_t chan_list[0]; } __packed; #define IEEE80211_EXTCAP_CMS (1ULL << 0) /* 20/40 BSS coexistence management support */ #define IEEE80211_EXTCAP_RSVD_1 (1ULL << 1) #define IEEE80211_EXTCAP_ECS (1ULL << 2) /* extended channel switching */ #define IEEE80211_EXTCAP_RSVD_3 (1ULL << 3) #define IEEE80211_EXTCAP_PSMP_CAP (1ULL << 4) /* PSMP capability */ #define IEEE80211_EXTCAP_RSVD_5 (1ULL << 5) #define IEEE80211_EXTCAP_S_PSMP_SUPP (1ULL << 6) #define IEEE80211_EXTCAP_EVENT (1ULL << 7) #define IEEE80211_EXTCAP_DIAGNOSTICS (1ULL << 8) #define IEEE80211_EXTCAP_MCAST_DIAG (1ULL << 9) #define IEEE80211_EXTCAP_LOC_TRACKING (1ULL << 10) #define IEEE80211_EXTCAP_FMS (1ULL << 11) #define IEEE80211_EXTCAP_PROXY_ARP (1ULL << 12) #define IEEE80211_EXTCAP_CIR (1ULL << 13) /* collocated interference reporting */ #define IEEE80211_EXTCAP_CIVIC_LOC (1ULL << 14) #define IEEE80211_EXTCAP_GEOSPATIAL_LOC (1ULL << 15) #define IEEE80211_EXTCAP_TFS (1ULL << 16) #define IEEE80211_EXTCAP_WNM_SLEEPMODE (1ULL << 17) #define IEEE80211_EXTCAP_TIM_BROADCAST (1ULL << 18) #define IEEE80211_EXTCAP_BSS_TRANSITION (1ULL << 19) #define IEEE80211_EXTCAP_QOS_TRAF_CAP (1ULL << 20) #define IEEE80211_EXTCAP_AC_STA_COUNT (1ULL << 21) #define IEEE80211_EXTCAP_M_BSSID (1ULL << 22) /* multiple BSSID field */ #define IEEE80211_EXTCAP_TIMING_MEAS (1ULL << 23) #define IEEE80211_EXTCAP_CHAN_USAGE (1ULL << 24) #define IEEE80211_EXTCAP_SSID_LIST (1ULL << 25) #define IEEE80211_EXTCAP_DMS (1ULL << 26) #define IEEE80211_EXTCAP_UTC_TSF_OFFSET (1ULL << 27) #define IEEE80211_EXTCAP_TLDS_BUF_STA_SUPP (1ULL << 28) /* TDLS peer U-APSP buffer STA support */ #define IEEE80211_EXTCAP_TLDS_PPSM_SUPP (1ULL << 29) /* TDLS peer PSM support */ #define IEEE80211_EXTCAP_TLDS_CH_SW (1ULL << 30) /* TDLS channel switching */ #define IEEE80211_EXTCAP_INTERWORKING (1ULL << 31) #define IEEE80211_EXTCAP_QOSMAP (1ULL << 32) #define IEEE80211_EXTCAP_EBR (1ULL << 33) #define IEEE80211_EXTCAP_SSPN_IF (1ULL << 34) #define IEEE80211_EXTCAP_RSVD_35 (1ULL << 35) #define IEEE80211_EXTCAP_MSGCF_CAP (1ULL << 36) #define IEEE80211_EXTCAP_TLDS_SUPP (1ULL << 37) #define IEEE80211_EXTCAP_TLDS_PROHIB (1ULL << 38) #define IEEE80211_EXTCAP_TLDS_CH_SW_PROHIB (1ULL << 39) /* TDLS channel switching prohibited */ #define IEEE80211_EXTCAP_RUF (1ULL << 40) /* reject unadmitted frame */ /* service interval granularity */ #define IEEE80211_EXTCAP_SIG \ ((1ULL << 41) | (1ULL << 42) | (1ULL << 43)) #define IEEE80211_EXTCAP_ID_LOC (1ULL << 44) #define IEEE80211_EXTCAP_U_APSD_COEX (1ULL << 45) #define IEEE80211_EXTCAP_WNM_NOTIFICATION (1ULL << 46) #define IEEE80211_EXTCAP_RSVD_47 (1ULL << 47) #define IEEE80211_EXTCAP_SSID (1ULL << 48) /* UTF-8 SSID */ /* bits 49-n are reserved */ struct ieee80211_extcap_ie { uint8_t ie; uint8_t len; } __packed; /* * 802.11h Quiet Time Element. */ struct ieee80211_quiet_ie { uint8_t quiet_ie; /* IEEE80211_ELEMID_QUIET */ uint8_t len; uint8_t tbttcount; /* quiet start */ uint8_t period; /* beacon intervals between quiets */ uint16_t duration; /* TUs of each quiet*/ uint16_t offset; /* TUs of from TBTT of quiet start */ } __packed; /* * 802.11h Channel Switch Announcement (CSA). */ struct ieee80211_csa_ie { uint8_t csa_ie; /* IEEE80211_ELEMID_CHANSWITCHANN */ uint8_t csa_len; uint8_t csa_mode; /* Channel Switch Mode */ uint8_t csa_newchan; /* New Channel Number */ uint8_t csa_count; /* Channel Switch Count */ } __packed; /* * Note the min acceptable CSA count is used to guard against * malicious CSA injection in station mode. Defining this value * as other than 0 violates the 11h spec. */ #define IEEE80211_CSA_COUNT_MIN 2 #define IEEE80211_CSA_COUNT_MAX 255 /* rate set entries are in .5 Mb/s units, and potentially marked as basic */ #define IEEE80211_RATE_BASIC 0x80 #define IEEE80211_RATE_VAL 0x7f #define IEEE80211_RV(v) ((v) & IEEE80211_RATE_VAL) /* ERP information element flags */ #define IEEE80211_ERP_NON_ERP_PRESENT 0x01 #define IEEE80211_ERP_USE_PROTECTION 0x02 #define IEEE80211_ERP_LONG_PREAMBLE 0x04 #define IEEE80211_ERP_BITS \ "\20\1NON_ERP_PRESENT\2USE_PROTECTION\3LONG_PREAMBLE" #define ATH_OUI 0x7f0300 /* Atheros OUI */ #define ATH_OUI_TYPE 0x01 /* Atheros protocol ie */ /* NB: Atheros allocated the OUI for this purpose ~2005 but beware ... */ #define TDMA_OUI ATH_OUI #define TDMA_OUI_TYPE 0x02 /* TDMA protocol ie */ #define BCM_OUI 0x4c9000 /* Broadcom OUI */ #define BCM_OUI_HTCAP 51 /* pre-draft HTCAP ie */ #define BCM_OUI_HTINFO 52 /* pre-draft HTINFO ie */ #define WPA_OUI 0xf25000 #define WPA_OUI_TYPE 0x01 #define WPA_VERSION 1 /* current supported version */ #define WPA_CSE_NULL 0x00 #define WPA_CSE_WEP40 0x01 #define WPA_CSE_TKIP 0x02 #define WPA_CSE_CCMP 0x04 #define WPA_CSE_WEP104 0x05 #define WPA_ASE_NONE 0x00 #define WPA_ASE_8021X_UNSPEC 0x01 #define WPA_ASE_8021X_PSK 0x02 #define WPS_OUI_TYPE 0x04 #define RSN_OUI 0xac0f00 #define RSN_VERSION 1 /* current supported version */ #define RSN_CSE_NULL 0x00 #define RSN_CSE_WEP40 0x01 #define RSN_CSE_TKIP 0x02 #define RSN_CSE_WRAP 0x03 #define RSN_CSE_CCMP 0x04 #define RSN_CSE_WEP104 0x05 #define RSN_ASE_NONE 0x00 #define RSN_ASE_8021X_UNSPEC 0x01 #define RSN_ASE_8021X_PSK 0x02 #define RSN_CAP_PREAUTH 0x01 #define WME_OUI 0xf25000 #define WME_OUI_TYPE 0x02 #define WME_INFO_OUI_SUBTYPE 0x00 #define WME_PARAM_OUI_SUBTYPE 0x01 #define WME_VERSION 1 /* WME stream classes */ #define WME_AC_BE 0 /* best effort */ #define WME_AC_BK 1 /* background */ #define WME_AC_VI 2 /* video */ #define WME_AC_VO 3 /* voice */ /* * AUTH management packets * * octet algo[2] * octet seq[2] * octet status[2] * octet chal.id * octet chal.length * octet chal.text[253] NB: 1-253 bytes */ /* challenge length for shared key auth */ #define IEEE80211_CHALLENGE_LEN 128 #define IEEE80211_AUTH_ALG_OPEN 0x0000 #define IEEE80211_AUTH_ALG_SHARED 0x0001 #define IEEE80211_AUTH_ALG_LEAP 0x0080 enum { IEEE80211_AUTH_OPEN_REQUEST = 1, IEEE80211_AUTH_OPEN_RESPONSE = 2, }; enum { IEEE80211_AUTH_SHARED_REQUEST = 1, IEEE80211_AUTH_SHARED_CHALLENGE = 2, IEEE80211_AUTH_SHARED_RESPONSE = 3, IEEE80211_AUTH_SHARED_PASS = 4, }; /* * Reason and status codes. * * Reason codes are used in management frames to indicate why an * action took place (e.g. on disassociation). Status codes are * used in management frames to indicate the result of an operation. * * Unlisted codes are reserved */ enum { IEEE80211_REASON_UNSPECIFIED = 1, IEEE80211_REASON_AUTH_EXPIRE = 2, IEEE80211_REASON_AUTH_LEAVE = 3, IEEE80211_REASON_ASSOC_EXPIRE = 4, IEEE80211_REASON_ASSOC_TOOMANY = 5, IEEE80211_REASON_NOT_AUTHED = 6, IEEE80211_REASON_NOT_ASSOCED = 7, IEEE80211_REASON_ASSOC_LEAVE = 8, IEEE80211_REASON_ASSOC_NOT_AUTHED = 9, IEEE80211_REASON_DISASSOC_PWRCAP_BAD = 10, /* 11h */ IEEE80211_REASON_DISASSOC_SUPCHAN_BAD = 11, /* 11h */ IEEE80211_REASON_IE_INVALID = 13, /* 11i */ IEEE80211_REASON_MIC_FAILURE = 14, /* 11i */ IEEE80211_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, /* 11i */ IEEE80211_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16, /* 11i */ IEEE80211_REASON_IE_IN_4WAY_DIFFERS = 17, /* 11i */ IEEE80211_REASON_GROUP_CIPHER_INVALID = 18, /* 11i */ IEEE80211_REASON_PAIRWISE_CIPHER_INVALID= 19, /* 11i */ IEEE80211_REASON_AKMP_INVALID = 20, /* 11i */ IEEE80211_REASON_UNSUPP_RSN_IE_VERSION = 21, /* 11i */ IEEE80211_REASON_INVALID_RSN_IE_CAP = 22, /* 11i */ IEEE80211_REASON_802_1X_AUTH_FAILED = 23, /* 11i */ IEEE80211_REASON_CIPHER_SUITE_REJECTED = 24, /* 11i */ IEEE80211_REASON_UNSPECIFIED_QOS = 32, /* 11e */ IEEE80211_REASON_INSUFFICIENT_BW = 33, /* 11e */ IEEE80211_REASON_TOOMANY_FRAMES = 34, /* 11e */ IEEE80211_REASON_OUTSIDE_TXOP = 35, /* 11e */ IEEE80211_REASON_LEAVING_QBSS = 36, /* 11e */ IEEE80211_REASON_BAD_MECHANISM = 37, /* 11e */ IEEE80211_REASON_SETUP_NEEDED = 38, /* 11e */ IEEE80211_REASON_TIMEOUT = 39, /* 11e */ IEEE80211_REASON_PEER_LINK_CANCELED = 52, /* 11s */ IEEE80211_REASON_MESH_MAX_PEERS = 53, /* 11s */ IEEE80211_REASON_MESH_CPVIOLATION = 54, /* 11s */ IEEE80211_REASON_MESH_CLOSE_RCVD = 55, /* 11s */ IEEE80211_REASON_MESH_MAX_RETRIES = 56, /* 11s */ IEEE80211_REASON_MESH_CONFIRM_TIMEOUT = 57, /* 11s */ IEEE80211_REASON_MESH_INVALID_GTK = 58, /* 11s */ IEEE80211_REASON_MESH_INCONS_PARAMS = 59, /* 11s */ IEEE80211_REASON_MESH_INVALID_SECURITY = 60, /* 11s */ IEEE80211_REASON_MESH_PERR_NO_PROXY = 61, /* 11s */ IEEE80211_REASON_MESH_PERR_NO_FI = 62, /* 11s */ IEEE80211_REASON_MESH_PERR_DEST_UNREACH = 63, /* 11s */ IEEE80211_REASON_MESH_MAC_ALRDY_EXISTS_MBSS = 64, /* 11s */ IEEE80211_REASON_MESH_CHAN_SWITCH_REG = 65, /* 11s */ IEEE80211_REASON_MESH_CHAN_SWITCH_UNSPEC = 66, /* 11s */ IEEE80211_STATUS_SUCCESS = 0, IEEE80211_STATUS_UNSPECIFIED = 1, IEEE80211_STATUS_CAPINFO = 10, IEEE80211_STATUS_NOT_ASSOCED = 11, IEEE80211_STATUS_OTHER = 12, IEEE80211_STATUS_ALG = 13, IEEE80211_STATUS_SEQUENCE = 14, IEEE80211_STATUS_CHALLENGE = 15, IEEE80211_STATUS_TIMEOUT = 16, IEEE80211_STATUS_TOOMANY = 17, IEEE80211_STATUS_BASIC_RATE = 18, IEEE80211_STATUS_SP_REQUIRED = 19, /* 11b */ IEEE80211_STATUS_PBCC_REQUIRED = 20, /* 11b */ IEEE80211_STATUS_CA_REQUIRED = 21, /* 11b */ IEEE80211_STATUS_SPECMGMT_REQUIRED = 22, /* 11h */ IEEE80211_STATUS_PWRCAP_REQUIRED = 23, /* 11h */ IEEE80211_STATUS_SUPCHAN_REQUIRED = 24, /* 11h */ IEEE80211_STATUS_SHORTSLOT_REQUIRED = 25, /* 11g */ IEEE80211_STATUS_DSSSOFDM_REQUIRED = 26, /* 11g */ IEEE80211_STATUS_MISSING_HT_CAPS = 27, /* 11n D3.0 */ IEEE80211_STATUS_INVALID_IE = 40, /* 11i */ IEEE80211_STATUS_GROUP_CIPHER_INVALID = 41, /* 11i */ IEEE80211_STATUS_PAIRWISE_CIPHER_INVALID = 42, /* 11i */ IEEE80211_STATUS_AKMP_INVALID = 43, /* 11i */ IEEE80211_STATUS_UNSUPP_RSN_IE_VERSION = 44, /* 11i */ IEEE80211_STATUS_INVALID_RSN_IE_CAP = 45, /* 11i */ IEEE80211_STATUS_CIPHER_SUITE_REJECTED = 46, /* 11i */ }; #define IEEE80211_WEP_KEYLEN 5 /* 40bit */ #define IEEE80211_WEP_IVLEN 3 /* 24bit */ #define IEEE80211_WEP_KIDLEN 1 /* 1 octet */ #define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */ #define IEEE80211_WEP_TOTLEN (IEEE80211_WEP_IVLEN + \ IEEE80211_WEP_KIDLEN + \ IEEE80211_WEP_CRCLEN) #define IEEE80211_WEP_NKID 4 /* number of key ids */ /* * 802.11i defines an extended IV for use with non-WEP ciphers. * When the EXTIV bit is set in the key id byte an additional * 4 bytes immediately follow the IV for TKIP. For CCMP the * EXTIV bit is likewise set but the 8 bytes represent the * CCMP header rather than IV+extended-IV. */ #define IEEE80211_WEP_EXTIV 0x20 #define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */ #define IEEE80211_WEP_MICLEN 8 /* trailing MIC */ #define IEEE80211_CRC_LEN 4 /* * Maximum acceptable MTU is: * IEEE80211_MAX_LEN - WEP overhead - CRC - * QoS overhead - RSN/WPA overhead * Min is arbitrarily chosen > IEEE80211_MIN_LEN. The default * mtu is Ethernet-compatible; it's set by ether_ifattach. */ #define IEEE80211_MTU_MAX 2290 #define IEEE80211_MTU_MIN 32 #define IEEE80211_MAX_LEN (2300 + IEEE80211_CRC_LEN + \ (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN)) #define IEEE80211_ACK_LEN \ (sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN) #define IEEE80211_MIN_LEN \ (sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN) /* * The 802.11 spec says at most 2007 stations may be * associated at once. For most AP's this is way more * than is feasible so we use a default of IEEE80211_AID_DEF. * This number may be overridden by the driver and/or by * user configuration but may not be less than IEEE80211_AID_MIN * (see _ieee80211.h for implementation-specific settings). */ #define IEEE80211_AID_MAX 2007 #define IEEE80211_AID(b) ((b) &~ 0xc000) /* * RTS frame length parameters. The default is specified in * the 802.11 spec as 512; we treat it as implementation-dependent * so it's defined in ieee80211_var.h. The max may be wrong * for jumbo frames. */ #define IEEE80211_RTS_MIN 1 #define IEEE80211_RTS_MAX 2346 /* * TX fragmentation parameters. As above for RTS, we treat * default as implementation-dependent so define it elsewhere. */ #define IEEE80211_FRAG_MIN 256 #define IEEE80211_FRAG_MAX 2346 /* * Beacon interval (TU's). Min+max come from WiFi requirements. * As above, we treat default as implementation-dependent so * define it elsewhere. */ #define IEEE80211_BINTVAL_MAX 1000 /* max beacon interval (TU's) */ #define IEEE80211_BINTVAL_MIN 25 /* min beacon interval (TU's) */ /* * DTIM period (beacons). Min+max are not really defined * by the protocol but we want them publicly visible so * define them here. */ #define IEEE80211_DTIM_MAX 15 /* max DTIM period */ #define IEEE80211_DTIM_MIN 1 /* min DTIM period */ /* * Beacon miss threshold (beacons). As for DTIM, we define * them here to be publicly visible. Note the max may be * clamped depending on device capabilities. */ #define IEEE80211_HWBMISS_MIN 1 #define IEEE80211_HWBMISS_MAX 255 /* * 802.11 frame duration definitions. */ struct ieee80211_duration { uint16_t d_rts_dur; uint16_t d_data_dur; uint16_t d_plcp_len; uint8_t d_residue; /* unused octets in time slot */ }; /* One Time Unit (TU) is 1Kus = 1024 microseconds. */ #define IEEE80211_DUR_TU 1024 /* IEEE 802.11b durations for DSSS PHY in microseconds */ #define IEEE80211_DUR_DS_LONG_PREAMBLE 144 #define IEEE80211_DUR_DS_SHORT_PREAMBLE 72 #define IEEE80211_DUR_DS_SLOW_PLCPHDR 48 #define IEEE80211_DUR_DS_FAST_PLCPHDR 24 #define IEEE80211_DUR_DS_SLOW_ACK 112 #define IEEE80211_DUR_DS_FAST_ACK 56 #define IEEE80211_DUR_DS_SLOW_CTS 112 #define IEEE80211_DUR_DS_FAST_CTS 56 #define IEEE80211_DUR_DS_SLOT 20 #define IEEE80211_DUR_DS_SIFS 10 #define IEEE80211_DUR_DS_PIFS (IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT) #define IEEE80211_DUR_DS_DIFS (IEEE80211_DUR_DS_SIFS + \ 2 * IEEE80211_DUR_DS_SLOT) #define IEEE80211_DUR_DS_EIFS (IEEE80211_DUR_DS_SIFS + \ IEEE80211_DUR_DS_SLOW_ACK + \ IEEE80211_DUR_DS_LONG_PREAMBLE + \ IEEE80211_DUR_DS_SLOW_PLCPHDR + \ IEEE80211_DUR_DIFS) #endif /* _NET80211_IEEE80211_H_ */