From patchwork Tue Aug 25 08:58:17 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: 259491 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=-11.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, RCVD_ILLEGAL_IP, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 C5CC2C433E1 for ; Tue, 25 Aug 2020 08:59:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 916BE2071E for ; Tue, 25 Aug 2020 08:59:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="XhaglZ1b" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729057AbgHYI7C (ORCPT ); Tue, 25 Aug 2020 04:59:02 -0400 Received: from mail-bn8nam11on2079.outbound.protection.outlook.com ([40.107.236.79]:20448 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728033AbgHYI7B (ORCPT ); Tue, 25 Aug 2020 04:59:01 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UFSQVmTRjNq9WIa7CbjmsdUXnqVPnI6EPaksGiR/I/jAKOAriAJoTe7MyolFEKOb8dmrbymp/qZiNejCxozrlYgSaNXj3LjKHP7ocs0IzvwYOlMUUzYK+rdRTiVZusCT26kwP3WWo1PdjM3eLJKd7ck5dR0JfhMBhPg4Jzo6z8Bgdj5zyYT+AaJ8D/nwkNVCamZQbgR5Dv4GFfBELTUxxHHAWhS9V1SpAz0DKGP7OqcxyE4gQQwTVogTNPxpWvO5iSHnnPnw6N/+e1sEoZ6C78g8Z11mwQ+3fXvJokzd0ZacFBc4uTRG3axoMrQNhSJo39HFkXIroSkEVSkC5gYtaw== 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=HulzlNPJ0vKnS1DE7gqTcXMUbsJBNAI5ANqEA6+6cIk=; b=JydQ2SDLMqTSE0de6Wt2u/ATEuITEIvWYDGec88YgkGj35w1bYssk3fSmEvTZzGiEJ0JmjLjFUOOKfZajWGu1c0iTogB/tChzXhhch6KaS9WXC5dZWqrQHVQCGxptE6wo4Ei3C+Zh4FNFQOGRuiynzRqbwbjR8JVWaSU3RG8zZ0iW04Iyn1epnIl81HwXZA+ekJfI7cpMBvzsdlRBhQLgHlHrpYpGuXsGErzVqORtbFOYLOHrNUKxyHFCW+IY04/P90iBSLAEF1ZiXgbRdbL6Mo/dPnPBrvR85H0gOaeTWUzMOv4UWuDwhqWTKopFLLodVa8/DOHFLeUZkiStBh07w== 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=HulzlNPJ0vKnS1DE7gqTcXMUbsJBNAI5ANqEA6+6cIk=; b=XhaglZ1b1LnajPC67+tFTxcTu00bl0N7NvUJfH1r5IZ8jCBTAQCLu5QI59Nt9yvCDo8x4TAPTzECucCdyb1Zeb8B4Vk21Ag7DrpOWGjXbdfVIk6xHBRcYGlyJiVD5UaAlpMQXo1xr4SiWCF1sv+aEYtgPON2AnYwqUT8K4VqJzI= 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 SN6PR11MB3501.namprd11.prod.outlook.com (2603:10b6:805:d4::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Tue, 25 Aug 2020 08:58:55 +0000 Received: from SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::85c9:1aa9:aeab:3fa6]) by SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::85c9:1aa9:aeab:3fa6%4]) with mapi id 15.20.3305.026; Tue, 25 Aug 2020 08:58:55 +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 v2 01/12] staging: wfx: fix BA when device is AP and MFP is enabled Date: Tue, 25 Aug 2020 10:58:17 +0200 Message-Id: <20200825085828.399505-1-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.28.0 X-ClientProxiedBy: PR3P192CA0002.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::7) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by PR3P192CA0002.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19 via Frontend Transport; Tue, 25 Aug 2020 08:58:53 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [37.71.187.125] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2fa8b919-00df-4385-9d65-08d848d51878 X-MS-TrafficTypeDiagnostic: SN6PR11MB3501: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XWFS3VFJRNLi4sYpO2lOw4akxNPDR9r1ovaOWlH1Z+JQt/4HNv5g3i1qy4QEYb4EIbgzgov7Jf4rR2E+zfdWxRsEDGY57JrqaYAvxvUwwVIricTVTpzbDJ9gN5wi1B6xsVoehRsLhhU3E8Yhuhzi3aZmWacbQWbbDHNbX/r3oOhxSCjgC0UM5hCZlKwn1fJbCnlkN7ZCdE397bohtz9IqpzClCTHeniTnUqzWTUF35BFYnpG3OnTBTdQOcTVjfxInSXgLvCjRSIGPHSilaay6lWj7SRhAZsnscEdklhUW8NTyvVlAk/RFoZUt03kZCMqjlK723jAuGzItJNAXP3oCg== 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:(136003)(39830400003)(396003)(346002)(376002)(366004)(316002)(5660300002)(478600001)(107886003)(1076003)(8936002)(83380400001)(16576012)(956004)(66556008)(66476007)(26005)(2616005)(186003)(8676002)(86362001)(66946007)(6486002)(54906003)(6666004)(36756003)(4326008)(66574015)(2906002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 5Brjpm2Z62h7oN4411l5CZwDuKYWFQPeYTgB0Q0GLH+lVpkhwNyOOfJs6zLtks8FWrPS81tfUr1e9q+uLWD0Pz4r06A1L2EnRkTBfKZD6sh05xtYdegLBkiIIHxFA6fEG04U5c18DGNMxaDzrvXuqIhgS+/y9rvNFdGQdOBasAzDxSfn/WJ4qOMHUjFtdirRiromcJGNKs0kqObLuf+QHvFny1PvWT69JTfru7od5/1PDkWNmGFvAIN0ooRoxiaDcrdHeYYGoPm2tRspii4rAhL5D2WdK4PEaqAZZaVSF5JUAz58FefIdVbquF7XyANAt1yXTh+LkUXnlSxshXnOviMz8flkHuk4SoKcbej5bmJt4S6hx3/BC3N0To3nyCZt1UFRo+Y/Up5zy1mEQW/o9K6okLVfzg0Vt8LKIoHDh7AMqjj4l5B8vm6T3B19YmkGlE/Vjna4zgkf68Pzw7JRmuaVgyeZobKL//p7kcZwQNeUsRQ5MGzcCJRXzb6ZH95bfZr29XmBBqQHoBXeHjKNRi8Wtxu4hmQccxBDVWnFZcWJnvDLVpZRm4VjnG2BeZK1mLHEo6PZEImut69vx8KU+RlHaxDcN0IBnO9TTZxH/O4qQ/PpST+HcyLQqMFfe8PurcrMJTv3Zrcd/1FDwbUuMw== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2fa8b919-00df-4385-9d65-08d848d51878 X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2020 08:58:55.1095 (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: BhS5+tsNR1gDOZ9E43xmaUrbT4vEWReR9ZAt6pNDVkbO9kvghjBB1JeMujzViIP5AuHYWipy00YpomUyFyK+lg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3501 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller The protection of the management frames is mainly done by mac80211. However, frames for the management of the BlockAck sessions are directly sent by the device. These frames have to be protected if MFP is in use. So the driver has to pass the MFP configuration to the device. Until now, the BlockAck management frames were completely unprotected whatever the status of the MFP negotiation. So, some devices dropped these frames. The device has two knobs to control the MFP. One global and one per station. Normally, the driver should always enable global MFP. Then it should enable MFP on every station with which MFP was successfully negotiated. Unfortunately, the older firmwares only provide the global control. So, this patch enable global MFP as it is exposed in the beacon. Then it marks every station with which the MFP is effective. Thus, the support for the old firmwares is not so bad. It may only encounter some difficulties to negotiate BA sessions when the local device (the AP) is MFP capable (ieee80211w=1) but the station is not. The only solution for this case is to upgrade the firmware. Signed-off-by: Jérôme Pouiller --- v2: - Check that ptr does not point out of bounds of skb. drivers/staging/wfx/sta.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index ad63332f690c..c31e302d05c9 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -434,7 +434,7 @@ int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, wvif->link_id_map |= BIT(sta_priv->link_id); WARN_ON(!sta_priv->link_id); WARN_ON(sta_priv->link_id >= HIF_LINK_ID_MAX); - hif_map_link(wvif, sta->addr, 0, sta_priv->link_id); + hif_map_link(wvif, sta->addr, sta->mfp ? 2 : 0, sta_priv->link_id); return 0; } @@ -474,6 +474,31 @@ static int wfx_upload_ap_templates(struct wfx_vif *wvif) return 0; } +static void wfx_set_mfp_ap(struct wfx_vif *wvif) +{ + struct sk_buff *skb = ieee80211_beacon_get(wvif->wdev->hw, wvif->vif); + const int ieoffset = offsetof(struct ieee80211_mgmt, u.beacon.variable); + const u16 *ptr = (u16 *)cfg80211_find_ie(WLAN_EID_RSN, + skb->data + ieoffset, + skb->len - ieoffset); + const int pairwise_cipher_suite_count_offset = 8 / sizeof(u16); + const int pairwise_cipher_suite_size = 4 / sizeof(u16); + const int akm_suite_size = 4 / sizeof(u16); + + if (ptr) { + ptr += pairwise_cipher_suite_count_offset; + if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) + return; + ptr += 1 + pairwise_cipher_suite_size * *ptr; + if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) + return; + ptr += 1 + akm_suite_size * *ptr; + if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) + return; + hif_set_mfp(wvif, *ptr & BIT(7), *ptr & BIT(6)); + } +} + int wfx_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; @@ -488,6 +513,7 @@ int wfx_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) ret = hif_start(wvif, &vif->bss_conf, wvif->channel); if (ret > 0) return -EIO; + wfx_set_mfp_ap(wvif); return ret; } From patchwork Tue Aug 25 08:58:21 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: 259486 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=-11.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, RCVD_ILLEGAL_IP, SIGNED_OFF_BY, 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 0388BC433E1 for ; Tue, 25 Aug 2020 09:01:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C32412067C for ; Tue, 25 Aug 2020 09:01:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="QbJhjos3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729604AbgHYI7V (ORCPT ); Tue, 25 Aug 2020 04:59:21 -0400 Received: from mail-dm6nam12on2052.outbound.protection.outlook.com ([40.107.243.52]:53959 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728033AbgHYI7R (ORCPT ); Tue, 25 Aug 2020 04:59:17 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vg+W7PDZBIL4SJMIN0dfTm3JFc7pV0lcbCIOXWVcwJG0WnnyjWUHg1rMonn3jjwesXiHDgL2C2FmRSp7QBxyiWidx3EOgTHY6KFve46FUn8W1F6nkhrnfCxf2gK2mByboSAR33GAIQoLx+N7WOvPa0exrIgFCgL9G3D57DvspwzBKscuza70HJqVHzlyZM0oLJOaqAQDknR1qcTqeeJuUEe1+ADC/G0nFJZ3fcofW5e5D9RbsnftDA8TEkKQUBL4ojIwuPJEGxx4BIfeqrFyRzkNyXtfZwUwgfSeUUOOyQ8wQ2ExrTx2GdQo9UAk9ID0B1LfERoR2921sh0QwleVeQ== 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=6h3ZZF67h4YqACm/j8Eh1W5rXu/X68RUEDVrbinPXJ0=; b=JF6ngQGNABGxMe6SPYdiEH1O45T1SF1s0VHbwkdoBW4013Xa9ykPgI7wm+ADFRS0KSvFCsOuujdF9HvFgYjzvtoGL3iCo/FqbF4Tr6YZ/p4bz7XK14Fi3zAOugid2nPANXdXioU9d/dG7tkaX8mxmOgFemVsmP9yAJgIOPolmJzGqVG9ZkHEtY5nGgAd7cRYeRoD2cHajfHDJo+ejTr0Qbt2Ye8YnWxKMTaijkxxD+N8+cuLvStALq59crAge/4wor3XqdinmbjeiTEk3fhIuikYpokJPmI9f3Q3DwEORqj5jcmN3vSuYN4J7rwr0itDVRWahOrPLe5qXY7PK5tYGw== 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=6h3ZZF67h4YqACm/j8Eh1W5rXu/X68RUEDVrbinPXJ0=; b=QbJhjos3c1kDix+KtOgrunykT2zf55n41QJpXBkrk3v/ZmToAY5zDLH8/S0KqBoRcawBl2a01YrSdO51eyD+4wsV2DKYFkc1E3VPbEp8dGc8umrLMZB6saTiopqOMsuSZ81Z2DNE4ic/E+InWfjNJt3T3jNTz4U9iSm8UB4Q8dc= 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 SN6PR11MB3501.namprd11.prod.outlook.com (2603:10b6:805:d4::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Tue, 25 Aug 2020 08:59:01 +0000 Received: from SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::85c9:1aa9:aeab:3fa6]) by SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::85c9:1aa9:aeab:3fa6%4]) with mapi id 15.20.3305.026; Tue, 25 Aug 2020 08:59:01 +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 v2 05/12] staging: wfx: fix support for cipher AES_CMAC (multicast PMF) Date: Tue, 25 Aug 2020 10:58:21 +0200 Message-Id: <20200825085828.399505-5-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200825085828.399505-1-Jerome.Pouiller@silabs.com> References: <20200825085828.399505-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR3P192CA0002.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::7) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by PR3P192CA0002.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19 via Frontend Transport; Tue, 25 Aug 2020 08:59:00 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [37.71.187.125] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f4add5ae-0310-4305-e7bc-08d848d51c58 X-MS-TrafficTypeDiagnostic: SN6PR11MB3501: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yUEghYn2mO4fW8B0Iizu+r51/1buU64U5lswJeMZrl2iZgFj5PBj37yF8tTUl7NJ8MtbdH7SmTv6VfAgf37/E6pY0CfoRoifgzZlyeMr4TPo6JXbSKRZ76hLhsbmW8Hdw0Vo8PhxP3D4Rb8a60v9a8ituUUO7iJoNwWebCGavD9S3DOnn3y7zr0jAAgnmeBN9hx4QLLmxza586tkgyu1ALOXGXv8dqzSkZDI4kXClfNN5B2VrGCKUnO4Qg5gdoVY82Sw2fVtmaMeMniFUF0Y1amCtv+YPngfXgdAgYDKyyOascX4ElOIOuh4L3uvxNmDx4qJu+SQ375xorzZKXIomg== 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:(136003)(39830400003)(396003)(346002)(376002)(366004)(316002)(5660300002)(478600001)(107886003)(1076003)(8936002)(83380400001)(16576012)(956004)(66556008)(66476007)(26005)(2616005)(186003)(8676002)(86362001)(66946007)(6486002)(54906003)(6666004)(36756003)(4326008)(66574015)(2906002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 4z+Ej5NhPi6vJmTVvVqPKIb2cyfPO5OrSwIEI+eLPkuHtRExMgjGei6s+lEwfNZegpmFoj55J84i0gSqU54YNyq3/NudhRkQp8WPT640wcp0jtgwrqfPrlT5g54sttQ8zCj3pz6wwB4zB5g46HTFe+g5SRnW2zRgc8Cg+gPZNsdx50v9CLyLQzeuQvNB5824Wx7E1IHjcQgMghF4PhnM9VcA8XT05eBEbUu4t7RhdCdkUbjtixC9CqDfS68tJrGszD2eZUuMj9Gi4JY5OS2AclncY54IvVLDMnMtelCiHudosbkRKHdrCSPwjcT86Jyhbs3VVC9fregCjV5QtsF0OrnZcGi480GJjXCWmcAJweih25n8VrzdgeZZWkNDKQtL/d2fLnVSeYiElVHqygIppnFnRvwTJzaDO10pb7ghQF0lGvOwERHP6W7SXHVytviCnGDHhZ4gH4RZtny0OCKwxsjpGzCRG6RBjrGDKWNyKS9lgMaEcddF+8jebM3Is8hBQORmGhfdl21aBkP/H8dEAhULnm3y0OpieU/STUl4MRT4v1KuIEgkPLNBDwOiBcgDRlnxgtq/7zCLfvQ91Z2OtKz0FFHhkNkCnqw5QKNjrCgw2uBAZDuOPDHjrguP0uH1EsmaHIQaIEXHBmbujADouA== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4add5ae-0310-4305-e7bc-08d848d51c58 X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2020 08:59:01.6226 (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: 1FqIuQ9CIT05aPMsNT4OMf6OgtCJ7JerLxKnYGSgoizy1W61/5EGOhAqL2HAkvjOzuUhf5uKCQt7ScsTo9qDcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3501 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller When MFP is enabled, the multicast management frames are not protected, in fact. Instead, but they should include an IE containing the MMIC of the frames (i.e. a cryptographic signature). Until now, the driver didn't correctly detect this kind of frames (they are not marked protected but they are associated to a key) and didn't ask to the device to encrypt them. In add, the device is not able to generate the IE itself. Mac80211 has to generate the IE and let the device compute the MMIC. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 5 +++-- drivers/staging/wfx/key.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index 41f9afd41e14..d16b516ad7cf 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -325,6 +325,8 @@ static int wfx_tx_get_icv_len(struct ieee80211_key_conf *hw_key) if (!hw_key) return 0; + if (hw_key->cipher == WLAN_CIPHER_SUITE_AES_CMAC) + return 0; mic_space = (hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) ? 8 : 0; return hw_key->icv_len + mic_space; } @@ -350,8 +352,7 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, memset(tx_info->rate_driver_data, 0, sizeof(struct wfx_tx_priv)); // Fill tx_priv tx_priv = (struct wfx_tx_priv *)tx_info->rate_driver_data; - if (ieee80211_has_protected(hdr->frame_control)) - tx_priv->hw_key = hw_key; + tx_priv->hw_key = hw_key; // Fill hif_msg WARN(skb_headroom(skb) < wmsg_len, "not enough space in skb"); diff --git a/drivers/staging/wfx/key.c b/drivers/staging/wfx/key.c index 6165df59ecf9..728e5f8d3b7c 100644 --- a/drivers/staging/wfx/key.c +++ b/drivers/staging/wfx/key.c @@ -198,8 +198,8 @@ static int wfx_add_key(struct wfx_vif *wvif, struct ieee80211_sta *sta, else k.type = fill_sms4_group(&k.key.wapi_group_key, key); } else if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC) { - k.type = fill_aes_cmac_group(&k.key.igtk_group_key, key, - &seq); + k.type = fill_aes_cmac_group(&k.key.igtk_group_key, key, &seq); + key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIE; } else { dev_warn(wdev->dev, "unsupported key type %d\n", key->cipher); wfx_free_key(wdev, idx); From patchwork Tue Aug 25 08:58:23 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: 259490 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=-11.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, RCVD_ILLEGAL_IP, SIGNED_OFF_BY, 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 19452C433DF for ; Tue, 25 Aug 2020 08:59:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D78832068F for ; Tue, 25 Aug 2020 08:59:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="Q5Ta75Ig" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729654AbgHYI7d (ORCPT ); Tue, 25 Aug 2020 04:59:33 -0400 Received: from mail-dm6nam12on2052.outbound.protection.outlook.com ([40.107.243.52]:53959 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729625AbgHYI70 (ORCPT ); Tue, 25 Aug 2020 04:59:26 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P133iMKGyBAAGSzjVKpJWuNJfRNlnUCZzxCZr50dqmBuJjVylxhKP6U51OLf2uEqkvNngGQUv0PvbZ3MTgKx/wjsYg7KD0qJH5GwtUlTaGIErqLkos0JcPPpMBi36SfR8eHrYV/0k4MSdB82cJ4cM8f99keKqYfOwyhsZyQiTn+dBvpWS5LwTSwWVhdDm+kvSQrgoMkJtjRjhji3NOG1aa3IDXEIj6ON0CpM26sAGyFBd0NONBmcfS8L/zu7U3RY6qQOx5mwwS8Q/NP9XFrvV7grdLOORDjqDQYWawhp3crSP+VOQdumAIPmTGXdCuY3cVWMistnnEP7fx7OMsQfKQ== 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=ak4CIZP3dcXMGBZZ3ut14GrlVvZym3fnk37czMeMAyQ=; b=L2I793BUaPgLE6TlK32IlhUVc/3WuooDAvMUYdAxzl+NLaIBvlMOaDDxVXN1OYdjHWHlNdmPRFy5Hw2i/gApRsCsXcVHL/kZYR0AH24Ig+1TEpz4RCdvUu8tcLabWxTECmprBfaZixVJYl2mXJXd5kifcr9iPb3wtSzuobEy6Q467VAtheAF2M9zk0fPZaGZHbHk361fs8uTJmFmOO220nGeDlVPqBDfi3aRyaNqqC+gOXXnU6fLIUDpcmHKkgYP1h8OnFrYnXcNehvTDOYpPvm4SnFfyT0jdAcoDc6CGHKVf/c0d6PPftA3q8W2nD78X3m8Nnn77ArsQ9bg4Mz2tQ== 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=ak4CIZP3dcXMGBZZ3ut14GrlVvZym3fnk37czMeMAyQ=; b=Q5Ta75IgwuVQ+ggtrjFMPnCf9lmCTqSrAOq3M89X/9dy8c6KpdCk2qvr0Ppl3W/kYAjZA2lfhrmdGgarrSRUsCPejhyjR0yKi0qEwmCYGZRsJNSDJJx9UE9kYqg5AsJGbUX1P95cD0oYfV5JkfCez/L8lgwx5pzQU38lUzU6P6c= 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 SN6PR11MB3501.namprd11.prod.outlook.com (2603:10b6:805:d4::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Tue, 25 Aug 2020 08:59:05 +0000 Received: from SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::85c9:1aa9:aeab:3fa6]) by SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::85c9:1aa9:aeab:3fa6%4]) with mapi id 15.20.3305.026; Tue, 25 Aug 2020 08:59:05 +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 v2 07/12] staging: wfx: fix frame reordering Date: Tue, 25 Aug 2020 10:58:23 +0200 Message-Id: <20200825085828.399505-7-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200825085828.399505-1-Jerome.Pouiller@silabs.com> References: <20200825085828.399505-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR3P192CA0002.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::7) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by PR3P192CA0002.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19 via Frontend Transport; Tue, 25 Aug 2020 08:59:03 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [37.71.187.125] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 685e85d7-6b4e-4dff-a041-08d848d51e67 X-MS-TrafficTypeDiagnostic: SN6PR11MB3501: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5grI8A8nErTT8v+2rGva5D4u9oNlxTz1oH52QZzsMZSWEodEnAMPx7NKkzgtmGy1Um7U/QfLTPcE1xAHWhgRqMU162dgqTtQ4ptBExC50KyLFmo33WQvui+TbUwbxe7na1z0NcSAx8ert+nSrEFdmqqE70ZFOoKp5zeogv533Di2GdCRpxRMp/mc6CcPrdiBKb9fM9B8cYEnCHC6soBeYqwFK3gbqIC0lr9Mj6ULs9XO1DjUE+eonVfgNS1I1JOBcumcT+9YLSkyehibV50xSVwiXcL/8/0wFr5KLHloY58vraFJC87ly5YrVTKK+QYE 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:(136003)(39830400003)(396003)(346002)(376002)(366004)(316002)(5660300002)(478600001)(107886003)(1076003)(8936002)(83380400001)(16576012)(956004)(66556008)(66476007)(26005)(2616005)(186003)(8676002)(86362001)(66946007)(6486002)(54906003)(6666004)(36756003)(4326008)(66574015)(2906002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: HEX90+GxvWi+q6E3CLX7aTrARVmx4U2sZHF/2NaorXVCZ1GYfqq6Qo4ShLt5grKwtVHzePvL0GlXFKq/L2eUTJoIL0iayXWH/MwoygtVtdrgzUdKbQDQuT+iRcMwSeoraX8I2n3wwYapar5QVpeVj+n7ECvoTt+Bvtll3YC8ge+MLCJqAgSQT5J3avW4uwhUL03FH9Z6oS4GgvCF+jK1XPcL6bRNkosW+CVGJQshEzad8uXTtM5iH4CAz/iKTak8b8efyEWKxZwKiUDZ4NePa0ia+QH2g6WsbRM1gepGGbpt3RVlax9FV7LPhb9DEO5QvUlFXLSQHqaPmy4iyt8KRU4/ej3mH6VmnG9nKwqTxEqD8tsJ/DxchJux/hx+rZ8sQD84uvU4bthSrMHawR30jvETWrlCTWmNW8OrVOY8pk06f3UyEgxIXrnF76n+SjKyASUi56x1XbVbcBtOIhStID63cv42wJf3v+qjPQBrw1wk/MwLJG8mvYgPhJGS/vAHShpyg5TuiujrpYI9VLiByIrLKIrk9y3QL0L7+Xg06RUQt/DXYnF2G76D57/2zyLNW73aH1CebGQNT90xRqERvJG0+sfDLUIIQ+qYAHa1lhnw5j5udqvlKSYBjjQZA1lwJtLIed/jTTGUuvxOKttpPw== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 685e85d7-6b4e-4dff-a041-08d848d51e67 X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2020 08:59:05.1085 (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: gWY9Cj0sDgrWvz1gNnX5P08csWHUAvZVnz0j+wPWzIZoiWwe6XYFZOGpvo/Fcjx8A8gl4DjY9CBrR/XsPVMOYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3501 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller When mac80211 debug is enabled, the trace below appears: [60744.340037] wlan0: Rx A-MPDU request on aa:bb:cc:97:60:24 tid 0 result -524 This imply that ___ieee80211_start_rx_ba_session will prematurely exit and frame reordering won't be enabled. Fixes: e5da5fbd77411 ("staging: wfx: fix CCMP/TKIP replay protection") Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/sta.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 2b848b8985df..7a4c9f63c4a2 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -680,15 +680,16 @@ int wfx_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_ampdu_params *params) { - /* Aggregation is implemented fully in firmware, - * including block ack negotiation. Do not allow - * mac80211 stack to do anything: it interferes with - * the firmware. - */ - - /* Note that we still need this function stubbed. */ - - return -ENOTSUPP; + // Aggregation is implemented fully in firmware + switch (params->action) { + case IEEE80211_AMPDU_RX_START: + case IEEE80211_AMPDU_RX_STOP: + // Just acknowledge it to enable frame re-ordering + return 0; + default: + // Leave the firmware doing its business for tx aggregation + return -ENOTSUPP; + } } int wfx_add_chanctx(struct ieee80211_hw *hw, From patchwork Tue Aug 25 08:58:24 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: 259488 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=-11.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, RCVD_ILLEGAL_IP, SIGNED_OFF_BY, 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 D3538C433E1 for ; Tue, 25 Aug 2020 09:00:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 98C8A2067C for ; Tue, 25 Aug 2020 09:00:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="dCygFhYQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729687AbgHYI7o (ORCPT ); Tue, 25 Aug 2020 04:59:44 -0400 Received: from mail-dm6nam12on2052.outbound.protection.outlook.com ([40.107.243.52]:53959 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729646AbgHYI7b (ORCPT ); Tue, 25 Aug 2020 04:59:31 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XCVwmowTOOdBcrCMXMsAHGnXXJ9Z9PcZmPu2VXiIKbd4FwHqLIh5xooEetipioHhDkDtVIZZkduE//FP2AQPGkUcF3HNzmsnZx84HtDzlSckvw9FUggfk9sS3HnZ6XobNRIsWm+aMPFXDw86zwqj8byWPYqLkurYcVW9qvoJeB+RT59t7H7VVEmE7dMR/EC3FGdkmqMeTCqbaHw6eoSZdeRjbtC6dR5NQsPrCkPnKKzaqRwaJRVenqcTOvF8V3Ok1YDiaXGDA9oNF6gOw/vYh7FdqEDjCvI5sARYj7iZRFPfgzTFMFEdwQUwADe5acxKJg8cYBkdqUEhcg/DmIp81A== 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=vUCfAVxEEjw5fe6klsi9DKE0qPl2IHDqTZNcYCPBzxQ=; b=XfI3s2RnNLYEVlNoUiT58SbAsJY7SMLYxpAu08aw54Yy+BfEHSeNxoxAWhPSif8JtX3C9pArUb8tp1DPxvB+zTdVm8USusxueEJ19e49U9YvqwIrnesBnwlZD71Gk3mhG3+/NIk402l1FzhTQYmTp8MXAK1245tqbjL7c9CZweHHdZVYiBPj+SP5EMrBPdJckrYgqhD6p31/SpnDB+mi+xBJ5CYTKtNevJJ5Xh1GLbyJ2Jlne9KnbEfVI8rMwRJVYIOVH3vw4nhCH4g0s1x+2XQWaSY7oq3GtbVG3iPeHrY7oo6xOtE5cqzRwwyv7J2+RDGR9Cp2f5KFjtlIcOOn1w== 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=vUCfAVxEEjw5fe6klsi9DKE0qPl2IHDqTZNcYCPBzxQ=; b=dCygFhYQ2C/qUcqC8Xhf34BNtyDqieAq6L4DqAy7SAUmOaHZIuM5yRMuH2nilwW1eLp/ZVDGuCbrsbyDFW2DOtY8WEysAMNL3Ce6+SKw2RTsIhqQNMJy8Y3cJH0D2URWo1iRp5JGvEVFdnwk4jhDToPRgHr7bcTJwBEvkCCzRE8= 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 SN6PR11MB3501.namprd11.prod.outlook.com (2603:10b6:805:d4::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Tue, 25 Aug 2020 08:59:07 +0000 Received: from SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::85c9:1aa9:aeab:3fa6]) by SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::85c9:1aa9:aeab:3fa6%4]) with mapi id 15.20.3305.026; Tue, 25 Aug 2020 08:59:07 +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 v2 08/12] staging: wfx: fix potential use before init Date: Tue, 25 Aug 2020 10:58:24 +0200 Message-Id: <20200825085828.399505-8-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200825085828.399505-1-Jerome.Pouiller@silabs.com> References: <20200825085828.399505-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR3P192CA0002.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::7) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by PR3P192CA0002.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19 via Frontend Transport; Tue, 25 Aug 2020 08:59:05 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [37.71.187.125] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 95f51a34-5838-43f9-974f-08d848d51f81 X-MS-TrafficTypeDiagnostic: SN6PR11MB3501: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: snfEWsImJyio9guHSCrMeH3/FFsoJvuwpe5rgKjIJ3DdQ1eNj/XLUus+Xg7+mbJPNtXn/BjZPArv4PmZ2gCzkU3GvezwFZuuaIKqsyO9HvQ7gUTmX4kKR+Xs1/8ifdUKEdp/bbjYJZ/YrRt8lYvCB2q8TZePUMKDdcdSe10R23v8WjD905sBGqFLSFH29fBUtm0YCWSfzezdpobBBXYJwoLfTwp/i+rTEuomFEwuLu4S4ZjJaNgnjY5V+fvU9WR0Rm0bPeJO7swQo+XUVWTWl1YG5rVRD0Spddk+r2csxT1yTD6Gfo66rjZRVvgc90h4 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:(136003)(39830400003)(396003)(346002)(376002)(366004)(316002)(5660300002)(478600001)(107886003)(1076003)(8936002)(83380400001)(16576012)(956004)(66556008)(66476007)(26005)(2616005)(186003)(8676002)(86362001)(66946007)(6486002)(54906003)(6666004)(36756003)(4326008)(66574015)(2906002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 0dqNlV+XaIcVSytfSddL+5by+dPs2xeuzAwaGvRp8079faLgCmy22s4AUaverMnIyuaevCsSCnydcB555HtFuD7QcTBEwl04DrDqkRJ27T7pgvoMAcYNgsIuYU46/OuxnpK5hs7np43KSr6+465QxjxVwqJe3dVoe9Dlje8KhUzErUBZw4KY0HhtjX9rsacsFGD/QeRmhKUZWKXDu71jnijxb2MkirROFDaUlmYGpXMGXkv0I+aBXGaYwZtzE/OAEYGUdNfyt8IGlxxA1DUDHqExw9c6TIQ/Fvn+0c8Brto8IylPsZXab+0MpSiC04VJuhFjtaKBJkzS6mEeJ3J7SSl7EP2mOU07vn6nqUrQTbrYHLOmSe++SKJ4S3J17plz8eanDUe7mLfK6VnwbJqLlyDVj9eV0mzq8c5lCskIdMKTG+L1ga/swhSPzMcz8EQ9A6n2/+Dkpotb+cUDQMUvAU4zHxJiIuJqxgqlzXh34Y1gDVBhZdRhMh5oerqlZNPzU48+xzNX9+uoP2N7FlOiualShAxYMltIW4XeehMIhNSZBbztePV4xz1VwiKAR9HZyoOC2I/uI0ScT5kWTWvHN0EcjfM+wld0eZfzW+dYG57Dw6G3Zmoj8toYu8iRpn6CE7NfANmpZQDwxJHV65vRQw== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95f51a34-5838-43f9-974f-08d848d51f81 X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2020 08:59:06.9793 (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: w321RENZLfi7gXx7jtMjs+Q+SLxRsZPM6coviv02wjPJ6aFIFKCzJ5YyQABXLpct06+4XtoEoLue59bvY50Q3g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3501 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller The trace below can appear: [83613.832200] INFO: trying to register non-static key. [83613.837248] the code is fine but needs lockdep annotation. [83613.842808] turning off the locking correctness validator. [83613.848375] CPU: 3 PID: 141 Comm: kworker/3:2H Tainted: G O 5.6.13-silabs15 #2 [83613.857019] Hardware name: BCM2835 [83613.860605] Workqueue: events_highpri bh_work [wfx] [83613.865552] Backtrace: [83613.868041] [] (dump_backtrace) from [] (show_stack+0x20/0x24) [83613.881463] [] (show_stack) from [] (dump_stack+0xe8/0x114) [83613.888882] [] (dump_stack) from [] (register_lock_class+0x748/0x768) [83613.905035] [] (register_lock_class) from [] (__lock_acquire+0x88/0x13dc) [83613.924192] [] (__lock_acquire) from [] (lock_acquire+0xe8/0x274) [83613.942644] [] (lock_acquire) from [] (_raw_spin_lock_irqsave+0x58/0x6c) [83613.961714] [] (_raw_spin_lock_irqsave) from [] (skb_dequeue+0x24/0x78) [83613.974967] [] (skb_dequeue) from [] (wfx_tx_queues_get+0x96c/0x1294 [wfx]) [83613.989728] [] (wfx_tx_queues_get [wfx]) from [] (bh_work+0x454/0x26d8 [wfx]) [83614.009337] [] (bh_work [wfx]) from [] (process_one_work+0x23c/0x7ec) [83614.028141] [] (process_one_work) from [] (worker_thread+0x4c/0x55c) [83614.046861] [] (worker_thread) from [] (kthread+0x138/0x168) [83614.064876] [] (kthread) from [] (ret_from_fork+0x14/0x20) [83614.072200] Exception stack(0xecad3fb0 to 0xecad3ff8) [83614.077323] 3fa0: 00000000 00000000 00000000 00000000 [83614.085620] 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [83614.093914] 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000 Indeed, the code of wfx_add_interface() shows that the interface is enabled to early. So, the spinlock associated with some skb_queue may not yet initialized when wfx_tx_queues_get() is called. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/sta.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 7a4c9f63c4a2..a890fe32161c 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -759,17 +759,6 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) return -EOPNOTSUPP; } - for (i = 0; i < ARRAY_SIZE(wdev->vif); i++) { - if (!wdev->vif[i]) { - wdev->vif[i] = vif; - wvif->id = i; - break; - } - } - if (i == ARRAY_SIZE(wdev->vif)) { - mutex_unlock(&wdev->conf_mutex); - return -EOPNOTSUPP; - } // FIXME: prefer use of container_of() to get vif wvif->vif = vif; wvif->wdev = wdev; @@ -786,12 +775,22 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) init_completion(&wvif->scan_complete); INIT_WORK(&wvif->scan_work, wfx_hw_scan_work); - mutex_unlock(&wdev->conf_mutex); - - hif_set_macaddr(wvif, vif->addr); - wfx_tx_queues_init(wvif); wfx_tx_policy_init(wvif); + + for (i = 0; i < ARRAY_SIZE(wdev->vif); i++) { + if (!wdev->vif[i]) { + wdev->vif[i] = vif; + wvif->id = i; + break; + } + } + WARN(i == ARRAY_SIZE(wdev->vif), "try to instantiate more vif than supported"); + + hif_set_macaddr(wvif, vif->addr); + + mutex_unlock(&wdev->conf_mutex); + wvif = NULL; while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { // Combo mode does not support Block Acks. We can re-enable them @@ -823,6 +822,7 @@ void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) wvif->vif = NULL; mutex_unlock(&wdev->conf_mutex); + wvif = NULL; while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { // Combo mode does not support Block Acks. We can re-enable them From patchwork Tue Aug 25 08:58:25 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: 259487 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=-11.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, RCVD_ILLEGAL_IP, SIGNED_OFF_BY, 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 CED96C433E3 for ; Tue, 25 Aug 2020 09:00:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A82312067C for ; Tue, 25 Aug 2020 09:00:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="I93WFmi1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728972AbgHYJAe (ORCPT ); Tue, 25 Aug 2020 05:00:34 -0400 Received: from mail-dm6nam12on2052.outbound.protection.outlook.com ([40.107.243.52]:53959 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729648AbgHYI7o (ORCPT ); Tue, 25 Aug 2020 04:59:44 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Me4DxsiUxQmHgjT+of1CMTTTsRa1fiqFe0bfsEaHdvyxCjoywtbfTLapY5PLqK+fJVNfSDtiEskKsonWAgSLXFyjjQfZrMOBhQfJtEivzZ8nGmgTZeg2kyQ9MU6/rOFrtsK09UTWYlE8kLXO4vVbHIQiHzuoh/6/1VHb3YL7+K3DIyDlabYxPXeMeC3FuHpNuldcAGYTqN6o07xbhErqMSMDEPPUqfgB0ecTbpEGcimQGgj8OVr0D4OC7YVEyk6or7NCjQwcI+a0aBTam0RMeP3rSMfo2U8TPYmBMnepz8O3hY/kXwUsXFZBu1u3tw/rZrcOcymYu/KDt0Nl670MOg== 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=UpyoGU4FzcSEiHvu1sHhSwYfCgw6bHk1zKFXGBQ+uEE=; b=HsvL18Srt9jBf/GKDug+aWTPRRAkyJdW1GS1g6AwqKXUiJ5DfkuNq4tqyCBUK2QYqhUSstKbb6oL7HhUd7zT3eshfzv3lFZ2/BKJ61a7sXOs8UoCCKaxFzyUjedKgDQec4MXs1BODyte2AKGCYI3yDuFIRYQlxePjVkpEnrECOJEmcQvg5yawYKSsdT/cWv9KG1f/LnvkU+DRxR5r1R3QkLb8Xr4GKytEkLDKGUrYQH62GooQJOhhSYOVGgrPHKRRju37CahiDveRgPALZvzXhIY0t+BVtjJ0Gxkt+6Fu8UuA/FcMW5FCneM+L9aTBGv9pD6LOi8sJn1qlpUEqnRmQ== 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=UpyoGU4FzcSEiHvu1sHhSwYfCgw6bHk1zKFXGBQ+uEE=; b=I93WFmi1xx5FxS6L9Nmi9K9P2dO9YKG4Lmigb4r/ToQAkorgFbee2uJ+cRZvYjqA1TAU1YsqFyfk1BChzyqy3fk5hdG3e0hei1ayC+ScTYunm7gD1bqolxrM0FD+vmuk55oGI1p/U/LXzbMkSOqrsfQ2ko6Ud0yCR4xG78UKFJU= 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 SN6PR11MB3501.namprd11.prod.outlook.com (2603:10b6:805:d4::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Tue, 25 Aug 2020 08:59:08 +0000 Received: from SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::85c9:1aa9:aeab:3fa6]) by SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::85c9:1aa9:aeab:3fa6%4]) with mapi id 15.20.3305.026; Tue, 25 Aug 2020 08:59:08 +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 v2 09/12] staging: wfx: scan while AP is supported Date: Tue, 25 Aug 2020 10:58:25 +0200 Message-Id: <20200825085828.399505-9-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200825085828.399505-1-Jerome.Pouiller@silabs.com> References: <20200825085828.399505-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR3P192CA0002.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::7) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by PR3P192CA0002.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19 via Frontend Transport; Tue, 25 Aug 2020 08:59:07 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [37.71.187.125] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bb83dc8e-ebb7-4844-11ac-08d848d5208d X-MS-TrafficTypeDiagnostic: SN6PR11MB3501: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:901; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lubL0CajL2PuEkctUBhWb63qwCy1VsAkX7PSl/ipDLHIc6SPhdU4v1TyBBQCl22U6yS81ZV1Yckfnf/K4/omLNpbAkHMPRaWYMNGTOtJBboPMJOLjNmHAAUknq79s7IVVJhKdInxfpoXEzJhzp0V8pPXPR0vZdQ+WqMvlZYlMR+vJdn38Oa2d3o+5l+DhJ//9uhHd3+f7RnQi75BZIcI9tsx6KFRqavZASzvNFKEcS/RAPziC62aojDikcro5JiNh1dQlp8Hr64hq0DZNq7VwT7NLynrKcKoFvaZQ2xyYwetnT1U0LvjwNq/G3K3kA1yrJwhSubdmmU+L2o3a1JczQ== 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:(136003)(39840400004)(396003)(346002)(376002)(366004)(316002)(5660300002)(478600001)(107886003)(1076003)(8936002)(83380400001)(16576012)(956004)(66556008)(66476007)(26005)(2616005)(186003)(8676002)(86362001)(66946007)(6486002)(54906003)(6666004)(36756003)(4326008)(66574015)(2906002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Jmb0Nse3aCxOW+60unnb7Q0FERusZ43oSKAU+3iHk/u93LvrQr5sSvITaeyH9LGhf7EhBF3CdmKJiKESkbTSb+trON8MdBG3+ef1BV5bydp3Me/CJK5vhGn2pJ+8ApoUigwERdccOT8Vk3a+7nT8d/Q+3LHe3f6dSMBKLgOuefluayJsRof0zW0s8gsC1RahnR69Z8Pr8/5oHdX7s8LFWhJIMqAzT+8Ov/oXh1NWc+FiL8HUtdpdBgEqU01ijX6fR5FVFs/GK057sQ3qnzq4Blg0xeKcE4nteqLH01WOkrS3+hBgIGBOi4pegSdcH+VrpmUZrj1cgOP/GbNaVggbltd6EJY6eip1FZV/7SFwQUBkvtn1nzTLnz11tB3Tsti446cNJzYToghrCD1Qz/NdgqVPudbenkOKyrQ9Lz744pJbfZsRt4HW+vMj5Eq5gEP6qH6+URSDAb2AACtbZcd1cu7BoxLFqKdrrJfoTE60Yy1v/kbmLRpjV6wugtIlimsHW/uEA7e55ajDBMzUA40boTMSq+8WNOwCQoxHPQ15rYuNxzdnaaVfr1SusYt1nrrGxTFyn0V2MfdfEb5xtY5n2PpXwx8WUUNp9VTJGN9dXdA5h4GaKd9qyl3c2IefqOQLeSDOOmYAmf5zd6tL5Q1EoA== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb83dc8e-ebb7-4844-11ac-08d848d5208d X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2020 08:59:08.6453 (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: ZjTlLJ1IaaOpITAeQkdLFnpUgvFZWu50ul8DvN4Ewix594RVm96Wr1RgzuTCP999wX200hrlg2XuDNtzdwnfYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3501 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller The device is able to scan while running an Access Point. Just declare it. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/main.c | 1 + drivers/staging/wfx/scan.c | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 4263f912760b..5a3018e14445 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -282,6 +282,7 @@ struct wfx_dev *wfx_init_common(struct device *dev, NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 | NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P | NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U; + hw->wiphy->features |= NL80211_FEATURE_AP_SCAN; hw->wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD; hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c index e9de19784865..02d4e653d594 100644 --- a/drivers/staging/wfx/scan.c +++ b/drivers/staging/wfx/scan.c @@ -113,10 +113,6 @@ int wfx_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; WARN_ON(hw_req->req.n_channels > HIF_API_MAX_NB_CHANNELS); - - if (vif->type == NL80211_IFTYPE_AP) - return -EOPNOTSUPP; - wvif->scan_req = hw_req; schedule_work(&wvif->scan_work); return 0; From patchwork Tue Aug 25 08:58:28 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: 259489 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=-11.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, RCVD_ILLEGAL_IP, SIGNED_OFF_BY, 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 632F0C433E1 for ; Tue, 25 Aug 2020 09:00:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B5A02067C for ; Tue, 25 Aug 2020 09:00:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="i6F8LNj5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729259AbgHYJAH (ORCPT ); Tue, 25 Aug 2020 05:00:07 -0400 Received: from mail-bn8nam11on2079.outbound.protection.outlook.com ([40.107.236.79]:20448 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729698AbgHYI7w (ORCPT ); Tue, 25 Aug 2020 04:59:52 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eNmZyHti2awJ+PjzQxAtPTTIfO7sAVKwaBpcNzj2Ijiecmr9Xwsu+UwE88Jl4hVCCUK3rR8FjLP9Z1py9piA6xEuI9OKN0roTYKlbCBJNIZcyRFjVskZ5Sh08Xq7Kzrc9PXHDBgm1AVOVQLg/OWPzu9jL6bKA0jl86LQl5Di/M186XYJ5D9LsURT340m8uJH6Ml1fq/DDIdt2jc17Zvw/dG2kswbyO1GQtxXBUUu4U2z5XiW25cw95UQav0bQ1x3KcLCvFbfNxBtTAQsqCqpjydEF1Q7W9y6PnrQHbWbguX4uDU539PEQL1bgtMcuQbX+3CPT534z2JfTqB6tqK4hA== 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=vnx1LDN0uuuMoQM1TsWcaSizN1CAv69/PathJt1c3xk=; b=RaWMdu4U3iswcJ73dFLC64Yi9LuoBJE9j2iilKI/4VEXZ89+FnVD8LIs3J0iwmoeRRdTewQNTk/koVDFF4yakfOAYrSTsD/UH06W9I/b79lcl6EV81r30SOQ/8DqW3R8wMKo6Sa/ouqKPvLCAgiaGgoy6gbaQwpDbjYyB+zAITBju6hPukxqNCHThSRUEJRmt4D3antA2e7K1IHa7LI2DrS8niXw7WcrVQd+KQJTk++jLyN4VfxtYsif+gRUaYIvayY7qNkiq1AU3JcUI0AU4PolS/Y1veKnGf2E90pTAdCAOB7yjd5WWLu0k0XRt61j4DYSmaZOVFiNxeI8FZQvqg== 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=vnx1LDN0uuuMoQM1TsWcaSizN1CAv69/PathJt1c3xk=; b=i6F8LNj57OsC6J/OakfmsQF1ibeUlh0I0c/sDXdMHHwdBlMiYWu2SNrZ9y7CAOf7LG9nFKhCP/XfrSJmPeO6sx2mDg+hsd3dlG/SJG7dLBfej8NIjHPHssSJYVq4Q181ncYuZUhkoYBP5ehx1++j8LXgta8ODz5yAehuTfBl7m0= 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 SN6PR11MB3501.namprd11.prod.outlook.com (2603:10b6:805:d4::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Tue, 25 Aug 2020 08:59:14 +0000 Received: from SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::85c9:1aa9:aeab:3fa6]) by SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::85c9:1aa9:aeab:3fa6%4]) with mapi id 15.20.3305.026; Tue, 25 Aug 2020 08:59:13 +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 v2 12/12] staging: wfx: add workaround for 'timeout while wake up chip' Date: Tue, 25 Aug 2020 10:58:28 +0200 Message-Id: <20200825085828.399505-12-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200825085828.399505-1-Jerome.Pouiller@silabs.com> References: <20200825085828.399505-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR3P192CA0002.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::7) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by PR3P192CA0002.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19 via Frontend Transport; Tue, 25 Aug 2020 08:59:12 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [37.71.187.125] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ba1e38ea-2b63-42b1-221e-08d848d523a5 X-MS-TrafficTypeDiagnostic: SN6PR11MB3501: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NDtufFFnrsC2nvuLCjdQZBRtM5Aft7Q5C61avkj29Wyj5j3xwrtoJiz+K+6UyGu07O3KKGKdimPdYF4iBxfREmHhplnb/MCuRQGfk9jpC2PNteSh87Kd0aiUBpHdiVWlfvwv6W5u6cOPaPxeYRo8MpdPVsd9z4NvPDtgFHSaNu2VlXtQkcmJFaA40hF6wReQpGISbLpeVqsyhCW2rJRtP41eX1VJtt1vhoBFnD+TjCnxUngBKEWNRnlKu6kjmr5g279tDp7lfM49CBpMMaugDIo+G0k04R1YfwyaOAcgu2FskejVMGlbDs4rhLCsO+No/cWHm/pKlS78enOS29ETCA== 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:(136003)(39840400004)(396003)(346002)(376002)(366004)(316002)(5660300002)(478600001)(107886003)(1076003)(8936002)(83380400001)(16576012)(956004)(66556008)(66476007)(26005)(2616005)(186003)(8676002)(86362001)(66946007)(6486002)(54906003)(6666004)(36756003)(4326008)(66574015)(2906002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: f13mqyYVwoQjkqKO41tGA5hckam2pEE7ev+Iv9Hfyen6aNsC1fLIm0DBQaL5LwiE+wCZtM50LaPaab95HL4D7eT6ukCf2djvvsRx6zRU/ONuHbJSErg4ixZVdTjvGdNgITNjD5/NeD7QwZG0DE/Bpn2ofoq3E6GbaKwMwFgHonwKNmrJoDmUNZVBh1VzNvmKgk5qkzO2W3zuR9JFjdrH41EqNyfetZTzPMoOPzulhPekNBCtf91KzX0FVRpTQPc3+gxPrwoW0V1CgP2i/+D/fs7B6RVlNMi3XvGhOTQxap+MmFNrqjHJGVvY6AiSoSY+AR2ezNvapRPuTUzuXR26LifqPvhUlRQTQt6jlJuK6zhNPpQTTibFtmjI/ATvsbNrGbQsR9AAUlpa6nC32XIYCNFBzY1TPqAN7ZnShpU4A5WEh5NcRJKgneJ45hE3g6mKAXdcd5pFPwYCrTh3z2qglm7E2DiPushyZMdkdRC8TnlUi63Yh1ocY3QKJ5n60/8q6LYabohk88ggl5+fnvhWyaJWeFk153CeVuNCL3jumkrxzO95+3QJdr1/0xjNtYr3vpDBOg69KJBgaOT0qLeXS078lChuste+Mz7XkD6Jz1okoU4a/kOVS/aYDVpWZf5CMa248VMlpTCokQ88+I3Plg== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: ba1e38ea-2b63-42b1-221e-08d848d523a5 X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2020 08:59:13.8102 (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: NZBmieBIdOohjB5kZQvBpvFzvAzZMnlJLbv2+1Ml3felXp7EyZ+Qj3vrijhfb7eMys6QXDKWm51DS9ChJjgqwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3501 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller The host and the device can be connected with a called Wake-Up GPIO. When the host fall down this GPIO, it allows the device to enter in deep sleep and no communication with the device is no more possible (the device wakes up automatically on DTIM and fetch data if necessary). So, before to communicate with the device, the driver have to raise the Wake-up GPIO and then wait for an IRQ from the device. Unfortunately, old firmwares have a race in sleep/wake-up process and the device may never wake up. In this case, the IRQ is not sent and driver complains with "timeout while wake up chip". Then, the driver tries anyway to access the bus and an other error is raised by the bus. Fortunately, when the bug occurs, it is possible to fall down the IRQ and the device will eventually finish the sleep process. Then the driver can wake it up normally. The patch implements that workaround and add a retry limit in case something goes very wrong. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/bh.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c index 07304a80c29b..f07bcee50e3f 100644 --- a/drivers/staging/wfx/bh.c +++ b/drivers/staging/wfx/bh.c @@ -18,25 +18,40 @@ static void device_wakeup(struct wfx_dev *wdev) { + int max_retry = 3; + if (!wdev->pdata.gpio_wakeup) return; if (gpiod_get_value_cansleep(wdev->pdata.gpio_wakeup)) return; - gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1); if (wfx_api_older_than(wdev, 1, 4)) { + gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1); if (!completion_done(&wdev->hif.ctrl_ready)) usleep_range(2000, 2500); - } else { + return; + } + for (;;) { + gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1); // completion.h does not provide any function to wait // completion without consume it (a kind of // wait_for_completion_done_timeout()). So we have to emulate // it. if (wait_for_completion_timeout(&wdev->hif.ctrl_ready, - msecs_to_jiffies(2))) + msecs_to_jiffies(2))) { complete(&wdev->hif.ctrl_ready); - else + return; + } else if (max_retry-- > 0) { + // Older firmwares have a race in sleep/wake-up process. + // Redo the process is sufficient to unfreeze the + // chip. dev_err(wdev->dev, "timeout while wake up chip\n"); + gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 0); + usleep_range(2000, 2500); + } else { + dev_err(wdev->dev, "max wake-up retries reached\n"); + return; + } } }