From patchwork Mon Sep 7 10:14:53 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: 11760405 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0853F746 for ; Mon, 7 Sep 2020 10:16:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DC93421473 for ; Mon, 7 Sep 2020 10:16:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="dkfBqzFf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728648AbgIGKQF (ORCPT ); Mon, 7 Sep 2020 06:16:05 -0400 Received: from mail-eopbgr770081.outbound.protection.outlook.com ([40.107.77.81]:21675 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728578AbgIGKP7 (ORCPT ); Mon, 7 Sep 2020 06:15:59 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gm8PFqYSvQkiuv6WbsLwvBZWnpPBx+F9Nep6oaVZBVrQMoJ56rY6A+vHCTAJ2AkeGzMUPgbIUhvOMFWeTKSwbKeokjO69DwTH2cx9+3lehAqltyQMmbFsn2SEpeI2cKLwJLHDgmt3Cs0ltEg6h3P07otkxsA2zfN+IAexDuZW3D5Bvio6k3tDBqdsTSIIvrgjndPwsgvpRpnjVucebo+rRbR1l5a2o55Pz5TPrfQTR1zF6gdI6nZQF2CGSU/MkH3altIXEeZoS0ByahwdS0oH7XGjn/cau5lG5P2QXwelJ4/mYwaaHpaJXuHqolvYP1Oqn8DCQnLe9WGY1PEQti0Sw== 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=D2jM+kgD2WXgbBXIjo869uKm6EUwRZpEWfSKlncRfho=; b=JtzQAlpmYeX2ATtAnTBKeENQRTZy7XL27SKDfHJtuE8NLjplvRxcbRgX2JsOlS4QtaRtM9/OVGMMWjnNqaz/F5O3u8bi0wzNDdk5zX/8pRgiLqpa4oKMAvLTDJyyA7Di3DigYyU8G7nFkwB6j1opqwGaJPXpVMPU0teIwFM3/njNpufW9glp4lD0P0ZKitxwt5Id3W3wpPY46P5vQm0mQQA7HxDyvjczrOrq4Zuq/JS/733F6Lb92v8Laj8VSalBR07EvdN1ocTOYs8+6Q63UptAPncQLjxadevLGI9oRFjb9qnHff6IXtLnrLFey+nAsM3FnpVuaSb0lMVId3A7cg== 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=D2jM+kgD2WXgbBXIjo869uKm6EUwRZpEWfSKlncRfho=; b=dkfBqzFfH/cwnZq0M6cA37RdZ2mGakV5IJvzME8EPFOW0B4judgsyW07OSKkZ3tZ3K20briZ0fHRmlbFtL9gHgCRlG0QoIVA17x3lB38Z83nro+AuWedp8Wr7UvCix7HVMuj9/XNd+LOMQueMXWY8RXxO+CM9WKEtIZEQ5U50wg= 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:49 +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:49 +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/31] staging: wfx: simplify hif_set_association_mode() Date: Mon, 7 Sep 2020 12:14:53 +0200 Message-Id: <20200907101521.66082-4-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:47 +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: f42e480e-764d-4506-0dc8-08d85316fe02 X-MS-TrafficTypeDiagnostic: SN6PR11MB2606: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XzhSlCPFQiJIPGLXA2Tfxnpg8CfIAntNK4SKiHWf3p/k6ZNz4Jw7glXzfPnn56AQiGSCCowpCepuIqxoXBjs4dZjU9VCFyo0/2agZhnBVB65pnAoyJylE6TPc7n2TK6PijgowV/56fWUkcVgwPre1eY/0t0alCO4a2jkDIPjATz3WkcFwHTnqeW944SBUjGnvV4dDzB88k8WbYhjqlUCktfH59EwiQ0gqIwkqGTfgueRofYYFnzeJCL16+ridse+5ONeeNIDdbSCm4XpUPNiKnDGZWhXsjXQv6wacwB7GZOqe5WzVZ03UtljvBu69R3d+UQGwsRPe8r8j/lUMGPc/Q== 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: RazQn8BFpc2QCJ183ysDoIUZq4XzODkud5KnhhLFi68WRbFhvQGwVXWuYPeNerfBCwof07UJu0xxp4cRfCrrTbGrOBpqeSOyan+J/A5vLNFiI3H5pxoIn2zNG0uUI2sWauT0hKrCJlU29GOS+hAK5jrZ/xi00j4KwSB2Bp33v4XqQ0cHYg+vnIg3gcchHQlHiPbf+YqOJDUOZy1i9CMaq4odzuyxFDzdiPVOF5RT8PtsfkNGWvtNvA3dqPcARqS2lbtC40c4g+PlAGnupjBsEpG4HpMVOjZQ4CiBhv+x1Jjg0C/M3GlYhlBdBiR75EqAcZGH7ZVXxKFx4HafkIWIZUeJJFY08A76LNqDI+owe5qnzr7uekhprb5JqeHovxe6CTxbgx/AEalxqVKdpWKahXp9OXFyozbENXES70PUR3WruJ+NmJ0zVdEABk7qOB8F5HrqG3bfVcdvX1nLejlNVF/5PySAUp6j+ByFOjn8h0em10o6SE2X5/Apf1i1oIAJ9kJsQNTAuV3T2BHSogHgKpyM+WjWMY2mRlrHSZnZ/i7wtfLVqmNA5SNeYdWRvRO1I6d53ymovcegI0+pE7Ig63yY4OUOrENJ01/hf4gHCesXr3W1XdBF8NMKZ/Uc2cbB2yMW9fm4onwL43bqL/1qRw== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: f42e480e-764d-4506-0dc8-08d85316fe02 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:49.0507 (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: oyj3XIOeFDppA4HXUKYbvv7blwnGhJeJ2e3++mWspAD9QSE5OmGSzR/yUcxxd5NIgMJo7f11hICEmXx4AlDcJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB2606 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 file hif_tx_mib.c expects to contain functions that format messages for the hardware. It is unexpected to find function that manipulate RCU and structures from mac80211. Keep hif_set_association_mode() with the code necessary for message formatting and relocate the smart part in wfx_join_finalize(). Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/hif_tx_mib.c | 21 +++++---------------- drivers/staging/wfx/hif_tx_mib.h | 4 ++-- drivers/staging/wfx/sta.c | 17 ++++++++++++++++- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/drivers/staging/wfx/hif_tx_mib.c b/drivers/staging/wfx/hif_tx_mib.c index 05f1e1e98af9..3b20b7486f08 100644 --- a/drivers/staging/wfx/hif_tx_mib.c +++ b/drivers/staging/wfx/hif_tx_mib.c @@ -187,29 +187,18 @@ int hif_set_block_ack_policy(struct wfx_vif *wvif, &val, sizeof(val)); } -int hif_set_association_mode(struct wfx_vif *wvif, - struct ieee80211_bss_conf *info) +int hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, + bool greenfield, bool short_preamble) { - struct ieee80211_sta *sta = NULL; struct hif_mib_set_association_mode val = { .preambtype_use = 1, .mode = 1, .spacing = 1, - .short_preamble = info->use_short_preamble, + .short_preamble = short_preamble, + .greenfield = greenfield, + .mpdu_start_spacing = ampdu_density, }; - rcu_read_lock(); // protect sta - if (info->bssid && !info->ibss_joined) - sta = ieee80211_find_sta(wvif->vif, info->bssid); - - // FIXME: it is strange to not retrieve all information from bss_info - if (sta && sta->ht_cap.ht_supported) { - val.mpdu_start_spacing = sta->ht_cap.ampdu_density; - if (!(info->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT)) - val.greenfield = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD); - } - rcu_read_unlock(); - return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SET_ASSOCIATION_MODE, &val, sizeof(val)); } diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h index 86683de7de7c..1a6f4221bdeb 100644 --- a/drivers/staging/wfx/hif_tx_mib.h +++ b/drivers/staging/wfx/hif_tx_mib.h @@ -33,8 +33,8 @@ int hif_set_template_frame(struct wfx_vif *wvif, struct sk_buff *skb, int hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required); int hif_set_block_ack_policy(struct wfx_vif *wvif, u8 tx_tid_policy, u8 rx_tid_policy); -int hif_set_association_mode(struct wfx_vif *wvif, - struct ieee80211_bss_conf *info); +int hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, + bool greenfield, bool short_preamble); int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, int policy_index, u8 *rates); int hif_set_mac_addr_condition(struct wfx_vif *wvif, diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index b2a29b2ac20c..feebb7c3bdfe 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -499,8 +499,23 @@ static void wfx_join(struct wfx_vif *wvif) static void wfx_join_finalize(struct wfx_vif *wvif, struct ieee80211_bss_conf *info) { + struct ieee80211_sta *sta = NULL; + int ampdu_density = 0; + bool greenfield = false; + + rcu_read_lock(); // protect sta + if (info->bssid && !info->ibss_joined) + sta = ieee80211_find_sta(wvif->vif, info->bssid); + if (sta && sta->ht_cap.ht_supported) + ampdu_density = sta->ht_cap.ampdu_density; + if (sta && sta->ht_cap.ht_supported && + !(info->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT)) + greenfield = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD); + rcu_read_unlock(); + wvif->join_in_progress = false; - hif_set_association_mode(wvif, info); + hif_set_association_mode(wvif, ampdu_density, greenfield, + info->use_short_preamble); hif_keep_alive_period(wvif, 0); // beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use // the same value.