summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Glocker <mglocker@cvs.openbsd.org>2007-08-09 14:50:07 +0000
committerMarcus Glocker <mglocker@cvs.openbsd.org>2007-08-09 14:50:07 +0000
commitd7b6521eee404057249b641e70b015ad0f6fc310 (patch)
treec526209e4078002ad771675d4958213c70e86a7a
parentaad3432526eb97a7ec7f4afbff344df1bf37862f (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.
-rw-r--r--sys/dev/pcmcia/if_malo.c28
-rw-r--r--sys/dev/pcmcia/if_maloreg.h5
-rw-r--r--sys/dev/pcmcia/if_malovar.h3
3 files changed, 30 insertions, 6 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);
diff --git a/sys/dev/pcmcia/if_maloreg.h b/sys/dev/pcmcia/if_maloreg.h
index da89cedda32..c4311d44a79 100644
--- a/sys/dev/pcmcia/if_maloreg.h
+++ b/sys/dev/pcmcia/if_maloreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_maloreg.h,v 1.13 2007/08/09 09:40:01 mglocker Exp $ */
+/* $OpenBSD: if_maloreg.h,v 1.14 2007/08/09 14:50:06 mglocker Exp $ */
/*
* Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org>
@@ -79,4 +79,5 @@
#define MALO_CMD_MACCTRL_PROMISC_ON 0x0080
/* events */
-#define MALO_EVENT_DISSASOC 0x0009
+#define MALO_EVENT_DEAUTH 0x0008
+#define MALO_EVENT_DISASSOC 0x0009
diff --git a/sys/dev/pcmcia/if_malovar.h b/sys/dev/pcmcia/if_malovar.h
index 2f236bc5491..ae7c7c8f620 100644
--- a/sys/dev/pcmcia/if_malovar.h
+++ b/sys/dev/pcmcia/if_malovar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_malovar.h,v 1.22 2007/08/07 11:44:44 mglocker Exp $ */
+/* $OpenBSD: if_malovar.h,v 1.23 2007/08/09 14:50:06 mglocker Exp $ */
/*
* Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org>
@@ -334,6 +334,7 @@ struct malo_softc {
int);
int sc_flags;
+ int sc_cmd_ctxsave;
void *sc_cmd;
void *sc_data;
uint8_t sc_curchan;