PERFORCE change 112407 for review
Kip Macy
kmacy at FreeBSD.org
Mon Jan 1 17:34:04 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=112407
Change 112407 by kmacy at kmacy_serendipity:sam_wifi on 2007/01/02 01:33:30
- convert channel initialization to packed format
- getting a firmware error kicks the device restart task which can race
with unload, only restart if the interface is up
- still need to track down and fix the source of the firmware error
Affected files ...
.. //depot/projects/wifi/sys/dev/iwi/if_iwi.c#16 edit
Differences ...
==== //depot/projects/wifi/sys/dev/iwi/if_iwi.c#16 (text+ko) ====
@@ -259,7 +259,7 @@
struct ieee80211com *ic = &sc->sc_ic;
struct ieee80211_channel *c;
uint16_t val;
- int error, i;
+ int error, i, j;
sc->sc_dev = dev;
@@ -269,12 +269,12 @@
sc->sc_unr = new_unrhdr(1, IWI_MAX_IBSSNODE-1, &sc->sc_mtx);
#if __FreeBSD_version >= 700000
- sc->sc_tq = taskqueue_create("iwi_taskq", M_NOWAIT,
+ sc->sc_tq = taskqueue_create("iwi_taskq", M_NOWAIT | M_ZERO,
taskqueue_thread_enqueue, &sc->sc_tq);
taskqueue_start_threads(&sc->sc_tq, 1, PI_NET, "%s taskq",
device_get_nameunit(dev));
#else
- sc->sc_tq = taskqueue_create("iwi_taskq", M_NOWAIT,
+ sc->sc_tq = taskqueue_create("iwi_taskq", M_NOWAIT | M_ZERO,
taskqueue_thread_enqueue, &sc->sc_tq, &sc->sc_tqproc);
kthread_create(taskqueue_thread_loop, &sc->sc_tq, &sc->sc_tqproc,
0, 0, "%s taskq", device_get_nameunit(dev));
@@ -408,38 +408,43 @@
val = iwi_read_prom_word(sc, IWI_EEPROM_MAC + 2);
ic->ic_myaddr[4] = val & 0xff;
ic->ic_myaddr[5] = val >> 8;
+
+ /* set supported .11b and .11g channels (1 through 14) */
+ for (j = 0, i = 1; i <= 14; i++) {
+ c = &ic->ic_channels[j++];
+ c->ic_freq = ieee80211_ieee2mhz(i, IEEE80211_CHAN_2GHZ);
+ c->ic_flags = IEEE80211_CHAN_B;
+ c->ic_ieee = i;
+ c = &ic->ic_channels[j++];
+ c->ic_freq = ieee80211_ieee2mhz(i, IEEE80211_CHAN_2GHZ);
+ c->ic_flags = IEEE80211_CHAN_G;
+ c->ic_ieee = i;
+ }
if (pci_get_device(dev) >= 0x4223) {
/* set supported .11a rates (2915ABG only) */
ic->ic_sup_rates[IEEE80211_MODE_11A] = iwi_rateset_11a;
/* set supported .11a channels */
- for (i = 36; i <= 64; i += 4) {
- ic->ic_channels[i].ic_freq =
+ for (i = 36; i <= 64; i += 4, j++) {
+ ic->ic_channels[j].ic_freq =
ieee80211_ieee2mhz(i, IEEE80211_CHAN_5GHZ);
- ic->ic_channels[i].ic_flags = IEEE80211_CHAN_A;
+ ic->ic_channels[j].ic_flags = IEEE80211_CHAN_A;
+ ic->ic_channels[j].ic_ieee = i;
}
- for (i = 149; i <= 165; i += 4) {
- ic->ic_channels[i].ic_freq =
+ for (i = 149; i <= 165; i += 4, j++) {
+ ic->ic_channels[j].ic_freq =
ieee80211_ieee2mhz(i, IEEE80211_CHAN_5GHZ);
- ic->ic_channels[i].ic_flags = IEEE80211_CHAN_A;
+ ic->ic_channels[j].ic_flags = IEEE80211_CHAN_A;
+ ic->ic_channels[j].ic_ieee = i;
}
}
/* set supported .11b and .11g rates */
ic->ic_sup_rates[IEEE80211_MODE_11B] = iwi_rateset_11b;
ic->ic_sup_rates[IEEE80211_MODE_11G] = iwi_rateset_11g;
+ ic->ic_nchans = j;
- /* set supported .11b and .11g channels (1 through 14) */
- for (i = 1; i <= 14; i++) {
- c = &ic->ic_channels[ic->ic_nchans++];
- c->ic_freq = ieee80211_ieee2mhz(i, IEEE80211_CHAN_2GHZ);
- c->ic_flags =
- IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM |
- IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ;
- c->ic_ieee = i;
- }
-
ieee80211_ifattach(ic);
ic->ic_bmissthreshold = 10; /* override default */
/* override default methods */
@@ -1667,7 +1672,9 @@
if (r & IWI_INTR_FATAL_ERROR) {
device_printf(sc->sc_dev, "firmware error\n");
- taskqueue_enqueue(sc->sc_tq, &sc->sc_restarttask);
+ /* don't restart if the interface isn't up */
+ if (sc->sc_ifp->if_flags & IFF_DRV_RUNNING)
+ taskqueue_enqueue(sc->sc_tq, &sc->sc_restarttask);
}
if (r & IWI_INTR_FW_INITED) {
@@ -2818,9 +2825,6 @@
* in the list.
*/
if (sc->flags & IWI_FLAG_SCANNING) {
-#if 0
- ieee80211_begin_scan(ic, 1);
-#endif
if (iwi_scan(sc) != 0) {
/* XXX should not happen */
sc->flags &= ~IWI_FLAG_SCANNING;
More information about the p4-projects
mailing list