Return-path: Received: from mga09.intel.com ([134.134.136.24]:50320 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754882AbZFJUma (ORCPT ); Wed, 10 Jun 2009 16:42:30 -0400 Subject: Re: [PATCH] mac80211: disassociate when switching bands and not scanning From: reinette chatre To: "Luis R. Rodriguez" Cc: "linville@tuxdriver.com" , "johannes@sipsolutions.net" , "j@w1.fi" , "linux-wireless@vger.kernel.org" , "ath9k-devel@lists.ath9k.org" , "Zhu, Yi" , "Abbas, Mohamed" , "ipw3945-devel@lists.sourceforge.net" In-Reply-To: <1244666131-20031-1-git-send-email-lrodriguez@atheros.com> References: <1244666131-20031-1-git-send-email-lrodriguez@atheros.com> Content-Type: text/plain Date: Wed, 10 Jun 2009 13:49:33 -0700 Message-Id: <1244666973.20900.399.camel@rc-desk> Mime-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org List-ID: Hi Luis, On Wed, 2009-06-10 at 13:35 -0700, Luis R. Rodriguez wrote: > If we're associated to an AP and we manually decide to switch > bands we have no guarantee we can communicate with that AP > on the new band and our current bss parameters may change > completely so disassociate. > > This fixes this warning (which is not specific to iwlwifi!): > > [25612.559460] ------------[ cut here ]------------ > [25612.559500] WARNING: at include/net/mac80211.h:2127 rate_control_send_low+0xcf/0xe0 [mac80211]() > [25612.559508] Hardware name: VGN-N170G > [25612.559513] Modules linked in: ath9k ath mac80211 cfg80211 > [25612.559807] Pid: 14492, comm: iwconfig Not tainted 2.6.30-rc8-wl #11 > [25612.559814] Call Trace: > [25612.559829] [] ? printk+0x18/0x1f > [25612.559865] [] ? rate_control_send_low+0xcf/0xe0 [mac80211] > [25612.559878] [] warn_slowpath_common+0x6c/0xc0 > [25612.559912] [] ? rate_control_send_low+0xcf/0xe0 [mac80211] > [25612.559923] [] warn_slowpath_null+0x15/0x20 > [25612.559957] [] rate_control_send_low+0xcf/0xe0 [mac80211] > [25612.559985] [] ath_get_rate+0x33/0x520 [ath9k] > [25612.559998] [] ? mark_held_locks+0x63/0x80 > [25612.560064] [] rate_control_get_rate+0xbd/0xd0 [mac80211] > [25612.560102] [] invoke_tx_handlers+0x5df/0xfa0 [mac80211] > [25612.560115] [] ? mark_held_locks+0x63/0x80 > [25612.560152] [] ? __ieee80211_tx_prepare+0x194/0x3b0 [mac80211] > [25612.560190] [] ieee80211_tx+0xd6/0x280 [mac80211] > [25612.560227] [] ? ieee80211_tx+0x6f/0x280 [mac80211] > [25612.560265] [] ieee80211_master_start_xmit+0x1f9/0x400 [mac80211] > [25612.560280] [] dev_hard_start_xmit+0x2ab/0x340 > [25612.560292] [] ? dev_hard_start_xmit+0x60/0x340 > [25612.560304] [] __qdisc_run+0x1e5/0x240 > [25612.560316] [] dev_queue_xmit+0x377/0x4e0 > [25612.560328] [] ? dev_queue_xmit+0x38/0x4e0 > [25612.560365] [] ieee80211_tx_skb+0x52/0x60 [mac80211] > [25612.560400] [] ieee80211_send_delba+0xf0/0x150 [mac80211] > [25612.560413] [] ? del_timer_sync+0x81/0xb0 > [25612.560447] [] __ieee80211_stop_rx_ba_session+0xea/0x1d0 [mac80211] > [25612.560476] [] ? ath9k_ampdu_action+0x0/0x130 [ath9k] > [25612.560511] [] ieee80211_sta_tear_down_BA_sessions+0x33/0x40 [mac80211] > [25612.560548] [] ieee80211_set_disassoc+0xc8/0x370 [mac80211] > [25612.560583] [] ? ieee80211_set_disassoc+0x0/0x370 [mac80211] > [25612.560597] [] ? might_fault+0x4b/0xa0 > [25612.560632] [] ieee80211_sta_req_auth+0xa0/0xc0 [mac80211] > [25612.560665] [] ieee80211_ioctl_siwessid+0xbe/0xd0 [mac80211] > [25612.560679] [] ? copy_from_user+0x35/0x130 > [25612.560694] [] ioctl_standard_call+0x199/0x3a0 > [25612.560707] [] ? __dev_get_by_name+0x7d/0xa0 > [25612.560720] [] wext_handle_ioctl+0x14f/0x230 > [25612.560753] [] ? ieee80211_ioctl_siwessid+0x0/0xd0 [mac80211] > [25612.560766] [] dev_ioctl+0x474/0x540 > [25612.560780] [] ? __pagevec_free+0x25/0x30 > [25612.560794] [] ? sock_ioctl+0x0/0x270 > [25612.560806] [] sock_ioctl+0xf5/0x270 > [25612.560817] [] ? sock_ioctl+0x0/0x270 > [25612.560831] [] vfs_ioctl+0x28/0x90 > [25612.560843] [] do_vfs_ioctl+0x72/0x590 > [25612.560856] [] ? trace_hardirqs_on+0xb/0x10 > [25612.560868] [] ? remove_vma+0x56/0x70 > [25612.560879] [] ? remove_vma+0x56/0x70 > [25612.560890] [] ? do_munmap+0x237/0x290 > [25612.560902] [] ? sysenter_exit+0xf/0x1a > [25612.560914] [] sys_ioctl+0x63/0x70 > [25612.560925] [] sysenter_do_call+0x12/0x38 > [25612.560934] ---[ end trace 05e1ecc810d6b568 ]--- > [25612.561114] ------------[ cut here ]------------ > > Cc: Reinette Chatre > Cc: Zhu Yi > Cc: Mohamed Abbas > Cc: ipw3945-devel@lists.sourceforge.net > Signed-off-by: Luis R. Rodriguez > --- > net/mac80211/util.c | 17 ++++++++++++++++- > 1 files changed, 16 insertions(+), 1 deletions(-) > > diff --git a/net/mac80211/util.c b/net/mac80211/util.c > index 66ce96a..8e66556 100644 > --- a/net/mac80211/util.c > +++ b/net/mac80211/util.c > @@ -791,9 +791,24 @@ int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freqMHz) > > if (local->sw_scanning || local->hw_scanning) > ret = 0; > - else > + else { > + struct ieee80211_channel *cur_chan; > + > + cur_chan = local->hw.conf.channel; > + > + /* > + * If we're switching bands and not scanning we > + * could potentially be moving to a band our AP > + * does not understand so give up on it > + */ > + if (sdata->vif.type == NL80211_IFTYPE_STATION && > + (sdata->u.mgd.flags & IEEE80211_STA_ASSOCIATED) && > + cur_chan->band != chan->band) > + ieee80211_sta_deauthenticate(sdata, > + WLAN_REASON_DEAUTH_LEAVING); > ret = ieee80211_hw_config( > local, IEEE80211_CONF_CHANGE_CHANNEL); > + } > } > > return ret; This touches code targeted for removal in recent "mac80211: disconnect when user changes channel" patch. Reinette