Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2358103imm; Mon, 28 May 2018 06:40:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZprKitxd3Z8DA8JsNn8xORy/w6UrV1vKO/sHLOV0mjcrrV1fqi1PT4tdgl6cRW074daKfzM X-Received: by 2002:a63:66c3:: with SMTP id a186-v6mr10526635pgc.408.1527514822303; Mon, 28 May 2018 06:40:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527514822; cv=none; d=google.com; s=arc-20160816; b=biNhMEEstZT5mHnCctwiyoB8S39rVnyk4ttt6i7fsGvs9pagvztfGfha21H9zVITvE uckoXRKzq1pvXXQ2c1xlcNq6z3QBSgxX/JfbMVj4yKURbQHvx4lWlDpl2gDGl9sPj+qb gpVLqPxkOLg/wF5wEh5MwQqzsjhVXHRZ9s2q0v4atIyHUoeyXULBKOHU3eqg+lmWmxSY y/w6D7TOBRhYQAeteFb6uX7L2lThmYeD15IJk7bGiFv1/p24+w6X1ro0EKetNgShBNBs xVjOedDfnx7V8pmcQtMnniV1bTLm7m5zNKh/3X9Wh2Sn4UwjhdZS+gbFTWUTUr+ttS5X emoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=ODb41cGyTyXOkLOEt6EpSl05JX1U8+5Y2qw3OBWOp1U=; b=iboAm+tmlAOUqh0bRJZ6XwLb2nvCR0mvy5ZiMWv9SPZ5E+CxULjeOfypfTt6GrC+lr JdNMujuLOcK0sEGs3fJNufoQbhCMpF+wr1hzOg/MKdRYj6+8cVOi/UKlkyQmp5VlQ5xw huZPohibPvb+5G3sk+e1eQgoqno5K+65DSZySLHymp+VOGY0cr8kV0Uy9PDdlzdi/6K6 C7Foau/UhPUdS8AMsZOsK9xpR1r7JuCF9hCUaugOFjMZ3LQczMlLVuiM5mJA1X/KRbHP qh3I7pfRrPCIAwiXAFvtTYc639d8TwkXCSv1fxv7CLhubK9u+Yh2p+81Hk4rIAbNSLXd lk/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cAfGi52p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q75-v6si30491126pfk.268.2018.05.28.06.40.07; Mon, 28 May 2018 06:40:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cAfGi52p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163080AbeE1Kox (ORCPT + 99 others); Mon, 28 May 2018 06:44:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:35486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163048AbeE1Kot (ORCPT ); Mon, 28 May 2018 06:44:49 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0B9CE204EE; Mon, 28 May 2018 10:44:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504288; bh=1Mn72wIBPZtRrUaUW59MLV0rFXx5wfNScplTz7mddD0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cAfGi52phZ4mObPDwoInJZYvoSYL6l3niEWunEpS40jUGkQGhK7WH7ENZjTKO/G/k /j6PqDpDdvIyPbTZuqzPOaTJRIcKZmQ3lx6E4dLi1bhhI9YCU1Ert6oBmaLu13RtzK 1zXes/2Y+Yr0TKt9VVh36uiPl1Ie1iXWgC6yLiL0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naftali Goldstein , Luca Coelho , Sasha Levin Subject: [PATCH 4.14 084/496] iwlwifi: mvm: always init rs with 20mhz bandwidth rates Date: Mon, 28 May 2018 11:57:49 +0200 Message-Id: <20180528100323.335987345@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Naftali Goldstein [ Upstream commit 6b7a5aea71b342ec0593d23b08383e1f33da4c9a ] In AP mode, when a new station associates, rs is initialized immediately upon association completion, before the phy context is updated with the association parameters, so the sta bandwidth might be wider than the phy context allows. To avoid this issue, always initialize rs with 20mhz bandwidth rate, and after authorization, when the phy context is already up-to-date, re-init rs with the correct bw. Signed-off-by: Naftali Goldstein Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 4 +++ drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 28 +++++++++++++++------- 2 files changed, 24 insertions(+), 8 deletions(-) --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -2703,6 +2703,10 @@ static int iwl_mvm_mac_sta_state(struct /* enable beacon filtering */ WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0)); + + iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band, + false); + ret = 0; } else if (old_state == IEEE80211_STA_AUTHORIZED && new_state == IEEE80211_STA_ASSOC) { --- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c @@ -2690,7 +2690,8 @@ static void rs_get_initial_rate(struct i struct ieee80211_sta *sta, struct iwl_lq_sta *lq_sta, enum nl80211_band band, - struct rs_rate *rate) + struct rs_rate *rate, + bool init) { int i, nentries; unsigned long active_rate; @@ -2744,14 +2745,25 @@ static void rs_get_initial_rate(struct i */ if (sta->vht_cap.vht_supported && best_rssi > IWL_RS_LOW_RSSI_THRESHOLD) { - switch (sta->bandwidth) { - case IEEE80211_STA_RX_BW_160: - case IEEE80211_STA_RX_BW_80: - case IEEE80211_STA_RX_BW_40: + /* + * In AP mode, when a new station associates, rs is initialized + * immediately upon association completion, before the phy + * context is updated with the association parameters, so the + * sta bandwidth might be wider than the phy context allows. + * To avoid this issue, always initialize rs with 20mhz + * bandwidth rate, and after authorization, when the phy context + * is already up-to-date, re-init rs with the correct bw. + */ + u32 bw = init ? RATE_MCS_CHAN_WIDTH_20 : rs_bw_from_sta_bw(sta); + + switch (bw) { + case RATE_MCS_CHAN_WIDTH_40: + case RATE_MCS_CHAN_WIDTH_80: + case RATE_MCS_CHAN_WIDTH_160: initial_rates = rs_optimal_rates_vht; nentries = ARRAY_SIZE(rs_optimal_rates_vht); break; - case IEEE80211_STA_RX_BW_20: + case RATE_MCS_CHAN_WIDTH_20: initial_rates = rs_optimal_rates_vht_20mhz; nentries = ARRAY_SIZE(rs_optimal_rates_vht_20mhz); break; @@ -2762,7 +2774,7 @@ static void rs_get_initial_rate(struct i active_rate = lq_sta->active_siso_rate; rate->type = LQ_VHT_SISO; - rate->bw = rs_bw_from_sta_bw(sta); + rate->bw = bw; } else if (sta->ht_cap.ht_supported && best_rssi > IWL_RS_LOW_RSSI_THRESHOLD) { initial_rates = rs_optimal_rates_ht; @@ -2844,7 +2856,7 @@ static void rs_initialize_lq(struct iwl_ tbl = &(lq_sta->lq_info[active_tbl]); rate = &tbl->rate; - rs_get_initial_rate(mvm, sta, lq_sta, band, rate); + rs_get_initial_rate(mvm, sta, lq_sta, band, rate, init); rs_init_optimal_rate(mvm, sta, lq_sta); WARN_ONCE(rate->ant != ANT_A && rate->ant != ANT_B,