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: 7115411 X-Patchwork-Delegate: kvalo@adurom.com 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 CB75FBEEC1 for ; Thu, 3 Sep 2015 08:44:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DB28120780 for ; Thu, 3 Sep 2015 08:44:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E20662077B for ; Thu, 3 Sep 2015 08:44:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752497AbbICIoc (ORCPT ); Thu, 3 Sep 2015 04:44:32 -0400 Received: from mail-lb0-f181.google.com ([209.85.217.181]:36165 "EHLO mail-lb0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751904AbbICIoa (ORCPT ); Thu, 3 Sep 2015 04:44:30 -0400 Received: by lbcao8 with SMTP id ao8so20159001lbc.3 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=YyRGUNKYPK0hkOIcQjGjQmIlQGlHE+w1jm9EJs4L0zUu4kXBu4VZw5StfQbNWTaOr4 R/hAdG5Ahrsl8rV5VLoU/Hp+8rwbTZICzLM31KN53FwZImqYxkl87oFnSTSLkuL6y9Lf ZvpvsmJhH4JYijVO9geRTpvuOS3TzE03+z5TtgISEYs9Uwco/nF2M4sbuIEs0g+s2zHx Xcmp0lwRdh54484IOkv/Y/DlgX84AlNGENKLQ+i0WNrs8HZJfrwrCvo/93rntO21buu9 a+ii04q1UsIYU/4wFU2/pDY2eyMSozlyHfJseD5Myf8/e8WPwrT2ND5mvl3lZRzP8FxK 1BcA== X-Gm-Message-State: ALoCoQkHQ19KC59wMkonjPhcp8A9NHkIZT9ByL6exUuMI3eWiIV2PNPtF9jpxUCGFtrz83fyQrrKf01eLNV0mcO+wP3FcBy75rEFtmP3tVlgSrsTuGQXGwvAdGA6XUIJESKvaRUqy2pK 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 Cc: linux-wireless@vger.kernel.org, Michal Kazior 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 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_SIGNED, 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 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? */