From patchwork Mon Dec 16 17:03:58 2019 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: 11294759 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 13C3E1580 for ; Mon, 16 Dec 2019 17:07:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DBDBE20717 for ; Mon, 16 Dec 2019 17:07:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="ioIFZnsg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727487AbfLPRHx (ORCPT ); Mon, 16 Dec 2019 12:07:53 -0500 Received: from mail-eopbgr690078.outbound.protection.outlook.com ([40.107.69.78]:42057 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727933AbfLPRHC (ORCPT ); Mon, 16 Dec 2019 12:07:02 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AL++eVmTpe+UAkSRSu3sPkrpuJDU/Mfp9OXXJB86kCmGLVSAFuCiJko+Ix9Q3jj1++aptPd4HYcBPV2Qa+ZC860mo8nJMtldDd92yfzzpCRaqTHrkF4ikCl9dcPjhoxTsGIeFtaHqdU7ProUdHi+NEb+2on5KKoyolYSbJTejDWpw5Kl6xG7Y6FY5aQtmnFpO+USGOxWltrkhDAhB9cdoIhiUtv6zqQP8OiQyEEzaDATpFJAa8jx7icBMocu+m4ev4vCc0udgUcmlQF85hF1Av0TNZhsrng/WCHEycEDKrjz/kdY6Sounzrzd5nZaBbygCj4Gz0RsRjS5sj+ZoEuew== 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=ju2pb/bN7NmIsuJrqbmIxqlLWZGyRmVnm5Zhe7MC/Ic=; b=oFBtoTix+Gu7UEygTGbHsA2KmfeMfsTxRv+27B9e8XwTBWx+87Wh4f9gluAPWpkH7YyUQ8x9Ee2ljxzBBpZyK8w6BJ3paOfuOEAlr1NcmcHi1gYqpcoMrwWKzS4+OV6bg7pO28BoiadvQSqMTQM4EfgcJw5PsvMtoYUseU6jJ+Ghf5DXWsHjZhPa1w9AyMZYc9ODKbZC9a7fe097oyG7PyITa/2tyKWKXVYg2X4/NW5ieQIb8equ46sj9Z86xIk0dZAk9kcgIhiVYA6xUlcsh6rgrhYk6maOQqPdH9BUSoiSivluRwbP6yYFeF0qiUEwsatbSxDhLX5sr4ySJtZMWg== 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=ju2pb/bN7NmIsuJrqbmIxqlLWZGyRmVnm5Zhe7MC/Ic=; b=ioIFZnsgE31gFUyih0gaTSeTBgvs8xuIcSIPU1S3xLkdamxbdX3uX1s5/v1XaxtR0Q629zeoGpB7YR0JhwiQDriqhxfUJpc4Euh8PvxHx6FxUMU5K5gLedSTnnZFkeEGL9YjIwEhBzLn/yGK9kyglgOW6drvHjuypAnUhZblgBs= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (10.255.180.22) by MN2PR11MB4142.namprd11.prod.outlook.com (20.179.149.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.15; Mon, 16 Dec 2019 17:06:47 +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.2538.019; Mon, 16 Dec 2019 17:06:47 +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 48/55] staging: wfx: introduce update_probe_tmpl() Thread-Topic: [PATCH 48/55] staging: wfx: introduce update_probe_tmpl() Thread-Index: AQHVtDLO7/q/Mx2zi0ywoiBpqR255Q== Date: Mon, 16 Dec 2019 17:03:58 +0000 Message-ID: <20191216170302.29543-49-Jerome.Pouiller@silabs.com> References: <20191216170302.29543-1-Jerome.Pouiller@silabs.com> In-Reply-To: <20191216170302.29543-1-Jerome.Pouiller@silabs.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jerome.Pouiller@silabs.com; x-originating-ip: [37.71.187.125] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e2f8b4bf-e0d0-4605-7653-08d7824a55e2 x-ms-traffictypediagnostic: MN2PR11MB4142: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1443; x-forefront-prvs: 02530BD3AA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(396003)(346002)(136003)(376002)(39850400004)(199004)(189003)(6512007)(71200400001)(91956017)(6486002)(8676002)(2906002)(54906003)(81166006)(81156014)(186003)(76116006)(478600001)(36756003)(85182001)(85202003)(6666004)(66556008)(66476007)(66446008)(64756008)(1076003)(66574012)(316002)(2616005)(4326008)(6506007)(26005)(8936002)(110136005)(15650500001)(5660300002)(107886003)(66946007)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB4142;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: RCac2Z+6Q4XyUkNoCEZDtGM4IdBH+DiywstTn70IUop/RuuSfyvGILswgjsSNDixLrFDbvZcL8ycs5B+8iWVfjpKJLxc+TMWfRxb9U/qB6RKE9tuYdIl6zHdhz/DQoVf9uG+cNl88q3M47yQL59AkHoyRfhYrYxiHGvrBykcJ69RRS92XkIaSG4XQnPFVuXt2s2TKgN5iBmzdDcNavkCNmT5OAyIvL5ckcZClTc+DRc/gDTaxs+QY7J/e04yPYRpxHIAelsaS0tvSM3ZFJ2unuGnbkLNa7bGhrK5FpO/rEhl+uDTwMziKRMIHCvYxbtdxxRB1cavoDIt9Fb6mD6eQw+6e9/Rqf5YtHaIabqT6IwGM7G1SIPhk+gA/G9/w//zfXBBr2E25hUMf81kQIUARHm9nrOYT6O/eMB7a/QGU8KZbzvpuLjQapil8fevHtqU Content-ID: <2D77E2D38BDB234BAB1354C9E40F3F12@namprd11.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: e2f8b4bf-e0d0-4605-7653-08d7824a55e2 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Dec 2019 17:03:58.0690 (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: 4fTGq7Kg7QlycicrFC7CFFfuaAmC844fixBk2tZS6mrmRh7l66s7OgtqiRyDSra1LXPCOf2Sws3VikgtoTwAaA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4142 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller Simplify wfx_hw_scan() by splitting out the update of the probe request. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/scan.c | 57 ++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c index 122da87bbf92..8b184efad0cf 100644 --- a/drivers/staging/wfx/scan.c +++ b/drivers/staging/wfx/scan.c @@ -49,6 +49,27 @@ static int wfx_scan_start(struct wfx_vif *wvif, return 0; } +static int update_probe_tmpl(struct wfx_vif *wvif, + struct cfg80211_scan_request *req) +{ + struct hif_mib_template_frame *tmpl; + struct sk_buff *skb; + + skb = ieee80211_probereq_get(wvif->wdev->hw, wvif->vif->addr, + NULL, 0, req->ie_len); + if (!skb) + return -ENOMEM; + + skb_put_data(skb, req->ie, req->ie_len); + skb_push(skb, 4); + tmpl = (struct hif_mib_template_frame *)skb->data; + tmpl->frame_type = HIF_TMPLT_PRBREQ; + tmpl->frame_length = cpu_to_le16(skb->len - 4); + hif_set_template_frame(wvif, tmpl); + dev_kfree_skb(skb); + return 0; +} + int wfx_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_scan_request *hw_req) @@ -56,9 +77,7 @@ int wfx_hw_scan(struct ieee80211_hw *hw, struct wfx_dev *wdev = hw->priv; struct wfx_vif *wvif = (struct wfx_vif *) vif->drv_priv; struct cfg80211_scan_request *req = &hw_req->req; - struct sk_buff *skb; int i, ret; - struct hif_mib_template_frame *p; if (!wvif) return -EINVAL; @@ -72,29 +91,15 @@ int wfx_hw_scan(struct ieee80211_hw *hw, if (req->n_ssids > HIF_API_MAX_NB_SSIDS) return -EINVAL; - skb = ieee80211_probereq_get(hw, wvif->vif->addr, NULL, 0, req->ie_len); - if (!skb) - return -ENOMEM; - - if (req->ie_len) - memcpy(skb_put(skb, req->ie_len), req->ie, req->ie_len); - mutex_lock(&wdev->conf_mutex); - p = (struct hif_mib_template_frame *)skb_push(skb, 4); - p->frame_type = HIF_TMPLT_PRBREQ; - p->frame_length = cpu_to_le16(skb->len - 4); - ret = hif_set_template_frame(wvif, p); - skb_pull(skb, 4); + ret = update_probe_tmpl(wvif, req); + if (ret) + goto failed; - if (!ret) - /* Host want to be the probe responder. */ - ret = wfx_fwd_probe_req(wvif, true); - if (ret) { - mutex_unlock(&wdev->conf_mutex); - dev_kfree_skb(skb); - return ret; - } + ret = wfx_fwd_probe_req(wvif, true); + if (ret) + goto failed; wfx_tx_lock_flush(wdev); @@ -114,13 +119,11 @@ int wfx_hw_scan(struct ieee80211_hw *hw, dst->ssid_length = req->ssids[i].ssid_len; ++wvif->scan.n_ssids; } + schedule_work(&wvif->scan.work); +failed: mutex_unlock(&wdev->conf_mutex); - - if (skb) - dev_kfree_skb(skb); - schedule_work(&wvif->scan.work); - return 0; + return ret; } void wfx_scan_work(struct work_struct *work)