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 Add scanning callout. Maybe handy in future.



details:   https://anonhg.NetBSD.org/src-all/rev/1a110a61cb11
branches:  trunk
changeset: 377685:1a110a61cb11
user:      Nathanial Sloss <nat%netbsd.org@localhost>
date:      Sat May 16 11:33:12 2020 +1000

description:
Add scanning callout.  Maybe handy in future.

diffstat:

 sys/dev/pci/if_iwn.c    |  21 ++++++++++++++++++++-
 sys/dev/pci/if_iwnvar.h |   1 +
 2 files changed, 21 insertions(+), 1 deletions(-)

diffs (91 lines):

diff -r e983b400951e -r 1a110a61cb11 sys/dev/pci/if_iwn.c
--- a/sys/dev/pci/if_iwn.c      Sat May 16 10:54:05 2020 +1000
+++ b/sys/dev/pci/if_iwn.c      Sat May 16 11:33:12 2020 +1000
@@ -248,6 +248,7 @@ static struct ieee80211vap *
 static void    iwn_vap_delete(struct ieee80211vap *);
 static void    iwn_parent(struct ieee80211com *);
 static void    iwn_scan_end(struct ieee80211com *);
+static void    iwn_next_scan(void *);
 static int     iwn_reset(struct ieee80211vap *, u_long);
 
 #ifdef IWN_DEBUG
@@ -465,6 +466,8 @@ iwn_attach(device_t parent __unused, dev
 
        callout_init(&sc->calib_to, 0);
        callout_setfunc(&sc->calib_to, iwn_calib_timeout, sc);
+       callout_init(&sc->scan_to, 0);
+       callout_setfunc(&sc->scan_to, iwn_next_scan, sc);
 
        pci_aprint_devinfo(pa, NULL);
 
@@ -815,6 +818,12 @@ iwn_reset(struct ieee80211vap *vap, u_lo
 }
 
 static void
+iwn_next_scan(void *arg)
+{
+       printf ("NNN iwn_next_scan called....\n");
+}
+
+static void
 iwn_scan_end(struct ieee80211com *ic)
 {
        struct iwn_softc *sc __unused = ic->ic_softc;
@@ -1085,6 +1094,7 @@ iwn_detach(device_t self, int flags __un
                return 0;
 
        callout_stop(&sc->calib_to);
+       callout_stop(&sc->scan_to);
 
        /* Uninstall interrupt handler. */
        if (sc->sc_ih != NULL)
@@ -2118,6 +2128,9 @@ iwn_newstate(struct ieee80211vap *vap, e
 
        enum ieee80211_state ostate = vap->iv_state;
 
+       callout_stop(&sc->scan_to);
+       callout_stop(&sc->calib_to);
+
        vap->iv_debug = ieee80211_debug;
        switch (nstate) {
        case IEEE80211_S_SCAN:
@@ -2140,6 +2153,9 @@ iwn_newstate(struct ieee80211vap *vap, e
 
                //iwn_scan(ic);
                //ic->ic_state = nstate;
+
+               /* Start periodic scan. */
+               callout_schedule(&sc->scan_to, hz / 5);
                break;
 
        case IEEE80211_S_CAC:
@@ -2147,7 +2163,7 @@ iwn_newstate(struct ieee80211vap *vap, e
        case IEEE80211_S_SLEEP:
                break;
        case IEEE80211_S_ASSOC:
-               if (ostate != IEEE80211_S_RUN)
+//             if (ostate != IEEE80211_S_RUN)
                        break;
                /* FALLTHROUGH */
        case IEEE80211_S_AUTH:
@@ -2185,6 +2201,9 @@ iwn_newstate(struct ieee80211vap *vap, e
                            "could not move to run state\n");
                        return error;
                }
+
+               /* Start periodic calibration. */
+               callout_schedule(&sc->calib_to, hz);
                break;
 
        case IEEE80211_S_INIT:
diff -r e983b400951e -r 1a110a61cb11 sys/dev/pci/if_iwnvar.h
--- a/sys/dev/pci/if_iwnvar.h   Sat May 16 10:54:05 2020 +1000
+++ b/sys/dev/pci/if_iwnvar.h   Sat May 16 11:33:12 2020 +1000
@@ -274,6 +274,7 @@ struct iwn_softc {
        int                     sc_cap_off;     /* PCIe Capabilities. */
        struct sysmon_envsys    *sc_sme;
        envsys_data_t           sc_sensor;
+       callout_t               scan_to;
        callout_t               calib_to;
        int                     calib_cnt;
        struct iwn_calib_state  calib;



Home | Main Index | Thread Index | Old Index