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/dev/netif/iwn/if_iwnvar.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 /*      $FreeBSD: head/sys/dev/iwn/if_iwnvar.h 258035 2013-11-12 05:58:23Z adrian $     */
    2 /*      $OpenBSD: if_iwnvar.h,v 1.18 2010/04/30 16:06:46 damien Exp $   */
    3 
    4 /*-
    5  * Copyright (c) 2013 Cedric GROSS <cg@cgross.info>
    6  * Copyright (c) 2011 Intel Corporation
    7  * Copyright (c) 2007, 2008
    8  *      Damien Bergamini <damien.bergamini@free.fr>
    9  * Copyright (c) 2008 Sam Leffler, Errno Consulting
   10  *
   11  * Permission to use, copy, modify, and distribute this software for any
   12  * purpose with or without fee is hereby granted, provided that the above
   13  * copyright notice and this permission notice appear in all copies.
   14  *
   15  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
   16  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
   17  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
   18  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   19  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
   20  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
   21  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   22  */
   23 
   24 #include <netproto/802_11/ieee80211_amrr.h>
   25 
   26 enum iwn_rxon_ctx_id {
   27                 IWN_RXON_BSS_CTX,
   28                 IWN_RXON_PAN_CTX,
   29                 IWN_NUM_RXON_CTX
   30 };
   31 
   32 struct iwn_pan_slot {
   33         uint16_t        time;
   34         uint8_t         type;
   35         uint8_t         reserved;
   36 } __packed;
   37 
   38 struct iwn_pan_params_cmd {
   39         uint16_t flags;
   40 #define IWN_PAN_PARAMS_FLG_SLOTTED_MODE (1 << 3)
   41 
   42         uint8_t reserved;
   43         uint8_t num_slots;
   44         struct iwn_pan_slot slots[10];
   45 } __packed;
   46 
   47 struct iwn_led_mode
   48 {
   49         uint8_t         led_cur_mode;
   50         uint64_t        led_cur_bt;
   51         uint64_t        led_last_bt;
   52         uint64_t        led_cur_tpt;
   53         uint64_t        led_last_tpt;
   54         uint64_t        led_bt_diff;
   55         int             led_cur_time;
   56         int             led_last_time;
   57 };
   58 
   59 struct iwn_rx_radiotap_header {
   60         struct ieee80211_radiotap_header wr_ihdr;
   61         uint64_t        wr_tsft;
   62         uint8_t         wr_flags;
   63         uint8_t         wr_rate;
   64         uint16_t        wr_chan_freq;
   65         uint16_t        wr_chan_flags;
   66         int8_t          wr_dbm_antsignal;
   67         int8_t          wr_dbm_antnoise;
   68 } __packed;
   69 
   70 #define IWN_RX_RADIOTAP_PRESENT                                         \
   71         ((1 << IEEE80211_RADIOTAP_TSFT) |                               \
   72          (1 << IEEE80211_RADIOTAP_FLAGS) |                              \
   73          (1 << IEEE80211_RADIOTAP_RATE) |                               \
   74          (1 << IEEE80211_RADIOTAP_CHANNEL) |                            \
   75          (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |                      \
   76          (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE))
   77 
   78 struct iwn_tx_radiotap_header {
   79         struct ieee80211_radiotap_header wt_ihdr;
   80         uint8_t         wt_flags;
   81         uint8_t         wt_rate;
   82         uint16_t        wt_chan_freq;
   83         uint16_t        wt_chan_flags;
   84 } __packed;
   85 
   86 #define IWN_TX_RADIOTAP_PRESENT                                         \
   87         ((1 << IEEE80211_RADIOTAP_FLAGS) |                              \
   88          (1 << IEEE80211_RADIOTAP_RATE) |                               \
   89          (1 << IEEE80211_RADIOTAP_CHANNEL))
   90 
   91 struct iwn_dma_info {
   92         bus_dma_tag_t           tag;
   93         bus_dmamap_t            map;
   94         bus_dma_segment_t       seg;
   95         bus_addr_t              paddr;
   96         caddr_t                 vaddr;
   97         bus_size_t              size;
   98 };
   99 
  100 struct iwn_tx_data {
  101         bus_dmamap_t            map;
  102         bus_addr_t              cmd_paddr;
  103         bus_addr_t              scratch_paddr;
  104         struct mbuf             *m;
  105         struct ieee80211_node   *ni;
  106 };
  107 
  108 struct iwn_tx_ring {
  109         struct iwn_dma_info     desc_dma;
  110         struct iwn_dma_info     cmd_dma;
  111         struct iwn_tx_desc      *desc;
  112         struct iwn_tx_cmd       *cmd;
  113         struct iwn_tx_data      data[IWN_TX_RING_COUNT];
  114         bus_dma_tag_t           data_dmat;
  115         int                     qid;
  116         int                     queued;
  117         int                     cur;
  118         int                     read;
  119 };
  120 
  121 struct iwn_amrr {
  122         struct                  ieee80211_node ni;      /* must be the first */
  123         int                     txcnt;
  124         int                     retrycnt;
  125         int                     success;
  126         int                     success_threshold;
  127         int                     recovery;
  128 };
  129 
  130 struct iwn_softc;
  131 
  132 struct iwn_rx_data {
  133         struct mbuf     *m;
  134         bus_dmamap_t    map;
  135 };
  136 
  137 struct iwn_rx_ring {
  138         struct iwn_dma_info     desc_dma;
  139         struct iwn_dma_info     stat_dma;
  140         uint32_t                *desc;
  141         struct iwn_rx_status    *stat;
  142         struct iwn_rx_data      data[IWN_RX_RING_COUNT];
  143         bus_dma_tag_t           data_dmat;
  144         int                     cur;
  145 };
  146 
  147 struct iwn_node {
  148         struct  ieee80211_node          ni;     /* must be the first */
  149         uint16_t                        disable_tid;
  150         uint8_t                         id;
  151         struct {
  152                 uint64_t                bitmap;
  153                 int                     startidx;
  154                 int                     nframes;
  155         } agg[IEEE80211_TID_SIZE];
  156         struct  ieee80211_amrr_node     amn;
  157 };
  158 
  159 struct iwn_calib_state {
  160         uint8_t         state;
  161 #define IWN_CALIB_STATE_INIT    0
  162 #define IWN_CALIB_STATE_ASSOC   1
  163 #define IWN_CALIB_STATE_RUN     2
  164 
  165         u_int           nbeacons;
  166         uint32_t        noise[3];
  167         uint32_t        rssi[3];
  168         uint32_t        ofdm_x1;
  169         uint32_t        ofdm_mrc_x1;
  170         uint32_t        ofdm_x4;
  171         uint32_t        ofdm_mrc_x4;
  172         uint32_t        cck_x4;
  173         uint32_t        cck_mrc_x4;
  174         uint32_t        bad_plcp_ofdm;
  175         uint32_t        fa_ofdm;
  176         uint32_t        bad_plcp_cck;
  177         uint32_t        fa_cck;
  178         uint32_t        low_fa;
  179         uint8_t         cck_state;
  180 #define IWN_CCK_STATE_INIT      0
  181 #define IWN_CCK_STATE_LOFA      1
  182 #define IWN_CCK_STATE_HIFA      2
  183 
  184         uint8_t         noise_samples[20];
  185         u_int           cur_noise_sample;
  186         uint8_t         noise_ref;
  187         uint32_t        energy_samples[10];
  188         u_int           cur_energy_sample;
  189         uint32_t        energy_cck;
  190 };
  191 
  192 struct iwn_calib_info {
  193         uint8_t         *buf;
  194         u_int           len;
  195 };
  196 
  197 struct iwn_fw_part {
  198         const uint8_t   *text;
  199         uint32_t        textsz;
  200         const uint8_t   *data;
  201         uint32_t        datasz;
  202 };
  203 
  204 struct iwn_fw_info {
  205         const uint8_t           *data;
  206         size_t                  size;
  207         struct iwn_fw_part      init;
  208         struct iwn_fw_part      main;
  209         struct iwn_fw_part      boot;
  210 };
  211 
  212 struct iwn_ops {
  213         int             (*load_firmware)(struct iwn_softc *);
  214         void            (*read_eeprom)(struct iwn_softc *);
  215         int             (*post_alive)(struct iwn_softc *);
  216         int             (*nic_config)(struct iwn_softc *);
  217         void            (*update_sched)(struct iwn_softc *, int, int, uint8_t,
  218                             uint16_t);
  219         int             (*get_temperature)(struct iwn_softc *);
  220         int             (*get_rssi)(struct iwn_softc *, struct iwn_rx_stat *);
  221         int             (*set_txpower)(struct iwn_softc *,
  222                             struct ieee80211_channel *, int);
  223         int             (*init_gains)(struct iwn_softc *);
  224         int             (*set_gains)(struct iwn_softc *);
  225         int             (*add_node)(struct iwn_softc *, struct iwn_node_info *,
  226                             int);
  227         void            (*tx_done)(struct iwn_softc *, struct iwn_rx_desc *,
  228                             struct iwn_rx_data *);
  229         void            (*ampdu_tx_start)(struct iwn_softc *,
  230                             struct ieee80211_node *, int, uint8_t, uint16_t);
  231         void            (*ampdu_tx_stop)(struct iwn_softc *, int, uint8_t,
  232                             uint16_t);
  233 };
  234 
  235 struct iwn_vap {
  236         struct ieee80211vap     iv_vap;
  237         uint8_t                 iv_ridx;
  238 
  239         int                     (*iv_newstate)(struct ieee80211vap *,
  240                                     enum ieee80211_state, int);
  241         struct  ieee80211_amrr_node     iv_amrr;
  242         int                     ctx;
  243         int                     beacon_int;
  244         uint8_t         macaddr[IEEE80211_ADDR_LEN];
  245 
  246 };
  247 #define IWN_VAP(_vap)   ((struct iwn_vap *)(_vap))
  248 
  249 struct iwn_softc {
  250         struct arpcom           arpcom;
  251         device_t                sc_dev;
  252 
  253         struct ifnet            *sc_ifp;
  254         int                     sc_debug;
  255 
  256         struct mtx              sc_mtx;
  257 
  258         u_int                   sc_flags;
  259 #define IWN_FLAG_HAS_OTPROM     (1 << 1)
  260 #define IWN_FLAG_CALIB_DONE     (1 << 2)
  261 #define IWN_FLAG_USE_ICT        (1 << 3)
  262 #define IWN_FLAG_INTERNAL_PA    (1 << 4)
  263 #define IWN_FLAG_HAS_11N        (1 << 6)
  264 #define IWN_FLAG_ENH_SENS       (1 << 7)
  265 #define IWN_FLAG_ADV_BTCOEX     (1 << 8)
  266 #define IWN_FLAG_PAN_SUPPORT    (1 << 9)
  267 #define IWN_FLAG_BTCOEX         (1 << 10)
  268 
  269         uint8_t                 hw_type;
  270         /* subdevice_id used to adjust configuration */
  271         uint16_t                subdevice_id;
  272 
  273         struct iwn_ops          ops;
  274         const char              *fwname;
  275         const struct iwn_sensitivity_limits
  276                                 *limits;
  277         int                     ntxqs;
  278         int                     firstaggqueue;
  279         int                     ndmachnls;
  280         uint8_t                 broadcast_id;
  281         int                     rxonsz;
  282         int                     schedsz;
  283         uint32_t                fw_text_maxsz;
  284         uint32_t                fw_data_maxsz;
  285         uint32_t                fwsz;
  286         bus_size_t              sched_txfact_addr;
  287         uint32_t                reset_noise_gain;
  288         uint32_t                noise_gain;
  289 
  290         /* TX scheduler rings. */
  291         struct iwn_dma_info     sched_dma;
  292         uint16_t                *sched;
  293         uint32_t                sched_base;
  294 
  295         /* "Keep Warm" page. */
  296         struct iwn_dma_info     kw_dma;
  297 
  298         /* Firmware image. */
  299         const struct firmware   *fw_fp;
  300 
  301         /* Firmware DMA transfer. */
  302         struct iwn_dma_info     fw_dma;
  303 
  304         /* ICT table. */
  305         struct iwn_dma_info     ict_dma;
  306         uint32_t                *ict;
  307         int                     ict_cur;
  308 
  309         /* TX/RX rings. */
  310         struct iwn_tx_ring      txq[IWN5000_NTXQUEUES];
  311         struct iwn_rx_ring      rxq;
  312 
  313         int                     mem_rid;
  314         struct resource         *mem;
  315         bus_space_tag_t         sc_st;
  316         bus_space_handle_t      sc_sh;
  317         int                     irq_rid;
  318         struct resource         *irq;
  319         bus_dma_tag_t           sc_dmat;
  320         void                    *sc_ih;
  321         bus_size_t              sc_sz;
  322         int                     sc_cap_off;     /* PCIe Capabilities. */
  323 
  324         /* Tasks used by the driver */
  325         struct task             sc_reinit_task;
  326         struct task             sc_radioon_task;
  327         struct task             sc_radiooff_task;
  328 
  329         struct callout          calib_to;
  330         int                     calib_cnt;
  331         struct iwn_calib_state  calib;
  332         struct callout          watchdog_to;
  333         struct callout          ct_kill_exit_to;
  334         struct iwn_fw_info      fw;
  335         struct iwn_calib_info   calibcmd[IWN5000_PHY_CALIB_MAX_RESULT];
  336         uint32_t                errptr;
  337 
  338         struct iwn_rx_stat      last_rx_stat;
  339         int                     last_rx_valid;
  340         struct iwn_ucode_info   ucode_info;
  341         struct iwn_rxon         rx_on[IWN_NUM_RXON_CTX];
  342         struct iwn_rxon         *rxon;
  343         int                     ctx;
  344         struct ieee80211vap     *ivap[IWN_NUM_RXON_CTX];
  345 
  346         uint8_t                 uc_scan_progress;
  347         uint32_t                rawtemp;
  348         int                     temp;
  349         int                     noise;
  350         uint32_t                qfullmsk;
  351 
  352         uint32_t                prom_base;
  353         struct iwn4965_eeprom_band
  354                                 bands[IWN_NBANDS];
  355         struct iwn_eeprom_chan  eeprom_channels[IWN_NBANDS][IWN_MAX_CHAN_PER_BAND];
  356         uint16_t                rfcfg;
  357         uint8_t                 calib_ver;
  358         char                    eeprom_domain[4];
  359         uint32_t                eeprom_crystal;
  360         int16_t                 eeprom_temp;
  361         int16_t                 eeprom_temp_high;
  362         int16_t                 eeprom_voltage;
  363         int8_t                  maxpwr2GHz;
  364         int8_t                  maxpwr5GHz;
  365         int8_t                  maxpwr[IEEE80211_CHAN_MAX];
  366 
  367         uint32_t                tlv_feature_flags;
  368 
  369         int32_t                 temp_off;
  370         uint32_t                int_mask;
  371         uint8_t                 ntxchains;
  372         uint8_t                 nrxchains;
  373         uint8_t                 txchainmask;
  374         uint8_t                 rxchainmask;
  375         uint8_t                 chainmask;
  376 
  377         int                     sc_tx_timer;
  378         int                     sc_scan_timer;
  379 
  380         /* Are we doing a scan? */
  381         int                     sc_is_scanning;
  382 
  383         struct ieee80211_tx_ampdu *qid2tap[IWN5000_NTXQUEUES];
  384 
  385         int                     (*sc_ampdu_rx_start)(struct ieee80211_node *,
  386                                     struct ieee80211_rx_ampdu *, int, int, int);
  387         void                    (*sc_ampdu_rx_stop)(struct ieee80211_node *,
  388                                     struct ieee80211_rx_ampdu *);
  389         int                     (*sc_addba_request)(struct ieee80211_node *,
  390                                     struct ieee80211_tx_ampdu *, int, int, int);
  391         int                     (*sc_addba_response)(struct ieee80211_node *,
  392                                     struct ieee80211_tx_ampdu *, int, int, int);
  393         void                    (*sc_addba_stop)(struct ieee80211_node *,
  394                                     struct ieee80211_tx_ampdu *);
  395 
  396         struct  iwn_led_mode sc_led;
  397 
  398         struct iwn_rx_radiotap_header sc_rxtap;
  399         struct iwn_tx_radiotap_header sc_txtap;
  400 
  401         /* The power save level originally configured by user */
  402         int                     desired_pwrsave_level;
  403 
  404         /*
  405          * The current power save level, this may differ from the
  406          * configured value due to thermal throttling etc.
  407          */
  408         int                     current_pwrsave_level;
  409 
  410         /* For specific params */
  411         const struct iwn_base_params *base_params;
  412         struct sysctl_ctx_list  sc_sysctl_ctx;
  413         struct sysctl_oid       *sc_sysctl_tree;
  414 };

Cache object: 8de4b90c3a6c86b8d4a36f10d882a0e2


[ 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.