1 /*- 2 * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> 3 * Copyright (c) 2016 Andriy Voskoboinyk <avos@FreeBSD.org> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 * 17 * $OpenBSD: if_urtwnreg.h,v 1.3 2010/11/16 18:02:59 damien Exp $ 18 * $FreeBSD$ 19 */ 20 21 #ifndef RTWN_USBVAR_H 22 #define RTWN_USBVAR_H 23 24 #define RTWN_USB_TXBUFSZ (16 * 1024) 25 26 #define RTWN_IFACE_INDEX 0 27 28 #define RTWN_USB_RX_LIST_COUNT 1 29 #define RTWN_USB_TX_LIST_COUNT 16 30 31 struct rtwn_data { 32 uint8_t *buf; 33 /* 'id' is meaningful for beacons only */ 34 int id; 35 uint16_t buflen; 36 struct mbuf *m; 37 struct ieee80211_node *ni; 38 STAILQ_ENTRY(rtwn_data) next; 39 }; 40 typedef STAILQ_HEAD(, rtwn_data) rtwn_datahead; 41 42 enum { 43 RTWN_BULK_RX, 44 RTWN_BULK_TX_BE, /* = WME_AC_BE */ 45 RTWN_BULK_TX_BK, /* = WME_AC_BK */ 46 RTWN_BULK_TX_VI, /* = WME_AC_VI */ 47 RTWN_BULK_TX_VO, /* = WME_AC_VO */ 48 RTWN_N_TRANSFER = 5, 49 }; 50 51 #define RTWN_EP_QUEUES RTWN_BULK_RX 52 53 struct rtwn_usb_softc { 54 struct rtwn_softc uc_sc; /* must be the first */ 55 struct usb_device *uc_udev; 56 struct usb_xfer *uc_xfer[RTWN_N_TRANSFER]; 57 58 struct rtwn_data uc_rx[RTWN_USB_RX_LIST_COUNT]; 59 rtwn_datahead uc_rx_active; 60 rtwn_datahead uc_rx_inactive; 61 struct rtwn_data uc_tx[RTWN_USB_TX_LIST_COUNT]; 62 rtwn_datahead uc_tx_active; 63 rtwn_datahead uc_tx_inactive; 64 rtwn_datahead uc_tx_pending; 65 66 int (*uc_align_rx)(int, int); 67 68 int ntx; 69 int tx_agg_desc_num; 70 }; 71 #define RTWN_USB_SOFTC(sc) ((struct rtwn_usb_softc *)(sc)) 72 73 #define rtwn_usb_align_rx(_uc, _totlen, _len) \ 74 (((_uc)->uc_align_rx)((_totlen), (_len))) 75 76 #endif /* RTWN_USBVAR_H */ 77