summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravos <avos@FreeBSD.org>2016-05-01 18:15:40 +0000
committeravos <avos@FreeBSD.org>2016-05-01 18:15:40 +0000
commit41063b98db147ceaafea714016c094848983eda6 (patch)
treedcf51c14f0bcd53b12108831335c71464f3a3f02
parent901b3490679b3dfc224405c76cac08dda29c44b5 (diff)
downloadFreeBSD-src-41063b98db147ceaafea714016c094848983eda6.zip
FreeBSD-src-41063b98db147ceaafea714016c094848983eda6.tar.gz
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
-rw-r--r--sys/dev/otus/if_otus.c46
-rw-r--r--sys/dev/otus/if_otusreg.h4
2 files changed, 33 insertions, 17 deletions
diff --git a/sys/dev/otus/if_otus.c b/sys/dev/otus/if_otus.c
index d291132..6539bbb 100644
--- a/sys/dev/otus/if_otus.c
+++ b/sys/dev/otus/if_otus.c
@@ -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)
{
diff --git a/sys/dev/otus/if_otusreg.h b/sys/dev/otus/if_otusreg.h
index 541d767..f7b1eda 100644
--- a/sys/dev/otus/if_otusreg.h
+++ b/sys/dev/otus/if_otusreg.h
@@ -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
};
/*
OpenPOWER on IntegriCloud