1/* $OpenBSD: if_rsu.c,v 1.17 2013/04/15 09:23:01 mglocker Exp $ */ 2 3/*- 4 * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18#include <sys/cdefs.h> |
19__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_rsu.c 287896 2015-09-17 03:19:09Z adrian $"); |
20 21/* 22 * Driver for Realtek RTL8188SU/RTL8191SU/RTL8192SU. 23 * 24 * TODO: 25 * o 11n support 26 * o h/w crypto 27 * o hostap / ibss / mesh --- 118 unchanged lines hidden (view full) --- 146#undef RSU_DEV 147}; 148 149static device_probe_t rsu_match; 150static device_attach_t rsu_attach; 151static device_detach_t rsu_detach; 152static usb_callback_t rsu_bulk_tx_callback_be_bk; 153static usb_callback_t rsu_bulk_tx_callback_vi_vo; |
154static usb_callback_t rsu_bulk_tx_callback_h2c; |
155static usb_callback_t rsu_bulk_rx_callback; 156static usb_error_t rsu_do_request(struct rsu_softc *, 157 struct usb_device_request *, void *); 158static struct ieee80211vap * 159 rsu_vap_create(struct ieee80211com *, const char name[], 160 int, enum ieee80211_opmode, int, const uint8_t bssid[], 161 const uint8_t mac[]); 162static void rsu_vap_delete(struct ieee80211vap *); --- 78 unchanged lines hidden (view full) --- 241 242static uint8_t rsu_wme_ac_xfer_map[4] = { 243 [WME_AC_BE] = RSU_BULK_TX_BE_BK, 244 [WME_AC_BK] = RSU_BULK_TX_BE_BK, 245 [WME_AC_VI] = RSU_BULK_TX_VI_VO, 246 [WME_AC_VO] = RSU_BULK_TX_VI_VO, 247}; 248 |
249/* XXX hard-coded */ 250#define RSU_H2C_ENDPOINT 3 251 |
252static const struct usb_config rsu_config[RSU_N_TRANSFER] = { 253 [RSU_BULK_RX] = { 254 .type = UE_BULK, 255 .endpoint = UE_ADDR_ANY, 256 .direction = UE_DIR_IN, 257 .bufsize = RSU_RXBUFSZ, 258 .flags = { 259 .pipe_bof = 1, --- 22 unchanged lines hidden (view full) --- 282 .flags = { 283 .ext_buffer = 1, 284 .pipe_bof = 1, 285 .force_short_xfer = 1 286 }, 287 .callback = rsu_bulk_tx_callback_vi_vo, 288 .timeout = RSU_TX_TIMEOUT 289 }, |
290 [RSU_BULK_TX_H2C] = { 291 .type = UE_BULK, 292 .endpoint = 0x0d, 293 .direction = UE_DIR_OUT, 294 .bufsize = RSU_TXBUFSZ, 295 .flags = { 296 .ext_buffer = 1, 297 .pipe_bof = 1, 298 .short_xfer_ok = 1 299 }, 300 .callback = rsu_bulk_tx_callback_h2c, 301 .timeout = RSU_TX_TIMEOUT 302 }, |
303}; 304 305static int 306rsu_match(device_t self) 307{ 308 struct usb_attach_arg *uaa = device_get_ivars(self); 309 310 if (uaa->usb_mode != USB_MODE_HOST || --- 592 unchanged lines hidden (view full) --- 903 } 904#endif 905 return (0); 906} 907 908static int 909rsu_fw_cmd(struct rsu_softc *sc, uint8_t code, void *buf, int len) 910{ |
911 const uint8_t which = RSU_H2C_ENDPOINT; |
912 struct rsu_data *data; 913 struct r92s_tx_desc *txd; 914 struct r92s_fw_cmd_hdr *cmd; 915 int cmdsz; 916 int xferlen; 917 918 data = rsu_getbuf(sc); 919 if (data == NULL) --- 804 unchanged lines hidden (view full) --- 1724} 1725 1726static void 1727rsu_bulk_tx_callback_vi_vo(struct usb_xfer *xfer, usb_error_t error) 1728{ 1729 rsu_bulk_tx_callback_sub(xfer, error, RSU_BULK_TX_VI_VO); 1730} 1731 |
1732static void 1733rsu_bulk_tx_callback_h2c(struct usb_xfer *xfer, usb_error_t error) 1734{ 1735 rsu_bulk_tx_callback_sub(xfer, error, RSU_BULK_TX_H2C); 1736} 1737 |
1738static int 1739rsu_tx_start(struct rsu_softc *sc, struct ieee80211_node *ni, 1740 struct mbuf *m0, struct rsu_data *data) 1741{ 1742 struct ieee80211com *ic = &sc->sc_ic; 1743 struct ieee80211vap *vap = ni->ni_vap; 1744 struct ieee80211_frame *wh; 1745 struct ieee80211_key *k = NULL; --- 790 unchanged lines hidden --- |