From patchwork Wed Jan 15 12:13:32 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: 11333963 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 DC08217EA for ; Wed, 15 Jan 2020 12:16:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B0E3922522 for ; Wed, 15 Jan 2020 12:16:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="UNPs+pWL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730951AbgAOMQP (ORCPT ); Wed, 15 Jan 2020 07:16:15 -0500 Received: from mail-bn7nam10on2041.outbound.protection.outlook.com ([40.107.92.41]:26034 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730891AbgAOMQO (ORCPT ); Wed, 15 Jan 2020 07:16:14 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iLponxSJEF6br/h/swea5p/IrRFOY/YHO2SHQ6/7RT6tdHsmX7seasBXpZF7GoTI/AkqNoBOkAXXjICgt594ioT5HR87h7LwnpMfA+4OBzBgR9j34/4In1i5Lp8e+chKUr6IEAcpN37EwJj/TlhtHPR3MjkhXu7VQBZDXnA/dmJaXazDwfxKwdVg5HoHNiWAWxal2l0gEuj3QqUL0PYAk8joVerxuBjlS6T7mYKevLRamJgV+Y1Ig2PCBk7If41aJeQeRX7XZcFO9EO9JPaR1nFZVdnXDio9yw1Ze5PdykPMdOdIv0ipVmuJrQtlQRfpkadRfr4i46Es1eTzZHfwPg== 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=BRdkCaupn/fgxCt3IoUfgFaos2qDQtkFasABJ9hW8nY=; b=knuzKRsx6nNJhin67XXHeIwlLKgAFsccVGf/M+z0Q1bQmsE2gl3q3atDokNMa+v8ogM9HygcIOmdOET/wKnQV8UVBz2VGxKCGKPpbJQ6c4mOsDyWjYu+ACBga1fUsBT/ZWk5oPvrKrDQPnuTkGwyiKWoL7hAlIU4jegNNK4NVRFakqzqS5PUhMiJ4PzV+Hdjb+BKiUUzAXASvZPjFIPWK3STWgZ4ikRykmEEEHVcgzhfdKlnl0hjmiOKcBX0uvAC46VMorf23gG/It7bz0Vsrzsh0QZtG6KV8pSGotw8vgG0dycwLyo+KGaCLzdQ0GF96Y/82TUaJxDgL8+f7JUHWA== 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=BRdkCaupn/fgxCt3IoUfgFaos2qDQtkFasABJ9hW8nY=; b=UNPs+pWL9vTakTDtIrIwEO6237OvRp+zUb83lO56RV9IKlP3MUBH0tjYvzdNvtM48IBB0dCffa6eRQlRMnJsG6mmFSUJD1UXufxD1exKdkcz9hhK90UQEg9x0fB69MInDgnpVgAEBKjT/UfgObjGLwkQda83xL1JdiKOgNsQoZo= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (10.255.180.22) by MN2PR11MB3934.namprd11.prod.outlook.com (10.255.180.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20; Wed, 15 Jan 2020 12:14:10 +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:14:10 +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:13:31 +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 62/65] staging: wfx: simplify hif_handle_tx_data() Thread-Topic: [PATCH 62/65] staging: wfx: simplify hif_handle_tx_data() Thread-Index: AQHVy500ydyKh/6ySEmSAtr/gZ90xg== Date: Wed, 15 Jan 2020 12:13:32 +0000 Message-ID: <20200115121041.10863-63-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: 39480ecd-140c-4fc6-70a7-08d799b4566e x-ms-traffictypediagnostic: MN2PR11MB3934: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2887; x-forefront-prvs: 02830F0362 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39850400004)(396003)(136003)(376002)(366004)(346002)(199004)(189003)(54906003)(110136005)(86362001)(956004)(107886003)(2616005)(316002)(36756003)(71200400001)(52116002)(7696005)(478600001)(8936002)(81156014)(8676002)(4326008)(81166006)(6486002)(2906002)(26005)(66946007)(16526019)(186003)(5660300002)(66574012)(1076003)(66556008)(64756008)(66446008)(85182001)(66476007)(85202003);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB3934;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: Pn1YoRD5L/3Ot1vGA4Dn2Zwp1h5jnthg1iP42Hw6f2a/EFz/81AwkdcBfkSwuw10Elj7QVNjy5aLQL6MrDAfZs8b8ZVOrKJLYdpDIv7pIglB9A5jr4x36es5fWAzxxCJ6yQHjWBv4jkK6id0jLOZqmCGRnH0KGWvGy8wDNzNexUXvVkKoDQgwTYWro3T1i6LKDMh1jQQvUiDuzCQg8K9e0zUVZPuZy2E/f2xYD76cGcQw/fWV3dlWsVEoI3mQXjYFvzOQ20dnnUGnUgZ2j4GayMJgLOPxRQQizfjIbGrmuTfY4ZlPXmqjgRebIKC6Ghkrw0Hs8hYGuKxw+qWX391L3txtKipxC0/GyUAEEv5HsbwumOAKu1OjJDVPPnBEFKsurDaZsR0T75CozmlvusAKx0MsXsWQ33gCdJmLWM/LYDKWIrYMR92uaH8fLQIh958 Content-ID: <271E883533FEAC44A75DD4C9AE41E05C@namprd11.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 39480ecd-140c-4fc6-70a7-08d799b4566e X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2020 12:13:32.1794 (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: 6C3JbunodojFvMqmYFUVBvrd8+JagsSNDKyrOeR/4ftJEt9H8IqNQhzQO3vD149L8QRpI2YaGrGDHcN6PKxKrA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3934 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller Since enum action has now only two cases, it can be dropped. Then hif_handle_tx_data() can be simplified. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/queue.c | 40 ++++++++++++++----------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index e0c609c35a7b..024497eb19ac 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -359,16 +359,13 @@ bool wfx_tx_queues_is_empty(struct wfx_dev *wdev) static bool hif_handle_tx_data(struct wfx_vif *wvif, struct sk_buff *skb, struct wfx_queue *queue) { - bool handled = false; - struct wfx_tx_priv *tx_priv = wfx_skb_tx_priv(skb); struct hif_req_tx *req = wfx_skb_txreq(skb); - struct ieee80211_hdr *frame = (struct ieee80211_hdr *) (req->frame + req->data_flags.fc_offset); - - enum { - do_wep, - do_tx, - } action = do_tx; + struct ieee80211_key_conf *hw_key = wfx_skb_tx_priv(skb)->hw_key; + struct ieee80211_hdr *frame = + (struct ieee80211_hdr *)(req->frame + req->data_flags.fc_offset); + // FIXME: mac80211 is smart enough to handle BSS loss. Driver should not + // try to do anything about that. if (ieee80211_is_nullfunc(frame->frame_control)) { mutex_lock(&wvif->bss_loss_lock); if (wvif->bss_loss_state) { @@ -376,31 +373,24 @@ static bool hif_handle_tx_data(struct wfx_vif *wvif, struct sk_buff *skb, req->queue_id.queue_id = HIF_QUEUE_ID_VOICE; } mutex_unlock(&wvif->bss_loss_lock); - } else if (ieee80211_has_protected(frame->frame_control) && - tx_priv->hw_key && - tx_priv->hw_key->keyidx != wvif->wep_default_key_id && - (tx_priv->hw_key->cipher == WLAN_CIPHER_SUITE_WEP40 || - tx_priv->hw_key->cipher == WLAN_CIPHER_SUITE_WEP104)) { - action = do_wep; } - switch (action) { - case do_wep: + // FIXME: identify the exact scenario matched by this condition. Does it + // happen yet? + if (ieee80211_has_protected(frame->frame_control) && + hw_key && hw_key->keyidx != wvif->wep_default_key_id && + (hw_key->cipher == WLAN_CIPHER_SUITE_WEP40 || + hw_key->cipher == WLAN_CIPHER_SUITE_WEP104)) { wfx_tx_lock(wvif->wdev); WARN_ON(wvif->wep_pending_skb); - wvif->wep_default_key_id = tx_priv->hw_key->keyidx; + wvif->wep_default_key_id = hw_key->keyidx; wvif->wep_pending_skb = skb; if (!schedule_work(&wvif->wep_key_work)) wfx_tx_unlock(wvif->wdev); - handled = true; - break; - case do_tx: - break; - default: - /* Do nothing */ - break; + return true; + } else { + return false; } - return handled; } static int wfx_get_prio_queue(struct wfx_vif *wvif,