From patchwork Thu Sep 3 08:44:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 7115441 Return-Path: X-Original-To: patchwork-ath10k@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CEF899F1CD for ; Thu, 3 Sep 2015 08:44:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E76F52078C for ; Thu, 3 Sep 2015 08:44:58 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 201C520781 for ; Thu, 3 Sep 2015 08:44:58 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZXQ8c-0001XN-35; Thu, 03 Sep 2015 08:44:54 +0000 Received: from mail-lb0-x231.google.com ([2a00:1450:4010:c04::231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZXQ8Z-00016w-VY for ath10k@lists.infradead.org; Thu, 03 Sep 2015 08:44:52 +0000 Received: by lbbmp1 with SMTP id mp1so20255127lbb.1 for ; Thu, 03 Sep 2015 01:44:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=s/bgOzs+NrgJbuP6d8sc/K6Djy/YwYHjf2b3PU+L8Sw=; b=4emolhpOPB5KUioDhxetxmDOH7oh2dAx+DFcU6fWuxLagxrUz/Wy2uRsKE+lTPHTqn zpBatn4F4tRTlbONsfd9EYw8+m1G6BlheGJyYXghp+IuAu6OFVHG75Ou2c0gXGJprUq6 pvirz4zupkIjsnTMTdCCYSKPvWSGosHoOvo40= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=s/bgOzs+NrgJbuP6d8sc/K6Djy/YwYHjf2b3PU+L8Sw=; b=ODdddl1y3At5q0rMOhnDpEuW4yQUEyoPvkjONySILp53+3EuAH5reN+LXdvZF4ssKN m7NlPAzjv64PDfaap5oQ8rJZcb0+vo/FhfmOJzH/YB/FVrkvlpBHqGfnKmEUdWXxp8ge l+YqO4CcMzGWQWj7ImYuYM+zo/ijMdxeBtyPWzaOOjOvc8MmZj/scndbzbFPjzwDrPZi BCO/Jty14kK5pyxOVdneBGfyuS9+0KNNBlJxIj22sDN4DoLm4SZbvgrlmylh40QbDgPt 9qKrzhJ3MbgGvbgh8kXWwATF7cjpTnFIUGDYQEOBEELdBIM9rCru4tWg5iQAw5nZzntS s4nQ== X-Gm-Message-State: ALoCoQkISI38obbAyVj8O0C+VBraHDGR/q4N4ujTxlqFfdZ29YSKVfeUnnX3SbQhRCDHr3kyl2Fn+dWa7IxZOZdboBX1dua1FfHAqXnYTP5zhIO6cfx3eIosLu9qGXXiH85FR3y3YBTC+6BuVysPjfa1R7vGpAUJneWIg933l8V83XYRGqHjhOL5B6RmIvSmFVCBNW6YCcFX X-Received: by 10.112.16.73 with SMTP id e9mr20589783lbd.65.1441269869092; Thu, 03 Sep 2015 01:44:29 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.10]) by smtp.gmail.com with ESMTPSA id y8sm6213777lbf.35.2015.09.03.01.44.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Sep 2015 01:44:28 -0700 (PDT) From: Michal Kazior To: ath10k@lists.infradead.org Subject: [PATCH 2/2] ath10k: handle IEEE80211_CHANCTX_CHANGE_WIDTH properly Date: Thu, 3 Sep 2015 10:44:52 +0200 Message-Id: <1441269892-438-2-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1441269892-438-1-git-send-email-michal.kazior@tieto.com> References: <1441269892-438-1-git-send-email-michal.kazior@tieto.com> X-DomainID: tieto.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150903_014452_203195_E052F2A3 X-CRM114-Status: GOOD ( 12.02 ) X-Spam-Score: -2.7 (--) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org, Michal Kazior MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Vdevs associated with a given chanctx should be restarted if the bandwidth changes. Otherwise traffic may cease. This is known to fix STA CSA with bandwidths wider than 20MHz. Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/mac.c | 64 +++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 13e9d5659e96..34aff8683943 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -6352,12 +6352,52 @@ ath10k_mac_op_remove_chanctx(struct ieee80211_hw *hw, mutex_unlock(&ar->conf_mutex); } +struct ath10k_mac_change_chanctx_arg { + struct ieee80211_chanctx_conf *ctx; + struct ieee80211_vif_chanctx_switch *vifs; + int n_vifs; + int next_vif; +}; + +static void +ath10k_mac_change_chanctx_cnt_iter(void *data, u8 *mac, + struct ieee80211_vif *vif) +{ + struct ath10k_mac_change_chanctx_arg *arg = data; + + if (rcu_access_pointer(vif->chanctx_conf) != arg->ctx) + return; + + arg->n_vifs++; +} + +static void +ath10k_mac_change_chanctx_fill_iter(void *data, u8 *mac, + struct ieee80211_vif *vif) +{ + struct ath10k_mac_change_chanctx_arg *arg = data; + struct ieee80211_chanctx_conf *ctx; + + ctx = rcu_access_pointer(vif->chanctx_conf); + if (ctx != arg->ctx) + return; + + if (WARN_ON(arg->next_vif == arg->n_vifs)) + return; + + arg->vifs[arg->next_vif].vif = vif; + arg->vifs[arg->next_vif].old_ctx = ctx; + arg->vifs[arg->next_vif].new_ctx = ctx; + arg->next_vif++; +} + static void ath10k_mac_op_change_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *ctx, u32 changed) { struct ath10k *ar = hw->priv; + struct ath10k_mac_change_chanctx_arg arg = { .ctx = ctx }; mutex_lock(&ar->conf_mutex); @@ -6371,6 +6411,30 @@ ath10k_mac_op_change_chanctx(struct ieee80211_hw *hw, if (WARN_ON(changed & IEEE80211_CHANCTX_CHANGE_CHANNEL)) goto unlock; + if (changed & IEEE80211_CHANCTX_CHANGE_WIDTH) { + ieee80211_iterate_active_interfaces_atomic( + hw, + IEEE80211_IFACE_ITER_NORMAL, + ath10k_mac_change_chanctx_cnt_iter, + &arg); + if (arg.n_vifs == 0) + goto radar; + + arg.vifs = kcalloc(arg.n_vifs, sizeof(arg.vifs[0]), + GFP_KERNEL); + if (!arg.vifs) + goto radar; + + ieee80211_iterate_active_interfaces_atomic( + hw, + IEEE80211_IFACE_ITER_NORMAL, + ath10k_mac_change_chanctx_fill_iter, + &arg); + ath10k_mac_update_vif_chan(ar, arg.vifs, arg.n_vifs); + kfree(arg.vifs); + } + +radar: ath10k_recalc_radar_detection(ar); /* FIXME: How to configure Rx chains properly? */