From patchwork Wed Apr 1 11:03:41 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: 221502 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.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, 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 1241FC43331 for ; Wed, 1 Apr 2020 11:07:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CDBF12078B for ; Wed, 1 Apr 2020 11:07:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="TSzlJPgT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732615AbgDALHw (ORCPT ); Wed, 1 Apr 2020 07:07:52 -0400 Received: from mail-bn7nam10on2067.outbound.protection.outlook.com ([40.107.92.67]:6024 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732312AbgDALEz (ORCPT ); Wed, 1 Apr 2020 07:04:55 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AVxqCNBlB0I8Pcq4tmBXgOUuuEWsInjRfMH/UdAyEnUmXYSX1XLaoSPk6aUfPoOmPFqM5JzW7mR3SZ7WUji2YJm/c10SbeiTjLt2dIOGGaHyBE3E1DGrzAkNbcW20nSLJNlt7ccpd/Ky8y2Hgl3n6ur6C6OAdcN0WDM+Glg77MiQJRRKeIWKz3xM2lzO5vmcaGbMRlgS2F6IS0pvqf75IkCIFOt1ATQZEsszTqOZeWK+cWlryDCMwPNIjp4vlDa/dqVoDRo+29yo9W5xTXel9C2yDA2/Q6h2Snbziu//MK0gA7CY/G/IB0tytIWohlAusiJVWPYqBELGjDUK0zut5g== 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=Ixh1kI1Qt5S2Eb+CPATQzrHK332RntXNptR9YznsozY=; b=HQM2AMzCl2XTn3EEl8sOhUgWWD01rhARF4Bpoxiggj6uhtT57qwLu759R+IwMSUyJO92IYd7iIcfolIn6HRZ8094oKYXIVnQkraOUWPzMeYk+MQXc7MpA7SAhRWY1jwF1R0Vcout8kx/Y7b1q87PhQzUBaMdBAPfLnVPUHs30IuHLmyzXiaRP2rtah2QjfwFICgPGGZDB3Z/2VeNq1TBB5r3T8Pmr0mMoW9M3JdG0SBAjmnB7iDok3XHyzKRS72N1orTwxE5Hd5tF++n/B742gZDoGkMG2ICm5ZZGTZ19SntVumGUurPdSKybCUDmeG9PeYKqTYxapV/AdKWnaYuug== 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=Ixh1kI1Qt5S2Eb+CPATQzrHK332RntXNptR9YznsozY=; b=TSzlJPgTZ7w9XMBwS2lLw+soowe8HXWRb6J3CiRIG+Hg8C49fWlNePomosDZ4ISRx4kVWqwlv4lQ/ct0qE1NITBDvCQomS0sgzw7lrUJKhsoEeXwuzRFvujxMpIdgjPxYxEw3LSM/szt98ORgvSEvj6fejejxQzVFFNIZtQdrZo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerome.Pouiller@silabs.com; Received: from MN2PR11MB4063.namprd11.prod.outlook.com (2603:10b6:208:13f::22) by MN2PR11MB4285.namprd11.prod.outlook.com (2603:10b6:208:191::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20; Wed, 1 Apr 2020 11:04:36 +0000 Received: from MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::ade4:5702:1c8b:a2b3]) by MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::ade4:5702:1c8b:a2b3%7]) with mapi id 15.20.2856.019; Wed, 1 Apr 2020 11:04:36 +0000 From: Jerome Pouiller 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 08/32] staging: wfx: simplify hif_handle_tx_data() Date: Wed, 1 Apr 2020 13:03:41 +0200 Message-Id: <20200401110405.80282-9-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200401110405.80282-1-Jerome.Pouiller@silabs.com> References: <20200401110405.80282-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: SN4PR0501CA0156.namprd05.prod.outlook.com (2603:10b6:803:2c::34) To MN2PR11MB4063.namprd11.prod.outlook.com (2603:10b6:208:13f::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc-42.silabs.com (2a01:e35:2435:66a0:1265:30ff:fefd:6e7f) by SN4PR0501CA0156.namprd05.prod.outlook.com (2603:10b6:803:2c::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.9 via Frontend Transport; Wed, 1 Apr 2020 11:04:34 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [2a01:e35:2435:66a0:1265:30ff:fefd:6e7f] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8ebcc93b-d074-446a-d67e-08d7d62c772d X-MS-TrafficTypeDiagnostic: MN2PR11MB4285: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-Forefront-PRVS: 03607C04F0 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR11MB4063.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(136003)(366004)(346002)(376002)(39850400004)(396003)(7696005)(8676002)(1076003)(16526019)(186003)(6666004)(5660300002)(86362001)(4326008)(66574012)(52116002)(478600001)(66946007)(66476007)(54906003)(36756003)(8936002)(316002)(81156014)(6486002)(2906002)(66556008)(107886003)(81166006)(2616005); DIR:OUT; SFP:1101; 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: 4hp4Kt/JEx7J1c18Z1udEV141S4a1O84JN6cYovakw+E1NDq8V+OI2hVeQ975qTCum45wGxT3R8KxwGNDHpWLBKWlhIL4gJLjrMO84PmxawjVtehcKWUkKUI2T3zp/JHWO6z6KAjFvS0LpMIT9lgyJZ8wUfWUZ4r/vKQ/diq97q/iZo7jzKtUcnudubdaTIWiT70IhMNdzmp9ucg28QlP5fI2/2A0tqwQQYl+m0vuUg5KnH4kJa3atob8Q1XisXx+CoSxBmFEzgTcL4FiDm4eP81x20gXnvOCFPCauKTFHMADh8PoLbcLBI1E0GxL2Aw3q6n0odvuHRPO6qS+6WBKf9McSi2HI831hNzShZnoKgRlOOphuYTjBwBT0Q0o87m9FN1yHr0kLsmPqI4ecNrjU82WEO0kDHopwns4Jntwy5SAmz0/rkGVEsIGw8MuZ5X X-MS-Exchange-AntiSpam-MessageData: gv7ksC2TDwtcWJ9daevmbuJkZg6g0VnZ7v6tHGvbsT1AmwO9aJB9n0jBvVdBmc3v7569SInypzY2u5jqhnWT34yT+/zc74FxPMCTjoHiS6T5UQid0XAlE8mNisTsZlrZ6H+7QZ7o+aMnLtroF2j2A9qwfywHaw7bvygHw06ilnSi1XEAXTvkPBVWmRNjzE5PtiKtCVnOcDo1o8rvgMEQYQ== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ebcc93b-d074-446a-d67e-08d7d62c772d X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2020 11:04:36.5210 (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: pl2jMYeIPnlCPCtKJIwj/rOaHclvqIqB9r3IAT9s90e1J5ZFbLATsjs2El3hk5J6x0qFPexL7BUNUFnCBK50cQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4285 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller The last argument of hif_handle_tx_data() was now unused. In add, hif_handle_tx_data() has nothing to do with HIF layer and should be renamed. Finally, it not convenient to pass a wfx_vif as parameter. It is easier to let hif_handle_tx_data() find the interface itself. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/queue.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index 2553f77522d9..8647731e02c0 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -319,13 +319,17 @@ bool wfx_tx_queues_is_empty(struct wfx_dev *wdev) return ret; } -static bool hif_handle_tx_data(struct wfx_vif *wvif, struct sk_buff *skb, - struct wfx_queue *queue) +static bool wfx_handle_tx_data(struct wfx_dev *wdev, struct sk_buff *skb) { struct hif_req_tx *req = wfx_skb_txreq(skb); 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); + struct wfx_vif *wvif = + wdev_to_wvif(wdev, ((struct hif_msg *)skb->data)->interface); + + if (!wvif) + return false; // FIXME: mac80211 is smart enough to handle BSS loss. Driver should not // try to do anything about that. @@ -344,12 +348,12 @@ static bool hif_handle_tx_data(struct wfx_vif *wvif, struct sk_buff *skb, 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); + wfx_tx_lock(wdev); WARN_ON(wvif->wep_pending_skb); 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); + wfx_tx_unlock(wdev); return true; } else { return false; @@ -496,13 +500,10 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev) skb = wfx_tx_queue_get(wdev, queue, tx_allowed_mask); if (!skb) continue; - hif = (struct hif_msg *)skb->data; - wvif = wdev_to_wvif(wdev, hif->interface); - WARN_ON(!wvif); - if (hif_handle_tx_data(wvif, skb, queue)) + if (wfx_handle_tx_data(wdev, skb)) continue; /* Handled by WSM */ - return hif; + return (struct hif_msg *)skb->data; } }