Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1392723ybz; Thu, 16 Apr 2020 08:23:01 -0700 (PDT) X-Google-Smtp-Source: APiQypJK5n/86bUXT+ut0XGy513fnI1g4tdbtPniiU/GpWYGuuFbr0YQ+cn+TbKDphZT1dUiG/XP X-Received: by 2002:a50:9b53:: with SMTP id a19mr2630319edj.104.1587050581219; Thu, 16 Apr 2020 08:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587050581; cv=none; d=google.com; s=arc-20160816; b=e3nSgya0TPfV+4/He7BGS0P+5YIPmSEbNCiWDRtll0TbyZYHa/S2sJmwwfsg0bgbPX 1dbNOYpGC9RACKw/X/89rNEoKpdbXnh/Mm4GKfgx3jr2Po5jHViLa52cWNKGqFKXzW5V 9HoLKwdlxYLg6HD6td392w+83ppOKRUDQ4Vkfz+BZbl0r+w9luAz2qToYW83KuxNc82d NRzXbU46nuGh5z3c1E5p4BX6UBKwq1aXrcwLfzwoz1U/xwZsVImSSLYWt7p+vAbn2hmo +p1al/ePgEZuRAOkFc4nCP4VsKTxmMehAEbkjmTSoOe/weTvauHZ2Rrw5pQn8FlhDp/u lE6w== 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=b1JKpeGThrz+uMqW/tbO2bPjNdQThLbOa3LOaE/wSSU=; b=xWkwvFvGe3sLu/4HsJZY/xJQ/4zPJ8yrlc+78lp+h4lOsEoh4sjgdH+5R1xbJJV8d9 /kG+GiHAIfVVEqV+4bgKA2JCWzaSGZrQDganS0loU+58erHG1bMEl6fDZy55f1BpncYM do9VjJlz5XzpDrpeo+h2aSd7G0ajpo0DEiESjbSufhSgmjgM9kUcKnYbVrKsRTPm2fP0 tb3Nrtvm5038syCG8E6qTCzFBPLq9oWcpFP1TUMx4uWwtZMROe0eUKH3HB9u9FbIUgkg HmJArm7KaWxf22uetk5rtjQA69U4ogtQNGVACY1UtmIGETDMhnKqHimH6ybGkK89I/Em p34Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GD91+rmD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t20si8953859edy.484.2020.04.16.08.22.36; Thu, 16 Apr 2020 08:23:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GD91+rmD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2505133AbgDPPUj (ORCPT + 99 others); Thu, 16 Apr 2020 11:20:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:33228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2898648AbgDPNrL (ORCPT ); Thu, 16 Apr 2020 09:47:11 -0400 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 79C962223D; Thu, 16 Apr 2020 13:47:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587044831; bh=WtyTCRlFyMzJAkJbuvSlHht8TZrezfj5ottSM/w2hRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GD91+rmDcyWrFkzsphnMmQB5kmG3l2lvDgioQeY4g1ucZnUJau0vyWp47sEt52Av9 kZPjA6QSra2WM2FFGu87arMJv6KJMdHdKEBCbV/akcC6QNdzW4RGLqlGziSTK0uBB9 yP+JV3rpqoIL/zc7e1NX69a/Z8P4sjMfE1komwVo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Remi Pommarel , Kalle Valo Subject: [PATCH 5.4 118/232] ath9k: Handle txpower changes even when TPC is disabled Date: Thu, 16 Apr 2020 15:23:32 +0200 Message-Id: <20200416131329.875693597@linuxfoundation.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200416131316.640996080@linuxfoundation.org> References: <20200416131316.640996080@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: Remi Pommarel commit 968ae2caad0782db5dbbabb560d3cdefd2945d38 upstream. 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 Signed-off-by: Kalle Valo Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/ath/ath9k/main.c | 3 +++ 1 file changed, 3 insertions(+) --- 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 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);