if_urtw.c (299176) | if_urtw.c (300753) |
---|---|
1/*- 2 * Copyright (c) 2008 Weongyo Jeong <weongyo@FreeBSD.org> 3 * 4 * Permission to use, copy, modify, and distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2008 Weongyo Jeong <weongyo@FreeBSD.org> 3 * 4 * Permission to use, copy, modify, and distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17#include <sys/cdefs.h> |
18__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_urtw.c 299176 2016-05-06 15:09:21Z pfg $"); | 18__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_urtw.c 300753 2016-05-26 16:15:10Z avos $"); |
19#include <sys/param.h> 20#include <sys/sockio.h> 21#include <sys/sysctl.h> 22#include <sys/lock.h> 23#include <sys/mutex.h> 24#include <sys/mbuf.h> 25#include <sys/kernel.h> 26#include <sys/socket.h> --- 174 unchanged lines hidden (view full) --- 201 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x20, 0x21, 0x22, 0x23, 202 0x24, 0x25, 0x26, 0x26, 0x27, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2a, 203 0x2a, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c, 0x2c, 0x2d, 0x2d, 0x2d, 0x2d, 204 0x2e, 0x2e, 0x2e, 0x2e, 0x2f, 0x2f, 0x2f, 0x30, 0x30, 0x31, 0x31, 205 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 206 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31 207}; 208 | 19#include <sys/param.h> 20#include <sys/sockio.h> 21#include <sys/sysctl.h> 22#include <sys/lock.h> 23#include <sys/mutex.h> 24#include <sys/mbuf.h> 25#include <sys/kernel.h> 26#include <sys/socket.h> --- 174 unchanged lines hidden (view full) --- 201 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x20, 0x21, 0x22, 0x23, 202 0x24, 0x25, 0x26, 0x26, 0x27, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2a, 203 0x2a, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c, 0x2c, 0x2d, 0x2d, 0x2d, 0x2d, 204 0x2e, 0x2e, 0x2e, 0x2e, 0x2f, 0x2f, 0x2f, 0x30, 0x30, 0x31, 0x31, 205 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 206 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31 207}; 208 |
209static const uint8_t urtw_chan_2ghz[] = 210 { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; 211 |
|
209static uint32_t urtw_8225_channel[] = { 210 0x0000, /* dummy channel 0 */ 211 0x085c, /* 1 */ 212 0x08dc, /* 2 */ 213 0x095c, /* 3 */ 214 0x09dc, /* 4 */ 215 0x0a5c, /* 5 */ 216 0x0adc, /* 6 */ --- 440 unchanged lines hidden (view full) --- 657static int urtw_transmit(struct ieee80211com *, struct mbuf *); 658static void urtw_start(struct urtw_softc *); 659static int urtw_alloc_rx_data_list(struct urtw_softc *); 660static int urtw_alloc_tx_data_list(struct urtw_softc *); 661static int urtw_raw_xmit(struct ieee80211_node *, struct mbuf *, 662 const struct ieee80211_bpf_params *); 663static void urtw_scan_start(struct ieee80211com *); 664static void urtw_scan_end(struct ieee80211com *); | 212static uint32_t urtw_8225_channel[] = { 213 0x0000, /* dummy channel 0 */ 214 0x085c, /* 1 */ 215 0x08dc, /* 2 */ 216 0x095c, /* 3 */ 217 0x09dc, /* 4 */ 218 0x0a5c, /* 5 */ 219 0x0adc, /* 6 */ --- 440 unchanged lines hidden (view full) --- 660static int urtw_transmit(struct ieee80211com *, struct mbuf *); 661static void urtw_start(struct urtw_softc *); 662static int urtw_alloc_rx_data_list(struct urtw_softc *); 663static int urtw_alloc_tx_data_list(struct urtw_softc *); 664static int urtw_raw_xmit(struct ieee80211_node *, struct mbuf *, 665 const struct ieee80211_bpf_params *); 666static void urtw_scan_start(struct ieee80211com *); 667static void urtw_scan_end(struct ieee80211com *); |
668static void urtw_getradiocaps(struct ieee80211com *, int, int *, 669 struct ieee80211_channel[]); |
|
665static void urtw_set_channel(struct ieee80211com *); 666static void urtw_update_mcast(struct ieee80211com *); 667static int urtw_tx_start(struct urtw_softc *, 668 struct ieee80211_node *, struct mbuf *, 669 struct urtw_data *, int); 670static int urtw_newstate(struct ieee80211vap *, 671 enum ieee80211_state, int); 672static void urtw_led_ch(void *); --- 107 unchanged lines hidden (view full) --- 780static int 781urtw_attach(device_t dev) 782{ 783 const struct usb_config *setup_start; 784 int ret = ENXIO; 785 struct urtw_softc *sc = device_get_softc(dev); 786 struct usb_attach_arg *uaa = device_get_ivars(dev); 787 struct ieee80211com *ic = &sc->sc_ic; | 670static void urtw_set_channel(struct ieee80211com *); 671static void urtw_update_mcast(struct ieee80211com *); 672static int urtw_tx_start(struct urtw_softc *, 673 struct ieee80211_node *, struct mbuf *, 674 struct urtw_data *, int); 675static int urtw_newstate(struct ieee80211vap *, 676 enum ieee80211_state, int); 677static void urtw_led_ch(void *); --- 107 unchanged lines hidden (view full) --- 785static int 786urtw_attach(device_t dev) 787{ 788 const struct usb_config *setup_start; 789 int ret = ENXIO; 790 struct urtw_softc *sc = device_get_softc(dev); 791 struct usb_attach_arg *uaa = device_get_ivars(dev); 792 struct ieee80211com *ic = &sc->sc_ic; |
788 uint8_t bands[IEEE80211_MODE_BYTES]; | |
789 uint8_t iface_index = URTW_IFACE_INDEX; /* XXX */ 790 uint16_t n_setup; 791 uint32_t data; 792 usb_error_t error; 793 794 device_set_usb_desc(dev); 795 796 sc->sc_dev = dev; --- 75 unchanged lines hidden (view full) --- 872 IEEE80211_C_STA | /* station mode */ 873 IEEE80211_C_MONITOR | /* monitor mode supported */ 874 IEEE80211_C_TXPMGT | /* tx power management */ 875 IEEE80211_C_SHPREAMBLE | /* short preamble supported */ 876 IEEE80211_C_SHSLOT | /* short slot time supported */ 877 IEEE80211_C_BGSCAN | /* capable of bg scanning */ 878 IEEE80211_C_WPA; /* 802.11i */ 879 | 793 uint8_t iface_index = URTW_IFACE_INDEX; /* XXX */ 794 uint16_t n_setup; 795 uint32_t data; 796 usb_error_t error; 797 798 device_set_usb_desc(dev); 799 800 sc->sc_dev = dev; --- 75 unchanged lines hidden (view full) --- 876 IEEE80211_C_STA | /* station mode */ 877 IEEE80211_C_MONITOR | /* monitor mode supported */ 878 IEEE80211_C_TXPMGT | /* tx power management */ 879 IEEE80211_C_SHPREAMBLE | /* short preamble supported */ 880 IEEE80211_C_SHSLOT | /* short slot time supported */ 881 IEEE80211_C_BGSCAN | /* capable of bg scanning */ 882 IEEE80211_C_WPA; /* 802.11i */ 883 |
880 memset(bands, 0, sizeof(bands)); 881 setbit(bands, IEEE80211_MODE_11B); 882 setbit(bands, IEEE80211_MODE_11G); 883 ieee80211_init_channels(ic, NULL, bands); | 884 /* XXX TODO: setup regdomain if URTW_EPROM_CHANPLAN_BY_HW bit is set.*/ 885 886 urtw_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, 887 ic->ic_channels); |
884 885 ieee80211_ifattach(ic); 886 ic->ic_raw_xmit = urtw_raw_xmit; 887 ic->ic_scan_start = urtw_scan_start; 888 ic->ic_scan_end = urtw_scan_end; | 888 889 ieee80211_ifattach(ic); 890 ic->ic_raw_xmit = urtw_raw_xmit; 891 ic->ic_scan_start = urtw_scan_start; 892 ic->ic_scan_end = urtw_scan_end; |
893 ic->ic_getradiocaps = urtw_getradiocaps; |
|
889 ic->ic_set_channel = urtw_set_channel; 890 ic->ic_updateslot = urtw_updateslot; 891 ic->ic_vap_create = urtw_vap_create; 892 ic->ic_vap_delete = urtw_vap_delete; 893 ic->ic_update_mcast = urtw_update_mcast; 894 ic->ic_parent = urtw_parent; 895 ic->ic_transmit = urtw_transmit; 896 --- 662 unchanged lines hidden (view full) --- 1559static void 1560urtw_scan_end(struct ieee80211com *ic) 1561{ 1562 1563 /* XXX do nothing? */ 1564} 1565 1566static void | 894 ic->ic_set_channel = urtw_set_channel; 895 ic->ic_updateslot = urtw_updateslot; 896 ic->ic_vap_create = urtw_vap_create; 897 ic->ic_vap_delete = urtw_vap_delete; 898 ic->ic_update_mcast = urtw_update_mcast; 899 ic->ic_parent = urtw_parent; 900 ic->ic_transmit = urtw_transmit; 901 --- 662 unchanged lines hidden (view full) --- 1564static void 1565urtw_scan_end(struct ieee80211com *ic) 1566{ 1567 1568 /* XXX do nothing? */ 1569} 1570 1571static void |
1572urtw_getradiocaps(struct ieee80211com *ic, 1573 int maxchans, int *nchans, struct ieee80211_channel chans[]) 1574{ 1575 uint8_t bands[IEEE80211_MODE_BYTES]; 1576 1577 memset(bands, 0, sizeof(bands)); 1578 setbit(bands, IEEE80211_MODE_11B); 1579 setbit(bands, IEEE80211_MODE_11G); 1580 ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, 1581 urtw_chan_2ghz, nitems(urtw_chan_2ghz), bands, 0); 1582} 1583 1584static void |
|
1567urtw_set_channel(struct ieee80211com *ic) 1568{ 1569 struct urtw_softc *sc = ic->ic_softc; 1570 uint32_t data, orig; 1571 usb_error_t error; 1572 1573 /* 1574 * if the user set a channel explicitly using ifconfig(8) this function --- 2812 unchanged lines hidden --- | 1585urtw_set_channel(struct ieee80211com *ic) 1586{ 1587 struct urtw_softc *sc = ic->ic_softc; 1588 uint32_t data, orig; 1589 usb_error_t error; 1590 1591 /* 1592 * if the user set a channel explicitly using ifconfig(8) this function --- 2812 unchanged lines hidden --- |