if_rsu.c (287895) | if_rsu.c (287896) |
---|---|
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> | 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 287895 2015-09-17 03:13:01Z adrian $"); | 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; | 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; |
|
154static usb_callback_t rsu_bulk_rx_callback; 155static usb_error_t rsu_do_request(struct rsu_softc *, 156 struct usb_device_request *, void *); 157static struct ieee80211vap * 158 rsu_vap_create(struct ieee80211com *, const char name[], 159 int, enum ieee80211_opmode, int, const uint8_t bssid[], 160 const uint8_t mac[]); 161static void rsu_vap_delete(struct ieee80211vap *); --- 78 unchanged lines hidden (view full) --- 240 241static uint8_t rsu_wme_ac_xfer_map[4] = { 242 [WME_AC_BE] = RSU_BULK_TX_BE_BK, 243 [WME_AC_BK] = RSU_BULK_TX_BE_BK, 244 [WME_AC_VI] = RSU_BULK_TX_VI_VO, 245 [WME_AC_VO] = RSU_BULK_TX_VI_VO, 246}; 247 | 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 |
|
248static const struct usb_config rsu_config[RSU_N_TRANSFER] = { 249 [RSU_BULK_RX] = { 250 .type = UE_BULK, 251 .endpoint = UE_ADDR_ANY, 252 .direction = UE_DIR_IN, 253 .bufsize = RSU_RXBUFSZ, 254 .flags = { 255 .pipe_bof = 1, --- 22 unchanged lines hidden (view full) --- 278 .flags = { 279 .ext_buffer = 1, 280 .pipe_bof = 1, 281 .force_short_xfer = 1 282 }, 283 .callback = rsu_bulk_tx_callback_vi_vo, 284 .timeout = RSU_TX_TIMEOUT 285 }, | 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 }, |
|
286}; 287 288static int 289rsu_match(device_t self) 290{ 291 struct usb_attach_arg *uaa = device_get_ivars(self); 292 293 if (uaa->usb_mode != USB_MODE_HOST || --- 592 unchanged lines hidden (view full) --- 886 } 887#endif 888 return (0); 889} 890 891static int 892rsu_fw_cmd(struct rsu_softc *sc, uint8_t code, void *buf, int len) 893{ | 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{ |
894 const uint8_t which = rsu_wme_ac_xfer_map[WME_AC_VO]; | 911 const uint8_t which = RSU_H2C_ENDPOINT; |
895 struct rsu_data *data; 896 struct r92s_tx_desc *txd; 897 struct r92s_fw_cmd_hdr *cmd; 898 int cmdsz; 899 int xferlen; 900 901 data = rsu_getbuf(sc); 902 if (data == NULL) --- 804 unchanged lines hidden (view full) --- 1707} 1708 1709static void 1710rsu_bulk_tx_callback_vi_vo(struct usb_xfer *xfer, usb_error_t error) 1711{ 1712 rsu_bulk_tx_callback_sub(xfer, error, RSU_BULK_TX_VI_VO); 1713} 1714 | 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 |
|
1715static int 1716rsu_tx_start(struct rsu_softc *sc, struct ieee80211_node *ni, 1717 struct mbuf *m0, struct rsu_data *data) 1718{ 1719 struct ieee80211com *ic = &sc->sc_ic; 1720 struct ieee80211vap *vap = ni->ni_vap; 1721 struct ieee80211_frame *wh; 1722 struct ieee80211_key *k = NULL; --- 790 unchanged lines hidden --- | 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 --- |