From owner-svn-src-head@freebsd.org Sun May 1 18:15:41 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C745AB29D89; Sun, 1 May 2016 18:15:41 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A21591F96; Sun, 1 May 2016 18:15:41 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u41IFelm051491; Sun, 1 May 2016 18:15:40 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u41IFedJ051489; Sun, 1 May 2016 18:15:40 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201605011815.u41IFedJ051489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 1 May 2016 18:15:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298894 - head/sys/dev/otus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 May 2016 18:15:41 -0000 Author: avos Date: Sun May 1 18:15:40 2016 New Revision: 298894 URL: https://svnweb.freebsd.org/changeset/base/298894 Log: otus: switch to ieee80211_add_channel_list_*() - Use device's channel list instead of default one (from ieee80211_init_channels()). - Sort channels (ieee80211_add_channel_list_* requirement). - Add ic_getradiocaps() method. Added channels: 2GHz band: 12, 13 and 14. 5GHz band: 34, 38, 42, 46 and 165. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D6145 Modified: head/sys/dev/otus/if_otus.c head/sys/dev/otus/if_otusreg.h Modified: head/sys/dev/otus/if_otus.c ============================================================================== --- head/sys/dev/otus/if_otus.c Sun May 1 18:09:34 2016 (r298893) +++ head/sys/dev/otus/if_otus.c Sun May 1 18:15:40 2016 (r298894) @@ -132,6 +132,8 @@ static device_detach_t otus_detach; static int otus_attachhook(struct otus_softc *); void otus_get_chanlist(struct otus_softc *); +static void otus_getradiocaps(struct ieee80211com *, int, int *, + struct ieee80211_channel[]); int otus_load_firmware(struct otus_softc *, const char *, uint32_t); int otus_open_pipes(struct otus_softc *); @@ -624,7 +626,6 @@ otus_attachhook(struct otus_softc *sc) struct ieee80211com *ic = &sc->sc_ic; usb_device_request_t req; uint32_t in, out; - uint8_t bands[IEEE80211_MODE_BYTES]; int error; /* Not locked */ @@ -742,20 +743,8 @@ otus_attachhook(struct otus_softc *sc) /* Build the list of supported channels. */ otus_get_chanlist(sc); #else - /* Set supported .11b and .11g rates. */ - memset(bands, 0, sizeof(bands)); - if (sc->eeprom.baseEepHeader.opCapFlags & AR5416_OPFLAGS_11G) { - setbit(bands, IEEE80211_MODE_11B); - setbit(bands, IEEE80211_MODE_11G); - } - if (sc->eeprom.baseEepHeader.opCapFlags & AR5416_OPFLAGS_11A) { - setbit(bands, IEEE80211_MODE_11A); - } -#if 0 - if (sc->sc_ht) - setbit(bands, IEEE80211_MODE_11NG); -#endif - ieee80211_init_channels(ic, NULL, bands); + otus_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, + ic->ic_channels); #endif ieee80211_ifattach(ic); @@ -763,6 +752,7 @@ otus_attachhook(struct otus_softc *sc) ic->ic_scan_start = otus_scan_start; ic->ic_scan_end = otus_scan_end; ic->ic_set_channel = otus_set_channel; + ic->ic_getradiocaps = otus_getradiocaps; ic->ic_vap_create = otus_vap_create; ic->ic_vap_delete = otus_vap_delete; ic->ic_update_mcast = otus_update_mcast; @@ -820,6 +810,32 @@ otus_get_chanlist(struct otus_softc *sc) } } +static void +otus_getradiocaps(struct ieee80211com *ic, + int maxchans, int *nchans, struct ieee80211_channel chans[]) +{ + struct otus_softc *sc = ic->ic_softc; + uint8_t bands[IEEE80211_MODE_BYTES]; + + /* Set supported .11b and .11g rates. */ + memset(bands, 0, sizeof(bands)); + if (sc->eeprom.baseEepHeader.opCapFlags & AR5416_OPFLAGS_11G) { + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); +#if 0 + if (sc->sc_ht) + setbit(bands, IEEE80211_MODE_11NG); +#endif + ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, + ar_chans, 14, bands, 0); + } + if (sc->eeprom.baseEepHeader.opCapFlags & AR5416_OPFLAGS_11A) { + setbit(bands, IEEE80211_MODE_11A); + ieee80211_add_channel_list_5ghz(chans, maxchans, nchans, + &ar_chans[14], nitems(ar_chans) - 14, bands, 0); + } +} + int otus_load_firmware(struct otus_softc *sc, const char *name, uint32_t addr) { Modified: head/sys/dev/otus/if_otusreg.h ============================================================================== --- head/sys/dev/otus/if_otusreg.h Sun May 1 18:09:34 2016 (r298893) +++ head/sys/dev/otus/if_otusreg.h Sun May 1 18:15:40 2016 (r298894) @@ -348,8 +348,8 @@ struct ar_evt_tx_comp { /* List of supported channels. */ static const uint8_t ar_chans[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, - 128, 132, 136, 140, 149, 153, 157, 161, 165, 34, 38, 42, 46 + 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, 100, 104, 108, + 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 }; /*