diff options
author | Marcus Glocker <mglocker@cvs.openbsd.org> | 2007-08-09 14:50:07 +0000 |
---|---|---|
committer | Marcus Glocker <mglocker@cvs.openbsd.org> | 2007-08-09 14:50:07 +0000 |
commit | d7b6521eee404057249b641e70b015ad0f6fc310 (patch) | |
tree | c526209e4078002ad771675d4958213c70e86a7a /sys/dev/pcmcia/if_malo.c | |
parent | aad3432526eb97a7ec7f4afbff344df1bf37862f (diff) |
o Add a mechanism to execute single commands even if are are not context
save. Protects cmalo_cmd_set_assoc() for now.
o In case of deauthentication or disassociation, try to reassociate.
Diffstat (limited to 'sys/dev/pcmcia/if_malo.c')
-rw-r--r-- | sys/dev/pcmcia/if_malo.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/sys/dev/pcmcia/if_malo.c b/sys/dev/pcmcia/if_malo.c index 7bacbb5d333..8e3bee5bd3a 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.46 2007/08/09 11:33:54 mglocker Exp $ */ +/* $OpenBSD: if_malo.c,v 1.47 2007/08/09 14:50:06 mglocker Exp $ */ /* * Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org> @@ -615,6 +615,9 @@ cmalo_init(struct ifnet *ifp) DPRINTF(1, "%s: current channel is %d\n", sc->sc_dev.dv_xname, sc->sc_curchan); + /* we are context save here for FW commands */ + sc->sc_cmd_ctxsave = 1; + /* setup device */ if (cmalo_cmd_set_macctrl(sc) != 0) return (EIO); @@ -648,6 +651,9 @@ cmalo_init(struct ifnet *ifp) ieee80211_new_state(ic, IEEE80211_S_RUN, -1); + /* we are not context save anymore for FW commands */ + sc->sc_cmd_ctxsave = 0; + return (0); } @@ -795,9 +801,12 @@ cmalo_intr(void *arg) if (intr & MALO_VAL_HOST_INTR_RX) /* RX frame received */ cmalo_rx(sc); - if (intr & MALO_VAL_HOST_INTR_CMD) + if (intr & MALO_VAL_HOST_INTR_CMD) { /* command response */ wakeup(sc); + if (!sc->sc_cmd_ctxsave) + cmalo_cmd_response(sc); + } if (intr & MALO_VAL_HOST_INTR_EVENT) /* event */ cmalo_event(sc); @@ -993,9 +1002,17 @@ cmalo_event(struct malo_softc *sc) event = event >> 8; switch (event) { - case MALO_EVENT_DISSASOC: + case MALO_EVENT_DEAUTH: + DPRINTF(1, "%s: got deauthentication event (0x%04x)\n", + sc->sc_dev.dv_xname, event); + /* try to associate again */ + cmalo_cmd_set_assoc(sc); + break; + case MALO_EVENT_DISASSOC: DPRINTF(1, "%s: got disassociation event (0x%04x)\n", sc->sc_dev.dv_xname, event); + /* try to associate again */ + cmalo_cmd_set_assoc(sc); break; default: DPRINTF(1, "%s: got unknown event (0x%04x)\n", @@ -1686,6 +1703,11 @@ cmalo_cmd_set_assoc(struct malo_softc *sc) hdr->size = htole16(psize - sizeof(*hdr)); /* process command request */ + if (!sc->sc_cmd_ctxsave) { + if (cmalo_cmd_request(sc, psize, 1) != 0) + return (EIO); + return (0); + } if (cmalo_cmd_request(sc, psize, 0) != 0) return (EIO); |