On Sat, Feb 11, 2023 at 06:32:31PM +0300, Vitaliy Makkoveev wrote: > Unfortunately the diff doesn't help. I attached photos with debug > information and panic report.
Based on the command code in the firmware trace the error seems to be caused by the driver sending this command: #define IWX_ADD_STA_KEY 0x17 It seems the set_key task is running while the driver is in INIT state? That is certainly not intended, and it is unclear why this is happening. What is the effect of this diff? Do you see the printfs added here? diff /usr/src commit - 272fae57df2955410d97e29c5923cd4948623da1 path + /usr/src blob - fe1bee0e59b08e6de8b7e3c00e20b930a29a6bb1 file + sys/dev/pci/if_iwx.c --- sys/dev/pci/if_iwx.c +++ sys/dev/pci/if_iwx.c @@ -8554,12 +8554,18 @@ iwx_setkey_task(void *arg) struct iwx_softc *sc = arg; struct iwx_setkey_task_arg *a; int err = 0, s = splnet(); + enum ieee80211_state state = sc->sc_ic.ic_state; - while (sc->setkey_nkeys > 0) { - if (err || (sc->sc_flags & IWX_FLAG_SHUTDOWN)) - break; + printf("%s: in state %s\n", __func__, ieee80211_state_name[state]); + while (state == IEEE80211_S_RUN && sc->setkey_nkeys > 0 && + err == 0 && (sc->sc_flags & IWX_FLAG_SHUTDOWN) == 0) { a = &sc->setkey_arg[sc->setkey_tail]; err = iwx_add_sta_key(sc, a->sta_id, a->ni, a->k); + if (err) { + printf("%s: could not set %s key (error %d)\n", + DEVNAME(sc), (a->k->k_flags & IEEE80211_KEY_GROUP) ? + "group" : "pairwise", err); + } a->sta_id = 0; a->ni = NULL; a->k = NULL; @@ -8568,6 +8574,10 @@ iwx_setkey_task(void *arg) sc->setkey_nkeys--; } + /* Reset everything if key installation failed. */ + if (err && (sc->sc_flags & IWX_FLAG_SHUTDOWN) == 0) + task_add(systq, &sc->init_task); + refcnt_rele_wake(&sc->task_refs); splx(s); }