From nox@FreeBSD.org  Mon Sep 19 00:09:57 2011
Return-Path: <nox@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 548EC1065672
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 Sep 2011 00:09:57 +0000 (UTC)
	(envelope-from nox@FreeBSD.org)
Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28])
	by mx1.freebsd.org (Postfix) with ESMTP id 439798FC0A
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 Sep 2011 00:09:57 +0000 (UTC)
Received: from freefall.freebsd.org (localhost [127.0.0.1])
	by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p8J09v9h018443
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 Sep 2011 00:09:57 GMT
	(envelope-from nox@freefall.freebsd.org)
Received: (from nox@localhost)
	by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p8J09vhV018442;
	Mon, 19 Sep 2011 00:09:57 GMT
	(envelope-from nox)
Message-Id: <201109190009.p8J09vhV018442@freefall.freebsd.org>
Date: Mon, 19 Sep 2011 00:09:57 GMT
From: Juergen Lock <nox@FreeBSD.org>
Reply-To: Juergen Lock <nox@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] [iwn] Fix channel switching in monitor mode
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         160815
>Category:       kern
>Synopsis:       [patch] [iwn] Fix channel switching in monitor mode
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-wireless
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 19 00:10:08 UTC 2011
>Closed-Date:    Wed Oct 12 19:32:32 UTC 2011
>Last-Modified:  Wed Oct 12 19:32:32 UTC 2011
>Originator:     Juergen Lock
>Release:        FreeBSD 8.2-STABLE i386
>Organization:
me?  organized??
>Environment:
System: FreeBSD enceladus.kn-bremen.de 9.0-BETA1 FreeBSD 9.0-BETA1 #1: Thu Sep 15 23:06:39 CEST 2011     nox@enceladus.kn-bremen.de:/usr/obj/usr/src/sys/ENCELADUS  amd64


>Description:
	As mentioned earler on -current,

		http://lists.freebsd.org/pipermail/freebsd-current/2011-September/027418.html

	I have a "Centrino Advanced-N 6230" half-size mini-pcie
	card and found channel switching didn't work in monitor
	mode, the patch below seems to fix it.

>How-To-Repeat:
	# ifconfig wlan0 create wlandev iwn0 wlanmode monitor ...

>Fix:

--- 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);
 }
 


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-wireless 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Sep 19 05:24:51 UTC 2011 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=160815 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/160815: commit references a PR
Date: Tue, 20 Sep 2011 04:30:38 +0000 (UTC)

 Author: adrian
 Date: Tue Sep 20 04:30:23 2011
 New Revision: 225686
 URL: http://svn.freebsd.org/changeset/base/225686
 
 Log:
   Manually set the channel when using monitor mode - the firmware
   doesn't select it automatically.
   
   Submitted by:	nox
   Reviewed by:	bschmidt
   Approved by:	re
   PR:		kern/160815
 
 Modified:
   head/sys/dev/iwn/if_iwn.c
 
 Modified: head/sys/dev/iwn/if_iwn.c
 ==============================================================================
 --- head/sys/dev/iwn/if_iwn.c	Tue Sep 20 04:20:55 2011	(r225685)
 +++ head/sys/dev/iwn/if_iwn.c	Tue Sep 20 04:30:23 2011	(r225686)
 @@ -6952,12 +6952,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,
 +		    "%s: error %d settting channel\n", __func__, error);
 +	}
  	IWN_UNLOCK(sc);
  }
  
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: adrian 
State-Changed-When: Tue Sep 20 04:42:04 UTC 2011 
State-Changed-Why:  
Committed to -HEAD. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=160815 
State-Changed-From-To: closed->patched 
State-Changed-By: adrian 
State-Changed-When: Tue Sep 20 13:49:16 UTC 2011 
State-Changed-Why:  
As pointed out by gavin@, this should be in patched so someone 
else can take care of MFCing it as appropriate. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=160815 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/160815: commit references a PR
Date: Wed, 12 Oct 2011 19:25:20 +0000 (UTC)

 Author: marius
 Date: Wed Oct 12 19:25:12 2011
 New Revision: 226317
 URL: http://svn.freebsd.org/changeset/base/226317
 
 Log:
   MFC: r225686
   
   Manually set the channel when using monitor mode - the firmware
   doesn't select it automatically.
   
   Submitted by:	nox
   Reviewed by:	bschmidt
   PR:		kern/160815
 
 Modified:
   stable/8/sys/dev/iwn/if_iwn.c
 Directory Properties:
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
 
 Modified: stable/8/sys/dev/iwn/if_iwn.c
 ==============================================================================
 --- stable/8/sys/dev/iwn/if_iwn.c	Wed Oct 12 19:23:28 2011	(r226316)
 +++ stable/8/sys/dev/iwn/if_iwn.c	Wed Oct 12 19:25:12 2011	(r226317)
 @@ -6656,12 +6656,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,
 +		    "%s: error %d settting channel\n", __func__, error);
 +	}
  	IWN_UNLOCK(sc);
  }
  
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: marius 
State-Changed-When: Wed Oct 12 19:32:18 UTC 2011 
State-Changed-Why:  
close 

http://www.freebsd.org/cgi/query-pr.cgi?pr=160815 
>Unformatted:
