From patchwork Mon Sep 7 10:14:52 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: 261438 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=-12.7 required=3.0 tests=BAYES_00,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, 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 1DE9FC433E2 for ; Mon, 7 Sep 2020 10:16:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D67A8207C3 for ; Mon, 7 Sep 2020 10:16:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="QrHGsC2V" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728720AbgIGKQU (ORCPT ); Mon, 7 Sep 2020 06:16:20 -0400 Received: from mail-eopbgr770058.outbound.protection.outlook.com ([40.107.77.58]:18596 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728524AbgIGKPz (ORCPT ); Mon, 7 Sep 2020 06:15:55 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bMey+gz+G8ZFnBVhWNhZPlGPyUVOaGQTRZt6n3fXhPOT69NgyD++kkoC4APsrpwujhtkuGNCeKcA2CwOf5Wc7RR0nrzbDGHZexFvUWPlwSnVbZjVX2s2sm1muSU1xRhptapgSNxmIaj15B0GGX1jhBHj0oMXYgrTuxQMUEC5Pg8HP5ecmKJRZBgigNshRWM1gdymp0gRzqEo3ernkj2W6W4bQkAvB1Mr6jiwUCvsE/3u816nk3ulXSVu4o1DxbeaL/s2WpkWGw8nmX7QMhIWjBa3gqYYWH8Nv/UbJxCG+AwQuzE1fKxFDk/9W9Ql2tD9HjpPAFMugRgYDA0/s5pj6Q== 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=lG4N+ZCAjhIEwblMAIWNjkT8FzQkA7YkgRQ+/QD2z+4=; b=FZHlJ6c7AOEnkYKMw3ptikBgVEZsJCRQIqkBLFxxF5t4JxvPBCGfCArG8dqGDJDLVVuXRGFvtf72zDYPcfZimOyKqNhhVrnc37uzf8bU0YhtGAO7bYdfOzYLeBMqtQ6qTuAY2FOPI8RVRTFOuW9SZVQQa1/K+YnZADLNjK4uoNzwIYK7PUTSIZPnJtyPKou4Xxzs5Rvpqgka5L5yiKtcON0AN4BaVU5PND4Y8txEh4rtx1k8KjSlYppjuIRVD+3QiI36ZhFoN53AuGcc2fE74b5xboEpQjWmqi4iaDUd5T1NEq4TxDUmIiCBRi23g1lO5tOaXpOw0swwXc/FFH3pSg== 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=lG4N+ZCAjhIEwblMAIWNjkT8FzQkA7YkgRQ+/QD2z+4=; b=QrHGsC2VLp8ZB0UAKbs1D4yC6wGALM20WGgl9/AevuZaihJVMKS/ZCrcflmbrE/Ez13YaR5TRN/Kt1sjtsvSr8B2t5sq7I51V2DvSHlz+nZd3RUH2ozH7XELQ9TkwRkQOOxccW3dUGOUJzp8YIaHO9WtWo3HUZ1Vmuk7ceY1Vow= 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 SN6PR11MB2606.namprd11.prod.outlook.com (2603:10b6:805:55::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.17; Mon, 7 Sep 2020 10:15:47 +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.3348.019; Mon, 7 Sep 2020 10:15:47 +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 02/31] staging: wfx: relocate wfx_join() beside wfx_join_finalize() Date: Mon, 7 Sep 2020 12:14:52 +0200 Message-Id: <20200907101521.66082-3-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200907101521.66082-1-Jerome.Pouiller@silabs.com> References: <20200907101521.66082-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR0P264CA0109.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:19::25) 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 (37.71.187.125) by PR0P264CA0109.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:19::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.16 via Frontend Transport; Mon, 7 Sep 2020 10:15:45 +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: c15e049d-bc57-4eeb-ec28-08d85316fd02 X-MS-TrafficTypeDiagnostic: SN6PR11MB2606: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 72Sp/MfNuas5b9iCu9GJuwog1/vwLVFaKRnjuD83BpG55fHZEB3TBlyRBHynw4VYsgWuP5qGn8YoIXgLyFXblWPSYRc0+Da68RQmJ0a2Mqpma7LgIC//o0oNbLT9aSO2+GKJ+NElZCgT7sSnaGxrUJ3BdZoHsdsfvQg/c+/O6LJZn8tdJewQKr1zPg7F7cwGvgDBPn7uhv8xFLDhVJrZen1zak+DswRd9VJGsrTwbqd62E4To6dOmduc6bZrqLYRoXykih0MbthQgiKs6MA9nHXNpuyCN7ry6wH/CxY5y5l9A8I/rPx9MsZMigTb3tSxMldo586vUX+intQxEdv1mw== 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:(396003)(376002)(346002)(366004)(136003)(39850400004)(66946007)(4326008)(5660300002)(2616005)(66476007)(316002)(956004)(478600001)(6666004)(54906003)(52116002)(2906002)(66556008)(1076003)(36756003)(8676002)(86362001)(6486002)(8936002)(7696005)(66574015)(83380400001)(26005)(107886003)(16526019)(186003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: TeESUgAIkp5iGygOXN28BV80Ya34fLYjcvoLFvNMImDv0dfvjtRgugTprPfMpX11wyrsNHb50Ej13QPv9WV3tgKL9l3oS71XCtHMBWInEWNZlo6r9LByHD9C0EER2v7naKBwl+9ZFPQxe2EsDVWuRnO1GLLUay7t80w/bLXw/AFNokuLryEGcEUNrRX743P379TzsPGLWygXfFUkZAZQXlIMJx+tUT9iNgtZQQXHxAt+Fyy+U6pd4+zbNFU9HXMhfQjzgiX5Tn7BypM0EKwIowQJ2KgU0nvm3KjvfkOIUWJTR2InY2M3ObzgeTm+VjpRs5bHVh6ziXTRJPpTySgXLluuJ5VE04e2ptTUbWXicHMvJ2VtIqcumCERML82MOzIvoAQiqLD40PZhrcmip/OFmJ2ZPltCZ2epgbNy8/yekmLDP+2i0ivi/cM26Gwisw6ScoBgZ1XUVXo1XBDChVLjhuUv0JpHSqzw5nDAtp0c8xsyF6dGjjOWiIhMJyPCAdWjOZ2UpFpEbwNke/O05vWcRumdHCYDi3tl12IB3/te0bWqEgRlXaG97U63T2Rdgix2LJi8EneL98tGiT6bMtVuJD2xqm2chyfb/eHkV3/fjaYAnd5v7pIR6ye2RtdfXJlR770OxDtyACTsuTdubmgjw== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: c15e049d-bc57-4eeb-ec28-08d85316fd02 X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2020 10:15:47.3947 (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: x91OlafsgrT/214h86THXYGfFvPzhEcg0p7kdFfha23OUjzbVchuI2QoGL8KpyOarAwYRgxjjOeIR6U9tDjx6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB2606 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller wfx_join() and wfx_join_finalize() are the two halves of the association process. Group them. In addition, for better uniformity of the code, rename wfx_do_join() in wfx_join(). Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/sta.c | 100 +++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 502967874373..b2a29b2ac20c 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -340,54 +340,6 @@ void wfx_reset(struct wfx_vif *wvif) wfx_update_pm(wvif); } -static void wfx_do_join(struct wfx_vif *wvif) -{ - int ret; - struct ieee80211_bss_conf *conf = &wvif->vif->bss_conf; - struct cfg80211_bss *bss = NULL; - u8 ssid[IEEE80211_MAX_SSID_LEN]; - const u8 *ssidie = NULL; - int ssidlen = 0; - - wfx_tx_lock_flush(wvif->wdev); - - bss = cfg80211_get_bss(wvif->wdev->hw->wiphy, wvif->channel, - conf->bssid, NULL, 0, - IEEE80211_BSS_TYPE_ANY, IEEE80211_PRIVACY_ANY); - if (!bss && !conf->ibss_joined) { - wfx_tx_unlock(wvif->wdev); - return; - } - - rcu_read_lock(); // protect ssidie - if (bss) - ssidie = ieee80211_bss_get_ie(bss, WLAN_EID_SSID); - if (ssidie) { - ssidlen = ssidie[1]; - if (ssidlen > IEEE80211_MAX_SSID_LEN) - ssidlen = IEEE80211_MAX_SSID_LEN; - memcpy(ssid, &ssidie[2], ssidlen); - } - rcu_read_unlock(); - - cfg80211_put_bss(wvif->wdev->hw->wiphy, bss); - - wvif->join_in_progress = true; - ret = hif_join(wvif, conf, wvif->channel, ssid, ssidlen); - if (ret) { - ieee80211_connection_loss(wvif->vif); - wfx_reset(wvif); - } else { - /* Due to beacon filtering it is possible that the - * AP's beacon is not known for the mac80211 stack. - * Disable filtering temporary to make sure the stack - * receives at least one - */ - wfx_filter_beacon(wvif, false); - } - wfx_tx_unlock(wvif->wdev); -} - int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { @@ -496,6 +448,54 @@ void wfx_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) wfx_reset(wvif); } +static void wfx_join(struct wfx_vif *wvif) +{ + int ret; + struct ieee80211_bss_conf *conf = &wvif->vif->bss_conf; + struct cfg80211_bss *bss = NULL; + u8 ssid[IEEE80211_MAX_SSID_LEN]; + const u8 *ssidie = NULL; + int ssidlen = 0; + + wfx_tx_lock_flush(wvif->wdev); + + bss = cfg80211_get_bss(wvif->wdev->hw->wiphy, wvif->channel, + conf->bssid, NULL, 0, + IEEE80211_BSS_TYPE_ANY, IEEE80211_PRIVACY_ANY); + if (!bss && !conf->ibss_joined) { + wfx_tx_unlock(wvif->wdev); + return; + } + + rcu_read_lock(); // protect ssidie + if (bss) + ssidie = ieee80211_bss_get_ie(bss, WLAN_EID_SSID); + if (ssidie) { + ssidlen = ssidie[1]; + if (ssidlen > IEEE80211_MAX_SSID_LEN) + ssidlen = IEEE80211_MAX_SSID_LEN; + memcpy(ssid, &ssidie[2], ssidlen); + } + rcu_read_unlock(); + + cfg80211_put_bss(wvif->wdev->hw->wiphy, bss); + + wvif->join_in_progress = true; + ret = hif_join(wvif, conf, wvif->channel, ssid, ssidlen); + if (ret) { + ieee80211_connection_loss(wvif->vif); + wfx_reset(wvif); + } else { + /* Due to beacon filtering it is possible that the + * AP's beacon is not known for the mac80211 stack. + * Disable filtering temporary to make sure the stack + * receives at least one + */ + wfx_filter_beacon(wvif, false); + } + wfx_tx_unlock(wvif->wdev); +} + static void wfx_join_finalize(struct wfx_vif *wvif, struct ieee80211_bss_conf *info) { @@ -514,7 +514,7 @@ int wfx_join_ibss(struct ieee80211_hw *hw, struct ieee80211_vif *vif) struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; wfx_upload_ap_templates(wvif); - wfx_do_join(wvif); + wfx_join(wvif); return 0; } @@ -551,7 +551,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, changed & BSS_CHANGED_BEACON_INT || changed & BSS_CHANGED_BSSID) { if (vif->type == NL80211_IFTYPE_STATION) - wfx_do_join(wvif); + wfx_join(wvif); } if (changed & BSS_CHANGED_ASSOC) {