Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Dec 2013 08:32:15 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r259064 - head/sys/dev/iwn
Message-ID:  <201312070832.rB78WFV7066223@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Sat Dec  7 08:32:15 2013
New Revision: 259064
URL: http://svnweb.freebsd.org/changeset/base/259064

Log:
  Refactor out the scan id and scan vap as part of the scan work.
  
  Make the scan state optional - we'll obviously need a vap, but we now
  won't require the scan state.  the only thing the scan state is needed
  for is to check for the list of SSIDs to scan - which we can now
  just plain ignore by passing in NULL as the scan state pointer.
  
  Tested:
  
  * Intel 5100 (STA)

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==============================================================================
--- head/sys/dev/iwn/if_iwn.c	Sat Dec  7 08:25:24 2013	(r259063)
+++ head/sys/dev/iwn/if_iwn.c	Sat Dec  7 08:32:15 2013	(r259064)
@@ -282,7 +282,8 @@ static int	iwn_send_advanced_btcoex(stru
 static int	iwn5000_runtime_calib(struct iwn_softc *);
 static int	iwn_config(struct iwn_softc *);
 static uint8_t	*ieee80211_add_ssid(uint8_t *, const uint8_t *, u_int);
-static int	iwn_scan(struct iwn_softc *, struct ieee80211_channel *);
+static int	iwn_scan(struct iwn_softc *, struct ieee80211vap *,
+		    struct ieee80211_scan_state *, struct ieee80211_channel *);
 static int	iwn_auth(struct iwn_softc *, struct ieee80211vap *vap);
 static int	iwn_run(struct iwn_softc *, struct ieee80211vap *vap);
 static int	iwn_ampdu_rx_start(struct ieee80211_node *,
@@ -6352,12 +6353,12 @@ iwn_get_passive_dwell_time(struct iwn_so
 }
 
 static int
-iwn_scan(struct iwn_softc *sc, struct ieee80211_channel *c)
+iwn_scan(struct iwn_softc *sc, struct ieee80211vap *vap,
+    struct ieee80211_scan_state *ss, struct ieee80211_channel *c)
 {
 	struct ifnet *ifp = sc->sc_ifp;
 	struct ieee80211com *ic = ifp->if_l2com;
-	struct ieee80211_scan_state *ss = ic->ic_scan;	/*XXX*/
-	struct ieee80211_node *ni = ss->ss_vap->iv_bss;
+	struct ieee80211_node *ni = vap->iv_bss;
 	struct iwn_scan_hdr *hdr;
 	struct iwn_cmd_data *tx;
 	struct iwn_scan_essid *essid;
@@ -6465,22 +6466,26 @@ iwn_scan(struct iwn_softc *sc, struct ie
 
 	/*
 	 * If we're scanning for a specific SSID, add it to the command.
+	 *
+	 * XXX maybe look at adding support for scanning multiple SSIDs?
 	 */
 	essid = (struct iwn_scan_essid *)(tx + 1);
-	if (ss->ss_ssid[0].len != 0) {
-		essid[0].id = IEEE80211_ELEMID_SSID;
-		essid[0].len = ss->ss_ssid[0].len;
-		memcpy(essid[0].data, ss->ss_ssid[0].ssid, ss->ss_ssid[0].len);
-	}
+	if (ss != NULL) {
+		if (ss->ss_ssid[0].len != 0) {
+			essid[0].id = IEEE80211_ELEMID_SSID;
+			essid[0].len = ss->ss_ssid[0].len;
+			memcpy(essid[0].data, ss->ss_ssid[0].ssid, ss->ss_ssid[0].len);
+		}
 
-	DPRINTF(sc, IWN_DEBUG_SCAN, "%s: ssid_len=%d, ssid=%*s\n",
-	    __func__,
-	    ss->ss_ssid[0].len,
-	    ss->ss_ssid[0].len,
-	    ss->ss_ssid[0].ssid);
+		DPRINTF(sc, IWN_DEBUG_SCAN, "%s: ssid_len=%d, ssid=%*s\n",
+		    __func__,
+		    ss->ss_ssid[0].len,
+		    ss->ss_ssid[0].len,
+		    ss->ss_ssid[0].ssid);
 
-	if (ss->ss_nssid > 0)
-		is_active = 1;
+		if (ss->ss_nssid > 0)
+			is_active = 1;
+	}
 
 	/*
 	 * Build a probe request frame.  Most of the following code is a
@@ -8488,7 +8493,7 @@ iwn_scan_curchan(struct ieee80211_scan_s
 	int error;
 
 	IWN_LOCK(sc);
-	error = iwn_scan(sc, ic->ic_curchan);
+	error = iwn_scan(sc, vap, ss, ic->ic_curchan);
 	IWN_UNLOCK(sc);
 	if (error != 0)
 		ieee80211_cancel_scan(vap);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312070832.rB78WFV7066223>