diff options
-rw-r--r-- | sys/dev/ic/r92creg.h | 4 | ||||
-rw-r--r-- | sys/dev/pci/if_rtwn.c | 187 | ||||
-rw-r--r-- | sys/dev/pci/if_rtwnreg.h | 205 | ||||
-rw-r--r-- | sys/dev/usb/if_urtwn.c | 170 | ||||
-rw-r--r-- | sys/dev/usb/if_urtwnreg.h | 188 |
5 files changed, 356 insertions, 398 deletions
diff --git a/sys/dev/ic/r92creg.h b/sys/dev/ic/r92creg.h index e50360a21d2..db155381cdd 100644 --- a/sys/dev/ic/r92creg.h +++ b/sys/dev/ic/r92creg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: r92creg.h,v 1.2 2016/03/07 18:05:40 stsp Exp $ */ +/* $OpenBSD: r92creg.h,v 1.3 2016/03/07 19:41:49 stsp Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -18,6 +18,8 @@ */ #define R92C_MAX_CHAINS 2 +#define R92C_MAX_TX_PWR 0x3f +#define R92C_H2C_NBOX 4 /* * MAC registers. diff --git a/sys/dev/pci/if_rtwn.c b/sys/dev/pci/if_rtwn.c index bf01b7abacf..b575193f7dd 100644 --- a/sys/dev/pci/if_rtwn.c +++ b/sys/dev/pci/if_rtwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rtwn.c,v 1.14 2016/03/07 18:05:41 stsp Exp $ */ +/* $OpenBSD: if_rtwn.c,v 1.15 2016/03/07 19:41:49 stsp Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -56,7 +56,190 @@ #include <dev/pci/pcidevs.h> #include <dev/ic/r92creg.h> -#include <dev/pci/if_rtwnreg.h> + +#define R92C_PUBQ_NPAGES 176 +#define R92C_HPQ_NPAGES 41 +#define R92C_LPQ_NPAGES 28 +#define R92C_TXPKTBUF_COUNT 256 +#define R92C_TX_PAGE_COUNT \ + (R92C_PUBQ_NPAGES + R92C_HPQ_NPAGES + R92C_LPQ_NPAGES) +#define R92C_TX_PAGE_BOUNDARY (R92C_TX_PAGE_COUNT + 1) + +/* + * Driver definitions. + */ +#define RTWN_NTXQUEUES 9 +#define RTWN_RX_LIST_COUNT 256 +#define RTWN_TX_LIST_COUNT 256 +#define RTWN_HOST_CMD_RING_COUNT 32 + +/* TX queue indices. */ +#define RTWN_BK_QUEUE 0 +#define RTWN_BE_QUEUE 1 +#define RTWN_VI_QUEUE 2 +#define RTWN_VO_QUEUE 3 +#define RTWN_BEACON_QUEUE 4 +#define RTWN_TXCMD_QUEUE 5 +#define RTWN_MGNT_QUEUE 6 +#define RTWN_HIGH_QUEUE 7 +#define RTWN_HCCA_QUEUE 8 + +/* RX queue indices. */ +#define RTWN_RX_QUEUE 0 + +#define RTWN_RXBUFSZ (16 * 1024) +#define RTWN_TXBUFSZ (sizeof(struct r92c_tx_desc_pci) + IEEE80211_MAX_LEN) + +#define RTWN_RIDX_COUNT 28 + +#define RTWN_TX_TIMEOUT 5000 /* ms */ + +#define RTWN_LED_LINK 0 +#define RTWN_LED_DATA 1 + +struct rtwn_rx_radiotap_header { + struct ieee80211_radiotap_header wr_ihdr; + uint8_t wr_flags; + uint8_t wr_rate; + uint16_t wr_chan_freq; + uint16_t wr_chan_flags; + uint8_t wr_dbm_antsignal; +} __packed; + +#define RTWN_RX_RADIOTAP_PRESENT \ + (1 << IEEE80211_RADIOTAP_FLAGS | \ + 1 << IEEE80211_RADIOTAP_RATE | \ + 1 << IEEE80211_RADIOTAP_CHANNEL | \ + 1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) + +struct rtwn_tx_radiotap_header { + struct ieee80211_radiotap_header wt_ihdr; + uint8_t wt_flags; + uint16_t wt_chan_freq; + uint16_t wt_chan_flags; +} __packed; + +#define RTWN_TX_RADIOTAP_PRESENT \ + (1 << IEEE80211_RADIOTAP_FLAGS | \ + 1 << IEEE80211_RADIOTAP_CHANNEL) + +struct rtwn_softc; + +struct rtwn_rx_data { + bus_dmamap_t map; + struct mbuf *m; +}; + +struct rtwn_rx_ring { + struct r92c_rx_desc_pci *desc; + bus_dmamap_t map; + bus_dma_segment_t seg; + int nsegs; + struct rtwn_rx_data rx_data[RTWN_RX_LIST_COUNT]; + +}; +struct rtwn_tx_data { + bus_dmamap_t map; + struct mbuf *m; + struct ieee80211_node *ni; +}; + +struct rtwn_tx_ring { + bus_dmamap_t map; + bus_dma_segment_t seg; + int nsegs; + struct r92c_tx_desc_pci *desc; + struct rtwn_tx_data tx_data[RTWN_TX_LIST_COUNT]; + int queued; + int cur; +}; + +struct rtwn_host_cmd { + void (*cb)(struct rtwn_softc *, void *); + uint8_t data[256]; +}; + +struct rtwn_cmd_key { + struct ieee80211_key key; + uint16_t associd; +}; + +struct rtwn_host_cmd_ring { + struct rtwn_host_cmd cmd[RTWN_HOST_CMD_RING_COUNT]; + int cur; + int next; + int queued; +}; + +struct rtwn_softc { + struct device sc_dev; + struct ieee80211com sc_ic; + int (*sc_newstate)(struct ieee80211com *, + enum ieee80211_state, int); + + /* PCI specific goo. */ + bus_dma_tag_t sc_dmat; + pci_chipset_tag_t sc_pc; + pcitag_t sc_tag; + void *sc_ih; + bus_space_tag_t sc_st; + bus_space_handle_t sc_sh; + bus_size_t sc_mapsize; + int sc_cap_off; + + + struct timeout scan_to; + struct timeout calib_to; + struct task init_task; + int ac2idx[EDCA_NUM_AC]; + u_int sc_flags; +#define RTWN_FLAG_CCK_HIPWR 0x01 +#define RTWN_FLAG_BUSY 0x02 + + u_int chip; +#define RTWN_CHIP_88C 0x00 +#define RTWN_CHIP_92C 0x01 +#define RTWN_CHIP_92C_1T2R 0x02 +#define RTWN_CHIP_UMC 0x04 +#define RTWN_CHIP_UMC_A_CUT 0x08 + + uint8_t board_type; + uint8_t regulatory; + uint8_t pa_setting; + int avg_pwdb; + int thcal_state; + int thcal_lctemp; + int ntxchains; + int nrxchains; + int ledlink; + + int sc_tx_timer; + int fwcur; + struct rtwn_rx_ring rx_ring; + struct rtwn_tx_ring tx_ring[RTWN_NTXQUEUES]; + uint32_t qfullmsk; + struct r92c_rom rom; + + uint32_t rf_chnlbw[R92C_MAX_CHAINS]; +#if NBPFILTER > 0 + caddr_t sc_drvbpf; + + union { + struct rtwn_rx_radiotap_header th; + uint8_t pad[64]; + } sc_rxtapu; +#define sc_rxtap sc_rxtapu.th + int sc_rxtap_len; + + union { + struct rtwn_tx_radiotap_header th; + uint8_t pad[64]; + } sc_txtapu; +#define sc_txtap sc_txtapu.th + int sc_txtap_len; +#endif +}; + #ifdef RTWN_DEBUG #define DPRINTF(x) do { if (rtwn_debug) printf x; } while (0) diff --git a/sys/dev/pci/if_rtwnreg.h b/sys/dev/pci/if_rtwnreg.h deleted file mode 100644 index 408ddad1221..00000000000 --- a/sys/dev/pci/if_rtwnreg.h +++ /dev/null @@ -1,205 +0,0 @@ -/* $OpenBSD: if_rtwnreg.h,v 1.5 2016/03/07 18:05:41 stsp Exp $ */ - -/*- - * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> - * Copyright (c) 2015 Stefan Sperling <stsp@openbsd.org> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define R92C_MAX_TX_PWR 0x3f - -#define R92C_PUBQ_NPAGES 176 -#define R92C_HPQ_NPAGES 41 -#define R92C_LPQ_NPAGES 28 -#define R92C_TXPKTBUF_COUNT 256 -#define R92C_TX_PAGE_COUNT \ - (R92C_PUBQ_NPAGES + R92C_HPQ_NPAGES + R92C_LPQ_NPAGES) -#define R92C_TX_PAGE_BOUNDARY (R92C_TX_PAGE_COUNT + 1) - -#define R92C_H2C_NBOX 4 - -/* - * Driver definitions. - */ -#define RTWN_NTXQUEUES 9 -#define RTWN_RX_LIST_COUNT 256 -#define RTWN_TX_LIST_COUNT 256 -#define RTWN_HOST_CMD_RING_COUNT 32 - -/* TX queue indices. */ -#define RTWN_BK_QUEUE 0 -#define RTWN_BE_QUEUE 1 -#define RTWN_VI_QUEUE 2 -#define RTWN_VO_QUEUE 3 -#define RTWN_BEACON_QUEUE 4 -#define RTWN_TXCMD_QUEUE 5 -#define RTWN_MGNT_QUEUE 6 -#define RTWN_HIGH_QUEUE 7 -#define RTWN_HCCA_QUEUE 8 - -/* RX queue indices. */ -#define RTWN_RX_QUEUE 0 - -#define RTWN_RXBUFSZ (16 * 1024) -#define RTWN_TXBUFSZ (sizeof(struct r92c_tx_desc_pci) + IEEE80211_MAX_LEN) - -#define RTWN_RIDX_COUNT 28 - -#define RTWN_TX_TIMEOUT 5000 /* ms */ - -#define RTWN_LED_LINK 0 -#define RTWN_LED_DATA 1 - -struct rtwn_rx_radiotap_header { - struct ieee80211_radiotap_header wr_ihdr; - uint8_t wr_flags; - uint8_t wr_rate; - uint16_t wr_chan_freq; - uint16_t wr_chan_flags; - uint8_t wr_dbm_antsignal; -} __packed; - -#define RTWN_RX_RADIOTAP_PRESENT \ - (1 << IEEE80211_RADIOTAP_FLAGS | \ - 1 << IEEE80211_RADIOTAP_RATE | \ - 1 << IEEE80211_RADIOTAP_CHANNEL | \ - 1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) - -struct rtwn_tx_radiotap_header { - struct ieee80211_radiotap_header wt_ihdr; - uint8_t wt_flags; - uint16_t wt_chan_freq; - uint16_t wt_chan_flags; -} __packed; - -#define RTWN_TX_RADIOTAP_PRESENT \ - (1 << IEEE80211_RADIOTAP_FLAGS | \ - 1 << IEEE80211_RADIOTAP_CHANNEL) - -struct rtwn_softc; - -struct rtwn_rx_data { - bus_dmamap_t map; - struct mbuf *m; -}; - -struct rtwn_rx_ring { - struct r92c_rx_desc_pci *desc; - bus_dmamap_t map; - bus_dma_segment_t seg; - int nsegs; - struct rtwn_rx_data rx_data[RTWN_RX_LIST_COUNT]; - -}; -struct rtwn_tx_data { - bus_dmamap_t map; - struct mbuf *m; - struct ieee80211_node *ni; -}; - -struct rtwn_tx_ring { - bus_dmamap_t map; - bus_dma_segment_t seg; - int nsegs; - struct r92c_tx_desc_pci *desc; - struct rtwn_tx_data tx_data[RTWN_TX_LIST_COUNT]; - int queued; - int cur; -}; - -struct rtwn_host_cmd { - void (*cb)(struct rtwn_softc *, void *); - uint8_t data[256]; -}; - -struct rtwn_cmd_key { - struct ieee80211_key key; - uint16_t associd; -}; - -struct rtwn_host_cmd_ring { - struct rtwn_host_cmd cmd[RTWN_HOST_CMD_RING_COUNT]; - int cur; - int next; - int queued; -}; - -struct rtwn_softc { - struct device sc_dev; - struct ieee80211com sc_ic; - int (*sc_newstate)(struct ieee80211com *, - enum ieee80211_state, int); - - /* PCI specific goo. */ - bus_dma_tag_t sc_dmat; - pci_chipset_tag_t sc_pc; - pcitag_t sc_tag; - void *sc_ih; - bus_space_tag_t sc_st; - bus_space_handle_t sc_sh; - bus_size_t sc_mapsize; - int sc_cap_off; - - - struct timeout scan_to; - struct timeout calib_to; - struct task init_task; - int ac2idx[EDCA_NUM_AC]; - u_int sc_flags; -#define RTWN_FLAG_CCK_HIPWR 0x01 -#define RTWN_FLAG_BUSY 0x02 - - u_int chip; -#define RTWN_CHIP_88C 0x00 -#define RTWN_CHIP_92C 0x01 -#define RTWN_CHIP_92C_1T2R 0x02 -#define RTWN_CHIP_UMC 0x04 -#define RTWN_CHIP_UMC_A_CUT 0x08 - - uint8_t board_type; - uint8_t regulatory; - uint8_t pa_setting; - int avg_pwdb; - int thcal_state; - int thcal_lctemp; - int ntxchains; - int nrxchains; - int ledlink; - - int sc_tx_timer; - int fwcur; - struct rtwn_rx_ring rx_ring; - struct rtwn_tx_ring tx_ring[RTWN_NTXQUEUES]; - uint32_t qfullmsk; - struct r92c_rom rom; - - uint32_t rf_chnlbw[R92C_MAX_CHAINS]; -#if NBPFILTER > 0 - caddr_t sc_drvbpf; - - union { - struct rtwn_rx_radiotap_header th; - uint8_t pad[64]; - } sc_rxtapu; -#define sc_rxtap sc_rxtapu.th - int sc_rxtap_len; - - union { - struct rtwn_tx_radiotap_header th; - uint8_t pad[64]; - } sc_txtapu; -#define sc_txtap sc_txtapu.th - int sc_txtap_len; -#endif -}; diff --git a/sys/dev/usb/if_urtwn.c b/sys/dev/usb/if_urtwn.c index a124de9d885..c59808b691d 100644 --- a/sys/dev/usb/if_urtwn.c +++ b/sys/dev/usb/if_urtwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urtwn.c,v 1.60 2016/03/07 18:05:41 stsp Exp $ */ +/* $OpenBSD: if_urtwn.c,v 1.61 2016/03/07 19:41:50 stsp Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -55,7 +55,173 @@ #include <dev/usb/usbdevs.h> #include <dev/ic/r92creg.h> -#include <dev/usb/if_urtwnreg.h> + +/* Maximum number of output pipes is 3. */ +#define R92C_MAX_EPOUT 3 + +#define R92C_PUBQ_NPAGES 231 +#define R92C_TXPKTBUF_COUNT 256 +#define R92C_TX_PAGE_COUNT 248 +#define R92C_TX_PAGE_BOUNDARY (R92C_TX_PAGE_COUNT + 1) +#define R88E_TXPKTBUF_COUNT 177 +#define R88E_TX_PAGE_COUNT 169 +#define R88E_TX_PAGE_BOUNDARY (R88E_TX_PAGE_COUNT + 1) + +/* USB Requests. */ +#define R92C_REQ_REGS 0x05 + +/* + * Driver definitions. + */ +#define URTWN_RX_LIST_COUNT 1 +#define URTWN_TX_LIST_COUNT 8 +#define URTWN_HOST_CMD_RING_COUNT 32 + +#define URTWN_RXBUFSZ (16 * 1024) +#define URTWN_TXBUFSZ (sizeof(struct r92c_tx_desc_usb) + IEEE80211_MAX_LEN) + +#define URTWN_RIDX_COUNT 28 + +#define URTWN_TX_TIMEOUT 5000 /* ms */ + +#define URTWN_LED_LINK 0 +#define URTWN_LED_DATA 1 + +struct urtwn_rx_radiotap_header { + struct ieee80211_radiotap_header wr_ihdr; + uint8_t wr_flags; + uint8_t wr_rate; + uint16_t wr_chan_freq; + uint16_t wr_chan_flags; + uint8_t wr_dbm_antsignal; +} __packed; + +#define URTWN_RX_RADIOTAP_PRESENT \ + (1 << IEEE80211_RADIOTAP_FLAGS | \ + 1 << IEEE80211_RADIOTAP_RATE | \ + 1 << IEEE80211_RADIOTAP_CHANNEL | \ + 1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) + +struct urtwn_tx_radiotap_header { + struct ieee80211_radiotap_header wt_ihdr; + uint8_t wt_flags; + uint16_t wt_chan_freq; + uint16_t wt_chan_flags; +} __packed; + +#define URTWN_TX_RADIOTAP_PRESENT \ + (1 << IEEE80211_RADIOTAP_FLAGS | \ + 1 << IEEE80211_RADIOTAP_CHANNEL) + +struct urtwn_softc; + +struct urtwn_rx_data { + struct urtwn_softc *sc; + struct usbd_xfer *xfer; + uint8_t *buf; +}; + +struct urtwn_tx_data { + struct urtwn_softc *sc; + struct usbd_pipe *pipe; + struct usbd_xfer *xfer; + uint8_t *buf; + TAILQ_ENTRY(urtwn_tx_data) next; +}; + +struct urtwn_host_cmd { + void (*cb)(struct urtwn_softc *, void *); + uint8_t data[256]; +}; + +struct urtwn_cmd_newstate { + enum ieee80211_state state; + int arg; +}; + +struct urtwn_cmd_key { + struct ieee80211_key key; + uint16_t associd; +}; + +struct urtwn_host_cmd_ring { + struct urtwn_host_cmd cmd[URTWN_HOST_CMD_RING_COUNT]; + int cur; + int next; + int queued; +}; + +struct urtwn_softc { + struct device sc_dev; + struct ieee80211com sc_ic; + int (*sc_newstate)(struct ieee80211com *, + enum ieee80211_state, int); + struct usbd_device *sc_udev; + struct usbd_interface *sc_iface; + struct usb_task sc_task; + struct timeout scan_to; + struct timeout calib_to; + struct usbd_pipe *rx_pipe; + struct usbd_pipe *tx_pipe[R92C_MAX_EPOUT]; + int ac2idx[EDCA_NUM_AC]; + u_int sc_flags; +#define URTWN_FLAG_CCK_HIPWR 0x01 +#define URTWN_FLAG_FORCE_RAID_11B 0x02 + + u_int chip; +#define URTWN_CHIP_92C 0x01 +#define URTWN_CHIP_92C_1T2R 0x02 +#define URTWN_CHIP_UMC 0x04 +#define URTWN_CHIP_UMC_A_CUT 0x08 +#define URTWN_CHIP_88E 0x10 + + void (*sc_rf_write)(struct urtwn_softc *, + int, uint8_t, uint32_t); + int (*sc_power_on)(struct urtwn_softc *); + int (*sc_dma_init)(struct urtwn_softc *); + + uint8_t board_type; + uint8_t regulatory; + uint8_t pa_setting; + int avg_pwdb; + int thcal_state; + int thcal_lctemp; + int ntxchains; + int nrxchains; + int ledlink; + + int sc_tx_timer; + struct urtwn_host_cmd_ring cmdq; + int fwcur; + struct urtwn_rx_data rx_data[URTWN_RX_LIST_COUNT]; + struct urtwn_tx_data tx_data[URTWN_TX_LIST_COUNT]; + TAILQ_HEAD(, urtwn_tx_data) tx_free_list; + struct r92c_rom rom; + uint8_t r88e_rom[512]; + uint8_t cck_tx_pwr[6]; + uint8_t ht40_tx_pwr[5]; + int8_t bw20_tx_pwr_diff; + int8_t ofdm_tx_pwr_diff; + + uint32_t rf_chnlbw[R92C_MAX_CHAINS]; +#if NBPFILTER > 0 + caddr_t sc_drvbpf; + + union { + struct urtwn_rx_radiotap_header th; + uint8_t pad[64]; + } sc_rxtapu; +#define sc_rxtap sc_rxtapu.th + int sc_rxtap_len; + + union { + struct urtwn_tx_radiotap_header th; + uint8_t pad[64]; + } sc_txtapu; +#define sc_txtap sc_txtapu.th + int sc_txtap_len; +#endif +}; #ifdef URTWN_DEBUG #define DPRINTF(x) do { if (urtwn_debug) printf x; } while (0) diff --git a/sys/dev/usb/if_urtwnreg.h b/sys/dev/usb/if_urtwnreg.h deleted file mode 100644 index d55a217bf6b..00000000000 --- a/sys/dev/usb/if_urtwnreg.h +++ /dev/null @@ -1,188 +0,0 @@ -/* $OpenBSD: if_urtwnreg.h,v 1.9 2016/03/07 18:05:41 stsp Exp $ */ - -/*- - * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* Maximum number of output pipes is 3. */ -#define R92C_MAX_EPOUT 3 - -#define R92C_MAX_TX_PWR 0x3f - -#define R92C_PUBQ_NPAGES 231 -#define R92C_TXPKTBUF_COUNT 256 -#define R92C_TX_PAGE_COUNT 248 -#define R92C_TX_PAGE_BOUNDARY (R92C_TX_PAGE_COUNT + 1) -#define R88E_TXPKTBUF_COUNT 177 -#define R88E_TX_PAGE_COUNT 169 -#define R88E_TX_PAGE_BOUNDARY (R88E_TX_PAGE_COUNT + 1) - -#define R92C_H2C_NBOX 4 - -/* USB Requests. */ -#define R92C_REQ_REGS 0x05 - -/* - * Driver definitions. - */ -#define URTWN_RX_LIST_COUNT 1 -#define URTWN_TX_LIST_COUNT 8 -#define URTWN_HOST_CMD_RING_COUNT 32 - -#define URTWN_RXBUFSZ (16 * 1024) -#define URTWN_TXBUFSZ (sizeof(struct r92c_tx_desc_usb) + IEEE80211_MAX_LEN) - -#define URTWN_RIDX_COUNT 28 - -#define URTWN_TX_TIMEOUT 5000 /* ms */ - -#define URTWN_LED_LINK 0 -#define URTWN_LED_DATA 1 - -struct urtwn_rx_radiotap_header { - struct ieee80211_radiotap_header wr_ihdr; - uint8_t wr_flags; - uint8_t wr_rate; - uint16_t wr_chan_freq; - uint16_t wr_chan_flags; - uint8_t wr_dbm_antsignal; -} __packed; - -#define URTWN_RX_RADIOTAP_PRESENT \ - (1 << IEEE80211_RADIOTAP_FLAGS | \ - 1 << IEEE80211_RADIOTAP_RATE | \ - 1 << IEEE80211_RADIOTAP_CHANNEL | \ - 1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) - -struct urtwn_tx_radiotap_header { - struct ieee80211_radiotap_header wt_ihdr; - uint8_t wt_flags; - uint16_t wt_chan_freq; - uint16_t wt_chan_flags; -} __packed; - -#define URTWN_TX_RADIOTAP_PRESENT \ - (1 << IEEE80211_RADIOTAP_FLAGS | \ - 1 << IEEE80211_RADIOTAP_CHANNEL) - -struct urtwn_softc; - -struct urtwn_rx_data { - struct urtwn_softc *sc; - struct usbd_xfer *xfer; - uint8_t *buf; -}; - -struct urtwn_tx_data { - struct urtwn_softc *sc; - struct usbd_pipe *pipe; - struct usbd_xfer *xfer; - uint8_t *buf; - TAILQ_ENTRY(urtwn_tx_data) next; -}; - -struct urtwn_host_cmd { - void (*cb)(struct urtwn_softc *, void *); - uint8_t data[256]; -}; - -struct urtwn_cmd_newstate { - enum ieee80211_state state; - int arg; -}; - -struct urtwn_cmd_key { - struct ieee80211_key key; - uint16_t associd; -}; - -struct urtwn_host_cmd_ring { - struct urtwn_host_cmd cmd[URTWN_HOST_CMD_RING_COUNT]; - int cur; - int next; - int queued; -}; - -struct urtwn_softc { - struct device sc_dev; - struct ieee80211com sc_ic; - int (*sc_newstate)(struct ieee80211com *, - enum ieee80211_state, int); - struct usbd_device *sc_udev; - struct usbd_interface *sc_iface; - struct usb_task sc_task; - struct timeout scan_to; - struct timeout calib_to; - struct usbd_pipe *rx_pipe; - struct usbd_pipe *tx_pipe[R92C_MAX_EPOUT]; - int ac2idx[EDCA_NUM_AC]; - u_int sc_flags; -#define URTWN_FLAG_CCK_HIPWR 0x01 -#define URTWN_FLAG_FORCE_RAID_11B 0x02 - - u_int chip; -#define URTWN_CHIP_92C 0x01 -#define URTWN_CHIP_92C_1T2R 0x02 -#define URTWN_CHIP_UMC 0x04 -#define URTWN_CHIP_UMC_A_CUT 0x08 -#define URTWN_CHIP_88E 0x10 - - void (*sc_rf_write)(struct urtwn_softc *, - int, uint8_t, uint32_t); - int (*sc_power_on)(struct urtwn_softc *); - int (*sc_dma_init)(struct urtwn_softc *); - - uint8_t board_type; - uint8_t regulatory; - uint8_t pa_setting; - int avg_pwdb; - int thcal_state; - int thcal_lctemp; - int ntxchains; - int nrxchains; - int ledlink; - - int sc_tx_timer; - struct urtwn_host_cmd_ring cmdq; - int fwcur; - struct urtwn_rx_data rx_data[URTWN_RX_LIST_COUNT]; - struct urtwn_tx_data tx_data[URTWN_TX_LIST_COUNT]; - TAILQ_HEAD(, urtwn_tx_data) tx_free_list; - struct r92c_rom rom; - uint8_t r88e_rom[512]; - uint8_t cck_tx_pwr[6]; - uint8_t ht40_tx_pwr[5]; - int8_t bw20_tx_pwr_diff; - int8_t ofdm_tx_pwr_diff; - - uint32_t rf_chnlbw[R92C_MAX_CHAINS]; -#if NBPFILTER > 0 - caddr_t sc_drvbpf; - - union { - struct urtwn_rx_radiotap_header th; - uint8_t pad[64]; - } sc_rxtapu; -#define sc_rxtap sc_rxtapu.th - int sc_rxtap_len; - - union { - struct urtwn_tx_radiotap_header th; - uint8_t pad[64]; - } sc_txtapu; -#define sc_txtap sc_txtapu.th - int sc_txtap_len; -#endif -}; |