From patchwork Tue Aug 15 13:06:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 9901851 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 4EA9D602C9 for ; Tue, 15 Aug 2017 13:07:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 411551FF54 for ; Tue, 15 Aug 2017 13:07:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 346E326E3A; Tue, 15 Aug 2017 13:07:09 +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 AB0941FF54 for ; Tue, 15 Aug 2017 13:07:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751568AbdHONHH (ORCPT ); Tue, 15 Aug 2017 09:07:07 -0400 Received: from mail-by2nam03on0073.outbound.protection.outlook.com ([104.47.42.73]:15232 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751468AbdHONG7 (ORCPT ); Tue, 15 Aug 2017 09:06:59 -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=xkdPta0Zw+Gq+Tn2CVc2ECjxDo2lkoljiCJ7+1pKrJs=; b=GVl0FzkPNvu/mB6C6bT/twfDfVZVoZXWCv4dJrdxnj36FRtXEcaIHDXaHcCssMLxeuD48wGW7f9TtV5Q74YnvCMIO1sJt5Wglw00/wYywY0d4m1t1JE67yI3qVQokK5Jj0gAAXyQb0DZ4lwSa/MP6hv3tyeAPyVEnBGpofRsWts= 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:06:56 +0000 From: Sergey Matyukevich To: linux-wireless@vger.kernel.org Cc: Igor Mitsyanko , Avinash Patil , Sergey Matyukevich Subject: [PATCH 4/9] qtnfmac: skb2rbd_attach cleanup Date: Tue, 15 Aug 2017 16:06:34 +0300 Message-Id: <20170815130638.31718-5-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: 96c16e0e-b933-4f50-ff99-08d4e3de8251 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; BLUPR05M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glWGjxiFjyrMIaF2Ah6MFuSLDJCHi7FaCUzr41gsNr9Vfse6/U5SyKyVOWhx1CzXIByxw4DsTyg05rgLAXcoyiG1h+e2oiWGXobEVnoPLl4IVnYbRYbTYHq0rHiKtiqWOBBVUcFxKsefQCKVAAPDUs3YZlHuU4hBi2Oygws5A3YmHK7aQhw8kFdRtt/JZX5w67VPNK9hFkUaBdnAbUWVBU33LSW13CA7UR/t0Cva6bx19pwpZE9qKU43tt6K+UWKbhscUk577aWgpDtmxFQKFrbJPwyX2alIAEuwiuL4NpvpH6NqE3Nggv7YggaFZewz/ss+8Ly98jIVS7OJRnyd0HFD/xpr4UxEXTDiAhc1OyZeM; 4:mMUxErLN/gE3GCTvXkoA8GSLglpPp3TD71ytmMqE+RxoXXuywOoot02feQpiRJg7Q8q9saPgRKmqGr1xSZtapCDsm98lO3YMHo+x4aNcxseRVSuZ3Ah6RvQyQVTn59zzgjC5v9JlNF0dI2W3KzkmAXVkKZf8KUOOXFBbvoSyLxXxZLbUme0zyRYfd9DO5BNKL76/wqlhKBiRhFWdzjZGyt6CtPnNxszRymGtFUPYMk2jmezS/4G/vXqtnOCfqMiN 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)(5890100001)(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:VPYuphh6wbR+ehgWoruq83MFdsJQDZlH2jnaSRgBs?= =?us-ascii?Q?NPiseU62ATuSUZL/I9bzQJlfgtaX6U/BulQOzsIlqMbP3SvLFriBlHqfU6xm?= =?us-ascii?Q?Pms9vl/smYHjz7b1Ho9XhvmJN4XDo6tjN1oFoHveVosNqOqwtC0x5mb+Lufo?= =?us-ascii?Q?e2mqjPgxenFvbHnVPANTZDHgcFvysKX3l7WLRlpu2DxiFfbJFY1HCccnzFZa?= =?us-ascii?Q?qqAlGRyqOSXUIjHPNWBIhJ8onYUuyHvqm6X2TqlNA3gPrbyvtzvNqQL1t49J?= =?us-ascii?Q?mCLYONI4vWoNjN4v6Jtph7x5XcENcbJgLb+/FxAmZ9vLqEmAyeDEj95mixqU?= =?us-ascii?Q?iknqyHAaJAl0tGPZ62ICrP0gyrp6SRAJ/9m98ntFdVn7qjGqI9M7QX3vpw7y?= =?us-ascii?Q?8bZMS8RdhvabugETrPS9fNH9Jyz3Ya5yF6rLE8zUPYX2zd/HaULIBIl3E4Xj?= =?us-ascii?Q?dgxQ5feOhsm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fzcKARz12ZLmdy0kp83A/cJK73qj34sU/KnsSd5szEoPjR45sJK1dMpMCdRQCscGYwZ5UjWA+RMDd1moJDQesPKhT9H6XP/0n9c7S4WE073/0uS6jQ6lCS8m+a6QGVsqZHrK+mgxd9LZJ5IgfbE4vdHiMPw0XuZo9QaUzbiDxOSq8WBwoSSAaYhEt88YdHJdoUa9SvyYVy+Gc+EWLuIR8aUy7rVuQBV2WA+2pEuOpd+KSN1pUy2DgtIqNSBtlgj6AhugjRFsM8Yj9S8403dNdW/4UqhMbopuCNgC1hkUirFKHyfanqWt1IxgNuFAAzHjfDhO4bSGf24FqPPw==; 5:mP6QYecym+0GyhUzlxlI/20C1zhNjC3r0I41+ITzO+1VaZB4vtShBucirAw9BXiKlWWT+oKunKrewPchPkW0fev4lPmxA0obajTXK6VjT3MFwioiYbAc0Qw/VHq9S9giaGCzVMApQdnHgTe3PKDJTg==; 24:OVv412fKiBvnzoZk5eOr9imYuxwMTj0gSPdd7SqSTr5p0s8aP4yMepmhAV7SZ2/RYYl5+aXoh3DHGqyE7706Na5r9jnlTBtdgxDsU3DuiMA=; 7:z+JzX9leagm3klcVS+smkkOGF5L05FAQ/eWwb08krv5/dVzSo4XPINtUVSGWB6n67Yo+zBQIsAUWCo5xeHGvv4ACkGyBozHXqP4hmmtCsZOIOom3tvlWo5HKsRFtBTPxER6nQc2pMo+qdtiMLQu/wRFLJNNdTPGeUtJj+BrxL1qMkUKnCUhxEZdImXNuZZD1Jptz1eq9doU7xsThOIzSeGhomsKyl0udyR5jOuTwiwg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2017 13:06:56.7864 (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 Update PCIE_HDP_TX_HOST_Q_WR_PTR register in skb2rbd_attach as a part of procedure of passing new Rx buffer to hardware. Sync up all the the qtnf_rx_bd descriptor updates before passing Rx buffer to hardware. Signed-off-by: Sergey Matyukevich --- .../net/wireless/quantenna/qtnfmac/pearl/pcie.c | 31 +++++++++------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c index 079aa1693ff5..a0b65d487ddb 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c +++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c @@ -411,11 +411,6 @@ static int alloc_bd_table(struct qtnf_pcie_bus_priv *priv) writel(priv->rx_bd_num | (sizeof(struct qtnf_rx_bd)) << 16, PCIE_HDP_TX_HOST_Q_SZ_CTRL(priv->pcie_reg_base)); - priv->hw_txproc_wr_ptr = priv->rx_bd_num - rx_bd_reserved_param; - - writel(priv->hw_txproc_wr_ptr, - PCIE_HDP_TX_HOST_Q_WR_PTR(priv->pcie_reg_base)); - pr_debug("RX descriptor table: vaddr=0x%p paddr=%pad\n", vaddr, &paddr); priv->rx_bd_index = 0; @@ -423,7 +418,7 @@ static int alloc_bd_table(struct qtnf_pcie_bus_priv *priv) return 0; } -static int skb2rbd_attach(struct qtnf_pcie_bus_priv *priv, u16 rx_bd_index) +static int skb2rbd_attach(struct qtnf_pcie_bus_priv *priv, u16 index) { struct qtnf_rx_bd *rxbd; struct sk_buff *skb; @@ -431,13 +426,12 @@ static int skb2rbd_attach(struct qtnf_pcie_bus_priv *priv, u16 rx_bd_index) skb = __netdev_alloc_skb_ip_align(NULL, SKB_BUF_SIZE, GFP_ATOMIC); if (!skb) { - priv->rx_skb[rx_bd_index] = NULL; + priv->rx_skb[index] = NULL; return -ENOMEM; } - priv->rx_skb[rx_bd_index] = skb; - - rxbd = &priv->rx_bd_vbase[rx_bd_index]; + priv->rx_skb[index] = skb; + rxbd = &priv->rx_bd_vbase[index]; paddr = pci_map_single(priv->pdev, skb->data, SKB_BUF_SIZE, PCI_DMA_FROMDEVICE); @@ -446,17 +440,20 @@ static int skb2rbd_attach(struct qtnf_pcie_bus_priv *priv, u16 rx_bd_index) return -ENOMEM; } - writel(QTN_HOST_LO32(paddr), - PCIE_HDP_HHBM_BUF_PTR(priv->pcie_reg_base)); - writel(QTN_HOST_HI32(paddr), - PCIE_HDP_HHBM_BUF_PTR_H(priv->pcie_reg_base)); - /* keep rx skb paddrs in rx buffer descriptors for cleanup purposes */ rxbd->addr = cpu_to_le32(QTN_HOST_LO32(paddr)); rxbd->addr_h = cpu_to_le32(QTN_HOST_HI32(paddr)); - rxbd->info = 0x0; + /* sync up all descriptor updates */ + wmb(); + + writel(QTN_HOST_HI32(paddr), + PCIE_HDP_HHBM_BUF_PTR_H(priv->pcie_reg_base)); + writel(QTN_HOST_LO32(paddr), + PCIE_HDP_HHBM_BUF_PTR(priv->pcie_reg_base)); + + writel(index, PCIE_HDP_TX_HOST_Q_WR_PTR(priv->pcie_reg_base)); return 0; } @@ -787,8 +784,6 @@ static int qtnf_rx_poll(struct napi_struct *napi, int budget) break; } - writel(priv->hw_txproc_wr_ptr, - PCIE_HDP_TX_HOST_Q_WR_PTR(priv->pcie_reg_base)); } if (processed < budget) {