From patchwork Wed Apr 1 11:03:57 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: 1265129 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=silabs.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-silabs-onmicrosoft-com header.b=MOGBpe95; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48sjz53N0fz9sSw for ; Wed, 1 Apr 2020 22:05:21 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732242AbgDALFS (ORCPT ); Wed, 1 Apr 2020 07:05:18 -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 S1732441AbgDALFM (ORCPT ); Wed, 1 Apr 2020 07:05:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AA77cmsSQfX2P5UcE1b5CEE80ginMeJF6xK8ehxAFQwsQNbyafH4aaJa4BukIf24gmHtdbO7wICL/IfW80VeLdgw2VAR1wLcVPohltojw0P6WZBhmpERi6UE3rJlL0Szmbe1JpPHF1bbR7WBD3iHwy6GbpbhZVK+kcuNNvLzZgTmZnDr1hrSftGWuXuBYSc1HXI0XDJST/qPxlNy7zwzmIBvs+/RnJiijf6U6N3QcEmNyy02cs7mtyjdwEPmRAIZzOviCQpveZO/PqG7/a2m1oDdLZZ59kQYA0GHjueHJ2gYsLbyi+iPcADqiqG8c6wArvx306gg1idP4V3vYG0O1g== 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=ADI/HTZknKww89v+/KToEisrEZcdFerjBHSWKVVMbto=; b=MYliBoeIeBw/duj3PApY7zBxp0kLVFFhQhdhYhxqAyKyA9uXvlML+CtF87XpW9eKGHzgwrw8rlAt6Ysq2eH3zQ4HXWBZBpcLfHSuDIgkVCtMeLlm9L/aFw1fWPQtuDk1xN3GgSX7v9npEG6H2O700YFN6CQylAb4idmS562S5MdxACoSrRJndeB0/KZ+CHPvq3fy30BVpSLXZ2jUEYGoSnyJIZecQ7zxMnSSsh/H0jWUFn/JcYzmaJt9jrUTXuaaqmwY4/5KnIrmiTFd5F6qZ+h+XtUhTUUU2QNY7Wf4NVuACmKyuC3DuWZi6UjJA7C3d44tCqRdMYUYpejJZ5MMcg== 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=ADI/HTZknKww89v+/KToEisrEZcdFerjBHSWKVVMbto=; b=MOGBpe95dj+oZtFSC06HtI4ajGYRs6MbwsTEJM69cnyjB7J3KzASJN0cIWmZG8yLd79pmaE6Ms4a/T2EON+Vrlz9v9TFCsVoWZZz+XGfSgv8iM1QQNYhbzfeFGxZvH5M5g4m0E4lrSw711MFYcLkvh7sOk6GrD1EpQOWnq7i/qQ= 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:05:09 +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:05:09 +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 24/32] staging: wfx: drop struct wfx_queue_stats Date: Wed, 1 Apr 2020 13:03:57 +0200 Message-Id: <20200401110405.80282-25-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:05:07 +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: 3dfbd0f1-797e-4ca5-d64c-08d7d62c8a71 X-MS-TrafficTypeDiagnostic: MN2PR11MB4285: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1303; 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: wU24RMWgRSTndmNu7CzcFEdhhuP+rVnrNKW/tDsQRx7f49PwhMZhgJ97aDTld/v/Q1VxGDB/5NXVqN/pVWZ8Pgd85dNY7fc7PRDNzoL/lHFsEo5AZp4A2Q2/BjLp/qqDPoM1c33nIHoCRzWERY210Mwbh8ZQFOPPhAesajIyKWIkgSWMdLTzVvR5wAH2+FXPFYU76ZsmA0HvedJZNK122dhp7THC1iDfVYsj14+kXT7Q9MEFX8gsjyrea4QHpNG2PZDtRWw+R+RuChFkqQHegkx5UPj+J7XhZ5ookxmaX8pYugIt3YdCCqsMIzEQxoNI9ohAgc2Ud/6PGlWuiPip2S5ibqa0N10h3nzEKsB63HlQS48ahRZovuOs2rtBCnDBj8dW51Qoxnkcym5DQF62GvHzabp0OfshTKJqge8KDau4N7koqdFpgrsMbR9O5V87 X-MS-Exchange-AntiSpam-MessageData: HjB08tcpg3jYEHLOPIAFpvPHHchD9OO9CSYdfAsA8biy9o/mlmr8CGz3e+8tlXFBGUsJxG5fVptJn1kDROYgslj1w0wb/DqrXj93KHpTVE5kCT5lIUrzG4vTsXjOQlq8+FBhc0Q92IMSRd+gkQHOdXGFVc5FJmB6xvi99/0ENjTyVaeZB4gvlnP+6dr3kc7VFFZVw//br1hAVNv9vtPzXg== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3dfbd0f1-797e-4ca5-d64c-08d7d62c8a71 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2020 11:05:08.8724 (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: zUGgnkaHo69KmKRpqq8upfxuJ01IWMLIuVkePgCuJnhbLg/lDfbhL6oFA5kk778ylf5SQ/iRJo34vwLpoLV2+w== 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 There is no reason to keep the intermediate struct wfx_queue_stats. Relocate its members to struct wfx_dev. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/queue.c | 36 +++++++++++++++--------------------- drivers/staging/wfx/queue.h | 5 ----- drivers/staging/wfx/sta.c | 2 +- drivers/staging/wfx/wfx.h | 3 ++- 4 files changed, 18 insertions(+), 28 deletions(-) diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index b45fb837f1cd..a03860db2f54 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -121,12 +121,11 @@ void wfx_tx_queues_clear(struct wfx_dev *wdev) int i; struct sk_buff *item; struct sk_buff_head gc_list; - struct wfx_queue_stats *stats = &wdev->tx_queue_stats; skb_queue_head_init(&gc_list); for (i = 0; i < IEEE80211_NUM_ACS; ++i) wfx_tx_queue_clear(wdev, &wdev->tx_queue[i], &gc_list); - wake_up(&stats->wait_link_id_empty); + wake_up(&wdev->tx_dequeue); while ((item = skb_dequeue(&gc_list)) != NULL) wfx_skb_dtor(wdev, item); } @@ -135,10 +134,9 @@ void wfx_tx_queues_init(struct wfx_dev *wdev) { int i; - memset(&wdev->tx_queue_stats, 0, sizeof(wdev->tx_queue_stats)); memset(wdev->tx_queue, 0, sizeof(wdev->tx_queue)); - skb_queue_head_init(&wdev->tx_queue_stats.pending); - init_waitqueue_head(&wdev->tx_queue_stats.wait_link_id_empty); + skb_queue_head_init(&wdev->tx_pending); + init_waitqueue_head(&wdev->tx_dequeue); for (i = 0; i < IEEE80211_NUM_ACS; ++i) { skb_queue_head_init(&wdev->tx_queue[i].normal); @@ -148,7 +146,7 @@ void wfx_tx_queues_init(struct wfx_dev *wdev) void wfx_tx_queues_deinit(struct wfx_dev *wdev) { - WARN_ON(!skb_queue_empty(&wdev->tx_queue_stats.pending)); + WARN_ON(!skb_queue_empty(&wdev->tx_pending)); wfx_tx_queues_clear(wdev); } @@ -165,28 +163,26 @@ void wfx_tx_queue_put(struct wfx_dev *wdev, struct wfx_queue *queue, int wfx_pending_requeue(struct wfx_dev *wdev, struct sk_buff *skb) { - struct wfx_queue_stats *stats = &wdev->tx_queue_stats; struct wfx_queue *queue = &wdev->tx_queue[skb_get_queue_mapping(skb)]; WARN_ON(skb_get_queue_mapping(skb) > 3); WARN_ON(!atomic_read(&queue->pending_frames)); atomic_dec(&queue->pending_frames); - skb_unlink(skb, &stats->pending); + skb_unlink(skb, &wdev->tx_pending); wfx_tx_queue_put(wdev, queue, skb); return 0; } int wfx_pending_remove(struct wfx_dev *wdev, struct sk_buff *skb) { - struct wfx_queue_stats *stats = &wdev->tx_queue_stats; struct wfx_queue *queue = &wdev->tx_queue[skb_get_queue_mapping(skb)]; WARN_ON(skb_get_queue_mapping(skb) > 3); WARN_ON(!atomic_read(&queue->pending_frames)); atomic_dec(&queue->pending_frames); - skb_unlink(skb, &stats->pending); + skb_unlink(skb, &wdev->tx_pending); wfx_skb_dtor(wdev, skb); return 0; @@ -196,32 +192,30 @@ struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id) { struct sk_buff *skb; struct hif_req_tx *req; - struct wfx_queue_stats *stats = &wdev->tx_queue_stats; - spin_lock_bh(&stats->pending.lock); - skb_queue_walk(&stats->pending, skb) { + spin_lock_bh(&wdev->tx_pending.lock); + skb_queue_walk(&wdev->tx_pending, skb) { req = wfx_skb_txreq(skb); if (req->packet_id == packet_id) { - spin_unlock_bh(&stats->pending.lock); + spin_unlock_bh(&wdev->tx_pending.lock); return skb; } } - spin_unlock_bh(&stats->pending.lock); + spin_unlock_bh(&wdev->tx_pending.lock); WARN(1, "cannot find packet in pending queue"); return NULL; } void wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms) { - struct wfx_queue_stats *stats = &wdev->tx_queue_stats; ktime_t now = ktime_get(); struct wfx_tx_priv *tx_priv; struct hif_req_tx *req; struct sk_buff *skb; bool first = true; - spin_lock_bh(&stats->pending.lock); - skb_queue_walk(&stats->pending, skb) { + spin_lock_bh(&wdev->tx_pending.lock); + skb_queue_walk(&wdev->tx_pending, skb) { tx_priv = wfx_skb_tx_priv(skb); req = wfx_skb_txreq(skb); if (ktime_after(now, ktime_add_ms(tx_priv->xmit_timestamp, @@ -236,7 +230,7 @@ void wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms) ktime_ms_delta(now, tx_priv->xmit_timestamp)); } } - spin_unlock_bh(&stats->pending.lock); + spin_unlock_bh(&wdev->tx_pending.lock); } unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, @@ -377,9 +371,9 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev) skb = wfx_tx_queues_get_skb(wdev); if (!skb) return NULL; - skb_queue_tail(&wdev->tx_queue_stats.pending, skb); + skb_queue_tail(&wdev->tx_pending, skb); if (wfx_tx_queues_empty(wdev)) - wake_up(&wdev->tx_queue_stats.wait_link_id_empty); + wake_up(&wdev->tx_dequeue); // FIXME: is it useful? if (wfx_handle_tx_data(wdev, skb)) continue; diff --git a/drivers/staging/wfx/queue.h b/drivers/staging/wfx/queue.h index 8e99bb2792ed..241ca3039b54 100644 --- a/drivers/staging/wfx/queue.h +++ b/drivers/staging/wfx/queue.h @@ -25,11 +25,6 @@ struct wfx_queue { atomic_t pending_frames; }; -struct wfx_queue_stats { - struct sk_buff_head pending; - wait_queue_head_t wait_link_id_empty; -}; - void wfx_tx_lock(struct wfx_dev *wdev); void wfx_tx_unlock(struct wfx_dev *wdev); void wfx_tx_flush(struct wfx_dev *wdev); diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 15f00ea84068..340e09bb639d 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -323,7 +323,7 @@ static int __wfx_flush(struct wfx_dev *wdev, bool drop) for (;;) { if (drop) wfx_tx_queues_clear(wdev); - if (wait_event_timeout(wdev->tx_queue_stats.wait_link_id_empty, + if (wait_event_timeout(wdev->tx_dequeue, wfx_tx_queues_empty(wdev), 2 * HZ) <= 0) return -ETIMEDOUT; diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h index 6b5b95a45e60..af4c93af81be 100644 --- a/drivers/staging/wfx/wfx.h +++ b/drivers/staging/wfx/wfx.h @@ -50,7 +50,8 @@ struct wfx_dev { struct wfx_hif_cmd hif_cmd; struct wfx_queue tx_queue[4]; - struct wfx_queue_stats tx_queue_stats; + struct sk_buff_head tx_pending; + wait_queue_head_t tx_dequeue; atomic_t tx_lock; atomic_t packet_id;