From patchwork Mon Nov 24 14:34:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Grumbach X-Patchwork-Id: 5367041 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 52FCDC11AC for ; Mon, 24 Nov 2014 14:36:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 77AA62041E for ; Mon, 24 Nov 2014 14:36:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C3A42041D for ; Mon, 24 Nov 2014 14:36:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932286AbaKXOgY (ORCPT ); Mon, 24 Nov 2014 09:36:24 -0500 Received: from mail-wi0-f174.google.com ([209.85.212.174]:60506 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753855AbaKXOgU (ORCPT ); Mon, 24 Nov 2014 09:36:20 -0500 Received: by mail-wi0-f174.google.com with SMTP id h11so5881079wiw.7 for ; Mon, 24 Nov 2014 06:36:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JDEM6oxZR7xussUOTMdR1V0aCqt2W249Jh1yasxdSgA=; b=zMuMLl9PS+zMoYRM4Qet2dMN5EtFvySrcf6+GR+ljipDzoY7mWpV0INFM3HCbZW8x5 MOjozjpqDcFtsgIUxYFO56Dg5aFSkrBavH5Od0Ja71R9U38dADnc71OLbkSVHzEkCc/o JWAinE3B5zhYTCJE2Hoa3h4Usongmoi0Q+VSFg8FDJaxgSZ8ZwyFDsfvUr1yOPWhWm1J YYKIOqk/0SFAdKV5AH1IO3Xydu43gxUts98kUkJYLjhgqtf5N1uLI2lhNACuV9GDz/8r V81s0GrggF3L8kMfrOHMUKqkMxhwCislgqj9vo9o/pHhMgw7iL3txMrXani+MYHi91ug rxYA== X-Received: by 10.194.203.105 with SMTP id kp9mr34746514wjc.81.1416839779597; Mon, 24 Nov 2014 06:36:19 -0800 (PST) Received: from localhost.localdomain (46-116-150-134.bb.netvision.net.il. [46.116.150.134]) by mx.google.com with ESMTPSA id n3sm21274744wjz.21.2014.11.24.06.36.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Nov 2014 06:36:18 -0800 (PST) From: Emmanuel Grumbach To: linux-wireless@vger.kernel.org Cc: Luciano Coelho Subject: [PATCH 50/75] iwlwifi: mvm: only save csa_vif in AP/GO mode Date: Mon, 24 Nov 2014 16:34:26 +0200 Message-Id: <1416839691-28533-50-git-send-email-egrumbach@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: 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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, 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 From: Luciano Coelho We only need the csa_vif in AP/GO modes, and assigning for other interfaces may cause problems, because csa_vif is never cleared. To prevent this, only assign the value if the iftype is NL80211_IFTYPE_AP. Use a switch to do this, even though, for now, only the AP interface type is handled, because soon other interface types will be added as well. Additionally, convert the WARN() in the error case when a channel-switch is already running to WARN_ONCE(). Signed-off-by: Luciano Coelho --- drivers/net/wireless/iwlwifi/mvm/mac80211.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 1f53f81..98bb846 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c @@ -3110,17 +3110,25 @@ static int iwl_mvm_pre_channel_switch(struct ieee80211_hw *hw, mutex_lock(&mvm->mutex); - csa_vif = rcu_dereference_protected(mvm->csa_vif, - lockdep_is_held(&mvm->mutex)); - if (WARN(csa_vif && csa_vif->csa_active, - "Another CSA is already in progress")) { - ret = -EBUSY; - goto out_unlock; - } - - IWL_DEBUG_MAC80211(mvm, "CSA started to freq %d\n", + IWL_DEBUG_MAC80211(mvm, "pre CSA to freq %d\n", chsw->chandef.center_freq1); - rcu_assign_pointer(mvm->csa_vif, vif); + + switch (vif->type) { + case NL80211_IFTYPE_AP: + csa_vif = + rcu_dereference_protected(mvm->csa_vif, + lockdep_is_held(&mvm->mutex)); + if (WARN_ONCE(csa_vif && csa_vif->csa_active, + "Another CSA is already in progress")) { + ret = -EBUSY; + goto out_unlock; + } + + rcu_assign_pointer(mvm->csa_vif, vif); + break; + default: + break; + } ret = 0;