diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2006-05-01 08:39:18 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2006-05-01 08:39:18 +0000 |
commit | 62bbde376b100e8e6963701ea072927622e96be8 (patch) | |
tree | 2683601ee87fcf3da31a02f0519ede5d97c15ae0 /sys/dev/pci/if_iwi.c | |
parent | 15b500529cf608d318b7b94669bf779b786a0e3e (diff) |
call iwi_stop() at beginning of iwi_init() so that all rings are properly
reset when iwi_init() is called from iwi_ioctl() on ENETRESET.
this fixes a firmware panic when setting a WEP key multiple times for
instance. fix some printf while i'm here.
pointed out by Kurt Miller (kurt@).
Diffstat (limited to 'sys/dev/pci/if_iwi.c')
-rw-r--r-- | sys/dev/pci/if_iwi.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c index 5dc59ccc81a..55c74b3a457 100644 --- a/sys/dev/pci/if_iwi.c +++ b/sys/dev/pci/if_iwi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwi.c,v 1.66 2006/04/02 20:30:19 dim Exp $ */ +/* $OpenBSD: if_iwi.c,v 1.67 2006/05/01 08:39:17 damien Exp $ */ /*- * Copyright (c) 2004-2006 @@ -2101,6 +2101,8 @@ iwi_init(struct ifnet *ifp) size_t size; int i, error; + iwi_stop(ifp, 0); + if ((error = iwi_reset(sc)) != 0) { printf("%s: could not reset adapter\n", sc->sc_dev.dv_xname); goto fail1; @@ -2129,7 +2131,7 @@ iwi_init(struct ifnet *ifp) } if (size < sizeof (struct iwi_firmware_hdr)) { - printf("%s: firmware image too short: %zu bytes\n", + printf("%s: firmware image too short: %u bytes\n", sc->sc_dev.dv_xname, size); error = EINVAL; goto fail2; @@ -2147,7 +2149,7 @@ iwi_init(struct ifnet *ifp) if (size < sizeof (struct iwi_firmware_hdr) + letoh32(hdr->bootsz) + letoh32(hdr->ucodesz) + letoh32(hdr->mainsz)) { - printf("%s: firmware image too short: %zu bytes\n", + printf("%s: firmware image too short: %u bytes\n", sc->sc_dev.dv_xname, size); error = EINVAL; goto fail2; @@ -2213,14 +2215,14 @@ iwi_init(struct ifnet *ifp) goto fail1; } + ifp->if_flags &= ~IFF_OACTIVE; + ifp->if_flags |= IFF_RUNNING; + if (ic->ic_opmode != IEEE80211_M_MONITOR) ieee80211_begin_scan(ifp); else ieee80211_new_state(ic, IEEE80211_S_RUN, -1); - ifp->if_flags &= ~IFF_OACTIVE; - ifp->if_flags |= IFF_RUNNING; - return 0; fail2: free(data, M_DEVBUF); |