From patchwork Thu Aug 20 15:58:49 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: 259555 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 C21BAC433E1 for ; Thu, 20 Aug 2020 16:03:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 98F50206B5 for ; Thu, 20 Aug 2020 16:03:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="aAZ8vie/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729554AbgHTQD1 (ORCPT ); Thu, 20 Aug 2020 12:03:27 -0400 Received: from mail-dm6nam12on2046.outbound.protection.outlook.com ([40.107.243.46]:36576 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728047AbgHTP7k (ORCPT ); Thu, 20 Aug 2020 11:59:40 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q9Wf+oqpoX23EEG/JLLNKcgtx5edUttZZAa/Nftt7LG0wDD89YYLUV3fLSxP5hr4XH60rpH7M0wNvgmo3HVSW6gMD9WL6t+JenVSdAjEklR8QjoC2eNzR1U6ijdT4bUw9LIIalTpLt0IMTrnkCdYJbkLLouhepOzcvqV5xeLC03d0oVKk5hx+Cc4Bu/i86XN40cK3S68WpVANYeli4qmURo+D37r8+6epnC8enllhmjLKzITXUvuN5fOo4jEtLj1O4N6FuLf/ETgqMnXCrzwrgZXxctONdWBzKmVwHT4+oHapv6QZZVxmvIm4a8wEhQ2qgo519c7wNSKnvhdIX2wbA== 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=xJrlJiwuPnQD82THeatQCST2HXpbIjrjeukM3c1SBBk=; b=ayPJu68nZnYkkhPA6j3RLHO3Et0BxzQrXRMU9c8ok1DiDiKnu9H1q1qypFgRlELmB1akt+zYbX/YtVyucYAU7jyJL9ld7xzRPTsi9mVs6rXhJbLiTHOHCqvuSb6DeajuMMqOGD+ogTmRvYR1P5LgOjoBUnugt2jWR2or0iHejgLaItLYUrOqicdz4bBRmgdrotogYwt6EZHIHXPDMA4ZyouytOYXxfesZBD54W64BjqvTdSDORbg4HLZWwpfJq6QM6x+GcuZnyqaGMMR8REqVCgmZh2u8HMcgyKDtJpROP/WA0jcxQ+Wku+ESumitLo/3S1vGa6WK8WX5HAeKGc3jw== 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=xJrlJiwuPnQD82THeatQCST2HXpbIjrjeukM3c1SBBk=; b=aAZ8vie/KA1/pS7V830njV0CUxbOxswxH7WUnTweJL+A9lC5wJDGoqYL4GEZnFdN/7oGcM6f3042qBPex+L7ftvzrIY/ZA2jVrKxs5v1nQiyaoFBvBtv+LUUp/b/XyV+w55cEP3e5ut5J97xy/BGU6iCaojsI3Qmy0FNiiWcJXc= 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 SA0PR11MB4541.namprd11.prod.outlook.com (2603:10b6:806:94::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25; Thu, 20 Aug 2020 15:59:27 +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; Thu, 20 Aug 2020 15:59:27 +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/12] staging: wfx: fix BA when MFP is disabled but BSS is MFP capable Date: Thu, 20 Aug 2020 17:58:49 +0200 Message-Id: <20200820155858.351292-3-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820155858.351292-1-Jerome.Pouiller@silabs.com> References: <20200820155858.351292-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR0P264CA0122.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1a::14) 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 PR0P264CA0122.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.24 via Frontend Transport; Thu, 20 Aug 2020 15:59:25 +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: 46c7336c-edaf-4c36-d179-08d8452203e2 X-MS-TrafficTypeDiagnostic: SA0PR11MB4541: 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: apO9F439yuO1mjUcEpINO+zLzxofdqjsQkTTC718OEl+GWhu76XtQS6B3svCVsEy3n711aHzQl5SFZVet4SaKsXBoJ5/hOwOp2QDqLAI7TwcdzUfhfaBXQ9lv08PUmD8dHWpDQD0/SQotZQtXB60iJDl74Yfr2H6zpbsX2KpB2fJsXGd8AWcYVLTLhe5bUe5VU3cL84ivj97J2kiqNCDawnBPKrs9ADDfU8FYDn+ScmBFJc3jNcLQzrH3RUGyWsHMeQ2S7EHbyCyU5gUlr2sl7GgCf56ysqGB6tthd5SP/0RdRGZz9c5ycwcq29z5077cpcoZmEwvg71i9RsqtEfhToIrpe4SroWPVFiUERIs0xBXEhI0hlFZKiDOm0olwHi 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:(376002)(396003)(39850400004)(366004)(346002)(136003)(186003)(6666004)(2906002)(8676002)(316002)(16576012)(54906003)(956004)(26005)(66574015)(8936002)(2616005)(110011004)(52116002)(83380400001)(107886003)(1076003)(5660300002)(478600001)(36756003)(4326008)(66476007)(66556008)(66946007)(86362001)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ytRpAfXwoVbRbepEEgj1qcRuCb4YTF8epSBr8n2z5rIdTjnx9I0Uio8+4SEehmn3oVu5qEPhlM+E+C3rB0KDS8ENC7atHGxpy9z0cgpY6jFXLI86n5W7BJUEFrkMnGwjnJqDjBGENhjT5fS8TXvtrUNoa5oAiEz1JtSQn58RKYxkvugIRF4yRyb03KFbdpBJCD5qESnsL/+0eCWjoMAgv8yOX2c2NQbz6MYxUhkNegf7jeMU97f5g5L0JjX4hIHwBY7/tUNEltdBoQdGhf5EyCYKDaygWfq4/eqnzr+YhxdR9qU9tQME1CFDPyuBfTcB7/4uOn8aSUGSC/Wv4QysWDCcAHFaYnTNZfCWe2dCmGFjLR1LUf7Me1bScM7uEF73nP+hEy2IjByYnRZAVvIj0sJrEsGIkQGdm+XhDUk3jHLGIglekcmxDNEtz/JEW8EoxqJZHAnA8sH0Zdca0ceRPO5VPeZDKJIiuZ8v9ae2gTPP/XP+KK3zCR1dvO2kMafqhRSShN4qJEBbJEdpEfMuPuOU8To77s4Bpx8sXFYP6b0CnWSPTpndxncot0PHsqJyd6OcJqR3hx3aAq8W0+7pecJ6qn0Q1THdvuAoDTMSvlSRPXWzv50Q2lRr/lTJyDwoGiQGvv0zAv7FGq9aYkyBzQ== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 46c7336c-edaf-4c36-d179-08d8452203e2 X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2020 15:59:27.0865 (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: FKFQWgKf9hdeki4Ej+cZsdKpi24sEjueR+lCB2iryL+D6gwPnOVqIe1NDpFx7BRMeKEy08fJfW1AuQoxl87o4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4541 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 driver directly read the RSN IE of the BSS. However, it didn't work when the BSS was MFP capable (ieee80211w=1) and the local device has disabled MFP (ieee80211w=0). This patch read the MFP information directly from the struct ieee80211_sta. This information take into account the MFP negotiated during the association. In addition, the code is far simpler. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/sta.c | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index d2e9cf651c81..20db4bbdd901 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -323,36 +323,6 @@ void wfx_set_default_unicast_key(struct ieee80211_hw *hw, hif_wep_default_key_id(wvif, idx); } -static void wfx_set_mfp(struct wfx_vif *wvif, - struct cfg80211_bss *bss) -{ - 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); - const u16 *ptr = NULL; - bool mfpc = false; - bool mfpr = false; - - /* 802.11w protected mgmt frames */ - - /* retrieve MFPC and MFPR flags from beacon or PBRSP */ - - rcu_read_lock(); - if (bss) - ptr = (const u16 *)ieee80211_bss_get_ie(bss, WLAN_EID_RSN); - - if (ptr) { - ptr += pairwise_cipher_suite_count_offset; - ptr += 1 + pairwise_cipher_suite_size * *ptr; - ptr += 1 + akm_suite_size * *ptr; - mfpr = *ptr & BIT(6); - mfpc = *ptr & BIT(7); - } - rcu_read_unlock(); - - hif_set_mfp(wvif, mfpc, mfpr); -} - void wfx_reset(struct wfx_vif *wvif) { struct wfx_dev *wdev = wvif->wdev; @@ -400,7 +370,6 @@ static void wfx_do_join(struct wfx_vif *wvif) } rcu_read_unlock(); - wfx_set_mfp(wvif, bss); cfg80211_put_bss(wvif->wdev->hw->wiphy, bss); wvif->join_in_progress = true; @@ -427,6 +396,9 @@ int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, sta_priv->vif_id = wvif->id; + if (vif->type == NL80211_IFTYPE_STATION) + hif_set_mfp(wvif, sta->mfp, sta->mfp); + // In station mode, the firmware interprets new link-id as a TDLS peer. if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) return 0;