Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3927494imm; Mon, 8 Oct 2018 11:49:38 -0700 (PDT) X-Google-Smtp-Source: ACcGV60kDATXpmC0pGKOYgwuWq70KsnZXBSNuDHTxO1sr2b/UtFfuo71cyaGWWzWmE4M23hWMwtg X-Received: by 2002:a63:9343:: with SMTP id w3-v6mr8990399pgm.343.1539024578661; Mon, 08 Oct 2018 11:49:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539024578; cv=none; d=google.com; s=arc-20160816; b=jD3UEzHvSrq8BD/fyqZdSimgOhtxItloGn5gX0Wspywig1WxgfcEcfq43qiM0xJ2Ai CTqWA3mlDzunUf9uvGFWIyDNH4AyqumTSW4+CXMx+NyhMbDb5SMxYdzxB934b3ZZIJi9 melB3IAek3EUlOSsX/JaQxRNIqIu8/8OIom5IqzLpFJ5F6v8AbKEEtV15/1/0WirMx9i knoCDCK2Zyxv4JFmdkw7kIo5VG1cGaZp65dqbruhQMBwIu0RR74QZH6flbUfNK5M53CM A8aJdGp4CWA032u+Cb9BWJ/iNr5Kmll7IFRk8eSkrxNFMtqQWNbKHxSYVWqwK+AA6CVo ACgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UilrWkPzslScWu/MI5c/NU7gGP7l0Y/m6WpAswei6bQ=; b=MXP0wF9RbpOvdGrtoRzPuG1eOURdVWcErplqBNJPR+Q+4tTqhvamxdWsyQt2qV8xpA 7xSY0FhSkVV4+4/azX8NFk66YjQabQBSo9+P23fztavHVvFsSa9nOggPK3Nyy50gkU4K t/FyCiORdqNXY6xEhvXG+4ruNi1GvQznGFOOprabk2xlf9HL1wpiOck7bF5xusykaBqu TUbMx8hba7yTswm8bloqjWTLxpwruKy2bB8QjJUEjNG+3ytvXtKO3tupGez2k4apdO2i eHj/slBZAnI5cSYZrN1mrCY+1Pk+oJV34YIRx/DGJsZvLzeeJyuD1DbDk38bULl3ZDkD lrbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OfyM4Ven; 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 r68-v6si20012334pfk.151.2018.10.08.11.49.23; Mon, 08 Oct 2018 11:49:38 -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=OfyM4Ven; 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 S1731838AbeJICCY (ORCPT + 99 others); Mon, 8 Oct 2018 22:02:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:51636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726991AbeJICCY (ORCPT ); Mon, 8 Oct 2018 22:02:24 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (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 2BDA4204FD; Mon, 8 Oct 2018 18:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024556; bh=6Bh1h+Hb0X8jvg/qdHYj3t04AEpAYqDSDW2J1rgKNBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OfyM4Veno5jFxrcygZMN5AFGHeh4fwtEzN29B0fB0JdY3/QHRXOp5w7iF1VWS2dEr EyrlWX8b0UB5RsqECZ6ppW9Ry7+SHDoAWrIuFQ4RR4ayDGwOTlprN84bdzLZXh8HE0 uUYuJ9ckzfD18niJME30vTAz7vYo+CUD8fBu4OZo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ilan Peer , Luca Coelho , Johannes Berg , Sasha Levin Subject: [PATCH 4.18 061/168] mac80211: Fix station bandwidth setting after channel switch Date: Mon, 8 Oct 2018 20:30:41 +0200 Message-Id: <20181008175622.371013842@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175620.043587728@linuxfoundation.org> References: <20181008175620.043587728@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ilan Peer [ Upstream commit 0007e94355fdb71a1cf5dba0754155cba08f0666 ] When performing a channel switch flow for a managed interface, the flow did not update the bandwidth of the AP station and the rate scale algorithm. In case of a channel width downgrade, this would result with the rate scale algorithm using a bandwidth that does not match the interface channel configuration. Fix this by updating the AP station bandwidth and rate scaling algorithm before the actual channel change in case of a bandwidth downgrade, or after the actual channel change in case of a bandwidth upgrade. Signed-off-by: Ilan Peer Signed-off-by: Luca Coelho Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/mac80211/mlme.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -978,6 +978,10 @@ static void ieee80211_chswitch_work(stru */ if (sdata->reserved_chanctx) { + struct ieee80211_supported_band *sband = NULL; + struct sta_info *mgd_sta = NULL; + enum ieee80211_sta_rx_bandwidth bw = IEEE80211_STA_RX_BW_20; + /* * with multi-vif csa driver may call ieee80211_csa_finish() * many times while waiting for other interfaces to use their @@ -986,6 +990,48 @@ static void ieee80211_chswitch_work(stru if (sdata->reserved_ready) goto out; + if (sdata->vif.bss_conf.chandef.width != + sdata->csa_chandef.width) { + /* + * For managed interface, we need to also update the AP + * station bandwidth and align the rate scale algorithm + * on the bandwidth change. Here we only consider the + * bandwidth of the new channel definition (as channel + * switch flow does not have the full HT/VHT/HE + * information), assuming that if additional changes are + * required they would be done as part of the processing + * of the next beacon from the AP. + */ + switch (sdata->csa_chandef.width) { + case NL80211_CHAN_WIDTH_20_NOHT: + case NL80211_CHAN_WIDTH_20: + default: + bw = IEEE80211_STA_RX_BW_20; + break; + case NL80211_CHAN_WIDTH_40: + bw = IEEE80211_STA_RX_BW_40; + break; + case NL80211_CHAN_WIDTH_80: + bw = IEEE80211_STA_RX_BW_80; + break; + case NL80211_CHAN_WIDTH_80P80: + case NL80211_CHAN_WIDTH_160: + bw = IEEE80211_STA_RX_BW_160; + break; + } + + mgd_sta = sta_info_get(sdata, ifmgd->bssid); + sband = + local->hw.wiphy->bands[sdata->csa_chandef.chan->band]; + } + + if (sdata->vif.bss_conf.chandef.width > + sdata->csa_chandef.width) { + mgd_sta->sta.bandwidth = bw; + rate_control_rate_update(local, sband, mgd_sta, + IEEE80211_RC_BW_CHANGED); + } + ret = ieee80211_vif_use_reserved_context(sdata); if (ret) { sdata_info(sdata, @@ -996,6 +1042,13 @@ static void ieee80211_chswitch_work(stru goto out; } + if (sdata->vif.bss_conf.chandef.width < + sdata->csa_chandef.width) { + mgd_sta->sta.bandwidth = bw; + rate_control_rate_update(local, sband, mgd_sta, + IEEE80211_RC_BW_CHANGED); + } + goto out; }