Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6021718ybc; Wed, 27 Nov 2019 13:33:09 -0800 (PST) X-Google-Smtp-Source: APXvYqxjUnvVx06NtQ22ZHk4hP001Onuxwxob6mYw59MsihmbyWmYv7uCWOlL1kwrxDNfGusc4sZ X-Received: by 2002:a17:906:a2d0:: with SMTP id by16mr3029277ejb.322.1574890389833; Wed, 27 Nov 2019 13:33:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574890389; cv=none; d=google.com; s=arc-20160816; b=uU2+rUmVEwifR30Rs5yQ48ijPeit1eusVmE23Vvj2+E3xmc0G/sgG/6cK93fLc8dxL JvlF/iwDkXN5Fy5W4ngd9yqnW7TqBpvWf0FSfqF5jaw21RpKE3SJLzXCoG6hrFFdW6/x vKOkDpJ+y67Ye1UiNqjaC8VxuU4ipR5bpwCrSXAvnUlFngG/eMp4E0Qe/AjtLVkXI8am mcpma1gvCfpeyXyY3ZyuuM5uSF2Ho7Iv7G4qklvapM07sj9pWSkhMu2AsgrZtCNClL5A /1Z0X39q9lVv6IM1BbEmjwAmJkilkhR9TWhVBLA/44jpw9Lfe5nSXpKNXbnNUjr7AePm RCIA== 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=3bvm63SCz3wRRKHKzeBkTk3eR0q1U3dG1zOfpnZi3eA=; b=KrtVTEH5QZCbyIoyYJ4mYm43aaxtpkHa6zA3Mwsuy/q/DJrIjkUo4wv5DU2K6mMr2x rOGLPrZkFwwK/uLZ48Vmoyu9fXEFN3jb3/FbUhp0bSrQL9/YvMfhglIO6pXA+/s6sfx2 xZA0tPFiFDRk+zIroF1Q8/Rd8OIioISmU8kl2sqG66rWdtkwJpamVtvU5qm3H2J9/7QY Nxz8FvFqKeB0NageeP9V+pWGAuOHU7ImLr3j+mTh/w3tW6wPKw8X4XwqVKcG4KO81zmw AegIwlMvTiGYmRuuz9P7DCQGpmHjUt/53x1DulXviUMVqVHVuPremZw8V+QG3MOCGCn3 MRmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AvpnY17Y; 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 l19si10915209ejx.406.2019.11.27.13.32.46; Wed, 27 Nov 2019 13:33:09 -0800 (PST) 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=AvpnY17Y; 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 S1731082AbfK0U4h (ORCPT + 99 others); Wed, 27 Nov 2019 15:56:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:47388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729304AbfK0U4e (ORCPT ); Wed, 27 Nov 2019 15:56:34 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 81CF62084D; Wed, 27 Nov 2019 20:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888193; bh=NziwyJrVvcAWTi/FXsiGKOVy/AjjmTnOxBBa5mByp5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AvpnY17YnBaVgXCLtg0fBLcgVL2JhIr5fl5dBctDn657U3IlnWZOmd5KdxBH2e+yh hGC4Q1oBYbWqfuFppr3xab7zkXmyAqG0WUp7Df5DtKDxCRgEb/zqVaK+wtttrgjdcW +dtWImgP++/hvOir4UnNsMGfK+GuYs074ltAP8HY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ali MJ Al-Nasrawy , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 039/306] brcmsmac: AP mode: update beacon when TIM changes Date: Wed, 27 Nov 2019 21:28:09 +0100 Message-Id: <20191127203117.707873697@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Ali MJ Al-Nasrawy [ Upstream commit 2258ee58baa554609a3cc3996276e4276f537b6d ] Beacons are not updated to reflect TIM changes. This is not compliant with power-saving client stations as the beacons do not have valid TIM and can cause the network to stall at random occasions and to have highly variable latencies. Fix it by updating beacon templates on mac80211 set_tim callback. Addresses an issue described in: https://marc.info/?i=20180911163534.21312d08%20()%20manjaro Signed-off-by: Ali MJ Al-Nasrawy Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- .../broadcom/brcm80211/brcmsmac/mac80211_if.c | 26 +++++++++++++++++++ .../broadcom/brcm80211/brcmsmac/main.h | 1 + 2 files changed, 27 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c index 6255fb6d97a70..81ff558046a8f 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c @@ -502,6 +502,7 @@ brcms_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) } spin_lock_bh(&wl->lock); + wl->wlc->vif = vif; wl->mute_tx = false; brcms_c_mute(wl->wlc, false); if (vif->type == NL80211_IFTYPE_STATION) @@ -519,6 +520,11 @@ brcms_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) static void brcms_ops_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { + struct brcms_info *wl = hw->priv; + + spin_lock_bh(&wl->lock); + wl->wlc->vif = NULL; + spin_unlock_bh(&wl->lock); } static int brcms_ops_config(struct ieee80211_hw *hw, u32 changed) @@ -937,6 +943,25 @@ static void brcms_ops_set_tsf(struct ieee80211_hw *hw, spin_unlock_bh(&wl->lock); } +static int brcms_ops_beacon_set_tim(struct ieee80211_hw *hw, + struct ieee80211_sta *sta, bool set) +{ + struct brcms_info *wl = hw->priv; + struct sk_buff *beacon = NULL; + u16 tim_offset = 0; + + spin_lock_bh(&wl->lock); + if (wl->wlc->vif) + beacon = ieee80211_beacon_get_tim(hw, wl->wlc->vif, + &tim_offset, NULL); + if (beacon) + brcms_c_set_new_beacon(wl->wlc, beacon, tim_offset, + wl->wlc->vif->bss_conf.dtim_period); + spin_unlock_bh(&wl->lock); + + return 0; +} + static const struct ieee80211_ops brcms_ops = { .tx = brcms_ops_tx, .start = brcms_ops_start, @@ -955,6 +980,7 @@ static const struct ieee80211_ops brcms_ops = { .flush = brcms_ops_flush, .get_tsf = brcms_ops_get_tsf, .set_tsf = brcms_ops_set_tsf, + .set_tim = brcms_ops_beacon_set_tim, }; void brcms_dpc(unsigned long data) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.h b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.h index c4d135cff04ad..9f76b880814e8 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.h @@ -563,6 +563,7 @@ struct brcms_c_info { struct wiphy *wiphy; struct scb pri_scb; + struct ieee80211_vif *vif; struct sk_buff *beacon; u16 beacon_tim_offset; -- 2.20.1