PERFORCE change 141149 for review

Sam Leffler sam at FreeBSD.org
Sun May 4 18:41:46 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=141149

Change 141149 by sam at sam_ebb on 2008/05/04 18:41:34

	Cleanup opmode handling a bit:
	o add sta mode capability flag now we have free bits
	o mark all drivers as sta mode capable
	o move IEEE80211_C_OPMODE to ieee80211_var.h so it's more clear
	  it needs to be kept consistent with the set of opmode capabilities
	o add ieee80211_opcap array to map an opmode to the corresponding
	  capability bit for use internal to net80211
	o update ddb capability bit decoding

Affected files ...

.. //depot/projects/vap/sys/dev/ath/if_ath.c#71 edit
.. //depot/projects/vap/sys/dev/bwi/if_bwi.c#18 edit
.. //depot/projects/vap/sys/dev/if_ndis/if_ndis.c#19 edit
.. //depot/projects/vap/sys/dev/ipw/if_ipw.c#18 edit
.. //depot/projects/vap/sys/dev/iwi/if_iwi.c#31 edit
.. //depot/projects/vap/sys/dev/iwn/if_iwn.c#19 edit
.. //depot/projects/vap/sys/dev/malo/if_malo.c#9 edit
.. //depot/projects/vap/sys/dev/mwl/if_mwl.c#9 edit
.. //depot/projects/vap/sys/dev/ral/rt2560.c#34 edit
.. //depot/projects/vap/sys/dev/ral/rt2661.c#32 edit
.. //depot/projects/vap/sys/dev/usb/if_rum.c#23 edit
.. //depot/projects/vap/sys/dev/usb/if_ural.c#21 edit
.. //depot/projects/vap/sys/dev/usb/if_zyd.c#22 edit
.. //depot/projects/vap/sys/dev/wi/if_wi.c#31 edit
.. //depot/projects/vap/sys/dev/wpi/if_wpi.c#24 edit
.. //depot/projects/vap/sys/net80211/ieee80211.c#44 edit
.. //depot/projects/vap/sys/net80211/ieee80211_ddb.c#14 edit
.. //depot/projects/vap/sys/net80211/ieee80211_proto.h#21 edit
.. //depot/projects/vap/sys/net80211/ieee80211_var.h#41 edit

Differences ...

==== //depot/projects/vap/sys/dev/ath/if_ath.c#71 (text+ko) ====

@@ -515,7 +515,8 @@
 	ic->ic_phytype = IEEE80211_T_OFDM;
 	ic->ic_opmode = IEEE80211_M_STA;
 	ic->ic_caps =
-		  IEEE80211_C_IBSS		/* ibss, nee adhoc, mode */
+		  IEEE80211_C_STA		/* station mode */
+		| IEEE80211_C_IBSS		/* ibss, nee adhoc, mode */
 		| IEEE80211_C_HOSTAP		/* hostap mode */
 		| IEEE80211_C_MONITOR		/* monitor mode */
 		| IEEE80211_C_AHDEMO		/* adhoc demo mode */

==== //depot/projects/vap/sys/dev/bwi/if_bwi.c#18 (text+ko) ====

@@ -506,7 +506,8 @@
 	ieee80211_init_channels(ic, NULL, &bands);
 
 	ic->ic_ifp = ifp;
-	ic->ic_caps = IEEE80211_C_SHSLOT |
+	ic->ic_caps = IEEE80211_C_STA |
+		      IEEE80211_C_SHSLOT |
 		      IEEE80211_C_SHPREAMBLE |
 		      IEEE80211_C_WPA |
 		      IEEE80211_C_MONITOR;

==== //depot/projects/vap/sys/dev/if_ndis/if_ndis.c#19 (text+ko) ====

@@ -719,7 +719,7 @@
 		ic->ic_ifp = ifp;
 		ic->ic_opmode = IEEE80211_M_STA;
 	        ic->ic_phytype = IEEE80211_T_DS;
