Received: by 10.223.176.5 with SMTP id f5csp801341wra; Sat, 3 Feb 2018 10:35:37 -0800 (PST) X-Google-Smtp-Source: AH8x226O+SwxM8tDIR2W4gpq08PiGPxXmupYzYZ4/TdHuUiNd/KdUYBdfoaoAwGc5377pAQjh4GH X-Received: by 2002:a17:902:74c9:: with SMTP id f9-v6mr8293428plt.89.1517682937566; Sat, 03 Feb 2018 10:35:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517682937; cv=none; d=google.com; s=arc-20160816; b=Rec+j1Pg+DBEI83/opOWng3rFynr25ZtO5Q+XI9ch200HES81sq1K5IYPLcR3z16n+ kkpBXdg+9xhvBc1ysj/kOsH78BRfuHX/JpGbjRj9LGeGZ4jGJ7VRzH9Oh8dSnpyIPW7w 4MZY0M8peuIr1brTULHYBhp7IOTP52KO9O+3fEKYmc2uOsFMU6+vnhSk56MlGLEk+AI8 B1MlVl01fmT1diY+39p/Kg1koM7zJ708as+3B2NxJWw5zN3TqReVZR6AAgID7cWzFop2 JjvCzGSdUOOEXVNRyJtRugVOprV1qRuHmGKLWt7zHab9p0U+wn/Aq44E6qlPgitcSWbE wdEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=PreZyqpZiEzIF05CwckKGlikLTOqhmVHmJN1qFOcrks=; b=kbeIAwMbfbd4MDrS4wqtoJcGwcq5tlL75SXRJDOfFt0WrFaAQ249blGxpWrrPlQDRm 8ImhI1uYqe+MNSAXJX90j4bkGlr/kv4wfZ6/N7v/o9AVNVoJ4XKvHTZRMNxJmn7SzTQ/ nai3WW/lAQuyZYS1Wdj7B//bHlXZQ4huOXvFKhhpL1ennYsz5IOdb8cesySVoDShRKXG Hehj7lnv4jM6RjoFqatqZPoLEuzqQswEgWGv3M+I3r6Vg73koZwNAe/flJzESTbw8/OT m6Wq58PfaVMv9025tO5URiv9boNx8x3cW/IrTIXyK1cgpbjNl8Axx5KbCaSMoqmApUig koJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Inzqh1Cd; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l91-v6si2061193plb.266.2018.02.03.10.35.22; Sat, 03 Feb 2018 10:35:37 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Inzqh1Cd; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754427AbeBCSeX (ORCPT + 99 others); Sat, 3 Feb 2018 13:34:23 -0500 Received: from mail-bl2nam02on0109.outbound.protection.outlook.com ([104.47.38.109]:45293 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752839AbeBCSEX (ORCPT ); Sat, 3 Feb 2018 13:04:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=PreZyqpZiEzIF05CwckKGlikLTOqhmVHmJN1qFOcrks=; b=Inzqh1CdvkDjBxbNSNN3LDb9GY+2e3qr4vurC0CWXIN8NoVfC59tf34a4qbbutQCgj0CBKqBJSCuQ9cOUaCd25HNm7xMtQgli45pYrg/WAWHS9GKv9x/pbkMgoqPtmFRquoHtHDeyLwczfQQVLdC12M6XUCvmyitCrXdi1fRndM= Received: from BL0PR2101MB1027.namprd21.prod.outlook.com (52.132.20.161) by BL0PR2101MB1041.namprd21.prod.outlook.com (52.132.23.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.506.3; Sat, 3 Feb 2018 18:02:16 +0000 Received: from BL0PR2101MB1027.namprd21.prod.outlook.com ([fe80::a8da:b5d9:d710:9bf9]) by BL0PR2101MB1027.namprd21.prod.outlook.com ([fe80::a8da:b5d9:d710:9bf9%3]) with mapi id 15.20.0485.006; Sat, 3 Feb 2018 18:02:16 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Loic Poulain , Kalle Valo , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 090/110] wcn36xx: Fix dynamic power saving Thread-Topic: [PATCH AUTOSEL for 4.14 090/110] wcn36xx: Fix dynamic power saving Thread-Index: AQHTnRkCMuk4TolW7kKOkryyGwevHg== Date: Sat, 3 Feb 2018 18:01:26 +0000 Message-ID: <20180203180015.29073-90-alexander.levin@microsoft.com> References: <20180203180015.29073-1-alexander.levin@microsoft.com> In-Reply-To: <20180203180015.29073-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BL0PR2101MB1041;6:e+w10NlXxhzRr1izK9lGvTCnQoxEVBkagEsFZi4o2lHYWbJopl5eeX/J/J5U+nCPgKWTzmbR5jg98QBel0Op+ugVb9nt7Gf6R/lt+trKuTbiKyyFox69L8EpnNy3AvIy8fVckwZ6ywK+5HQZdKG0/njXPiBgB2M5q0+QmBen4QuEZo+1ajC8Obbv6/VMMv89/wTwsz6d4+TXxnPqjCyx4n245KigaxQLFoc1z89V0YHLsoQ4+3lATlitDdrJbJSKRK8uwFXzvWbPmzjGaZX8CA5+PmhQnNgoreBgWpMTtqiTzxThEsdhi6CigZSvJO0/2FkJ7XzKxzv+EEBR+CQuPR+6IPkW37z7pwAfPxyTssZZabzZQqkt9TWyeueEmVUs;5:CT1dEREZ/pbxuKif293n4CPWlfdN3t9davswjDrjoPgxy4ZDT67pDSX7eptTnglzahm2hxVw+bHlMkyXb9ntmAWcrDKmw2Rgi7WYdGlD1PwpozlHOiYAmASSw2OeqkH49S1S+8uBqcyUTNJurKfA8p09GllBU7/9sxF5RZaJVz8=;24:eowqquIhaRcCM08q9PDP8K3Uw7fbOtB3Gqt9E7VwDDvEy7NSdABdtVUT9VTuuT45D2scO65cXiXi/jpza+5TFrWp98rfoohcXJHbR8DcnuY=;7:NCEUsEbnh1KzLzwypX6bHyEyRQylEyxWh6NVaSgXOfRyj5OP4maXL7qitVX+cF9kT5v2nCQZ9Hln4Mh52p7U0EOpHESO8vdiCJdiItwvXo/DZhcu+B/1qz080g2g/ajojr3QDIAfee7083byZOHFQcdLTzLQUK/QHPn8nZg/Cvr5FOEUmDN9ThSocKsIctFeAUYIpzNXmm3Nh5ItORHKKEo+H37fLn86CHN3XLjr/jESqELRDp3WKc3tw6pYt1YM x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 15a7cb43-b265-4e0a-af51-08d56b304280 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:BL0PR2101MB1041; x-ms-traffictypediagnostic: BL0PR2101MB1041: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040501)(2401047)(5005006)(8121501046)(3231101)(2400082)(944501161)(93006095)(93001095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011);SRVR:BL0PR2101MB1041;BCL:0;PCL:0;RULEID:;SRVR:BL0PR2101MB1041; x-forefront-prvs: 05724A8921 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(396003)(366004)(39860400002)(376002)(346002)(189003)(199004)(2501003)(305945005)(3660700001)(5250100002)(81156014)(99286004)(81166006)(36756003)(7736002)(10290500003)(106356001)(53936002)(5660300001)(316002)(22452003)(8936002)(54906003)(110136005)(3280700002)(478600001)(72206003)(4326008)(25786009)(107886003)(102836004)(97736004)(76176011)(6666003)(66066001)(6506007)(2950100002)(2900100001)(68736007)(8676002)(6116002)(3846002)(186003)(1076002)(6346003)(105586002)(26005)(10090500001)(2906002)(6512007)(86612001)(14454004)(86362001)(6436002)(6486002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:BL0PR2101MB1041;H:BL0PR2101MB1027.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: z4quOP2W9MaPWRMBwnW9Pm8BLl6cf4s8z7H9S3sswLWpTstdinL6sOWYw+a4T/Rxq+B9VPwf0k32gWTtFaRZ7w== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15a7cb43-b265-4e0a-af51-08d56b304280 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Feb 2018 18:01:26.0503 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB1041 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Loic Poulain [ Upstream commit 0856655a25476d4431005e39d606e349050066b0 ] Since driver does not report hardware dynamic power saving cap, this is up to the mac80211 to manage power saving timeout and state machine, using the ieee80211 config callback to report PS changes. This patch enables/disables PS mode according to the new configuration. Remove old behaviour enabling PS mode in a static way, this make the device unusable when power save is enabled since device is forced to PS regardless RX/TX traffic. Acked-by: Bjorn Andersson Signed-off-by: Loic Poulain Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/wcn36xx/main.c | 23 ++++++++++++----------- drivers/net/wireless/ath/wcn36xx/pmc.c | 6 ++++-- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless= /ath/wcn36xx/main.c index b83f01d6e3dd..af37c19dbfd7 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -384,6 +384,18 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32= changed) } } =20 + if (changed & IEEE80211_CONF_CHANGE_PS) { + list_for_each_entry(tmp, &wcn->vif_list, list) { + vif =3D wcn36xx_priv_to_vif(tmp); + if (hw->conf.flags & IEEE80211_CONF_PS) { + if (vif->bss_conf.ps) /* ps allowed ? */ + wcn36xx_pmc_enter_bmps_state(wcn, vif); + } else { + wcn36xx_pmc_exit_bmps_state(wcn, vif); + } + } + } + mutex_unlock(&wcn->conf_mutex); =20 return 0; @@ -747,17 +759,6 @@ static void wcn36xx_bss_info_changed(struct ieee80211_= hw *hw, vif_priv->dtim_period =3D bss_conf->dtim_period; } =20 - if (changed & BSS_CHANGED_PS) { - wcn36xx_dbg(WCN36XX_DBG_MAC, - "mac bss PS set %d\n", - bss_conf->ps); - if (bss_conf->ps) { - wcn36xx_pmc_enter_bmps_state(wcn, vif); - } else { - wcn36xx_pmc_exit_bmps_state(wcn, vif); - } - } - if (changed & BSS_CHANGED_BSSID) { wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss changed_bssid %pM\n", bss_conf->bssid); diff --git a/drivers/net/wireless/ath/wcn36xx/pmc.c b/drivers/net/wireless/= ath/wcn36xx/pmc.c index 589fe5f70971..1976b80c235f 100644 --- a/drivers/net/wireless/ath/wcn36xx/pmc.c +++ b/drivers/net/wireless/ath/wcn36xx/pmc.c @@ -45,8 +45,10 @@ int wcn36xx_pmc_exit_bmps_state(struct wcn36xx *wcn, struct wcn36xx_vif *vif_priv =3D wcn36xx_vif_to_priv(vif); =20 if (WCN36XX_BMPS !=3D vif_priv->pw_state) { - wcn36xx_err("Not in BMPS mode, no need to exit from BMPS mode!\n"); - return -EINVAL; + /* Unbalanced call or last BMPS enter failed */ + wcn36xx_dbg(WCN36XX_DBG_PMC, + "Not in BMPS mode, no need to exit\n"); + return -EALREADY; } wcn36xx_smd_exit_bmps(wcn, vif); vif_priv->pw_state =3D WCN36XX_FULL_POWER; --=20 2.11.0