Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci - Fix the recursive iwn_init() call problem prop...
details: https://anonhg.NetBSD.org/src/rev/a6034343dd09
branches: trunk
changeset: 756010:a6034343dd09
user: christos <christos%NetBSD.org@localhost>
date: Fri Jul 02 14:47:25 2010 +0000
description:
- Fix the recursive iwn_init() call problem properly.
- Don't print the scan request while scanning all the time. Perhaps I will
remove this completely.
diffstat:
sys/dev/pci/if_iwn.c | 39 +++++++++++++++++----------------------
sys/dev/pci/if_iwnvar.h | 7 +++++--
2 files changed, 22 insertions(+), 24 deletions(-)
diffs (140 lines):
diff -r f8cac0ff4c17 -r a6034343dd09 sys/dev/pci/if_iwn.c
--- a/sys/dev/pci/if_iwn.c Fri Jul 02 12:25:54 2010 +0000
+++ b/sys/dev/pci/if_iwn.c Fri Jul 02 14:47:25 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iwn.c,v 1.46 2010/06/18 21:10:23 christos Exp $ */
+/* $NetBSD: if_iwn.c,v 1.47 2010/07/02 14:47:25 christos Exp $ */
/* $OpenBSD: if_iwn.c,v 1.96 2010/05/13 09:25:03 damien Exp $ */
/*-
@@ -22,7 +22,7 @@
* adapters.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.46 2010/06/18 21:10:23 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.47 2010/07/02 14:47:25 christos Exp $");
#define IWN_USE_RBUF /* Use local storage for RX */
#undef IWN_HWCRYPTO /* XXX does not even compile yet */
@@ -416,6 +416,7 @@
sc->sc_pct = pa->pa_pc;
sc->sc_pcitag = pa->pa_tag;
sc->sc_dmat = pa->pa_dmat;
+ mutex_init(&sc->sc_mtx, MUTEX_DEFAULT, IPL_NONE);
callout_init(&sc->calib_to, 0);
callout_setfunc(&sc->calib_to, iwn_calib_timeout, sc);
@@ -1836,8 +1837,10 @@
case IEEE80211_S_SCAN:
/* XXX Do not abort a running scan. */
if (sc->sc_flags & IWN_FLAG_SCANNING) {
- aprint_error_dev(sc->sc_dev,
- "scan request while scanning ignored\n");
+ if (ic->ic_state != nstate)
+ aprint_error_dev(sc->sc_dev, "scan request(%d) "
+ "while scanning(%d) ignored\n", nstate,
+ ic->ic_state);
break;
}
@@ -3161,22 +3164,6 @@
int s, error = 0;
s = splnet();
- /*
- * Prevent processes from entering this function while another
- * process is tsleep'ing in it.
- */
- if (sc->sc_flags & IWN_FLAG_BUSY) {
- switch (cmd) {
- case SIOCSIFADDR:
- /* FALLTHROUGH */
- case SIOCSIFFLAGS:
- splx(s);
- aprint_normal_dev(sc->sc_dev,
- "ioctl while busy cmd = 0x%lx\n", cmd);
- return EBUSY;
- }
- }
- sc->sc_flags |= IWN_FLAG_BUSY;
switch (cmd) {
case SIOCSIFADDR:
@@ -3224,7 +3211,6 @@
}
}
- sc->sc_flags &= ~IWN_FLAG_BUSY;
splx(s);
return error;
}
@@ -5856,6 +5842,9 @@
struct ieee80211com *ic = &sc->sc_ic;
int error;
+ mutex_spin_enter(&sc->sc_mtx);
+ if (sc->sc_flags & IWN_FLAG_HW_INITED)
+ return 0;
if ((error = iwn_hw_prepare(sc)) != 0) {
aprint_error_dev(sc->sc_dev,
"hardware not ready\n");
@@ -5908,9 +5897,12 @@
else
ieee80211_new_state(ic, IEEE80211_S_RUN, -1);
+ sc->sc_flags |= IWN_FLAG_HW_INITED;
+ mutex_spin_exit(&sc->sc_mtx);
return 0;
-fail: iwn_stop(ifp, 1);
+fail: mutex_spin_exit(&sc->sc_mtx);
+ iwn_stop(ifp, 1);
return error;
}
@@ -5920,6 +5912,8 @@
struct iwn_softc *sc = ifp->if_softc;
struct ieee80211com *ic = &sc->sc_ic;
+ mutex_spin_enter(&sc->sc_mtx);
+ sc->sc_flags &= ~IWN_FLAG_HW_INITED;
ifp->if_timer = sc->sc_tx_timer = 0;
ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
@@ -5933,6 +5927,7 @@
sc->sc_sensor.value_cur = 0;
sc->sc_sensor.state = ENVSYS_SINVALID;
#endif
+ mutex_spin_exit(&sc->sc_mtx);
}
/*
diff -r f8cac0ff4c17 -r a6034343dd09 sys/dev/pci/if_iwnvar.h
--- a/sys/dev/pci/if_iwnvar.h Fri Jul 02 12:25:54 2010 +0000
+++ b/sys/dev/pci/if_iwnvar.h Fri Jul 02 14:47:25 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iwnvar.h,v 1.11 2010/06/18 21:10:23 christos Exp $ */
+/* $NetBSD: if_iwnvar.h,v 1.12 2010/07/02 14:47:25 christos Exp $ */
/* $OpenBSD: if_iwnvar.h,v 1.19 2010/05/05 19:47:43 damien Exp $ */
/*-
@@ -226,9 +226,9 @@
#define IWN_FLAG_CALIB_DONE (1 << 2)
#define IWN_FLAG_USE_ICT (1 << 3)
#define IWN_FLAG_INTERNAL_PA (1 << 4)
-#define IWN_FLAG_BUSY (1 << 5)
/* Added for NetBSD */
#define IWN_FLAG_SCANNING (1 << 8)
+#define IWN_FLAG_HW_INITED (1 << 9)
uint8_t hw_type;
const struct iwn_hal *sc_hal;
@@ -321,5 +321,8 @@
} sc_txtapu;
#define sc_txtap sc_txtapu.th
int sc_txtap_len;
+
+ kmutex_t sc_mtx; /* mutex for init/stop */
+
};
Home |
Main Index |
Thread Index |
Old Index