From patchwork Wed Apr 1 11:03:59 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: 221510 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 4434EC43331 for ; Wed, 1 Apr 2020 11:06:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0D8502078B for ; Wed, 1 Apr 2020 11:06: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="lDoAZBtF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732645AbgDALGS (ORCPT ); Wed, 1 Apr 2020 07:06:18 -0400 Received: from mail-bn7nam10on2084.outbound.protection.outlook.com ([40.107.92.84]:6083 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732478AbgDALFQ (ORCPT ); Wed, 1 Apr 2020 07:05:16 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fiuOc9UUKb2YIfQYsT1sQM1b4h6rDJcMqqFS1bKl/n5I9NBxw2+EjlijqQfmen+QTXhgwFFPIUeLEWn6O0yT5iaz6ScCBxxzx+6r2lP5YnVZcuVrq/1avTAAAnfydAxS4hIg3GIL2QFA+4O2m0Rjla6jd5r8xNRkUcd8sKasCRPSNV6W6ic/NCQeW96cX5Wnr+JhoPcdA6UztKgAXxL50JuLniqOW63+sjyhS8RlRrVdSyt4+ZQwqDXcPTHmg8dlcTqNswpvZG2ePb1/Qbnb6jX2I4wEfuExGN2HS6AtMTdeYZus8QZn7LFDnhIimMDNYRcaxUPoHOFpIgyo4j9qiA== 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=JLXkHtgOfIXkrIv65auGzqAl7SnFA+CICIpiDZd5Mfc=; b=hbMMmN1mhanqW0eVozOPCYKmNE6eiX5xdjStQG2LwxVpiWyjIgIzJI3hA2J/YHrOA+ydlmu3LTA5j8MQdT6m6TCAZuKL6sF578KEmVWn9jo5vGlvxW+0PjNbpKNAS+nFz4e3+rk7r9YB9ij3pDAaokP9ucveaCW41VqEow8nnufU2QRKtvE7swEU9APxh7XZUwll8IK2tmpjN8QFnLmB1nhDhbCc1IFrC8Zj0uURfjDG/ZwZLvhBcepUTnykJmlbicJW86Aq7jmlwNfiEQNOW6sSvPS4mOaSJ3Fi2akPBDRjwDFj5eg4scWILj6Gwh0OPb4a7OC03NDqmD137G/1TQ== 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=JLXkHtgOfIXkrIv65auGzqAl7SnFA+CICIpiDZd5Mfc=; b=lDoAZBtFGGcMdA0kfRASUGKxWPZ3ctMXJpNMVS1XVfc/rIUcqMjgtipX+WW9TipT5kRFDzPP5Kv+52rYyiUPBhNInnqENBsliRq2dQDSVJEPSbm3KClpJNNvcvlb+T2LwRQdpmA1R7VW38PN5ksK5dPAppMFBdfhnrkN6Tnyuao= 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:14 +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:14 +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 26/32] staging: wfx: improve interface between data_tx.c and queue.c Date: Wed, 1 Apr 2020 13:03:59 +0200 Message-Id: <20200401110405.80282-27-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:11 +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: 97463663-6387-4ee3-38c8-08d7d62c8d22 X-MS-TrafficTypeDiagnostic: MN2PR11MB4285: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2201; 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: ctcs35DUbRf2jjxtaIJt/OZH50BOMMP/3GMj37QfEFi8DhsXm+u3KmRY1jZNhI+QDE8kZfvdlqo4kAB0by0IU0FaYSXpxf8rhD6aMR7tOTEQ2pBrDJgdtrK+u3XdIWDm4R752IhevIMb06R2+Vyp7jNwEkjeb2uk0BW6eliC39aeJviURE9FnLH6vuFJKeyEMdgei67/Ye0xmy684nQjVAFE9QIPmWusCAOCivRxYpA0ufCzgJbfE5WXIr0yu89t85KbM4zQ9XwocBJ3wUo6yShJw8DkoWoJ/EW+ZzOUx9fYO0Ksorf4Z4zyh5KzjrW0WKdtYzbdz8huzXdiziXS0rkRzSduw3B2QXv51K/7Ndg4zR2aIZdEIzJzJWCmHwEdh35QjrIvgNmTyP+QODcguNVi61ZmBvr1Xy3kxCvo9oFGMT8dJZkxM4nIs8rnPWVO X-MS-Exchange-AntiSpam-MessageData: o1fbsVfMdt7w74HbnjKvV1u9FqGuaCryNJ/XBVbfyR6LYOYhaBwe57Uzv11dG2UrUYw5BSIwhySgfvq8ESKCMnBawFfL478iTp3TFYlQLcDPNK/Ghx1vMW3/LlPvZj4aYWGCtRUWGU7Cin7jSvIeb5EkW7QVH6LiFCEgLRphr07e7JGW19WoMS4UU7bRpXLNTK+5GFxU0R8dh6cAfRaT8A== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97463663-6387-4ee3-38c8-08d7d62c8d22 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2020 11:05:14.2343 (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: xIEKb6xF6ach2a3TxsvXYiEBqbkVDrWNlRVjoD0JqGKbt6nJdfwDS8+6wMVQ99nEc52KHiMrql+p/por0eungA== 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 Currently, wfx_pending_remove() (from queue.c) call wfx_skb_dtor() (from data_tx.c) that forward the tx status to mac80211. Moreover, there no purpose to retrieve a frame from the pending queue without dequeuing it. So, the main purpose of wfx_pending_remove() is to forward the tx status to mac80211. Let's make the architecture cleaner: - merge wfx_pending_remove() into wfx_pending_get() - call wfx_skb_dtor() from data_tx.c Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 2 +- drivers/staging/wfx/queue.c | 22 +++++++--------------- drivers/staging/wfx/queue.h | 1 - 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index d2e925218eda..17209f645e4b 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -586,7 +586,7 @@ void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg) arg->packet_id == wvif->bss_loss_confirm_id) wfx_cqm_bssloss_sm(wvif, 0, 0, 1); } - wfx_pending_remove(wvif->wdev, skb); + wfx_skb_dtor(wvif->wdev, skb); } static void wfx_notify_buffered_tx(struct wfx_vif *wvif, struct sk_buff *skb) diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index cc89bfe1dbb4..a1a2f7756a27 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -174,30 +174,22 @@ int wfx_pending_requeue(struct wfx_dev *wdev, struct sk_buff *skb) return 0; } -int wfx_pending_remove(struct wfx_dev *wdev, struct sk_buff *skb) -{ - 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, &wdev->tx_pending); - wfx_skb_dtor(wdev, skb); - - return 0; -} - struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id) { - struct sk_buff *skb; + struct wfx_queue *queue; struct hif_req_tx *req; + struct sk_buff *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(&wdev->tx_pending.lock); + 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, &wdev->tx_pending); return skb; } } diff --git a/drivers/staging/wfx/queue.h b/drivers/staging/wfx/queue.h index 4851635d159b..9bc1a5200e64 100644 --- a/drivers/staging/wfx/queue.h +++ b/drivers/staging/wfx/queue.h @@ -41,7 +41,6 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev); struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id); -int wfx_pending_remove(struct wfx_dev *wdev, struct sk_buff *skb); int wfx_pending_requeue(struct wfx_dev *wdev, struct sk_buff *skb); unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, struct sk_buff *skb);