From owner-freebsd-stable@FreeBSD.ORG Wed Apr 26 04:02:23 2006 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ABA5216A402 for ; Wed, 26 Apr 2006 04:02:23 +0000 (UTC) (envelope-from sam@errno.com) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.FreeBSD.org (Postfix) with ESMTP id BAD1543D53 for ; Wed, 26 Apr 2006 04:02:20 +0000 (GMT) (envelope-from sam@errno.com) Received: from [10.0.0.248] (trouble.errno.com [10.0.0.248]) (authenticated bits=0) by ebb.errno.com (8.13.6/8.12.6) with ESMTP id k3Q42FuJ029043 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 25 Apr 2006 21:02:16 -0700 (PDT) (envelope-from sam@errno.com) Message-ID: <444EF0C7.8040407@errno.com> Date: Tue, 25 Apr 2006 21:02:15 -0700 From: Sam Leffler User-Agent: Thunderbird 1.5 (X11/20060210) MIME-Version: 1.0 To: Douglas Berry References: <200604252258.k3PMwJ74026969@monk.cnd.dundas.on.ca> In-Reply-To: <200604252258.k3PMwJ74026969@monk.cnd.dundas.on.ca> Content-Type: multipart/mixed; boundary="------------070104070407040408000905" Cc: freebsd-stable@freebsd.org Subject: Re: ath0: ath_chan_set: unable to reset channel 5 (2432 Mhz, flags 0x3e0 hal flags 0x140) X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2006 04:02:23 -0000 This is a multi-part message in MIME format. --------------070104070407040408000905 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Douglas Berry wrote: > On Tue, 25 Apr 2006 13:36:56 PDT, Sam Leffler wrote: >> flags 0x3e0 = Passive+5Ghz+2Ghz+OFDM+CCK >> hal flags 0x140 = 5Ghz+OFDM >> Both of these make no sense for a frequency of 2432 Mhz, hence the hal >> got upset. > > Thanks for the interpretation. > >> What are the regulatory domain settings for the card; sysctl dev.ath.0 >> will show them? Please also show the output of ifconfig ath0 list channel. > > Below is the output of of both commands. I couldn't find what 18 > meant as a regulatory domain. The card is currently in use in > Canada. > > dev.ath.0.%desc: Atheros 5212 > dev.ath.0.%driver: ath > dev.ath.0.%location: slot=9 function=0 > dev.ath.0.%pnpinfo: vendor=0x168c device=0x0013 subvendor=0x1186 subdevice=0x3a14 class=0x020000 > dev.ath.0.%parent: pci3 > dev.ath.0.smoothing_rate: 95 > dev.ath.0.sample_rate: 10 > dev.ath.0.countrycode: 0 > dev.ath.0.regdomain: 18 > dev.ath.0.slottime: 20 > dev.ath.0.acktimeout: 48 > dev.ath.0.ctstimeout: 48 > dev.ath.0.softled: 0 > dev.ath.0.ledpin: 0 > dev.ath.0.ledon: 0 > dev.ath.0.ledidle: 2700 > dev.ath.0.txantenna: 0 > dev.ath.0.rxantenna: 1 > dev.ath.0.diversity: 0 > dev.ath.0.txintrperiod: 5 > dev.ath.0.diag: 0 > dev.ath.0.tpscale: 0 > dev.ath.0.tpc: 0 > dev.ath.0.tpack: 63 > dev.ath.0.tpcts: 63 > dev.ath.0.monpass: 24 > > > Channel 1 : 2412 Mhz 11g Channel 137 : 4955* Mhz 11a > Channel 2 : 2417 Mhz 11g Channel 137 : 4957* Mhz 11a > Channel 3 : 2422 Mhz 11g Channel 137 : 4960* Mhz 11a > Channel 4 : 2427 Mhz 11g Channel 137 : 4962* Mhz 11a > Channel 5 : 2432* Mhz 11a 11g Channel 137 : 4965* Mhz 11a > Channel 6 : 2437 Mhz 11g Channel 137 : 4967* Mhz 11a > Channel 7 : 2442 Mhz 11g Channel 137 : 4970* Mhz 11a > Channel 8 : 2447 Mhz 11g Channel 138 : 4972* Mhz 11a > Channel 9 : 2452 Mhz 11g Channel 138 : 4975* Mhz 11a > Channel 10 : 2457* Mhz 11a 11g Channel 138 : 4977* Mhz 11a > Channel 11 : 2462 Mhz 11g Channel 138 : 4980* Mhz 11a > Channel 136 : 4947* Mhz 11a Channel 138 : 4982* Mhz 11a > Channel 136 : 4950* Mhz 11a Channel 138 : 4985* Mhz 11a > Channel 137 : 4952* Mhz 11a Channel 138 : 4987* Mhz 11a Ok, this makes sense now. What's going on is that regdomain 18 enables the FCC Broadband Public Safety channels. These are the frequencies in the 4.9GHz band that are defined for use by the TSB. Unfortunately I botched the integration (I'm shoe-horning support into old code). In particular the mapping from frequency to IEEE channel number for these channels overlaps with the numbers in the 2.4GHz range which causes problems because we have an array of channels that are indexed by IEEE channel number. This is why you see channels 5 and 10 marked as usable for 11a and 11g (the public safety channels are overlayed on top of the normal 2.4G channels). As a stopgap let's try backing out the correct public safety mapping and just use the alternative mapping that maps the frequencies to IEEE channel numbers 188-197. Attached are two patches; one for the ath driver and another for sys/net80211/ieee80211.c in releng6 (note changes to the latter in head are different). I believe this will resolve your problem; you can check by updating your code and looking at what ifconfig ath0 list chan gives you. Once 6.1 goes out I plan to bring in a bunch of work that'll make stuff like this easy to handle. Unfortunately that will only happen in current because it'll break ABI's that are fixed for the life of 6.x. Sam --------------070104070407040408000905 Content-Type: text/plain; name="stable-ieee80211.c.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="stable-ieee80211.c.patch" Index: ieee80211.c =================================================================== RCS file: /usr/ncvs/src/sys/net80211/ieee80211.c,v retrieving revision 1.19.2.7 diff -u -r1.19.2.7 ieee80211.c --- ieee80211.c 11 Mar 2006 19:25:23 -0000 1.19.2.7 +++ ieee80211.c 26 Apr 2006 03:25:33 -0000 @@ -244,14 +244,21 @@ else return 15 + ((freq - 2512) / 20); } else if (flags & IEEE80211_CHAN_5GHZ) { /* 5Ghz band */ - return (freq - 5000) / 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); + if (freq < 5000) { + if (freq > 4900) + return (freq - 4000) / 5; + else + return 15 + ((freq - 2512) / 20); + } return (freq - 5000) / 5; } } --------------070104070407040408000905 Content-Type: text/plain; name="if_ath.c.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="if_ath.c.patch" Index: if_ath.c =================================================================== RCS file: /usr/ncvs/src/sys/dev/ath/if_ath.c,v retrieving revision 1.141 diff -u -r1.141 if_ath.c --- if_ath.c 25 Apr 2006 22:52:28 -0000 1.141 +++ if_ath.c 26 Apr 2006 03:19:59 -0000 @@ -4586,6 +4586,9 @@ HAL_BOOL outdoor, HAL_BOOL xchanmode) { #define COMPAT (CHANNEL_ALL_NOTURBO|CHANNEL_PASSIVE) +#define IS_CHAN_PUBLIC_SAFETY(_c) \ + (((_c)->channelFlags & CHANNEL_5GHZ) && \ + ((_c)->channel > 4940 && (_c)->channel < 4990)) struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = sc->sc_ifp; struct ath_hal *ah = sc->sc_ah; @@ -4618,7 +4621,16 @@ HAL_CHANNEL *c = &chans[i]; u_int16_t flags; - ix = ath_hal_mhz2ieee(ah, c->channel, c->channelFlags); + /* + * XXX we're not ready to handle the ieee number mapping + * for public safety channels as they overlap with any + * 2GHz channels; for now use the non-public safety + * numbering which is non-overlapping. + */ + if (IS_CHAN_PUBLIC_SAFETY(c)) + ix = (c->channel - 4000) / 5; + else + ix = ath_hal_mhz2ieee(ah, c->channel, c->channelFlags); if (ix > IEEE80211_CHAN_MAX) { if_printf(ifp, "bad hal channel %d (%u/%x) ignored\n", ix, c->channel, c->channelFlags); @@ -4651,6 +4663,7 @@ } free(chans, M_TEMP); return 0; +#undef IS_CHAN_PUBLIC_SAFETY #undef COMPAT } --------------070104070407040408000905--