diff options
Diffstat (limited to 'sys/compat/linuxkpi/common/include/net')
-rw-r--r-- | sys/compat/linuxkpi/common/include/net/cfg80211.h | 689 | ||||
-rw-r--r-- | sys/compat/linuxkpi/common/include/net/mac80211.h | 1126 | ||||
-rw-r--r-- | sys/compat/linuxkpi/common/include/net/page_pool.h | 2 |
3 files changed, 961 insertions, 856 deletions
diff --git a/sys/compat/linuxkpi/common/include/net/cfg80211.h b/sys/compat/linuxkpi/common/include/net/cfg80211.h index 7e57ce67cc26..18b34f0e90ec 100644 --- a/sys/compat/linuxkpi/common/include/net/cfg80211.h +++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2020-2023 The FreeBSD Foundation + * Copyright (c) 2020-2025 The FreeBSD Foundation * Copyright (c) 2021-2022 Bjoern A. Zeeb * * This software was developed by Björn Zeeb under sponsorship from @@ -33,14 +33,19 @@ #include <linux/types.h> #include <linux/nl80211.h> #include <linux/ieee80211.h> +#include <linux/mutex.h> #include <linux/if_ether.h> #include <linux/ethtool.h> #include <linux/device.h> #include <linux/netdevice.h> #include <linux/random.h> #include <linux/skbuff.h> +#include <linux/timer.h> +#include <linux/workqueue.h> #include <net/regulatory.h> +#include <net80211/ieee80211.h> + /* linux_80211.c */ extern int linuxkpi_debug_80211; #ifndef D80211_TODO @@ -49,8 +54,8 @@ extern int linuxkpi_debug_80211; #ifndef D80211_IMPROVE #define D80211_IMPROVE 0x2 #endif -#define TODO(...) if (linuxkpi_debug_80211 & D80211_TODO) \ - printf("%s:%d: XXX LKPI80211 TODO\n", __func__, __LINE__) +#define TODO(fmt, ...) if (linuxkpi_debug_80211 & D80211_TODO) \ + printf("%s:%d: XXX LKPI80211 TODO " fmt "\n", __func__, __LINE__, ##__VA_ARGS__) #define IMPROVE(...) if (linuxkpi_debug_80211 & D80211_IMPROVE) \ printf("%s:%d: XXX LKPI80211 IMPROVE\n", __func__, __LINE__) @@ -78,6 +83,9 @@ enum cfg80211_rate_info_flags { /* Max 8 bits as used in struct rate_info. */ }; +#define CFG80211_RATE_INFO_FLAGS_BITS \ + "\20\1MCS\2VHT_MCS\3SGI\5HE_MCS\10EHT_MCS" + extern const uint8_t rfc1042_header[6]; extern const uint8_t bridge_tunnel_header[6]; @@ -106,6 +114,11 @@ enum ieee80211_channel_flags { IEEE80211_CHAN_NO_80MHZ = BIT(7), IEEE80211_CHAN_NO_160MHZ = BIT(8), IEEE80211_CHAN_NO_OFDM = BIT(9), + IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT = BIT(10), + IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT = BIT(11), + IEEE80211_CHAN_PSD = BIT(12), + IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP = BIT(13), + IEEE80211_CHAN_CAN_MONITOR = BIT(14), }; #define IEEE80211_CHAN_NO_HT40 (IEEE80211_CHAN_NO_HT40MINUS|IEEE80211_CHAN_NO_HT40PLUS) @@ -156,7 +169,7 @@ enum rate_info_bw { struct rate_info { uint8_t flags; /* enum cfg80211_rate_info_flags */ - uint8_t bw; + uint8_t bw; /* enum rate_info_bw */ uint16_t legacy; uint8_t mcs; uint8_t nss; @@ -167,11 +180,10 @@ struct rate_info { }; struct ieee80211_rate { - /* TODO FIXME */ - uint32_t bitrate; - uint32_t hw_value; - uint32_t hw_value_short; - uint32_t flags; + uint32_t flags; /* enum ieee80211_rate_flags */ + uint16_t bitrate; + uint16_t hw_value; + uint16_t hw_value_short; }; struct ieee80211_sta_ht_cap { @@ -190,7 +202,7 @@ struct ieee80211_sta_ht_cap { #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_SUPP_CHAN_WIDTH_MASK IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK #define IEEE80211_VHT_CAP_RXLDPC 0x00000010 /* IEEE80211_VHTCAP_RXLDPC */ @@ -228,7 +240,8 @@ struct ieee80211_sta_ht_cap { #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 */ -#define IEEE80211_VHT_CAP_EXT_NSS_BW_MASK 0xc0000000 +#define IEEE80211_VHT_CAP_EXT_NSS_BW_MASK IEEE80211_VHTCAP_EXT_NSS_BW +#define IEEE80211_VHT_CAP_EXT_NSS_BW_SHIFT IEEE80211_VHTCAP_EXT_NSS_BW_S struct ieee80211_sta_vht_cap { /* TODO FIXME */ @@ -275,6 +288,9 @@ struct cfg80211_bss_ies { struct cfg80211_bss { /* XXX TODO */ struct cfg80211_bss_ies *ies; + struct cfg80211_bss_ies *beacon_ies; + + int32_t signal; }; struct cfg80211_chan_def { @@ -283,6 +299,7 @@ struct cfg80211_chan_def { enum nl80211_chan_width width; uint32_t center_freq1; uint32_t center_freq2; + uint16_t punctured; }; struct cfg80211_ftm_responder_stats { @@ -378,11 +395,16 @@ struct cfg80211_match_set { struct cfg80211_scan_request { /* XXX TODO */ - int duration, duration_mandatory, flags; bool no_cck; bool scan_6ghz; + bool duration_mandatory; + int8_t tsf_report_link_id; + uint16_t duration; + uint32_t flags; struct wireless_dev *wdev; struct wiphy *wiphy; + uint64_t scan_start; + uint32_t rates[NUM_NL80211_BANDS]; int ie_len; uint8_t *ie; uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN]; @@ -529,18 +551,39 @@ struct station_del_parameters { }; 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_duration, tx_failed, tx_retries; - int ack_signal, avg_ack_signal; + uint64_t filled; /* enum nl80211_sta_info */ + uint32_t connected_time; + uint32_t inactive_time; + + uint64_t rx_bytes; + uint32_t rx_packets; + uint32_t rx_dropped_misc; + + uint64_t rx_duration; + uint32_t rx_beacon; + uint8_t rx_beacon_signal_avg; + + int8_t signal; + int8_t signal_avg; + int8_t ack_signal; + int8_t avg_ack_signal; + + /* gap */ + int generation; + + uint64_t tx_bytes; + uint32_t tx_packets; + uint32_t tx_failed; + uint64_t tx_duration; + uint32_t tx_retries; int chains; uint8_t chain_signal[IEEE80211_MAX_CHAINS]; uint8_t chain_signal_avg[IEEE80211_MAX_CHAINS]; uint8_t *assoc_req_ies; + size_t assoc_req_ies_len; + struct rate_info rxrate; struct rate_info txrate; struct cfg80211_ibss_params bss_param; @@ -599,174 +642,6 @@ struct linuxkpi_ieee80211_regdomain { 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_OMI_CONTROL 0x02 -#define IEEE80211_HE_MAC_CAP3_OFDMA_RA 0x04 -#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_1 0x08 -#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_2 0x10 -#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3 0x18 -#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK 0x18 -#define IEEE80211_HE_MAC_CAP3_FLEX_TWT_SCHED 0x40 -#define IEEE80211_HE_MAC_CAP3_RX_CTRL_FRAME_TO_MULTIBSS 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_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_CAP0_CHANNEL_WIDTH_SET_MASK_ALL 0xff - -#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 IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED 0x1 -#define IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET 0x2 -#define IEEE80211_HE_OPERATION_ER_SU_DISABLE 0x4 - -#define IEEE80211_HE_SPR_HESIGA_SR_VAL15_ALLOWED 0x01 -#define IEEE80211_HE_SPR_NON_SRG_OBSS_PD_SR_DISALLOWED 0x02 -#define IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT 0x04 -#define IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT 0x08 - #define IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS 0x01 #define IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_11454 0x02 #define IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_MASK 0x03 @@ -774,6 +649,7 @@ struct linuxkpi_ieee80211_regdomain { #define IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE1 0x05 #define IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE2 0x06 #define IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_7991 0x07 +#define IEEE80211_EHT_MAC_CAP0_SCS_TRAFFIC_DESC 0x08 #define IEEE80211_EHT_MAC_CAP1_MAX_AMPDU_LEN_MASK 0x01 @@ -851,28 +727,12 @@ struct linuxkpi_ieee80211_regdomain { #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 +/* net80211::net80211_he_cap */ struct ieee80211_sta_he_cap { - /* TODO FIXME */ - int has_he; + bool 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]; + uint8_t ppe_thres[IEEE80211_HE_CAP_PPE_THRES_MAX]; }; struct cfg80211_he_bss_color { @@ -889,22 +749,27 @@ struct ieee80211_he_obss_pd { uint8_t partial_bssid_bitmap[8]; }; -struct ieee80211_sta_he_6ghz_capa { - /* TODO FIXME */ - int capa; -}; - struct ieee80211_eht_mcs_nss_supp_20mhz_only { - uint8_t rx_tx_mcs7_max_nss; - uint8_t rx_tx_mcs9_max_nss; - uint8_t rx_tx_mcs11_max_nss; - uint8_t rx_tx_mcs13_max_nss; + union { + struct { + uint8_t rx_tx_mcs7_max_nss; + uint8_t rx_tx_mcs9_max_nss; + uint8_t rx_tx_mcs11_max_nss; + uint8_t rx_tx_mcs13_max_nss; + }; + uint8_t rx_tx_max_nss[4]; + }; }; struct ieee80211_eht_mcs_nss_supp_bw { - uint8_t rx_tx_mcs9_max_nss; - uint8_t rx_tx_mcs11_max_nss; - uint8_t rx_tx_mcs13_max_nss; + union { + struct { + uint8_t rx_tx_mcs9_max_nss; + uint8_t rx_tx_mcs11_max_nss; + uint8_t rx_tx_mcs13_max_nss; + }; + uint8_t rx_tx_max_nss[3]; + }; }; struct ieee80211_eht_cap_elem_fixed { @@ -937,7 +802,7 @@ 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 ieee80211_he_6ghz_capa he_6ghz_capa; struct ieee80211_sta_eht_cap eht_cap; struct { const uint8_t *data; @@ -981,9 +846,12 @@ struct cfg80211_wowlan_nd_info { enum wiphy_wowlan_support_flags { WIPHY_WOWLAN_DISCONNECT, - WIPHY_WOWLAN_GTK_REKEY_FAILURE, WIPHY_WOWLAN_MAGIC_PKT, WIPHY_WOWLAN_SUPPORTS_GTK_REKEY, + WIPHY_WOWLAN_GTK_REKEY_FAILURE, + WIPHY_WOWLAN_EAP_IDENTITY_REQ, + WIPHY_WOWLAN_4WAY_HANDSHAKE, + WIPHY_WOWLAN_RFKILL_RELEASE, WIPHY_WOWLAN_NET_DETECT, }; @@ -997,6 +865,7 @@ struct cfg80211_wowlan_wakeup { /* XXX TODO */ uint16_t pattern_idx; bool disconnect; + bool unprot_deauth_disassoc; bool eap_identity_req; bool four_way_handshake; bool gtk_rekey_failure; @@ -1014,11 +883,22 @@ struct cfg80211_wowlan_wakeup { struct cfg80211_wowlan { /* XXX TODO */ - int disconnect, gtk_rekey_failure, magic_pkt; - int eap_identity_req, four_way_handshake, rfkill_release, tcp, any; + bool any; + bool disconnect; + bool magic_pkt; + bool gtk_rekey_failure; + bool eap_identity_req; + bool four_way_handshake; + bool rfkill_release; + + /* Magic packet patterns. */ int n_patterns; - struct cfg80211_sched_scan_request *nd_config; struct cfg80211_pkt_pattern *patterns; + + /* netdetect? if not assoc? */ + struct cfg80211_sched_scan_request *nd_config; + + void *tcp; /* XXX ? */ }; struct cfg80211_gtk_rekey_data { @@ -1096,7 +976,7 @@ struct wiphy_iftype_ext_capab { const uint8_t *extended_capabilities_mask; uint8_t extended_capabilities_len; uint16_t eml_capabilities; - + uint16_t mld_capa_and_ops; }; struct tid_config_support { @@ -1115,6 +995,18 @@ enum cfg80211_regulatory { REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(6), }; +struct wiphy_radio_freq_range { + uint32_t start_freq; + uint32_t end_freq; +}; + +struct wiphy_radio { + int n_freq_range; + int n_iface_combinations; + const struct wiphy_radio_freq_range *freq_range; + const struct ieee80211_iface_combination *iface_combinations; +}; + enum wiphy_flags { WIPHY_FLAG_AP_UAPSD = BIT(0), WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(1), @@ -1133,10 +1025,23 @@ enum wiphy_flags { WIPHY_FLAG_4ADDR_AP = BIT(14), WIPHY_FLAG_4ADDR_STATION = BIT(15), WIPHY_FLAG_SUPPORTS_MLO = BIT(16), + WIPHY_FLAG_DISABLE_WEXT = BIT(17), }; -struct wiphy { +struct wiphy_work; +typedef void (*wiphy_work_fn)(struct wiphy *, struct wiphy_work *); +struct wiphy_work { + struct list_head entry; + wiphy_work_fn fn; +}; +struct wiphy_delayed_work { + struct wiphy_work work; + struct wiphy *wiphy; + struct timer_list timer; +}; +struct wiphy { + struct mutex mtx; struct device *dev; struct mac_address *addresses; int n_addresses; @@ -1166,6 +1071,9 @@ struct wiphy { uint8_t available_antennas_rx; uint8_t available_antennas_tx; + int n_radio; + const struct wiphy_radio *radio; + int features, hw_version; 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; @@ -1179,16 +1087,22 @@ struct wiphy { unsigned long ext_features[BITS_TO_LONGS(NUM_NL80211_EXT_FEATURES)]; struct dentry *debugfsdir; - struct cfg80211_wowlan_support *wowlan; + + const struct wiphy_wowlan_support *wowlan; + struct cfg80211_wowlan *wowlan_config; /* Lower layer (driver/mac80211) specific data. */ /* Must stay last. */ uint8_t priv[0] __aligned(CACHE_LINE_SIZE); }; +#define lockdep_assert_wiphy(wiphy) \ + lockdep_assert_held(&(wiphy)->mtx) + struct wireless_dev { /* XXX TODO, like ic? */ - int iftype; - int address; + enum nl80211_iftype iftype; + uint32_t radio_mask; + uint8_t address[ETH_ALEN]; struct net_device *netdev; struct wiphy *wiphy; }; @@ -1249,8 +1163,18 @@ struct cfg80211_ops { struct wiphy *linuxkpi_wiphy_new(const struct cfg80211_ops *, size_t); void linuxkpi_wiphy_free(struct wiphy *wiphy); +void linuxkpi_wiphy_work_queue(struct wiphy *, struct wiphy_work *); +void linuxkpi_wiphy_work_cancel(struct wiphy *, struct wiphy_work *); +void linuxkpi_wiphy_work_flush(struct wiphy *, struct wiphy_work *); +void lkpi_wiphy_delayed_work_timer(struct timer_list *); +void linuxkpi_wiphy_delayed_work_queue(struct wiphy *, + struct wiphy_delayed_work *, unsigned long); +void linuxkpi_wiphy_delayed_work_cancel(struct wiphy *, + struct wiphy_delayed_work *); + int linuxkpi_regulatory_set_wiphy_regd_sync(struct wiphy *wiphy, struct linuxkpi_ieee80211_regdomain *regd); +uint32_t linuxkpi_cfg80211_calculate_bitrate(struct rate_info *); 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 * @@ -1300,28 +1224,11 @@ wiphy_dev(struct wiphy *wiphy) return (wiphy->dev); } -#define wiphy_err(_wiphy, _fmt, ...) \ - dev_err((_wiphy)->dev, _fmt, __VA_ARGS__) +#define wiphy_dereference(_w, p) \ + rcu_dereference_check(p, lockdep_is_held(&(_w)->mtx)) -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(); -} +#define wiphy_lock(_w) mutex_lock(&(_w)->mtx) +#define wiphy_unlock(_w) mutex_unlock(&(_w)->mtx) static __inline void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked, @@ -1372,6 +1279,18 @@ rfkill_soft_blocked(int rfkill) return (false); } +static __inline void +wiphy_rfkill_start_polling(struct wiphy *wiphy) +{ + TODO(); +} + +static __inline void +wiphy_rfkill_stop_polling(struct wiphy *wiphy) +{ + TODO(); +} + static __inline int reg_query_regdb_wmm(uint8_t *alpha2, uint32_t center_freq, struct ieee80211_reg_rule *rule) @@ -1413,40 +1332,74 @@ cfg80211_pmsr_report(struct wireless_dev *wdev, TODO(); } -static __inline void +static inline void cfg80211_chandef_create(struct cfg80211_chan_def *chandef, - struct linuxkpi_ieee80211_channel *chan, enum nl80211_chan_flags chan_flag) + struct linuxkpi_ieee80211_channel *chan, enum nl80211_channel_type chan_type) { KASSERT(chandef != NULL, ("%s: chandef is NULL\n", __func__)); KASSERT(chan != NULL, ("%s: chan is NULL\n", __func__)); - memset(chandef, 0, sizeof(*chandef)); + /* memset(chandef, 0, sizeof(*chandef)); */ chandef->chan = chan; - chandef->center_freq2 = 0; /* Set here and only overwrite if needed. */ + chandef->center_freq1 = chan->center_freq; + /* chandef->width, center_freq2, punctured */ - switch (chan_flag) { + switch (chan_type) { 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; + case NL80211_CHAN_HT20: + chandef->width = NL80211_CHAN_WIDTH_20; + break; + case NL80211_CHAN_HT40MINUS: + chandef->width = NL80211_CHAN_WIDTH_40; + chandef->center_freq1 -= 10; + break; + case NL80211_CHAN_HT40PLUS: + chandef->width = NL80211_CHAN_WIDTH_40; + chandef->center_freq1 += 10; break; }; } +static __inline bool +cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef) +{ + TODO(); + return (false); +} + +static __inline bool +cfg80211_chandef_dfs_usable(struct wiphy *wiphy, const struct cfg80211_chan_def *chandef) +{ + TODO(); + return (false); +} + +static __inline unsigned int +cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy, const struct cfg80211_chan_def *chandef) +{ + TODO(); + return (0); +} + +static __inline bool +cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef_1, + const struct cfg80211_chan_def *chandef_2) +{ + TODO(); + return (false); +} + +static __inline bool +cfg80211_chandef_usable(struct wiphy *wiphy, + const struct cfg80211_chan_def *chandef, uint32_t flags) +{ + TODO(); + return (false); +} + static __inline void cfg80211_bss_iter(struct wiphy *wiphy, struct cfg80211_chan_def *chandef, void (*iterfunc)(struct wiphy *, struct cfg80211_bss *, void *), void *data) @@ -1529,11 +1482,10 @@ cfg80211_find_vendor_ie(unsigned int oui, int oui_type, return (__DECONST(uint8_t *, elem)); } -static __inline uint32_t +static inline uint32_t cfg80211_calculate_bitrate(struct rate_info *rate) { - TODO(); - return (-1); + return (linuxkpi_cfg80211_calculate_bitrate(rate)); } static __inline uint32_t @@ -1661,6 +1613,12 @@ wiphy_ext_feature_set(struct wiphy *wiphy, enum nl80211_ext_feature ef) set_bit(ef, wiphy->ext_features); } +static inline bool +wiphy_ext_feature_isset(struct wiphy *wiphy, enum nl80211_ext_feature ef) +{ + return (test_bit(ef, wiphy->ext_features)); +} + static __inline void * wiphy_net(struct wiphy *wiphy) { @@ -1906,7 +1864,7 @@ cfg80211_channel_is_psc(struct linuxkpi_ieee80211_channel *channel) 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) + enum nl80211_band band) { const struct element *elem; @@ -1977,23 +1935,200 @@ cfg80211_find_ext_ie(uint8_t eid, const uint8_t *p, size_t len) return (NULL); } -static __inline bool -cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef) +static inline void +_ieee80211_set_sband_iftype_data(struct ieee80211_supported_band *band, + struct ieee80211_sband_iftype_data *iftype_data, size_t nitems) { - TODO(); - return (false); + band->iftype_data = iftype_data; + band->n_iftype_data = nitems; +} + +static inline const struct ieee80211_sband_iftype_data * +ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *band, + enum nl80211_iftype iftype) +{ + const struct ieee80211_sband_iftype_data *iftype_data; + int i; + + for (i = 0; i < band->n_iftype_data; i++) { + iftype_data = (const void *)&band->iftype_data[i]; + if (iftype_data->types_mask & BIT(iftype)) + return (iftype_data); + } + + return (NULL); } -static __inline const struct ieee80211_sta_eht_cap * +static inline const struct ieee80211_sta_he_cap * +ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *band, + enum nl80211_iftype iftype) +{ + const struct ieee80211_sband_iftype_data *iftype_data; + const struct ieee80211_sta_he_cap *he_cap; + + iftype_data = ieee80211_get_sband_iftype_data(band, iftype); + if (iftype_data == NULL) + return (NULL); + + he_cap = NULL; + if (iftype_data->he_cap.has_he) + he_cap = &iftype_data->he_cap; + + return (he_cap); +} + +static inline const struct ieee80211_sta_eht_cap * ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *band, enum nl80211_iftype iftype) { + const struct ieee80211_sband_iftype_data *iftype_data; + const struct ieee80211_sta_eht_cap *eht_cap; + + iftype_data = ieee80211_get_sband_iftype_data(band, iftype); + if (iftype_data == NULL) + return (NULL); + + eht_cap = NULL; + if (iftype_data->eht_cap.has_eht) + eht_cap = &iftype_data->eht_cap; + + return (eht_cap); +} + +static inline bool +cfg80211_ssid_eq(struct cfg80211_ssid *ssid1, struct cfg80211_ssid *ssid2) +{ + int error; + + if (ssid1 == NULL || ssid2 == NULL) /* Can we KASSERT this? */ + return (false); + + if (ssid1->ssid_len != ssid2->ssid_len) + return (false); + error = memcmp(ssid1->ssid, ssid2->ssid, ssid2->ssid_len); + if (error != 0) + return (false); + return (true); +} + +static inline void +cfg80211_rx_unprot_mlme_mgmt(struct net_device *ndev, const uint8_t *hdr, + uint32_t len) +{ + TODO(); +} + +static inline const struct wiphy_iftype_ext_capab * +cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype iftype) +{ + TODO(); return (NULL); } +static inline uint16_t +ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband, + enum nl80211_iftype iftype) +{ + TODO(); + return (0); +} + +static inline int +nl80211_chan_width_to_mhz(enum nl80211_chan_width width) +{ + switch (width) { + case NL80211_CHAN_WIDTH_5: + return (5); + break; + case NL80211_CHAN_WIDTH_10: + return (10); + break; + case NL80211_CHAN_WIDTH_20_NOHT: + case NL80211_CHAN_WIDTH_20: + return (20); + break; + case NL80211_CHAN_WIDTH_40: + return (40); + break; + case NL80211_CHAN_WIDTH_80: + case NL80211_CHAN_WIDTH_80P80: + return (80); + break; + case NL80211_CHAN_WIDTH_160: + return (160); + break; + case NL80211_CHAN_WIDTH_320: + return (320); + break; + } +} + +static __inline ssize_t +wiphy_locked_debugfs_write(struct wiphy *wiphy, struct file *file, + char *buf, size_t bufsize, const char __user *userbuf, size_t count, + ssize_t (*handler)(struct wiphy *, struct file *, char *, size_t, void *), + void *data) +{ + TODO(); + return (-ENXIO); +} + +/* -------------------------------------------------------------------------- */ + +static inline void +wiphy_work_init(struct wiphy_work *wwk, wiphy_work_fn fn) +{ + INIT_LIST_HEAD(&wwk->entry); + wwk->fn = fn; +} + +static inline void +wiphy_work_queue(struct wiphy *wiphy, struct wiphy_work *wwk) +{ + linuxkpi_wiphy_work_queue(wiphy, wwk); +} + +static inline void +wiphy_work_cancel(struct wiphy *wiphy, struct wiphy_work *wwk) +{ + linuxkpi_wiphy_work_cancel(wiphy, wwk); +} + +static inline void +wiphy_work_flush(struct wiphy *wiphy, struct wiphy_work *wwk) +{ + linuxkpi_wiphy_work_flush(wiphy, wwk); +} + +static inline void +wiphy_delayed_work_init(struct wiphy_delayed_work *wdwk, wiphy_work_fn fn) +{ + wiphy_work_init(&wdwk->work, fn); + timer_setup(&wdwk->timer, lkpi_wiphy_delayed_work_timer, 0); +} + +static inline void +wiphy_delayed_work_queue(struct wiphy *wiphy, struct wiphy_delayed_work *wdwk, + unsigned long delay) +{ + linuxkpi_wiphy_delayed_work_queue(wiphy, wdwk, delay); +} + +static inline void +wiphy_delayed_work_cancel(struct wiphy *wiphy, struct wiphy_delayed_work *wdwk) +{ + linuxkpi_wiphy_delayed_work_cancel(wiphy, wdwk); +} + +/* -------------------------------------------------------------------------- */ + +#define wiphy_err(_wiphy, _fmt, ...) \ + dev_err((_wiphy)->dev, _fmt, __VA_ARGS__) #define wiphy_info(wiphy, fmt, ...) \ - printf("%s:%d XXX TODO " fmt, __func__, __LINE__, __VA_ARGS__) + dev_info((wiphy)->dev, fmt, ##__VA_ARGS__) +#define wiphy_info_once(wiphy, fmt, ...) \ + dev_info_once((wiphy)->dev, fmt, ##__VA_ARGS__) #ifndef LINUXKPI_NET80211 #define ieee80211_channel linuxkpi_ieee80211_channel diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h index fc9d7829dae3..af3199c38939 100644 --- a/sys/compat/linuxkpi/common/include/net/mac80211.h +++ b/sys/compat/linuxkpi/common/include/net/mac80211.h @@ -1,6 +1,6 @@ /*- - * Copyright (c) 2020-2023 The FreeBSD Foundation - * Copyright (c) 2020-2022 Bjoern A. Zeeb + * Copyright (c) 2020-2025 The FreeBSD Foundation + * Copyright (c) 2020-2025 Bjoern A. Zeeb * * This software was developed by Björn Zeeb under sponsorship from * the FreeBSD Foundation. @@ -34,13 +34,16 @@ #include <asm/atomic64.h> #include <linux/bitops.h> +#include <linux/bitfield.h> #include <linux/etherdevice.h> #include <linux/ethtool.h> #include <linux/netdevice.h> #include <linux/skbuff.h> #include <linux/workqueue.h> #include <linux/dcache.h> +#include <linux/ieee80211.h> #include <net/cfg80211.h> +#include <net/if_inet6.h> #define ARPHRD_IEEE80211_RADIOTAP __LINE__ /* XXX TODO brcmfmac */ @@ -83,6 +86,7 @@ enum mcast_filter_flags { FIF_OTHER_BSS = BIT(4), FIF_PSPOLL = BIT(5), FIF_CONTROL = BIT(6), + FIF_MCAST_ACTION = BIT(7), }; enum ieee80211_bss_changed { @@ -117,6 +121,9 @@ enum ieee80211_bss_changed { BSS_CHANGED_TWT = BIT(28), BSS_CHANGED_UNSOL_BCAST_PROBE_RESP = BIT(30), BSS_CHANGED_EHT_PUNCTURING = BIT(31), + BSS_CHANGED_MLD_VALID_LINKS = BIT_ULL(32), + BSS_CHANGED_MLD_TTLM = BIT_ULL(33), + BSS_CHANGED_TPE = BIT_ULL(34), }; /* 802.11 Figure 9-256 Suite selector format. [OUI(3), SUITE TYPE(1)] */ @@ -167,13 +174,24 @@ enum ieee80211_bss_changed { #define TKIP_PN_TO_IV16(_x) ((uint16_t)(_x & 0xffff)) #define TKIP_PN_TO_IV32(_x) ((uint32_t)((_x >> 16) & 0xffffffff)) -struct ieee80211_sta; +enum ieee80211_neg_ttlm_res { + NEG_TTLM_RES_ACCEPT, + NEG_TTLM_RES_REJECT, +}; + +#define IEEE80211_TTLM_NUM_TIDS 8 +struct ieee80211_neg_ttlm { + uint16_t downlink[IEEE80211_TTLM_NUM_TIDS]; + uint16_t uplink[IEEE80211_TTLM_NUM_TIDS]; +}; /* 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_sta; + struct ieee80211_ampdu_params { struct ieee80211_sta *sta; enum ieee80211_ampdu_mlme_action action; @@ -191,19 +209,6 @@ struct ieee80211_bar { 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; @@ -217,11 +222,13 @@ struct mac80211_fils_discovery { }; 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; + struct cfg80211_chan_def ap; + + uint8_t rx_chains_dynamic; + uint8_t rx_chains_static; + bool radar_enabled; /* Must stay last. */ uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE); @@ -240,12 +247,39 @@ struct ieee80211_ema_beacons { } bcn[0]; }; +struct ieee80211_chanreq { + struct cfg80211_chan_def oper; +}; + #define WLAN_MEMBERSHIP_LEN (8) #define WLAN_USER_POSITION_LEN (16) +/* + * 802.11ac-2013, 8.4.2.164 VHT Transmit Power Envelope element + * 802.11-???? ? + */ +struct ieee80211_parsed_tpe_eirp { + int8_t power[5]; + uint8_t count; + bool valid; +}; +struct ieee80211_parsed_tpe_psd { + int8_t power[16]; + uint8_t count; + bool valid; +}; +struct ieee80211_parsed_tpe { + /* We see access to [0] so assume at least 2. */ + struct ieee80211_parsed_tpe_eirp max_local[2]; + struct ieee80211_parsed_tpe_eirp max_reg_client[2]; + struct ieee80211_parsed_tpe_psd psd_local[2]; + struct ieee80211_parsed_tpe_psd psd_reg_client[2]; +}; + struct ieee80211_bss_conf { /* TODO FIXME */ struct ieee80211_vif *vif; + struct cfg80211_bss *bss; const uint8_t *bssid; uint8_t addr[ETH_ALEN]; uint8_t link_id; @@ -253,7 +287,7 @@ struct ieee80211_bss_conf { 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; + struct ieee80211_chanreq chanreq; __be32 arp_addr_list[1]; /* XXX TODO */ struct ieee80211_rate *beacon_rate; struct { @@ -288,6 +322,7 @@ struct ieee80211_bss_conf { uint8_t dtim_period; uint8_t sync_dtim_count; + uint8_t bss_param_ch_cnt_link_id; bool qos; bool twt_broadcast; bool use_cts_prot; @@ -297,17 +332,19 @@ struct ieee80211_bss_conf { bool eht_support; bool csa_active; bool mu_mimo_owner; + bool color_change_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]; - enum ieee80211_reg_ap_power power_type; + enum ieee80211_ap_reg_power power_type; struct cfg80211_bitrate_mask beacon_tx_rate; struct mac80211_fils_discovery fils_discovery; struct ieee80211_chanctx_conf *chanctx_conf; struct ieee80211_vif *mbssid_tx_vif; + struct ieee80211_parsed_tpe tpe; 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; @@ -316,27 +353,15 @@ struct ieee80211_bss_conf { int twt_requester, uora_exists, uora_ocw_range; int assoc_capability, enable_beacon, hidden_ssid, ibss_joined, twt_protected; int twt_responder, unsol_bcast_probe_resp_interval; - int color_change_active; }; struct ieee80211_channel_switch { /* TODO FIXME */ int block_tx, count, delay, device_timestamp, timestamp; + uint8_t link_id; 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, @@ -388,11 +413,6 @@ struct ieee80211_ftm_responder_params { 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; @@ -444,6 +464,11 @@ enum ieee80211_hw_flags { IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD, IEEE80211_HW_SUPPORTS_RC_TABLE, IEEE80211_HW_DETECTS_COLOR_COLLISION, + IEEE80211_HW_DISALLOW_PUNCTURING, + IEEE80211_HW_DISALLOW_PUNCTURING_5GHZ, + IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN, + IEEE80211_HW_HANDLES_QUIET_CSA, + IEEE80211_HW_NO_VIRTUAL_MONITOR, /* Keep last. */ NUM_IEEE80211_HW_FLAGS @@ -456,8 +481,6 @@ struct ieee80211_hw { /* TODO FIXME */ 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. */ @@ -500,9 +523,18 @@ enum ieee802111_key_flag { IEEE80211_KEY_FLAG_GENERATE_IV_MGMT = BIT(6), IEEE80211_KEY_FLAG_GENERATE_MMIE = BIT(7), IEEE80211_KEY_FLAG_RESERVE_TAILROOM = BIT(8), + IEEE80211_KEY_FLAG_SPP_AMSDU = BIT(9), }; +#define IEEE80211_KEY_FLAG_BITS \ + "\20\1GENERATE_IV\2GENERATE_MMIC\3PAIRWISE\4PUT_IV_SPACE" \ + "\5PUT_MIC_SPACE\6SW_MGMT_TX\7GENERATE_IV_MGMT\10GENERATE_MMIE" \ + "\11RESERVE_TAILROOM\12SPP_AMSDU" + struct ieee80211_key_conf { +#if defined(__FreeBSD__) + const struct ieee80211_key *_k; /* backpointer to net80211 */ +#endif atomic64_t tx_pn; uint32_t cipher; uint8_t icv_len; /* __unused nowadays? */ @@ -526,10 +558,13 @@ struct ieee80211_key_seq { uint8_t pn[IEEE80211_CCMP_PN_LEN]; } ccmp; struct { - uint8_t pn[IEEE80211_CCMP_PN_LEN]; + uint8_t pn[IEEE80211_GCMP_PN_LEN]; + } gcmp; + struct { + uint8_t pn[IEEE80211_CMAC_PN_LEN]; } aes_cmac; struct { - uint8_t pn[IEEE80211_CCMP_PN_LEN]; + uint8_t pn[IEEE80211_GMAC_PN_LEN]; } aes_gmac; struct { uint32_t iv32; @@ -548,8 +583,10 @@ enum ieee80211_rx_status_flags { 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_MACTIME = BIT(8) | BIT(9), + RX_FLAG_MACTIME_PLCP_START = 1 << 8, + RX_FLAG_MACTIME_START = 2 << 8, + RX_FLAG_MACTIME_END = 3 << 8, RX_FLAG_MIC_STRIPPED = BIT(10), RX_FLAG_MMIC_ERROR = BIT(11), RX_FLAG_MMIC_STRIPPED = BIT(12), @@ -564,13 +601,27 @@ enum ieee80211_rx_status_flags { 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), + /* = BIT(24), */ RX_FLAG_ONLY_MONITOR = BIT(25), RX_FLAG_SKIP_MONITOR = BIT(26), RX_FLAG_8023 = BIT(27), RX_FLAG_RADIOTAP_TLV_AT_END = BIT(28), + /* = BIT(29), */ + RX_FLAG_MACTIME_IS_RTAP_TS64 = BIT(30), + RX_FLAG_FAILED_PLCP_CRC = BIT(31), }; +#define IEEE80211_RX_STATUS_FLAGS_BITS \ + "\20\1ALLOW_SAME_PN\2AMPDU_DETAILS\3AMPDU_EOF_BIT\4AMPDU_EOF_BIT_KNOWN" \ + "\5DECRYPTED\6DUP_VALIDATED\7FAILED_FCS_CRC\10ICV_STRIPPED" \ + "\11MACTIME_PLCP_START\12MACTIME_START\13MIC_STRIPPED" \ + "\14MMIC_ERROR\15MMIC_STRIPPED\16NO_PSDU\17PN_VALIDATED" \ + "\20RADIOTAP_HE\21RADIOTAP_HE_MU\22RADIOTAP_LSIG\23RADIOTAP_VENDOR_DATA" \ + "\24NO_SIGNAL_VAL\25IV_STRIPPED\26AMPDU_IS_LAST\27AMPDU_LAST_KNOWN" \ + "\30AMSDU_MORE\31MACTIME_END\32ONLY_MONITOR\33SKIP_MONITOR" \ + "\348023\35RADIOTAP_TLV_AT_END\36MACTIME\37MACTIME_IS_RTAP_TS64" \ + "\40FAILED_PLCP_CRC" + enum mac80211_rx_encoding { RX_ENC_LEGACY = 0, RX_ENC_HT, @@ -653,9 +704,10 @@ struct ieee80211_sta_rates { /* XXX TODO */ /* XXX some _rcu thing */ struct { - int idx; - int flags; - } rate[1]; /* XXX what is the real number? */ + uint8_t idx; + uint8_t count; + uint16_t flags; + } rate[4]; /* XXX what is the real number? */ }; struct ieee80211_sta_txpwr { @@ -672,13 +724,14 @@ struct ieee80211_sta_agg { }; struct ieee80211_link_sta { + struct ieee80211_sta *sta; uint8_t addr[ETH_ALEN]; uint8_t link_id; 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; + struct ieee80211_he_6ghz_capa he_6ghz_capa; struct ieee80211_sta_eht_cap eht_cap; uint8_t rx_nss; enum ieee80211_sta_rx_bw bandwidth; @@ -696,6 +749,7 @@ struct ieee80211_sta { uint8_t addr[ETH_ALEN]; uint16_t aid; bool wme; + bool mlo; uint8_t max_sp; uint8_t uapsd_queues; uint16_t valid_links; @@ -742,7 +796,12 @@ enum ieee80211_vif_driver_flags { IEEE80211_VIF_BEACON_FILTER = BIT(0), IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1), IEEE80211_VIF_SUPPORTS_UAPSD = BIT(2), - IEEE80211_VIF_DISABLE_SMPS_OVERRIDE = BIT(3), +#if defined(LINUXKPI_VERSION) && (LINUXKPI_VERSION < 60600) /* v6.6 */ + IEEE80211_VIF_DISABLE_SMPS_OVERRIDE = BIT(3), /* Renamed to IEEE80211_VIF_EML_ACTIVE. */ +#endif + IEEE80211_VIF_EML_ACTIVE = BIT(4), + IEEE80211_VIF_IGNORE_OFDMA_WIDER_BW = BIT(5), + IEEE80211_VIF_REMOVE_AP_AFTER_DISASSOC = BIT(6), }; #define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4 @@ -765,15 +824,13 @@ struct ieee80211_vif_cfg { struct ieee80211_vif { /* TODO FIXME */ enum nl80211_iftype type; - int csa_active, mu_mimo_owner; int cab_queue; - int color_change_active, offload_flags; + int 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; struct ieee80211_bss_conf *link_conf[IEEE80211_MLD_MAX_NUM_LINKS]; /* rcu? */ @@ -799,20 +856,23 @@ struct ieee80211_vif_chanctx_switch { struct ieee80211_prep_tx_info { u16 duration; bool success; + bool was_assoc; + int link_id; }; /* 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; + enum ieee80211_tx_info_flags flags; /* 32 bits */ /* TODO FIXME */ - u8 band; - u8 hw_queue; - bool tx_time_est; + enum nl80211_band band; /* 3 bits */ + uint16_t hw_queue:4, /* 4 bits */ + tx_time_est:10; /* 10 bits */ union { struct { struct ieee80211_tx_rate rates[4]; bool use_rts; + uint8_t antennas:2; struct ieee80211_vif *vif; struct ieee80211_key_conf *hw_key; enum ieee80211_tx_control_flags flags; @@ -911,11 +971,12 @@ enum ieee80211_offload_flags { struct ieee80211_ops { /* TODO FIXME */ int (*start)(struct ieee80211_hw *); - void (*stop)(struct ieee80211_hw *); + void (*stop)(struct ieee80211_hw *, bool); int (*config)(struct ieee80211_hw *, u32); void (*reconfig_complete)(struct ieee80211_hw *, enum ieee80211_reconfig_type); + void (*prep_add_interface)(struct ieee80211_hw *, enum nl80211_iftype); 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); @@ -934,7 +995,7 @@ struct ieee80211_ops { 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 (*mgd_protect_tdls_discover)(struct ieee80211_hw *, struct ieee80211_vif *, unsigned int); void (*flush)(struct ieee80211_hw *, struct ieee80211_vif *, u32, bool); void (*flush_sta)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); @@ -954,6 +1015,7 @@ struct ieee80211_ops { 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 (*link_sta_rc_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_link_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); @@ -965,10 +1027,10 @@ struct ieee80211_ops { 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 *); + int (*post_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *); 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 (*abort_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *); 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 *); @@ -1007,9 +1069,7 @@ struct ieee80211_ops { 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 *); - void (*set_rekey_data)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_gtk_rekey_data *); 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 *); @@ -1030,7 +1090,7 @@ struct ieee80211_ops { void (*update_vif_offload)(struct ieee80211_hw *, struct ieee80211_vif *); - int (*get_txpower)(struct ieee80211_hw *, struct ieee80211_vif *, int *); + int (*get_txpower)(struct ieee80211_hw *, struct ieee80211_vif *, unsigned int, int *); int (*get_stats)(struct ieee80211_hw *, struct ieee80211_low_level_stats *); int (*set_radar_background)(struct ieee80211_hw *, struct cfg80211_chan_def *); @@ -1044,13 +1104,29 @@ struct ieee80211_ops { int (*change_vif_links)(struct ieee80211_hw *, struct ieee80211_vif *, u16, u16, struct ieee80211_bss_conf *[IEEE80211_MLD_MAX_NUM_LINKS]); int (*change_sta_links)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u16, u16); + bool (*can_activate_links)(struct ieee80211_hw *, struct ieee80211_vif *, u16); + enum ieee80211_neg_ttlm_res (*can_neg_ttlm)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_neg_ttlm *); + + void (*rfkill_poll)(struct ieee80211_hw *); /* #ifdef CONFIG_MAC80211_DEBUGFS */ /* Do not change depending on compile-time option. */ void (*sta_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct dentry *); + void (*vif_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *); + void (*link_sta_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_link_sta *, struct dentry *); + void (*link_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct dentry *); /* #endif */ +/* #ifdef CONFIG_PM_SLEEP */ /* Do not change depending on compile-time option. */ + int (*suspend)(struct ieee80211_hw *, struct cfg80211_wowlan *); + int (*resume)(struct ieee80211_hw *); + void (*set_wakeup)(struct ieee80211_hw *, bool); + void (*set_rekey_data)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_gtk_rekey_data *); + void (*set_default_unicast_key)(struct ieee80211_hw *, struct ieee80211_vif *, int); +/* #if IS_ENABLED(CONFIG_IPV6) */ + void (*ipv6_addr_change)(struct ieee80211_hw *, struct ieee80211_vif *, struct inet6_dev *); +/* #endif */ +/* #endif CONFIG_PM_SLEEP */ }; - /* -------------------------------------------------------------------------- */ /* linux_80211.c */ @@ -1073,7 +1149,7 @@ 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 *, bool); void linuxkpi_ieee80211_iterate_chan_contexts(struct ieee80211_hw *, void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, void *), @@ -1253,7 +1329,7 @@ ieee80211_hw_restart_disconnect(struct ieee80211_vif *vif) (_link = rcu_dereference((_vif)->link_conf[_linkid])) ) #define for_each_sta_active_link(_vif, _sta, _linksta, _linkid) \ - for (_linkid = 0; _linkid < nitems((_vif)->link_conf); _linkid++) \ + for (_linkid = 0; _linkid < nitems((_sta)->link); _linkid++) \ if ( ((_vif)->active_links == 0 /* no MLO */ || \ ((_vif)->active_links & BIT(_linkid)) != 0) && \ (_linksta = link_sta_dereference_protected((_sta), (_linkid))) ) @@ -1261,353 +1337,12 @@ ieee80211_hw_restart_disconnect(struct ieee80211_vif *vif) /* -------------------------------------------------------------------------- */ 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(struct sk_buff *skb) -{ - struct ieee80211_mgmt *mgmt; - __le16 fc; - - mgmt = (struct ieee80211_mgmt *)skb->data; - fc = mgmt->frame_control; - - /* 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); /* XXX false? */ - if (ieee80211_is_disassoc(fc)) - return (true); - if (ieee80211_is_deauth(fc)) - return (true); - - TODO(); - - 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_is_pspoll(__le16 fc) -{ - __le16 v; - - fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); - v = htole16(IEEE80211_FC0_SUBTYPE_PS_POLL | IEEE80211_FC0_TYPE_CTL); - - return (fc == v); -} - -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_robust_mgmt_frame(struct sk_buff *skb) -{ - TODO(); - return (false); -} - -static __inline bool -ieee80211_is_ftm(struct sk_buff *skb) -{ - TODO(); - return (false); -} - -static __inline bool -ieee80211_is_timing_measurement(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). */ @@ -1714,6 +1449,13 @@ ieee80211_handle_wake_tx_queue(struct ieee80211_hw *hw, linuxkpi_ieee80211_handle_wake_tx_queue(hw, txq); } +static inline void +ieee80211_purge_tx_queue(struct ieee80211_hw *hw, + struct sk_buff_head *skbs) +{ + TODO(); +} + /* -------------------------------------------------------------------------- */ static __inline uint8_t @@ -1780,25 +1522,22 @@ ieee80211_iterate_interfaces(struct ieee80211_hw *hw, linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg); } -static __inline void +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); + linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg, false); } -static __inline void +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); + linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg, true); } static __inline void @@ -1841,7 +1580,7 @@ ieee80211_beacon_loss(struct ieee80211_vif *vif) } static __inline void -ieee80211_chswitch_done(struct ieee80211_vif *vif, bool t) +ieee80211_chswitch_done(struct ieee80211_vif *vif, bool t, uint32_t link_id) { TODO(); } @@ -1867,12 +1606,12 @@ ieee80211_csa_update_counter(struct ieee80211_vif *vif) } static __inline void -ieee80211_csa_finish(struct ieee80211_vif *vif) +ieee80211_csa_finish(struct ieee80211_vif *vif, uint32_t link_id) { TODO(); } -static __inline enum nl80211_iftype +static inline enum nl80211_iftype ieee80211_vif_type_p2p(struct ieee80211_vif *vif) { @@ -1970,26 +1709,6 @@ ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw, const uint8_t *addr, 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) -{ - - KASSERT(keyconf != NULL && addr != NULL && p1k != NULL, - ("%s: keyconf %p addr %p p1k %p\n", __func__, keyconf, addr, p1k)); - - TODO(); - memset(p1k, 0xfa, 5 * sizeof(*p1k)); /* Just initializing. */ -} - 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) @@ -2077,91 +1796,211 @@ ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif, 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 +static inline bool ieee80211_sn_less(uint16_t sn1, uint16_t sn2) { - TODO(); - return (false); + return (IEEE80211_SEQ_BA_BEFORE(sn1, sn2)); } -static __inline uint16_t +static inline uint16_t ieee80211_sn_inc(uint16_t sn) { - TODO(); - return (sn + 1); + return (IEEE80211_SEQ_INC(sn)); } -static __inline uint16_t +static inline uint16_t ieee80211_sn_add(uint16_t sn, uint16_t a) { - TODO(); - return (sn + a); + return (IEEE80211_SEQ_ADD(sn, a)); } -static __inline void -ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, uint32_t x, uint8_t *addr) +static inline uint16_t +ieee80211_sn_sub(uint16_t sa, uint16_t sb) { - TODO(); + return (IEEE80211_SEQ_SUB(sa, sb)); } static __inline void -ieee80211_rate_set_vht(struct ieee80211_tx_rate *r, uint32_t f1, uint32_t f2) +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 uint8_t -ieee80211_rate_get_vht_nss(struct ieee80211_tx_rate *r) +static __inline void +ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, uint32_t x, uint8_t *addr) { TODO(); - return (0); } -static __inline uint8_t -ieee80211_rate_get_vht_mcs(struct ieee80211_tx_rate *r) +static __inline void +ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif, uint8_t *addr, + uint8_t tid) { TODO(); - return (0); } static __inline void -ieee80211_reserve_tid(struct ieee80211_sta *sta, uint8_t tid) +ieee80211_start_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr, + uint8_t tid) { TODO(); } static __inline void -ieee80211_unreserve_tid(struct ieee80211_sta *sta, uint8_t tid) +ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr, + uint8_t tid) { TODO(); } +/* -------------------------------------------------------------------------- */ + +static inline void +ieee80211_rate_set_vht(struct ieee80211_tx_rate *r, uint8_t mcs, uint8_t nss) +{ + + /* XXX-BZ make it KASSERTS? */ + if (((mcs & 0xF0) != 0) || (((nss - 1) & 0xf8) != 0)) { + printf("%s:%d: mcs %#04x nss %#04x invalid\n", + __func__, __LINE__, mcs, nss); + return; + } + + r->idx = mcs; + r->idx |= ((nss - 1) << 4); +} + +static inline uint8_t +ieee80211_rate_get_vht_nss(const struct ieee80211_tx_rate *r) +{ + return (((r->idx >> 4) & 0x07) + 1); +} + +static inline uint8_t +ieee80211_rate_get_vht_mcs(const struct ieee80211_tx_rate *r) +{ + return (r->idx & 0x0f); +} + +static inline int +ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *vht_cap, + enum ieee80211_vht_chanwidth chanwidth, /* defined in net80211. */ + int mcs /* always 0 */, bool ext_nss_bw_cap /* always true */, int max_nss) +{ + enum ieee80211_vht_mcs_support mcs_s; + uint32_t supp_cw, ext_nss_bw; + + switch (mcs) { + case 0 ... 7: + mcs_s = IEEE80211_VHT_MCS_SUPPORT_0_7; + break; + case 8: + mcs_s = IEEE80211_VHT_MCS_SUPPORT_0_8; + break; + case 9: + mcs_s = IEEE80211_VHT_MCS_SUPPORT_0_9; + break; + default: + printf("%s: unsupported mcs value %d\n", __func__, mcs); + return (0); + } + + if (max_nss == 0) { + uint16_t map; + + map = le16toh(vht_cap->supp_mcs.rx_mcs_map); + for (int i = 7; i >= 0; i--) { + uint8_t val; + + val = (map >> (2 * i)) & 0x03; + if (val == IEEE80211_VHT_MCS_NOT_SUPPORTED) + continue; + if (val >= mcs_s) { + max_nss = i + 1; + break; + } + } + } + + if (max_nss == 0) + return (0); + + if ((le16toh(vht_cap->supp_mcs.tx_mcs_map) & + IEEE80211_VHT_EXT_NSS_BW_CAPABLE) == 0) + return (max_nss); + + supp_cw = le32_get_bits(vht_cap->vht_cap_info, + IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK); + ext_nss_bw = le32_get_bits(vht_cap->vht_cap_info, + IEEE80211_VHT_CAP_EXT_NSS_BW_MASK); + + /* If requested as ext nss not supported assume ext_nss_bw 0. */ + if (!ext_nss_bw_cap) + ext_nss_bw = 0; + + /* + * Cover 802.11-2016, Table 9-250. + */ + + /* Unsupported settings. */ + if (supp_cw == 3) + return (0); + if (supp_cw == 2 && (ext_nss_bw == 1 || ext_nss_bw == 2)) + return (0); + + /* Settings with factor != 1 or unsupported. */ + switch (chanwidth) { + case IEEE80211_VHT_CHANWIDTH_80P80MHZ: + if (supp_cw == 0 && (ext_nss_bw == 0 || ext_nss_bw == 1)) + return (0); + if (supp_cw == 1 && ext_nss_bw == 0) + return (0); + if ((supp_cw == 0 || supp_cw == 1) && ext_nss_bw == 2) + return (max_nss / 2); + if ((supp_cw == 0 || supp_cw == 1) && ext_nss_bw == 3) + return (3 * max_nss / 4); + break; + case IEEE80211_VHT_CHANWIDTH_160MHZ: + if (supp_cw == 0 && ext_nss_bw == 0) + return (0); + if (supp_cw == 0 && (ext_nss_bw == 1 || ext_nss_bw == 2)) + return (max_nss / 2); + if (supp_cw == 0 && ext_nss_bw == 3) + return (3 * max_nss / 4); + if (supp_cw == 1 && ext_nss_bw == 3) + return (2 * max_nss); + break; + case IEEE80211_VHT_CHANWIDTH_80MHZ: + case IEEE80211_VHT_CHANWIDTH_USE_HT: + if ((supp_cw == 1 || supp_cw == 2) && ext_nss_bw == 3) + return (2 * max_nss); + break; + } + + /* Everything else has a factor of 1. */ + return (max_nss); +} + + static __inline void -ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif, uint8_t *addr, - uint8_t tid) +ieee80211_reserve_tid(struct ieee80211_sta *sta, uint8_t tid) { TODO(); } static __inline void -ieee80211_send_eosp_nullfunc(struct ieee80211_sta *sta, uint8_t tid) +ieee80211_unreserve_tid(struct ieee80211_sta *sta, uint8_t tid) { TODO(); } -static __inline uint16_t -ieee80211_sn_sub(uint16_t sa, uint16_t sb) +static __inline void +ieee80211_send_eosp_nullfunc(struct ieee80211_sta *sta, uint8_t tid) { - - return ((sa - sb) & - (IEEE80211_SEQ_SEQ_MASK >> IEEE80211_SEQ_SEQ_SHIFT)); + TODO(); } static __inline void @@ -2183,10 +2022,12 @@ ieee80211_sta_pspoll(struct ieee80211_sta *sta) TODO(); } -static __inline void +static inline void ieee80211_sta_recalc_aggregates(struct ieee80211_sta *sta) { - TODO(); + if (sta->valid_links) { + TODO(); + } } static __inline void @@ -2195,13 +2036,6 @@ ieee80211_sta_uapsd_trigger(struct ieee80211_sta *sta, int ntids) 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) { @@ -2235,33 +2069,6 @@ ieee80211_sta_set_buffered(struct ieee80211_sta *sta, uint8_t tid, bool t) } static __inline void -ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, uint8_t tid, - struct ieee80211_key_seq *seq) -{ - - KASSERT(keyconf != NULL && seq != NULL, ("%s: keyconf %p seq %p\n", - __func__, keyconf, seq)); - - TODO(); - switch (keyconf->cipher) { - case WLAN_CIPHER_SUITE_CCMP: - case WLAN_CIPHER_SUITE_CCMP_256: - memset(seq->ccmp.pn, 0xfa, sizeof(seq->ccmp.pn)); /* XXX TODO */ - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - memset(seq->aes_cmac.pn, 0xfa, sizeof(seq->aes_cmac.pn)); /* XXX TODO */ - break; - case WLAN_CIPHER_SUITE_TKIP: - seq->tkip.iv32 = 0xfa; /* XXX TODO */ - seq->tkip.iv16 = 0xfa; /* XXX TODO */ - break; - default: - pr_debug("%s: unsupported cipher suite %d\n", __func__, keyconf->cipher); - break; - } -} - -static __inline void ieee80211_sched_scan_results(struct ieee80211_hw *hw) { TODO(); @@ -2377,25 +2184,39 @@ ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *w) linuxkpi_ieee80211_queue_work(hw, w); } -static __inline void -ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) +static __inline bool +ieee80211_tx_prepare_skb(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct sk_buff *skb, enum nl80211_band band, struct ieee80211_sta **sta) { + TODO(); + return (false); +} +static __inline void +ieee80211_tx_status_skb(struct ieee80211_hw *hw, struct sk_buff *skb) +{ linuxkpi_ieee80211_tx_status(hw, skb); } +static inline void +ieee80211_tx_status_noskb(struct ieee80211_hw *hw, struct ieee80211_sta *sta, + struct ieee80211_tx_info *info) +{ + TODO(); +} + static __inline void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) { IMPROVE(); - ieee80211_tx_status(hw, skb); + linuxkpi_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); + linuxkpi_ieee80211_tx_status(hw, skb); } static __inline void @@ -2437,15 +2258,6 @@ ieee80211_txq_get_depth(struct ieee80211_txq *txq, unsigned long *frame_cnt, 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) { @@ -2460,20 +2272,6 @@ ieee80211_report_low_ack(struct ieee80211_sta *sta, int x) } 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 void ieee80211_tx_rate_update(struct ieee80211_hw *hw, struct ieee80211_sta *sta, struct ieee80211_tx_info *info) { @@ -2488,7 +2286,8 @@ ieee80211_txq_may_transmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq) } static __inline void -ieee80211_radar_detected(struct ieee80211_hw *hw) +ieee80211_radar_detected(struct ieee80211_hw *hw, + struct ieee80211_chanctx_conf *chanctx_conf) { TODO(); } @@ -2507,22 +2306,14 @@ ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter) } 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) +ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif, uint32_t link_id) { TODO(); return (-1); } static __inline bool -ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif) +ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif, uint32_t link_id) { TODO(); return (true); @@ -2535,27 +2326,7 @@ ieee80211_disconnect(struct ieee80211_vif *vif, bool _x) } 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) +ieee80211_channel_switch_disconnect(struct ieee80211_vif *vif) { TODO(); } @@ -2576,7 +2347,7 @@ ieee80211_get_tx_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta, } static __inline void -ieee80211_color_change_finish(struct ieee80211_vif *vif) +ieee80211_color_change_finish(struct ieee80211_vif *vif, uint8_t link_id) { TODO(); } @@ -2618,16 +2389,29 @@ ieee80211_data_to_8023(struct sk_buff *skb, const uint8_t *addr, return (-1); } +/* -------------------------------------------------------------------------- */ + static __inline void -ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *key, - uint32_t iv32, uint16_t *p1k) +ieee80211_key_mic_failure(struct ieee80211_key_conf *key) +{ + TODO(); +} + +static __inline void +ieee80211_key_replay(struct ieee80211_key_conf *key) +{ + TODO(); +} + +static __inline void +ieee80211_remove_key(struct ieee80211_key_conf *key) { TODO(); } static __inline struct ieee80211_key_conf * ieee80211_gtk_rekey_add(struct ieee80211_vif *vif, - struct ieee80211_key_conf *key) + struct ieee80211_key_conf *key, int link_id) { TODO(); return (NULL); @@ -2641,18 +2425,103 @@ ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const uint8_t *bssid, } static __inline void -ieee80211_remove_key(struct ieee80211_key_conf *key) +ieee80211_tkip_add_iv(u8 *crypto_hdr, struct ieee80211_key_conf *keyconf, + uint64_t pn) +{ + TODO(); +} + +static __inline void +ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf, + const u8 *addr, uint32_t iv32, u16 *p1k) +{ + + KASSERT(keyconf != NULL && addr != NULL && p1k != NULL, + ("%s: keyconf %p addr %p p1k %p\n", __func__, keyconf, addr, p1k)); + + TODO(); + memset(p1k, 0xfa, 5 * sizeof(*p1k)); /* Just initializing. */ +} + +static __inline void +ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *key, + uint32_t iv32, uint16_t *p1k) { TODO(); } 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_key_rx_seq(struct ieee80211_key_conf *keyconf, int8_t tid, + struct ieee80211_key_seq *seq) +{ + const struct ieee80211_key *k; + const uint8_t *p; + + KASSERT(keyconf != NULL && seq != NULL, ("%s: keyconf %p seq %p\n", + __func__, keyconf, seq)); + k = keyconf->_k; + KASSERT(k != NULL, ("%s: keyconf %p ieee80211_key is NULL\n", __func__, keyconf)); + + switch (keyconf->cipher) { + case WLAN_CIPHER_SUITE_TKIP: + if (tid < 0 || tid >= IEEE80211_NUM_TIDS) + return; + /* See net80211::tkip_decrypt() */ + seq->tkip.iv32 = TKIP_PN_TO_IV32(k->wk_keyrsc[tid]); + seq->tkip.iv16 = TKIP_PN_TO_IV16(k->wk_keyrsc[tid]); + break; + case WLAN_CIPHER_SUITE_CCMP: + case WLAN_CIPHER_SUITE_CCMP_256: + if (tid < -1 || tid >= IEEE80211_NUM_TIDS) + return; + if (tid == -1) + p = (const uint8_t *)&k->wk_keyrsc[IEEE80211_NUM_TIDS]; /* IEEE80211_NONQOS_TID */ + else + p = (const uint8_t *)&k->wk_keyrsc[tid]; + memcpy(seq->ccmp.pn, p, sizeof(seq->ccmp.pn)); + break; + case WLAN_CIPHER_SUITE_GCMP: + case WLAN_CIPHER_SUITE_GCMP_256: + if (tid < -1 || tid >= IEEE80211_NUM_TIDS) + return; + if (tid == -1) + p = (const uint8_t *)&k->wk_keyrsc[IEEE80211_NUM_TIDS]; /* IEEE80211_NONQOS_TID */ + else + p = (const uint8_t *)&k->wk_keyrsc[tid]; + memcpy(seq->gcmp.pn, p, sizeof(seq->gcmp.pn)); + break; + case WLAN_CIPHER_SUITE_AES_CMAC: + case WLAN_CIPHER_SUITE_BIP_CMAC_256: + TODO(); + memset(seq->aes_cmac.pn, 0xfa, sizeof(seq->aes_cmac.pn)); /* XXX TODO */ + break; + case WLAN_CIPHER_SUITE_BIP_GMAC_128: + case WLAN_CIPHER_SUITE_BIP_GMAC_256: + TODO(); + memset(seq->aes_gmac.pn, 0xfa, sizeof(seq->aes_gmac.pn)); /* XXX TODO */ + break; + default: + pr_debug("%s: unsupported cipher suite %d\n", __func__, keyconf->cipher); + break; + } +} + +static __inline void ieee80211_set_key_rx_seq(struct ieee80211_key_conf *key, int tid, struct ieee80211_key_seq *seq) { TODO(); } +/* -------------------------------------------------------------------------- */ + static __inline void ieee80211_report_wowlan_wakeup(struct ieee80211_vif *vif, struct cfg80211_wowlan_wakeup *wakeup, gfp_t gfp) @@ -2696,23 +2565,122 @@ ieee80211_vif_is_mld(const struct ieee80211_vif *vif) return (vif->valid_links != 0); } -static __inline const struct ieee80211_sta_he_cap * +static inline const struct ieee80211_sta_he_cap * ieee80211_get_he_iftype_cap_vif(const struct ieee80211_supported_band *band, struct ieee80211_vif *vif) { - TODO(); - return (NULL); + enum nl80211_iftype iftype; + + iftype = ieee80211_vif_type_p2p(vif); + return (ieee80211_get_he_iftype_cap(band, iftype)); } -static __inline const struct ieee80211_sta_eht_cap * +static inline const struct ieee80211_sta_eht_cap * ieee80211_get_eht_iftype_cap_vif(const struct ieee80211_supported_band *band, struct ieee80211_vif *vif) { + enum nl80211_iftype iftype; + + iftype = ieee80211_vif_type_p2p(vif); + return (ieee80211_get_eht_iftype_cap(band, iftype)); +} + +static inline uint32_t +ieee80211_vif_usable_links(const struct ieee80211_vif *vif) +{ + IMPROVE("MLO usable links likely are not just valid"); + return (vif->valid_links); +} + +static inline bool +ieee80211_vif_link_active(const struct ieee80211_vif *vif, uint8_t link_id) +{ + if (ieee80211_vif_is_mld(vif)) + return (vif->active_links & BIT(link_id)); + return (link_id == 0); +} + +static inline void +ieee80211_set_active_links_async(struct ieee80211_vif *vif, + uint32_t new_active_links) +{ TODO(); - return (NULL); +} + +static inline int +ieee80211_set_active_links(struct ieee80211_vif *vif, + uint32_t active_links) +{ + TODO(); + return (-ENXIO); +} + +static inline void +ieee80211_cqm_beacon_loss_notify(struct ieee80211_vif *vif, gfp_t gfp __unused) +{ + IMPROVE("we notify user space by a vap state change eventually"); + linuxkpi_ieee80211_beacon_loss(vif); } #define ieee80211_send_bar(_v, _r, _t, _s) \ linuxkpi_ieee80211_send_bar(_v, _r, _t, _s) +/* -------------------------------------------------------------------------- */ + +int lkpi_80211_update_chandef(struct ieee80211_hw *, + struct ieee80211_chanctx_conf *); + +static inline int +ieee80211_emulate_add_chanctx(struct ieee80211_hw *hw, + struct ieee80211_chanctx_conf *chanctx_conf) +{ + int error; + + hw->conf.radar_enabled = chanctx_conf->radar_enabled; + error = lkpi_80211_update_chandef(hw, chanctx_conf); + return (error); +} + +static inline void +ieee80211_emulate_remove_chanctx(struct ieee80211_hw *hw, + struct ieee80211_chanctx_conf *chanctx_conf __unused) +{ + hw->conf.radar_enabled = false; + lkpi_80211_update_chandef(hw, NULL); +} + +static inline void +ieee80211_emulate_change_chanctx(struct ieee80211_hw *hw, + struct ieee80211_chanctx_conf *chanctx_conf, uint32_t changed __unused) +{ + hw->conf.radar_enabled = chanctx_conf->radar_enabled; + lkpi_80211_update_chandef(hw, chanctx_conf); +} + +static inline int +ieee80211_emulate_switch_vif_chanctx(struct ieee80211_hw *hw, + struct ieee80211_vif_chanctx_switch *vifs, int n_vifs, + enum ieee80211_chanctx_switch_mode mode __unused) +{ + struct ieee80211_chanctx_conf *chanctx_conf; + int error; + + /* Sanity check. */ + if (n_vifs <= 0) + return (-EINVAL); + if (vifs == NULL || vifs[0].new_ctx == NULL) + return (-EINVAL); + + /* + * What to do if n_vifs > 1? + * Does that make sense for drivers not supporting chanctx? + */ + hw->conf.radar_enabled = vifs[0].new_ctx->radar_enabled; + chanctx_conf = vifs[0].new_ctx; + error = lkpi_80211_update_chandef(hw, chanctx_conf); + return (error); +} + +/* -------------------------------------------------------------------------- */ + #endif /* _LINUXKPI_NET_MAC80211_H */ diff --git a/sys/compat/linuxkpi/common/include/net/page_pool.h b/sys/compat/linuxkpi/common/include/net/page_pool.h index 82dbeff82167..2dc8f74b31f3 100644 --- a/sys/compat/linuxkpi/common/include/net/page_pool.h +++ b/sys/compat/linuxkpi/common/include/net/page_pool.h @@ -29,6 +29,7 @@ #include <linux/kernel.h> /* pr_debug */ #include <linux/types.h> #include <linux/dma-mapping.h> +#include <linux/netdevice.h> struct device; @@ -41,6 +42,7 @@ struct page_pool_params { uint32_t offset; int nid; /* NUMA */ enum dma_data_direction dma_dir; + struct napi_struct *napi; }; struct page_pool { |