From patchwork Mon Sep 13 13:01:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 511635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 730C4C433EF for ; Mon, 13 Sep 2021 13:02:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5EE4E60E8B for ; Mon, 13 Sep 2021 13:02:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238547AbhIMNDt (ORCPT ); Mon, 13 Sep 2021 09:03:49 -0400 Received: from mail-dm6nam12on2064.outbound.protection.outlook.com ([40.107.243.64]:19681 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238050AbhIMNDj (ORCPT ); Mon, 13 Sep 2021 09:03:39 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MwcCbrzkwRPSABJ7/iIsx53EDBRb7UjOmfZDr8j65X1l/fkIvud7bBPn9Qf8ztOM/UbpVzmnYu8jAGMkxwwNbuvo0q8eTr7CEENQv0Oh+SxHqFcZpWAK9weOxUqUHXsFxER7sFn+GWcwbaJu1tXQiKlwwtWkFwX0fpx6J0nuj9Q91gub6iw8Q9w/0ihLAYyYd4jINlWimv6giO1xviyh1ZGeA1BzP8Jb4tdYuiMJyyrFcDfvzNrKn4RpjRQrf2cadzziDNa2E+gy0Ho+krE9v05ehsMGXaqzt8qN5lBelt3H5APDiWLp7Ml7bSxNtYbuA+cAAeIyIzu76OXVtyCwIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=uUO5xCt55CNozRJ34OB+Ps7TB7KSGWz/tLv7tV6TOJ0=; b=mmff7e/76xf5zHuae86eZMyZL4MAAug6FmsXj+nuL5XRB5aqJ+uNUanCZSMHH/NrEEqnX248/N+lvYWxfP/y1UsL5sqhdRxJwRkQL2zEwBULsnwcNqwbcRuElKzVjw3uD6GBEWwpXwNHRy8hxliqctlqYIhkz9QQrcBBs4+zy5+z7wrf4vYVx1D2PCSq7ubzcW6wVZuMOU7x+QXEwU/MRCx78hxD3NcOzVnFOE3+mu8Z3GG+JV/DcAYe81b7Rz7IKS3Cj9cEGQAmekq/Uz1wLMKjTF5vPWQxL3aLDbgZoFNO5B9Xjz9wcoVZCZlDu8I21q1HsEdgsZX72DKxhC4yPg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uUO5xCt55CNozRJ34OB+Ps7TB7KSGWz/tLv7tV6TOJ0=; b=decHrQgmbhuEgyOWo2bGtREPuFpGtE+5BhcDYuAaZ58Dp9ir+R6qQWKTjYec/feuAVJ0BqHSp6MA1/t6Lcz4+G0UZSBBiydXjh25f7VP+xod6nKPYeCT9d/tXr87H9ZGPwlwdvZ4rkdSPWjaOmj7SOAmAhStKsJPghvgjI6AQP4= Authentication-Results: driverdev.osuosl.org; dkim=none (message not signed) header.d=none; driverdev.osuosl.org; dmarc=none action=none header.from=silabs.com; Received: from SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) by SN6PR11MB2894.namprd11.prod.outlook.com (2603:10b6:805:d7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Mon, 13 Sep 2021 13:02:22 +0000 Received: from SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::7050:a0a:415:2ccd]) by SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::7050:a0a:415:2ccd%7]) with mapi id 15.20.4500.017; Mon, 13 Sep 2021 13:02:22 +0000 From: Jerome Pouiller To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH v3 03/32] staging: wfx: ignore PS when STA/AP share same channel Date: Mon, 13 Sep 2021 15:01:34 +0200 Message-Id: <20210913130203.1903622-4-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913130203.1903622-1-Jerome.Pouiller@silabs.com> References: <20210913130203.1903622-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR2P264CA0021.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101::33) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 Received: from pc-42.silabs.com (37.71.187.125) by PR2P264CA0021.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Mon, 13 Sep 2021 13:02:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9acdfcba-781a-4158-a083-08d976b6b9dc X-MS-TrafficTypeDiagnostic: SN6PR11MB2894: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2512; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2Ao/eU0WOQhNp2B67tEn/8OQRi/Ho5ts0NUCGpU1erzswlhO+Q9/b64bcDjYRhg+cPPUD4ImlURDWkfOgYVZp3uKPfWWWbzZcGQht+CKPa8pEPi/Hr6ExjR3gkU6impIAOuSK7q9pD3cuU8m3YFAnyZSV7UTKRmN6EPB04XMZJWjT2eAlFn/waKUgABlqULTaM7FjmSKpUFFph0v2xNI+vCbWnp6PSen5kLKlSU1ezN0A5tirY45yJoAezk8i4wjcA4HfK1ToDI4qQxVWoaBvnLV2WeghCm23MeT8sw2R78WpYQUTFRm00ZqcjomBH4+PyOCSLWmex82NecIz6gA33yKrz6unHNmdNu8/RN7tAY6RDLNR1NNWiYyI9N0m/n5NfNDjDm+Rp98V8JsOE2WgFOkROAee66xakQB1MpwYlVmKcTUXHcuYyuK+LDAy9FTO4wvvTU26VW2WIyIQeNIWdq9wLyZV3LQYl+vfex+3kDeZ46hL6L3vNGv3+Slob0RXarrCo7vaqPn3JWWEGWbTDSpqQDyJFu3RWt/fSVhx+6OLzFDmu3AUbPZvYgMqf/cCRukRidE7H96SkGCxpiGk93y+XgO1tqCg1rF+ZM7AVs7798zSviXFzQm5KAu65rdbMGrYpuUrV5XEi1G3GqZwdUe0OFyhDr887vJyvL+1T2yFJfZtLezrBzWkIXAJgq5f+gcdYkwp1NakJ1Tr838lg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB2718.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(366004)(136003)(39850400004)(346002)(376002)(5660300002)(26005)(8936002)(6486002)(38350700002)(38100700002)(66946007)(7696005)(186003)(316002)(1076003)(8676002)(956004)(478600001)(2616005)(2906002)(52116002)(4326008)(36756003)(6666004)(54906003)(83380400001)(107886003)(66476007)(66556008)(86362001)(66574015); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?pNtizsF9pc+jy6I3co9/HgCUO?= =?utf-8?q?NMtiuh9/dNflumB9ntxuks5+1J6Hgp82LWESAbt9aTgdi/pn0crUEp+l?= =?utf-8?q?bHa5Cpd9K7aW3I5oKA/IB4F314iNtd6E7ewcPwptOnn2eecOqrpfczmk?= =?utf-8?q?1jMhWQ/tZcjlURC7fd2fwDWG7NVKfg6uFXiFkXwJznRRZlYkBEZpGGET?= =?utf-8?q?Jt+kMpAynC45pMZvkxwRoa6Toq20en96H3WcbpsxOFE8/ckhwkdeWmwv?= =?utf-8?q?zFAGxHgSMY8Sai/gSC9y3VVosvcBr5gcZgNiuI1moHe6Q5mcUt3wGT9H?= =?utf-8?q?xu1aTAxbQgb62V0tfJk5ED1oDMRney+DRxnBXUrwm1Vo997AgTNDPkxV?= =?utf-8?q?QVW+KZv4XNldMTMhVGcKcixum9k95siFC+r7XIlBhyT+bdHOCKfvC6TL?= =?utf-8?q?UMu+HxbZEMyG4sPLwz1nwHDJOdADlorT/BH5q5ZUiK7xqcmMPX84+hrJ?= =?utf-8?q?NJ25/PzIulJs19GrTracv7Q4MUgpQp76APnjdgd9X2DPLi/bmvAggell?= =?utf-8?q?Z5Wsv4nub67hax7ZN3bCveu3WRtD1lb6ZbrpxqqvbbFB8s9ZwmAUqyev?= =?utf-8?q?AIUVtewMLH+HjfZ6pzf1fvgLkfgf7/UDR4SZMLgW8e7uFgbUJj0/6ST2?= =?utf-8?q?g5Sa0MonYa9tT9vp+otj5v7t6S1nUx16Z2RCPpSirz/dR78qA/6XQEqC?= =?utf-8?q?KmsnmErqS53fsrtJvIJ36zmJ5lfkAFOgzenOWs9W8mgPjaOUI/wJvsOi?= =?utf-8?q?uhFrptqGrZB1owtRrxvY87rtbDDDV7L1gXSm1horHiO9pg9p49uNMlU3?= =?utf-8?q?+ZS27oJOeqrA0Dx+WnYguQakLd31hU1mjRykv6dR0Y29/znVQBCtrAQG?= =?utf-8?q?C4Zr8vz45HUyH77i1h+tvqQ1RRmMd8Otj7mOE6xmWNKYQOijjpuf5o9r?= =?utf-8?q?JDRhZKb+W0hebr62G+Z4JHY/ULu531xYENbwKld2NWOvEdzUJBg2UDPg?= =?utf-8?q?dGd2TvMuhEw/hKGD736Sj0AlpLAs1J3ooPsAKTmvTwxCcUhr630xTZl9?= =?utf-8?q?dQVBogP7a8PoOmyG7THBrpPIy5VlD13jIm1XlW9BjZ//JeQWOz8odwqJ?= =?utf-8?q?FcRQV3auYH01h8tqP4v4JLK50xgwJ6AyLdOLUrDFrNiJEpqxZluMDtiM?= =?utf-8?q?ilYC1rLBn0GrTjs3HjyPxotS6GHQ6RzVF3n0PGRfos8GUkR3cC4gQPtv?= =?utf-8?q?W39JySLDFQTMblMXEZkHA4TaRB0uoiFW2RSS0UbUhfd0FX94vf43Da5/?= =?utf-8?q?mCg2HTb1jqt1SJfkZ6FMWrEnnjf8KTuMFSBQ/KxmbjVIP3kORT/hgGlx?= =?utf-8?q?CdsqLE/2/RYiOZ9K9JmMoOdWi9WrWrQ?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9acdfcba-781a-4158-a083-08d976b6b9dc X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2021 13:02:22.5444 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OcWSp74pUHEkBQmnB/Lg9+lJVUx8Yz0V6kScNU+Og06rbuvc361Q+OLBG8hCUUL0LMQIbyGs525/lso1LVYQcg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB2894 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller When multiple interface are in use. One is always AP while the other is always station. When the two interface use the same channel, it makes no sense to enabled Power Saving (PS) on the station. Indeed, because of the AP, the device will be kept awake on this channel anyway. In add, when multiple interface are in use, mac80211 does not update the PS information and delegate to the driver responsibility to do the right thing. Thus, in the current code, when the user enable PS in this configuration, the driver finally enable PS-Poll which is probably not what the user expected. This patch detect this case and applies a sane configuration in all cases. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/sta.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 5de9ccf02285..aff0559653bf 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -154,18 +154,26 @@ static int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps) chan0 = wdev_to_wvif(wvif->wdev, 0)->vif->bss_conf.chandef.chan; if (wdev_to_wvif(wvif->wdev, 1)) chan1 = wdev_to_wvif(wvif->wdev, 1)->vif->bss_conf.chandef.chan; - if (chan0 && chan1 && chan0->hw_value != chan1->hw_value && - wvif->vif->type != NL80211_IFTYPE_AP) { - // It is necessary to enable powersave if channels - // are different. - if (enable_ps) - *enable_ps = true; - if (wvif->wdev->force_ps_timeout > -1) - return wvif->wdev->force_ps_timeout; - else if (wfx_api_older_than(wvif->wdev, 3, 2)) - return 0; - else - return 30; + if (chan0 && chan1 && wvif->vif->type != NL80211_IFTYPE_AP) { + if (chan0->hw_value == chan1->hw_value) { + // It is useless to enable PS if channels are the same. + if (enable_ps) + *enable_ps = false; + if (wvif->vif->bss_conf.assoc && wvif->vif->bss_conf.ps) + dev_info(wvif->wdev->dev, "ignoring requested PS mode"); + return -1; + } else { + // It is necessary to enable PS if channels + // are different. + if (enable_ps) + *enable_ps = true; + if (wvif->wdev->force_ps_timeout > -1) + return wvif->wdev->force_ps_timeout; + else if (wfx_api_older_than(wvif->wdev, 3, 2)) + return 0; + else + return 30; + } } if (enable_ps) *enable_ps = wvif->vif->bss_conf.ps;