Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jul 2005 16:38:14 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 80452 for review
Message-ID:  <200507181638.j6IGcEqs056354@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=80452

Change 80452 by sam@sam_ebb on 2005/07/18 16:37:22

	add bgscan+roaming controls

Affected files ...

.. //depot/projects/wifi/sbin/ifconfig/ifieee80211.c#41 edit

Differences ...

==== //depot/projects/wifi/sbin/ifconfig/ifieee80211.c#41 (text+ko) ====

@@ -636,6 +636,66 @@
 	set80211(s, IEEE80211_IOC_PUREG, d, 0, NULL);
 }
 
+static void
+set80211bgscan(const char *val, int d, int s, const struct afswtch *rafp)
+{
+	set80211(s, IEEE80211_IOC_BGSCAN, d, 0, NULL);
+}
+
+static
+DECL_CMD_FUNC(set80211bgscanidle, val, d)
+{
+	set80211(s, IEEE80211_IOC_BGSCAN_IDLE, atoi(val), 0, NULL);
+}
+
+static
+DECL_CMD_FUNC(set80211bgscanintvl, val, d)
+{
+	set80211(s, IEEE80211_IOC_BGSCAN_INTERVAL, atoi(val), 0, NULL);
+}
+
+static
+DECL_CMD_FUNC(set80211scanvalid, val, d)
+{
+	set80211(s, IEEE80211_IOC_SCANVALID, atoi(val), 0, NULL);
+}
+
+static
+DECL_CMD_FUNC(set80211roamrssi11a, val, d)
+{
+	set80211(s, IEEE80211_IOC_ROAM_RSSI_11A, atoi(val), 0, NULL);
+}
+
+static
+DECL_CMD_FUNC(set80211roamrssi11b, val, d)
+{
+	set80211(s, IEEE80211_IOC_ROAM_RSSI_11B, atoi(val), 0, NULL);
+}
+
+static
+DECL_CMD_FUNC(set80211roamrssi11g, val, d)
+{
+	set80211(s, IEEE80211_IOC_ROAM_RSSI_11G, atoi(val), 0, NULL);
+}
+
+static
+DECL_CMD_FUNC(set80211roamrate11a, val, d)
+{
+	set80211(s, IEEE80211_IOC_ROAM_RATE_11A, 2*atoi(val), 0, NULL);
+}
+
+static
+DECL_CMD_FUNC(set80211roamrate11b, val, d)
+{
+	set80211(s, IEEE80211_IOC_ROAM_RATE_11B, 2*atoi(val), 0, NULL);
+}
+
+static
+DECL_CMD_FUNC(set80211roamrate11g, val, d)
+{
+	set80211(s, IEEE80211_IOC_ROAM_RATE_11G, 2*atoi(val), 0, NULL);
+}
+
 static int
 getmaxrate(uint8_t rates[15], uint8_t nrates)
 {
@@ -961,12 +1021,11 @@
 	if (IEEE80211_IS_CHAN_A(c))
 		strlcat(buf, " 11a", sizeof(buf));
 	/* XXX 11g schizophrenia */
-	if (IEEE80211_IS_CHAN_G(c) ||
-	    IEEE80211_IS_CHAN_PUREG(c))
+	if (IEEE80211_IS_CHAN_ANYG(c))
 		strlcat(buf, " 11g", sizeof(buf));
 	else if (IEEE80211_IS_CHAN_B(c))
 		strlcat(buf, " 11b", sizeof(buf));
-	if (IEEE80211_IS_CHAN_T(c))
+	if (IEEE80211_IS_CHAN_TURBO(c))
 		strlcat(buf, " Turbo", sizeof(buf));
 	printf("Channel %3u : %u%c Mhz%-14.14s",
 		ieee80211_mhz2ieee(c->ic_freq), c->ic_freq,
@@ -1028,7 +1087,7 @@
 #define	IEEE80211_C_BITS \
 "\020\1WEP\2TKIP\3AES\4AES_CCM\6CKIP\11IBSS\12PMGT\13HOSTAP\14AHDEMO" \
 "\15SWRETRY\16TXPMGT\17SHSLOT\20SHPREAMBLE\21MONITOR\22TKIPMIC\30WPA1" \
-"\31WPA2\32BURST\33WME"
+"\31WPA2\32BURST\33WME\34WDS\36BGSCAN"
 
 static void
 list_capabilities(int s)
@@ -1306,7 +1365,7 @@
 {
 	static const uint8_t zerobssid[IEEE80211_ADDR_LEN];
 	enum ieee80211_opmode opmode = get80211opmode(s);
-	int i, num, wpa, wme;
+	int i, num, wpa, wme, bgscan;
 	struct ieee80211req ireq;
 	u_int8_t data[32];
 	const struct ieee80211_channel *c;
@@ -1316,6 +1375,7 @@
 	ireq.i_data = &data;
 
 	wpa = 0;		/* unknown/not set */
+	bgscan = 0;		/* unknown/not set */
 
 	ireq.i_type = IEEE80211_IOC_SSID;
 	ireq.i_val = -1;
@@ -1521,7 +1581,54 @@
 			LINE_CHECK("%crtsthreshold %d", spacer, ireq.i_val);
 	}
 
-	if (IEEE80211_IS_CHAN_G(c) || IEEE80211_IS_CHAN_PUREG(c) || verbose) {
+	ireq.i_type = IEEE80211_IOC_BGSCAN;
+	if (ioctl(s, SIOCG80211, &ireq) != -1) {
+		bgscan = ireq.i_val;
+		if (ireq.i_val)
+			LINE_CHECK("%cbgscan", spacer);
+		else if (verbose)
+			LINE_CHECK("%c-bgscan", spacer);
+	}
+	if (bgscan || verbose) {
+		ireq.i_type = IEEE80211_IOC_BGSCAN_INTERVAL;
+		if (ioctl(s, SIOCG80211, &ireq) != -1)
+			LINE_CHECK("%cbgscanintvl %u", spacer, ireq.i_val);
+		ireq.i_type = IEEE80211_IOC_BGSCAN_IDLE;
+		if (ioctl(s, SIOCG80211, &ireq) != -1)
+			LINE_CHECK("%cbgscanidle %u", spacer, ireq.i_val);
+		if (IEEE80211_IS_CHAN_A(c) || verbose) {
+			ireq.i_type = IEEE80211_IOC_ROAM_RSSI_11A;
+			if (ioctl(s, SIOCG80211, &ireq) != -1)
+				LINE_CHECK("%croam:rssi11a %d",
+					spacer, ireq.i_val);
+			ireq.i_type = IEEE80211_IOC_ROAM_RATE_11A;
+			if (ioctl(s, SIOCG80211, &ireq) != -1)
+				LINE_CHECK("%croam:rate11a %u",
+					spacer, ireq.i_val/2);
+		}
+		if (IEEE80211_IS_CHAN_B(c) || verbose) {
+			ireq.i_type = IEEE80211_IOC_ROAM_RSSI_11B;
+			if (ioctl(s, SIOCG80211, &ireq) != -1)
+				LINE_CHECK("%croam:rssi11b %d",
+					spacer, ireq.i_val);
+			ireq.i_type = IEEE80211_IOC_ROAM_RATE_11B;
+			if (ioctl(s, SIOCG80211, &ireq) != -1)
+				LINE_CHECK("%croam:rate11b %u",
+					spacer, ireq.i_val/2);
+		}
+		if (IEEE80211_IS_CHAN_ANYG(c) || verbose) {
+			ireq.i_type = IEEE80211_IOC_ROAM_RSSI_11G;
+			if (ioctl(s, SIOCG80211, &ireq) != -1)
+				LINE_CHECK("%croam:rssi11g %d",
+					spacer, ireq.i_val);
+			ireq.i_type = IEEE80211_IOC_ROAM_RATE_11G;
+			if (ioctl(s, SIOCG80211, &ireq) != -1)
+				LINE_CHECK("%croam:rate11g %u",
+					spacer, ireq.i_val/2);
+		}
+	}
+
+	if (IEEE80211_IS_CHAN_ANYG(c) || verbose) {
 		ireq.i_type = IEEE80211_IOC_PUREG;
 		if (ioctl(s, SIOCG80211, &ireq) != -1) {
 			if (ireq.i_val)
@@ -1836,6 +1943,17 @@
 	DEF_CMD("-ff",		0,	set80211fastframes),
 	DEF_CMD("dturbo",	1,	set80211dturbo),
 	DEF_CMD("-dturbo",	0,	set80211dturbo),
+	DEF_CMD("bgscan",	1,	set80211bgscan),
+	DEF_CMD("-bgscan",	0,	set80211bgscan),
+	DEF_CMD_ARG("bgscanidle",	set80211bgscanidle),
+	DEF_CMD_ARG("bgscanintvl",	set80211bgscanintvl),
+	DEF_CMD_ARG("scanvalid",	set80211scanvalid),
+	DEF_CMD_ARG("roam:rssi11a",	set80211roamrssi11a),
+	DEF_CMD_ARG("roam:rssi11b",	set80211roamrssi11b),
+	DEF_CMD_ARG("roam:rssi11g",	set80211roamrssi11g),
+	DEF_CMD_ARG("roam:rate11a",	set80211roamrate11a),
+	DEF_CMD_ARG("roam:rate11b",	set80211roamrate11b),
+	DEF_CMD_ARG("roam:rate11g",	set80211roamrate11g),
 };
 static struct afswtch af_ieee80211 = {
 	.af_name	= "af_ieee80211",



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