From patchwork Fri May 15 08:33:20 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: 219193 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, 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 25BBEC433E3 for ; Fri, 15 May 2020 08:35:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ED3E420657 for ; Fri, 15 May 2020 08:35:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="FNKPYNu1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728359AbgEOIei (ORCPT ); Fri, 15 May 2020 04:34:38 -0400 Received: from mail-dm6nam11on2086.outbound.protection.outlook.com ([40.107.223.86]:6138 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728303AbgEOIed (ORCPT ); Fri, 15 May 2020 04:34:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GTSx5UFlK9EToNKOfD9CJiEi3v4bUe7IbYqig09FcpoaKf3FHaYw1KqdZEqXmIys14WVf7Xw/zupMVzrR6NUR6V4cIzhWW7FiZYV+dYkzKOCOoPtdAZSzqaazIgU/3+Uk3TsDDtJwxAyPSOcX4OGSalNGBOragkyZG1FVulM1JKyaxZDI0cmg2zg6cS723jCcDR7TrRkBBXAsUx5Y+FLj2huw+XMpENGlvUPSHKYdBFc7EOzf1bPKWvAJxJ6eNrEGsheFp1Dehxu/AOM44iysAIJtivs9jHGalawKkp7LiQq5Lt9TRh45UKaEwMj715dQZMHMRTiDX08GPMOFcob+Q== 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=/iAr3L+Z/U5t5GrzA6d9+xJ7lD8R0AItbO5PmLu8DFE=; b=JCl2U09O841AbPYfZZIuZWmYq1DcUA+vHh/JMiIPRMRbxwAG5OIkAOe4Qm1mWLEkJZLrcyNiBFDx9n9x0wJmwb+60OiF0lW/e6D+PBrX1u9wURp5C88/xwlsiR1+lkQjqiB9VP4ekAbnfN+J54Guz2eu1rs1dwtbcg0N9wdalYcyounRbIx6gXMDGdP22jkBTaBfkArtVQYEndxhmJsyCxx0fXQ1nBLndyrNey4YlT/x7j+2iVngedfJTKczPDH7h0vuNC+mtn6g4c/rzM1NMWY8lxBFQ0w5HleUtXNodIAV48ld+3iEDaJpiiYwE9SoQE1N8srKHLm/6zRtxdtOZA== 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=/iAr3L+Z/U5t5GrzA6d9+xJ7lD8R0AItbO5PmLu8DFE=; b=FNKPYNu1Z1Xmj3brbHsmZxlI/iBRuIHL342Agrgg1VXvCMBnYXvTWUHfc/oBHQY13IWhs93xCqekjJcMuOWRSU/eRrKBu8fbrB6zym7Fe4/JTj22UEhEiRgHkAGh50cy5lu3qVS8uirFQdsTAYCtE1HVKvocyhCaSu+oKR/DMqY= 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 MWHPR11MB1775.namprd11.prod.outlook.com (2603:10b6:300:10e::14) by MWHPR11MB1310.namprd11.prod.outlook.com (2603:10b6:300:28::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26; Fri, 15 May 2020 08:34:15 +0000 Received: from MWHPR11MB1775.namprd11.prod.outlook.com ([fe80::e055:3e6d:ff4:56da]) by MWHPR11MB1775.namprd11.prod.outlook.com ([fe80::e055:3e6d:ff4:56da%5]) with mapi id 15.20.3000.022; Fri, 15 May 2020 08:34:15 +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 14/19] staging: wfx: fix PS parameters when multiple vif are in use Date: Fri, 15 May 2020 10:33:20 +0200 Message-Id: <20200515083325.378539-15-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200515083325.378539-1-Jerome.Pouiller@silabs.com> References: <20200515083325.378539-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR0P264CA0076.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:18::16) To MWHPR11MB1775.namprd11.prod.outlook.com (2603:10b6:300:10e::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc-42.home (82.67.86.106) by PR0P264CA0076.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:18::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 08:34:13 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [82.67.86.106] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e8d50d96-1e6d-44cf-62dc-08d7f8aac045 X-MS-TrafficTypeDiagnostic: MWHPR11MB1310: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bzGvCb1WQ/RubSBUK5pd+SmW2W2vDmXBstshyO5aVG6s3vCLHrw+BjSDRVMWTRmD86HVcD6JpzXh7GlUdsi78+j9QRghcPu6iuTfat1uVgZgsSrNqlxf8ZZk2rfJZPGCgjJmZ9574UYnMmgSPS95PvwIN+gIDbP8ah0vhSVoOVZ/8KZ9zwp8Ls6hhvdOgasBHjNCDnahWyujWFr0/PGIuswc6NgtWLrzjHKmiEnRuAfz0uJWX95yjd/h0fsWGWFjCNuqK/PamGe02zyQSatvftsVXKxmjRw09i6RbhqyjlspVI6IADIfQKMVO/J+sGpO3R8+UZzhSX/J18diHBXgR+T6f7yXk565NHLylEku9OX1S7dRFURd63eBmGwtIODpOfy8m3pvqXGn7m5FnS41DGo/ya+3R39xevv28eKxS2vu0Hw1AKVcYth++AFJawHW X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB1775.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(346002)(136003)(376002)(366004)(39850400004)(396003)(8886007)(66556008)(186003)(6512007)(66946007)(6506007)(36756003)(316002)(66476007)(26005)(52116002)(16526019)(6666004)(54906003)(2906002)(2616005)(478600001)(66574014)(107886003)(956004)(8936002)(86362001)(8676002)(6486002)(5660300002)(4326008)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: /t9FMCg6CBlr7DuEMuwdg+cebTy0uAgKfF75CBYXIA0E0exf3Ts0Z6x9Dj+rhN5+5a70r4utN86bN6nJ9u6NRBUrKMCbt1y0Ubwynl4ehEl8hmJIvMj5eeovI7wjQu77L7jkDgWtrmLWZ2GbJp5/dkPpTgshTcxK6zsvwSMYbZdX58d6jc3tNO4xvEFlv8hBFK+wFIARzNEkOiU5p5EcJ7/d+oBJMzed+giOOz68/RQR9BPpvlA1dHp24AMvhGY0BHPU0dRwBbuWDwhrVZplLpRodc6gOOz+RMjA86dkI7jIZjPbBIrp+WG+/VJcDOgIYxb4TQg6cx/7ALwtcRYyyJAM8qIIo1zkKwo6kcBSkLdadw/crfhZh/FLH5v4zGy0EQwfVSIRX5dFzA0y1HeD1tf45eQbuq82AbcUH/qomKoqh7kKm/sGLjcSspPEp1+ER4++wWVFNf/TWkjPV1qp178+O99nFNYmZVKiqBhi60A= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: e8d50d96-1e6d-44cf-62dc-08d7f8aac045 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 08:34:15.1055 (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: zTZBDplFjlO2dV+FPKiSfWAhrfuzYwLo/b+22W4kBvYxz8z02zFVBDVFe4IUX7H0n99V6yHVw50mMoeDF4itkQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1310 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller When multiple vif are in use (= one access point and one station), and when the channels are different, it is necessary to enable power save on station. The firmware check that steps are done in the correct order: - AP can't start if PS is not enable on the station - PS can't set on the station before the association has finished (= before the call set_bss_params) Obviously, in add, when one of the interface disappears, it is necessary to restore the power save status. wfx_update_pm() is able to set the correct PS configuration. But it has to be called at the right time: 1. before hif_start(), but after the channel configuration is known 2. after hif_set_bss_params() 3. after hif_reset() Therefore, the call to wfx_update_pm() from wfx_add_interface() is too early to address 1. The call after hif_set_bss_params() already exists. For the symmetry, the call from wfx_remove_interface() (that handle 3.) is also relocated. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/sta.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 6e9f38d051ab..0cb7315bb050 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -347,15 +347,20 @@ static void wfx_set_mfp(struct wfx_vif *wvif, void wfx_reset(struct wfx_vif *wvif) { - wfx_tx_lock_flush(wvif->wdev); + struct wfx_dev *wdev = wvif->wdev; + + wfx_tx_lock_flush(wdev); hif_reset(wvif, false); wfx_tx_policy_init(wvif); - if (wvif_count(wvif->wdev) <= 1) + if (wvif_count(wdev) <= 1) hif_set_block_ack_policy(wvif, 0xFF, 0xFF); - wfx_tx_unlock(wvif->wdev); + wfx_tx_unlock(wdev); wvif->join_in_progress = false; wvif->bss_not_support_ps_poll = false; cancel_delayed_work_sync(&wvif->beacon_loss_work); + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) + wfx_update_pm(wvif); } static void wfx_do_join(struct wfx_vif *wvif) @@ -471,7 +476,12 @@ static int wfx_upload_ap_templates(struct wfx_vif *wvif) int wfx_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + struct wfx_dev *wdev = wvif->wdev; + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) + wfx_update_pm(wvif); + wvif = (struct wfx_vif *)vif->drv_priv; wfx_upload_ap_templates(wvif); hif_start(wvif, &vif->bss_conf, wvif->channel); return 0; @@ -786,8 +796,6 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) hif_set_block_ack_policy(wvif, 0xFF, 0xFF); else hif_set_block_ack_policy(wvif, 0x00, 0x00); - // Combo force powersave mode. We can re-enable it now - ret = wfx_update_pm(wvif); } return ret; } @@ -818,8 +826,6 @@ void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) hif_set_block_ack_policy(wvif, 0xFF, 0xFF); else hif_set_block_ack_policy(wvif, 0x00, 0x00); - // Combo force powersave mode. We can re-enable it now - wfx_update_pm(wvif); } }