cfg80211.h (8d371164898141673ad3bfe6ee771931569e07d2) cfg80211.h (800aa9cd3d8050c1d873a1db02d9a546dca8c42e)
1/*-
2 * Copyright (c) 2020-2021 The FreeBSD Foundation
3 * Copyright (c) 2021-2022 Bjoern A. Zeeb
4 *
5 * This software was developed by Björn Zeeb under sponsorship from
6 * the FreeBSD Foundation.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 37 unchanged lines hidden (view full) ---

46/* linux_80211.c */
47extern int linuxkpi_debug_80211;
48#ifndef D80211_TODO
49#define D80211_TODO 0x1
50#endif
51#ifndef D80211_IMPROVE
52#define D80211_IMPROVE 0x2
53#endif
1/*-
2 * Copyright (c) 2020-2021 The FreeBSD Foundation
3 * Copyright (c) 2021-2022 Bjoern A. Zeeb
4 *
5 * This software was developed by Björn Zeeb under sponsorship from
6 * the FreeBSD Foundation.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 37 unchanged lines hidden (view full) ---

46/* linux_80211.c */
47extern int linuxkpi_debug_80211;
48#ifndef D80211_TODO
49#define D80211_TODO 0x1
50#endif
51#ifndef D80211_IMPROVE
52#define D80211_IMPROVE 0x2
53#endif
54#define TODO() if (linuxkpi_debug_80211 & D80211_TODO) \
54#define TODO(...) if (linuxkpi_debug_80211 & D80211_TODO) \
55 printf("%s:%d: XXX LKPI80211 TODO\n", __func__, __LINE__)
56#define IMPROVE(...) if (linuxkpi_debug_80211 & D80211_IMPROVE) \
57 printf("%s:%d: XXX LKPI80211 IMPROVE\n", __func__, __LINE__)
58
59enum rfkill_hard_block_reasons {
60 RFKILL_HARD_BLOCK_NOT_OWNER = BIT(0),
61};
62

--- 8 unchanged lines hidden (view full) ---

71
72#define IEEE80211_MAX_CHAINS 4 /* net80211: IEEE80211_MAX_CHAINS copied */
73
74enum cfg80211_rate_info_flags {
75 RATE_INFO_FLAGS_SHORT_GI = BIT(0),
76 RATE_INFO_FLAGS_MCS = BIT(1),
77 RATE_INFO_FLAGS_VHT_MCS = BIT(2),
78 RATE_INFO_FLAGS_HE_MCS = BIT(3),
55 printf("%s:%d: XXX LKPI80211 TODO\n", __func__, __LINE__)
56#define IMPROVE(...) if (linuxkpi_debug_80211 & D80211_IMPROVE) \
57 printf("%s:%d: XXX LKPI80211 IMPROVE\n", __func__, __LINE__)
58
59enum rfkill_hard_block_reasons {
60 RFKILL_HARD_BLOCK_NOT_OWNER = BIT(0),
61};
62

--- 8 unchanged lines hidden (view full) ---

71
72#define IEEE80211_MAX_CHAINS 4 /* net80211: IEEE80211_MAX_CHAINS copied */
73
74enum cfg80211_rate_info_flags {
75 RATE_INFO_FLAGS_SHORT_GI = BIT(0),
76 RATE_INFO_FLAGS_MCS = BIT(1),
77 RATE_INFO_FLAGS_VHT_MCS = BIT(2),
78 RATE_INFO_FLAGS_HE_MCS = BIT(3),
79 /* Max 8 bits as used in struct rate_info. */
79};
80
81extern const uint8_t rfc1042_header[6];
82extern const uint8_t bridge_tunnel_header[6];
83
84enum ieee80211_privacy {
85 IEEE80211_PRIVACY_ANY,
86};

--- 39 unchanged lines hidden (view full) ---

126 int max_antenna_gain, max_reg_power;
127 int orig_flags;
128 int dfs_cac_ms, dfs_state;
129 int orig_mpwr;
130};
131
132struct cfg80211_bitrate_mask {
133 /* TODO FIXME */
80};
81
82extern const uint8_t rfc1042_header[6];
83extern const uint8_t bridge_tunnel_header[6];
84
85enum ieee80211_privacy {
86 IEEE80211_PRIVACY_ANY,
87};

