From patchwork Thu Jan 20 19:14:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helmut Schaa X-Patchwork-Id: 492501 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0KKFYft017679 for ; Thu, 20 Jan 2011 20:15:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754267Ab1ATUPd (ORCPT ); Thu, 20 Jan 2011 15:15:33 -0500 Received: from mail-bw0-f46.google.com ([209.85.214.46]:54268 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754260Ab1ATUPc (ORCPT ); Thu, 20 Jan 2011 15:15:32 -0500 Received: by bwz15 with SMTP id 15so894044bwz.19 for ; Thu, 20 Jan 2011 12:15:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:from:to:subject:date:user-agent:cc:references :in-reply-to:mime-version:content-type:content-transfer-encoding :message-id; bh=TQFd99SROEHcdaVysJCNDY5aN0zPdNlPDejeH9PXvVI=; b=WEvKCjzZCAqO8U69/EDyZClmRWmMoRZAZV77vT3yyEXuq16SeQgUV2SaJM3LrpS1rI ChgIOjbJmiEl0CpZLdLzlpJH5Uenrsez5TWBvoXSR+d1J1OgN4hfAic7Vh/V3rKREAo2 WJmlxHYl6JXYnbGDENi649jhnTY66ceT933zM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; b=TDglu++AMjDBwmLfcOhZ8bnC9F6mA4xCztJNjBeXzgbCHFO+mv0UUGXm5oKK+dqDRZ ixsi9okj0lf1NLjN7TSGUWu6aiHRK6TtTt2D7+9JGFv+XVltRuBSYHBfgZfsjRIOAtQ9 Li11c6iO7zswtiN2hblfntUzTFrhAqF4cm+Ls= Received: by 10.204.114.143 with SMTP id e15mr2319556bkq.182.1295550973734; Thu, 20 Jan 2011 11:16:13 -0800 (PST) Received: from helmutmobil.site (p5495E78E.dip.t-dialin.net [84.149.231.142]) by mx.google.com with ESMTPS id v25sm4120902bkt.18.2011.01.20.11.16.11 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 20 Jan 2011 11:16:12 -0800 (PST) From: Helmut Schaa To: Ben Greear Subject: Re: [RFC 2/3] mac80211: Support scanning only current active channel. Date: Thu, 20 Jan 2011 20:14:50 +0100 User-Agent: KMail/1.13.5 (Linux/2.6.37-wl-default+; KDE/4.5.5; x86_64; ; ) Cc: Johannes Berg , linux-wireless@vger.kernel.org References: <1295544750-6704-1-git-send-email-greearb@candelatech.com> <1295547439.3693.46.camel@jlt3.sipsolutions.net> <4D387D25.7080902@candelatech.com> In-Reply-To: <4D387D25.7080902@candelatech.com> MIME-Version: 1.0 Message-Id: <201101202014.51161.helmut.schaa@googlemail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 20 Jan 2011 20:15:54 +0000 (UTC) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index a6701ed..d710149 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -388,6 +388,7 @@ ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx) struct ieee80211_local *local = rx->local; struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); struct sk_buff *skb = rx->skb; + int ret; if (likely(!(status->rx_flags & IEEE80211_RX_IN_SCAN))) return RX_CONTINUE; @@ -396,10 +397,14 @@ ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx) return ieee80211_scan_rx(rx->sdata, skb); if (test_bit(SCAN_SW_SCANNING, &local->scanning)) { - /* drop all the other packets during a software scan anyway */ - if (ieee80211_scan_rx(rx->sdata, skb) != RX_QUEUED) + ret = ieee80211_scan_rx(rx->sdata, skb); + /* drop all the other packets while scanning off channel */ + if (ret != RX_QUEUED && + test_bit(SCAN_OFF_CHANNEL, &local->scanning)) { dev_kfree_skb(skb); - return RX_QUEUED; + return RX_QUEUED; + } + return ret; } /* scanning finished during invoking of handlers */ @@ -2730,7 +2735,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, local->dot11ReceivedFragmentCount++; if (unlikely(test_bit(SCAN_HW_SCANNING, &local->scanning) || - test_bit(SCAN_OFF_CHANNEL, &local->scanning))) + test_bit(SCAN_SW_SCANNING, &local->scanning))) status->rx_flags |= IEEE80211_RX_IN_SCAN; if (ieee80211_is_mgmt(fc)) diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index fb274db..bcc8a3e 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c @@ -486,7 +486,15 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local, } mutex_unlock(&local->iflist_mtx); - if (local->scan_channel) { + if (local->scan_channel == local->oper_channel || + local->scan_channel == NULL) { + /* + * we're on the operating channel currently, let's + * leave that channel now to scan another one + */ + local->next_scan_state = SCAN_LEAVE_OPER_CHANNEL; + } + else { /* * we're currently scanning a different channel, let's * see if we can scan another channel without interfering @@ -520,12 +528,6 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local, local->next_scan_state = SCAN_ENTER_OPER_CHANNEL; else local->next_scan_state = SCAN_SET_CHANNEL; - } else { - /* - * we're on the operating channel currently, let's - * leave that channel now to scan another one - */ - local->next_scan_state = SCAN_LEAVE_OPER_CHANNEL; } *next_delay = 0; @@ -534,6 +536,21 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local, static void ieee80211_scan_state_leave_oper_channel(struct ieee80211_local *local, unsigned long *next_delay) { + struct ieee80211_channel *chan; + chan = local->scan_req->channels[local->scan_channel_idx]; + + /* remember when we left the operating channel */ + local->leave_oper_channel_time = jiffies; + + /* advance to the next channel to be scanned */ + local->next_scan_state = SCAN_SET_CHANNEL; + + /* Scanning operating channel, take the shortcut */ + if (chan == local->oper_channel) { + *next_delay = 0; + return; + } + ieee80211_offchannel_stop_station(local); __set_bit(SCAN_OFF_CHANNEL, &local->scanning); @@ -546,12 +563,6 @@ static void ieee80211_scan_state_leave_oper_channel(struct ieee80211_local *loca *next_delay = 0; else *next_delay = HZ / 10; - - /* remember when we left the operating channel */ - local->leave_oper_channel_time = jiffies; - - /* advance to the next channel to be scanned */ - local->next_scan_state = SCAN_SET_CHANNEL; } static void ieee80211_scan_state_enter_oper_channel(struct ieee80211_local *local, @@ -583,8 +594,10 @@ static void ieee80211_scan_state_set_channel(struct ieee80211_local *local, chan = local->scan_req->channels[local->scan_channel_idx]; local->scan_channel = chan; - if (ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL)) - skip = 1; + + if (chan != local->oper_channel) + if (ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL)) + skip = 1; /* advance state machine to next channel/band */ local->scan_channel_idx++;