From owner-p4-projects@FreeBSD.ORG Tue Nov 22 23:50:58 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id F220416A424; Tue, 22 Nov 2005 23:50:57 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C592D16A41F for ; Tue, 22 Nov 2005 23:50:57 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E02C543D69 for ; Tue, 22 Nov 2005 23:50:47 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id jAMNoYRw091795 for ; Tue, 22 Nov 2005 23:50:34 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id jAMNoYwN091792 for perforce@freebsd.org; Tue, 22 Nov 2005 23:50:34 GMT (envelope-from sam@freebsd.org) Date: Tue, 22 Nov 2005 23:50:34 GMT Message-Id: <200511222350.jAMNoYwN091792@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 87097 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Nov 2005 23:50:59 -0000 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 -__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 -__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 -__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 *,