I do not see a good reason for using multiple custom task queues in this driver, and at the same time it is using systq for tasks.
This moves all tasks to one custom queue to make things consistent. Except I'm leaving the init_task on systq because this task is kind of special (e.g. it might be added during resume and I'm not sure if that requires IPL_HIGH). Perhaps the custom queue would be fine for init_task, too? Not sure. Index: if_iwm.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v retrieving revision 1.155 diff -u -p -r1.155 if_iwm.c --- if_iwm.c 18 Dec 2016 10:37:42 -0000 1.155 +++ if_iwm.c 26 Dec 2016 07:56:41 -0000 @@ -2480,7 +2480,7 @@ iwm_update_htprot(struct ieee80211com *i struct iwm_softc *sc = ic->ic_softc; /* assumes that ni == ic->ic_bss */ - task_add(systq, &sc->htprot_task); + task_add(sc->taskq, &sc->htprot_task); } void @@ -2513,7 +2513,7 @@ iwm_ampdu_rx_start(struct ieee80211com * sc->ba_start = 1; sc->ba_tid = tid; sc->ba_ssn = htole16(ba->ba_winstart); - task_add(systq, &sc->ba_task); + task_add(sc->taskq, &sc->ba_task); return EBUSY; } @@ -2530,7 +2530,7 @@ iwm_ampdu_rx_stop(struct ieee80211com *i sc->ba_start = 0; sc->ba_tid = tid; - task_add(systq, &sc->ba_task); + task_add(sc->taskq, &sc->ba_task); } void @@ -3432,7 +3432,7 @@ iwm_rx_tx_cmd_single(struct iwm_softc *s * the firwmare's LQ rate table from process context. */ if (omcs != ni->ni_txmcs) - task_add(systq, &sc->setrates_task); + task_add(sc->taskq, &sc->setrates_task); } if (txfail) @@ -5323,7 +5323,7 @@ iwm_calib_timeout(void *arg) * the firwmare's LQ rate table from process context. */ if (otxrate != ni->ni_txrate) - task_add(systq, &sc->setrates_task); + task_add(sc->taskq, &sc->setrates_task); } splx(s); @@ -5638,7 +5638,7 @@ iwm_newstate(struct ieee80211com *ic, en sc->ns_nstate = nstate; sc->ns_arg = arg; - task_add(sc->sc_nswq, &sc->newstate_task); + task_add(sc->taskq, &sc->newstate_task); return 0; } @@ -6118,11 +6118,11 @@ iwm_stop(struct ifnet *ifp, int disable) in->in_phyctxt = NULL; task_del(systq, &sc->init_task); - task_del(sc->sc_nswq, &sc->newstate_task); - task_del(sc->sc_eswq, &sc->sc_eswk); - task_del(systq, &sc->setrates_task); - task_del(systq, &sc->ba_task); - task_del(systq, &sc->htprot_task); + task_del(sc->taskq, &sc->newstate_task); + task_del(sc->taskq, &sc->endscan_task); + task_del(sc->taskq, &sc->setrates_task); + task_del(sc->taskq, &sc->ba_task); + task_del(sc->taskq, &sc->htprot_task); sc->sc_newstate(ic, IEEE80211_S_INIT, -1); @@ -6672,14 +6672,14 @@ iwm_notif_intr(struct iwm_softc *sc) case IWM_SCAN_ITERATION_COMPLETE: { struct iwm_lmac_scan_complete_notif *notif; SYNC_RESP_STRUCT(notif, pkt); - task_add(sc->sc_eswq, &sc->sc_eswk); + task_add(sc->taskq, &sc->endscan_task); break; } case IWM_SCAN_COMPLETE_UMAC: { struct iwm_umac_scan_complete *notif; SYNC_RESP_STRUCT(notif, pkt); - task_add(sc->sc_eswq, &sc->sc_eswk); + task_add(sc->taskq, &sc->endscan_task); break; } @@ -6687,7 +6687,7 @@ iwm_notif_intr(struct iwm_softc *sc) struct iwm_umac_scan_iter_complete_notif *notif; SYNC_RESP_STRUCT(notif, pkt); - task_add(sc->sc_eswq, &sc->sc_eswk); + task_add(sc->taskq, &sc->endscan_task); break; } @@ -6995,7 +6995,7 @@ iwm_attach(struct device *parent, struct sc->sc_pcitag = pa->pa_tag; sc->sc_dmat = pa->pa_dmat; - task_set(&sc->sc_eswk, iwm_endscan_cb, sc); + task_set(&sc->endscan_task, iwm_endscan_cb, sc); rw_init(&sc->ioctl_rwl, "iwmioctl"); err = pci_get_capability(sc->sc_pct, sc->sc_pcitag, @@ -7192,11 +7192,8 @@ iwm_attach(struct device *parent, struct goto fail4; } - sc->sc_eswq = taskq_create("iwmes", 1, IPL_NET, 0); - if (sc->sc_eswq == NULL) - goto fail4; - sc->sc_nswq = taskq_create("iwmns", 1, IPL_NET, 0); - if (sc->sc_nswq == NULL) + sc->taskq = taskq_create("iwm", 1, IPL_NET, 0); + if (sc->taskq == NULL) goto fail4; /* Clear pending interrupts. */ Index: if_iwmvar.h =================================================================== RCS file: /cvs/src/sys/dev/pci/if_iwmvar.h,v retrieving revision 1.25 diff -u -p -r1.25 if_iwmvar.h --- if_iwmvar.h 30 Nov 2016 14:31:51 -0000 1.25 +++ if_iwmvar.h 26 Dec 2016 07:52:22 -0000 @@ -358,6 +358,7 @@ struct iwm_softc { struct task init_task; struct task newstate_task; struct task setrates_task; + struct task endscan_task; enum ieee80211_state ns_nstate; int ns_arg; @@ -462,8 +463,7 @@ struct iwm_softc { uint8_t sc_cmd_resp[IWM_CMD_RESP_MAX]; int sc_wantresp; - struct taskq *sc_nswq, *sc_eswq; - struct task sc_eswk; + struct taskq *taskq; struct iwm_rx_phy_info sc_last_phy_info; int sc_ampdu_ref;