-		ic->ic_caps = IEEE80211_C_IBSS;
+		ic->ic_caps = IEEE80211_C_STA | IEEE80211_C_IBSS;
 		setbit(ic->ic_modecaps, IEEE80211_MODE_AUTO);
 		len = 0;
 		r = ndis_get_info(sc, OID_802_11_NETWORK_TYPES_SUPPORTED,

==== //depot/projects/vap/sys/dev/ipw/if_ipw.c#18 (text+ko) ====

@@ -305,7 +305,9 @@
 	ic->ic_phytype = IEEE80211_T_DS;
 
 	/* set device capabilities */
-	ic->ic_caps = IEEE80211_C_IBSS		/* IBSS mode supported */
+	ic->ic_caps =
+		  IEEE80211_C_STA		/* station mode supported */
+		| IEEE80211_C_IBSS		/* IBSS mode supported */
 		| IEEE80211_C_MONITOR		/* monitor mode supported */
 		| IEEE80211_C_PMGT		/* power save supported */
 		| IEEE80211_C_SHPREAMBLE	/* short preamble supported */

==== //depot/projects/vap/sys/dev/iwi/if_iwi.c#31 (text+ko) ====

@@ -388,7 +388,8 @@
 
 	/* set device capabilities */
 	ic->ic_caps =
-	      IEEE80211_C_IBSS		/* IBSS mode supported */
+	      IEEE80211_C_STA		/* station mode supported */
+	    | IEEE80211_C_IBSS		/* IBSS mode supported */
 	    | IEEE80211_C_MONITOR	/* monitor mode supported */
 	    | IEEE80211_C_PMGT		/* power save supported */
 	    | IEEE80211_C_SHPREAMBLE	/* short preamble supported */

==== //depot/projects/vap/sys/dev/iwn/if_iwn.c#19 (text+kox) ====

@@ -379,7 +379,8 @@
 
 	/* set device capabilities */
 	ic->ic_caps =
-		  IEEE80211_C_MONITOR		/* monitor mode supported */
+		  IEEE80211_C_STA		/* station mode supported */
+		| IEEE80211_C_MONITOR		/* monitor mode supported */
 		| IEEE80211_C_TXPMGT		/* tx power management */
 		| IEEE80211_C_SHSLOT		/* short slot time supported */
 		| IEEE80211_C_WPA

==== //depot/projects/vap/sys/dev/malo/if_malo.c#9 (text+ko) ====

@@ -301,7 +301,8 @@
 	ic->ic_phytype = IEEE80211_T_OFDM;
 	ic->ic_opmode = IEEE80211_M_STA;
 	ic->ic_caps =
-	      IEEE80211_C_BGSCAN		/* capable of bg scanning */
+	      IEEE80211_C_STA			/* station mode supported */
+	    | IEEE80211_C_BGSCAN		/* capable of bg scanning */
 	    | IEEE80211_C_MONITOR		/* monitor mode */
 	    | IEEE80211_C_SHPREAMBLE		/* short preamble supported */
 	    | IEEE80211_C_SHSLOT		/* short slot time supported */

==== //depot/projects/vap/sys/dev/mwl/if_mwl.c#9 (text+ko) ====

@@ -427,7 +427,8 @@
 	ic->ic_phytype = IEEE80211_T_OFDM;
 	ic->ic_opmode = IEEE80211_M_STA;
 	ic->ic_caps =
-		  IEEE80211_C_HOSTAP		/* hostap mode */
+		  IEEE80211_C_STA		/* station mode supported */
+		| IEEE80211_C_HOSTAP		/* hostap mode */
 		| IEEE80211_C_MONITOR		/* monitor mode */
 #if 0
 		| IEEE80211_C_IBSS		/* ibss, nee adhoc, mode */

==== //depot/projects/vap/sys/dev/ral/rt2560.c#34 (text) ====

@@ -278,7 +278,8 @@
 
 	/* set device capabilities */
 	ic->ic_caps =
-		  IEEE80211_C_IBSS		/* ibss, nee adhoc, mode */
+		  IEEE80211_C_STA		/* station mode supported */
+		| IEEE80211_C_IBSS		/* ibss, nee adhoc, mode */
 		| IEEE80211_C_HOSTAP		/* hostap mode */
 		| IEEE80211_C_MONITOR		/* monitor mode */
 		| IEEE80211_C_AHDEMO		/* adhoc demo mode */

==== //depot/projects/vap/sys/dev/ral/rt2661.c#32 (text) ====

@@ -280,7 +280,8 @@
 
 	/* set device capabilities */
 	ic->ic_caps =
-		  IEEE80211_C_IBSS		/* ibss, nee adhoc, mode */
+		  IEEE80211_C_STA		/* station mode supported */
+		| IEEE80211_C_IBSS		/* ibss, nee adhoc, mode */
 		| IEEE80211_C_HOSTAP		/* hostap mode */
 		| IEEE80211_C_MONITOR		/* monitor mode */
 		| IEEE80211_C_AHDEMO		/* adhoc demo mode */

==== //depot/projects/vap/sys/dev/usb/if_rum.c#23 (text+ko) ====

@@ -490,7 +490,8 @@
 
 	/* set device capabilities */
 	ic->ic_caps =
-	      IEEE80211_C_IBSS		/* IBSS mode supported */
+	      IEEE80211_C_STA		/* station mode supported */
+	    | IEEE80211_C_IBSS		/* IBSS mode supported */
 	    | IEEE80211_C_MONITOR	/* monitor mode supported */
 	    | IEEE80211_C_HOSTAP	/* HostAp mode supported */
 	    | IEEE80211_C_TXPMGT	/* tx power management */

==== //depot/projects/vap/sys/dev/usb/if_ural.c#21 (text+ko) ====

@@ -479,7 +479,8 @@
 
 	/* set device capabilities */
 	ic->ic_caps =
-	      IEEE80211_C_IBSS		/* IBSS mode supported */
+	      IEEE80211_C_STA		/* station mode supported */
+	    | IEEE80211_C_IBSS		/* IBSS mode supported */
 	    | IEEE80211_C_MONITOR	/* monitor mode supported */
 	    | IEEE80211_C_HOSTAP	/* HostAp mode supported */
 	    | IEEE80211_C_TXPMGT	/* tx power management */

==== //depot/projects/vap/sys/dev/usb/if_zyd.c#22 (text+ko) ====

@@ -390,7 +390,8 @@
 
 	/* set device capabilities */
 	ic->ic_caps =
-		  IEEE80211_C_MONITOR		/* monitor mode */
+		  IEEE80211_C_STA		/* station mode supported */
+		| IEEE80211_C_MONITOR		/* monitor mode */
 		| IEEE80211_C_SHPREAMBLE	/* short preamble supported */
 	        | IEEE80211_C_SHSLOT	/* short slot time supported */
 		| IEEE80211_C_BGSCAN		/* capable of bg scanning */

==== //depot/projects/vap/sys/dev/wi/if_wi.c#31 (text+ko) ====

@@ -331,8 +331,9 @@
 	ic->ic_ifp = ifp;
 	ic->ic_phytype = IEEE80211_T_DS;
 	ic->ic_opmode = IEEE80211_M_STA;
-	ic->ic_caps = IEEE80211_C_PMGT
+	ic->ic_caps = IEEE80211_C_STA
 		    | IEEE80211_C_MONITOR
+		    | IEEE80211_C_PMGT
 		    ;
 
 	/*

==== //depot/projects/vap/sys/dev/wpi/if_wpi.c#24 (text+ko) ====

@@ -623,7 +623,8 @@
 
 	/* set device capabilities */
 	ic->ic_caps =
-		  IEEE80211_C_MONITOR		/* monitor mode supported */
+		  IEEE80211_C_STA		/* station mode supported */
+		| IEEE80211_C_MONITOR		/* monitor mode supported */
 		| IEEE80211_C_TXPMGT		/* tx power management */
 		| IEEE80211_C_SHSLOT		/* short slot time supported */
 		| IEEE80211_C_SHPREAMBLE	/* short preamble supported */

==== //depot/projects/vap/sys/net80211/ieee80211.c#44 (text+ko) ====

@@ -49,18 +49,28 @@
 
 #include <net/bpf.h>
 
-const char *ieee80211_phymode_name[] = {
-	"auto",		/* IEEE80211_MODE_AUTO */
-	"11a",		/* IEEE80211_MODE_11A */
-	"11b",		/* IEEE80211_MODE_11B */
-	"11g",		/* IEEE80211_MODE_11G */
-	"FH",		/* IEEE80211_MODE_FH */
-	"turboA",	/* IEEE80211_MODE_TURBO_A */
-	"turboG",	/* IEEE80211_MODE_TURBO_G */
-	"sturboA",	/* IEEE80211_MODE_STURBO_A */
-	"11na",		/* IEEE80211_MODE_11NA */
-	"11ng",		/* IEEE80211_MODE_11NG */
+const char *ieee80211_phymode_name[IEEE80211_MODE_MAX] = {
+	[IEEE80211_MODE_AUTO]	  = "auto",
+	[IEEE80211_MODE_11A]	  = "11a",
+	[IEEE80211_MODE_11B]	  = "11b",
+	[IEEE80211_MODE_11G]	  = "11g",
+	[IEEE80211_MODE_FH]	  = "FH",
+	[IEEE80211_MODE_TURBO_A]  = "turboA",
+	[IEEE80211_MODE_TURBO_G]  = "turboG",
+	[IEEE80211_MODE_STURBO_A] = "sturboA",
+	[IEEE80211_MODE_11NA]	  = "11na",
+	[IEEE80211_MODE_11NG]	  = "11ng",
+};
+/* map ieee80211_opmode to the corresponding capability bit */
+const int ieee80211_opcap[IEEE80211_OPMODE_MAX] = {
+	[IEEE80211_M_IBSS]	= IEEE80211_C_IBSS,
+	[IEEE80211_M_WDS]	= IEEE80211_C_WDS,
+	[IEEE80211_M_STA]	= IEEE80211_C_STA,
+	[IEEE80211_M_AHDEMO]	= IEEE80211_C_AHDEMO,
+	[IEEE80211_M_HOSTAP]	= IEEE80211_C_HOSTAP,
+	[IEEE80211_M_MONITOR]	= IEEE80211_C_MONITOR,
 };
+
 static const uint8_t ieee80211broadcastaddr[IEEE80211_ADDR_LEN] =
 	{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 
@@ -310,9 +320,6 @@
 	const uint8_t bssid[IEEE80211_ADDR_LEN],
 	const uint8_t macaddr[IEEE80211_ADDR_LEN])
 {
-#define	IEEE80211_C_OPMODE \
-	(IEEE80211_C_IBSS | IEEE80211_C_HOSTAP | IEEE80211_C_AHDEMO | \
-	 IEEE80211_C_MONITOR | IEEE80211_C_WDS)
 	struct ifnet *ifp;
 
 	ifp = if_alloc(IFT_ETHER);
@@ -341,26 +348,14 @@
 	vap->iv_caps = ic->ic_caps &~ IEEE80211_C_OPMODE;
 	vap->iv_htcaps = ic->ic_htcaps;
 	vap->iv_opmode = opmode;
+	vap->iv_caps |= ieee80211_opcap[opmode];
 	switch (opmode) {
 	case IEEE80211_M_STA:
 		/* auto-enable s/w beacon miss support */
 		if (flags & IEEE80211_CLONE_NOBEACONS)
 			vap->iv_flags_ext |= IEEE80211_FEXT_SWBMISS;
 		break;
-	case IEEE80211_M_IBSS:
-		vap->iv_caps |= IEEE80211_C_IBSS;
-		break;
-	case IEEE80211_M_AHDEMO:
-		vap->iv_caps |= IEEE80211_C_AHDEMO;
-		break;
-	case IEEE80211_M_HOSTAP:
-		vap->iv_caps |= IEEE80211_C_HOSTAP;
-		break;
-	case IEEE80211_M_MONITOR:
-		vap->iv_caps |= IEEE80211_C_MONITOR;
-		break;
 	case IEEE80211_M_WDS:
-		vap->iv_caps |= IEEE80211_C_WDS;
 		/*
 		 * WDS links must specify the bssid of the far end.
 		 * For legacy operation this is a static relationship.
@@ -417,7 +412,6 @@
 	ieee80211_regdomain_vattach(vap);
 
 	return 0;
-#undef IEEE80211_C_OPMODE
 }
 
 /*

==== //depot/projects/vap/sys/net80211/ieee80211_ddb.c#14 (text+ko) ====

@@ -71,7 +71,7 @@
 #define	IEEE80211_FVEN_BITS	"\20"
 
 #define	IEEE80211_C_BITS \
-	"\20\7FF\10TURBOP\11IBSS\12PMGT" \
+	"\20\1STA\7FF\10TURBOP\11IBSS\12PMGT" \
 	"\13HOSTAP\14AHDEMO\15SWRETRY\16TXPMGT\17SHSLOT\20SHPREAMBLE" \
 	"\21MONITOR\30WPA1\31WPA2\32BURST\33WME\34WDS\36BGSCAN" \
 	"\37TXFRAG"

==== //depot/projects/vap/sys/net80211/ieee80211_proto.h#21 (text+ko) ====

@@ -48,7 +48,8 @@
 	((*(_ni)->ni_ic->ic_send_mgmt)(_ni, _type, _arg))
 
 extern	const char *ieee80211_mgt_subtype_name[];
-extern	const char *ieee80211_phymode_name[];
+extern	const char *ieee80211_phymode_name[IEEE80211_MODE_MAX];
+extern	const int ieee80211_opcap[IEEE80211_OPMODE_MAX];
 
 void	ieee80211_proto_attach(struct ieee80211com *);
 void	ieee80211_proto_detach(struct ieee80211com *);

==== //depot/projects/vap/sys/net80211/ieee80211_var.h#41 (text+ko) ====

@@ -493,6 +493,7 @@
 
 /* ic_caps/iv_caps: device driver capabilities */
 /* 0x2f available */
+#define	IEEE80211_C_STA		0x00000001	/* CAPABILITY: STA available */
 #define	IEEE80211_C_FF		0x00000040	/* CAPABILITY: ATH FF avail */
 #define	IEEE80211_C_TURBOP	0x00000080	/* CAPABILITY: ATH Turbo avail*/
 #define	IEEE80211_C_IBSS	0x00000100	/* CAPABILITY: IBSS available */
@@ -516,6 +517,10 @@
 #define	IEEE80211_C_TXFRAG	0x40000000	/* CAPABILITY: tx fragments */
 /* XXX protection/barker? */
 
+#define	IEEE80211_C_OPMODE \
+	(IEEE80211_C_STA | IEEE80211_C_IBSS | IEEE80211_C_HOSTAP | \
+	 IEEE80211_C_AHDEMO | IEEE80211_C_MONITOR | IEEE80211_C_WDS)
+
 /*
  * ic_htcaps/iv_htcaps: HT-specific device/driver capabilities
  *


More information about the p4-projects mailing list