--- 39 unchanged lines hidden (view full) ---

127 int max_antenna_gain, max_reg_power;
128 int orig_flags;
129 int dfs_cac_ms, dfs_state;
130 int orig_mpwr;
131};
132
133struct cfg80211_bitrate_mask {
134 /* TODO FIXME */
134 /* This is so weird but nothing else works out...*/
135 struct {
135 struct {
136 uint64_t legacy; /* XXX? */
136 uint32_t legacy;
137 uint8_t ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
137 uint8_t ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
138 uint16_t vht_mcs[16]; /* XXX? */
139 uint16_t he_mcs[16]; /* XXX? */
138 uint16_t vht_mcs[8];
139 uint16_t he_mcs[8];
140 enum nl80211_txrate_gi gi;
141 enum nl80211_he_gi he_gi;
140 enum nl80211_txrate_gi gi;
141 enum nl80211_he_gi he_gi;
142 uint8_t he_ltf;
142 uint8_t he_ltf; /* XXX enum? */
143 } control[NUM_NL80211_BANDS];
144};
145
146enum rate_info_bw {
147 RATE_INFO_BW_20 = 0,
148 RATE_INFO_BW_5,
149 RATE_INFO_BW_10,
150 RATE_INFO_BW_40,
151 RATE_INFO_BW_80,
152 RATE_INFO_BW_160,
153 RATE_INFO_BW_HE_RU,
154};
155
156struct rate_info {
143 } control[NUM_NL80211_BANDS];
144};
145
146enum rate_info_bw {
147 RATE_INFO_BW_20 = 0,
148 RATE_INFO_BW_5,
149 RATE_INFO_BW_10,
150 RATE_INFO_BW_40,
151 RATE_INFO_BW_80,
152 RATE_INFO_BW_160,
153 RATE_INFO_BW_HE_RU,
154};
155
156struct rate_info {
157 /* TODO FIXME */
158 int bw, flags, he_dcm, he_gi, he_ru_alloc, legacy, mcs, nss;
157 uint8_t flags; /* enum cfg80211_rate_info_flags */
158 uint8_t bw;
159 uint16_t legacy;
160 uint8_t mcs;
161 uint8_t nss;
162 uint8_t he_dcm;
163 uint8_t he_gi;
164 uint8_t he_ru_alloc;
159};
160
161struct ieee80211_rate {
162 /* TODO FIXME */
163 uint32_t bitrate;
164 uint32_t hw_value;
165 uint32_t hw_value_short;
166 uint32_t flags;

--- 51 unchanged lines hidden (view full) ---

218
219#define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT 23 /* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT */
220#define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \
221 (7 << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT) /* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK */
222
223
224struct ieee80211_sta_vht_cap {
225 /* TODO FIXME */
165};
166
167struct ieee80211_rate {
168 /* TODO FIXME */
169 uint32_t bitrate;
170 uint32_t hw_value;
171 uint32_t hw_value_short;
172 uint32_t flags;

--- 51 unchanged lines hidden (view full) ---

224
225#define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT 23 /* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT */
226#define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \
227 (7 << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT) /* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK */
228
229
230struct ieee80211_sta_vht_cap {
231 /* TODO FIXME */
226 bool vht_supported;
227 uint32_t cap;
228 struct vht_mcs vht_mcs;
232 bool vht_supported;
233 uint32_t cap;
234 struct ieee80211_vht_mcs_info vht_mcs;
229};
230
231enum ieee80211_vht_opmode {
232 IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT = 4,
233};
234
235struct cfg80211_connect_resp_params {
236 /* XXX TODO */

--- 272 unchanged lines hidden (view full) ---

509};
510
511struct cfg80211_pmksa {
512 /* XXX TODO */
513 const uint8_t *bssid;
514 const uint8_t *pmkid;
515};
516
235};
236
237enum ieee80211_vht_opmode {
238 IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT = 4,
239};
240
241struct cfg80211_connect_resp_params {
242 /* XXX TODO */

--- 272 unchanged lines hidden (view full) ---

515};
516
517struct cfg80211_pmksa {
518 /* XXX TODO */
519 const uint8_t *bssid;
520 const uint8_t *pmkid;
521};
522
517struct cfg80211_wowlan_nd_match {
518 /* XXX TODO */
519 struct cfg80211_ssid ssid;
520 int n_channels;
521 uint32_t channels[0]; /* freq! = ieee80211_channel_to_frequency() */
522};
523
524struct cfg80211_wowlan_nd_info {
525 /* XXX TODO */
526 int n_matches;
527 struct cfg80211_wowlan_nd_match *matches[0];
528};
529
530enum wiphy_wowlan_support_flags {
531 WIPHY_WOWLAN_DISCONNECT,
532 WIPHY_WOWLAN_GTK_REKEY_FAILURE,
533 WIPHY_WOWLAN_MAGIC_PKT,
534 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY,
535 WIPHY_WOWLAN_NET_DETECT,
536};
537
538struct wiphy_wowlan_support {
539 /* XXX TODO */
540 enum wiphy_wowlan_support_flags flags;
541 int max_nd_match_sets, max_pkt_offset, n_patterns, pattern_max_len, pattern_min_len;
542};
543
544struct station_del_parameters {
545 /* XXX TODO */
546 const uint8_t *mac;
547 uint32_t reason_code; /* elsewhere uint16_t? */
548};
549
550struct station_info {
551 /* TODO FIXME */

--- 290 unchanged lines hidden (view full) ---

842struct cfg80211_pkt_pattern {
843 /* XXX TODO */
844 uint8_t *mask;
845 uint8_t *pattern;
846 int pattern_len;
847 int pkt_offset;
848};
849
523struct station_del_parameters {
524 /* XXX TODO */
525 const uint8_t *mac;
526 uint32_t reason_code; /* elsewhere uint16_t? */
527};
528
529struct station_info {
530 /* TODO FIXME */

--- 290 unchanged lines hidden (view full) ---

821struct cfg80211_pkt_pattern {
822 /* XXX TODO */
823 uint8_t *mask;
824 uint8_t *pattern;
825 int pattern_len;
826 int pkt_offset;
827};
828
829struct cfg80211_wowlan_nd_match {
830 /* XXX TODO */
831 struct cfg80211_ssid ssid;
832 int n_channels;
833 uint32_t channels[0]; /* freq! = ieee80211_channel_to_frequency() */
834};
835
836struct cfg80211_wowlan_nd_info {
837 /* XXX TODO */
838 int n_matches;
839 struct cfg80211_wowlan_nd_match *matches[0];
840};
841
842enum wiphy_wowlan_support_flags {
843 WIPHY_WOWLAN_DISCONNECT,
844 WIPHY_WOWLAN_GTK_REKEY_FAILURE,
845 WIPHY_WOWLAN_MAGIC_PKT,
846 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY,
847 WIPHY_WOWLAN_NET_DETECT,
848};
849
850struct wiphy_wowlan_support {
851 /* XXX TODO */
852 enum wiphy_wowlan_support_flags flags;
853 int max_nd_match_sets, max_pkt_offset, n_patterns, pattern_max_len, pattern_min_len;
854};
855
856struct cfg80211_wowlan_wakeup {
857 /* XXX TODO */
858 uint16_t pattern_idx;
859 bool disconnect;
860 bool eap_identity_req;
861 bool four_way_handshake;
862 bool gtk_rekey_failure;
863 bool magic_pkt;
864 bool rfkill_release;
865 bool tcp_connlost;
866 bool tcp_nomoretokens;
867 bool tcp_match;
868 bool packet_80211;
869 struct cfg80211_wowlan_nd_info *net_detect;
870 uint8_t *packet;
871 uint16_t packet_len;
872 uint16_t packet_present_len;
873};
874
850struct cfg80211_wowlan {
851 /* XXX TODO */
852 int disconnect, gtk_rekey_failure, magic_pkt;
875struct cfg80211_wowlan {
876 /* XXX TODO */
877 int disconnect, gtk_rekey_failure, magic_pkt;
878 int eap_identity_req, four_way_handshake, rfkill_release, tcp, any;
853 int n_patterns;
854 struct cfg80211_sched_scan_request *nd_config;
855 struct cfg80211_pkt_pattern *patterns;
856};
857
858struct cfg80211_gtk_rekey_data {
859 /* XXX TODO */
879 int n_patterns;
880 struct cfg80211_sched_scan_request *nd_config;
881 struct cfg80211_pkt_pattern *patterns;
882};
883
884struct cfg80211_gtk_rekey_data {
885 /* XXX TODO */
860 int kck, kek, replay_ctr;
886 const uint8_t *kck, *kek, *replay_ctr;
887 uint32_t akm;
888 uint8_t kck_len, kek_len;
861};
862
863struct cfg80211_tid_cfg {
864 /* XXX TODO */
865 int mask, noack, retry_long, rtscts, tids;
866 enum nl80211_tx_rate_setting txrate_type;
867 struct cfg80211_bitrate_mask txrate_mask;
868};

--- 92 unchanged lines hidden (view full) ---

961struct wiphy {
962
963 struct device *dev;
964 struct mac_address *addresses;
965 int n_addresses;
966 uint32_t flags;
967 struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
968 uint8_t perm_addr[ETH_ALEN];
889};
890
891struct cfg80211_tid_cfg {
892 /* XXX TODO */
893 int mask, noack, retry_long, rtscts, tids;
894 enum nl80211_tx_rate_setting txrate_type;
895 struct cfg80211_bitrate_mask txrate_mask;
896};

--- 92 unchanged lines hidden (view full) ---

989struct wiphy {
990
991 struct device *dev;
992 struct mac_address *addresses;
993 int n_addresses;
994 uint32_t flags;
995 struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
996 uint8_t perm_addr[ETH_ALEN];
997 uint16_t max_scan_ie_len;
969
970 /* XXX TODO */
971 const struct cfg80211_pmsr_capabilities *pmsr_capa;
972 const struct cfg80211_sar_capa *sar_capa;
973 const struct wiphy_iftype_ext_capab *iftype_ext_capab;
974 const struct linuxkpi_ieee80211_regdomain *regd;
975 char fw_version[ETHTOOL_FWVERS_LEN];
976 const struct ieee80211_iface_combination *iface_combinations;

--- 6 unchanged lines hidden (view full) ---

983 const struct wiphy_vendor_command *vendor_commands;
984 const struct ieee80211_txrx_stypes *mgmt_stypes;
985 uint32_t rts_threshold;
986 uint32_t frag_threshold;
987 struct tid_config_support tid_config_support;
988
989 int available_antennas_rx, available_antennas_tx;
990 int features, hw_version;
998
999 /* XXX TODO */
1000 const struct cfg80211_pmsr_capabilities *pmsr_capa;
1001 const struct cfg80211_sar_capa *sar_capa;
1002 const struct wiphy_iftype_ext_capab *iftype_ext_capab;
1003 const struct linuxkpi_ieee80211_regdomain *regd;
1004 char fw_version[ETHTOOL_FWVERS_LEN];
1005 const struct ieee80211_iface_combination *iface_combinations;

--- 6 unchanged lines hidden (view full) ---

1012 const struct wiphy_vendor_command *vendor_commands;
1013 const struct ieee80211_txrx_stypes *mgmt_stypes;
1014 uint32_t rts_threshold;
1015 uint32_t frag_threshold;
1016 struct tid_config_support tid_config_support;
1017
1018 int available_antennas_rx, available_antennas_tx;
1019 int features, hw_version;
991 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;
1020 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;
992 int num_iftype_ext_capab;
993 int max_ap_assoc_sta, probe_resp_offload, software_iftypes;
994 int bss_select_support, max_num_pmkids, retry_long, retry_short, signal_type;
995 int max_data_retry_count;
996 int tx_queue_len, rfkill;
997 int mbssid_max_interfaces;
998
999 unsigned long ext_features[BITS_TO_LONGS(NUM_NL80211_EXT_FEATURES)];

--- 213 unchanged lines hidden (view full) ---

1213 chandef->center_freq2 = 0; /* Set here and only overwrite if needed. */
1214
1215 switch (chan_flag) {
1216 case NL80211_CHAN_NO_HT:
1217 chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
1218 chandef->center_freq1 = chan->center_freq;
1219 break;
1220 default:
1021 int num_iftype_ext_capab;
1022 int max_ap_assoc_sta, probe_resp_offload, software_iftypes;
1023 int bss_select_support, max_num_pmkids, retry_long, retry_short, signal_type;
1024 int max_data_retry_count;
1025 int tx_queue_len, rfkill;
1026 int mbssid_max_interfaces;
1027
1028 unsigned long ext_features[BITS_TO_LONGS(NUM_NL80211_EXT_FEATURES)];

--- 213 unchanged lines hidden (view full) ---

1242 chandef->center_freq2 = 0; /* Set here and only overwrite if needed. */
1243
1244 switch (chan_flag) {
1245 case NL80211_CHAN_NO_HT:
1246 chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
1247 chandef->center_freq1 = chan->center_freq;
1248 break;
1249 default:
1250 IMPROVE("Also depends on our manual settings");
1221 if (chan->flags & IEEE80211_CHAN_NO_HT40)
1222 chandef->width = NL80211_CHAN_WIDTH_20;
1223 else if (chan->flags & IEEE80211_CHAN_NO_80MHZ)
1224 chandef->width = NL80211_CHAN_WIDTH_40;
1225 else if (chan->flags & IEEE80211_CHAN_NO_160MHZ)
1226 chandef->width = NL80211_CHAN_WIDTH_80;
1227 else {
1228 chandef->width = NL80211_CHAN_WIDTH_160;

--- 106 unchanged lines hidden (view full) ---

1335freq_reg_info(struct wiphy *wiphy, uint32_t center_freq)
1336{
1337 TODO();
1338 return (NULL);
1339}
1340
1341static __inline struct cfg80211_bss *
1342cfg80211_get_bss(struct wiphy *wiphy, struct linuxkpi_ieee80211_channel *chan,
1251 if (chan->flags & IEEE80211_CHAN_NO_HT40)
1252 chandef->width = NL80211_CHAN_WIDTH_20;
1253 else if (chan->flags & IEEE80211_CHAN_NO_80MHZ)
1254 chandef->width = NL80211_CHAN_WIDTH_40;
1255 else if (chan->flags & IEEE80211_CHAN_NO_160MHZ)
1256 chandef->width = NL80211_CHAN_WIDTH_80;
1257 else {
1258 chandef->width = NL80211_CHAN_WIDTH_160;

--- 106 unchanged lines hidden (view full) ---

1365freq_reg_info(struct wiphy *wiphy, uint32_t center_freq)
1366{
1367 TODO();
1368 return (NULL);
1369}
1370
1371static __inline struct cfg80211_bss *
1372cfg80211_get_bss(struct wiphy *wiphy, struct linuxkpi_ieee80211_channel *chan,
1343 uint8_t *bssid, void *p, int x, uint32_t f1, uint32_t f2)
1373 const uint8_t *bssid, void *p, int x, uint32_t f1, uint32_t f2)
1344{
1345 TODO();
1346 return (NULL);
1347}
1348
1349static __inline void
1350cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss)
1351{

--- 339 unchanged lines hidden (view full) ---

1691#define wiphy_info(wiphy, fmt, ...) \
1692 printf("%s:%d XXX TODO " fmt, __func__, __LINE__, __VA_ARGS__)
1693
1694#ifndef LINUXKPI_NET80211
1695#define ieee80211_channel linuxkpi_ieee80211_channel
1696#define ieee80211_regdomain linuxkpi_ieee80211_regdomain
1697#endif
1698
1374{
1375 TODO();
1376 return (NULL);
1377}
1378
1379static __inline void
1380cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss)
1381{

--- 339 unchanged lines hidden (view full) ---

1721#define wiphy_info(wiphy, fmt, ...) \
1722 printf("%s:%d XXX TODO " fmt, __func__, __LINE__, __VA_ARGS__)
1723
1724#ifndef LINUXKPI_NET80211
1725#define ieee80211_channel linuxkpi_ieee80211_channel
1726#define ieee80211_regdomain linuxkpi_ieee80211_regdomain
1727#endif
1728
1729#include <net/mac80211.h>
1730
1699#endif /* _LINUXKPI_NET_CFG80211_H */
1731#endif /* _LINUXKPI_NET_CFG80211_H */