From patchwork Wed Apr 1 11:03:36 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: 216131 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, MSGID_FROM_MTA_HEADER, 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 D5BC1C2D0E7 for ; Wed, 1 Apr 2020 11:08:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C2B52078B for ; Wed, 1 Apr 2020 11:08:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="Tz5G7Bia" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732288AbgDALEv (ORCPT ); Wed, 1 Apr 2020 07:04:51 -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 S1731343AbgDALEu (ORCPT ); Wed, 1 Apr 2020 07:04:50 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ezgj0X5ANhfgCwKx0tPEZPLj3zPO3qbcOkXD1ZqpNZcNKAHZnVZgBkEHB6Co/PyNsgVx7h3S/UeyGhEMYMO92DKO/vg5Y6517LXDyxZb3QkIyKQ51cpb84xIL98MEud//6IZzgRnAPKWYGty9HRybHOlj6FWhSwIdTibba467maoMFfypUgIvf4K+GoI/o0+PjT7bsSrY0iN62e7IfF9IOIHiqYfil4Mddo29oMc3daRkA1Q1uqv7GP/dXn5eIlPWynYTy3OdYWbCXXG0NC7Q4rL9YlTsxGGKaUlGMCGLdbUH8gjUvCBJzMLyfVl05mVVIGKRvzVe8mhaqZAxf3aDA== 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=DWgc3yIgT0IVMqNtnriEBLSEOQ8hIKhrblewei6Q9IQ=; b=XDKno/hUHHaeBD5BQfvJtVojFwQ3FKrVXgP6x+lHhp4fFAidOWUTAD/TAgl961o5rAeOPx76WtLrfvTtWxNcgbKSIAX2HwJSK2qgXzm2iEz6oXGqAIloRPzcPe6+MipiE2mJxF2MtPOv9bh8kmW5E97z3GMZmgR7gG3beO5+T2pPHGi+Q5qnb/n5V3Sg/L57l4eXwOLMyDCofnrunoZLpgLB+aFMAS98egXxBL4h47ITzJaB/Kr6gJ2kdkLIeP6iFpKhak9rv18MPKxYcEe8cG7F63KtS0gIsma90Kp9+5474Y5Tqal1pHHa9a6XXcF5voKMT59w+19M5BILwBqMDw== 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=DWgc3yIgT0IVMqNtnriEBLSEOQ8hIKhrblewei6Q9IQ=; b=Tz5G7BiaxIHSJ8pia+v14JwZWvfw2oS/Y8mWGTXpyEc3DWqK6V+3F0a9LW9DRBpgtq3uw3TwMb1cF7BTANO8Eeo3ixV8V6L8w7gOQIw2KB2Bi/+qHgnL+pxmsgiBO1VZbU/rAsBoFfYgIZ/EmPC3CPGdHtJDb+QvRvf18yGphoo= 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:26 +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:26 +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 03/32] staging: wfx: take advantage of ieee80211_{stop/start}_queues Date: Wed, 1 Apr 2020 13:03:36 +0200 Message-Id: <20200401110405.80282-4-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:24 +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: 265bff3f-e095-4528-7de8-08d7d62c711a X-MS-TrafficTypeDiagnostic: MN2PR11MB4285: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:334; 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: V77DDpPb5NcZZWoZRwVQvj/jjZpF+Wi8gH89uidbUpSXBYIWNc6tg2lsUrvVayqMdgRwIenGWAWrkjKD8BMHc3Jtl1jV7jY+lOLSu68Ps0qQmkOdXDbuupvZt3XWC3fziDw6GkYeaa5fEaoshEm45LIToESljkU7f/iaGUuAIUTM2XNVMAVdSPqtIYL9nQYigap/NMjCPN9gnN3eSFFIWX87OX4AW1ymRkEJgT/o2Ae3oK+VInygdQPABDf021u+x4A4q07MuvdpxJNN62zRn1bSEpoQLNpa2Skmzm9qFkrfFJD3wYb8W45uPCblPXkGkXSV66E0oNkA7KDIVS0VDHOqs9epTJqD8YkVXkuwvhyev/slsFbyQCZNIUc4joxiKzKs2dciCoG+ryqx9AT3qfl0LTOKpOWEl1z2jGNjgnBJ1nkXawC/lOAt+a0tTtji X-MS-Exchange-AntiSpam-MessageData: Iyz3vNLgDmF+Q1qT2A45+P3e2wr8+RBFM/CXF7sLig3SwIV95zWQ9Nf6rtRAPn//SbzTh9BGG+sM7SsCx8S7NTgSDcNr3yDiUXLDZP+wPb4D29LhYWXEKJlLtd3za68L/SXYHgjgKXQesu/COpqcjZm9XiN02JU0Eaqz3b1/QrVz8nd/x8RdS+O9CwbOwALI3W4H1mYXJKqwYW6qWoeEAg== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 265bff3f-e095-4528-7de8-08d7d62c711a X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2020 11:04:26.2839 (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: r/4orkbGu00YpjLEkadQaMn8ppx4Jb0FG36LWZMH5ERN8uaQh5RLsESxEY/n3VAl7z3c6lhqpF0XYvzmMCpYhw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4285 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller Instead of maintaining stop status for each queue, we can just maintain a global status for all queues. In add, wfx_tx_queues_{lock/unlock} are only used when no more tx_policies are available. Therefore, the counter of recursive locks ("tx_locked_cnt") is useless. So, wfx_tx_queues_{lock/unlock} can be replaced by ieee80211_{stop/start}_queues. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 12 ++++-------- drivers/staging/wfx/queue.c | 29 ----------------------------- drivers/staging/wfx/queue.h | 3 --- 3 files changed, 4 insertions(+), 40 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index 7a7c2518f6cf..889ebc2f5d83 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -189,10 +189,8 @@ static int wfx_tx_policy_get(struct wfx_vif *wvif, idx = entry - cache->cache; } wfx_tx_policy_use(cache, &cache->cache[idx]); - if (list_empty(&cache->free)) { - /* Lock TX queues. */ - wfx_tx_queues_lock(wvif->wdev); - } + if (list_empty(&cache->free)) + ieee80211_stop_queues(wvif->wdev->hw); spin_unlock_bh(&cache->lock); return idx; } @@ -207,10 +205,8 @@ static void wfx_tx_policy_put(struct wfx_vif *wvif, int idx) spin_lock_bh(&cache->lock); locked = list_empty(&cache->free); usage = wfx_tx_policy_release(cache, &cache->cache[idx]); - if (locked && !usage) { - /* Unlock TX queues. */ - wfx_tx_queues_unlock(wvif->wdev); - } + if (locked && !usage) + ieee80211_wake_queues(wvif->wdev->hw); spin_unlock_bh(&cache->lock); } diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index 39d9127ce4b9..e3aa1e346c70 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -55,35 +55,6 @@ void wfx_tx_lock_flush(struct wfx_dev *wdev) wfx_tx_flush(wdev); } -void wfx_tx_queues_lock(struct wfx_dev *wdev) -{ - int i; - struct wfx_queue *queue; - - for (i = 0; i < IEEE80211_NUM_ACS; ++i) { - queue = &wdev->tx_queue[i]; - spin_lock_bh(&queue->queue.lock); - if (queue->tx_locked_cnt++ == 0) - ieee80211_stop_queue(wdev->hw, queue->queue_id); - spin_unlock_bh(&queue->queue.lock); - } -} - -void wfx_tx_queues_unlock(struct wfx_dev *wdev) -{ - int i; - struct wfx_queue *queue; - - for (i = 0; i < IEEE80211_NUM_ACS; ++i) { - queue = &wdev->tx_queue[i]; - spin_lock_bh(&queue->queue.lock); - WARN(!queue->tx_locked_cnt, "queue already unlocked"); - if (--queue->tx_locked_cnt == 0) - ieee80211_wake_queue(wdev->hw, queue->queue_id); - spin_unlock_bh(&queue->queue.lock); - } -} - /* If successful, LOCKS the TX queue! */ void wfx_tx_queues_wait_empty_vif(struct wfx_vif *wvif) { diff --git a/drivers/staging/wfx/queue.h b/drivers/staging/wfx/queue.h index 90bb060d1204..88ee2bf56d11 100644 --- a/drivers/staging/wfx/queue.h +++ b/drivers/staging/wfx/queue.h @@ -23,7 +23,6 @@ struct wfx_vif; struct wfx_queue { struct sk_buff_head queue; - int tx_locked_cnt; int link_map_cache[WFX_LINK_ID_MAX]; u8 queue_id; }; @@ -41,8 +40,6 @@ void wfx_tx_lock_flush(struct wfx_dev *wdev); void wfx_tx_queues_init(struct wfx_dev *wdev); void wfx_tx_queues_deinit(struct wfx_dev *wdev); -void wfx_tx_queues_lock(struct wfx_dev *wdev); -void wfx_tx_queues_unlock(struct wfx_dev *wdev); void wfx_tx_queues_clear(struct wfx_dev *wdev); bool wfx_tx_queues_is_empty(struct wfx_dev *wdev); void wfx_tx_queues_wait_empty_vif(struct wfx_vif *wvif);