From owner-freebsd-current@FreeBSD.ORG Sat Jan 7 18:57:17 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 48D2516A41F; Sat, 7 Jan 2006 18:57:17 +0000 (GMT) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.177]) by mx1.FreeBSD.org (Postfix) with ESMTP id 34F9843D45; Sat, 7 Jan 2006 18:57:15 +0000 (GMT) (envelope-from max@love2party.net) Received: from [84.163.206.120] (helo=amd64.laiers.local) by mrelayeu.kundenserver.de (node=mrelayeu2) with ESMTP (Nemesis), id 0MKwtQ-1EvJFZ3h6s-0000ls; Sat, 07 Jan 2006 19:57:14 +0100 From: Max Laier Organization: FreeBSD To: freebsd-current@freebsd.org Date: Sat, 7 Jan 2006 19:57:48 +0100 User-Agent: KMail/1.8.3 References: <200601070605.05535.max@love2party.net> In-Reply-To: <200601070605.05535.max@love2party.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1376887.ZC23clUomX"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200601071957.55542.max@love2party.net> X-Provags-ID: kundenserver.de abuse@kundenserver.de login:61c499deaeeba3ba5be80f48ecc83056 Cc: Damien Bergamini , Alexander Nedotsukov Subject: Re: Intel 2915abg and 11a X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jan 2006 18:57:17 -0000 --nextPart1376887.ZC23clUomX Content-Type: multipart/mixed; boundary="Boundary-01=_u8AwDzxaeWM2LKO" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_u8AwDzxaeWM2LKO Content-Type: text/plain; charset="iso-8859-6" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Saturday 07 January 2006 06:04, Max Laier wrote: > Hi, > > is anyone successfully running their Intel 2915abg card in 11a mode with > the iwi(4) driver? I am wondering, because since 11a has been enabled in > the driver I can't use it anymore. "fatal error" while scanning through > the 11a channels. No matter what firmware I use. > > Please let me know - if there are no positive reports I'd like to disable > 11a for the moment to have the driver working in 11b/g mode at least - > which it does. Andrew Atrens, who did the DragonFly port, was nice enough to let me know t= hat=20 he had worked around the issue. By looking at the diffs I came up with thi= s=20 patch, which fixes things for me. There is more to be done wrt locking, bu= t=20 that's another story - for now only fixing the obvious problems. BTW, I am working on the firmware loading proposed by Sam in -arch a while= =20 back. My latest version is here: http://people.freebsd.org/~mlaier/firmware.tgz including these changes to iwi as well as the modified firmware loading. =2D-=20 /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News --Boundary-01=_u8AwDzxaeWM2LKO Content-Type: text/x-diff; charset="iso-8859-6"; name="if_iwi.11a.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="if_iwi.11a.diff" Index: if_iwi.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /usr/store/mlaier/fcvs/src/sys/dev/iwi/if_iwi.c,v retrieving revision 1.26 diff -u -r1.26 if_iwi.c =2D-- if_iwi.c 20 Nov 2005 16:02:04 -0000 1.26 +++ if_iwi.c 7 Jan 2006 18:46:16 -0000 @@ -150,6 +150,7 @@ static int iwi_scan(struct iwi_softc *); static int iwi_auth_and_assoc(struct iwi_softc *); static void iwi_init(void *); +static void iwi_init_locked(void *); static void iwi_stop(void *); static int iwi_read_firmware(const char *, caddr_t *, size_t *); static int iwi_sysctl_stats(SYSCTL_HANDLER_ARGS); @@ -881,7 +882,7 @@ } =20 if ((ifp->if_flags & IFF_UP) && (ifp->if_drv_flags & IFF_DRV_RUNNING)) =2D iwi_init(sc); + iwi_init_locked(sc); =20 IWI_UNLOCK(sc); =20 @@ -1773,7 +1774,7 @@ case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) =2D iwi_init(sc); + iwi_init_locked(sc); } else { if (ifp->if_drv_flags & IFF_DRV_RUNNING) iwi_stop(sc); @@ -1788,7 +1789,7 @@ if ((ifp->if_flags & IFF_UP) && (ifp->if_drv_flags & IFF_DRV_RUNNING) && (ic->ic_roaming !=3D IEEE80211_ROAMING_MANUAL)) =2D iwi_init(sc); + iwi_init_locked(sc); error =3D 0; } =20 @@ -2255,10 +2256,12 @@ struct ieee80211com *ic =3D &sc->sc_ic; struct iwi_scan scan; uint8_t *p; =2D int i, count; + int i, count, do_5ghz_scan =3D 0; =20 =2D memset(&scan, 0, sizeof scan); + sc->scan_counter++; + sc->flags |=3D IWI_FLAG_SCANNING; =20 + bzero(&scan, sizeof(scan)); if (ic->ic_des_esslen !=3D 0) { scan.bdirected =3D htole16(sc->dwelltime); memset(scan.type, IWI_SCAN_TYPE_BDIRECTED, sizeof scan.type); @@ -2268,25 +2271,40 @@ } =20 p =3D scan.channels; =2D count =3D 0; =2D for (i =3D 0; i <=3D IEEE80211_CHAN_MAX; i++) { =2D if (IEEE80211_IS_CHAN_5GHZ(&ic->ic_channels[i]) && =2D isset(ic->ic_chan_active, i)) { =2D *++p =3D i; =2D count++; =2D } + /* + * If we have .11a capable adapter, and + * - we are in .11a mode, or + * - we are in auto mode and this is an odd numbered scan + * then do a 5GHz scan, otherwise do a 2GHz scan. + */ + if ( ic->ic_sup_rates[IEEE80211_MODE_11A].rs_nrates > 0 ) { + if (( ic->ic_curmode =3D=3D IEEE80211_MODE_11A ) || + (( ic->ic_curmode =3D=3D IEEE80211_MODE_AUTO ) && + ( sc->scan_counter & 1))) + do_5ghz_scan =3D 1; } =2D *(p - count) =3D IWI_CHAN_5GHZ | count; =2D count =3D 0; =2D for (i =3D 0; i <=3D IEEE80211_CHAN_MAX; i++) { =2D if (IEEE80211_IS_CHAN_2GHZ(&ic->ic_channels[i]) && =2D isset(ic->ic_chan_active, i)) { =2D *++p =3D i; =2D count++; + if ( do_5ghz_scan ) { + DPRINTF(("Scanning 5GHz band\n")); + for (i =3D 0; i <=3D IEEE80211_CHAN_MAX; i++) { + if (IEEE80211_IS_CHAN_5GHZ(&ic->ic_channels[i]) && + isset(ic->ic_chan_active, i)) { + *++p =3D i; + count++; + } + } + *(p - count) =3D IWI_CHAN_5GHZ | count; + } else { + DPRINTF(("Scanning 2GHz band\n")); + for (i =3D 0; i <=3D IEEE80211_CHAN_MAX; i++) { + if (IEEE80211_IS_CHAN_2GHZ(&ic->ic_channels[i]) && + isset(ic->ic_chan_active, i)) { + *++p =3D i; + count++; + } } + *(p - count) =3D IWI_CHAN_2GHZ | count; } =2D *(p - count) =3D IWI_CHAN_2GHZ | count; =20 DPRINTF(("Start scanning\n")); return iwi_cmd(sc, IWI_CMD_SCAN, &scan, sizeof scan, 1); @@ -2418,6 +2436,16 @@ iwi_init(void *priv) { struct iwi_softc *sc =3D priv; + + IWI_LOCK(sc); + iwi_init_locked(sc); + IWI_UNLOCK(sc); +} + +static void +iwi_init_locked(void *priv) +{ + struct iwi_softc *sc =3D priv; struct ieee80211com *ic =3D &sc->sc_ic; struct ifnet *ifp =3D ic->ic_ifp; struct iwi_rx_data *data; Index: if_iwivar.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /usr/store/mlaier/fcvs/src/sys/dev/iwi/if_iwivar.h,v retrieving revision 1.8 diff -u -r1.8 if_iwivar.h =2D-- if_iwivar.h 19 Nov 2005 16:54:55 -0000 1.8 +++ if_iwivar.h 7 Jan 2006 18:46:16 -0000 @@ -118,6 +118,7 @@ struct mtx sc_mtx; struct unrhdr *sc_unr; =20 + uint32_t scan_counter; uint32_t flags; #define IWI_FLAG_FW_INITED (1 << 0) #define IWI_FLAG_SCANNING (1 << 1) --Boundary-01=_u8AwDzxaeWM2LKO-- --nextPart1376887.ZC23clUomX Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (FreeBSD) iD8DBQBDwA8zXyyEoT62BG0RAlP2AJ9K8a7Ew4bsZLuf2sOK7JEs7WAl+QCePOoH JKnQwQHZAW0HdMkszC4Jjuo= =p7HK -----END PGP SIGNATURE----- --nextPart1376887.ZC23clUomX--