From patchwork Tue Aug 15 13:06:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 9901855 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 33777602C9 for ; Tue, 15 Aug 2017 13:07:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C5F81FF54 for ; Tue, 15 Aug 2017 13:07:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01320205F7; Tue, 15 Aug 2017 13:07:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 856D726E3A for ; Tue, 15 Aug 2017 13:07:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751654AbdHONHL (ORCPT ); Tue, 15 Aug 2017 09:07:11 -0400 Received: from mail-by2nam03on0084.outbound.protection.outlook.com ([104.47.42.84]:62496 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751598AbdHONHI (ORCPT ); Tue, 15 Aug 2017 09:07:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Bz3ZIGd5pz0SWI9sv/yJCvF/Ucl2DTgynRsCKZwekFo=; b=unp80PvTdyQC7t7c83gioJ9tn5RGOgLhRDn8wJzt/o/gOUZZOOEgU8VhwVYidSWTu8nxbG3rh9O/fqyeOHgnIomOqQetyfmBb/frNia++LkT2tarvZseX/rRmDUpIq0rShZldfaAeI8ty6UBmUBPtrELkpbMHkhSH9SMkBISE+A= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; Received: from bars.quantenna.com (195.182.157.78) by BLUPR05MB1924.namprd05.prod.outlook.com (10.162.224.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1362.12; Tue, 15 Aug 2017 13:07:05 +0000 From: Sergey Matyukevich To: linux-wireless@vger.kernel.org Cc: Igor Mitsyanko , Avinash Patil , Sergey Matyukevich Subject: [PATCH 8/9] qtnfmac: modify tx reclaim locking Date: Tue, 15 Aug 2017 16:06:38 +0300 Message-Id: <20170815130638.31718-9-sergey.matyukevich.os@quantenna.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170815130638.31718-1-sergey.matyukevich.os@quantenna.com> References: <20170815130638.31718-1-sergey.matyukevich.os@quantenna.com> MIME-Version: 1.0 X-Originating-IP: [195.182.157.78] X-ClientProxiedBy: AM5PR0602CA0021.eurprd06.prod.outlook.com (10.175.46.159) To BLUPR05MB1924.namprd05.prod.outlook.com (10.162.224.14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9c8f371b-52e8-4744-955c-08d4e3de876c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BLUPR05MB1924; X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB1924; 3:XVotqMNz9e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qvJJS0XG4xCkjzXGoBqogsIpwjbicvHRLHMw3WcEwOJxnYZhT4lzV9c6JQORy+f+ZnUJTcB5JlzXR2M00Ap57jc7l+76eYQ6g9kY7/FkMkEQdiYsxkvdZOyCw39vI2boR92QDbUysvdjwRRIXw73gWoOLaCVDtUGkDLMcic5H45v6dm86tOIFgCf8Iltg6tvePpyIOlerLSlNVdSw19XQrOaa6dCIYmVW7AgTOqyWdYnAmfC/AP+hBL+6EOPhtp3SlauFW/MBnTd4p4HSDnobHf2QCMpQviElnkeZpWy/eIyzbTjjaeze+zW0EKYpjSMCyPNv8PV; 4:no96Kt50+fe5XBScFOJa4WPzcjYK3E8UDI6yrr4ePon1iaSWDhbLvRa8/S8jyDQRxm7XNam2eRsKzwXs/EB4pvhHnebBHS2rTvyniCu3dE2il6FShitTnds6I/91XIv5cGPZblhA8cfG8wbBpcTwKGoAdT9zs7A2XXj2R5xpAy+cYnZcnp9uYnJSng1V2rTxQQn/7iLwNethIad0kXeDycaOlESPjtMuY1CDV0AOarWDlT0H/MXHt4McGdfvkxFA X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123555025)(20161123558100)(20161123564025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BLUPR05MB1924; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BLUPR05MB1924; X-Forefront-PRVS: 04004D94E2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39830400002)(189002)(199003)(86362001)(478600001)(4326008)(305945005)(25786009)(101416001)(2906002)(47776003)(7736002)(66066001)(81156014)(81166006)(8676002)(50226002)(103116003)(189998001)(50986999)(69596002)(76176999)(97736004)(50466002)(2361001)(2351001)(33646002)(6486002)(1076002)(48376002)(106356001)(105586002)(36756003)(5660300001)(68736007)(575784001)(53936002)(110136004)(107886003)(42186005)(6666003)(7350300001)(2950100002)(5003940100001)(6116002)(53416004)(6916009)(3846002)(54906002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR05MB1924; H:bars.quantenna.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR05MB1924; 23:KffY255bbI/Et9GV8iUkglwK8KfbtTA4zISXlivoc?= =?us-ascii?Q?20P96LUHx7s2kvqzDzevNCFW6umzoiLf14RHFfiuosERT7wYp5pnQWU/XVJ8?= =?us-ascii?Q?2CsfBIMZCXdjk+1AzgKUAv3hTpfBOkP1Rxj3Ci9xr1m6I2W0aMwJwxa0YNIj?= =?us-ascii?Q?XDCQiFdEJ1KjiDICcpjh5kY1jIsf0ekDUMRe2Vpltvp84X/STC/Hhe7LVGLV?= =?us-ascii?Q?Bo+kFUeW/1gIJJphMi28OHFWQTeHTB7Ffr9W82qcopNEcI1jSqhF4U7qeH5E?= =?us-ascii?Q?wXlokHwOSq13lj8VrvxGP4aYvhSIMLVQdjH/tlM/T2wu2h5waSnSDiNcahKu?= =?us-ascii?Q?+pz1W/R1P0AtzEKHobwXNQWsty8ohWIjXMAM2QMOnUfjHrEuOhyEPNaYOeVS?= =?us-ascii?Q?fk31ef28qVtJVPWAaHzpGxZ9y/rARX+OrBlNctKAbNGdjNzy+bC88gAxsRXx?= =?us-ascii?Q?TINc5OpEJ2cZBbTyLfH52I4yrqg/i07nCRhKnvsIBfuRY7l9xCYPkTEyN4JP?= =?us-ascii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4CrKS6ZK68B7ldum6ugcOxUi7RMn+dN/1yEm6qOyEBzf/VsCQYE2dP+MWAWD4REEwFJNscXiGQcShzuD+dAPQfdfnqm0Q6aFC6K9YkxPqK92mDKAcionXb0miB7J2uxmq7nOPrvqlH8ReeBwM2ZSR6MNTWIwW+bGYxiAnDZDJLho9JaWhyf4PTKMf68Q5hmR/wTTkD5o+Yg1S8Irw==; 5:NacrANGypz1qeFB5+cEmAOH07p31edJ4hJFQQwBlL/qXEqK5+D1ssmRxFlsiMLp3jlTln2lCzymnt8ssMA00RAD21u9bn0CYXhdUxC6W5iOUgfiAAcbBF4sWmMis1MYQq3Mty/TU+QL9hWV/ampHRg==; 24:Wrt0dxdLBEQq4nQNVZcxvKzVMliD7XdiKuQx60dZ+iZv02KsFLtNGcO8Npl4a183Hk/Kvs64YWfVDETUxJ88KZ5UYuOdXoUGAlQRaNqIOrc=; 7:Z0lGeOe7DHO9quhSGrvzWP9MeefsUqdVO+LyxUOcsb5pulN1SZXfYR7NzHwa/Bmas5D4PNIDC8eLbBd4oCUhgYFgOcDmtERtEGhh3r676WcKe8crOd1RrHpCLNwpZTJUMCPeRn0tUooO6Dwi8cnfSqVDVIHUFtRY8bozMBIzAS5VmYUHHovZWfpRZgopTw/6FDLzmVei1GEbPq8OEx9qkmmqiTVcF6j8LVH3AorK+vA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2017 13:07:05.3336 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR05MB1924 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Perform additional reclaim from qtnf_pcie_data_tx. Lock tx_lock serves only reclaim synchronization purposes. Rename it accordingly and improve granularity moving this lock to qtnf_pcie_data_tx_reclaim. Signed-off-by: Sergey Matyukevich --- drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c | 17 ++++++----------- .../wireless/quantenna/qtnfmac/pearl/pcie_bus_priv.h | 4 ++-- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c index 72730aff2a41..cd2f2b667643 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c +++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c @@ -534,11 +534,13 @@ static void qtnf_pcie_data_tx_reclaim(struct qtnf_pcie_bus_priv *priv) { struct qtnf_tx_bd *txbd; struct sk_buff *skb; + unsigned long flags; dma_addr_t paddr; u32 tx_done_index; int count = 0; int i; + spin_lock_irqsave(&priv->tx_reclaim_lock, flags); tx_done_index = readl(PCIE_HDP_RX0DMA_CNT(priv->pcie_reg_base)) & (priv->tx_bd_num - 1); @@ -576,6 +578,7 @@ static void qtnf_pcie_data_tx_reclaim(struct qtnf_pcie_bus_priv *priv) priv->tx_reclaim_req++; priv->tx_bd_r_index = i; + spin_unlock_irqrestore(&priv->tx_reclaim_lock, flags); } static int qtnf_tx_queue_ready(struct qtnf_pcie_bus_priv *priv) @@ -600,20 +603,14 @@ static int qtnf_pcie_data_tx(struct qtnf_bus *bus, struct sk_buff *skb) struct qtnf_pcie_bus_priv *priv = (void *)get_bus_priv(bus); dma_addr_t txbd_paddr, skb_paddr; struct qtnf_tx_bd *txbd; - unsigned long flags; int len, i; u32 info; int ret = 0; - spin_lock_irqsave(&priv->tx_lock, flags); - - priv->tx_done_count++; - if (!qtnf_tx_queue_ready(priv)) { if (skb->dev) netif_stop_queue(skb->dev); - spin_unlock_irqrestore(&priv->tx_lock, flags); return NETDEV_TX_BUSY; } @@ -659,7 +656,8 @@ static int qtnf_pcie_data_tx(struct qtnf_bus *bus, struct sk_buff *skb) dev_kfree_skb_any(skb); } - spin_unlock_irqrestore(&priv->tx_lock, flags); + qtnf_pcie_data_tx_reclaim(priv); + priv->tx_done_count++; return NETDEV_TX_OK; } @@ -1067,11 +1065,8 @@ static int qtnf_bringup_fw(struct qtnf_bus *bus) static void qtnf_reclaim_tasklet_fn(unsigned long data) { struct qtnf_pcie_bus_priv *priv = (void *)data; - unsigned long flags; - spin_lock_irqsave(&priv->tx_lock, flags); qtnf_pcie_data_tx_reclaim(priv); - spin_unlock_irqrestore(&priv->tx_lock, flags); qtnf_en_txdone_irq(priv); } @@ -1192,7 +1187,7 @@ static int qtnf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) init_completion(&bus->request_firmware_complete); mutex_init(&bus->bus_lock); spin_lock_init(&pcie_priv->irq_lock); - spin_lock_init(&pcie_priv->tx_lock); + spin_lock_init(&pcie_priv->tx_reclaim_lock); /* init stats */ pcie_priv->tx_full_count = 0; diff --git a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie_bus_priv.h b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie_bus_priv.h index 698e42132ed4..e76a23716ee0 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie_bus_priv.h +++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie_bus_priv.h @@ -32,8 +32,8 @@ struct qtnf_pcie_bus_priv { /* lock for irq configuration changes */ spinlock_t irq_lock; - /* lock for tx operations */ - spinlock_t tx_lock; + /* lock for tx reclaim operations */ + spinlock_t tx_reclaim_lock; u8 msi_enabled; int mps;