summaryrefslogtreecommitdiff
path: root/sys/dev
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
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')
-rw-r--r--sys/dev/pci/if_iwn.c20
-rw-r--r--sys/dev/pci/if_wpi.c18
2 files changed, 23 insertions, 15 deletions
diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c
index 0ef0192f636..e23796555df 100644
--- a/sys/dev/pci/if_iwn.c
+++ b/sys/dev/pci/if_iwn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwn.c,v 1.10 2007/09/11 18:53:34 damien Exp $ */
+/* $OpenBSD: if_iwn.c,v 1.11 2007/11/03 13:10:29 damien Exp $ */
/*-
* Copyright (c) 2007
@@ -803,9 +803,11 @@ iwn_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)) {
+ iwn_stop(ifp, 0);
iwn_init(ifp);
-
+ }
return 0;
}
@@ -818,9 +820,6 @@ iwn_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 */
@@ -2033,8 +2032,10 @@ iwn_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)) {
+ iwn_stop(ifp, 0);
iwn_init(ifp);
+ }
error = 0;
}
@@ -3344,7 +3345,7 @@ iwn_post_alive(struct iwn_softc *sc)
IWN_WRITE(sc, IWN_MEM_WDATA, 64);
/* set sched. frame limit */
IWN_WRITE(sc, IWN_MEM_WADDR, base + IWN_QUEUE_OFFSET(qid) + 4);
- IWN_WRITE(sc, IWN_MEM_WDATA, 10 << 16);
+ IWN_WRITE(sc, IWN_MEM_WDATA, 64 << 16);
}
/* enable interrupts for all 16 queues */
@@ -3577,6 +3578,9 @@ iwn_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);
IWN_WRITE(sc, IWN_RESET, IWN_NEVO_RESET);
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 */