Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jan 2019 01:12:20 +0000 (UTC)
From:      Andriy Voskoboinyk <avos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r343509 - stable/11/sys/net80211
Message-ID:  <201901280112.x0S1CKFP085340@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avos
Date: Mon Jan 28 01:12:20 2019
New Revision: 343509
URL: https://svnweb.freebsd.org/changeset/base/343509

Log:
  MFC r343340:
  net80211: fix channel list construction for non-auto operating mode.
  
  Change the way how channel list mode <-> desired mode match is done:
  - Match channel list mode for next non-auto desired modes:
   * 11b: 11g, 11ng;
   * 11a: 11na
  - Add pre-defined channels only when one of the next conditions met:
   * the desired channel mode is 'auto' or
   * the desired channel and selected channel list modes are exactly
  the same or
   * the previous rule (11g / 11n promotion) applies.
  
  Before r275875 construction work properly for all except
  11ng / 11na modes - these were broken at all
  (i.e., the scan list was empty); after r275875 all checks were removed,
  so scan table was populated by all device-compatible channels
  (desired mode was ignored).
  
  For example, if I will set 'ifconfig wlan0 mode 11ng' for RTL8821AU:
  - pre-r275875: nothing, scan will not work;
  - after r275875: both 11ng and 11na bands were scanned; also, since 11b
  channel list was used, 14th channel was scanned too.
  - after this change: only 11ng - 1-13 channels - are used for scanning.
  
  Note: since 11-stable does not have VHT mode definitions
  they were removed from this merge.

Modified:
  stable/11/sys/net80211/ieee80211_scan_sta.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net80211/ieee80211_scan_sta.c
==============================================================================
--- stable/11/sys/net80211/ieee80211_scan_sta.c	Mon Jan 28 01:09:23 2019	(r343508)
+++ stable/11/sys/net80211/ieee80211_scan_sta.c	Mon Jan 28 01:12:20 2019	(r343509)
@@ -595,32 +595,46 @@ makescanlist(struct ieee80211_scan_state *ss, struct i
 	 */
 	for (scan = table; scan->list != NULL; scan++) {
 		mode = scan->mode;
-		if (vap->iv_des_mode != IEEE80211_MODE_AUTO) {
+
+		switch (mode) {
+		case IEEE80211_MODE_11B:
+			if (vap->iv_des_mode == IEEE80211_MODE_11B)
+				break;
+
 			/*
-			 * If a desired mode was specified, scan only 
-			 * channels that satisfy that constraint.
+			 * The scan table marks 2.4Ghz channels as b
+			 * so if the desired mode is 11g / 11ng,
+			 * then use the 11b channel list but upgrade the mode.
+			 *
+			 * NB: 11b -> AUTO lets add_channels upgrade an
+			 * 11b channel to 11g if available.
 			 */
-			if (vap->iv_des_mode != mode) {
-				/*
-				 * The scan table marks 2.4Ghz channels as b
-				 * so if the desired mode is 11g, then use
-				 * the 11b channel list but upgrade the mode.
-				 */
-				if (vap->iv_des_mode == IEEE80211_MODE_11G) {
-					if (mode == IEEE80211_MODE_11G) /* Skip the G check */
-						continue;
-					else if (mode == IEEE80211_MODE_11B)
-						mode = IEEE80211_MODE_11G;	/* upgrade */
-				}
+			if (vap->iv_des_mode == IEEE80211_MODE_AUTO ||
+			    vap->iv_des_mode == IEEE80211_MODE_11G ||
+			    vap->iv_des_mode == IEEE80211_MODE_11NG) {
+				mode = vap->iv_des_mode;
+				break;
 			}
-		} else {
+
+			continue;
+		case IEEE80211_MODE_11A:
+			/* Use 11a channel list for 11na mode */
+			if (vap->iv_des_mode == IEEE80211_MODE_11NA) {
+				mode = vap->iv_des_mode;
+				break;
+			}
+
+			/* FALLTHROUGH */
+		default:
 			/*
-			 * This lets add_channels upgrade an 11b channel
-			 * to 11g if available.
+			 * If a desired mode was specified, scan only
+			 * channels that satisfy that constraint.
 			 */
-			if (mode == IEEE80211_MODE_11B)
-				mode = IEEE80211_MODE_AUTO;
+			if (vap->iv_des_mode != IEEE80211_MODE_AUTO &&
+			    vap->iv_des_mode != mode)
+				continue;
 		}
+
 #ifdef IEEE80211_F_XR
 		/* XR does not operate on turbo channels */
 		if ((vap->iv_flags & IEEE80211_F_XR) &&



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