From patchwork Fri Sep 10 16:04:36 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: 509088 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, 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 5E764C433EF for ; Fri, 10 Sep 2021 16:05:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4B20A61209 for ; Fri, 10 Sep 2021 16:05:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229872AbhIJQHA (ORCPT ); Fri, 10 Sep 2021 12:07:00 -0400 Received: from mail-dm6nam08on2082.outbound.protection.outlook.com ([40.107.102.82]:61568 "EHLO NAM04-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229448AbhIJQGt (ORCPT ); Fri, 10 Sep 2021 12:06:49 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bWaU2SzGzF+qggdxLtZq1JeICDs+8nxzlFrKEpj3pcEPPhUJDLLWz0t6G5jx56m4VxAVVUeHainBcqb77JD4Ej3IbRFQuukiVuaiJ2Os/7vSqYbxVOIw2o4B6o2fUbIKmRzfG28jR2fkBcbbRFIGmmIxU9wSGSboDukyJlIpw+5nLZ5GKY35KFEycQOVN5Uh/+ZcwW78QuGhp4SLW8lckYK3GsxMt/F/TFYDgENFHLKMsRsXtQ9FIHjD9/2KHlJ/rPMn6vnMiEfF2fGmMqcinpeIfMyQFyIsA3KpHNUAVDa6mYfHm4C+Ydn6xe9H2KcKht5F5O8rgt6AHApZyWgQ1w== 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=0w+Xz727jgVX/irNEH9/BqvsPmS+ssDQd0a+YfBOGac=; b=PHW3pDpHb5orRikOdcrVgaaIuJ9ByGE9sKk3PDwPKLRLmd2hLbP3RMJtHtY9YW+YUgha2/XL1rXWBr+8RjXvyX4rmDdV8zvmkfj1jdGsS23P4jrFiQd+ZXWMnU550WIOknIB0DHvJwKXhvNb00z8Z48EyZ7pgDA578iz18cpHFVjYAWw0FOs2WhqIPfpsFDvsJ6ISjUSB6GzgKoirjuicLLpVU2G4yCqYLyD6HfOFSSQesx97PHmuwiXKbq/BmyjX5JM82cQx27icaeBwJzdKXYZJN7srSvgAT4M9HpzGKP/cSt9NEII7ej/jm8h0kL1Y3enByCD6GMvpbInUaCi5w== 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=0w+Xz727jgVX/irNEH9/BqvsPmS+ssDQd0a+YfBOGac=; b=JNJcVfmpaeGLD8nErSyssdyFZDCXYFUhEFwDesmzDYjsGtHPnOPj+Jo0lsGM1aqDCcS0GHOkYsipfA7iSsK0P4KRfpJv95s2qlQB47efM7wjBjLgNYJldysivXdsvbpcT8sEtBXb7sMeX3hwhX/6q3Idk0A0IxQCgn2Sh/wo5Ik= 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 SA0PR11MB4592.namprd11.prod.outlook.com (2603:10b6:806:98::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Fri, 10 Sep 2021 16:05:37 +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; Fri, 10 Sep 2021 16:05:37 +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 03/31] staging: wfx: ignore PS when STA/AP share same channel Date: Fri, 10 Sep 2021 18:04:36 +0200 Message-Id: <20210910160504.1794332-4-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210910160504.1794332-1-Jerome.Pouiller@silabs.com> References: <20210910160504.1794332-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: SN4PR0601CA0006.namprd06.prod.outlook.com (2603:10b6:803:2f::16) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 Received: from pc-42.silabs.com (2a01:e34:ecb5:66a0:9876:e1d7:65be:d294) by SN4PR0601CA0006.namprd06.prod.outlook.com (2603:10b6:803:2f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15 via Frontend Transport; Fri, 10 Sep 2021 16:05:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d615f737-10ce-412b-e499-08d97474d3c3 X-MS-TrafficTypeDiagnostic: SA0PR11MB4592: 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: 2EODoa3VjzFV7zowESBQcHs6/DFCjEjtJUU3d9OkIrbdoHleoRaAjy9jJYOO/S+2mF72EpbnFfe+oUSRI+c14oe/B1ir9sYmkEessH0kbdxYK/Wry8LJQzG3PkIO/9GqhP2ybKt267H38IGWZpGPJgdku1WKdjo3s7/eF6fP4+vlKSSPGRxxmXcF5abpvk/UNiLPV9+tnimrK1Cw/N9V1sEW70ntVKllZyOkYGn3UYjLuE3IfPZtwQijKe503nMXXMZu1mq3vftFf85EELo0r9abb781Xx+YNLM+eshMW+Hwrn+RIlghPEuMzDn+3aGZ71Q7rObqqVtXg22QCnfGq/fxu58WXwzxhX0yOG643Lqk7dQ5rNzs85seqwG0seI7R/+/thW2ge9blS4LFxtu3Fy4pq0XfR4F57SzMYnWJ/KHUo/wBGtJC+IHr6R8OczPuK2PhKSyvCIXR9IORfLuFSYJCq3ULczKnkFQgbJOWXvNkzEDTR/ofz+uDPstZL8y3WRRqovGHpYB9hidUjEEMDMdz78C+pEQxDYRiTEbsXFKLT26zkUUbPNH8uKChlu17XX5AWvrWAR8o03W0qw7vsolMuFSWyLjxsOP/UkpD/8/soDYO+CPPdzTUumrk6+8Hd/wQQmIc/4Uw6mxsa/U2w== 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:(366004)(508600001)(2906002)(66556008)(66476007)(316002)(66946007)(83380400001)(66574015)(8676002)(8936002)(36756003)(86362001)(6486002)(107886003)(7696005)(52116002)(54906003)(2616005)(5660300002)(4326008)(38100700002)(1076003)(186003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?SkY3IYQjaziDaljFP0bxW2SkS?= =?utf-8?q?sp1jUa7hOzbWJlkVZS6tKIxedLqjHKdsYNwuXDp5oiBSvzBAb267CSkm?= =?utf-8?q?qvWduL7BxchyfZ2G4q9lk5runocMpdGF/6LxIYkmorf7V9VUEZmT30ro?= =?utf-8?q?/aGrwC18you8C1LZeXZ+BqbT85laBjzp408fKeCYFqYJoZCcseqR3Xzx?= =?utf-8?q?McZOBv+Un1fLHm37gRt6cMykh9GY7QmOORT/ve00cOfJX9u2pevUfkhf?= =?utf-8?q?xt4DCU2ZAp/QYS657s/HvlwXRnCm4A31+G9zQnC03RGhXb+TFlqsorwe?= =?utf-8?q?ifoTmjr+UGmUCfHhWh/DijhJItdS7NkjDgSa9jkdBZPTVktu5wr8shn0?= =?utf-8?q?LpLDaLkkbVjWkxI+el8JUAgOb1RWcBgfj9CYy5FpEPzLgYQk7Ab0n86K?= =?utf-8?q?+VZ0IyrBCrC2ZE6DBEVYnyHaiiEE5PZVGJMCSlIsDhhHDgW+dwHdcXn5?= =?utf-8?q?tkFIWYPA/Kc13YWaHeIgYrPq6dnpvi3zLOuUuHixRRxgtVvn+DMGE/d+?= =?utf-8?q?TVyh4Ig1eJ6hAXdEekrkIpfRgpCbspodkpfP3IS3D8daLZH4e2XguR7W?= =?utf-8?q?DKSMI7u2schrU6HFfsD1kdZN5tZkvF/bSFm2JL+gUMjh9KOBnS8sIuuQ?= =?utf-8?q?GeYYhb9LxTzcelYRZ72JlTZpguklCz4k6erVLgszoS/l3ehWB9QxvgJr?= =?utf-8?q?zOo6O9Cph6eujux7ZxDV+bbPsTn0MDEFAvNWyxzzWMTb+TwAJus2OgHs?= =?utf-8?q?S39O9T/UDH+Ze6vyUBaEnK+FVdToiSpZN6fJ+Y8x6QW/L+aYOx258oPU?= =?utf-8?q?OqNIxO6akXJmlihBI0/qKa5QWn3GhZsoHtUTCfipCQD0unuzFq/eS4u6?= =?utf-8?q?G8fSO3ivqfJN5mlGE/JQPUbL0fSBsjSHqz1cbCREy0vvvQjS9zQuVmyZ?= =?utf-8?q?qZYjkQlc8cFYilfDWN+IVv+56SMFMiVd9xn4WCscgVElHu3aQsQvMMbG?= =?utf-8?q?4FhS8Xw2xbM/ReTirFNNZXWiBEj8tO6fFg78ONcnLJHut0Ruazar6naQ?= =?utf-8?q?wKg4uJtOLM55Nu02Q2smrmTzqAXpxgOF4LZj2QtbWgkPQPmXtJ7I49Ue?= =?utf-8?q?8BosBK76t0qziyx8Gzkbwd13coWFOxwLRcDPzQTqIiEiDziofieZscpM?= =?utf-8?q?ZE2e7cLYat4S8Y7jJSxXa15Y9A/F3oGw/OD0oDoYMVyEODSFUH94TytT?= =?utf-8?q?Wxz9qYNiC6xeY6XwYWmJi+Mr5k64lDM+phu063MOxEWvYyc2Wk7uIu8N?= =?utf-8?q?C0b57s6RB2qzZv3uDaz6dOxlSTuq8fgwH/bniO4Ny3VIXr4BfI8FYYFP?= =?utf-8?q?pcag1QgB0vGAc8gXHmVpWdG3tMvZpLIlxSRGGD27yZvx130VNR8WH1RE?= =?utf-8?q?4DQWJX0CIXMdCr53Va6mNykY2tHSdRfI5C5hdq3?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: d615f737-10ce-412b-e499-08d97474d3c3 X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2021 16:05:37.0573 (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: csXiGCsefQdRo/M2VmgAbHzyug6fyeBi3F72GvUKvzoGY02enUSFcqwK8Cg2V6Chy7MwDAeH9bOVyWap+uMvhw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4592 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 d901588237a4..58446f78d648 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;