From nobody Mon Oct 17 20:41:25 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Mrpn16bMZz4fQkh; Mon, 17 Oct 2022 20:41:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Mrpn16Gpjz45JG; Mon, 17 Oct 2022 20:41:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666039285; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PmQ90814KCO4ihez7VbJVlwaqoP3Vw4SXf6PVuMgZO0=; b=OdEbE0jjUIi1zgiqGQaEBR//Pn2as+DbXZXD9TOJqEaCNUTB7Mg0lGeGEhbcq5f5JA5d7H XaQZlBhblelGGrqGdsJeIkKGRwGxT29KOxOlBgMn9QWTEtgD26S2gKPeGeJP4wa2UektqX 5YqPFd49oSJCr+leejp9o1lCm2Cd0m2xfl+R4XAsmbjN7RWwOiF57fh/8/l6lSGMYZwFde F2N7STgTLmOXiuhnL3HTTGmTmxZMxLMc3/Srl5s7qT+2IVgxtsrpq679ECbeOAY+h55Tkm pIciI6kHaehV9Ob3u+ys9enYhQasY6es/dfTvXSxaFy0EdeqpniKvDvtYZxMwg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Mrpn15MTlzxQD; Mon, 17 Oct 2022 20:41:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 29HKfPQQ096233; Mon, 17 Oct 2022 20:41:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29HKfP5V096232; Mon, 17 Oct 2022 20:41:25 GMT (envelope-from git) Date: Mon, 17 Oct 2022 20:41:25 GMT Message-Id: <202210172041.29HKfP5V096232@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 1055af5c98c4 - stable/13 - LinuxKPI: 80211 (+net80211): update and cleanup headers List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1055af5c98c47b25fee9c4e01f455413dc7694f2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666039285; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PmQ90814KCO4ihez7VbJVlwaqoP3Vw4SXf6PVuMgZO0=; b=oAJkv+AINCO6p52vnE1nNGyO4GF3SJmIXEVCyE4Fstvn++ctZzosm4pmcB7zWIrMzDHer+ a93uzu8kabn1FBkZpvaBUuaHnUtd/mtWdpceyuOn2iLSa5m/E17SaXJoaWIWpottXtheLM Q/Jm5ft0LenrVR0SDnKRF99QDF+4VLKQaVHBfgMLFjylut5EBWbohGl1kUg8VR629IZTyX FE+oX9N5QFlTOUJrW+bz22oYDcwWjnhSjd8Y6Zl1PBWGE42FCkxJPBqJONiqCUqdz6FADK L6qJFX7gIG7dsrnIVDpeZ03FWDKZS234gxj0VSjnAyp8rCQXxXkC4L6F70y4Og== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666039285; a=rsa-sha256; cv=none; b=dNCibhxrI8x9dbbP4Qgujhw/R+Qfz+cBTJWOm9Nfccd02r9LuVOvfGGJY27F1Om0kan/W7 dvHwTEHRNCgFvIi6NtuxAMwPwrNLib87jnNsYBYJWd9VMkcWNAesVp6NxF7zQ7guNjcX2D P53Fpt3D6NEZ7tnV80UJ5el+wdoraex8wi3UKin9qn/qi4wqVXip2qt6hGGJoSiRSi+2T7 XPMOW6VcFFeYqPvZQqdCpoZO85WTtw5V9xdJ5DDNi2EajqxAnGncwsgIrs0/3GmDLlIR0h 44X5PlTL+4sy38cJoznjhb5+pAQ1D/n+GS8sFiE8EYKFzsVtnjcdIKxDtslvdA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=1055af5c98c47b25fee9c4e01f455413dc7694f2 commit 1055af5c98c47b25fee9c4e01f455413dc7694f2 Author: Bjoern A. Zeeb AuthorDate: 2022-09-09 18:40:23 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-10-17 20:37:02 +0000 LinuxKPI: 80211 (+net80211): update and cleanup headers Fix types for various struct fields (initially added as int). Move structs and inline functions logically together, e.g., for wowlan. Add more skeleton functions and #defines needed for iwlwifi d3.c in the future. Add struct ieee80211_vht_cap (without "_ie") to net80211 and remove duplicate definitions in LinuxKPI headers now using net80211 structs. For now leave ieee80211_ie_vhtcap in net80211. I am not sure yet if we actually need it as such. That'll be cleaned up with more VHT updates in net80211 in the future. No functional changes in currently compiled code intended. Try to implement ieee80211_action_contains_tpc() as I ran into it with an older iwlwifi chipset. This depends on c994352a8841eb453. Sponsored by: The FreeBSD Foundation (cherry picked from commit 800aa9cd3d8050c1d873a1db02d9a546dca8c42e) --- .../linuxkpi/common/include/linux/ieee80211.h | 35 ++-- sys/compat/linuxkpi/common/include/linux/nl80211.h | 2 + sys/compat/linuxkpi/common/include/net/cfg80211.h | 114 +++++++----- sys/compat/linuxkpi/common/include/net/mac80211.h | 191 +++++++++++++++++---- sys/net80211/ieee80211.h | 6 + 5 files changed, 251 insertions(+), 97 deletions(-) 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 @@ -132,7 +132,9 @@ enum wlan_ht_cap_sm_ps { #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 */ @@ -243,6 +245,8 @@ enum ieee80211_ac_numbers { /* 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 */ @@ -251,8 +255,6 @@ enum ieee80211_ac_numbers { #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 @@ -269,13 +271,6 @@ struct ieee80211_mcs_info { 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; @@ -286,11 +281,6 @@ struct ieee80211_ht_cap { 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 { @@ -447,7 +437,7 @@ 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; @@ -480,6 +470,16 @@ struct ieee80211_mgmt { 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; @@ -669,9 +669,8 @@ 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); } 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 @@ -367,6 +367,8 @@ enum nl80211_probe_resp_offload_support { }; #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 @@ -51,7 +51,7 @@ extern int linuxkpi_debug_80211; #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__) @@ -76,6 +76,7 @@ enum cfg80211_rate_info_flags { 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]; @@ -131,15 +132,14 @@ struct linuxkpi_ieee80211_channel { 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]; }; @@ -154,8 +154,14 @@ enum rate_info_bw { }; 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 { @@ -223,9 +229,9 @@ struct ieee80211_sta_ht_cap { 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 { @@ -514,33 +520,6 @@ struct cfg80211_pmksa { 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; @@ -847,9 +826,56 @@ struct cfg80211_pkt_pattern { 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; @@ -857,7 +883,9 @@ struct cfg80211_wowlan { 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 { @@ -966,6 +994,7 @@ struct wiphy { 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; @@ -988,7 +1017,7 @@ struct wiphy { 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; @@ -1218,6 +1247,7 @@ cfg80211_chandef_create(struct cfg80211_chan_def *chandef, 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) @@ -1340,7 +1370,7 @@ freq_reg_info(struct wiphy *wiphy, uint32_t center_freq) 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); @@ -1696,4 +1726,6 @@ cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef) #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 @@ -162,6 +162,8 @@ enum ieee80211_bss_changed { /* 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; @@ -773,6 +775,7 @@ enum ieee80211_iface_iter { /* 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 { @@ -1491,6 +1494,17 @@ ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, 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, @@ -1621,11 +1635,47 @@ ieee80211_tu_to_usec(unsigned long 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 @@ -1867,13 +1917,6 @@ 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) @@ -1926,11 +1969,32 @@ 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 @@ -1948,7 +2012,8 @@ ieee80211_scan_completed(struct ieee80211_hw *hw, } 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); @@ -2034,20 +2099,6 @@ ieee80211_tx_status_ni(struct ieee80211_hw *hw, struct sk_buff *skb) 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) { @@ -2143,13 +2194,6 @@ ieee80211_txq_may_transmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq) 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) { @@ -2165,30 +2209,39 @@ ieee80211_sta_register_airtime(struct ieee80211_sta *sta, 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) { @@ -2314,6 +2367,68 @@ linuxkpi_ieee80211_send_bar(struct ieee80211_vif *vif, uint8_t *ra, uint16_t tid 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) diff --git a/sys/net80211/ieee80211.h b/sys/net80211/ieee80211.h index 95889c266e09..80106e73cce2 100644 --- a/sys/net80211/ieee80211.h +++ b/sys/net80211/ieee80211.h @@ -862,6 +862,12 @@ struct ieee80211_vht_mcs_info { uint16_t tx_highest; } __packed; +/* 802.11ac-2013, 8.4.2.160.1 VHT Capabilities element structure */ +struct ieee80211_vht_cap { + uint32_t vht_cap_info; + struct ieee80211_vht_mcs_info supp_mcs; +} __packed; + /* VHT capabilities element: 802.11ac-2013 8.4.2.160 */ struct ieee80211_ie_vhtcap { uint8_t ie;