From patchwork Thu Dec 22 22:31:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Hsu X-Patchwork-Id: 9486923 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BCAE4601D4 for ; Thu, 22 Dec 2016 22:32:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B05FF282E2 for ; Thu, 22 Dec 2016 22:32:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A1A98283FB; Thu, 22 Dec 2016 22:32:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9497F282E2 for ; Thu, 22 Dec 2016 22:32:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965962AbcLVWcd (ORCPT ); Thu, 22 Dec 2016 17:32:33 -0500 Received: from wolverine01.qualcomm.com ([199.106.114.254]:52536 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755329AbcLVWcd (ORCPT ); Thu, 22 Dec 2016 17:32:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1482445952; x=1513981952; h=from:to:cc:subject:date:message-id:mime-version; bh=DCiwJBjajxeeMQ/UpJixVh2MImV3J8u+/1a8uVZ8xS8=; b=t6tvzaO/j7UkjNPwp+iBNWUltrWmDBRjxw0nUNSGvf85MJqwaPWO3/DC KsAzKQ3VojMl/3EFvNb1GOWGLu7ubotn86R9bT0Zg8iVtT6lCyDjNeT4P qU1SNJs/CqZjbY9FMK2/Le3TroAFWAFFY/v43sL2+SHufJd8BqoJbf72d k=; X-IronPort-AV: E=Sophos;i="5.33,390,1477983600"; d="scan'208";a="250603440" Received: from ironmsg06-lv.qualcomm.com ([10.47.202.185]) by wolverine01.qualcomm.com with ESMTP; 22 Dec 2016 14:32:31 -0800 X-IronPort-AV: E=McAfee;i="5700,7163,8387"; a="19350829" X-Amp-Result: CLEAN Received: from nalasexr01g.na.qualcomm.com ([10.49.56.53]) by Ironmsg06-lv.qualcomm.com with ESMTP/TLS/RC4-SHA; 22 Dec 2016 14:32:30 -0800 Received: from ryanhsu-linux2.qualcomm.com (10.80.80.8) by NALASEXR01G.na.qualcomm.com (10.49.56.53) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Thu, 22 Dec 2016 14:32:30 -0800 From: To: , CC: Subject: [PATCH] ath10k: recal the txpower when removing interface Date: Thu, 22 Dec 2016 14:31:46 -0800 Message-ID: <1482445906-20421-1-git-send-email-ryanhsu@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01F.na.qualcomm.com (10.85.0.32) To NALASEXR01G.na.qualcomm.com (10.49.56.53) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ryan Hsu The txpower is being recalculated when adding interface to make sure txpower won't overshoot the spec, and when removing the interface, the txpower should again to be recalculated to restore the correct value from the active interface list. Following is one of the scenario vdev0 is created as STA and connected: txpower:23 vdev1 is created as P2P_DEVICE for control interface: txpower:0 vdev2 is created as p2p go/gc interface: txpower is 21 So the vdev2@txpower:21 will be set to firmware when vdev2 is created. When we tear down the vdev2, the txpower needs to be recalculated to re-set it to vdev0@txpower:23 as vdev0/vdev1 are the active interface. ath10k_pci mac vdev 0 peer create 8c:fd:f0:01:62:98 ath10k_pci mac vdev_id 0 txpower 23 ... (adding interface) ath10k_pci mac vdev create 2 (add interface) type 1 subtype 3 ath10k_pci mac vdev_id 2 txpower 21 ath10k_pci mac txpower 21 ... (removing interface) ath10k_pci mac vdev 2 delete (remove interface) ath10k_pci vdev 1 txpower 0 ath10k_pci vdev 0 txpower 23 ath10k_pci mac txpower 23 Signed-off-by: Ryan Hsu --- drivers/net/wireless/ath/ath10k/mac.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index aa545a1..6475dc8 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -5194,6 +5194,10 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw, ath10k_warn(ar, "failed to recalc monitor: %d\n", ret); } + ret = ath10k_mac_txpower_recalc(ar); + if (ret) + ath10k_warn(ar, "failed to recalc tx power: %d\n", ret); + spin_lock_bh(&ar->htt.tx_lock); ath10k_mac_vif_tx_unlock_all(arvif); spin_unlock_bh(&ar->htt.tx_lock);