Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Apr 2007 06:17:31 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 118563 for review
Message-ID:  <200704220617.l3M6HVJt033909@repoman.freebsd.org>

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

Change 118563 by sam@sam_ebb on 2007/04/22 06:17:22

	add missing array entry for static turb mode; while here
	add assertions so it doesn't happen in the future

Affected files ...

.. //depot/projects/wifi/sys/net80211/ieee80211.c#50 edit

Differences ...

==== //depot/projects/wifi/sys/net80211/ieee80211.c#50 (text+ko) ====

@@ -426,21 +426,27 @@
 static void
 addmedia(struct ieee80211com *ic, int mode, int mword)
 {
+#define	TURBO(m)	((m) | IFM_IEEE80211_TURBO)
 #define	ADD(_ic, _s, _o) \
 	ifmedia_add(&(_ic)->ic_media, \
 		IFM_MAKEWORD(IFM_IEEE80211, (_s), (_o), 0), 0, NULL)
 	static const u_int mopts[IEEE80211_MODE_MAX] = { 
-		IFM_AUTO,
-		IFM_IEEE80211_11A,
-		IFM_IEEE80211_11B,
-		IFM_IEEE80211_11G,
-		IFM_IEEE80211_FH,
-		IFM_IEEE80211_11A | IFM_IEEE80211_TURBO,
-		IFM_IEEE80211_11G | IFM_IEEE80211_TURBO,
+		IFM_AUTO,			/* IEEE80211_MODE_AUTO */
+		IFM_IEEE80211_11A,		/* IEEE80211_MODE_11A */
+		IFM_IEEE80211_11B,		/* IEEE80211_MODE_11B */
+		IFM_IEEE80211_11G,		/* IEEE80211_MODE_11G */
+		IFM_IEEE80211_FH,		/* IEEE80211_MODE_FH */
+		TURBO(IFM_IEEE80211_11A),	/* IEEE80211_MODE_TURBO_A */
+		TURBO(IFM_IEEE80211_11G),	/* IEEE80211_MODE_TURBO_G */
+		TURBO(IFM_IEEE80211_11A),	/* IEEE80211_MODE_STURBO_A */
 	};
 	u_int mopt;
 
+	KASSERT(mode < IEEE80211_MODE_MAX, ("bad mode %u", mode));
 	mopt = mopts[mode];
+	KASSERT(mopts != 0 || mode == IEEE80211_MODE_AUTO,
+	    ("no media mapping for mode %u", mode));
+
 	ADD(ic, mword, mopt);	/* e.g. 11a auto */
 	if (ic->ic_caps & IEEE80211_C_IBSS)
 		ADD(ic, mword, mopt | IFM_IEEE80211_ADHOC);
@@ -451,6 +457,7 @@
 	if (ic->ic_caps & IEEE80211_C_MONITOR)
 		ADD(ic, mword, mopt | IFM_IEEE80211_MONITOR);
 #undef ADD
+#undef TURBO
 }
 
 /*



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