Page MenuHomeFreeBSD

D6235.diff
No OneTemporary

D6235.diff

Index: head/sys/dev/wi/if_wi.c
===================================================================
--- head/sys/dev/wi/if_wi.c
+++ head/sys/dev/wi/if_wi.c
@@ -155,9 +155,12 @@
static int wi_read_rid(struct wi_softc *, int, void *, int *);
static int wi_write_rid(struct wi_softc *, int, const void *, int);
static int wi_write_appie(struct wi_softc *, int, const struct ieee80211_appie *);
+static u_int16_t wi_read_chanmask(struct wi_softc *);
static void wi_scan_start(struct ieee80211com *);
static void wi_scan_end(struct ieee80211com *);
+static void wi_getradiocaps(struct ieee80211com *, int, int *,
+ struct ieee80211_channel[]);
static void wi_set_channel(struct ieee80211com *);
static __inline int
@@ -335,23 +338,9 @@
* Query the card for available channels and setup the
* channel table. We assume these are all 11b channels.
*/
- buflen = sizeof(val);
- if (wi_read_rid(sc, WI_RID_CHANNEL_LIST, &val, &buflen) != 0)
- val = htole16(0x1fff); /* assume 1-13 */
- KASSERT(val != 0, ("wi_attach: no available channels listed!"));
-
- val <<= 1; /* shift for base 1 indices */
- for (i = 1; i < 16; i++) {
- struct ieee80211_channel *c;
-
- if (!isset((u_int8_t*)&val, i))
- continue;
- c = &ic->ic_channels[ic->ic_nchans++];
- c->ic_freq = ieee80211_ieee2mhz(i, IEEE80211_CHAN_B);
- c->ic_flags = IEEE80211_CHAN_B;
- c->ic_ieee = i;
- /* XXX txpowers? */
- }
+ sc->sc_chanmask = wi_read_chanmask(sc);
+ wi_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans,
+ ic->ic_channels);
/*
* Set flags based on firmware version.
@@ -439,6 +428,7 @@
ic->ic_raw_xmit = wi_raw_xmit;
ic->ic_scan_start = wi_scan_start;
ic->ic_scan_end = wi_scan_end;
+ ic->ic_getradiocaps = wi_getradiocaps;
ic->ic_set_channel = wi_set_channel;
ic->ic_vap_create = wi_vap_create;
ic->ic_vap_delete = wi_vap_delete;
@@ -697,6 +687,26 @@
}
static void
+wi_getradiocaps(struct ieee80211com *ic,
+ int maxchans, int *nchans, struct ieee80211_channel chans[])
+{
+ struct wi_softc *sc = ic->ic_softc;
+ u_int8_t bands[IEEE80211_MODE_MAX];
+ int i;
+
+ memset(bands, 0, sizeof(bands));
+ setbit(bands, IEEE80211_MODE_11B);
+
+ for (i = 1; i < 16; i++) {
+ if (sc->sc_chanmask & (1 << i)) {
+ /* XXX txpowers? */
+ ieee80211_add_channel(chans, maxchans, nchans,
+ i, 0, 0, 0, bands);
+ }
+ }
+}
+
+static void
wi_set_channel(struct ieee80211com *ic)
{
struct wi_softc *sc = ic->ic_softc;
@@ -1988,6 +1998,22 @@
return wi_write_rid(sc, rid, buf, ie->ie_len + sizeof(uint16_t));
}
+static u_int16_t
+wi_read_chanmask(struct wi_softc *sc)
+{
+ u_int16_t val;
+ int buflen;
+
+ buflen = sizeof(val);
+ if (wi_read_rid(sc, WI_RID_CHANNEL_LIST, &val, &buflen) != 0)
+ val = htole16(0x1fff); /* assume 1-13 */
+ KASSERT(val != 0, ("%s: no available channels listed!", __func__));
+
+ val <<= 1; /* shift for base 1 indices */
+
+ return (val);
+}
+
int
wi_alloc(device_t dev, int rid)
{
Index: head/sys/dev/wi/if_wivar.h
===================================================================
--- head/sys/dev/wi/if_wivar.h
+++ head/sys/dev/wi/if_wivar.h
@@ -114,6 +114,7 @@
u_int16_t sc_portnum;
u_int16_t sc_encryption;
u_int16_t sc_monitor_port;
+ u_int16_t sc_chanmask;
/* RSSI interpretation */
u_int16_t sc_min_rssi; /* clamp sc_min_rssi < RSSI */

File Metadata

Mime Type
text/plain
Expires
Thu, Apr 2, 6:23 PM (11 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30733097
Default Alt Text
D6235.diff (3 KB)

Event Timeline