From patchwork Wed Jan 15 13:54:46 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: 1223539 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=silabs.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-silabs-onmicrosoft-com header.b=TnblwiSt; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47yTVC4c19z9sTF for ; Thu, 16 Jan 2020 01:00:03 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729760AbgAONzV (ORCPT ); Wed, 15 Jan 2020 08:55:21 -0500 Received: from mail-eopbgr770084.outbound.protection.outlook.com ([40.107.77.84]:58049 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729728AbgAONzS (ORCPT ); Wed, 15 Jan 2020 08:55:18 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZS1g+BhRcsh1+EYU28ZNZaUER02f6lcht9f56bcJC1wkydzvI5zBUV6868KuONKzoJ+eD1DzEey8/KIJpn9QeTyeR58NfPdDQU+Yc/BPkpA9uYQXhN+UZRaBkuMtbdN/TLvVaxgppEI9trnyjjeXDMy+WknosBxOWd8/B8KS1PXlM4H0dJUlaiQf8NeQBh2BAQPwktDkleL6MTnPhl9d5UBtIOOI3TQIvWIwiXkYfr2gDnizgePhmDPunMwlCtOhEsuX7isQcsnj8C7Fc42RaWjk58NIuJpnFGMQqfLb85IE/uSU/i8pLgooIjAgIwGkrBLVB/jC37FRTgDTRfRd3Q== 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=CoALfwlM/z/b/L9FvjGzI0GVk00eBScXP8faXnr1QdEoTIZAsZqz6QfmwlwppcojRjczbRkelhbn3XH4yKC8kLeXy7AyCBC4uEdBjcOU/3Khsg6+Gt4Lb6E61ZT2FEnR7uFgh4U2wjIdXos6fUhvR1plrORrDMEwq4QewyI94nmRMb1Anc+94DK3d85LFq7sKOm2ue5heY7KozMNrKvZvvVuRZbNEE/47jo9uQmh6GXP75RLKv1CWUzAaV4y5aiWISo3sPoLaNuiv41W9S9rPLWxGvRo3p2mX8Lc6KiMTjh47qvNULjie0AkFDA4OfHwmlEjbl1sB79sWv8Apm/OuQ== 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=TnblwiSt6akUQs3v+61E1vjjaA37h6tAHAdAVMmDwVEq9mhxoyKfzKqxAInY99NaFJqd3kich1qT165rvKV10xxcp45MinEQymKSIhGZQfHdhkLSh5/UYamm98bnNIXs1u4B3cMrcr52ksTG8pr+4MoITpA292Ylbqw/vFqY9hM= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (10.255.180.22) by MN2PR11MB3661.namprd11.prod.outlook.com (20.178.252.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.18; Wed, 15 Jan 2020 13:55:16 +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 13:55:16 +0000 Received: from pc-42.home (2a01:e35:8bf5:66a0:3dbe:4cb5:6059:a948) by PR2P264CA0008.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101::20) 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 13:54:45 +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?SsOpcsO0bWUgUG91?= =?utf-8?q?iller?= Subject: [PATCH v2 30/65] staging: wfx: simplify hif_set_association_mode() Thread-Topic: [PATCH v2 30/65] staging: wfx: simplify hif_set_association_mode() Thread-Index: AQHVy6tYdBfJhrYIq0+G0WpEU/sZWA== Date: Wed, 15 Jan 2020 13:54:46 +0000 Message-ID: <20200115135338.14374-31-Jerome.Pouiller@silabs.com> References: <20200115135338.14374-1-Jerome.Pouiller@silabs.com> In-Reply-To: <20200115135338.14374-1-Jerome.Pouiller@silabs.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PR2P264CA0008.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101::20) 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: [2a01:e35:8bf5:66a0:3dbe:4cb5:6059:a948] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 386c424c-f0d1-40d2-47a1-08d799c27b30 x-ms-traffictypediagnostic: MN2PR11MB3661: 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)(39860400002)(376002)(396003)(136003)(346002)(366004)(199004)(189003)(8886007)(6486002)(316002)(54906003)(71200400001)(36756003)(6506007)(66476007)(66446008)(66946007)(110136005)(8676002)(81166006)(81156014)(478600001)(86362001)(2616005)(4326008)(66574012)(2906002)(107886003)(1076003)(16526019)(186003)(85202003)(5660300002)(6512007)(52116002)(64756008)(66556008)(85182001)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR11MB3661; 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: 8LPDo53B5Zk0Wd+z1VToVtG5qPZanGkeEPrao0HO40osdMnxAvN20K15wTKcr1k0GykHNStGV0SxYHNjKdZkH0fQdJzNCXM7J9mWMup90aGsw/lruzcRgR/0iv80piizfMprwV59bH4AX2ynuJ9vK765tsJH1RIkaynfWPTl6LVVdRSRDk5dcxrabqsHkX40gO4S8j7sSC95pPO49raWLkYtIdiqYAT3nn+AKKviiVzzMOEZDoRY0f6UZux24SvO2iOqNARz3sxjrTmcufrrppBQ6ySiEbIH9alvZ+R1FNJCEOMSIde93fH5uzM5uUE+jAySfnWS1DEd4a49sg7zk1pox+g9Cn6G5NgqAlYl+zB7smwhBFL0oodhU1V/7kegmMxGwF+Zi1LvADmwrQ9d27P62tqUcSYglgdI1Ri3PG/srfi2x6KjL0bmxdqe+MAQ Content-ID: MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 386c424c-f0d1-40d2-47a1-08d799c27b30 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2020 13:54:46.7820 (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: ll7Qlw+rnhY5GgVS0IOpExJSuObVLTsn+PXQHbzo1EGhegtMA+Ga5X/5Nj1m+0X/OYuGXso5NVVoTIgZgUY1Hw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3661 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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 */);