Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1683946ybz; Thu, 16 Apr 2020 13:38:15 -0700 (PDT) X-Google-Smtp-Source: APiQypLEPydlrjjpPHzJR6xqozhotL4K8jJPxjKS+t7D00OtaeFl68i1tsuUWFOSfqg6YbyOxQV3 X-Received: by 2002:aa7:cb4e:: with SMTP id w14mr54409edt.168.1587069495773; Thu, 16 Apr 2020 13:38:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587069495; cv=none; d=google.com; s=arc-20160816; b=u9Rl3UqHzPzq/1LJO23PL0Mp9gEfjdaUamF9phf/3vSk7Nn3aPUW7fOolWFFcpoL1W AZiDGMXA6Pw3R8+zJ/UQW5ArT7x7+l7RJXcpFSKTcfT5nC4KftlWmK087qWRWRt8SRkV KNLDY2KjFOgNJRk84eYvF/nziFt85KBuKNcS2fZtHjnIOQ+QtmFyxWajcDs79dH17MUb j9svRT9NSp5C3dYtVKVXv9FkFlZpgjrR+0YZJQaSRy+PsTf10Jhn79xGC+avgcJZBCGr kKYZSv5go2cuqTpPkqfqK8cgrqHpEZq67SXS/4ZDr+hyHamTAGeGq6eA1vAEey5pJT4Z c5Jw== 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=ZYsFd5ycA6poYIx1tw30wJFOfhQde/3J+hHI5x8+3INNFnTpXAlsQl5c9+25rMPbtc 5conhyGShCqnrKWC/sGm+RS+Jhvp3DlqihP2k5RUiQa6YCg0oj+3HpiX33dpEqWfPun1 axlGNe7+oFTZB5tZzA9fR7SFiyNBfDxdgrEg4VqzqZuoHrlQetdPE6kR74zVnJP5b05n m7pto0sih0LIUAV1wbk+3ppvpvWEGAp+50vV65bf354pIY2CeXlWfg48fioNCLwf2qXV LVowoxcXmalaxPGHOGvZWbRz/Sut7o02OSNmUiZM6DJXrW0ejrUj5VV8DpzHFrofnzTN u/aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qBu8xALI; 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 cw21si12402679ejb.158.2020.04.16.13.37.53; Thu, 16 Apr 2020 13:38:15 -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=qBu8xALI; 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 S2506470AbgDPPlJ (ORCPT + 99 others); Thu, 16 Apr 2020 11:41:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:49502 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2897428AbgDPNhP (ORCPT ); Thu, 16 Apr 2020 09:37:15 -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 38A7C221F9; Thu, 16 Apr 2020 13:37:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587044234; bh=WtyTCRlFyMzJAkJbuvSlHht8TZrezfj5ottSM/w2hRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qBu8xALIy2nsCst/Fx+ArA/v0up1T6TWVMX2rYKlfeLeI3Iz/LHDH2HtO8px5LKUD zuwzqmS0/+UP6h/iODMIHo1Q2yHIfn63bmNNls0LWYKRYiuQD+P2Jo6ryD5IXdi2tP YY0VpCf2u6Y+h2M0WB88p/lP9FpGsc4npI7E7QO4= 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.5 135/257] ath9k: Handle txpower changes even when TPC is disabled Date: Thu, 16 Apr 2020 15:23:06 +0200 Message-Id: <20200416131343.334987227@linuxfoundation.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200416131325.891903893@linuxfoundation.org> References: <20200416131325.891903893@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);