From patchwork Wed Jan 7 15:50:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eliad Peller X-Patchwork-Id: 5585461 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 12773BF6C3 for ; Wed, 7 Jan 2015 15:50:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 33B1C2024C for ; Wed, 7 Jan 2015 15:50:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 175E820221 for ; Wed, 7 Jan 2015 15:50:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753206AbbAGPuX (ORCPT ); Wed, 7 Jan 2015 10:50:23 -0500 Received: from mail-wg0-f41.google.com ([74.125.82.41]:61678 "EHLO mail-wg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752663AbbAGPuV (ORCPT ); Wed, 7 Jan 2015 10:50:21 -0500 Received: by mail-wg0-f41.google.com with SMTP id l18so1447158wgh.0 for ; Wed, 07 Jan 2015 07:50:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=s8sCA6G0oxsf7hjr7HBr4RplXBkCOpO3pSJmAFc4PoQ=; b=Ty41pNxRsDnGfZlMDUc8uHL+MV24EVAaQiXEepIFQThLtsHxMy8hBiU5C3pYgrbnHH E9n9sZ8UEODGanxSD6ROvAmVEOXDG99zyxN7+bbvio1LLaAhQy9iVX61Xodvo+JrXMxN rVO3YZrEXd/bbMtBoh4xoHwh02owZv9dZFdhxGKld7GPUY4s1flzqgo40mlNwjhbDAtr VM7L7zGXv96pqc2D2or2NwBvQUk0ubv0XFww+MekZrTjne1W7rY9ANeEFOMr33k/MrQH fv+NxrIxdq5F21D3YoQ4dHykHdSk8PJoNsHIzuoY+q/sYNIkUidQwqr0sMj6SeMA/x4e mJeQ== X-Gm-Message-State: ALoCoQnQO+ZsUxmI25MOFgu8SZVa539NPqOjUmQOu6FCOaRlE5aCGuG6Fr4cGcm3lQ8tBlB6zca3 X-Received: by 10.180.98.197 with SMTP id ek5mr49683592wib.35.1420645819979; Wed, 07 Jan 2015 07:50:19 -0800 (PST) Received: from muse.ger.corp.intel.com (93-172-181-114.bb.netvision.net.il. [93.172.181.114]) by mx.google.com with ESMTPSA id o1sm2567110wjf.41.2015.01.07.07.50.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Jan 2015 07:50:19 -0800 (PST) From: Eliad Peller To: Subject: [PATCH v2 2/3] mac80211: consider only relevant vifs for radar_required calculation Date: Wed, 7 Jan 2015 17:50:10 +0200 Message-Id: <1420645811-17877-2-git-send-email-eliad@wizery.com> X-Mailer: git-send-email 1.8.5.2.229.g4448466.dirty In-Reply-To: <1420645811-17877-1-git-send-email-eliad@wizery.com> References: <1420645811-17877-1-git-send-email-eliad@wizery.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ctx->conf.radar_enabled should reflect whether radar detection is enabled for the channel context. When calculating it, make it consider only the vifs that have this context assigned (instead of all the vifs). Signed-off-by: Eliad Peller --- v1->v2: * add a new function (instead of replacing existing one) * init ctx->conf.radar_enabled to false net/mac80211/chan.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index f5d08d5..28da444 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -406,6 +406,34 @@ bool ieee80211_is_radar_required(struct ieee80211_local *local) return false; } +static bool +ieee80211_chanctx_radar_required(struct ieee80211_local *local, + struct ieee80211_chanctx *ctx) +{ + struct ieee80211_chanctx_conf *conf = &ctx->conf; + struct ieee80211_sub_if_data *sdata; + bool required = false; + + lockdep_assert_held(&local->chanctx_mtx); + lockdep_assert_held(&local->mtx); + + rcu_read_lock(); + list_for_each_entry_rcu(sdata, &local->interfaces, list) { + if (!ieee80211_sdata_running(sdata)) + continue; + if (rcu_access_pointer(sdata->vif.chanctx_conf) != conf) + continue; + if (!sdata->radar_required) + continue; + + required = true; + break; + } + rcu_read_unlock(); + + return required; +} + static struct ieee80211_chanctx * ieee80211_alloc_chanctx(struct ieee80211_local *local, const struct cfg80211_chan_def *chandef, @@ -425,7 +453,7 @@ ieee80211_alloc_chanctx(struct ieee80211_local *local, ctx->conf.rx_chains_static = 1; ctx->conf.rx_chains_dynamic = 1; ctx->mode = mode; - ctx->conf.radar_enabled = ieee80211_is_radar_required(local); + ctx->conf.radar_enabled = false; ieee80211_recalc_chanctx_min_def(local, ctx); return ctx; @@ -570,7 +598,7 @@ static void ieee80211_recalc_radar_chanctx(struct ieee80211_local *local, /* for ieee80211_is_radar_required */ lockdep_assert_held(&local->mtx); - radar_enabled = ieee80211_is_radar_required(local); + radar_enabled = ieee80211_chanctx_radar_required(local, chanctx); if (radar_enabled == chanctx->conf.radar_enabled) return;