svn commit: r187796 - head/sys/net80211

Sam Leffler sam at FreeBSD.org
Tue Jan 27 14:48:49 PST 2009


Author: sam
Date: Tue Jan 27 22:48:46 2009
New Revision: 187796
URL: http://svn.freebsd.org/changeset/base/187796

Log:
  fill in ieee channel #'s and max tx power for drivers that work exclusively
  with frequencies; this mimics how ieee80211_setregdomain works

Modified:
  head/sys/net80211/ieee80211.c

Modified: head/sys/net80211/ieee80211.c
==============================================================================
--- head/sys/net80211/ieee80211.c	Tue Jan 27 22:46:34 2009	(r187795)
+++ head/sys/net80211/ieee80211.c	Tue Jan 27 22:48:46 2009	(r187796)
@@ -126,6 +126,21 @@ ieee80211_chan_init(struct ieee80211com 
 	for (i = 0; i < ic->ic_nchans; i++) {
 		c = &ic->ic_channels[i];
 		KASSERT(c->ic_flags != 0, ("channel with no flags"));
+		/*
+		 * Help drivers that work only with frequencies by filling
+		 * in IEEE channel #'s if not already calculated.  Note this
+		 * mimics similar work done in ieee80211_setregdomain when
+		 * changing regulatory state.
+		 */
+		if (c->ic_ieee == 0)
+			c->ic_ieee = ieee80211_mhz2ieee(c->ic_freq,c->ic_flags);
+		if (IEEE80211_IS_CHAN_HT40(c) && c->ic_extieee == 0)
+			c->ic_extieee = ieee80211_mhz2ieee(c->ic_freq +
+			    (IEEE80211_IS_CHAN_HT40U(c) ? 20 : -20),
+			    c->ic_flags);
+		/* default max tx power to max regulatory */
+		if (c->ic_maxpower == 0)
+			c->ic_maxpower = 2*c->ic_maxregpower;
 		setbit(ic->ic_chan_avail, c->ic_ieee);
 		/*
 		 * Identify mode capabilities.


More information about the svn-src-head mailing list