if_rtwn.c (300744) | if_rtwn.c (300754) |
---|---|
1/* $OpenBSD: if_rtwn.c,v 1.6 2015/08/28 00:03:53 deraadt Exp $ */ 2 3/*- 4 * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> 5 * Copyright (c) 2015 Stefan Sperling <stsp@openbsd.org> 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above --- 4 unchanged lines hidden (view full) --- 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20#include <sys/cdefs.h> | 1/* $OpenBSD: if_rtwn.c,v 1.6 2015/08/28 00:03:53 deraadt Exp $ */ 2 3/*- 4 * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> 5 * Copyright (c) 2015 Stefan Sperling <stsp@openbsd.org> 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above --- 4 unchanged lines hidden (view full) --- 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20#include <sys/cdefs.h> |
21__FBSDID("$FreeBSD: head/sys/dev/rtwn/if_rtwn.c 300744 2016-05-26 14:17:57Z avos $"); | 21__FBSDID("$FreeBSD: head/sys/dev/rtwn/if_rtwn.c 300754 2016-05-26 16:39:11Z avos $"); |
22 23/* 24 * Driver for Realtek RTL8188CE 25 */ 26 27#include <sys/param.h> 28#include <sys/sysctl.h> 29#include <sys/sockio.h> --- 137 unchanged lines hidden (view full) --- 167 struct ieee80211_channel *, struct ieee80211_channel *, 168 uint16_t[]); 169static void rtwn_set_txpower(struct rtwn_softc *, 170 struct ieee80211_channel *, struct ieee80211_channel *); 171static void rtwn_set_rx_bssid_all(struct rtwn_softc *, int); 172static void rtwn_set_gain(struct rtwn_softc *, uint8_t); 173static void rtwn_scan_start(struct ieee80211com *); 174static void rtwn_scan_end(struct ieee80211com *); | 22 23/* 24 * Driver for Realtek RTL8188CE 25 */ 26 27#include <sys/param.h> 28#include <sys/sysctl.h> 29#include <sys/sockio.h> --- 137 unchanged lines hidden (view full) --- 167 struct ieee80211_channel *, struct ieee80211_channel *, 168 uint16_t[]); 169static void rtwn_set_txpower(struct rtwn_softc *, 170 struct ieee80211_channel *, struct ieee80211_channel *); 171static void rtwn_set_rx_bssid_all(struct rtwn_softc *, int); 172static void rtwn_set_gain(struct rtwn_softc *, uint8_t); 173static void rtwn_scan_start(struct ieee80211com *); 174static void rtwn_scan_end(struct ieee80211com *); |
175static void rtwn_getradiocaps(struct ieee80211com *, int, int *, 176 struct ieee80211_channel[]); |
|
175static void rtwn_set_channel(struct ieee80211com *); 176static void rtwn_update_mcast(struct ieee80211com *); 177static void rtwn_set_chan(struct rtwn_softc *, 178 struct ieee80211_channel *, struct ieee80211_channel *); 179static int rtwn_iq_calib_chain(struct rtwn_softc *, int, uint16_t[2], 180 uint16_t[2]); 181static void rtwn_iq_calib_run(struct rtwn_softc *, int, uint16_t[2][2], 182 uint16_t[2][2]); --- 42 unchanged lines hidden (view full) --- 225DRIVER_MODULE(rtwn, pci, rtwn_driver, rtwn_devclass, NULL, NULL); 226 227MODULE_VERSION(rtwn, 1); 228 229MODULE_DEPEND(rtwn, pci, 1, 1, 1); 230MODULE_DEPEND(rtwn, wlan, 1, 1, 1); 231MODULE_DEPEND(rtwn, firmware, 1, 1, 1); 232 | 177static void rtwn_set_channel(struct ieee80211com *); 178static void rtwn_update_mcast(struct ieee80211com *); 179static void rtwn_set_chan(struct rtwn_softc *, 180 struct ieee80211_channel *, struct ieee80211_channel *); 181static int rtwn_iq_calib_chain(struct rtwn_softc *, int, uint16_t[2], 182 uint16_t[2]); 183static void rtwn_iq_calib_run(struct rtwn_softc *, int, uint16_t[2][2], 184 uint16_t[2][2]); --- 42 unchanged lines hidden (view full) --- 227DRIVER_MODULE(rtwn, pci, rtwn_driver, rtwn_devclass, NULL, NULL); 228 229MODULE_VERSION(rtwn, 1); 230 231MODULE_DEPEND(rtwn, pci, 1, 1, 1); 232MODULE_DEPEND(rtwn, wlan, 1, 1, 1); 233MODULE_DEPEND(rtwn, firmware, 1, 1, 1); 234 |
235static const uint8_t rtwn_chan_2ghz[] = 236 { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; 237 |
|
233static int 234rtwn_probe(device_t dev) 235{ 236 const struct rtwn_ident *ident; 237 238 for (ident = rtwn_ident_table; ident->name != NULL; ident++) { 239 if (pci_get_vendor(dev) == ident->vendor && 240 pci_get_device(dev) == ident->device) { --- 5 unchanged lines hidden (view full) --- 246} 247 248static int 249rtwn_attach(device_t dev) 250{ 251 struct rtwn_softc *sc = device_get_softc(dev); 252 struct ieee80211com *ic = &sc->sc_ic; 253 uint32_t lcsr; | 238static int 239rtwn_probe(device_t dev) 240{ 241 const struct rtwn_ident *ident; 242 243 for (ident = rtwn_ident_table; ident->name != NULL; ident++) { 244 if (pci_get_vendor(dev) == ident->vendor && 245 pci_get_device(dev) == ident->device) { --- 5 unchanged lines hidden (view full) --- 251} 252 253static int 254rtwn_attach(device_t dev) 255{ 256 struct rtwn_softc *sc = device_get_softc(dev); 257 struct ieee80211com *ic = &sc->sc_ic; 258 uint32_t lcsr; |
254 uint8_t bands[IEEE80211_MODE_BYTES]; | |
255 int i, count, error, rid; 256 257 sc->sc_dev = dev; 258 sc->sc_debug = 0; 259 260 /* 261 * Get the offset of the PCI Express Capability Structure in PCI 262 * Configuration Space. --- 84 unchanged lines hidden (view full) --- 347 | IEEE80211_C_MONITOR /* monitor mode */ 348 | IEEE80211_C_SHPREAMBLE /* short preamble supported */ 349 | IEEE80211_C_SHSLOT /* short slot time supported */ 350 | IEEE80211_C_WPA /* capable of WPA1+WPA2 */ 351 | IEEE80211_C_BGSCAN /* capable of bg scanning */ 352 | IEEE80211_C_WME /* 802.11e */ 353 ; 354 | 259 int i, count, error, rid; 260 261 sc->sc_dev = dev; 262 sc->sc_debug = 0; 263 264 /* 265 * Get the offset of the PCI Express Capability Structure in PCI 266 * Configuration Space. --- 84 unchanged lines hidden (view full) --- 351 | IEEE80211_C_MONITOR /* monitor mode */ 352 | IEEE80211_C_SHPREAMBLE /* short preamble supported */ 353 | IEEE80211_C_SHSLOT /* short slot time supported */ 354 | IEEE80211_C_WPA /* capable of WPA1+WPA2 */ 355 | IEEE80211_C_BGSCAN /* capable of bg scanning */ 356 | IEEE80211_C_WME /* 802.11e */ 357 ; 358 |
355 memset(bands, 0, sizeof(bands)); 356 setbit(bands, IEEE80211_MODE_11B); 357 setbit(bands, IEEE80211_MODE_11G); 358 ieee80211_init_channels(ic, NULL, bands); | 359 /* XXX TODO: setup regdomain if R92C_CHANNEL_PLAN_BY_HW bit is set. */ |
359 | 360 |
361 rtwn_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, 362 ic->ic_channels); 363 |
|
360 ieee80211_ifattach(ic); 361 362 ic->ic_wme.wme_update = rtwn_updateedca; 363 ic->ic_update_mcast = rtwn_update_mcast; | 364 ieee80211_ifattach(ic); 365 366 ic->ic_wme.wme_update = rtwn_updateedca; 367 ic->ic_update_mcast = rtwn_update_mcast; |
364 ic->ic_scan_start =rtwn_scan_start; | 368 ic->ic_scan_start = rtwn_scan_start; |
365 ic->ic_scan_end = rtwn_scan_end; | 369 ic->ic_scan_end = rtwn_scan_end; |
370 ic->ic_getradiocaps = rtwn_getradiocaps; |
|
366 ic->ic_set_channel = rtwn_set_channel; 367 ic->ic_raw_xmit = rtwn_raw_xmit; 368 ic->ic_transmit = rtwn_transmit; 369 ic->ic_parent = rtwn_parent; 370 ic->ic_vap_create = rtwn_vap_create; 371 ic->ic_vap_delete = rtwn_vap_delete; 372 373 ieee80211_radiotap_attach(ic, --- 2338 unchanged lines hidden (view full) --- 2712 /* Restore limitations. */ 2713 rtwn_set_rx_bssid_all(sc, 0); 2714 /* Set gain under link. */ 2715 rtwn_set_gain(sc, 0x32); 2716 RTWN_UNLOCK(sc); 2717} 2718 2719static void | 371 ic->ic_set_channel = rtwn_set_channel; 372 ic->ic_raw_xmit = rtwn_raw_xmit; 373 ic->ic_transmit = rtwn_transmit; 374 ic->ic_parent = rtwn_parent; 375 ic->ic_vap_create = rtwn_vap_create; 376 ic->ic_vap_delete = rtwn_vap_delete; 377 378 ieee80211_radiotap_attach(ic, --- 2338 unchanged lines hidden (view full) --- 2717 /* Restore limitations. */ 2718 rtwn_set_rx_bssid_all(sc, 0); 2719 /* Set gain under link. */ 2720 rtwn_set_gain(sc, 0x32); 2721 RTWN_UNLOCK(sc); 2722} 2723 2724static void |
2725rtwn_getradiocaps(struct ieee80211com *ic, 2726 int maxchans, int *nchans, struct ieee80211_channel chans[]) 2727{ 2728 uint8_t bands[IEEE80211_MODE_BYTES]; 2729 2730 memset(bands, 0, sizeof(bands)); 2731 setbit(bands, IEEE80211_MODE_11B); 2732 setbit(bands, IEEE80211_MODE_11G); 2733 ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, 2734 rtwn_chan_2ghz, nitems(rtwn_chan_2ghz), bands, 0); 2735} 2736 2737static void |
|
2720rtwn_set_channel(struct ieee80211com *ic) 2721{ 2722 struct rtwn_softc *sc = ic->ic_softc; 2723 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); 2724 2725 RTWN_LOCK(sc); 2726 if (vap->iv_state == IEEE80211_S_SCAN) { 2727 /* Make link LED blink during scan. */ --- 766 unchanged lines hidden --- | 2738rtwn_set_channel(struct ieee80211com *ic) 2739{ 2740 struct rtwn_softc *sc = ic->ic_softc; 2741 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); 2742 2743 RTWN_LOCK(sc); 2744 if (vap->iv_state == IEEE80211_S_SCAN) { 2745 /* Make link LED blink during scan. */ --- 766 unchanged lines hidden --- |