Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src-draft/trunk]: src/sys/dev/pci Fix state machine definitions. Also don't...



details:   https://anonhg.NetBSD.org/src-all/rev/dd991d7c8b3a
branches:  trunk
changeset: 363705:dd991d7c8b3a
user:      Nathanial Sloss <nat%netbsd.org@localhost>
date:      Fri Sep 04 09:17:43 2020 +1000

description:
Fix state machine definitions.  Also don't force state transitions.

diffstat:

 sys/dev/pci/if_iwm.c    |  32 +++++++++++++++++---------------
 sys/dev/pci/if_iwmvar.h |   3 ++-
 2 files changed, 19 insertions(+), 16 deletions(-)

diffs (104 lines):

diff -r 017d26377d22 -r dd991d7c8b3a sys/dev/pci/if_iwm.c
--- a/sys/dev/pci/if_iwm.c      Fri Sep 04 09:03:13 2020 +1000
+++ b/sys/dev/pci/if_iwm.c      Fri Sep 04 09:17:43 2020 +1000
@@ -468,10 +468,10 @@
 static int     iwm_setrates(struct iwm_node *);
 #endif
 static int     iwm_media_change(struct ifnet *);
-static int     iwm_do_newstate(struct ieee80211com *, enum ieee80211_state,
+static int     iwm_do_newstate(struct ieee80211vap *, enum ieee80211_state,
                    int);
-static void    iwm_newstate_cb(struct work *, void *);
-static int     iwm_newstate(struct ieee80211com *, enum ieee80211_state, int);
+//static void  iwm_newstate_cb(struct work *, void *);
+static int     iwm_newstate(struct ieee80211vap *, enum ieee80211_state, int);
 static void    iwm_endscan(struct iwm_softc *);
 static void    iwm_fill_sf_command(struct iwm_softc *, struct iwm_sf_cfg_cmd *,
                    struct ieee80211_node *);
@@ -6316,9 +6316,6 @@
                 * driver so bring the FSM from RUN to SCAN in this case.
                 */
                if (nstate != IEEE80211_S_INIT) {
-                       DPRINTF(("Force transition to INIT; MGT=%d\n", arg));
-                       /* Always pass arg as -1 since we can't Tx right now. */
-                       sc->sc_newstate(ic, IEEE80211_S_INIT, -1);
                        iwm_stop(ifp, 0);
                        iwm_init(ifp);
                        return 0;
@@ -6431,10 +6428,11 @@
                break;
        }
 
-       return sc->sc_newstate(ic, nstate, arg);
-}
-
-static void
+       return sc->sc_newstate(vap, nstate, arg);
+}
+
+#if 0
+static void __unused
 iwm_newstate_cb(struct work *wk, void *v)
 {
        struct iwm_softc *sc = v;
@@ -6449,7 +6447,7 @@
 
        s = splnet();
 
-//     DPRINTF(("Prepare to switch state %d->%d\n", ic->ic_state, nstate));
+       DPRINTF(("Prepare to switch state %d->%d\n", ic->ic_state, nstate));
        if (sc->sc_generation != generation) {
                DPRINTF(("newstate_cb: someone pulled the plug meanwhile\n"));
                if (nstate == IEEE80211_S_INIT) {
@@ -6462,10 +6460,12 @@
 
        splx(s);
 }
+#endif
 
 static int
-iwm_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
-{
+iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
+{
+       struct ieee80211com *ic = vap->iv_ic;
        struct iwm_newstate_state *iwmns;
        struct iwm_softc *sc = ic->ic_softc;
 
@@ -7912,8 +7912,8 @@
        ic->ic_node_alloc = iwm_node_alloc;
 
        /* Override 802.11 state transition machine. */
-       sc->sc_newstate = ic->ic_newstate;
-       ic->ic_newstate = iwm_newstate;
+       sc->sc_newstate = vap->iv_newstate;
+       vap->iv_newstate = iwn_newstate;
 
        /* XXX media locking needs revisiting */
        mutex_init(&sc->sc_media_mtx, MUTEX_DEFAULT, IPL_SOFTNET);
@@ -7957,10 +7957,12 @@
 
        pci_aprint_devinfo(pa, NULL);
 
+#if 0
        if (workqueue_create(&sc->sc_nswq, "iwmns",
            iwm_newstate_cb, sc, PRI_NONE, IPL_NET, 0))
                panic("%s: could not create workqueue: newstate",
                    device_xname(self));
+#endif
        sc->sc_soft_ih = softint_establish(SOFTINT_NET, iwm_softintr, sc);
        if (sc->sc_soft_ih == NULL)
                panic("%s: could not establish softint", device_xname(self));
diff -r 017d26377d22 -r dd991d7c8b3a sys/dev/pci/if_iwmvar.h
--- a/sys/dev/pci/if_iwmvar.h   Fri Sep 04 09:03:13 2020 +1000
+++ b/sys/dev/pci/if_iwmvar.h   Fri Sep 04 09:17:43 2020 +1000
@@ -367,7 +367,8 @@
        struct ethercom sc_ec;
        struct ieee80211com sc_ic;
 
-       int (*sc_newstate)(struct ieee80211com *, enum ieee80211_state, int);
+       int                     (*sc_newstate)(struct ieee80211vap *,
+                                   enum ieee80211_state, int);
 
        struct ieee80211_amrr sc_amrr;
        struct callout sc_calib_to;



Home | Main Index | Thread Index | Old Index