From patchwork Mon Sep 18 08:04:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 9955659 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 9F05160385 for ; Mon, 18 Sep 2017 08:05:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F93728BB3 for ; Mon, 18 Sep 2017 08:05:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8452528BC0; Mon, 18 Sep 2017 08:05:32 +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 EA62E28BB3 for ; Mon, 18 Sep 2017 08:05:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752344AbdIRIFa (ORCPT ); Mon, 18 Sep 2017 04:05:30 -0400 Received: from mail-dm3nam03on0059.outbound.protection.outlook.com ([104.47.41.59]:56446 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751961AbdIRIFE (ORCPT ); Mon, 18 Sep 2017 04:05: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=3AikW/UM/lvv0Fyy48m2YPhwJhfF3HhEWOptgntIaq8YZtVeYPrDTYBv441Wx1tsZoRfXWeWJ8kxBCoUbQAXJH3bzzdUcLsKHPKSZAuid+kFx87ZeexK04jbnymtPiu+pzsOgqPThR4UGzOZVVhVHJwSONjLdKlMn+OAjwVY4ZI= Received: from bars.quantenna.com (195.182.157.78) by CY1PR05MB1930.namprd05.prod.outlook.com (10.162.216.12) 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 08:05:01 +0000 From: Sergey Matyukevich To: linux-wireless@vger.kernel.org Cc: Igor Mitsyanko , Avinash Patil , Sergey Matyukevich Subject: [PATCH 1/2] qtnfmac: lock access to h/w in tx path Date: Mon, 18 Sep 2017 11:04:45 +0300 Message-Id: <20170918080446.21763-2-sergey.matyukevich.os@quantenna.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170918080446.21763-1-sergey.matyukevich.os@quantenna.com> References: <20170918080446.21763-1-sergey.matyukevich.os@quantenna.com> MIME-Version: 1.0 X-Originating-IP: [195.182.157.78] X-ClientProxiedBy: HE1PR0401CA0067.eurprd04.prod.outlook.com (10.168.27.35) To CY1PR05MB1930.namprd05.prod.outlook.com (10.162.216.12) X-MS-Office365-Filtering-Correlation-Id: c69c6464-e828-4316-4cec-08d4fe6bf73c 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:CY1PR05MB1930; X-Microsoft-Exchange-Diagnostics: 1; CY1PR05MB1930; 3:rR8WFWjTliap655befG3MFPe2Ui9XKZpvoMLot8eJscPPfqGoElPMhf2IfNmVhwjIYKnw3v9jr2z3zxhuxfgvRTpqZ6i9nClXNm6GT6+yrIBlRVxXN3Sn3uUEAA4zIfuhvXfDb7mVbt5f9VRInVoHxp6oP3GMHfDYH9hoARYqp6O4wS9tU0pAlIGlL6WGy088JuKLHmDv1/8BVruRxGxK/OgqRUneCME9NusaIF9tP+2dbkEyJljZOCTxSjJQvcW; 25:mdP7mEYmCUnuCnjZDLJcuvC4QgLS5A2FJwa/uYXtkOx7JJBUFIo5KrUHDi/3nDd+RqG517KrpDu7lPdQV6COFRgkbABTaqb7zZ5F1xMEVNNgBv+6YHL/q7W2kvyB6mlQyTcrB9nVUDiX+zr6askNU3lyE+VMHio92icza/WfMvsFpr4kHoQ/VQ9ncvGgNf/HuO2MzRNnpSg4YrNA+ku+PlIx8fmCfE7GgU5C3bRRWdAHu1JZTMi7odOPl9/wnOEtT83MyfsfkJEZxr24WCMzUw2p2GEtWFQeJ6fca1g6lROpzSec33F/6ZDFnNW8xCQAk4DDyREr0BuKcn3K6QaWJw==; 31:e8rFp7ozObJ3qvvt27cSPcQJEUrzRr+F2oZTcxGl7Vt/mFx2RVQe+vMm9DodzNUv6V3s93rK/f7roI9NewfEGVWw7/lwxC6sI7si5VWxhdn2brpGy9IAlMLML1vDFnHNZzaxcIqMWdxOAywucQ6qEt8JqoPyLp7W6MofscanYBMSD8XocuNA0RgXL+3VVFFFS/DbyN6KuIqLDrbv70GNdQclR6IgOJclguVmLeubbOc= X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY1PR05MB1930: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; X-Microsoft-Exchange-Diagnostics: 1; CY1PR05MB1930; 20:NH3jiSbbp2SkAneCMYoozUpqgTv8bt6l+cRooZn2Fian+DcvbcgvqpVVEyXlgyvmwYGJemh4JHVn/JrqOGvHEZMzxoBkYQo3w2iehSS3kT67uY5831TlbrWkX5ijoamsyaDCtbxtVqA+Xt+P8Jf8n1/CqL+D7EAMuJ4Hn0llsg3j406NWR9XEb4CZx4eECdLiDn9RWZU41FND3C3TovRdHGheT/caoH1NJcCUmOzRQ3YEosw64Oi0QgfkqAhuYaYHqIQeRgHWHzmQsK5mLrrj/YRhbwnorz+fWVbXQ1NkFSBnpuVcFmhwC3cQRWHCxFdmHvC7OeDbbllOwxqi0TmeBc0TMmUqh3Xj6Pj9YzLeZEjSX2cYZCLiQ24dRUXb5QpmtMP1Ni9Zyf6a+n86aiqNh67+ZymcE9DDX4gfRDmi51e6eLy5qaEOzR4f4jfH4T9nb2txkCIweuIwuJGHC5PyNb7dHbMo966PLJCDZAUqlQvbj0/UXlmRINZEETLDrmT; 4:l7QhgEUnWb/ZXIc+661NGGYyY8e1Wbf7d69XW5j15wjhCVrijV/43GZbYslcidpxxYU5HOLb0ybknhLK6qFkMdqVkYaaVD+1xJ4BvWP41OmMNSyML/KaAmviUDGZqGGlb2Chb/CVyKbFFxAm4Q3OnMALnCTiYT0V0cbc8naaTF9NfzTaGL29JOVnefHYwDmyZHfL9zUAf0yOiVyIU6TVYXf9/Mx2CsfR3Oteq7U3qwRr5AmeqAKEJ+xtuZF2dQF9 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)(8121501046)(5005006)(3002001)(100000703101)(100105400095)(10201501046)(93006095)(93001095)(6041248)(20161123564025)(20161123555025)(20161123562025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR05MB1930; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR05MB1930; X-Forefront-PRVS: 04347F8039 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(39830400002)(199003)(189002)(8676002)(2906002)(81156014)(81166006)(36756003)(16586007)(6666003)(106356001)(6116002)(5003940100001)(103116003)(189998001)(25786009)(16526017)(50226002)(3846002)(8936002)(105586002)(2361001)(4326008)(478600001)(69596002)(316002)(48376002)(97736004)(50466002)(7736002)(68736007)(6486002)(110136004)(305945005)(33646002)(50986999)(107886003)(86362001)(101416001)(54906002)(66066001)(47776003)(6916009)(1076002)(5660300001)(2950100002)(53416004)(53936002)(2351001)(76176999); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR05MB1930; 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; CY1PR05MB1930; 23:qVdgif7QOC6Syiui22++g4oxm3DiVUVPWahX6UcqW?= =?us-ascii?Q?PRm/JDzAad3zlR/3VEoS42+/0Z/OtOVm8GxPmOqC6+95XHb2u01sfxmKLsz1?= =?us-ascii?Q?pcnYnT/N/D8/J7L4Pyk3KAyriCclAPyxVi15iRYLf7aJyykFPRKz5gPI+1DJ?= =?us-ascii?Q?oYb7GDmvRLjgZcLSTE6ZqCXD/VnuEF2l5w9H90+/cz1ariXLpVk48uJcx2NJ?= =?us-ascii?Q?weJXzU4GH8c5c2ArDc4ljkVo4Xduw7ZEFvb/DXXx4/rHUOfxG1sxZE5BI3OQ?= =?us-ascii?Q?RjrTBdhcvGo//UPmwSHaRr8mJG+WimA9LGX61HgpAGNh/gbOdwPIqxTzHBrz?= =?us-ascii?Q?oTeIKdUBHnDrWIlwVNQRZzT/9KkFU8EeTToD2BV0FUgmh8J4QWpuceH3uR+3?= =?us-ascii?Q?ld1oQ/ivYp+9ivYF2NgDYqUfaf0kq3mvq1kBBNQUJzPpX1DMw3qFNaKelxEV?= =?us-ascii?Q?cEqTs1N1+zTCPlTcJjSmGlO2DGFVcfd5Tk8s2jPR6cda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7h5naS93CHO92rq1IqGIW/NcYgMqldR+chddr/QllbB5T+DPCAj+1Kf60velpE42wLk4nXPFoM/TLn9TUklsVn4AkTis3gfHeL7jLyzMZ2zllOHWM5uXASqUUbmurU9JlYrWNzhUmINVeZZi1u5622v5r+3Udvzz+H6957HPg17GlsQdP8LCru7DW0Y+AOtklrHLywBz8n3avSOkpGyAoiRi30xx87w==; 5:UE5JJs3WC0t2v4aG4I5hYWppC3eG2u3A1dYzUpGSI6RG6R+Ga4O2r4ErY1yeAgtSW6YddcZj096OUx9DFzYRSn8wM+Ruj8ah2ECAPK+vOXGD6ftcDIS9poZvFydAZNx0SlBrLybw5c2U8aG8jKfiyA==; 24:O4cWvqm4Iaz4e6QhX59MSmHz+qzWAjcmFSERdG9K+GNpgVlYo1IJHAaHuG3dsRD/GCmhUMcOt+i1VKDr4lzwBs6J49TVPJqTMHjDqKM5Otg=; 7:vLvy0FtdbPZwPG2dH60FC7kBC54xbEKsgt84HVw1FMeDyc1Jw7/tUdFkndAG3xMfMsl5lZb4Vi0N7CAZ8N2OlG/nJ8o41cBmHiJSLFOXIQi683hcEdOr4OJ4la/umt5bIwtDlcMP5/Q7YAdWeSwPzBgZPoBUJdYDGRzIGPKnAvjdMTymUlCNDFERy92/qA7rcSOdz8o/f3W/eb6OWwQz0Rk2oHSUxVZ4gcSXbyUaSak= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2017 08:05:01.5524 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR05MB1930 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;