From patchwork Wed Jul 1 15:07:06 2020 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: 1320609 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=silabs.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-silabs-onmicrosoft-com header.b=ZRSlMnM+; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49xl3x3KXdz9sTb for ; Thu, 2 Jul 2020 01:08:45 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731922AbgGAPIn (ORCPT ); Wed, 1 Jul 2020 11:08:43 -0400 Received: from mail-bn8nam12on2072.outbound.protection.outlook.com ([40.107.237.72]:60865 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731845AbgGAPIj (ORCPT ); Wed, 1 Jul 2020 11:08:39 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DFBogDMMFXwTuUF1Qnxe8rrv4Edm/knT06fHnA/vOyl3D0khVdhjGvAdkg5VAl8y9gWG8VAp/5ZV/lVAY7846V4XX9wLFlQdnzC2Nln67ZDZehvZdtZNJAF0c47c4/jA3OlB8Uwo9A0qux1pRLyIQeHdkE+Eo4SEdRU+XK1vYMO2+smpX6xh6RH57GmM/YIPpKDJAkFyPBOTq6pgaq1lROksG7TZxDjbdSiYsePuvN9nEugjiuFLN/j9Ba2bed3EkdxgR6oSaxMVZrOCHlEDZ6G97x1p9m5GoFqucNOWBfJb4QPyMTBlT5RSeoTZUTQLw4A5biHgkt3hoXBoA4Y+SQ== 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:X-MS-Exchange-SenderADCheck; bh=rU4jZR9bH7uW5J9DSSlLvc4DQzujrGowUAW5IFxdmQk=; b=RSftfAtF+9GqpTStdREQ2a6Qx0mmD+zeO6rCdL0mEGyfPdqRtD9APS5oH6frOEXwt0cSUEjIuzW/vXjBIBNc4Q3M/O0zxuB3p2sUlLChF/w3edPvRhsuplNKJGK9SUUukW7ZM2kaMzEnxZ3PAk507wlh7Kqcgz29SBoxY9n1RyCvTRh91OeioimStQkJ/216QW5l+xWnFxEymaTTV3G0y6VcoHSAnFMxn2X8DD6FittpXmNoRodw0Cun23ieQNbz5xgF9z8t6VFGAgoKYuAjJhovpm59VVVmYQoz9BwDkF4sTLa/9eDBvbgVzg+JtQcgSULbFlU/P6hX7+diQHdAlA== 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=rU4jZR9bH7uW5J9DSSlLvc4DQzujrGowUAW5IFxdmQk=; b=ZRSlMnM+N9NOPGeC8b+ox1q/6zM6afqvIpctDfrgb+I8na0iUffnXOWehDllZQx8FPV7rlQ9YSBu/Y3TQYw5gTcOOQ/IKw8UTx/4IUube9bgNBG6WpM7HerND7uZ9frCfg+j4+K2kW7ljJrIU4Z+ah0O4geGnaGAekIRlg5fnKM= 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 SA0PR11MB4736.namprd11.prod.outlook.com (2603:10b6:806:9f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22; Wed, 1 Jul 2020 15:08:24 +0000 Received: from SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::c504:2d66:a8f7:2336]) by SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::c504:2d66:a8f7:2336%7]) with mapi id 15.20.3131.033; Wed, 1 Jul 2020 15:08:24 +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 12/13] staging: wfx: add a debugfs entry to force ps_timeout Date: Wed, 1 Jul 2020 17:07:06 +0200 Message-Id: <20200701150707.222985-13-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200701150707.222985-1-Jerome.Pouiller@silabs.com> References: <20200701150707.222985-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: DM5PR07CA0143.namprd07.prod.outlook.com (2603:10b6:3:13e::33) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc-42.silabs.com (2a01:e35:2435:66a0:544b:f17b:7ae8:fb7) by DM5PR07CA0143.namprd07.prod.outlook.com (2603:10b6:3:13e::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.21 via Frontend Transport; Wed, 1 Jul 2020 15:08:22 +0000 X-Mailer: git-send-email 2.27.0 X-Originating-IP: [2a01:e35:2435:66a0:544b:f17b:7ae8:fb7] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 833902b0-7bfc-4da3-7974-08d81dd0998a X-MS-TrafficTypeDiagnostic: SA0PR11MB4736: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lRBGuYQUi0B3MUbdGz9/U3WfM0pF1LWMC9f6E+Cgn67NyMO+e12zCVNff2mvBVZcoKwmgJttdRS6+GSLV4/CHI9fE9wyL+5FTQFLJqxSS6B3z0AwQL2FzKiK5SFXohqDJgmjnrJTes8VqnkiGw0XaDsyPuKFMMx12IPpmPCMIVqZXkp5A23inWKtYh73BN/2fi5ztDKhRLszNJGqMQwefz7qBi4tWqa3uQOSZSigs/CTZqmGJnwwnsQZ8jmYfncg41Hi5qpxv5psJv9b0t5Uqzm7kvEvIHT2nopcuykeJSGY0qjEeSPml9+aZ1d8hoiucBqiVllpp3J6g6HEvRPvuQ== 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;SFTY:;SFS:(39850400004)(366004)(346002)(376002)(396003)(136003)(5660300002)(6486002)(86362001)(6666004)(66574015)(36756003)(2906002)(186003)(83380400001)(16526019)(8936002)(66556008)(66476007)(107886003)(4326008)(8676002)(2616005)(1076003)(478600001)(316002)(54906003)(66946007)(52116002)(7696005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 1RggAmDyEPn204D8Tx7uFYM5Va1B0j0jTYs4fNprp8MLtejMGbWE/qXRJYv453P3yMFT1HkUtkgjfUtYu05wapPZV8ApqSm3a56pbUWuOUKiB4i2fKuLJU7fCDQR4OhN40xEWVKV1TWac0ws8aPZeg7cGvs9+sYcrtOKvYDCpM+3sUeKlVxsi7hOrbYvXRgT4Lyec+yebILZZZW+Btnu/lBVvgM999ob8gJZOO4SvNLJQGiptchh63LYLYshkiHaQL3jFh5MwSLJHV0wJo4LjtbGX+uFam9uXA0hwahEg+Vz+Nhrzl56aQYroxSJ8XoSXcmtw+cv5AwrQRnkf7YUQYbqulJnqzV6ydPZE65WllcrmwR2eoHaN6dV9EdNFgiUurgOTKqGGHXKvoKJkDAWC7aYb7WkGXQ27l+KViVnW9jTztH1SJQo4GoChAkcpezcC1fV/6g0Xlkfnc0Fjv0geXqu1pv/J10pOoK2N9PjcivNd60slnPe7rfvOiKgrvtBDq4AmUk5kUsmmGGipymKsk8BehAiAEprUabw9BAnDeA= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 833902b0-7bfc-4da3-7974-08d81dd0998a X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2020 15:08:24.1656 (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: ObCltJhF3HmpZ/trJINRXlxguRsBC/1AyCDr1Ak7Hfsy4kgyvPMSNfF0qpJ/wDDYuLXC5BfdHjUTQZHwqzvZvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4736 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller In some advanced usage or debug scenarios, it could interesting to change the value of ps_timeout or eventually to force use of PS-Poll frames. The wext API (used by iwconfig) provide a way to change ps_timeout. However, this API is obsolete and it seems a little weird to use (it seems it does apply the change, so the user have to disable then re-enable de power save) On side of nl80211, there is no way to change the ps_timeout. This patch provides a file in debugfs to change the value of ps_timeout. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/debug.c | 23 +++++++++++++++++++++++ drivers/staging/wfx/main.c | 1 + drivers/staging/wfx/sta.c | 10 +++++++--- drivers/staging/wfx/sta.h | 1 + drivers/staging/wfx/wfx.h | 1 + 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wfx/debug.c b/drivers/staging/wfx/debug.c index 10d649985696a..3f1712b7c919d 100644 --- a/drivers/staging/wfx/debug.c +++ b/drivers/staging/wfx/debug.c @@ -334,6 +334,28 @@ static const struct file_operations wfx_send_hif_msg_fops = { .read = wfx_send_hif_msg_read, }; +static int wfx_ps_timeout_set(void *data, u64 val) +{ + struct wfx_dev *wdev = (struct wfx_dev *)data; + struct wfx_vif *wvif; + + wdev->force_ps_timeout = val; + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) + wfx_update_pm(wvif); + return 0; +} + +static int wfx_ps_timeout_get(void *data, u64 *val) +{ + struct wfx_dev *wdev = (struct wfx_dev *)data; + + *val = wdev->force_ps_timeout; + return 0; +} + +DEFINE_DEBUGFS_ATTRIBUTE(wfx_ps_timeout_fops, wfx_ps_timeout_get, wfx_ps_timeout_set, "%lld\n"); + int wfx_debug_init(struct wfx_dev *wdev) { struct dentry *d; @@ -348,6 +370,7 @@ int wfx_debug_init(struct wfx_dev *wdev) &wfx_burn_slk_key_fops); debugfs_create_file("send_hif_msg", 0600, d, wdev, &wfx_send_hif_msg_fops); + debugfs_create_file("ps_timeout", 0600, d, wdev, &wfx_ps_timeout_fops); return 0; } diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 80e4474cc3314..62e3634556ec0 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -352,6 +352,7 @@ struct wfx_dev *wfx_init_common(struct device *dev, skb_queue_head_init(&wdev->tx_pending); init_waitqueue_head(&wdev->tx_dequeue); wfx_init_hif_cmd(&wdev->hif_cmd); + wdev->force_ps_timeout = -1; if (devm_add_action_or_reset(dev, wfx_free_common, wdev)) return NULL; diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 2c0ab51fc92da..fdf4f48ddc2ce 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -217,20 +217,24 @@ static int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps) // are differents. if (enable_ps) *enable_ps = true; - if (wvif->bss_not_support_ps_poll) + if (wvif->wdev->force_ps_timeout > -1) + return wvif->wdev->force_ps_timeout; + else if (wvif->bss_not_support_ps_poll) return 30; else return 0; } if (enable_ps) *enable_ps = wvif->vif->bss_conf.ps; - if (wvif->vif->bss_conf.assoc && wvif->vif->bss_conf.ps) + if (wvif->wdev->force_ps_timeout > -1) + return wvif->wdev->force_ps_timeout; + else if (wvif->vif->bss_conf.assoc && wvif->vif->bss_conf.ps) return conf->dynamic_ps_timeout; else return -1; } -static int wfx_update_pm(struct wfx_vif *wvif) +int wfx_update_pm(struct wfx_vif *wvif) { int ps_timeout; bool ps; diff --git a/drivers/staging/wfx/sta.h b/drivers/staging/wfx/sta.h index 43808cef4785c..6b15a64ac9e28 100644 --- a/drivers/staging/wfx/sta.h +++ b/drivers/staging/wfx/sta.h @@ -66,6 +66,7 @@ void wfx_cooling_timeout_work(struct work_struct *work); void wfx_suspend_hot_dev(struct wfx_dev *wdev, enum sta_notify_cmd cmd); void wfx_suspend_resume_mc(struct wfx_vif *wvif, enum sta_notify_cmd cmd); void wfx_event_report_rssi(struct wfx_vif *wvif, u8 raw_rcpi_rssi); +int wfx_update_pm(struct wfx_vif *wvif); // Other Helpers void wfx_reset(struct wfx_vif *wvif); diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h index 0c44b733ef6fe..477c08fc713fa 100644 --- a/drivers/staging/wfx/wfx.h +++ b/drivers/staging/wfx/wfx.h @@ -59,6 +59,7 @@ struct wfx_dev { struct mutex rx_stats_lock; struct hif_tx_power_loop_info tx_power_loop_info; struct mutex tx_power_loop_info_lock; + int force_ps_timeout; }; struct wfx_vif {