Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Nov 2005 23:50:34 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 87097 for review
Message-ID:  <200511222350.jAMNoYwN091792@repoman.freebsd.org>

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

Change 87097 by sam@sam_ebb on 2005/11/22 23:50:02

	IFC

Affected files ...

.. //depot/projects/wifi/sys/net80211/ieee80211.c#29 integrate
.. //depot/projects/wifi/sys/net80211/ieee80211_freebsd.c#18 integrate
.. //depot/projects/wifi/sys/net80211/ieee80211_output.c#56 integrate
.. //depot/projects/wifi/sys/net80211/ieee80211_var.h#36 integrate

Differences ...

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

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net80211/ieee80211.c,v 1.22 2005/08/10 16:22:29 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/net80211/ieee80211.c,v 1.23 2005/11/15 05:56:32 sam Exp $");
 
 /*
  * IEEE 802.11 generic handler
@@ -235,33 +235,48 @@
 /*
  * Convert MHz frequency to IEEE channel number.
  */
-u_int
+int
 ieee80211_mhz2ieee(u_int freq, u_int flags)
 {
+#define IS_CHAN_IN_PUBLIC_SAFETY_BAND(_c) ((_c) > 4940 && (_c) < 4990)
 	if (flags & IEEE80211_CHAN_2GHZ) {	/* 2GHz band */
 		if (freq == 2484)
 			return 14;
 		if (freq < 2484)
-			return (freq - 2407) / 5;
+			return ((int) freq - 2407) / 5;
 		else
 			return 15 + ((freq - 2512) / 20);
 	} else if (flags & IEEE80211_CHAN_5GHZ) {	/* 5Ghz band */
-		return (freq - 5000) / 5;
+		if (IS_CHAN_IN_PUBLIC_SAFETY_BAND(freq))
+			return ((freq * 10) +
+				(((freq % 5) == 2) ? 5 : 0) - 49400) / 5;
+		if (freq <= 5000)
+			return (freq - 4000) / 5;
+		else
+			return (freq - 5000) / 5;
 	} else {				/* either, guess */
 		if (freq == 2484)
 			return 14;
 		if (freq < 2484)
-			return (freq - 2407) / 5;
-		if (freq < 5000)
-			return 15 + ((freq - 2512) / 20);
+			return ((int) freq - 2407) / 5;
+		if (freq < 5000) {
+			if (IS_CHAN_IN_PUBLIC_SAFETY_BAND(freq))
+				return ((freq * 10) +
+					(((freq % 5) == 2) ? 5 : 0) - 49400)/5;
+			else if (freq > 4900)
+				return (freq - 4000) / 5;
+			else
+				return 15 + ((freq - 2512) / 20);
+		}
 		return (freq - 5000) / 5;
 	}
+#undef IS_CHAN_IN_PUBLIC_SAFETY_BAND
 }
 
 /*
  * Convert channel to IEEE channel number.
  */
-u_int
+int
 ieee80211_chan2ieee(struct ieee80211com *ic, const struct ieee80211_channel *c)
 {
 	if (c == NULL) {

==== //depot/projects/wifi/sys/net80211/ieee80211_freebsd.c#18 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_freebsd.c,v 1.8 2005/08/08 18:46:35 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_freebsd.c,v 1.9 2005/11/02 13:46:31 andre Exp $");
 
 /*
  * IEEE 802.11 support (FreeBSD-specific code)
@@ -170,7 +170,7 @@
 	len = roundup(sizeof(struct ieee80211_frame) + pktlen, 4);
 	KASSERT(len <= MCLBYTES, ("802.11 mgt frame too large: %u", len));
 	if (len < MINCLSIZE) {
-		m = m_gethdr(M_NOWAIT, MT_HEADER);
+		m = m_gethdr(M_NOWAIT, MT_DATA);
 		/*
 		 * Align the data in case additional headers are added.
 		 * This should only happen when a WEP header is added
@@ -180,7 +180,7 @@
 		if (m != NULL)
 			MH_ALIGN(m, len);
 	} else
-		m = m_getcl(M_NOWAIT, MT_HEADER, M_PKTHDR);
+		m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
 	if (m != NULL) {
 		m->m_data += sizeof(struct ieee80211_frame);
 		*frm = m->m_data;

==== //depot/projects/wifi/sys/net80211/ieee80211_output.c#56 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_output.c,v 1.34 2005/08/10 16:22:29 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_output.c,v 1.35 2005/11/02 13:46:31 andre Exp $");
 
 #include "opt_inet.h"
 
@@ -223,7 +223,7 @@
 	struct mbuf *m;
 	struct ieee80211_frame *wh;
 
-	MGETHDR(m, M_NOWAIT, MT_HEADER);
+	MGETHDR(m, M_NOWAIT, MT_DATA);
 	if (m == NULL) {
 		/* XXX debug msg */
 		ic->ic_stats.is_tx_nobuf++;

==== //depot/projects/wifi/sys/net80211/ieee80211_var.h#36 (text+ko) ====

@@ -29,7 +29,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/net80211/ieee80211_var.h,v 1.30 2005/08/10 16:22:29 sam Exp $
+ * $FreeBSD: src/sys/net80211/ieee80211_var.h,v 1.31 2005/11/15 05:56:32 sam Exp $
  */
 #ifndef _NET80211_IEEE80211_VAR_H_
 #define _NET80211_IEEE80211_VAR_H_
@@ -340,8 +340,8 @@
 int	ieee80211_rate2media(struct ieee80211com *, int,
 		enum ieee80211_phymode);
 int	ieee80211_media2rate(int);
-u_int	ieee80211_mhz2ieee(u_int, u_int);
-u_int	ieee80211_chan2ieee(struct ieee80211com *,
+int	ieee80211_mhz2ieee(u_int, u_int);
+int	ieee80211_chan2ieee(struct ieee80211com *,
 		const struct ieee80211_channel *);
 u_int	ieee80211_ieee2mhz(u_int, u_int);
 struct ieee80211_channel *ieee80211_find_channel(struct ieee80211com *,



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