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/4e1b35f95e39
branches:  trunk
changeset: 939504:4e1b35f95e39
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 e74cb7c1a3fa -r 4e1b35f95e39 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
@@ -167,6 +167,7 @@
 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
@@ -392,6 +393,8 @@
 
        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);
 
@@ -742,6 +745,12 @@
 }
 
 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;
@@ -1012,6 +1021,7 @@
                return 0;
 
        callout_stop(&sc->calib_to);
+       callout_stop(&sc->scan_to);
 
        /* Uninstall interrupt handler. */
        if (sc->sc_ih != NULL)
@@ -2045,6 +2055,9 @@
 
        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:
@@ -2067,6 +2080,9 @@
 
                //iwn_scan(ic);
                //ic->ic_state = nstate;
+
+               /* Start periodic scan. */
+               callout_schedule(&sc->scan_to, hz / 5);
                break;
 
        case IEEE80211_S_CAC:
@@ -2074,7 +2090,7 @@
        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:
@@ -2112,6 +2128,9 @@
                            "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 e74cb7c1a3fa -r 4e1b35f95e39 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 @@
        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