[BACK]Return to pgtvar.h CVS log [TXT][DIR] Up to [local] / sys / dev / ic

Annotation of sys/dev/ic/pgtvar.h, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: pgtvar.h,v 1.11 2006/10/09 21:04:05 mglocker Exp $  */
        !             2:
        !             3: /*
        !             4:  * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
        !             5:  * Copyright (c) 2006 Marcus Glocker <mglocker@openbsd.org>
        !             6:  *
        !             7:  * Permission to use, copy, modify, and distribute this software for any
        !             8:  * purpose with or without fee is hereby granted, provided that the above
        !             9:  * copyright notice and this permission notice appear in all copies.
        !            10:  *
        !            11:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
        !            12:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
        !            13:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
        !            14:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
        !            15:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
        !            16:  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
        !            17:  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
        !            18:  */
        !            19:
        !            20: /*
        !            21:  * Copyright (c) 2004 Fujitsu Laboratories of America, Inc.
        !            22:  * Copyright (c) 2004 Brian Fundakowski Feldman
        !            23:  * All rights reserved.
        !            24:  *
        !            25:  * Redistribution and use in source and binary forms, with or without
        !            26:  * modification, are permitted provided that the following conditions
        !            27:  * are met:
        !            28:  * 1. Redistributions of source code must retain the above copyright
        !            29:  *    notice, this list of conditions and the following disclaimer.
        !            30:  * 2. Redistributions in binary form must reproduce the above copyright
        !            31:  *    notice, this list of conditions and the following disclaimer in the
        !            32:  *    documentation and/or other materials provided with the distribution.
        !            33:  *
        !            34:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
        !            35:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            36:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            37:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
        !            38:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            39:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            40:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            41:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            42:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            43:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            44:  * SUCH DAMAGE.
        !            45:  */
        !            46:
        !            47: #ifndef __PGTVAR_H__
        !            48: #define __PGTVAR_H__
        !            49:
        !            50: #define PGT_RX_RADIOTAP_PRESENT                                                \
        !            51:        ((1 << IEEE80211_RADIOTAP_FLAGS) |                              \
        !            52:         (1 << IEEE80211_RADIOTAP_CHANNEL) |                            \
        !            53:         (1 << IEEE80211_RADIOTAP_RSSI))
        !            54:
        !            55: struct pgt_rx_radiotap_hdr {
        !            56:        struct ieee80211_radiotap_header        wr_ihdr;
        !            57:        uint8_t                                 wr_flags;
        !            58:        uint16_t                                wr_chan_freq;
        !            59:        uint16_t                                wr_chan_flags;
        !            60:        uint8_t                                 wr_rssi;
        !            61:        uint8_t                                 wr_max_rssi;
        !            62: } __packed;
        !            63:
        !            64: #define PGT_TX_RADIOTAP_PRESENT                                                \
        !            65:        ((1 << IEEE80211_RADIOTAP_FLAGS) |                              \
        !            66:         (1 << IEEE80211_RADIOTAP_RATE) |                               \
        !            67:         (1 << IEEE80211_RADIOTAP_CHANNEL))
        !            68:
        !            69: struct pgt_tx_radiotap_hdr {
        !            70:        struct ieee80211_radiotap_header        wt_ihdr;
        !            71:        uint8_t                                 wt_flags;
        !            72:        uint8_t                                 wt_rate;
        !            73:        uint16_t                                wt_chan_freq;
        !            74:        uint16_t                                wt_chan_flags;
        !            75: } __packed;
        !            76:
        !            77: /*
        !            78:  * The struct pgt_desc is used to either enqueue or dequeue pgt_frags
        !            79:  * (packets) when either free or in flight.
        !            80:  */
        !            81: struct pgt_desc {
        !            82:        TAILQ_ENTRY(pgt_desc)   pd_link;
        !            83:        void                   *pd_mem;
        !            84:        bus_addr_t              pd_dmaaddr;
        !            85:        bus_dmamap_t            pd_dmam;
        !            86:        bus_dma_segment_t       pd_dmas;
        !            87:        struct pgt_frag        *pd_fragp;
        !            88:        unsigned int            pd_fragnum;
        !            89: };
        !            90: TAILQ_HEAD(pgt_descq, pgt_desc);
        !            91:
        !            92: /*
        !            93:  * The struct pgt_mgmt_desc is used to enqueue a management request
        !            94:  * and await response.
        !            95:  */
        !            96: struct pgt_mgmt_desc {
        !            97:        TAILQ_ENTRY(pgt_mgmt_desc)      pmd_link;
        !            98:        const void                     *pmd_sendbuf;    /* NULL = get op */
        !            99:        void                           *pmd_recvbuf;    /* NULL = set op */
        !           100:        size_t                          pmd_len;
        !           101:        uint32_t                        pmd_oid;
        !           102:        int                             pmd_error;
        !           103: };
        !           104: TAILQ_HEAD(pgt_mgmt_descq, pgt_mgmt_desc);
        !           105:
        !           106: /*
        !           107:  * These events are put on the per-device kthread to be
        !           108:  * able to trigger actions from inside the interrupt; as most
        !           109:  * operations require waiting for another interrupt for response
        !           110:  * (that is, management packets), this is common.
        !           111:  */
        !           112: struct pgt_async_trap {
        !           113:        TAILQ_ENTRY(pgt_async_trap)     pa_link;
        !           114:        struct mbuf                    *pa_mbuf;
        !           115:        /* followed by the rest of the mbuf data */
        !           116: };
        !           117:
        !           118: struct pgt_ieee80211_node {
        !           119:        struct ieee80211_node   pin_node;
        !           120:        enum pin_dot1x_authorization {
        !           121:                PIN_DOT1X_UNAUTHORIZED,
        !           122:                PIN_DOT1X_AUTHORIZED
        !           123:        }                       pin_dot1x_auth_desired, pin_dot1x_auth;
        !           124:        uint16_t                pin_mlme_state;
        !           125: };
        !           126:
        !           127: struct pgt_softc {
        !           128:        struct device           sc_dev;
        !           129:        struct ieee80211com     sc_ic;
        !           130:        unsigned int            sc_flags;
        !           131: #define        SC_NEEDS_FIRMWARE       0x00000001 /* do firmware upload on reset */
        !           132: #define        SC_UNINITIALIZED        0x00000002 /* still awaiting initial intr */
        !           133: #define        SC_DYING                0x00000004 /* going away */
        !           134: #define        SC_NEEDS_RESET          0x00000008 /* going to reset when refcnt = 1 */
        !           135: #define        SC_INTR_RESET           0x00000020 /* interrupt resets at end */
        !           136: #define        SC_POWERSAVE            0x00000040 /* device is asleep */
        !           137: #define        SC_NOFREE_ALLNODES      0x00000100 /* do not free assoc w/reinit */
        !           138: #define        SC_START_DESIRED        0x00000200 /* tried to start during mgmt-crit */
        !           139: #define        SC_KTHREAD              0x00000400 /* has a kthread around */
        !           140: #define        SC_ISL3877              0x00000800 /* chipset */
        !           141:        struct timeout          sc_chanscan_timer;
        !           142:        /* configuration sysctls */
        !           143:        int                     sc_dot1x;
        !           144:        int                     sc_wds;
        !           145:        /* cached values */
        !           146:        int                     sc_if_flags;
        !           147:        int16_t                 sc_80211_ioc_wep;
        !           148:        int16_t                 sc_80211_ioc_auth;
        !           149:        uint32_t                sc_noise;
        !           150:        unsigned int            sc_debug;
        !           151: #define        SC_DEBUG_QUEUES         0x00000001
        !           152: #define        SC_DEBUG_MGMT           0x00000002
        !           153: #define        SC_DEBUG_UNEXPECTED     0x00000004
        !           154: #define        SC_DEBUG_TRIGGER        0x00000008
        !           155: #define        SC_DEBUG_EVENTS         0x00000010
        !           156: #define        SC_DEBUG_POWER          0x00000020
        !           157: #define        SC_DEBUG_TRAP           0x00000040
        !           158: #define        SC_DEBUG_LINK           0x00000080
        !           159: #define        SC_DEBUG_RXANNEX        0x00000100
        !           160: #define        SC_DEBUG_RXFRAG         0x00000200
        !           161: #define        SC_DEBUG_RXETHER        0x00000400
        !           162:        bus_space_tag_t         sc_iotag;
        !           163:        bus_space_handle_t      sc_iohandle;
        !           164:        bus_dma_tag_t           sc_dmat;
        !           165:
        !           166:        bus_dmamap_t            sc_cbdmam;
        !           167:        bus_dma_segment_t       sc_cbdmas;
        !           168:        struct pgt_control_block *sc_cb;        /* DMA-mapped control block */
        !           169:
        !           170:        bus_dmamap_t            sc_psmdmam;
        !           171:        bus_dma_segment_t       sc_psmdmas;
        !           172:        void                   *sc_psmbuf;      /* DMA-mapped psm frame area */
        !           173:
        !           174:        int                     (*sc_newstate)
        !           175:                                (struct ieee80211com *,
        !           176:                                 enum ieee80211_state, int);
        !           177:
        !           178:        int                     (*sc_enable)(struct pgt_softc *);
        !           179:        void                    (*sc_disable)(struct pgt_softc *);
        !           180:        void                    (*sc_power)(struct pgt_softc *, int);
        !           181:        void                    *sc_shutdown_hook;      /* shutdown hook */
        !           182:        void                    *sc_power_hook;         /* power mgmt hook */
        !           183:
        !           184:        struct pgt_mgmt_descq   sc_mgmtinprog;
        !           185:        struct pgt_descq        sc_freeq[PGT_QUEUE_COUNT];
        !           186:        size_t                  sc_freeq_count[PGT_QUEUE_COUNT];
        !           187:        struct pgt_descq        sc_dirtyq[PGT_QUEUE_COUNT];
        !           188:        size_t                  sc_dirtyq_count[PGT_QUEUE_COUNT];
        !           189:        int                     sc_txtimer;
        !           190:        struct pgt_softc_kthread {
        !           191:                struct proc                    *sck_proc;
        !           192:                int                             sck_exit, sck_reset, sck_update;
        !           193:                TAILQ_HEAD(, pgt_async_trap)    sck_traps;
        !           194:        }                       sc_kthread;
        !           195:
        !           196: #if NBPFILTER > 0
        !           197:        caddr_t                 sc_drvbpf;
        !           198:
        !           199:        union {
        !           200:                struct pgt_rx_radiotap_hdr th;
        !           201:                 uint8_t pad[64];
        !           202:        }                       sc_rxtapu;
        !           203: #define sc_rxtap               sc_rxtapu.th
        !           204:        int                     sc_rxtap_len;
        !           205:
        !           206:        union {
        !           207:                struct pgt_tx_radiotap_hdr th;
        !           208:                uint8_t pad[64];
        !           209:        }                       sc_txtapu;
        !           210: #define sc_txtap               sc_txtapu.th
        !           211:        int                     sc_txtap_len;
        !           212: #endif
        !           213: };
        !           214:
        !           215: int    pgt_intr(void *);
        !           216: void   pgt_attach(void *);
        !           217: int    pgt_detach(struct pgt_softc *);
        !           218:
        !           219: static __inline int
        !           220: pgt_queue_is_rx(enum pgt_queue pq)
        !           221: {
        !           222:        return (pq == PGT_QUEUE_DATA_LOW_RX ||
        !           223:            pq == PGT_QUEUE_DATA_HIGH_RX ||
        !           224:            pq == PGT_QUEUE_MGMT_RX);
        !           225: }
        !           226:
        !           227: static __inline int
        !           228: pgt_queue_is_tx(enum pgt_queue pq)
        !           229: {
        !           230:        return (pq == PGT_QUEUE_DATA_LOW_TX ||
        !           231:            pq == PGT_QUEUE_DATA_HIGH_TX ||
        !           232:            pq == PGT_QUEUE_MGMT_TX);
        !           233: }
        !           234:
        !           235: static __inline int
        !           236: pgt_queue_is_data(enum pgt_queue pq)
        !           237: {
        !           238:        return (pq == PGT_QUEUE_DATA_LOW_RX ||
        !           239:            pq == PGT_QUEUE_DATA_HIGH_RX ||
        !           240:            pq == PGT_QUEUE_DATA_LOW_TX ||
        !           241:            pq == PGT_QUEUE_DATA_HIGH_TX);
        !           242: }
        !           243:
        !           244: static __inline int
        !           245: pgt_queue_is_mgmt(enum pgt_queue pq)
        !           246: {
        !           247:        return (pq == PGT_QUEUE_MGMT_RX ||
        !           248:            pq == PGT_QUEUE_MGMT_TX);
        !           249: }
        !           250:
        !           251: #endif

CVSweb