From patchwork Wed Dec 7 21:45:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Hsu X-Patchwork-Id: 9465291 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 30DEA605A5 for ; Wed, 7 Dec 2016 21:49:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1868E28533 for ; Wed, 7 Dec 2016 21:49:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D10C28587; Wed, 7 Dec 2016 21:49:40 +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=unavailable 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 6863028593 for ; Wed, 7 Dec 2016 21:49:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932948AbcLGVtc (ORCPT ); Wed, 7 Dec 2016 16:49:32 -0500 Received: from wolverine01.qualcomm.com ([199.106.114.254]:46405 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933177AbcLGVt3 (ORCPT ); Wed, 7 Dec 2016 16:49:29 -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=1481147369; x=1512683369; h=from:to:cc:subject:date:message-id:mime-version; bh=4Us+qEeTPwnQeMGFEWyhW+hPOPyKKl8tbLkMYZtqHCc=; b=gn13V5ymCbsVhOUVCecLuUHvxmtVE6HpR2gqLg2PHWaWRBwsM0Hj/IC+ QdDs42XiZc/ML2cjBYYg0OhBDAHuQ82KzPo6uGc1RYzdO8Y/Cmutm5bfs xakr1SQUym2I1DRlO7zmvPx/6aom2Mwcrn8nn5sjfKTZBo8itJWFflci8 w=; X-IronPort-AV: E=Sophos;i="5.33,315,1477983600"; d="scan'208";a="246299329" Received: from unknown (HELO ironmsg02-R.qualcomm.com) ([10.53.140.106]) by wolverine01.qualcomm.com with ESMTP; 07 Dec 2016 13:46:25 -0800 X-IronPort-AV: E=McAfee;i="5700,7163,8372"; a="860648068" X-Amp-Result: CLEAN Received: from nasanexm01g.na.qualcomm.com ([10.85.0.33]) by ironmsg02-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 07 Dec 2016 13:46:25 -0800 Received: from ryanhsu-linux2.qualcomm.com (10.80.80.8) by NASANEXM01G.na.qualcomm.com (10.85.0.33) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Wed, 7 Dec 2016 13:46:24 -0800 From: To: , CC: Subject: [PATCH] ath10k: fix incorrect txpower set by P2P_DEVICE interface Date: Wed, 7 Dec 2016 13:45:33 -0800 Message-ID: <1481147133-3957-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 NASANEXM01G.na.qualcomm.com (10.85.0.33) 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 Ath10k reports the phy capability that upports P2P_DEVICE interface. When we use the P2P supported wpa_supplicant to start connection, it'll create the two interfaces, one is wlan0 (vdev_id=0) and one is P2P_DEVICE p2p-dev-wlan0 which is for p2p control channel (vdev_id=1). ath10k_pci mac vdev create 0 (add interface) type 2 subtype 0 ath10k_add_interface: vdev_id: 0, txpower: 0, bss_power: 0 ... ath10k_pci mac vdev create 1 (add interface) type 2 subtype 1 ath10k_add_interface: vdev_id: 1, txpower: 0, bss_power: 0 And the txpower in per vif bss_conf will only be set to valid tx power when the interface is assigned with channel_ctx. But this P2P_DEVICE interface will never be used for any connection, so that the uninitialized bss_conf.txpower=0 is assinged to the arvif->txpower when interface created. Since the txpower configuration is per phy interface. So the smallest txpower of all vifs will be the one limit the tx power of the phyical device, that causing the low txpower issue on other active interfaces. wlan0: Limiting TX power to 21 (24 - 3) dBm ath10k_pci mac vdev_id 0 txpower 21 ath10k_mac_txpower_recalc: vdev_id: 1, txpower: 0 ath10k_mac_txpower_recalc: vdev_id: 0, txpower: 21 ath10k_pci mac txpower 0 This issue only happens when we use the wpa_supplicant that supports P2P or if we use the iw tool to create the control P2P_DEVICE interface. Signed-off-by: Ryan Hsu --- drivers/net/wireless/ath/ath10k/mac.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index fe42bf5..6e1550b 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -4671,7 +4671,8 @@ static int ath10k_mac_txpower_recalc(struct ath10k *ar) lockdep_assert_held(&ar->conf_mutex); list_for_each_entry(arvif, &ar->arvifs, list) { - WARN_ON(arvif->txpower < 0); + if (arvif->txpower <= 0) + continue; if (txpower == -1) txpower = arvif->txpower; @@ -4679,8 +4680,8 @@ static int ath10k_mac_txpower_recalc(struct ath10k *ar) txpower = min(txpower, arvif->txpower); } - if (WARN_ON(txpower == -1)) - return -EINVAL; + if (txpower == -1) + return 0; ret = ath10k_mac_txpower_setup(ar, txpower); if (ret) {