if_urtwn.c (300434) | if_urtwn.c (300754) |
---|---|
1/* $OpenBSD: if_urtwn.c,v 1.16 2011/02/10 17:26:40 jakemsr Exp $ */ 2 3/*- 4 * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> 5 * Copyright (c) 2014 Kevin Lo <kevlo@FreeBSD.org> 6 * Copyright (c) 2015 Andriy Voskoboinyk <avos@FreeBSD.org> 7 * 8 * Permission to use, copy, modify, and distribute this software for any --- 5 unchanged lines hidden (view full) --- 14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 */ 20 21#include <sys/cdefs.h> | 1/* $OpenBSD: if_urtwn.c,v 1.16 2011/02/10 17:26:40 jakemsr Exp $ */ 2 3/*- 4 * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> 5 * Copyright (c) 2014 Kevin Lo <kevlo@FreeBSD.org> 6 * Copyright (c) 2015 Andriy Voskoboinyk <avos@FreeBSD.org> 7 * 8 * Permission to use, copy, modify, and distribute this software for any --- 5 unchanged lines hidden (view full) --- 14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 */ 20 21#include <sys/cdefs.h> |
22__FBSDID("$FreeBSD: head/sys/dev/urtwn/if_urtwn.c 300434 2016-05-22 20:12:07Z avos $"); | 22__FBSDID("$FreeBSD: head/sys/dev/urtwn/if_urtwn.c 300754 2016-05-26 16:39:11Z avos $"); |
23 24/* 25 * Driver for Realtek RTL8188CE-VAU/RTL8188CUS/RTL8188EU/RTL8188RU/RTL8192CU. 26 */ 27 28#include "opt_wlan.h" 29#include "opt_urtwn.h" 30 --- 314 unchanged lines hidden (view full) --- 345 struct ieee80211_channel *, uint16_t[]); 346static void urtwn_set_txpower(struct urtwn_softc *, 347 struct ieee80211_channel *, 348 struct ieee80211_channel *); 349static void urtwn_set_rx_bssid_all(struct urtwn_softc *, int); 350static void urtwn_set_gain(struct urtwn_softc *, uint8_t); 351static void urtwn_scan_start(struct ieee80211com *); 352static void urtwn_scan_end(struct ieee80211com *); | 23 24/* 25 * Driver for Realtek RTL8188CE-VAU/RTL8188CUS/RTL8188EU/RTL8188RU/RTL8192CU. 26 */ 27 28#include "opt_wlan.h" 29#include "opt_urtwn.h" 30 --- 314 unchanged lines hidden (view full) --- 345 struct ieee80211_channel *, uint16_t[]); 346static void urtwn_set_txpower(struct urtwn_softc *, 347 struct ieee80211_channel *, 348 struct ieee80211_channel *); 349static void urtwn_set_rx_bssid_all(struct urtwn_softc *, int); 350static void urtwn_set_gain(struct urtwn_softc *, uint8_t); 351static void urtwn_scan_start(struct ieee80211com *); 352static void urtwn_scan_end(struct ieee80211com *); |
353static void urtwn_getradiocaps(struct ieee80211com *, int, int *, 354 struct ieee80211_channel[]); |
|
353static void urtwn_set_channel(struct ieee80211com *); 354static int urtwn_wme_update(struct ieee80211com *); 355static void urtwn_update_slot(struct ieee80211com *); 356static void urtwn_update_slot_cb(struct urtwn_softc *, 357 union sec_param *); 358static void urtwn_update_aifs(struct urtwn_softc *, uint8_t); 359static uint8_t urtwn_get_multi_pos(const uint8_t[]); 360static void urtwn_set_multi(struct urtwn_softc *); --- 92 unchanged lines hidden (view full) --- 453 uint8_t qid; 454} wme2queue[WME_NUM_AC] = { 455 { R92C_EDCA_BE_PARAM, URTWN_BULK_TX_BE}, 456 { R92C_EDCA_BK_PARAM, URTWN_BULK_TX_BK}, 457 { R92C_EDCA_VI_PARAM, URTWN_BULK_TX_VI}, 458 { R92C_EDCA_VO_PARAM, URTWN_BULK_TX_VO} 459}; 460 | 355static void urtwn_set_channel(struct ieee80211com *); 356static int urtwn_wme_update(struct ieee80211com *); 357static void urtwn_update_slot(struct ieee80211com *); 358static void urtwn_update_slot_cb(struct urtwn_softc *, 359 union sec_param *); 360static void urtwn_update_aifs(struct urtwn_softc *, uint8_t); 361static uint8_t urtwn_get_multi_pos(const uint8_t[]); 362static void urtwn_set_multi(struct urtwn_softc *); --- 92 unchanged lines hidden (view full) --- 455 uint8_t qid; 456} wme2queue[WME_NUM_AC] = { 457 { R92C_EDCA_BE_PARAM, URTWN_BULK_TX_BE}, 458 { R92C_EDCA_BK_PARAM, URTWN_BULK_TX_BK}, 459 { R92C_EDCA_VI_PARAM, URTWN_BULK_TX_VI}, 460 { R92C_EDCA_VO_PARAM, URTWN_BULK_TX_VO} 461}; 462 |
463static const uint8_t urtwn_chan_2ghz[] = 464 { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; 465 |
|
461static int 462urtwn_match(device_t self) 463{ 464 struct usb_attach_arg *uaa = device_get_ivars(self); 465 466 if (uaa->usb_mode != USB_MODE_HOST) 467 return (ENXIO); 468 if (uaa->info.bConfigIndex != URTWN_CONFIG_INDEX) --- 18 unchanged lines hidden (view full) --- 487} 488 489static int 490urtwn_attach(device_t self) 491{ 492 struct usb_attach_arg *uaa = device_get_ivars(self); 493 struct urtwn_softc *sc = device_get_softc(self); 494 struct ieee80211com *ic = &sc->sc_ic; | 466static int 467urtwn_match(device_t self) 468{ 469 struct usb_attach_arg *uaa = device_get_ivars(self); 470 471 if (uaa->usb_mode != USB_MODE_HOST) 472 return (ENXIO); 473 if (uaa->info.bConfigIndex != URTWN_CONFIG_INDEX) --- 18 unchanged lines hidden (view full) --- 492} 493 494static int 495urtwn_attach(device_t self) 496{ 497 struct usb_attach_arg *uaa = device_get_ivars(self); 498 struct urtwn_softc *sc = device_get_softc(self); 499 struct ieee80211com *ic = &sc->sc_ic; |
495 uint8_t bands[IEEE80211_MODE_BYTES]; | |
496 int error; 497 498 device_set_usb_desc(self); 499 sc->sc_udev = uaa->device; 500 sc->sc_dev = self; 501 if (USB_GET_DRIVER_INFO(uaa) == URTWN_RTL8188E) 502 sc->chip |= URTWN_CHIP_88E; 503 --- 99 unchanged lines hidden (view full) --- 603 /* no HT40 just yet */ 604 // ic->ic_htcaps |= IEEE80211_HTCAP_CHWIDTH40; 605 606 /* XXX TODO: verify chains versus streams for urtwn */ 607 ic->ic_txstream = sc->ntxchains; 608 ic->ic_rxstream = sc->nrxchains; 609 } 610 | 500 int error; 501 502 device_set_usb_desc(self); 503 sc->sc_udev = uaa->device; 504 sc->sc_dev = self; 505 if (USB_GET_DRIVER_INFO(uaa) == URTWN_RTL8188E) 506 sc->chip |= URTWN_CHIP_88E; 507 --- 99 unchanged lines hidden (view full) --- 607 /* no HT40 just yet */ 608 // ic->ic_htcaps |= IEEE80211_HTCAP_CHWIDTH40; 609 610 /* XXX TODO: verify chains versus streams for urtwn */ 611 ic->ic_txstream = sc->ntxchains; 612 ic->ic_rxstream = sc->nrxchains; 613 } 614 |
611 memset(bands, 0, sizeof(bands)); 612 setbit(bands, IEEE80211_MODE_11B); 613 setbit(bands, IEEE80211_MODE_11G); 614 if (urtwn_enable_11n) 615 setbit(bands, IEEE80211_MODE_11NG); 616 ieee80211_init_channels(ic, NULL, bands); | 615 /* XXX TODO: setup regdomain if R92C_CHANNEL_PLAN_BY_HW bit is set. */ |
617 | 616 |
617 urtwn_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, 618 ic->ic_channels); 619 |
|
618 ieee80211_ifattach(ic); 619 ic->ic_raw_xmit = urtwn_raw_xmit; 620 ic->ic_scan_start = urtwn_scan_start; 621 ic->ic_scan_end = urtwn_scan_end; | 620 ieee80211_ifattach(ic); 621 ic->ic_raw_xmit = urtwn_raw_xmit; 622 ic->ic_scan_start = urtwn_scan_start; 623 ic->ic_scan_end = urtwn_scan_end; |
624 ic->ic_getradiocaps = urtwn_getradiocaps; |
|
622 ic->ic_set_channel = urtwn_set_channel; 623 ic->ic_transmit = urtwn_transmit; 624 ic->ic_parent = urtwn_parent; 625 ic->ic_vap_create = urtwn_vap_create; 626 ic->ic_vap_delete = urtwn_vap_delete; 627 ic->ic_wme.wme_update = urtwn_wme_update; 628 ic->ic_updateslot = urtwn_update_slot; 629 ic->ic_update_promisc = urtwn_update_promisc; --- 4109 unchanged lines hidden (view full) --- 4739 urtwn_set_rx_bssid_all(sc, 0); 4740 4741 /* Set gain under link. */ 4742 urtwn_set_gain(sc, 0x32); 4743 URTWN_UNLOCK(sc); 4744} 4745 4746static void | 625 ic->ic_set_channel = urtwn_set_channel; 626 ic->ic_transmit = urtwn_transmit; 627 ic->ic_parent = urtwn_parent; 628 ic->ic_vap_create = urtwn_vap_create; 629 ic->ic_vap_delete = urtwn_vap_delete; 630 ic->ic_wme.wme_update = urtwn_wme_update; 631 ic->ic_updateslot = urtwn_update_slot; 632 ic->ic_update_promisc = urtwn_update_promisc; --- 4109 unchanged lines hidden (view full) --- 4742 urtwn_set_rx_bssid_all(sc, 0); 4743 4744 /* Set gain under link. */ 4745 urtwn_set_gain(sc, 0x32); 4746 URTWN_UNLOCK(sc); 4747} 4748 4749static void |
4750urtwn_getradiocaps(struct ieee80211com *ic, 4751 int maxchans, int *nchans, struct ieee80211_channel chans[]) 4752{ 4753 uint8_t bands[IEEE80211_MODE_BYTES]; 4754 4755 memset(bands, 0, sizeof(bands)); 4756 setbit(bands, IEEE80211_MODE_11B); 4757 setbit(bands, IEEE80211_MODE_11G); 4758 if (urtwn_enable_11n) 4759 setbit(bands, IEEE80211_MODE_11NG); 4760 ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, 4761 urtwn_chan_2ghz, nitems(urtwn_chan_2ghz), bands, 0); 4762} 4763 4764static void |
|
4747urtwn_set_channel(struct ieee80211com *ic) 4748{ 4749 struct urtwn_softc *sc = ic->ic_softc; 4750 struct ieee80211_channel *c = ic->ic_curchan; 4751 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); 4752 4753 URTWN_LOCK(sc); 4754 if (vap->iv_state == IEEE80211_S_SCAN) { --- 818 unchanged lines hidden --- | 4765urtwn_set_channel(struct ieee80211com *ic) 4766{ 4767 struct urtwn_softc *sc = ic->ic_softc; 4768 struct ieee80211_channel *c = ic->ic_curchan; 4769 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); 4770 4771 URTWN_LOCK(sc); 4772 if (vap->iv_state == IEEE80211_S_SCAN) { --- 818 unchanged lines hidden --- |