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/iwn/if_iwnvar.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*      $FreeBSD: releng/11.2/sys/dev/iwn/if_iwnvar.h 300732 2016-05-26 11:12:36Z avos $        */
    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 enum iwn_rxon_ctx_id {
   24                 IWN_RXON_BSS_CTX,
   25                 IWN_RXON_PAN_CTX,
   26                 IWN_NUM_RXON_CTX
   27 };
   28 
   29 struct iwn_pan_slot {
   30         uint16_t        time;
   31         uint8_t         type;
   32         uint8_t         reserved;
   33 } __packed;
   34 
   35 struct iwn_pan_params_cmd {
   36         uint16_t flags;
   37 #define IWN_PAN_PARAMS_FLG_SLOTTED_MODE (1 << 3)
   38 
   39         uint8_t reserved;
   40         uint8_t num_slots;
   41         struct iwn_pan_slot slots[10];
   42 } __packed;
   43 
   44 struct iwn_led_mode
   45 {
   46         uint8_t         led_cur_mode;
   47         uint64_t        led_cur_bt;
   48         uint64_t        led_last_bt;
   49         uint64_t        led_cur_tpt;
   50         uint64_t        led_last_tpt;
   51         uint64_t        led_bt_diff;
   52         int             led_cur_time;
   53         int             led_last_time;
   54 };
   55 
   56 struct iwn_rx_radiotap_header {
   57         struct ieee80211_radiotap_header wr_ihdr;
   58         uint64_t        wr_tsft;
   59         uint8_t         wr_flags;
   60         uint8_t         wr_rate;
   61         uint16_t        wr_chan_freq;
   62         uint16_t        wr_chan_flags;
   63         int8_t          wr_dbm_antsignal;
   64         int8_t          wr_dbm_antnoise;
   65 } __packed;
   66 
   67 #define IWN_RX_RADIOTAP_PRESENT                                         \
   68         ((1 << IEEE80211_RADIOTAP_TSFT) |                               \
   69          (1 << IEEE80211_RADIOTAP_FLAGS) |                              \
   70          (1 << IEEE80211_RADIOTAP_RATE) |                               \
   71          (1 << IEEE80211_RADIOTAP_CHANNEL) |                            \
   72          (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |                      \
   73          (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE))
   74 
   75 struct iwn_tx_radiotap_header {
   76         struct ieee80211_radiotap_header wt_ihdr;
   77         uint8_t         wt_flags;
   78         uint8_t         wt_rate;
   79         uint16_t        wt_chan_freq;
   80         uint16_t        wt_chan_flags;
   81 } __packed;
   82 
   83 #define IWN_TX_RADIOTAP_PRESENT                                         \
   84         ((1 << IEEE80211_RADIOTAP_FLAGS) |                              \
   85          (1 << IEEE80211_RADIOTAP_RATE) |                               \
   86          (1 << IEEE80211_RADIOTAP_CHANNEL))
   87 
   88 struct iwn_dma_info {
   89         bus_dma_tag_t           tag;
   90         bus_dmamap_t            map;
   91         bus_dma_segment_t       seg;
   92         bus_addr_t              paddr;
   93         caddr_t                 vaddr;
   94         bus_size_t              size;
   95 };
   96 
   97 struct iwn_tx_data {
   98         bus_dmamap_t            map;
   99         bus_addr_t              cmd_paddr;
  100         bus_addr_t              scratch_paddr;
  101         struct mbuf             *m;
  102         struct ieee80211_node   *ni;
  103 };
  104 
  105 struct iwn_tx_ring {
  106         struct iwn_dma_info     desc_dma;
  107         struct iwn_dma_info     cmd_dma;
  108         struct iwn_tx_desc      *desc;
  109         struct iwn_tx_cmd       *cmd;
  110         struct iwn_tx_data      data[IWN_TX_RING_COUNT];
  111         bus_dma_tag_t           data_dmat;
  112         int                     qid;
  113         int                     queued;
  114         int                     cur;
  115         int                     read;
  116 };
  117 
  118 struct iwn_softc;
  119 
  120 struct iwn_rx_data {
  121         struct mbuf     *m;
  122         bus_dmamap_t    map;
  123 };
  124 
  125 struct iwn_rx_ring {
  126         struct iwn_dma_info     desc_dma;
  127         struct iwn_dma_info     stat_dma;
  128         uint32_t                *desc;
  129         struct iwn_rx_status    *stat;
  130         struct iwn_rx_data      data[IWN_RX_RING_COUNT];
  131         bus_dma_tag_t           data_dmat;
  132         int                     cur;
  133 };
  134 
  135 struct iwn_node {
  136         struct  ieee80211_node          ni;     /* must be the first */
  137         uint16_t                        disable_tid;
  138         uint8_t                         id;
  139         struct {
  140                 uint64_t                bitmap;
  141                 int                     startidx;
  142                 int                     nframes;
  143         } agg[IEEE80211_TID_SIZE];
  144 };
  145 
  146 struct iwn_calib_state {
  147         uint8_t         state;
  148 #define IWN_CALIB_STATE_INIT    0
  149 #define IWN_CALIB_STATE_ASSOC   1
  150 #define IWN_CALIB_STATE_RUN     2
  151 
  152         u_int           nbeacons;
  153         uint32_t        noise[3];
  154         uint32_t        rssi[3];
  155         uint32_t        ofdm_x1;
  156         uint32_t        ofdm_mrc_x1;
  157         uint32_t        ofdm_x4;
  158         uint32_t        ofdm_mrc_x4;
  159         uint32_t        cck_x4;
  160         uint32_t        cck_mrc_x4;
  161         uint32_t        bad_plcp_ofdm;
  162         uint32_t        fa_ofdm;
  163         uint32_t        bad_plcp_cck;
  164         uint32_t        fa_cck;
  165         uint32_t        low_fa;
  166         uint32_t        bad_plcp_ht;
  167         uint8_t         cck_state;
  168 #define IWN_CCK_STATE_INIT      0
  169 #define IWN_CCK_STATE_LOFA      1
  170 #define IWN_CCK_STATE_HIFA      2
  171 
  172         uint8_t         noise_samples[20];
  173         u_int           cur_noise_sample;
  174         uint8_t         noise_ref;
  175         uint32_t        energy_samples[10];
  176         u_int           cur_energy_sample;
  177         uint32_t        energy_cck;
  178 };
  179 
  180 struct iwn_calib_info {
  181         uint8_t         *buf;
  182         u_int           len;
  183 };
  184 
  185 struct iwn_fw_part {
  186         const uint8_t   *text;
  187         uint32_t        textsz;
  188         const uint8_t   *data;
  189         uint32_t        datasz;
  190 };
  191 
  192 struct iwn_fw_info {
  193         const uint8_t           *data;
  194         size_t                  size;
  195         struct iwn_fw_part      init;
  196         struct iwn_fw_part      main;
  197         struct iwn_fw_part      boot;
  198 };
  199 
  200 struct iwn_ops {
  201         int             (*load_firmware)(struct iwn_softc *);
  202         void            (*read_eeprom)(struct iwn_softc *);
  203         int             (*post_alive)(struct iwn_softc *);
  204         int             (*nic_config)(struct iwn_softc *);
  205         void            (*update_sched)(struct iwn_softc *, int, int, uint8_t,
  206                             uint16_t);
  207         int             (*get_temperature)(struct iwn_softc *);
  208         int             (*get_rssi)(struct iwn_softc *, struct iwn_rx_stat *);
  209         int             (*set_txpower)(struct iwn_softc *,
  210                             struct ieee80211_channel *, int);
  211         int             (*init_gains)(struct iwn_softc *);
  212         int             (*set_gains)(struct iwn_softc *);
  213         int             (*add_node)(struct iwn_softc *, struct iwn_node_info *,
  214                             int);
  215         void            (*tx_done)(struct iwn_softc *, struct iwn_rx_desc *,
  216                             struct iwn_rx_data *);
  217         void            (*ampdu_tx_start)(struct iwn_softc *,
  218                             struct ieee80211_node *, int, uint8_t, uint16_t);
  219         void            (*ampdu_tx_stop)(struct iwn_softc *, int, uint8_t,
  220                             uint16_t);
  221 };
  222 
  223 struct iwn_vap {
  224         struct ieee80211vap     iv_vap;
  225         uint8_t                 iv_ridx;
  226 
  227         int                     (*iv_newstate)(struct ieee80211vap *,
  228                                     enum ieee80211_state, int);
  229         int                     ctx;
  230         int                     beacon_int;
  231 
  232 };
  233 #define IWN_VAP(_vap)   ((struct iwn_vap *)(_vap))
  234 
  235 struct iwn_softc {
  236         device_t                sc_dev;
  237         int                     sc_debug;
  238         struct cdev             *sc_cdev;
  239         struct mtx              sc_mtx;
  240         struct ieee80211com     sc_ic;
  241 
  242         u_int                   sc_flags;
  243 #define IWN_FLAG_HAS_OTPROM     (1 << 1)
  244 #define IWN_FLAG_CALIB_DONE     (1 << 2)
  245 #define IWN_FLAG_USE_ICT        (1 << 3)
  246 #define IWN_FLAG_INTERNAL_PA    (1 << 4)
  247 #define IWN_FLAG_HAS_11N        (1 << 6)
  248 #define IWN_FLAG_ENH_SENS       (1 << 7)
  249 #define IWN_FLAG_ADV_BTCOEX     (1 << 8)
  250 #define IWN_FLAG_PAN_SUPPORT    (1 << 9)
  251 #define IWN_FLAG_BTCOEX         (1 << 10)
  252 #define IWN_FLAG_RUNNING        (1 << 11)
  253 
  254         uint8_t                 hw_type;
  255         /* subdevice_id used to adjust configuration */
  256         uint16_t                subdevice_id;
  257 
  258         struct iwn_ops          ops;
  259         const char              *fwname;
  260         const struct iwn_sensitivity_limits
  261                                 *limits;
  262         int                     ntxqs;
  263         int                     firstaggqueue;
  264         int                     ndmachnls;
  265         uint8_t                 broadcast_id;
  266         int                     rxonsz;
  267         int                     schedsz;
  268         uint32_t                fw_text_maxsz;
  269         uint32_t                fw_data_maxsz;
  270         uint32_t                fwsz;
  271         bus_size_t              sched_txfact_addr;
  272         uint32_t                reset_noise_gain;
  273         uint32_t                noise_gain;
  274 
  275         /* TX scheduler rings. */
  276         struct iwn_dma_info     sched_dma;
  277         uint16_t                *sched;
  278         uint32_t                sched_base;
  279 
  280         /* "Keep Warm" page. */
  281         struct iwn_dma_info     kw_dma;
  282 
  283         /* Firmware image. */
  284         const struct firmware   *fw_fp;
  285 
  286         /* Firmware DMA transfer. */
  287         struct iwn_dma_info     fw_dma;
  288 
  289         /* ICT table. */
  290         struct iwn_dma_info     ict_dma;
  291         uint32_t                *ict;
  292         int                     ict_cur;
  293 
  294         /* TX/RX rings. */
  295         struct iwn_tx_ring      txq[IWN5000_NTXQUEUES];
  296         struct iwn_rx_ring      rxq;
  297 
  298         struct resource         *mem;
  299         bus_space_tag_t         sc_st;
  300         bus_space_handle_t      sc_sh;
  301         struct resource         *irq;
  302         void                    *sc_ih;
  303         bus_size_t              sc_sz;
  304         int                     sc_cap_off;     /* PCIe Capabilities. */
  305 
  306         /* Tasks used by the driver */
  307         struct task             sc_radioon_task;
  308         struct task             sc_radiooff_task;
  309         struct task             sc_panic_task;
  310         struct task             sc_xmit_task;
  311 
  312         /* Taskqueue */
  313         struct taskqueue        *sc_tq;
  314 
  315         /* Calibration information */
  316         struct callout          calib_to;
  317         int                     calib_cnt;
  318         struct iwn_calib_state  calib;
  319         int                     last_calib_ticks;
  320         struct callout          scan_timeout;
  321         struct callout          watchdog_to;
  322         struct iwn_fw_info      fw;
  323         struct iwn_calib_info   calibcmd[IWN5000_PHY_CALIB_MAX_RESULT];
  324         uint32_t                errptr;
  325 
  326         struct iwn_rx_stat      last_rx_stat;
  327         int                     last_rx_valid;
  328         struct iwn_ucode_info   ucode_info;
  329         struct iwn_rxon         rx_on[IWN_NUM_RXON_CTX];
  330         struct iwn_rxon         *rxon;
  331         int                     ctx;
  332         struct ieee80211vap     *ivap[IWN_NUM_RXON_CTX];
  333 
  334         /* General statistics */
  335         /*
  336          * The statistics are reset after each channel
  337          * change.  So it may be zeroed after things like
  338          * a background scan.
  339          *
  340          * So for now, this is just a cheap hack to
  341          * expose the last received statistics dump
  342          * via an ioctl().  Later versions of this
  343          * could expose the last 'n' messages, or just
  344          * provide a pipeline for the firmware responses
  345          * via something like BPF.
  346          */
  347         struct iwn_stats        last_stat;
  348         int                     last_stat_valid;
  349 
  350         uint8_t                 uc_scan_progress;
  351         uint32_t                rawtemp;
  352         int                     temp;
  353         int                     noise;
  354         uint32_t                qfullmsk;
  355 
  356         uint32_t                prom_base;
  357         struct iwn4965_eeprom_band
  358                                 bands[IWN_NBANDS];
  359         struct iwn_eeprom_chan  eeprom_channels[IWN_NBANDS][IWN_MAX_CHAN_PER_BAND];
  360         uint16_t                rfcfg;
  361         uint8_t                 calib_ver;
  362         char                    eeprom_domain[4];
  363         uint32_t                eeprom_crystal;
  364         int16_t                 eeprom_temp;
  365         int16_t                 eeprom_temp_high;
  366         int16_t                 eeprom_voltage;
  367         int8_t                  maxpwr2GHz;
  368         int8_t                  maxpwr5GHz;
  369         int8_t                  maxpwr[IEEE80211_CHAN_MAX];
  370 
  371         uint32_t                tlv_feature_flags;
  372 
  373         int32_t                 temp_off;
  374         uint32_t                int_mask;
  375         uint8_t                 ntxchains;
  376         uint8_t                 nrxchains;
  377         uint8_t                 txchainmask;
  378         uint8_t                 rxchainmask;
  379         uint8_t                 chainmask;
  380 
  381         int                     sc_tx_timer;
  382 
  383         /* Are we doing a scan? */
  384         int                     sc_is_scanning;
  385 
  386         /* Are we waiting for a beacon before xmit? */
  387         int                     sc_beacon_wait;
  388 
  389         struct ieee80211_tx_ampdu *qid2tap[IWN5000_NTXQUEUES];
  390 
  391         int                     (*sc_ampdu_rx_start)(struct ieee80211_node *,
  392                                     struct ieee80211_rx_ampdu *, int, int, int);
  393         void                    (*sc_ampdu_rx_stop)(struct ieee80211_node *,
  394                                     struct ieee80211_rx_ampdu *);
  395         int                     (*sc_addba_request)(struct ieee80211_node *,
  396                                     struct ieee80211_tx_ampdu *, int, int, int);
  397         int                     (*sc_addba_response)(struct ieee80211_node *,
  398                                     struct ieee80211_tx_ampdu *, int, int, int);
  399         void                    (*sc_addba_stop)(struct ieee80211_node *,
  400                                     struct ieee80211_tx_ampdu *);
  401 
  402         struct  iwn_led_mode sc_led;
  403 
  404         struct iwn_rx_radiotap_header sc_rxtap;
  405         struct iwn_tx_radiotap_header sc_txtap;
  406 
  407         /* The power save level originally configured by user */
  408         int                     desired_pwrsave_level;
  409 
  410         /*
  411          * The current power save level, this may differ from the
  412          * configured value due to thermal throttling etc.
  413          */
  414         int                     current_pwrsave_level;
  415 
  416         /* For specific params */
  417         const struct iwn_base_params *base_params;
  418 
  419 #define IWN_UCODE_API(ver)      (((ver) & 0x0000FF00) >> 8)
  420         uint32_t                ucode_rev;
  421 
  422         /*
  423          * Global queue for queuing xmit frames
  424          * when we can't yet transmit (eg raw
  425          * frames whilst waiting for beacons.)
  426          */
  427         struct mbufq            sc_xmit_queue;
  428 };
  429 
  430 #define IWN_LOCK_INIT(_sc) \
  431         mtx_init(&(_sc)->sc_mtx, device_get_nameunit((_sc)->sc_dev), \
  432             MTX_NETWORK_LOCK, MTX_DEF)
  433 #define IWN_LOCK(_sc)                   mtx_lock(&(_sc)->sc_mtx)
  434 #define IWN_LOCK_ASSERT(_sc)            mtx_assert(&(_sc)->sc_mtx, MA_OWNED)
  435 #define IWN_UNLOCK(_sc)                 mtx_unlock(&(_sc)->sc_mtx)
  436 #define IWN_LOCK_DESTROY(_sc)           mtx_destroy(&(_sc)->sc_mtx)

Cache object: eb06773ad7fe7345652304c77a3d7345


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