From patchwork Mon Sep 18 12:29:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 9956607 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 5E16860568 for ; Mon, 18 Sep 2017 12:30:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 474C028BD7 for ; Mon, 18 Sep 2017 12:30:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BC2328C9E; Mon, 18 Sep 2017 12:30:56 +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 3F76B28BD7 for ; Mon, 18 Sep 2017 12:30:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932114AbdIRMaH (ORCPT ); Mon, 18 Sep 2017 08:30:07 -0400 Received: from mail-cys01nam02on0064.outbound.protection.outlook.com ([104.47.37.64]:29472 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754199AbdIRMaE (ORCPT ); Mon, 18 Sep 2017 08:30:04 -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=oDqLjjzSw2L5nq6bZcr1ijhpH2zoCWzHbc/BNUqTEoA=; b=O35ZD7N2WMY6imz/LhgTBTDxmFtU2Zr50BwHGm9QAPRszbO66UFJ9vhg3XNNbkFhlo4DwMyg5mG9sAiNzlkjCBRZJh7mWr+SEer3KBTinggxhpr0uEYzNa8maE7HRmP2bgz3R+L8XnsLyJxETVjxr4VO5c+/NRG/WZ4MXphjGGA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; Received: from bars.quantenna.com (195.182.157.78) by CY1PR05MB1931.namprd05.prod.outlook.com (10.162.216.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.5; Mon, 18 Sep 2017 12:30:01 +0000 From: Sergey Matyukevich To: linux-wireless@vger.kernel.org Cc: Igor Mitsyanko , Avinash Patil , Sergey Matyukevich Subject: [PATCH v2 1/2] qtnfmac: lock access to h/w in tx path Date: Mon, 18 Sep 2017 15:29:49 +0300 Message-Id: <20170918122950.32612-2-sergey.matyukevich.os@quantenna.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170918122950.32612-1-sergey.matyukevich.os@quantenna.com> References: <20170918122950.32612-1-sergey.matyukevich.os@quantenna.com> MIME-Version: 1.0 X-Originating-IP: [195.182.157.78] X-ClientProxiedBy: AM5PR0502CA0013.eurprd05.prod.outlook.com (10.175.37.151) To CY1PR05MB1931.namprd05.prod.outlook.com (10.162.216.13) X-MS-Office365-Filtering-Correlation-Id: aa54071e-2ed7-40b5-3ebb-08d4fe90fc68 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CY1PR05MB1931; X-Microsoft-Exchange-Diagnostics: 1; CY1PR05MB1931; 3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dyzGWdahTkeUwvGev+fFRjn3l+/F/kWSer832Cp62BIaMgAcygHqYvOSOvwPLJT5TjKiYFZZnnvYKkolMPkFZgip7LFkOw0HiOhVEEim4FTytbVTHs+/FCN0I3ybSjuftwRXYyXCI5wxknq+9Zw/Yk55JdYZIOh4/JLWmTv6B5JxxyvJjwLZGSTtO9phKU27wbsFKaB+aIIyfVXMvXBWeVgWdx4nLEycaj+2FGKvMd8sDDf2HN19J8LeFYPLMWMOO+DFDl1UH4qrOriwvrJFoctvJdPRU5EiwNIjAj/g0ND42c6nr7WREqM/RDq8Cgg989m7hEyECP9s61uhD32hiuXThiaHY46CmJGK+uwcJUNkHI; 4:KkG1zybbA36A5YdrCtvgOYeivlbAtThbNpV4LSYiK05IFIx4jGy9Y1RCXikjknIvdlLDQOqXd8P5b7RcSxwgSkphRQ5+jk0VKrPiW7JSW1UDz6azJnOjdP+4yNG6vtnV9bG1WZylTvRA/pgaam2MzFfH0QYQ3B4pnGdxc07uj5cV4ins5NG+p2dOH3JEIOP1n4rOtq//EQPH9pcuxvnguHesalOuFHILVKWx3kKZvFgqt51i83RCRVqrnXALDJG3 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)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6041248)(20161123560025)(20161123564025)(20161123555025)(20161123558100)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR05MB1931; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR05MB1931; X-Forefront-PRVS: 04347F8039 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(39830400002)(346002)(199003)(189002)(47776003)(66066001)(36756003)(50226002)(478600001)(69596002)(6116002)(6916009)(54906002)(97736004)(16586007)(3846002)(2950100002)(2906002)(50466002)(305945005)(4326008)(103116003)(48376002)(6666003)(7736002)(1076002)(5660300001)(53936002)(5003940100001)(6486002)(81166006)(81156014)(8936002)(86362001)(107886003)(110136004)(25786009)(76176999)(50986999)(106356001)(2351001)(8676002)(33646002)(101416001)(16526017)(53416004)(316002)(68736007)(105586002)(189998001)(2361001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR05MB1931; H:bars.quantenna.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; CY1PR05MB1931; 23:idO0Hjcb80c1SpJtTkduTUV6JH2Bcxl+pjCYpMDn6?= =?us-ascii?Q?AdvULyr0zVFADH8loDk6pMaFoDyhVBZF6Z0kCVU3Q/OBwByYkUaO30HdVOc6?= =?us-ascii?Q?gyLBiRfG80E+isU6hG8X9A5yFHh29WeCC4vioqI1qpbPqiap1oFf/BeWvXjY?= =?us-ascii?Q?tdkCOoMUqg1DIhy+G6Ocg5jfMO/Iu5XD+pm2KdwNX5gizrSzvXdfacSCQOeW?= =?us-ascii?Q?6Hejy1M9r+TZLVTXN0xiRgwMLvZYo3p3INVkBhgp6PzJXcB+WTKuKaRWs+It?= =?us-ascii?Q?PsfeBfk3HNveF0DJLlwoCW+VO80FLoNqcsYWvLqFkKBfnCRzQ6+bJO7jERHg?= =?us-ascii?Q?7K0SQxiDPmxzmdEsSJUY0xD8e+Nv6eqZkI64gNafPZtL9q9w0TLXoaRxJSzO?= =?us-ascii?Q?eqMrsQhFCCWHYD0rgoOvIT220Y9q5ZrgfHIk5l4E+zB/nR/uKmI09y7jS3Ib?= =?us-ascii?Q?kk1or6RgRN5roPQ0I5oU0U8+mjFz4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WosiSyG1iIbR5UhHFhlmZ1kRgWU9XFbS/zHGGPguMvum65SlMBvqs0oWymXLm7syFjhGgHP8KMN77FCzCCzqyz5f9XbDrJLr0I5c0U2PGGJd1lJ1vM2Eu5T7JQ3u+DeXsC0qHGhV6ku9K5hfWJr+y7ULbFVFlzsycC5W6enXjJC0gnCAtkkyrfSIYH/M62Oo6ZstroKOEIBQ5NSB2/UH/doZ/W4EoBLJJhZ0Nv/Ty8fuv1YnP0g==; 5:2aFtZvhmzEjwR9J9zVvflA/3ClVLnaaJSFVjTslRwPagmKWUaRfn746UkyIleCkYxbbbxJ6ON/m5hcJ5BvqN0z9Fk6EbeGVRnaLfu+VLsr2/aqohDvNpmfD4iVRNqAGZB59wKtYIv2RSo6PJ4DcHMA==; 24:YUMv02ODPmRIAAGYewXsH2dmlfQhg+vljtKQYANjubQPjaYOHGPbyWga2giOfr8jBBWj5AhAWHeIjAZvH/STSL7H5ahxd8T2LXuSvUWsUes=; 7:1kwSNLsdcAvC/lDS2pE/hl35dzEwKnGKEU8BzTJ+ZYesdONctgUzBvM4xQEl6ZFWaESZiimFPC78SDWnbcCsdIhZT12UpLQN5iT44s+QADeAQo4RT+lnjdJcKoMpCIckL3LKPCBvhdyTQbh2NmEoAsadaDG+mGDFhqS9MUDvu2UaOZc9fDT2gbWL2d67cKh/82TEq135Hktwq2BHBHDpMN2zjYYIsBm9hPvPXKCrVXQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2017 12:30:01.9362 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR05MB1931 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 Fix tx path regression. Lock should be held when queuing packets to h/w fifos in order to properly handle configurations with multiple enabled interfaces. Signed-off-by: Sergey Matyukevich --- drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c | 9 ++++++++- drivers/net/wireless/quantenna/qtnfmac/pearl/pcie_bus_priv.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c index 502e72b7cdcc..69131965a298 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c +++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c @@ -661,14 +661,18 @@ 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->tx0_lock, flags); + if (!qtnf_tx_queue_ready(priv)) { if (skb->dev) netif_stop_queue(skb->dev); + spin_unlock_irqrestore(&priv->tx0_lock, flags); return NETDEV_TX_BUSY; } @@ -717,8 +721,10 @@ static int qtnf_pcie_data_tx(struct qtnf_bus *bus, struct sk_buff *skb) dev_kfree_skb_any(skb); } - qtnf_pcie_data_tx_reclaim(priv); priv->tx_done_count++; + spin_unlock_irqrestore(&priv->tx0_lock, flags); + + qtnf_pcie_data_tx_reclaim(priv); return NETDEV_TX_OK; } @@ -1247,6 +1253,7 @@ static int qtnf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) strcpy(bus->fwname, QTN_PCI_PEARL_FW_NAME); init_completion(&bus->request_firmware_complete); mutex_init(&bus->bus_lock); + spin_lock_init(&pcie_priv->tx0_lock); spin_lock_init(&pcie_priv->irq_lock); spin_lock_init(&pcie_priv->tx_reclaim_lock); 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 e76a23716ee0..86ac1ccedb52 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie_bus_priv.h +++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie_bus_priv.h @@ -34,6 +34,8 @@ struct qtnf_pcie_bus_priv { /* lock for tx reclaim operations */ spinlock_t tx_reclaim_lock; + /* lock for tx0 operations */ + spinlock_t tx0_lock; u8 msi_enabled; int mps;