From owner-freebsd-current@FreeBSD.ORG Fri Sep 16 17:58:45 2011 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2295B1065674; Fri, 16 Sep 2011 17:58:45 +0000 (UTC) (envelope-from nox@jelal.kn-bremen.de) Received: from smtp.kn-bremen.de (gelbbaer.kn-bremen.de [78.46.108.116]) by mx1.freebsd.org (Postfix) with ESMTP id D145D8FC17; Fri, 16 Sep 2011 17:58:44 +0000 (UTC) Received: by smtp.kn-bremen.de (Postfix, from userid 10) id 327E41E000E4; Fri, 16 Sep 2011 19:40:04 +0200 (CEST) Received: from triton8.kn-bremen.de (noident@localhost [127.0.0.1]) by triton8.kn-bremen.de (8.14.4/8.14.3) with ESMTP id p8GHbjwW042912; Fri, 16 Sep 2011 19:37:45 +0200 (CEST) (envelope-from nox@triton8.kn-bremen.de) Received: (from nox@localhost) by triton8.kn-bremen.de (8.14.4/8.14.3/Submit) id p8GHbjD8042911; Fri, 16 Sep 2011 19:37:45 +0200 (CEST) (envelope-from nox) From: Juergen Lock Date: Fri, 16 Sep 2011 19:37:45 +0200 To: freebsd-current@FreeBSD.org Message-ID: <20110916173745.GA42502@triton8.kn-bremen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-mobile@FreeBSD.org Subject: [PATCH: iwn(4)] Fix channel switching in monitor mode 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: Fri, 16 Sep 2011 17:58:45 -0000 Hi! I just got a "Centrino Advanced-N 6230" half-size mini-pcie card (using iwn6000g2bfw.ko firmware, my Dell Precision M4500 laptop came with an unsupported Broadcom BCM4313: https://laptop.bsdgroup.de/freebsd/index.html?action=show_laptop_detail&laptop=13061 ), and found channel switching didn't work in monitor mode, the patch below seems to fix it - also at: http://people.freebsd.org/~nox/tmp/patch-iwn-channel-monitor.txt (I also applied the two patches from the `"Intel Centrino Advanced-N + WiMAX 6250" doesn't work' thread tho I'm not 100% sure they are needed for this nic: http://markmail.org/message/exik7phjs2j7pnsi and http://docs.freebsd.org/cgi/mid.cgi?CAAgh0_bL7K3PZVAZxPV8JwdhnopOvdRp0Z+xHU-CfGba5bz1Kw ) And here is the channel switching patch: --- src/sys/dev/iwn/if_iwn.c.orig +++ src/sys/dev/iwn/if_iwn.c @@ -6984,12 +6984,24 @@ iwn_set_channel(struct ieee80211com *ic) const struct ieee80211_channel *c = ic->ic_curchan; struct ifnet *ifp = ic->ic_ifp; struct iwn_softc *sc = ifp->if_softc; + int error; IWN_LOCK(sc); sc->sc_rxtap.wr_chan_freq = htole16(c->ic_freq); sc->sc_rxtap.wr_chan_flags = htole16(c->ic_flags); sc->sc_txtap.wt_chan_freq = htole16(c->ic_freq); sc->sc_txtap.wt_chan_flags = htole16(c->ic_flags); + + /* + * Only need to set the channel in Monitor mode. AP scanning and auth + * are already taken care of by their respective firmware commands. + */ + if (ic->ic_opmode == IEEE80211_M_MONITOR) { + error = iwn_config(sc); + if (error != 0) + device_printf(sc->sc_dev, + "error %d settting channel\n", error); + } IWN_UNLOCK(sc); }