summaryrefslogtreecommitdiff
path: root/sys/dev/pcmcia/if_malo.c
diff options
context:
space:
mode:
authorMarcus Glocker <mglocker@cvs.openbsd.org>2007-08-09 08:53:23 +0000
committerMarcus Glocker <mglocker@cvs.openbsd.org>2007-08-09 08:53:23 +0000
commitc932241a1954996c40c29ab699a0f5841bab84dc (patch)
tree1027dabbf1b958a0abc210c8b29160aeb8d82b2c /sys/dev/pcmcia/if_malo.c
parent7018f7cbac92f3162dc997d337a9fc4d24d4faaa (diff)
Add event handler. Events notify us about things like when a
disassociation frame has arrived. Nice side effect; As we acknowledge the event reason after receiving a disassociation frame (which happens pretty often by wi(4) hostap) now, the FW issues an automatic reassociation, and we do not loose network connectivity anymore.
Diffstat (limited to 'sys/dev/pcmcia/if_malo.c')
-rw-r--r--sys/dev/pcmcia/if_malo.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/sys/dev/pcmcia/if_malo.c b/sys/dev/pcmcia/if_malo.c
index eb08fe4490f..3c9def435d8 100644
--- a/sys/dev/pcmcia/if_malo.c
+++ b/sys/dev/pcmcia/if_malo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_malo.c,v 1.43 2007/08/07 11:44:44 mglocker Exp $ */
+/* $OpenBSD: if_malo.c,v 1.44 2007/08/09 08:53:22 mglocker Exp $ */
/*
* Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org>
@@ -87,6 +87,7 @@ void cmalo_start(struct ifnet *);
void cmalo_watchdog(struct ifnet *);
int cmalo_tx(struct malo_softc *, struct mbuf *);
void cmalo_tx_done(struct malo_softc *);
+void cmalo_event(struct malo_softc *);
void cmalo_select_network(struct malo_softc *);
void cmalo_reflect_network(struct malo_softc *);
int cmalo_wep(struct malo_softc *);
@@ -797,6 +798,9 @@ cmalo_intr(void *arg)
if (intr & MALO_VAL_HOST_INTR_CMD)
/* command response */
wakeup(sc);
+ if (intr & MALO_VAL_HOST_INTR_EVENT)
+ /* event */
+ cmalo_event(sc);
return (1);
}
@@ -979,6 +983,31 @@ cmalo_tx_done(struct malo_softc *sc)
}
void
+cmalo_event(struct malo_softc *sc)
+{
+ uint16_t event;
+
+ /* read event reason */
+ event = MALO_READ_2(sc, MALO_REG_CARD_STATUS);
+ event &= MALO_VAL_CARD_STATUS_MASK;
+ event = event >> 8;
+
+ switch (event) {
+ case MALO_EVENT_DISSASOC:
+ DPRINTF(1, "%s: got disassociation event (0x%04x)\n",
+ sc->sc_dev.dv_xname, event);
+ break;
+ default:
+ DPRINTF(1, "%s: got unknown event (0x%04x)\n",
+ sc->sc_dev.dv_xname, event);
+ break;
+ }
+
+ /* clear event */
+ MALO_WRITE_2(sc, MALO_REG_CARD_INTR_CAUSE, MALO_VAL_CMD_DL_OVER);
+}
+
+void
cmalo_select_network(struct malo_softc *sc)
{
struct ieee80211com *ic = &sc->sc_ic;