summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_wpi.c
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2007-11-03 13:10:30 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2007-11-03 13:10:30 +0000
commit22761722370bb2389ff416be9d80c151c16db919 (patch)
tree85fbbf13ecd995916da63f2f1f79942c14a3a92f /sys/dev/pci/if_wpi.c
parent08287660670666391e565fab9ef7b9c196117f4c (diff)
fix ENETRESET handling in {wpi,iwn}_ioctl() so that the firmware won't
panic when resetting the device - requested by many fix ifconfig -M (the interface still has to be down though ie it won't work while the interface is up). fix AMPDU window for 4965AGN (has no effect since 802.11n is not supported yet).
Diffstat (limited to 'sys/dev/pci/if_wpi.c')
-rw-r--r--sys/dev/pci/if_wpi.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/sys/dev/pci/if_wpi.c b/sys/dev/pci/if_wpi.c
index 842700696a2..1c795cde7ad 100644
--- a/sys/dev/pci/if_wpi.c
+++ b/sys/dev/pci/if_wpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wpi.c,v 1.56 2007/09/11 18:52:32 damien Exp $ */
+/* $OpenBSD: if_wpi.c,v 1.57 2007/11/03 13:10:29 damien Exp $ */
/*-
* Copyright (c) 2006, 2007
@@ -775,9 +775,11 @@ wpi_media_change(struct ifnet *ifp)
if (error != ENETRESET)
return error;
- if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) == (IFF_UP | IFF_RUNNING))
+ if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) ==
+ (IFF_UP | IFF_RUNNING)) {
+ wpi_stop(ifp, 0);
wpi_init(ifp);
-
+ }
return 0;
}
@@ -791,9 +793,6 @@ wpi_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
timeout_del(&sc->calib_to);
- if (ic->ic_state == IEEE80211_S_SCAN)
- ic->ic_scan_lock = IEEE80211_SCAN_UNLOCKED;
-
switch (nstate) {
case IEEE80211_S_SCAN:
/* make the link LED blink while we're scanning */
@@ -1912,8 +1911,10 @@ wpi_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if (error == ENETRESET) {
if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) ==
- (IFF_UP | IFF_RUNNING))
+ (IFF_UP | IFF_RUNNING)) {
+ wpi_stop(ifp, 0);
wpi_init(ifp);
+ }
error = 0;
}
@@ -2906,6 +2907,9 @@ wpi_stop(struct ifnet *ifp, int disable)
ifp->if_timer = sc->sc_tx_timer = 0;
ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ /* in case we were scanning, release the scan "lock" */
+ ic->ic_scan_lock = IEEE80211_SCAN_UNLOCKED;
+
ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
/* disable interrupts */