The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/compat/linuxkpi/common/include/net/cfg80211.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    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
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  *
   17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   27  * SUCH DAMAGE.
   28  *
   29  * $FreeBSD$
   30  */
   31 
   32 #ifndef _LINUXKPI_NET_CFG80211_H
   33 #define _LINUXKPI_NET_CFG80211_H
   34 
   35 #include <linux/types.h>
   36 #include <linux/nl80211.h>
   37 #include <linux/ieee80211.h>
   38 #include <linux/if_ether.h>
   39 #include <linux/ethtool.h>
   40 #include <linux/device.h>
   41 #include <linux/netdevice.h>
   42 #include <linux/random.h>
   43 #include <linux/skbuff.h>
   44 #include <net/regulatory.h>
   45 
   46 /* linux_80211.c */
   47 extern 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) \
   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 
   59 enum rfkill_hard_block_reasons {
   60         RFKILL_HARD_BLOCK_NOT_OWNER             = BIT(0),
   61 };
   62 
   63 #define WIPHY_PARAM_FRAG_THRESHOLD                      __LINE__ /* TODO FIXME brcmfmac */
   64 #define WIPHY_PARAM_RETRY_LONG                          __LINE__ /* TODO FIXME brcmfmac */
   65 #define WIPHY_PARAM_RETRY_SHORT                         __LINE__ /* TODO FIXME brcmfmac */
   66 #define WIPHY_PARAM_RTS_THRESHOLD                       __LINE__ /* TODO FIXME brcmfmac */
   67 
   68 #define CFG80211_SIGNAL_TYPE_MBM                        __LINE__ /* TODO FIXME brcmfmac */
   69 
   70 #define UPDATE_ASSOC_IES        1
   71 
   72 #define IEEE80211_MAX_CHAINS    4               /* net80211: IEEE80211_MAX_CHAINS copied */
   73 
   74 enum 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. */
   80 };
   81 
   82 extern const uint8_t rfc1042_header[6];
   83 extern const uint8_t bridge_tunnel_header[6];
   84 
   85 enum ieee80211_privacy {
   86         IEEE80211_PRIVACY_ANY,
   87 };
   88 
   89 enum ieee80211_bss_type {
   90         IEEE80211_BSS_TYPE_ANY,
   91 };
   92 
   93 enum cfg80211_bss_frame_type {
   94         CFG80211_BSS_FTYPE_UNKNOWN,
   95         CFG80211_BSS_FTYPE_BEACON,
   96         CFG80211_BSS_FTYPE_PRESP,
   97 };
   98 
   99 enum ieee80211_channel_flags {
  100         IEEE80211_CHAN_DISABLED                 = BIT(0),
  101         IEEE80211_CHAN_INDOOR_ONLY              = BIT(1),
  102         IEEE80211_CHAN_IR_CONCURRENT            = BIT(2),
  103         IEEE80211_CHAN_RADAR                    = BIT(3),
  104         IEEE80211_CHAN_NO_IR                    = BIT(4),
  105         IEEE80211_CHAN_NO_HT40MINUS             = BIT(5),
  106         IEEE80211_CHAN_NO_HT40PLUS              = BIT(6),
  107         IEEE80211_CHAN_NO_80MHZ                 = BIT(7),
  108         IEEE80211_CHAN_NO_160MHZ                = BIT(8),
  109         IEEE80211_CHAN_NO_OFDM                  = BIT(9),
  110 };
  111 #define IEEE80211_CHAN_NO_HT40  (IEEE80211_CHAN_NO_HT40MINUS|IEEE80211_CHAN_NO_HT40PLUS)
  112 
  113 struct ieee80211_txrx_stypes {
  114         uint16_t        tx;
  115         uint16_t        rx;
  116 };
  117 
  118 /* XXX net80211 has an ieee80211_channel as well. */
  119 struct linuxkpi_ieee80211_channel {
  120         /* TODO FIXME */
  121         uint32_t                                hw_value;       /* ic_ieee */
  122         uint32_t                                center_freq;    /* ic_freq */
  123         enum ieee80211_channel_flags            flags;          /* ic_flags */
  124         enum nl80211_band                       band;
  125         int8_t                                  max_power;      /* ic_maxpower */
  126         bool                                    beacon_found;
  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 
  133 struct cfg80211_bitrate_mask {
  134         /* TODO FIXME */
  135         struct {
  136                 uint32_t                        legacy;
  137                 uint8_t                         ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
  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;
  142                 uint8_t                         he_ltf;         /* XXX enum? */
  143         } control[NUM_NL80211_BANDS];
  144 };
  145 
  146 enum 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 
  156 struct rate_info {
  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;
  165 };
  166 
  167 struct ieee80211_rate {
  168         /* TODO FIXME */
  169         uint32_t                bitrate;
  170         uint32_t                hw_value;
  171         uint32_t                hw_value_short;
  172         uint32_t                flags;
  173 };
  174 
  175 struct ieee80211_sta_ht_cap {
  176         bool                                    ht_supported;
  177         uint8_t                                 ampdu_density;
  178         uint8_t                                 ampdu_factor;
  179         uint16_t                                cap;
  180         struct ieee80211_mcs_info               mcs;
  181 };
  182 
  183 /* XXX net80211 calls these IEEE80211_VHTCAP_* */
  184 #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895  0x00000000      /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_3895 */
  185 #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991  0x00000001      /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_7991 */
  186 #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002      /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_11454 */
  187 #define IEEE80211_VHT_CAP_MAX_MPDU_MASK         0x00000003      /* IEEE80211_VHTCAP_MAX_MPDU_MASK */
  188 
  189 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ                (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160MHZ << IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S)
  190 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ       (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160_80P80MHZ << IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S)
  191 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK  0x0000000c      /* IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK */
  192 
  193 #define IEEE80211_VHT_CAP_RXLDPC                0x00000010      /* IEEE80211_VHTCAP_RXLDPC */
  194 
  195 #define IEEE80211_VHT_CAP_SHORT_GI_80           0x00000020      /* IEEE80211_VHTCAP_SHORT_GI_80 */
  196 #define IEEE80211_VHT_CAP_SHORT_GI_160          0x00000040      /* IEEE80211_VHTCAP_SHORT_GI_160 */
  197 
  198 #define IEEE80211_VHT_CAP_TXSTBC                0x00000080      /* IEEE80211_VHTCAP_TXSTBC */
  199 
  200 #define IEEE80211_VHT_CAP_RXSTBC_1              0x00000100      /* IEEE80211_VHTCAP_RXSTBC_1 */
  201 #define IEEE80211_VHT_CAP_RXSTBC_MASK           0x00000700      /* IEEE80211_VHTCAP_RXSTBC_MASK */
  202 
  203 #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800      /* IEEE80211_VHTCAP_SU_BEAMFORMER_CAPABLE */
  204 
  205 #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000      /* IEEE80211_VHTCAP_SU_BEAMFORMEE_CAPABLE */
  206 
  207 #define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000      /* IEEE80211_VHTCAP_MU_BEAMFORMER_CAPABLE */
  208 
  209 #define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000      /* IEEE80211_VHTCAP_MU_BEAMFORMEE_CAPABLE */
  210 
  211 #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT          13      /* IEEE80211_VHTCAP_BEAMFORMEE_STS_SHIFT */
  212 #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK           (7 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT)   /* IEEE80211_VHTCAP_BEAMFORMEE_STS_MASK */
  213 
  214 #define IEEE80211_VHT_CAP_HTC_VHT               0x00400000      /* IEEE80211_VHTCAP_HTC_VHT */
  215 
  216 #define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN    0x10000000      /* IEEE80211_VHTCAP_RX_ANTENNA_PATTERN */
  217 #define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN    0x20000000      /* IEEE80211_VHTCAP_TX_ANTENNA_PATTERN */
  218 
  219 #define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB       0x0c000000      /* IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB */
  220 
  221 #define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT     16      /* IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT */
  222 #define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK              \
  223         (7 << IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT)       /* IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_MASK */
  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 
  230 struct ieee80211_sta_vht_cap {
  231                 /* TODO FIXME */
  232         bool                            vht_supported;
  233         uint32_t                        cap;
  234         struct ieee80211_vht_mcs_info   vht_mcs;
  235 };
  236 
  237 enum ieee80211_vht_opmode {
  238         IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT     = 4,
  239 };
  240 
  241 struct cfg80211_connect_resp_params {
  242                 /* XXX TODO */
  243         uint8_t                         *bssid;
  244         const uint8_t                   *req_ie;
  245         const uint8_t                   *resp_ie;
  246         uint32_t                        req_ie_len;
  247         uint32_t                        resp_ie_len;
  248         int     status;
  249 };
  250 
  251 struct cfg80211_inform_bss {
  252                 /* XXX TODO */
  253         int     boottime_ns, scan_width, signal;
  254         struct linuxkpi_ieee80211_channel       *chan;
  255 };
  256 
  257 struct cfg80211_roam_info {
  258                 /* XXX TODO */
  259         uint8_t                         *bssid;
  260         const uint8_t                   *req_ie;
  261         const uint8_t                   *resp_ie;
  262         uint32_t                        req_ie_len;
  263         uint32_t                        resp_ie_len;
  264         struct linuxkpi_ieee80211_channel       *channel;
  265 };
  266 
  267 struct cfg80211_bss_ies {
  268                 /* XXX TODO, type is best guess. Fix if more info. */
  269         uint8_t                         *data;
  270         int                             len;
  271 };
  272 
  273 struct cfg80211_bss {
  274                 /* XXX TODO */
  275         struct cfg80211_bss_ies         *ies;
  276 };
  277 
  278 struct cfg80211_chan_def {
  279                 /* XXX TODO */
  280         struct linuxkpi_ieee80211_channel       *chan;
  281         enum nl80211_chan_width         width;
  282         uint32_t                        center_freq1;
  283         uint32_t                        center_freq2;
  284 };
  285 
  286 struct cfg80211_ftm_responder_stats {
  287                 /* XXX TODO */
  288         int     asap_num, failed_num, filled, non_asap_num, out_of_window_triggers_num, partial_num, reschedule_requests_num, success_num, total_duration_ms, unknown_triggers_num;
  289 };
  290 
  291 struct cfg80211_pmsr_capabilities {
  292                 /* XXX TODO */
  293         int     max_peers, randomize_mac_addr, report_ap_tsf;
  294         struct {
  295                 int      asap, bandwidths, max_bursts_exponent, max_ftms_per_burst, non_asap, non_trigger_based, preambles, request_civicloc, request_lci, supported, trigger_based;
  296         } ftm;
  297 };
  298 
  299 struct cfg80211_pmsr_ftm_request {
  300                 /* XXX TODO */
  301         int     asap, burst_period, ftmr_retries, ftms_per_burst, non_trigger_based, num_bursts_exp, request_civicloc, request_lci, trigger_based;
  302         uint8_t                                 bss_color;
  303         bool                                    lmr_feedback;
  304 };
  305 
  306 struct cfg80211_pmsr_request_peer {
  307                 /* XXX TODO */
  308         struct cfg80211_chan_def                chandef;
  309         struct cfg80211_pmsr_ftm_request        ftm;
  310         uint8_t                                 addr[ETH_ALEN];
  311         int     report_ap_tsf;
  312 };
  313 
  314 struct cfg80211_pmsr_request {
  315                 /* XXX TODO */
  316         int     cookie, n_peers, timeout;
  317         uint8_t                                 mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN];
  318         struct cfg80211_pmsr_request_peer       peers[];
  319 };
  320 
  321 struct cfg80211_pmsr_ftm_result {
  322                 /* XXX TODO */
  323         int     burst_index, busy_retry_time, failure_reason;
  324         int     num_ftmr_successes, rssi_avg, rssi_avg_valid, rssi_spread, rssi_spread_valid, rtt_avg, rtt_avg_valid, rtt_spread, rtt_spread_valid, rtt_variance, rtt_variance_valid;
  325         uint8_t                                 *lci;
  326         uint8_t                                 *civicloc;
  327         int                                     lci_len;
  328         int                                     civicloc_len;
  329 };
  330 
  331 struct cfg80211_pmsr_result {
  332                 /* XXX TODO */
  333         int     ap_tsf, ap_tsf_valid, final, host_time, status, type;
  334         uint8_t                                 addr[ETH_ALEN];
  335         struct cfg80211_pmsr_ftm_result         ftm;
  336 };
  337 
  338 struct cfg80211_sar_freq_ranges {
  339         uint32_t                                start_freq;
  340         uint32_t                                end_freq;
  341 };
  342 
  343 struct cfg80211_sar_sub_specs {
  344         uint32_t                                freq_range_index;
  345         int                                     power;
  346 };
  347 
  348 struct cfg80211_sar_specs {
  349         enum nl80211_sar_type                   type;
  350         uint32_t                                num_sub_specs;
  351         struct cfg80211_sar_sub_specs           sub_specs[];
  352 };
  353 
  354 struct cfg80211_sar_capa {
  355         enum nl80211_sar_type                   type;
  356         uint32_t                                num_freq_ranges;
  357         const struct cfg80211_sar_freq_ranges   *freq_ranges;
  358 };
  359 
  360 struct cfg80211_ssid {
  361         int     ssid_len;
  362         uint8_t ssid[IEEE80211_MAX_SSID_LEN];
  363 };
  364 
  365 struct cfg80211_scan_6ghz_params {
  366         /* XXX TODO */
  367         uint8_t                         *bssid;
  368         int     channel_idx, psc_no_listen, short_ssid, short_ssid_valid, unsolicited_probe;
  369 };
  370 
  371 struct cfg80211_match_set {
  372         uint8_t                                 bssid[ETH_ALEN];
  373         struct cfg80211_ssid    ssid;
  374         int                     rssi_thold;
  375 };
  376 
  377 struct cfg80211_scan_request {
  378                 /* XXX TODO */
  379         int     duration, duration_mandatory, flags;
  380         bool                                    no_cck;
  381         bool                                    scan_6ghz;
  382         struct wireless_dev                     *wdev;
  383         struct wiphy                            *wiphy;
  384         int                                     ie_len;
  385         uint8_t                                 *ie;
  386         uint8_t                                 mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN];
  387         uint8_t                                 bssid[ETH_ALEN];
  388         int                                     n_ssids;
  389         int                                     n_6ghz_params;
  390         int                                     n_channels;
  391         struct cfg80211_ssid                    *ssids;
  392         struct cfg80211_scan_6ghz_params        *scan_6ghz_params;
  393         struct linuxkpi_ieee80211_channel       *channels[0];
  394 };
  395 
  396 struct cfg80211_sched_scan_plan {
  397                 /* XXX TODO */
  398         int     interval, iterations;
  399 };
  400 
  401 struct cfg80211_sched_scan_request {
  402                 /* XXX TODO */
  403         int     delay, flags;
  404         uint8_t                                 mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN];
  405         uint64_t                                reqid;
  406         int                                     n_match_sets;
  407         int                                     n_scan_plans;
  408         int                                     n_ssids;
  409         int                                     n_channels;
  410         int                                     ie_len;
  411         uint8_t                                 *ie;
  412         struct cfg80211_match_set               *match_sets;
  413         struct cfg80211_sched_scan_plan         *scan_plans;
  414         struct cfg80211_ssid                    *ssids;
  415         struct linuxkpi_ieee80211_channel       *channels[0];
  416 };
  417 
  418 struct cfg80211_scan_info {
  419         uint64_t                                scan_start_tsf;
  420         uint8_t                                 tsf_bssid[ETH_ALEN];
  421         bool                                    aborted;
  422 };
  423 
  424 struct cfg80211_beacon_data {
  425         /* XXX TODO */
  426         const uint8_t                           *head;
  427         const uint8_t                           *tail;
  428         uint32_t                                head_len;
  429         uint32_t                                tail_len;
  430         const uint8_t                           *proberesp_ies;
  431         const uint8_t                           *assocresp_ies;
  432         uint32_t                                proberesp_ies_len;
  433         uint32_t                                assocresp_ies_len;
  434 };
  435 
  436 struct cfg80211_ap_settings {
  437         /* XXX TODO */
  438         int     auth_type, beacon_interval, dtim_period, hidden_ssid, inactivity_timeout;
  439         const uint8_t                           *ssid;
  440         size_t                                  ssid_len;
  441         struct cfg80211_beacon_data             beacon;
  442         struct cfg80211_chan_def                chandef;
  443 };
  444 
  445 struct cfg80211_bss_selection {
  446         /* XXX TODO */
  447         enum nl80211_bss_select_attr            behaviour;
  448         union {
  449                 enum nl80211_band               band_pref;
  450                 struct {
  451                         enum nl80211_band       band;
  452                         uint8_t                 delta;
  453                 } adjust;
  454         } param;
  455 };
  456 
  457 struct cfg80211_crypto {                /* XXX made up name */
  458         /* XXX TODO */
  459         enum nl80211_wpa_versions               wpa_versions;
  460         uint32_t                                cipher_group;   /* WLAN_CIPHER_SUITE_* */
  461         uint32_t                                *akm_suites;
  462         uint32_t                                *ciphers_pairwise;
  463         const uint8_t                           *sae_pwd;
  464         const uint8_t                           *psk;
  465         int                                     n_akm_suites;
  466         int                                     n_ciphers_pairwise;
  467         int                                     sae_pwd_len;
  468 };
  469 
  470 struct cfg80211_connect_params {
  471         /* XXX TODO */
  472         struct linuxkpi_ieee80211_channel       *channel;
  473         uint8_t                                 *bssid;
  474         const uint8_t                           *ie;
  475         const uint8_t                           *ssid;
  476         uint32_t                                ie_len;
  477         uint32_t                                ssid_len;
  478         const void                              *key;
  479         uint32_t                                key_len;
  480         int     auth_type, key_idx, privacy, want_1x;
  481         struct cfg80211_bss_selection           bss_select;
  482         struct cfg80211_crypto                  crypto;
  483 };
  484 
  485 enum bss_param_flags {          /* Used as bitflags. XXX FIXME values? */
  486         BSS_PARAM_FLAGS_CTS_PROT        = 0x01,
  487         BSS_PARAM_FLAGS_SHORT_PREAMBLE  = 0x02,
  488         BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 0x04,
  489 };
  490 
  491 struct cfg80211_ibss_params {
  492         /* XXX TODO */
  493         int     basic_rates, beacon_interval;
  494         int     channel_fixed, ie, ie_len, privacy;
  495         int     dtim_period;
  496         uint8_t                                 *ssid;
  497         uint8_t                                 *bssid;
  498         int                                     ssid_len;
  499         struct cfg80211_chan_def                chandef;
  500         enum bss_param_flags                    flags;
  501 };
  502 
  503 struct cfg80211_mgmt_tx_params {
  504         /* XXX TODO */
  505         struct linuxkpi_ieee80211_channel       *chan;
  506         const uint8_t                           *buf;
  507         size_t                                  len;
  508         int     wait;
  509 };
  510 
  511 struct cfg80211_pmk_conf {
  512         /* XXX TODO */
  513         const uint8_t                   *pmk;
  514         uint8_t                         pmk_len;
  515 };
  516 
  517 struct cfg80211_pmksa {
  518         /* XXX TODO */
  519         const uint8_t                   *bssid;
  520         const uint8_t                   *pmkid;
  521 };
  522 
  523 struct station_del_parameters {
  524         /* XXX TODO */
  525         const uint8_t                           *mac;
  526         uint32_t                                reason_code;    /* elsewhere uint16_t? */
  527 };
  528 
  529 struct station_info {
  530         /* TODO FIXME */
  531         int     assoc_req_ies_len, connected_time;
  532         int     generation, inactive_time, rx_bytes, rx_dropped_misc, rx_packets, signal, tx_bytes, tx_packets;
  533         int     filled, rx_beacon, rx_beacon_signal_avg, signal_avg;
  534         int     rx_duration, tx_duration, tx_failed, tx_retries;
  535 
  536         int                                     chains;
  537         uint8_t                                 chain_signal[IEEE80211_MAX_CHAINS];
  538         uint8_t                                 chain_signal_avg[IEEE80211_MAX_CHAINS];
  539 
  540         uint8_t                                 *assoc_req_ies;
  541         struct rate_info                        rxrate;
  542         struct rate_info                        txrate;
  543         struct cfg80211_ibss_params             bss_param;
  544         struct nl80211_sta_flag_update          sta_flags;
  545 };
  546 
  547 struct station_parameters {
  548         /* XXX TODO */
  549         int     sta_flags_mask, sta_flags_set;
  550 };
  551 
  552 struct key_params {
  553         /* XXX TODO */
  554         const uint8_t   *key;
  555         const uint8_t   *seq;
  556         int             key_len;
  557         int             seq_len;
  558         uint32_t        cipher;                 /* WLAN_CIPHER_SUITE_* */
  559 };
  560 
  561 struct mgmt_frame_regs {
  562         /* XXX TODO */
  563         int     interface_stypes;
  564 };
  565 
  566 struct vif_params {
  567         /* XXX TODO */
  568         uint8_t                 macaddr[ETH_ALEN];
  569 };
  570 
  571 /* That the world needs so many different structs for this is amazing. */
  572 struct mac_address {
  573         uint8_t addr[ETH_ALEN];
  574 };
  575 
  576 struct ieee80211_reg_rule {
  577         /* TODO FIXME */
  578         uint32_t        flags;
  579         int     dfs_cac_ms;
  580         struct freq_range {
  581                 int     start_freq_khz;
  582                 int     end_freq_khz;
  583                 int     max_bandwidth_khz;
  584         } freq_range;
  585         struct power_rule {
  586                 int     max_antenna_gain;
  587                 int     max_eirp;
  588         } power_rule;
  589 };
  590 
  591 struct linuxkpi_ieee80211_regdomain {
  592         /* TODO FIXME */
  593         uint8_t                                 alpha2[2];
  594         int     dfs_region;
  595         int                                     n_reg_rules;
  596         struct ieee80211_reg_rule               reg_rules[];
  597 };
  598 
  599 /* XXX-BZ this are insensible values probably ... */
  600 #define IEEE80211_HE_MAC_CAP0_HTC_HE                    0x1
  601 #define IEEE80211_HE_MAC_CAP0_TWT_REQ                   0x2
  602 #define IEEE80211_HE_MAC_CAP0_TWT_RES                   0x4
  603 
  604 #define IEEE80211_HE_MAC_CAP1_LINK_ADAPTATION           0x1
  605 #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8    0x2
  606 #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US       0x4
  607 #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_MASK       0x8
  608 
  609 #define IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP           0x1
  610 #define IEEE80211_HE_MAC_CAP2_ACK_EN                    0x2
  611 #define IEEE80211_HE_MAC_CAP2_BSR                       0x4
  612 #define IEEE80211_HE_MAC_CAP2_LINK_ADAPTATION           0x8
  613 #define IEEE80211_HE_MAC_CAP2_BCAST_TWT                 0x10
  614 #define IEEE80211_HE_MAC_CAP2_ALL_ACK                   0x20
  615 #define IEEE80211_HE_MAC_CAP2_MU_CASCADING              0x40
  616 #define IEEE80211_HE_MAC_CAP2_TRS                       0x80
  617 
  618 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2   0x1
  619 #define IEEE80211_HE_MAC_CAP3_OMI_CONTROL               0x2
  620 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_1   0x10
  621 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_2   0x20
  622 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3   0x40
  623 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK    0x70
  624 #define IEEE80211_HE_MAC_CAP3_RX_CTRL_FRAME_TO_MULTIBSS 0x80
  625 #define IEEE80211_HE_MAC_CAP3_FLEX_TWT_SCHED            0x80
  626 #define IEEE80211_HE_MAC_CAP3_OFDMA_RA                  0x80
  627 
  628 #define IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU            0x1
  629 #define IEEE80211_HE_MAC_CAP4_BQR                       0x2
  630 #define IEEE80211_HE_MAC_CAP4_MULTI_TID_AGG_TX_QOS_B39  0x4
  631 #define IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU            0x8
  632 #define IEEE80211_HE_MAC_CAP4_OPS                       0x10
  633 #define IEEE80211_HE_MAC_CAP4_BSRP_BQRP_A_MPDU_AGG      0x20
  634 
  635 #define IEEE80211_HE_MAC_CAP5_HE_DYNAMIC_SM_PS          0x1
  636 #define IEEE80211_HE_MAC_CAP5_HT_VHT_TRIG_FRAME_RX      0x2
  637 #define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B40  0x4
  638 #define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B41  0x8
  639 #define IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU          0x10
  640 #define IEEE80211_HE_MAC_CAP5_OM_CTRL_UL_MU_DATA_DIS_RX 0x20
  641 #define IEEE80211_HE_MAC_CAP5_PUNCTURED_SOUNDING        0x40
  642 #define IEEE80211_HE_MAC_CAP5_SUBCHAN_SELECTIVE_TRANSMISSION    0x80
  643 
  644 #define IEEE80211_HE_MCS_NOT_SUPPORTED                  0x0
  645 #define IEEE80211_HE_MCS_SUPPORT_0_7                    0x1
  646 #define IEEE80211_HE_MCS_SUPPORT_0_9                    0x2
  647 #define IEEE80211_HE_MCS_SUPPORT_0_11                   0x4
  648 
  649 #define IEEE80211_HE_6GHZ_CAP_TX_ANTPAT_CONS            0x01
  650 #define IEEE80211_HE_6GHZ_CAP_RX_ANTPAT_CONS            0x02
  651 #define IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START            0x04
  652 #define IEEE80211_HE_6GHZ_CAP_MAX_MPDU_LEN              0x08
  653 #define IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP         0x10
  654 #define IEEE80211_HE_6GHZ_CAP_SM_PS                     0x20
  655 
  656 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G            0x1
  657 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G       0x2
  658 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G             0x4
  659 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G      0x8
  660 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_2G        0x10
  661 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_5G        0x20
  662 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK                    0x40
  663 
  664 #define IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A            0x1
  665 #define IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD    0x2
  666 #define IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS   0x4
  667 #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK     0x8
  668 #define IEEE80211_HE_PHY_CAP1_HE_LTF_AND_GI_FOR_HE_PPDUS_0_8US  0x10
  669 
  670 #define IEEE80211_HE_PHY_CAP2_MIDAMBLE_RX_TX_MAX_NSTS   0x1
  671 #define IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US      0x2
  672 #define IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ       0x4
  673 #define IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ       0x8
  674 #define IEEE80211_HE_PHY_CAP2_DOPPLER_TX                0x10
  675 #define IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO     0x20
  676 #define IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO        0x40
  677 
  678 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK     0x1
  679 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_NO_DCM   0x2
  680 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_NO_DCM   0x4
  681 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1          0x8
  682 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_1          0x10
  683 #define IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER             0x20
  684 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM   0x40
  685 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_16_QAM   0x80
  686 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_2          0x10
  687 #define IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU      0x20
  688 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_BPSK     0x40
  689 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_BPSK     0x80
  690 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK     0x80
  691 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_QPSK     0x80
  692 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_QPSK     0x80
  693 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_2          0x80
  694 
  695 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_8  0x1
  696 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_8  0x2
  697 #define IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE                     0x4
  698 #define IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER                     0x8
  699 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_4  0x10
  700 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_4  0x20
  701 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_MASK       0x40
  702 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_MASK       0x80
  703 
  704 #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2      0x1
  705 #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2      0x2
  706 #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK   0x4
  707 #define IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK                          0x8
  708 #define IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK                          0x10
  709 #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_MASK   0x20
  710 
  711 #define IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT     0x1
  712 #define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB     0x2
  713 #define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB     0x4
  714 #define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB    0x8
  715 #define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB 0x20
  716 #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU       0x40
  717 #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU       0x80
  718 #define IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE      0x80
  719 #define IEEE80211_HE_PHY_CAP6_TRIG_CQI_FB               0x80
  720 #define IEEE80211_HE_PHY_CAP6_PARTIAL_BANDWIDTH_DL_MUMIMO       0x80
  721 
  722 #define IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI  0x1
  723 #define IEEE80211_HE_PHY_CAP7_MAX_NC_1                          0x2
  724 #define IEEE80211_HE_PHY_CAP7_MAX_NC_2                          0x4
  725 #define IEEE80211_HE_PHY_CAP7_MAX_NC_MASK                       0x6
  726 #define IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR             0x8
  727 #define IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP           0x10
  728 #define IEEE80211_HE_PHY_CAP7_STBC_RX_ABOVE_80MHZ               0x20
  729 #define IEEE80211_HE_PHY_CAP7_STBC_TX_ABOVE_80MHZ               0x40
  730 #define IEEE80211_HE_PHY_CAP7_PSR_BASED_SR                      0x80
  731 
  732 #define IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU           0x1
  733 #define IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G      0x2
  734 #define IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU           0x4
  735 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_242                    0x8
  736 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_484                    0x10
  737 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_996                    0x18
  738 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_2x996                  0x20
  739 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_MASK                   0x28
  740 #define IEEE80211_HE_PHY_CAP8_HE_ER_SU_PPDU_4XLTF_AND_08_US_GI  0x40
  741 #define IEEE80211_HE_PHY_CAP8_HE_ER_SU_1XLTF_AND_08_US_GI       0x80
  742 
  743 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_0US           0x1
  744 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US          0x2
  745 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_8US           0x4
  746 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK          0x8
  747 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_RESERVED      0x10
  748 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_POS           0x0
  749 #define IEEE80211_HE_PHY_CAP9_NON_TRIGGERED_CQI_FEEDBACK        0x20
  750 #define IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB     0x4
  751 #define IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB 0x8
  752 #define IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_THAN_242_TONE_RU 0x10
  753 #define IEEE80211_HE_PHY_CAP9_TX_1024_QAM_LESS_THAN_242_TONE_RU 0x20
  754 #define IEEE80211_HE_PHY_CAP9_LONGER_THAN_16_SIGB_OFDM_SYM      0x40
  755 
  756 #define IEEE80211_HE_PHY_CAP10_HE_MU_M1RU_MAX_LTF               0x1
  757 
  758 #define IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED               0x1
  759 #define IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET                 0x2
  760 
  761 #define IEEE80211_HE_SPR_HESIGA_SR_VAL15_ALLOWED                0x01
  762 #define IEEE80211_HE_SPR_NON_SRG_OBSS_PD_SR_DISALLOWED          0x02
  763 #define IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT                 0x04
  764 #define IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT                0x08
  765 
  766 #define VENDOR_CMD_RAW_DATA     (void *)(uintptr_t)(-ENOENT)
  767 
  768 struct ieee80211_he_cap_elem {
  769         u8 mac_cap_info[6];
  770         u8 phy_cap_info[11];
  771 } __packed;
  772 
  773 struct ieee80211_he_mcs_nss_supp {
  774         /* TODO FIXME */
  775         uint32_t        rx_mcs_80;
  776         uint32_t        tx_mcs_80;
  777         uint32_t        rx_mcs_160;
  778         uint32_t        tx_mcs_160;
  779         uint32_t        rx_mcs_80p80;
  780         uint32_t        tx_mcs_80p80;
  781 };
  782 
  783 #define IEEE80211_STA_HE_CAP_PPE_THRES_MAX      32
  784 struct ieee80211_sta_he_cap {
  785         /* TODO FIXME */
  786         int                                     has_he;
  787         struct ieee80211_he_cap_elem            he_cap_elem;
  788         struct ieee80211_he_mcs_nss_supp        he_mcs_nss_supp;
  789         uint8_t                                 ppe_thres[IEEE80211_STA_HE_CAP_PPE_THRES_MAX];
  790 };
  791 
  792 struct cfg80211_he_bss_color {
  793         int     color, enabled;
  794 };
  795 
  796 struct ieee80211_he_obss_pd {
  797         bool                                    enable;
  798         uint8_t                                 min_offset;
  799         uint8_t                                 max_offset;
  800         uint8_t                                 non_srg_max_offset;
  801         uint8_t                                 sr_ctrl;
  802         uint8_t                                 bss_color_bitmap[8];
  803         uint8_t                                 partial_bssid_bitmap[8];
  804 };
  805 
  806 struct ieee80211_sta_he_6ghz_capa {
  807         /* TODO FIXME */
  808         int     capa;
  809 };
  810 
  811 struct ieee80211_sband_iftype_data {
  812         /* TODO FIXME */
  813         enum nl80211_iftype                     types_mask;
  814         struct ieee80211_sta_he_cap             he_cap;
  815         struct ieee80211_sta_he_6ghz_capa       he_6ghz_capa;
  816         struct {
  817                 const uint8_t                   *data;
  818                 size_t                          len;
  819         } vendor_elems;
  820 };
  821 
  822 struct ieee80211_supported_band {
  823         /* TODO FIXME */
  824         struct linuxkpi_ieee80211_channel       *channels;
  825         struct ieee80211_rate                   *bitrates;
  826         struct ieee80211_sband_iftype_data      *iftype_data;
  827         int                                     n_channels;
  828         int                                     n_bitrates;
  829         int                                     n_iftype_data;
  830         enum nl80211_band                       band;
  831         struct ieee80211_sta_ht_cap             ht_cap;
  832         struct ieee80211_sta_vht_cap            vht_cap;
  833 };
  834 
  835 struct cfg80211_pkt_pattern {
  836         /* XXX TODO */
  837         uint8_t                                 *mask;
  838         uint8_t                                 *pattern;
  839         int                                     pattern_len;
  840         int                                     pkt_offset;
  841 };
  842 
  843 struct cfg80211_wowlan_nd_match {
  844         /* XXX TODO */
  845         struct cfg80211_ssid            ssid;
  846         int                             n_channels;
  847         uint32_t                        channels[0];    /* freq! = ieee80211_channel_to_frequency() */
  848 };
  849 
  850 struct cfg80211_wowlan_nd_info {
  851         /* XXX TODO */
  852         int                             n_matches;
  853         struct cfg80211_wowlan_nd_match *matches[0];
  854 };
  855 
  856 enum wiphy_wowlan_support_flags {
  857         WIPHY_WOWLAN_DISCONNECT,
  858         WIPHY_WOWLAN_GTK_REKEY_FAILURE,
  859         WIPHY_WOWLAN_MAGIC_PKT,
  860         WIPHY_WOWLAN_SUPPORTS_GTK_REKEY,
  861         WIPHY_WOWLAN_NET_DETECT,
  862 };
  863 
  864 struct wiphy_wowlan_support {
  865         /* XXX TODO */
  866         enum wiphy_wowlan_support_flags         flags;
  867         int     max_nd_match_sets, max_pkt_offset, n_patterns, pattern_max_len, pattern_min_len;
  868 };
  869 
  870 struct cfg80211_wowlan_wakeup {
  871         /* XXX TODO */
  872         uint16_t                                pattern_idx;
  873         bool                                    disconnect;
  874         bool                                    eap_identity_req;
  875         bool                                    four_way_handshake;
  876         bool                                    gtk_rekey_failure;
  877         bool                                    magic_pkt;
  878         bool                                    rfkill_release;
  879         bool                                    tcp_connlost;
  880         bool                                    tcp_nomoretokens;
  881         bool                                    tcp_match;
  882         bool                                    packet_80211;
  883         struct cfg80211_wowlan_nd_info          *net_detect;
  884         uint8_t                                 *packet;
  885         uint16_t                                packet_len;
  886         uint16_t                                packet_present_len;
  887 };
  888 
  889 struct cfg80211_wowlan {
  890         /* XXX TODO */
  891         int     disconnect, gtk_rekey_failure, magic_pkt;
  892         int     eap_identity_req, four_way_handshake, rfkill_release, tcp, any;
  893         int                                     n_patterns;
  894         struct cfg80211_sched_scan_request      *nd_config;
  895         struct cfg80211_pkt_pattern             *patterns;
  896 };
  897 
  898 struct cfg80211_gtk_rekey_data {
  899         /* XXX TODO */
  900         const uint8_t                           *kck, *kek, *replay_ctr;
  901         uint32_t                                akm;
  902         uint8_t                                 kck_len, kek_len;
  903 };
  904 
  905 struct cfg80211_tid_cfg {
  906         /* XXX TODO */
  907         int     mask, noack, retry_long, rtscts, tids;
  908         enum nl80211_tx_rate_setting            txrate_type;
  909         struct cfg80211_bitrate_mask            txrate_mask;
  910 };
  911 
  912 struct cfg80211_tid_config {
  913         /* XXX TODO */
  914         int     n_tid_conf;
  915         struct cfg80211_tid_cfg                 tid_conf[0];
  916 };
  917 
  918 struct ieee80211_iface_limit {
  919         /* TODO FIXME */
  920         int             max, types;
  921 };
  922 
  923 struct ieee80211_iface_combination {
  924         /* TODO FIXME */
  925         const struct ieee80211_iface_limit      *limits;
  926         int                                     n_limits;
  927         int             max_interfaces, num_different_channels;
  928         int             beacon_int_infra_match, beacon_int_min_gcd;
  929         int             radar_detect_widths;
  930 };
  931 
  932 struct iface_combination_params {
  933         int num_different_channels;
  934         int iftype_num[NUM_NL80211_IFTYPES];
  935 };
  936 
  937 struct regulatory_request {
  938                 /* XXX TODO */
  939         uint8_t                                 alpha2[2];
  940         int     initiator, dfs_region;
  941         int     user_reg_hint_type;
  942 };
  943 
  944 enum wiphy_vendor_cmd_need_flags {
  945         WIPHY_VENDOR_CMD_NEED_NETDEV            = 0x01,
  946         WIPHY_VENDOR_CMD_NEED_RUNNING           = 0x02,
  947         WIPHY_VENDOR_CMD_NEED_WDEV              = 0x04,
  948 };
  949 
  950 struct wiphy_vendor_command {
  951         struct {
  952                 uint32_t        vendor_id;
  953                 uint32_t        subcmd;
  954         };
  955         uint32_t                flags;
  956         void                    *policy;
  957         int (*doit)(struct wiphy *, struct wireless_dev *, const void *, int);
  958 };
  959 
  960 struct wiphy_iftype_ext_capab {
  961         /* TODO FIXME */
  962         enum nl80211_iftype                     iftype;
  963         const uint8_t                           *extended_capabilities;
  964         const uint8_t                           *extended_capabilities_mask;
  965         uint8_t                                 extended_capabilities_len;
  966 
  967 };
  968 
  969 struct tid_config_support {
  970         /* TODO FIXME */
  971         uint64_t                                vif;    /* enum nl80211_tid_cfg_attr */
  972         uint64_t                                peer;   /* enum nl80211_tid_cfg_attr */
  973 };
  974 
  975 enum cfg80211_regulatory {
  976         REGULATORY_CUSTOM_REG                   = BIT(0),
  977         REGULATORY_STRICT_REG                   = BIT(1),
  978         REGULATORY_DISABLE_BEACON_HINTS         = BIT(2),
  979         REGULATORY_ENABLE_RELAX_NO_IR           = BIT(3),
  980         REGULATORY_WIPHY_SELF_MANAGED           = BIT(4),
  981         REGULATORY_COUNTRY_IE_IGNORE            = BIT(5),
  982         REGULATORY_COUNTRY_IE_FOLLOW_POWER      = BIT(6),
  983 };
  984 
  985 enum wiphy_flags {
  986         WIPHY_FLAG_AP_UAPSD                     = BIT(0),
  987         WIPHY_FLAG_HAS_CHANNEL_SWITCH           = BIT(1),
  988         WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL        = BIT(2),
  989         WIPHY_FLAG_HAVE_AP_SME                  = BIT(3),
  990         WIPHY_FLAG_IBSS_RSN                     = BIT(4),
  991         WIPHY_FLAG_NETNS_OK                     = BIT(5),
  992         WIPHY_FLAG_OFFCHAN_TX                   = BIT(6),
  993         WIPHY_FLAG_PS_ON_BY_DEFAULT             = BIT(7),
  994         WIPHY_FLAG_SPLIT_SCAN_6GHZ              = BIT(8),
  995         WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK         = BIT(9),
  996         WIPHY_FLAG_SUPPORTS_FW_ROAM             = BIT(10),
  997         WIPHY_FLAG_SUPPORTS_TDLS                = BIT(11),
  998         WIPHY_FLAG_TDLS_EXTERNAL_SETUP          = BIT(12),
  999         WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD        = BIT(13),
 1000         WIPHY_FLAG_4ADDR_AP                     = BIT(14),
 1001         WIPHY_FLAG_4ADDR_STATION                = BIT(15),
 1002 };
 1003 
 1004 struct wiphy {
 1005 
 1006         struct device                           *dev;
 1007         struct mac_address                      *addresses;
 1008         int                                     n_addresses;
 1009         uint32_t                                flags;
 1010         struct ieee80211_supported_band         *bands[NUM_NL80211_BANDS];
 1011         uint8_t                                 perm_addr[ETH_ALEN];
 1012         uint16_t                                max_scan_ie_len;
 1013 
 1014         /* XXX TODO */
 1015         const struct cfg80211_pmsr_capabilities *pmsr_capa;
 1016         const struct cfg80211_sar_capa          *sar_capa;
 1017         const struct wiphy_iftype_ext_capab     *iftype_ext_capab;
 1018         const struct linuxkpi_ieee80211_regdomain *regd;
 1019         char                                    fw_version[ETHTOOL_FWVERS_LEN];
 1020         const struct ieee80211_iface_combination *iface_combinations;
 1021         const uint32_t                          *cipher_suites;
 1022         int                                     n_iface_combinations;
 1023         int                                     n_cipher_suites;
 1024         void(*reg_notifier)(struct wiphy *, struct regulatory_request *);
 1025         enum cfg80211_regulatory                regulatory_flags;
 1026         int                                     n_vendor_commands;
 1027         const struct wiphy_vendor_command       *vendor_commands;
 1028         const struct ieee80211_txrx_stypes      *mgmt_stypes;
 1029         uint32_t                                rts_threshold;
 1030         uint32_t                                frag_threshold;
 1031         struct tid_config_support               tid_config_support;
 1032 
 1033         int     available_antennas_rx, available_antennas_tx;
 1034         int     features, hw_version;
 1035         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;
 1036         int     num_iftype_ext_capab;
 1037         int     max_ap_assoc_sta, probe_resp_offload, software_iftypes;
 1038         int     bss_select_support, max_num_pmkids, retry_long, retry_short, signal_type;
 1039         int     max_data_retry_count;
 1040         int     tx_queue_len, rfkill;
 1041         int     mbssid_max_interfaces;
 1042 
 1043         unsigned long                           ext_features[BITS_TO_LONGS(NUM_NL80211_EXT_FEATURES)];
 1044         struct dentry                           *debugfsdir;
 1045         struct cfg80211_wowlan_support          *wowlan;
 1046         /* Lower layer (driver/mac80211) specific data. */
 1047         /* Must stay last. */
 1048         uint8_t                                 priv[0] __aligned(CACHE_LINE_SIZE);
 1049 };
 1050 
 1051 struct wireless_dev {
 1052                 /* XXX TODO, like ic? */
 1053         int             iftype;
 1054         int     address;
 1055         struct net_device                       *netdev;
 1056         struct wiphy                            *wiphy;
 1057 };
 1058 
 1059 struct cfg80211_ops {
 1060         /* XXX TODO */
 1061         struct wireless_dev *(*add_virtual_intf)(struct wiphy *, const char *, unsigned char, enum nl80211_iftype, struct vif_params *);
 1062         int (*del_virtual_intf)(struct wiphy *,  struct wireless_dev *);
 1063         s32 (*change_virtual_intf)(struct wiphy *,  struct net_device *, enum nl80211_iftype, struct vif_params *);
 1064         s32 (*scan)(struct wiphy *,  struct cfg80211_scan_request *);
 1065         s32 (*set_wiphy_params)(struct wiphy *,  u32);
 1066         s32 (*join_ibss)(struct wiphy *,  struct net_device *, struct cfg80211_ibss_params *);
 1067         s32 (*leave_ibss)(struct wiphy *,  struct net_device *);
 1068         s32 (*get_station)(struct wiphy *, struct net_device *, const u8 *, struct station_info *);
 1069         int (*dump_station)(struct wiphy *,  struct net_device *, int,  u8 *,  struct station_info *);
 1070         s32 (*set_tx_power)(struct wiphy *,  struct wireless_dev *, enum nl80211_tx_power_setting,  s32);
 1071         s32 (*get_tx_power)(struct wiphy *,  struct wireless_dev *, s32 *);
 1072         s32 (*add_key)(struct wiphy *,  struct net_device *, u8,  bool,  const u8 *, struct key_params *);
 1073         s32 (*del_key)(struct wiphy *,  struct net_device *, u8,  bool,  const u8 *);
 1074         s32 (*get_key)(struct wiphy *,  struct net_device *,  u8, bool,  const u8 *,  void *, void(*)(void *, struct key_params *));
 1075         s32 (*set_default_key)(struct wiphy *,  struct net_device *, u8,  bool,  bool);
 1076         s32 (*set_default_mgmt_key)(struct wiphy *, struct net_device *,  u8);
 1077         s32 (*set_power_mgmt)(struct wiphy *,  struct net_device *, bool,  s32);
 1078         s32 (*connect)(struct wiphy *,  struct net_device *, struct cfg80211_connect_params *);
 1079         s32 (*disconnect)(struct wiphy *,  struct net_device *, u16);
 1080         s32 (*suspend)(struct wiphy *, struct cfg80211_wowlan *);
 1081         s32 (*resume)(struct wiphy *);
 1082         s32 (*set_pmksa)(struct wiphy *, struct net_device *, struct cfg80211_pmksa *);
 1083         s32 (*del_pmksa)(struct wiphy *, struct net_device *, struct cfg80211_pmksa *);
 1084         s32 (*flush_pmksa)(struct wiphy *,  struct net_device *);
 1085         s32 (*start_ap)(struct wiphy *,  struct net_device *, struct cfg80211_ap_settings *);
 1086         int (*stop_ap)(struct wiphy *,  struct net_device *);
 1087         s32 (*change_beacon)(struct wiphy *,  struct net_device *, struct cfg80211_beacon_data *);
 1088         int (*del_station)(struct wiphy *,  struct net_device *, struct station_del_parameters *);
 1089         int (*change_station)(struct wiphy *,  struct net_device *, const u8 *,  struct station_parameters *);
 1090         int (*sched_scan_start)(struct wiphy *, struct net_device *, struct cfg80211_sched_scan_request *);
 1091         int (*sched_scan_stop)(struct wiphy *, struct net_device *,  u64);
 1092         void (*update_mgmt_frame_registrations)(struct wiphy *, struct wireless_dev *, struct mgmt_frame_regs *);
 1093         int (*mgmt_tx)(struct wiphy *,  struct wireless_dev *, struct cfg80211_mgmt_tx_params *,  u64 *);
 1094         int (*cancel_remain_on_channel)(struct wiphy *, struct wireless_dev *, u64);
 1095         int (*get_channel)(struct wiphy *, struct wireless_dev *, struct cfg80211_chan_def *);
 1096         int (*crit_proto_start)(struct wiphy *, struct wireless_dev *, enum nl80211_crit_proto_id, u16);
 1097         void (*crit_proto_stop)(struct wiphy *, struct wireless_dev *);
 1098         int (*tdls_oper)(struct wiphy *, struct net_device *,  const u8 *, enum nl80211_tdls_operation);
 1099         int (*update_connect_params)(struct wiphy *, struct net_device *, struct cfg80211_connect_params *, u32);
 1100         int (*set_pmk)(struct wiphy *,  struct net_device *, const struct cfg80211_pmk_conf *);
 1101         int (*del_pmk)(struct wiphy *,  struct net_device *, const u8 *);
 1102         int (*remain_on_channel)(struct wiphy *,  struct wireless_dev *, struct linuxkpi_ieee80211_channel *, unsigned int,  u64 *);
 1103         int (*start_p2p_device)(struct wiphy *,  struct wireless_dev *);
 1104         void (*stop_p2p_device)(struct wiphy *,  struct wireless_dev *);
 1105 };
 1106 
 1107 
 1108 /* -------------------------------------------------------------------------- */
 1109 
 1110 /* linux_80211.c */
 1111 
 1112 struct wiphy *linuxkpi_wiphy_new(const struct cfg80211_ops *, size_t);
 1113 void linuxkpi_wiphy_free(struct wiphy *wiphy);
 1114 
 1115 int linuxkpi_regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
 1116     struct linuxkpi_ieee80211_regdomain *regd);
 1117 uint32_t linuxkpi_ieee80211_channel_to_frequency(uint32_t, enum nl80211_band);
 1118 uint32_t linuxkpi_ieee80211_frequency_to_channel(uint32_t, uint32_t);
 1119 struct linuxkpi_ieee80211_channel *
 1120     linuxkpi_ieee80211_get_channel(struct wiphy *, uint32_t);
 1121 struct cfg80211_bss *linuxkpi_cfg80211_get_bss(struct wiphy *,
 1122     struct linuxkpi_ieee80211_channel *, const uint8_t *,
 1123     const uint8_t *, size_t, enum ieee80211_bss_type, enum ieee80211_privacy);
 1124 void linuxkpi_cfg80211_put_bss(struct wiphy *, struct cfg80211_bss *);
 1125 void linuxkpi_cfg80211_bss_flush(struct wiphy *);
 1126 
 1127 /* -------------------------------------------------------------------------- */
 1128 
 1129 static __inline struct wiphy *
 1130 wiphy_new(const struct cfg80211_ops *ops, size_t priv_len)
 1131 {
 1132 
 1133         return (linuxkpi_wiphy_new(ops, priv_len));
 1134 }
 1135 
 1136 static __inline void
 1137 wiphy_free(struct wiphy *wiphy)
 1138 {
 1139 
 1140         linuxkpi_wiphy_free(wiphy);
 1141 }
 1142 
 1143 static __inline void *
 1144 wiphy_priv(struct wiphy *wiphy)
 1145 {
 1146 
 1147         return (wiphy->priv);
 1148 }
 1149 
 1150 static __inline void
 1151 set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
 1152 {
 1153 
 1154         wiphy->dev = dev;
 1155 }
 1156 
 1157 static __inline struct device *
 1158 wiphy_dev(struct wiphy *wiphy)
 1159 {
 1160 
 1161         return (wiphy->dev);
 1162 }
 1163 
 1164 #define wiphy_err(_wiphy, _fmt, ...)                                    \
 1165     dev_err((_wiphy)->dev, _fmt, __VA_ARGS__)
 1166 
 1167 static __inline const struct linuxkpi_ieee80211_regdomain *
 1168 wiphy_dereference(struct wiphy *wiphy,
 1169     const struct linuxkpi_ieee80211_regdomain *regd)
 1170 {
 1171         TODO();
 1172         return (NULL);
 1173 }
 1174 
 1175 static __inline void
 1176 wiphy_lock(struct wiphy *wiphy)
 1177 {
 1178         TODO();
 1179 }
 1180 
 1181 static __inline void
 1182 wiphy_unlock(struct wiphy *wiphy)
 1183 {
 1184         TODO();
 1185 }
 1186 
 1187 static __inline void
 1188 wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
 1189     enum rfkill_hard_block_reasons reason)
 1190 {
 1191         TODO();
 1192 }
 1193 
 1194 /* -------------------------------------------------------------------------- */
 1195 
 1196 static inline struct cfg80211_bss *
 1197 cfg80211_get_bss(struct wiphy *wiphy, struct linuxkpi_ieee80211_channel *chan,
 1198     const uint8_t *bssid, const uint8_t *ssid, size_t ssid_len,
 1199     enum ieee80211_bss_type bss_type, enum ieee80211_privacy privacy)
 1200 {
 1201 
 1202         return (linuxkpi_cfg80211_get_bss(wiphy, chan, bssid, ssid, ssid_len,
 1203            bss_type, privacy));
 1204 }
 1205 
 1206 static inline void
 1207 cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss)
 1208 {
 1209 
 1210         linuxkpi_cfg80211_put_bss(wiphy, bss);
 1211 }
 1212 
 1213 static inline void
 1214 cfg80211_bss_flush(struct wiphy *wiphy)
 1215 {
 1216 
 1217         linuxkpi_cfg80211_bss_flush(wiphy);
 1218 }
 1219 
 1220 /* -------------------------------------------------------------------------- */
 1221 
 1222 static __inline bool
 1223 rfkill_blocked(int rfkill)              /* argument type? */
 1224 {
 1225         TODO();
 1226         return (false);
 1227 }
 1228 
 1229 static __inline bool
 1230 rfkill_soft_blocked(int rfkill)
 1231 {
 1232         TODO();
 1233         return (false);
 1234 }
 1235 
 1236 static __inline int
 1237 reg_query_regdb_wmm(uint8_t *alpha2, uint32_t center_freq,
 1238     struct ieee80211_reg_rule *rule)
 1239 {
 1240 
 1241         /* ETSI has special rules. FreeBSD regdb needs to learn about them. */
 1242         TODO();
 1243 
 1244         return (-ENXIO);
 1245 }
 1246 
 1247 static __inline const u8 *
 1248 cfg80211_find_ie_match(uint32_t f, const u8 *ies, size_t ies_len,
 1249     const u8 *match, int x, int y)
 1250 {
 1251         TODO();
 1252         return (NULL);
 1253 }
 1254 
 1255 static __inline const u8 *
 1256 cfg80211_find_ie(uint8_t eid, const uint8_t *ie, uint32_t ielen)
 1257 {
 1258         TODO();
 1259         return (NULL);
 1260 }
 1261 
 1262 static __inline void
 1263 cfg80211_pmsr_complete(struct wireless_dev *wdev,
 1264     struct cfg80211_pmsr_request *req, gfp_t gfp)
 1265 {
 1266         TODO();
 1267 }
 1268 
 1269 static __inline void
 1270 cfg80211_pmsr_report(struct wireless_dev *wdev,
 1271     struct cfg80211_pmsr_request *req,
 1272     struct cfg80211_pmsr_result *result, gfp_t gfp)
 1273 {
 1274         TODO();
 1275 }
 1276 
 1277 static __inline void
 1278 cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
 1279     struct linuxkpi_ieee80211_channel *chan, enum nl80211_chan_flags chan_flag)
 1280 {
 1281 
 1282         KASSERT(chandef != NULL, ("%s: chandef is NULL\n", __func__));
 1283         KASSERT(chan != NULL, ("%s: chan is NULL\n", __func__));
 1284 
 1285         memset(chandef, 0, sizeof(*chandef));
 1286         chandef->chan = chan;
 1287         chandef->center_freq2 = 0;      /* Set here and only overwrite if needed. */
 1288 
 1289         switch (chan_flag) {
 1290         case NL80211_CHAN_NO_HT:
 1291                 chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
 1292                 chandef->center_freq1 = chan->center_freq;
 1293                 break;
 1294         default:
 1295                 IMPROVE("Also depends on our manual settings");
 1296                 if (chan->flags & IEEE80211_CHAN_NO_HT40)
 1297                         chandef->width = NL80211_CHAN_WIDTH_20;
 1298                 else if (chan->flags & IEEE80211_CHAN_NO_80MHZ)
 1299                         chandef->width = NL80211_CHAN_WIDTH_40;
 1300                 else if (chan->flags & IEEE80211_CHAN_NO_160MHZ)
 1301                         chandef->width = NL80211_CHAN_WIDTH_80;
 1302                 else {
 1303                         chandef->width = NL80211_CHAN_WIDTH_160;
 1304                         IMPROVE("80P80 and 320 ...");
 1305                 }
 1306                 chandef->center_freq1 = chan->center_freq;
 1307                 break;
 1308         };
 1309 }
 1310 
 1311 static __inline void
 1312 cfg80211_bss_iter(struct wiphy *wiphy, struct cfg80211_chan_def *chandef,
 1313     void (*iterfunc)(struct wiphy *, struct cfg80211_bss *, void *), void *data)
 1314 {
 1315         TODO();
 1316 }
 1317 
 1318 struct element {
 1319         uint8_t                                 id;
 1320         uint8_t                                 datalen;
 1321         uint8_t                                 data[0];
 1322 } __packed;
 1323 
 1324 static inline const struct element *
 1325 lkpi_cfg80211_find_elem_pattern(enum ieee80211_eid eid,
 1326     const uint8_t *data, size_t len, uint8_t *pattern, size_t plen)
 1327 {
 1328         const struct element *elem;
 1329         const uint8_t *p;
 1330         size_t ielen;
 1331 
 1332         p = data;
 1333         elem = (const struct element *)p;
 1334         ielen = len;
 1335         while (elem != NULL && ielen > 1) {
 1336                 if ((2 + elem->datalen) > ielen)
 1337                         /* Element overruns our memory. */
 1338                         return (NULL);
 1339                 if (elem->id == eid) {
 1340                         if (pattern == NULL)
 1341                                 return (elem);
 1342                         if (elem->datalen >= plen &&
 1343                             memcmp(elem->data, pattern, plen) == 0)
 1344                                 return (elem);
 1345                 }
 1346                 ielen -= 2 + elem->datalen;
 1347                 p += 2 + elem->datalen;
 1348                 elem = (const struct element *)p;
 1349         }
 1350 
 1351         return (NULL);
 1352 }
 1353 
 1354 static inline const struct element *
 1355 cfg80211_find_elem(enum ieee80211_eid eid, const uint8_t *data, size_t len)
 1356 {
 1357 
 1358         return (lkpi_cfg80211_find_elem_pattern(eid, data, len, NULL, 0));
 1359 }
 1360 
 1361 static inline const struct element *
 1362 ieee80211_bss_get_elem(struct cfg80211_bss *bss, uint32_t eid)
 1363 {
 1364 
 1365         if (bss->ies == NULL)
 1366                 return (NULL);
 1367         return (cfg80211_find_elem(eid, bss->ies->data, bss->ies->len));
 1368 }
 1369 
 1370 static inline const uint8_t *
 1371 ieee80211_bss_get_ie(struct cfg80211_bss *bss, uint32_t eid)
 1372 {
 1373 
 1374         return ((const uint8_t *)ieee80211_bss_get_elem(bss, eid));
 1375 }
 1376 
 1377 static inline uint8_t *
 1378 cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
 1379     uint8_t *data, size_t len)
 1380 {
 1381         const struct element *elem;
 1382         uint8_t pattern[4] = { oui << 16, oui << 8, oui, oui_type };
 1383         uint8_t plen = 4;               /* >= 3? oui_type always part of this? */
 1384         IMPROVE("plen currently always incl. oui_type");
 1385 
 1386         elem = lkpi_cfg80211_find_elem_pattern(IEEE80211_ELEMID_VENDOR,
 1387             data, len, pattern, plen);
 1388         if (elem == NULL)
 1389                 return (NULL);
 1390         return (__DECONST(uint8_t *, elem));
 1391 }
 1392 
 1393 static __inline uint32_t
 1394 cfg80211_calculate_bitrate(struct rate_info *rate)
 1395 {
 1396         TODO();
 1397         return (-1);
 1398 }
 1399 
 1400 static __inline uint32_t
 1401 ieee80211_channel_to_frequency(uint32_t channel, enum nl80211_band band)
 1402 {
 1403 
 1404         return (linuxkpi_ieee80211_channel_to_frequency(channel, band));
 1405 }
 1406 
 1407 static __inline uint32_t
 1408 ieee80211_frequency_to_channel(uint32_t freq)
 1409 {
 1410 
 1411         return (linuxkpi_ieee80211_frequency_to_channel(freq, 0));
 1412 }
 1413 
 1414 static __inline int
 1415 regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
 1416     struct linuxkpi_ieee80211_regdomain *regd)
 1417 {
 1418         IMPROVE();
 1419         return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd));
 1420 }
 1421 
 1422 static __inline int
 1423 regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
 1424     struct linuxkpi_ieee80211_regdomain *regd)
 1425 {
 1426 
 1427         IMPROVE();
 1428         return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd));
 1429 }
 1430 
 1431 static __inline int
 1432 regulatory_set_wiphy_regd(struct wiphy *wiphy,
 1433     struct linuxkpi_ieee80211_regdomain *regd)
 1434 {
 1435 
 1436         IMPROVE();
 1437         if (regd == NULL)
 1438                 return (EINVAL);
 1439 
 1440         /* XXX-BZ wild guessing here based on brcmfmac. */
 1441         if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED)
 1442                 wiphy->regd = regd;
 1443         else
 1444                 return (EPERM);
 1445 
 1446         /* XXX FIXME, do we have to do anything with reg_notifier? */
 1447         return (0);
 1448 }
 1449 
 1450 static __inline int
 1451 regulatory_hint(struct wiphy *wiphy, const uint8_t *alpha2)
 1452 {
 1453         TODO();
 1454         return (-ENXIO);
 1455 }
 1456 
 1457 static __inline const char *
 1458 reg_initiator_name(enum nl80211_reg_initiator initiator)
 1459 {
 1460         TODO();
 1461         return (NULL);
 1462 }
 1463 
 1464 static __inline struct linuxkpi_ieee80211_regdomain *
 1465 rtnl_dereference(const struct linuxkpi_ieee80211_regdomain *regd)
 1466 {
 1467         TODO();
 1468         return (NULL);
 1469 }
 1470 
 1471 static __inline struct ieee80211_reg_rule *
 1472 freq_reg_info(struct wiphy *wiphy, uint32_t center_freq)
 1473 {
 1474         TODO();
 1475         return (NULL);
 1476 }
 1477 
 1478 static __inline void
 1479 wiphy_apply_custom_regulatory(struct wiphy *wiphy,
 1480     const struct linuxkpi_ieee80211_regdomain *regd)
 1481 {
 1482         TODO();
 1483 }
 1484 
 1485 static __inline char *
 1486 wiphy_name(struct wiphy *wiphy)
 1487 {
 1488         if (wiphy != NULL && wiphy->dev != NULL)
 1489                 return dev_name(wiphy->dev);
 1490         else {
 1491                 IMPROVE("wlanNA");
 1492                 return ("wlanNA");
 1493         }
 1494 }
 1495 
 1496 static __inline void
 1497 wiphy_read_of_freq_limits(struct wiphy *wiphy)
 1498 {
 1499 #ifdef FDT
 1500         TODO();
 1501 #endif
 1502 }
 1503 
 1504 static __inline void
 1505 wiphy_ext_feature_set(struct wiphy *wiphy, enum nl80211_ext_feature ef)
 1506 {
 1507 
 1508         set_bit(ef, wiphy->ext_features);
 1509 }
 1510 
 1511 static __inline void *
 1512 wiphy_net(struct wiphy *wiphy)
 1513 {
 1514         TODO();
 1515         return (NULL);  /* XXX passed to dev_net_set() */
 1516 }
 1517 
 1518 static __inline int
 1519 wiphy_register(struct wiphy *wiphy)
 1520 {
 1521         TODO();
 1522         return (0);
 1523 }
 1524 
 1525 static __inline void
 1526 wiphy_unregister(struct wiphy *wiphy)
 1527 {
 1528         TODO();
 1529 }
 1530 
 1531 static __inline void
 1532 wiphy_warn(struct wiphy *wiphy, const char *fmt, ...)
 1533 {
 1534         TODO();
 1535 }
 1536 
 1537 static __inline int
 1538 cfg80211_check_combinations(struct wiphy *wiphy,
 1539     struct iface_combination_params *params)
 1540 {
 1541         TODO();
 1542         return (-ENOENT);
 1543 }
 1544 
 1545 static __inline uint8_t
 1546 cfg80211_classify8021d(struct sk_buff *skb, void *p)
 1547 {
 1548         TODO();
 1549         return (0);
 1550 }
 1551 
 1552 static __inline void
 1553 cfg80211_connect_done(struct net_device *ndev,
 1554     struct cfg80211_connect_resp_params *conn_params, gfp_t gfp)
 1555 {
 1556         TODO();
 1557 }
 1558 
 1559 static __inline void
 1560 cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp)
 1561 {
 1562         TODO();
 1563 }
 1564 
 1565 static __inline void
 1566 cfg80211_disconnected(struct net_device *ndev, uint16_t reason,
 1567     void *p, int x, bool locally_generated, gfp_t gfp)
 1568 {
 1569         TODO();
 1570 }
 1571 
 1572 static __inline int
 1573 cfg80211_get_p2p_attr(const u8 *ie, u32 ie_len,
 1574     enum ieee80211_p2p_attr_ids attr, u8 *p, size_t p_len)
 1575 {
 1576         TODO();
 1577         return (-1);
 1578 }
 1579 
 1580 static __inline void
 1581 cfg80211_ibss_joined(struct net_device *ndev, const uint8_t *addr,
 1582     struct linuxkpi_ieee80211_channel *chan, gfp_t gfp)
 1583 {
 1584         TODO();
 1585 }
 1586 
 1587 static __inline struct cfg80211_bss *
 1588 cfg80211_inform_bss(struct wiphy *wiphy,
 1589     struct linuxkpi_ieee80211_channel *channel,
 1590     enum cfg80211_bss_frame_type bss_ftype, const uint8_t *bss, int _x,
 1591     uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len,
 1592     int signal, gfp_t gfp)
 1593 {
 1594         TODO();
 1595         return (NULL);
 1596 }
 1597 
 1598 static __inline struct cfg80211_bss *
 1599 cfg80211_inform_bss_data(struct wiphy *wiphy,
 1600     struct cfg80211_inform_bss *bss_data,
 1601     enum cfg80211_bss_frame_type bss_ftype, const uint8_t *bss, int _x,
 1602     uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len, gfp_t gfp)
 1603 {
 1604         TODO();
 1605         return (NULL);
 1606 }
 1607 
 1608 static __inline void
 1609 cfg80211_mgmt_tx_status(struct wireless_dev *wdev, uint64_t cookie,
 1610     const u8 *buf, size_t len, bool ack, gfp_t gfp)
 1611 {
 1612         TODO();
 1613 }
 1614 
 1615 static __inline void
 1616 cfg80211_michael_mic_failure(struct net_device *ndev, const uint8_t *addr,
 1617     enum nl80211_key_type key_type, int _x, void *p, gfp_t gfp)
 1618 {
 1619         TODO();
 1620 }
 1621 
 1622 static __inline void
 1623 cfg80211_new_sta(struct net_device *ndev, const uint8_t *addr,
 1624     struct station_info *sinfo, gfp_t gfp)
 1625 {
 1626         TODO();
 1627 }
 1628 
 1629 static __inline void
 1630 cfg80211_del_sta(struct net_device *ndev, const uint8_t *addr, gfp_t gfp)
 1631 {
 1632         TODO();
 1633 }
 1634 
 1635 static __inline void
 1636 cfg80211_port_authorized(struct net_device *ndev, const uint8_t *bssid,
 1637     gfp_t gfp)
 1638 {
 1639         TODO();
 1640 }
 1641 
 1642 static __inline void
 1643 cfg80211_ready_on_channel(struct wireless_dev *wdev, uint64_t cookie,
 1644     struct linuxkpi_ieee80211_channel *channel, unsigned int duration,
 1645     gfp_t gfp)
 1646 {
 1647         TODO();
 1648 }
 1649 
 1650 static __inline void
 1651 cfg80211_remain_on_channel_expired(struct wireless_dev *wdev,
 1652     uint64_t cookie, struct linuxkpi_ieee80211_channel *channel, gfp_t gfp)
 1653 {
 1654         TODO();
 1655 }
 1656 
 1657 static __inline void
 1658 cfg80211_report_wowlan_wakeup(void)
 1659 {
 1660         TODO();
 1661 }
 1662 
 1663 static __inline void
 1664 cfg80211_roamed(struct net_device *ndev, struct cfg80211_roam_info *roam_info,
 1665     gfp_t gfp)
 1666 {
 1667         TODO();
 1668 }
 1669 
 1670 static __inline void
 1671 cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int _x,
 1672     uint8_t *p, size_t p_len, int _x2)
 1673 {
 1674         TODO();
 1675 }
 1676 
 1677 static __inline void
 1678 cfg80211_scan_done(struct cfg80211_scan_request *scan_request,
 1679     struct cfg80211_scan_info *info)
 1680 {
 1681         TODO();
 1682 }
 1683 
 1684 static __inline void
 1685 cfg80211_sched_scan_results(struct wiphy *wiphy, uint64_t reqid)
 1686 {
 1687         TODO();
 1688 }
 1689 
 1690 static __inline void
 1691 cfg80211_sched_scan_stopped(struct wiphy *wiphy, int _x)
 1692 {
 1693         TODO();
 1694 }
 1695 
 1696 static __inline void
 1697 cfg80211_unregister_wdev(struct wireless_dev *wdev)
 1698 {
 1699         TODO();
 1700 }
 1701 
 1702 static __inline struct sk_buff *
 1703 cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, unsigned int len)
 1704 {
 1705         TODO();
 1706         return (NULL);
 1707 }
 1708 
 1709 static __inline int
 1710 cfg80211_vendor_cmd_reply(struct sk_buff *skb)
 1711 {
 1712         TODO();
 1713         return (-ENXIO);
 1714 }
 1715 
 1716 static __inline struct linuxkpi_ieee80211_channel *
 1717 ieee80211_get_channel(struct wiphy *wiphy, uint32_t freq)
 1718 {
 1719 
 1720         return (linuxkpi_ieee80211_get_channel(wiphy, freq));
 1721 }
 1722 
 1723 static inline size_t
 1724 ieee80211_get_hdrlen_from_skb(struct sk_buff *skb)
 1725 {
 1726         const struct ieee80211_hdr *hdr;
 1727         size_t len;
 1728 
 1729         if (skb->len < 10)      /* sizeof(ieee80211_frame_[ack,cts]) */
 1730                 return (0);
 1731 
 1732         hdr = (const struct ieee80211_hdr *)skb->data;
 1733         len = ieee80211_hdrlen(hdr->frame_control);
 1734 
 1735         /* If larger than what is in the skb return. */
 1736         if (len > skb->len)
 1737                 return (0);
 1738 
 1739         return (len);
 1740 }
 1741 
 1742 static __inline bool
 1743 cfg80211_channel_is_psc(struct linuxkpi_ieee80211_channel *channel)
 1744 {
 1745 
 1746         /* Only 6Ghz. */
 1747         if (channel->band != NL80211_BAND_6GHZ)
 1748                 return (false);
 1749 
 1750         TODO();
 1751         return (false);
 1752 }
 1753 
 1754 static inline int
 1755 cfg80211_get_ies_channel_number(const uint8_t *ie, size_t len,
 1756     enum nl80211_band band, enum cfg80211_bss_frame_type ftype)
 1757 {
 1758         const struct element *elem;
 1759 
 1760         switch (band) {
 1761         case NL80211_BAND_6GHZ:
 1762                 TODO();
 1763                 break;
 1764         case NL80211_BAND_5GHZ:
 1765         case NL80211_BAND_2GHZ:
 1766                 /* DSPARAMS has the channel number. */
 1767                 elem = cfg80211_find_elem(IEEE80211_ELEMID_DSPARMS, ie, len);
 1768                 if (elem != NULL && elem->datalen == 1)
 1769                         return (elem->data[0]);
 1770                 /* HTINFO has the primary center channel. */
 1771                 elem = cfg80211_find_elem(IEEE80211_ELEMID_HTINFO, ie, len);
 1772                 if (elem != NULL &&
 1773                     elem->datalen >= (sizeof(struct ieee80211_ie_htinfo) - 2)) {
 1774                         const struct ieee80211_ie_htinfo *htinfo;
 1775                         htinfo = (const struct ieee80211_ie_htinfo *)elem;
 1776                         return (htinfo->hi_ctrlchannel);
 1777                 }
 1778                 /* What else? */
 1779                 break;
 1780         default:
 1781                 IMPROVE("Unsupported");
 1782                 break;
 1783         }
 1784         return (-1);
 1785 }
 1786 
 1787 /* Used for scanning at least. */
 1788 static __inline void
 1789 get_random_mask_addr(uint8_t *dst, const uint8_t *addr, const uint8_t *mask)
 1790 {
 1791         int i;
 1792 
 1793         /* Get a completely random address and then overlay what we want. */
 1794         get_random_bytes(dst, ETH_ALEN);
 1795         for (i = 0; i < ETH_ALEN; i++)
 1796                 dst[i] = (dst[i] & ~(mask[i])) | (addr[i] & mask[i]);
 1797 }
 1798 
 1799 static __inline void
 1800 cfg80211_shutdown_all_interfaces(struct wiphy *wiphy)
 1801 {
 1802         TODO();
 1803 }
 1804 
 1805 static __inline bool
 1806 cfg80211_reg_can_beacon(struct wiphy *wiphy, struct cfg80211_chan_def *chandef,
 1807     enum nl80211_iftype iftype)
 1808 {
 1809         TODO();
 1810         return (false);
 1811 }
 1812 
 1813 static __inline void
 1814 cfg80211_background_radar_event(struct wiphy *wiphy,
 1815     struct cfg80211_chan_def *chandef, gfp_t gfp)
 1816 {
 1817         TODO();
 1818 }
 1819 
 1820 static __inline const u8 *
 1821 cfg80211_find_ext_ie(uint8_t eid, uint8_t *p, size_t len)
 1822 {
 1823         TODO();
 1824         return (NULL);
 1825 }
 1826 
 1827 static __inline bool
 1828 cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef)
 1829 {
 1830         TODO();
 1831         return (false);
 1832 }
 1833 
 1834 #define wiphy_info(wiphy, fmt, ...)                                     \
 1835         printf("%s:%d XXX TODO " fmt, __func__, __LINE__, __VA_ARGS__)
 1836 
 1837 #ifndef LINUXKPI_NET80211
 1838 #define ieee80211_channel               linuxkpi_ieee80211_channel
 1839 #define ieee80211_regdomain             linuxkpi_ieee80211_regdomain
 1840 #endif
 1841 
 1842 #include <net/mac80211.h>
 1843 
 1844 #endif  /* _LINUXKPI_NET_CFG80211_H */

Cache object: 7e84ef5e530146f1512ef1258aac8061


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.