Change scan and auth+assoc workq entries to taskq entries.
authorkrw <krw@openbsd.org>
Fri, 19 Dec 2014 15:19:47 +0000 (15:19 +0000)
committerkrw <krw@openbsd.org>
Fri, 19 Dec 2014 15:19:47 +0000 (15:19 +0000)
Identical diff originally and independently developed by blambert@.

sys/dev/pci/if_ipw.c
sys/dev/pci/if_ipwvar.h

index 7528293..04b4b3e 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: if_ipw.c,v 1.101 2014/07/22 13:12:11 mpi Exp $        */
+/*     $OpenBSD: if_ipw.c,v 1.102 2014/12/19 15:19:47 krw Exp $        */
 
 /*-
  * Copyright (c) 2004-2008
@@ -25,7 +25,7 @@
 
 #include <sys/param.h>
 #include <sys/sockio.h>
-#include <sys/workq.h>
+#include <sys/task.h>
 #include <sys/mbuf.h>
 #include <sys/kernel.h>
 #include <sys/socket.h>
@@ -205,6 +205,9 @@ ipw_attach(struct device *parent, struct device *self, void *aux)
        }
        printf(": %s", intrstr);
 
+       task_set(&sc->sc_scantask, ipw_scan, sc, NULL);
+       task_set(&sc->sc_authandassoctask, ipw_auth_and_assoc, sc, NULL);
+
        if (ipw_reset(sc) != 0) {
                printf(": could not reset adapter\n");
                return;
@@ -606,6 +609,9 @@ ipw_release(struct ipw_softc *sc)
                        bus_dmamap_destroy(sc->sc_dmat, sbuf->map);
                }
        }
+
+       task_del(systq, &sc->sc_scantask);
+       task_del(systq, &sc->sc_authandassoctask);
 }
 
 int
@@ -680,15 +686,11 @@ ipw_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
 
        switch (nstate) {
        case IEEE80211_S_SCAN:
-               error = workq_add_task(NULL, 0, ipw_scan, sc, NULL);
-               if (error != 0)
-                       return error;
+               task_add(systq, &sc->sc_scantask);
                break;
 
        case IEEE80211_S_AUTH:
-               error = workq_add_task(NULL, 0, ipw_auth_and_assoc, sc, NULL);
-               if (error != 0)
-                       return error;
+               task_add(systq, &sc->sc_authandassoctask);
                break;
 
        case IEEE80211_S_RUN:
index 0b222b5..7dbcbd6 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: if_ipwvar.h,v 1.23 2013/12/06 21:03:04 deraadt Exp $  */
+/*     $OpenBSD: if_ipwvar.h,v 1.24 2014/12/19 15:19:47 krw Exp $      */
 
 /*-
  * Copyright (c) 2004-2006
@@ -117,6 +117,9 @@ struct ipw_softc {
        struct ipw_soft_bd              srbd_list[IPW_NRBD];
        struct ipw_soft_buf             rx_sbuf_list[IPW_NRBD];
 
+       struct task                     sc_scantask;
+       struct task                     sc_authandassoctask;
+
        SLIST_HEAD(, ipw_soft_hdr)      free_shdr;
        SLIST_HEAD(, ipw_soft_buf)      free_sbuf;