From patchwork Wed Jan 15 12:12: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: 11333911 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 01211138D for ; Wed, 15 Jan 2020 12:13:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA72C22522 for ; Wed, 15 Jan 2020 12:13:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="K1dbEoER" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731078AbgAOMNX (ORCPT ); Wed, 15 Jan 2020 07:13:23 -0500 Received: from mail-bn7nam10on2048.outbound.protection.outlook.com ([40.107.92.48]:31808 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730228AbgAOMNW (ORCPT ); Wed, 15 Jan 2020 07:13:22 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iqR+LEG8x+sNaDVK7gnAtwmWT9aPVwLs34LQWo0QS110WmsdCeLVP6hobPiwsvi4qElfD9ZZY5LhIyiiH+w03mrhkNAHyRnttOVK7AssLS45jXVVFtuSWENIQGi7QZ2F2q6GbV/WNiILd9NIyGpfHP9uaazyo+4ve1fQPybP1d9TsONBwD5LCP8B+MNyqo9fW5oHiPCL9+uOe9AP8R9ZSHRfr9VaX9aBmdFAdHRcOF8rMzz0Mx9ePc0dn+zly2TQGniBczoP1nInubmpzGEbif4an/A7Z+TJl5G4ysEfn+EPIZltQiaJJUqxs8YZLJKYVV522++cUlmZa0sD9HDWGg== 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=83XLPoKJOHbwgxaYl6x/ur2Ey8D+6u88X4pvsRD0nwY=; b=Zc2PV0uCk8jvzzC1uVNiPvPp48O7WfCG3J8l7G9HPl4H5gaB6R2DOJK5lxrq7cdRCRhLd+YTL9IIHOUb3TFxtGjV5pJz6+VSX0Px9KVc2Rp5r2kK2cSR6GL5xwvuutlsz/1n6wo+/hPBLvBs5v0KVegsgM9ZAsnEisDYBpEe7E+aJBQwicpZiArY3bk7PNHRyhtnR6sJn094MJjYiNix/6bV0Ldtz807CHPoWZCblYKjcPkWxmDn+FbVw8wWDAi6P09bRCF3N+4n3tTxgbYjNYMkQMT057PGHcwgsBJ8YOfs+iosVVNwiaKDBrVPfn2hB1qs2ss9+yZEKavX9wt0BA== 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=83XLPoKJOHbwgxaYl6x/ur2Ey8D+6u88X4pvsRD0nwY=; b=K1dbEoER4Z9UNZRG+XSiRJNI0+MYR5YR6AhYWAg9ZKu02jOfHgFxeV55DMW21MvwEk6DzO8ccfp+Qc1S56d4/IKpeF+ip2NC33HgzBRW3Woiwyz9FF5ruX28yOQ+qssTaD/tuTiSCxIv4NU0CeOKNjAaRFOHx6tuQhQ6mKuZGtk= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (10.255.180.22) by MN2PR11MB4096.namprd11.prod.outlook.com (20.179.150.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10; Wed, 15 Jan 2020 12:13:19 +0000 Received: from MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::f46c:e5b4:2a85:f0bf]) by MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::f46c:e5b4:2a85:f0bf%4]) with mapi id 15.20.2623.018; Wed, 15 Jan 2020 12:13:19 +0000 Received: from pc-42.silabs.com (37.71.187.125) by PR2PR09CA0009.eurprd09.prod.outlook.com (2603:10a6:101:16::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.18 via Frontend Transport; Wed, 15 Jan 2020 12:12:48 +0000 From: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= 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 30/65] staging: wfx: simplify hif_set_association_mode() Thread-Topic: [PATCH 30/65] staging: wfx: simplify hif_set_association_mode() Thread-Index: AQHVy50aX1wStvuIQkKM+/3XwIvfFA== Date: Wed, 15 Jan 2020 12:12:49 +0000 Message-ID: <20200115121041.10863-31-Jerome.Pouiller@silabs.com> References: <20200115121041.10863-1-Jerome.Pouiller@silabs.com> In-Reply-To: <20200115121041.10863-1-Jerome.Pouiller@silabs.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PR2PR09CA0009.eurprd09.prod.outlook.com (2603:10a6:101:16::21) To MN2PR11MB4063.namprd11.prod.outlook.com (2603:10b6:208:13f::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jerome.Pouiller@silabs.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.25.0 x-originating-ip: [37.71.187.125] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 999f97ae-5f67-42c5-ec57-08d799b43ce2 x-ms-traffictypediagnostic: MN2PR11MB4096: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4303; x-forefront-prvs: 02830F0362 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(346002)(39860400002)(366004)(376002)(136003)(199004)(189003)(85202003)(66946007)(66446008)(66476007)(2906002)(107886003)(66556008)(1076003)(66574012)(64756008)(5660300002)(8936002)(6486002)(186003)(26005)(8676002)(316002)(81156014)(36756003)(52116002)(2616005)(7696005)(478600001)(16526019)(956004)(54906003)(110136005)(86362001)(71200400001)(85182001)(4326008)(81166006);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB4096;H:MN2PR11MB4063.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: silabs.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: K7M9DAIAi+8BaYgufucqm22ba1YRlmlJryfAYdDz0PI+R1+pHeEaAP8AfuliwwL32hwnYXC8THCGBefan8vl180ekIWs+sJdylj9pc1lX5KPrj7KWjdM7NaIw0OX3gHPoVoraNpm3hZEpgGu6hlX06NLDn4U3Kd0YTMfEp7Gcz9+WedI2O/kZahAAheH8WKpvbU38widD4oCRYnZSbecRdOtQ2ZEUmn/B5JzWRJdxSeP5e2eD8nW0PhXKNCnvQvxD35vDHmllq1HOH9t4x8PpCLvq9Sr1kKWkVHwdYdxoQpsDS1Usm7uzuG6+0M2s91iPwo7jij/Vai2HC2TQaBPbYvYWuNmXDku2xNCOa6FUCvtPvd8GYc7899e/qFR9VfaI1FmjaNZ7vDBRnp7DCE94xfsG3IxvU4CKg8Mgx0rcHu1fE2IDst+gjZqhZ9auE76 Content-ID: <2C363E75B42A8D4DBFA8F6B10BA2A17F@namprd11.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 999f97ae-5f67-42c5-ec57-08d799b43ce2 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2020 12:12:49.2910 (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: UCkTcN2pErUU6p1JKjZs5zh7huQzJrS8GDLwBBFM/LCJyyZ1JmNMiKrCwwe4Vu5/wN/EBCpu3PtE9zvVBsoirg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4096 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 structure hif_mib_set_association_mode come from hardware API. It is not intended to be manipulated in upper layers of the driver. In add, current code for hif_set_association_mode() is too dumb. It should pack data with hardware representation instead of leaving all work to the caller. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/hif_tx_mib.h | 22 ++++++++++++++++++++-- drivers/staging/wfx/sta.c | 16 +--------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h index 5b39200bd697..eec6f4157e60 100644 --- a/drivers/staging/wfx/hif_tx_mib.h +++ b/drivers/staging/wfx/hif_tx_mib.h @@ -191,10 +191,28 @@ static inline int hif_set_block_ack_policy(struct wfx_vif *wvif, } static inline int hif_set_association_mode(struct wfx_vif *wvif, - struct hif_mib_set_association_mode *arg) + struct ieee80211_bss_conf *info, + struct ieee80211_sta_ht_cap *ht_cap) { + int basic_rates = wfx_rate_mask_to_hw(wvif->wdev, info->basic_rates); + struct hif_mib_set_association_mode val = { + .preambtype_use = 1, + .mode = 1, + .rateset = 1, + .spacing = 1, + .short_preamble = info->use_short_preamble, + .basic_rate_set = cpu_to_le32(basic_rates) + }; + + // FIXME: it is strange to not retrieve all information from bss_info + if (ht_cap && ht_cap->ht_supported) { + val.mpdu_start_spacing = ht_cap->ampdu_density; + if (!(info->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT)) + val.greenfield = !!(ht_cap->cap & IEEE80211_HT_CAP_GRN_FLD); + } + return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_SET_ASSOCIATION_MODE, arg, sizeof(*arg)); + HIF_MIB_ID_SET_ASSOCIATION_MODE, &val, sizeof(val)); } static inline int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 30c62e3b3716..9030681858bb 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -712,7 +712,6 @@ static void wfx_join_finalize(struct wfx_vif *wvif, struct ieee80211_bss_conf *info) { struct ieee80211_sta *sta = NULL; - struct hif_mib_set_association_mode association_mode = { }; wvif->beacon_int = info->beacon_int; rcu_read_lock(); @@ -730,26 +729,13 @@ static void wfx_join_finalize(struct wfx_vif *wvif, else hif_dual_cts_protection(wvif, false); - association_mode.preambtype_use = 1; - association_mode.mode = 1; - association_mode.rateset = 1; - association_mode.spacing = 1; - association_mode.short_preamble = info->use_short_preamble; - association_mode.basic_rate_set = cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, info->basic_rates)); - if (sta && sta->ht_cap.ht_supported && - !(info->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT)) - association_mode.greenfield = - !!(sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD); - if (sta && sta->ht_cap.ht_supported) - association_mode.mpdu_start_spacing = sta->ht_cap.ampdu_density; - wfx_cqm_bssloss_sm(wvif, 0, 0, 0); cancel_work_sync(&wvif->unjoin_work); wvif->bss_params.beacon_lost_count = 20; wvif->bss_params.aid = info->aid; - hif_set_association_mode(wvif, &association_mode); + hif_set_association_mode(wvif, info, sta ? &sta->ht_cap : NULL); if (!info->ibss_joined) { hif_keep_alive_period(wvif, 30 /* sec */);