Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp485523ybf; Sat, 29 Feb 2020 08:08:02 -0800 (PST) X-Google-Smtp-Source: APXvYqwuZxUb7E0IzaJTuXU/ILDRfm55cBdXEaKp1hmSx0knVKgBhhIdCWQFrtZerYVDfokIM+o9 X-Received: by 2002:a9d:3b6:: with SMTP id f51mr7736155otf.255.1582992482648; Sat, 29 Feb 2020 08:08:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582992482; cv=none; d=google.com; s=arc-20160816; b=mI5sncYBkloSslfTx7su2hyCfsxuzkhZy0GBptidu+CfkbjjxUoOSNAml3C5RlfAEn wwCnHmEExE25MI52gpLdiHOBSNV2PcKcYRf/chxadoOcTsa5cc/F2W6zVm193eU06f9r toibZy+FjfAsbuUO8LzkGkMfsRLM9emRz+s0q4RQMguGHfT+EV4bP7OsltvGuX4fcURx 86CzX/MnvOrT91D/HXGnd9sZRW1QcAa+hA6Vf6JlFQsksLgxDGyYHhxAHAUQWxxLihrT FFSY5zOGAcAbTI77/Mgte9hFI5dLhvYxnfqsXCLBNjTBkFNUyE8yU/cyMTqCcDU6anwY fdyQ== 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 :message-id:date:subject:cc:to:from; bh=0IePfGGBvK/viwTgew+Z27Y8EJ2INLphBFJCYJp5bRM=; b=v0GNTiQ7H12Ad+jcyOBefkJUiKtWECAerO2PR+34j+s1D1gj2hnahwFtMi7NhPJmu7 AW7ExCeIkk2SjF5hmxamZ61ykPRkleonyj6C5SwhGBk61tEYycIVUk+Emw3UdZ0ryE4I EQ5IzrDNb7xuhWU/6rPqgYZH1pc44xSfQv81d4MPGIV+upAJQ7R2jm70w4RMIaNt4+2l RQZZiPG126El28I9UHsMm384yS91f2xfOTjiIKORgjrt3KbwE+NZlJ6Je0XMyBKyLlHA gh3cDSCIm703iTPT37jWl4W3hOfzRwBwcIKt9qGFCbzw2uYjye1XywkQJ2j6VZR6X20J 8Y0g== ARC-Authentication-Results: i=1; mx.google.com; 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 e25si3820602otk.62.2020.02.29.08.07.50; Sat, 29 Feb 2020 08:08:02 -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; 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 S1727263AbgB2QFA (ORCPT + 99 others); Sat, 29 Feb 2020 11:05:00 -0500 Received: from relay10.mail.gandi.net ([217.70.178.230]:44099 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727164AbgB2QE7 (ORCPT ); Sat, 29 Feb 2020 11:04:59 -0500 Received: from localhost (lfbn-ren-1-591-115.w81-53.abo.wanadoo.fr [81.53.169.115]) (Authenticated sender: repk@triplefau.lt) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 7B566240003; Sat, 29 Feb 2020 16:04:56 +0000 (UTC) From: Remi Pommarel To: Lorenzo Bianconi , Kalle Valo Cc: QCA ath9k Development , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Remi Pommarel , stable@vger.kernel.org Subject: [PATCH] ath9k: Handle txpower changes even when TPC is disabled Date: Sat, 29 Feb 2020 17:13:47 +0100 Message-Id: <20200229161347.31341-1-repk@triplefau.lt> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When TPC is disabled IEEE80211_CONF_CHANGE_POWER event can be handled to reconfigure HW's maximum txpower. This fixes 0dBm txpower setting when user attaches to an interface for the first time with the following scenario: ieee80211_do_open() ath9k_add_interface() ath9k_set_txpower() /* Set TX power with not yet initialized sc->hw->conf.power_level */ ieee80211_hw_config() /* Iniatilize sc->hw->conf.power_level and raise IEEE80211_CONF_CHANGE_POWER */ ath9k_config() /* IEEE80211_CONF_CHANGE_POWER is ignored */ This issue can be reproduced with the following: $ modprobe -r ath9k $ modprobe ath9k $ wpa_supplicant -i wlan0 -c /tmp/wpa.conf & $ iw dev /* Here TX power is either 0 or 3 depending on RF chain */ $ killall wpa_supplicant $ iw dev /* TX power goes back to calibrated value and subsequent calls will be fine */ Fixes: 283dd11994cde ("ath9k: add per-vif TX power capability") Cc: stable@vger.kernel.org Signed-off-by: Remi Pommarel --- drivers/net/wireless/ath/ath9k/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 0548aa3702e3..ef2b856670e1 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c @@ -1457,6 +1457,9 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) ath_chanctx_set_channel(sc, ctx, &hw->conf.chandef); } + if (changed & IEEE80211_CONF_CHANGE_POWER) + ath9k_set_txpower(sc, NULL); + mutex_unlock(&sc->mutex); ath9k_ps_restore(sc); -- 2.25.0