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 Attempt at fixing scanning.



details:   https://anonhg.NetBSD.org/src-all/rev/aedd970bded3
branches:  trunk
changeset: 377162:aedd970bded3
user:      Nathanial Sloss <nat%netbsd.org@localhost>
date:      Tue Jun 27 22:39:57 2023 +1000

description:
Attempt at fixing scanning.

Add iwm_scan function.
Rework newstate.
Same iwm_scan_curchan as for iwn(4).
Clarify des_esslen as for active and passive scans, similar to what is used in
FreeBSD.

diffstat:

 sys/dev/pci/if_iwm.c |  54 ++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 36 insertions(+), 18 deletions(-)

diffs (95 lines):

diff -r c46e7373e80f -r aedd970bded3 sys/dev/pci/if_iwm.c
--- a/sys/dev/pci/if_iwm.c      Tue Jun 27 22:36:49 2023 +1000
+++ b/sys/dev/pci/if_iwm.c      Tue Jun 27 22:39:57 2023 +1000
@@ -469,6 +469,7 @@ static void iwm_mac_ctxt_cmd_fill_sta(st
 static int     iwm_mac_ctxt_cmd(struct iwm_softc *, struct iwm_node *,
                    uint32_t, int);
 static int     iwm_update_quotas(struct iwm_softc *, struct iwm_node *);
+static int     iwm_scan(struct ieee80211com *, struct ieee80211_scan_state *);
 static int     iwm_auth(struct ieee80211vap *);
 static void    iwm_newassoc(struct ieee80211_node *, int);
 static void    iwm_calib_timeout(void *);
@@ -6309,21 +6310,13 @@ iwm_newstate(struct ieee80211vap *vap, e
                break;
 
        case IEEE80211_S_SCAN:
+#if 0
                if (ostate == nstate &&
                    ISSET(sc->sc_flags, IWM_FLAG_SCANNING)) {
                        return 0;
                }
-               if (isset(sc->sc_enabled_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) {
-                       err = iwm_umac_scan(sc);
-               } else {
-                       err = iwm_lmac_scan(sc);
-               }
-               if (err) {
-                       DPRINTF(("%s: could not initiate scan: %d\n",
-                           DEVNAME(sc), err));
-                       return err;
-               }
-               SET(sc->sc_flags, IWM_FLAG_SCANNING);
+               ic->ic_flags |= IEEE80211_F_SCAN;// | IEEE80211_F_ASCAN;
+#endif
                IWM_LOCK(sc);
                iwm_led_blink_start(sc);
                IWM_UNLOCK(sc);
@@ -8449,26 +8442,51 @@ iwm_set_channel(struct ieee80211com *ic)
 #endif
 }
 
+static int
+iwm_scan(struct ieee80211com *ic, struct ieee80211_scan_state *ss)
+{
+       struct iwm_softc *sc = ic->ic_softc;
+       int err;
+
+       if (ISSET(sc->sc_flags, IWM_FLAG_SCANNING)) {
+               return EAGAIN;
+       }
+       if (ss != NULL)
+               sc->sc_des_esslen = uimin(ss->ss_nssid, IWM_PROBE_OPTION_MAX);
+       else
+               sc->sc_des_esslen = IWM_PROBE_OPTION_MAX;
+       //ic->ic_flags |= IEEE80211_F_SCAN;// | IEEE80211_F_ASCAN;
+       if (isset(sc->sc_enabled_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) {
+               err = iwm_umac_scan(sc);
+       } else {
+               err = iwm_lmac_scan(sc);
+       }
+       if (err) {
+               DPRINTF(("%s: could not initiate scan: %d\n",
+                   DEVNAME(sc), err));
+               return err;
+       }
+       SET(sc->sc_flags, IWM_FLAG_SCANNING);
+
+       return 0;
+}
+
 /*
  * Callback from net80211 to start scanning of the current channel.
  */
 static void
 iwm_scan_curchan(struct ieee80211_scan_state *ss, unsigned long maxdwell)
 {
-#if 0
        struct ieee80211vap *vap = ss->ss_vap;
        struct ieee80211com *ic = vap->iv_ic;
        int error;
 
        ss->ss_flags |= IEEE80211_SCAN_ONCE;
 
-       error = iwm_scan_start(ic);
+       error = iwm_scan(ic, ss);
        if (error != 0) {
-               IEEE80211_LOCK(ic);
-               ieee80211_cancel_scan(vap);
-               IEEE80211_UNLOCK(ic);
-       }
-#endif
+               ieee80211_cancel_scan(vap,0);
+       }
 }
 
 /*



Home | Main Index | Thread Index | Old Index