From patchwork Wed Jan 15 12:12:20 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: 216648 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 869CDC33CB1 for ; Wed, 15 Jan 2020 12:20:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 45BEC222C3 for ; Wed, 15 Jan 2020 12:20:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="pRjVAmzy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730390AbgAOMM1 (ORCPT ); Wed, 15 Jan 2020 07:12:27 -0500 Received: from mail-bn7nam10on2050.outbound.protection.outlook.com ([40.107.92.50]:24527 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730191AbgAOMMX (ORCPT ); Wed, 15 Jan 2020 07:12:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FW7txK/+GpNqYiW2hnxnejNqUMOha/s1CGY2VEtJSzAr05W9jEOKb8Wlx1U1r5VtQR64XakDdc+h2yFqLosP3N9PvHcwW1cUmDl5hryCWzr7TEcvPiHmiHIHV40a5wqcZgJJMaXKVbQtvqF3YV2mqzP5wbf/KRuNXVsNcW4FCfHBIGpu8gCdYeDnrXQ9EbzOTYkdxYjveuSZP/jdNCVpCk691Z3vzMG90eETUMysKdu7VkMfoKiYAytad9koxyCP9zWumDnxYKo4N8tUMtBu/YqzA8Tp99Ci13I6la2awL3a/ORFISltyo6kadEeSEOVpeaW0EH072w7owpAhpihZA== 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=tz6rRPqYovKmS4+0y3NaPK/jPsF16HaTkAo8p/CyYzE=; b=ZJE90e8AXRxNQLrAn3igRoXE8LwQMGOMtAUCmSLRtqFEytzlGOe5+CARUAJrigQ8xF428e7c7jaVbxvDYq2aTPHRlbHjEDciDfgQW0TsezQZ5hmK/Tecxlf9p8r8tubNZn6K8fWUHuP87WVPe7UqgTrK17S5tX3ADVlO7k+Pv9Uca7kQmTi/3eCmFj/xvhuycIsjmHt9NBiWQ0Tmrf37pkOy6EK7//G0+qw6ru+iaAst5oRGdxcc0FttVkeWHpWC0uofLS8/VcSY/+U1ZOY1FD+gkEhZEGChsQGia3OxophICGUQ0W3koSDlqxmkvqPChjGwuhMzRuhP56Fr0g9rQA== 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=tz6rRPqYovKmS4+0y3NaPK/jPsF16HaTkAo8p/CyYzE=; b=pRjVAmzyQnBiwOPZgQFYfN6K873kbqhKL5E5GAPJHOgn07CkQ2fyZ/4phg3yoq68PGS4K1R40bLbpfEhSKr8J7S8wY28Fic8p8BvhqQbPlg1KgVl0/+k9WU0tTOhjXar8aPVIeaGzXzvv5WWTiPzWcHXttm5Fnuc90p/AneWG3o= 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:12:20 +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:12:20 +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:19 +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 09/65] staging: wfx: simplify hif_start() usage Thread-Topic: [PATCH 09/65] staging: wfx: simplify hif_start() usage Thread-Index: AQHVy50JgE81QsoikkK+Xtsk9e+c0w== Date: Wed, 15 Jan 2020 12:12:20 +0000 Message-ID: <20200115121041.10863-10-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: e46af8c4-756d-4195-2804-08d799b42bcc 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)(6666004)(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: cR1uc2CpUJTaOc0Hvs9gQP4UsoGVOr+7+bV+Qihum89BpI8DTwbD7AAWLCFcvmgZ0Zcwv/d9yFsfuNLYToHhMhS8zwrn/Tie5pQlDiJKt+i7kV0sRNzKApVee7djwFxuIDBfgZLBgrPjoCRRGML+tFFLyskNaLM+XrCGWYpppwWky8UddLgfUFet4vYSUHrtVKRj85hiZoY479uUyABkbyZneNMlC8gW1r/yzEh+wF7ndRzyC9maKJDPMp10jcbT92HxVj6pxOwXKPX2JF+83KYwEguWkEWK0njMe60OM9Iu3JxN/S3qB1fzDsi3be0DIogJY3gK3NaEqBZY+6B6L5NorHJn4XPEk3Bk1Pz8YAQ4y5A5HRdUTmSQqzSDgsLN/fLAzMcBeqOBGmlJUv8JhcmafrSpFbYojDs2hg4xNovtpw+DjFOq6Y5zhHalhbga Content-ID: MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: e46af8c4-756d-4195-2804-08d799b42bcc X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2020 12:12:20.5896 (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: ElLLv8P1mBsGibfbIJ7QOJmgVF8K7qWQAm/AqkWZplXdAr6NTl+grmF2JasIWFjHfJgMv3A0NVO14jn5br/G7w== 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_req_start come from hardware API. It is not intended to be manipulated in upper layers of the driver. In add, current code for hif_start() 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.c | 17 ++++++++++----- drivers/staging/wfx/hif_tx.h | 5 ++++- drivers/staging/wfx/sta.c | 40 ++++++++++++------------------------ 3 files changed, 29 insertions(+), 33 deletions(-) diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index d8e159670eae..be3138590a4f 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -409,16 +409,23 @@ int hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout) return ret; } -int hif_start(struct wfx_vif *wvif, const struct hif_req_start *arg) +int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, + const struct ieee80211_channel *channel) { int ret; struct hif_msg *hif; struct hif_req_start *body = wfx_alloc_hif(sizeof(*body), &hif); - memcpy(body, arg, sizeof(*body)); - cpu_to_le16s(&body->channel_number); - cpu_to_le32s(&body->beacon_interval); - cpu_to_le32s(&body->basic_rate_set); + body->dtim_period = conf->dtim_period, + body->short_preamble = conf->use_short_preamble, + body->channel_number = cpu_to_le16(channel->hw_value), + body->beacon_interval = cpu_to_le32(conf->beacon_int); + body->basic_rate_set = + cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates)); + if (!conf->hidden_ssid) { + body->ssid_length = conf->ssid_len; + memcpy(body->ssid, conf->ssid, conf->ssid_len); + } wfx_fill_header(hif, wvif->id, HIF_REQ_ID_START, sizeof(*body)); ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); kfree(hif); diff --git a/drivers/staging/wfx/hif_tx.h b/drivers/staging/wfx/hif_tx.h index e8855ead3a18..fbaed991b112 100644 --- a/drivers/staging/wfx/hif_tx.h +++ b/drivers/staging/wfx/hif_tx.h @@ -12,6 +12,8 @@ #include "hif_api_cmd.h" +struct ieee80211_channel; +struct ieee80211_bss_conf; struct ieee80211_tx_queue_params; struct cfg80211_scan_request; struct wfx_dev; @@ -51,7 +53,8 @@ int hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg); int hif_remove_key(struct wfx_dev *wdev, int idx); int hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, const struct ieee80211_tx_queue_params *arg); -int hif_start(struct wfx_vif *wvif, const struct hif_req_start *arg); +int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, + const struct ieee80211_channel *channel); int hif_beacon_transmit(struct wfx_vif *wvif, bool enable); int hif_map_link(struct wfx_vif *wvif, u8 *mac_addr, int flags, int sta_id); int hif_update_ie(struct wfx_vif *wvif, const struct hif_ie_flags *target_frame, diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 8c55089b1ea4..660a75024f4b 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -740,38 +740,24 @@ static void wfx_set_cts_work(struct work_struct *work) static int wfx_start_ap(struct wfx_vif *wvif) { int ret; - struct ieee80211_bss_conf *conf = &wvif->vif->bss_conf; - struct hif_req_start start = { - .channel_number = wvif->channel->hw_value, - .beacon_interval = conf->beacon_int, - .dtim_period = conf->dtim_period, - .short_preamble = conf->use_short_preamble, - .basic_rate_set = wfx_rate_mask_to_hw(wvif->wdev, - conf->basic_rates), - }; - memset(start.ssid, 0, sizeof(start.ssid)); - if (!conf->hidden_ssid) { - start.ssid_length = conf->ssid_len; - memcpy(start.ssid, conf->ssid, start.ssid_length); - } - - wvif->beacon_int = conf->beacon_int; - wvif->dtim_period = conf->dtim_period; + wvif->beacon_int = wvif->vif->bss_conf.beacon_int; + wvif->dtim_period = wvif->vif->bss_conf.dtim_period; memset(&wvif->link_id_db, 0, sizeof(wvif->link_id_db)); wvif->wdev->tx_burst_idx = -1; - ret = hif_start(wvif, &start); - if (!ret) - ret = wfx_upload_keys(wvif); - if (!ret) { - if (wvif_count(wvif->wdev) <= 1) - hif_set_block_ack_policy(wvif, 0xFF, 0xFF); - wvif->state = WFX_STATE_AP; - wfx_update_filtering(wvif); - } - return ret; + ret = hif_start(wvif, &wvif->vif->bss_conf, wvif->channel); + if (ret) + return ret; + ret = wfx_upload_keys(wvif); + if (ret) + return ret; + if (wvif_count(wvif->wdev) <= 1) + hif_set_block_ack_policy(wvif, 0xFF, 0xFF); + wvif->state = WFX_STATE_AP; + wfx_update_filtering(wvif); + return 0; } static int wfx_update_beaconing(struct wfx_vif *wvif)