Date: Thu, 26 May 2016 15:05:37 +0000 (UTC) From: Andriy Voskoboinyk <avos@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300748 - head/sys/dev/usb/wlan Message-ID: <201605261505.u4QF5bLU088493@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avos Date: Thu May 26 15:05:37 2016 New Revision: 300748 URL: https://svnweb.freebsd.org/changeset/base/300748 Log: run: switch to ieee80211_add_channel_list_*() - Use device's channel list instead of default one (from ieee80211_init_channels()). - Add ic_getradiocaps() method. Differential Revision: https://reviews.freebsd.org/D6144 Modified: head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_runreg.h Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Thu May 26 14:26:49 2016 (r300747) +++ head/sys/dev/usb/wlan/if_run.c Thu May 26 15:05:37 2016 (r300748) @@ -423,6 +423,8 @@ static void run_rt5390_set_chan(struct r static void run_rt5592_set_chan(struct run_softc *, u_int); static int run_set_chan(struct run_softc *, struct ieee80211_channel *); static void run_set_channel(struct ieee80211com *); +static void run_getradiocaps(struct ieee80211com *, int, int *, + struct ieee80211_channel[]); static void run_scan_start(struct ieee80211com *); static void run_scan_end(struct ieee80211com *); static void run_update_beacon(struct ieee80211vap *, int); @@ -704,7 +706,6 @@ run_attach(device_t self) struct usb_attach_arg *uaa = device_get_ivars(self); struct ieee80211com *ic = &sc->sc_ic; uint32_t ver; - uint8_t bands[IEEE80211_MODE_BYTES]; uint8_t iface_index; int ntries, error; @@ -786,20 +787,15 @@ run_attach(device_t self) ic->ic_flags |= IEEE80211_F_DATAPAD; ic->ic_flags_ext |= IEEE80211_FEXT_SWBMISS; - memset(bands, 0, sizeof(bands)); - setbit(bands, IEEE80211_MODE_11B); - setbit(bands, IEEE80211_MODE_11G); - if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850 || - sc->rf_rev == RT3070_RF_3052 || sc->rf_rev == RT3593_RF_3053 || - sc->rf_rev == RT5592_RF_5592) - setbit(bands, IEEE80211_MODE_11A); - ieee80211_init_channels(ic, NULL, bands); + run_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, + ic->ic_channels); ieee80211_ifattach(ic); ic->ic_scan_start = run_scan_start; ic->ic_scan_end = run_scan_end; ic->ic_set_channel = run_set_channel; + ic->ic_getradiocaps = run_getradiocaps; ic->ic_node_alloc = run_node_alloc; ic->ic_newassoc = run_newassoc; ic->ic_updateslot = run_updateslot; @@ -4784,6 +4780,28 @@ run_set_channel(struct ieee80211com *ic) } static void +run_getradiocaps(struct ieee80211com *ic, + int maxchans, int *nchans, struct ieee80211_channel chans[]) +{ + struct run_softc *sc = ic->ic_softc; + uint8_t bands[IEEE80211_MODE_BYTES]; + + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); + ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, + run_chan_2ghz, nitems(run_chan_2ghz), bands, 0); + + if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850 || + sc->rf_rev == RT3070_RF_3052 || sc->rf_rev == RT3593_RF_3053 || + sc->rf_rev == RT5592_RF_5592) { + setbit(bands, IEEE80211_MODE_11A); + ieee80211_add_channel_list_5ghz(chans, maxchans, nchans, + run_chan_5ghz, nitems(run_chan_5ghz), bands, 0); + } +} + +static void run_scan_start(struct ieee80211com *ic) { struct run_softc *sc = ic->ic_softc; Modified: head/sys/dev/usb/wlan/if_runreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_runreg.h Thu May 26 14:26:49 2016 (r300747) +++ head/sys/dev/usb/wlan/if_runreg.h Thu May 26 15:05:37 2016 (r300748) @@ -1084,6 +1084,18 @@ struct rt2860_rxwi { { 137, 0x0f } /* + * Channel map for run(4) driver; taken from the table below. + */ +static const uint8_t run_chan_2ghz[] = + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; + +static const uint8_t run_chan_5ghz[] = + { 36, 38, 40, 44, 46, 48, 52, 54, 56, 60, 62, 64, 100, 102, 104, + 108, 110, 112, 116, 118, 120, 124, 126, 128, 132, 134, 136, 140, + 149, 151, 153, 157, 159, 161, 165, 167, 169, 171, 173, + 184, 188, 192, 196, 208, 212, 216 }; + +/* * Default settings for RF registers; values derived from the reference driver. */ #define RT2860_RF2850 \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605261505.u4QF5bLU088493>