From patchwork Fri Apr 12 13:28:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 10898289 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D07201669 for ; Fri, 12 Apr 2019 13:28:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0917286B4 for ; Fri, 12 Apr 2019 13:28:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A492028E12; Fri, 12 Apr 2019 13:28:33 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 52BA6286B4 for ; Fri, 12 Apr 2019 13:28:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:To:From: Subject:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=t9SC5io5FLEQPrRYqUIIBkGjA4WO9RVQqTKQ/98swwQ=; b=EHTTFdzhkTTji3 RlmLTPetgkToUzxcVK29qEPF9mlmey+CbhI8J3NFIU99tg6qj+T+kI0CKh/vxvJeejWeCHjcusuG0 LEnRCDr4uHgz3lvsqPIjc071gAHfWqJFDw9ygckAX5dzxt3SFcF78rhh9eOBsthRuem5X+eEAdvSL 0DteyveImgp4UbIQXLMe6S70p+qttzA7fy02J0p+pjRxvF/lypPIOQIPlYmFXbzPW+kBqCZlPsZh2 NYBklAJIcx+BrDlwKuzU7HcFSMfT31sr0xlcTgLV5H07uWc0gJZvQXDoeoIOd5m7yTl+idVtiZeh4 crw0MMvJ3WkAuRjZRuew==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEwEC-0002Wl-Qo; Fri, 12 Apr 2019 13:28:24 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEwE8-0002T5-L9 for ath10k@lists.infradead.org; Fri, 12 Apr 2019 13:28:22 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 45B7D61577; Fri, 12 Apr 2019 13:28:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1555075700; bh=tvoPqiI+paUAOLZVilty2/u/V2VPLMMSzI9QUfRvf1A=; h=Subject:From:To:Cc:Date:From; b=YtvbuusJBjFwKYni3pKs/U6x+hhvHr/0cJzYMSKanGvRzrQIFyDx8FvoDgq7Gn22D WUF30OSLDz27AbBp75Ju42dOPGqUswm0KWJgCgsUVYOrUfe5JWtdV+V2eRqA9ttCnk W364nZvPIhfz3H1MaLEh68CqhqZiNUNR5r+jxaYw= Received: from potku.adurom.net (88-114-240-156.elisa-laajakaista.fi [88.114.240.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: kvalo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 239386119E; Fri, 12 Apr 2019 13:28:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1555075699; bh=tvoPqiI+paUAOLZVilty2/u/V2VPLMMSzI9QUfRvf1A=; h=Subject:From:To:Cc:Date:From; b=CBweQumdAM3gBr0dIb/2CnW/VhAWIItQtRtQXHq5QXytP1t8rNJM39jDrU2cZe01E Emp3rVS5bdh/ec7pHw1bqeThGxSHSsbT+3NhUy2imNS5xvQgwFLOBP1PbUexiWhgh6 ZyXW4K8mlubTuW9CKbwEpJaL4bL2VI7sfMdVkLx4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 239386119E Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org Subject: [PATCH 1/6] ath10k: sdio: workaround firmware UART pin configuration bug From: Kalle Valo To: ath10k@lists.infradead.org Date: Fri, 12 Apr 2019 16:28:17 +0300 Message-ID: <155507569645.32018.15231567732563770250.stgit@potku.adurom.net> User-Agent: StGit/0.17.1-17-ge4e0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190412_062820_790207_A30C6859 X-CRM114-Status: GOOD ( 12.21 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wen Gong On QCA6174 SDIO devices the SDIO interrupt will fail if UART is disabled from ath10k. SDIO firmware enables UART printouts by default. If ath10k will try to enable UART again the firmware will configure it's GPIO line incorrectly and SDIO interrupts won't work anymore. The workaround is to set UART pin again (19 for QCA6174 SDIO) if uart_print is 0. Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00007-QCARMSWP-1. Signed-off-by: Wen Gong Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath10k/core.c | 10 +++++++++- drivers/net/wireless/ath/ath10k/hw.h | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 835b8de92d55..cfd7bb29a1ec 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -2065,8 +2065,16 @@ static int ath10k_init_uart(struct ath10k *ar) return ret; } - if (!uart_print) + if (!uart_print && ar->hw_params.uart_pin_workaround) { + ret = ath10k_bmi_write32(ar, hi_dbg_uart_txpin, + ar->hw_params.uart_pin); + if (ret) { + ath10k_warn(ar, "failed to set UART TX pin: %d", ret); + return ret; + } + return 0; + } ret = ath10k_bmi_write32(ar, hi_dbg_uart_txpin, ar->hw_params.uart_pin); if (ret) { diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h index 71314999aa24..a92fce1bb6f0 100644 --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h @@ -606,6 +606,11 @@ struct ath10k_hw_params { /* target supporting fw download via diag ce */ bool fw_diag_ce_download; + + /* need to set uart pin if disable uart print, workaround for a + * firmware bug + */ + bool uart_pin_workaround; }; struct htt_rx_desc; From patchwork Fri Apr 12 13:28:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 10898291 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 25C051669 for ; Fri, 12 Apr 2019 13:28:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00CA9286B4 for ; Fri, 12 Apr 2019 13:28:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E92CC28E12; Fri, 12 Apr 2019 13:28:35 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9F899286B4 for ; Fri, 12 Apr 2019 13:28:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:To:From:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ylF+10ZkgpBl8769IhJN0IJD7fZZdO58AzgIsigJjc4=; b=mNRTXch6T3wVGA z/duVtNRNJqj6Q7Zg56adfSfICO9QaAITGta6Ns4xurIdUc7fk2Gm8GypBv8b1shvJF7CmIulEklj 5tBDCj6lYqkPIe2gvradls6PqIBPpJXBn/QYYCIahARDVp6NM3psD5AYDu1EAVvwK1WEUcsJawJUa fs42Xiz0VTPAFG/bMnsNFPqWQpRBSeW11REdZas8Lfg4IBffvBXy2HKwfj7YY2QsbdAhDHv1z1oGt WFatjdp2wgx1RbPJXn/sY95cIxJ/VPURSV2okZNFNtMIdFcGBg7bUqi1XfA/GLkUQ9M6w45ycVNRG 1ZVmq6QcLrLh/XRatuPg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEwEM-0002ec-3f; Fri, 12 Apr 2019 13:28:34 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEwEH-0002c7-6T for ath10k@lists.infradead.org; Fri, 12 Apr 2019 13:28:32 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D0A1C6155F; Fri, 12 Apr 2019 13:28:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1555075708; bh=seCpOX84YkfMOHkLN7YFEyuxFmwnd9K2haUTClSZ9Gk=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=UZX+D5wTcaOzEVEj48GCb0eM9F3CVU5ytqkEQ228KMXA4wgRpsbZqi4+bHXHPrWZI z9rcrsLI6NPj39oKks7hqzyCyGbG5qo+69JEuaM6KWfeOucv0EGu/NoABGE/ZDW0cN b3aoZ4BUUiomw6ZN0Nssff1LJU/Mhp7BAVcwBRVk= Received: from potku.adurom.net (88-114-240-156.elisa-laajakaista.fi [88.114.240.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: kvalo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id CE0B4616B8; Fri, 12 Apr 2019 13:28:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1555075708; bh=seCpOX84YkfMOHkLN7YFEyuxFmwnd9K2haUTClSZ9Gk=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=UZX+D5wTcaOzEVEj48GCb0eM9F3CVU5ytqkEQ228KMXA4wgRpsbZqi4+bHXHPrWZI z9rcrsLI6NPj39oKks7hqzyCyGbG5qo+69JEuaM6KWfeOucv0EGu/NoABGE/ZDW0cN b3aoZ4BUUiomw6ZN0Nssff1LJU/Mhp7BAVcwBRVk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org CE0B4616B8 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org Subject: [PATCH 2/6] ath10k: don't disable interrupts in ath10k_sdio_remove() From: Kalle Valo To: ath10k@lists.infradead.org Date: Fri, 12 Apr 2019 16:28:25 +0300 Message-ID: <155507570518.32018.13698324211799701564.stgit@potku.adurom.net> In-Reply-To: <155507569645.32018.15231567732563770250.stgit@potku.adurom.net> References: <155507569645.32018.15231567732563770250.stgit@potku.adurom.net> User-Agent: StGit/0.17.1-17-ge4e0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190412_062829_456227_9868A2CD X-CRM114-Status: UNSURE ( 9.14 ) X-CRM114-Notice: Please train this message. X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wen Gong Disabling interrupts this early meant WMI communication was not working anymore when the SDIO device was removed. But we call ath10k_core_unregister() that will eventually call ath10k_sdio_hif_stop(), which disables the interrupts. So there's actually no need to disable interrupts here. Also remove cancel_work_sync() as it's also called in ath10k_sdio_hif_stop(). Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00007-QCARMSWP-1. Signed-off-by: Wen Gong Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath10k/sdio.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index fae56c67766f..d573d24624c0 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -2073,8 +2073,6 @@ static void ath10k_sdio_remove(struct sdio_func *func) "sdio removed func %d vendor 0x%x device 0x%x\n", func->num, func->vendor, func->device); - (void)ath10k_sdio_hif_disable_intrs(ar); - cancel_work_sync(&ar_sdio->wr_async_work); ath10k_core_unregister(ar); ath10k_core_destroy(ar); } From patchwork Fri Apr 12 13:28:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 10898295 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 162DC1515 for ; Fri, 12 Apr 2019 13:28:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3227288F8 for ; Fri, 12 Apr 2019 13:28:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D628728E15; Fri, 12 Apr 2019 13:28:47 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 825CE288F8 for ; Fri, 12 Apr 2019 13:28:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:To:From:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ntmi2zwpbaOb2dceX6q10wc07DTbysdBQddUdGwv8MQ=; b=bFDaQZOba3jHSd Hk8/fcRgS5wdOEuIrPxsMLt2kpi/1NFRSm26s3FSLp9of+YQzn8TUGCvvmvjemcWOs4CWVmJ7ElpW 9kx8vkdyjD9UfLuYV+gTITdhA+7PzO2VkW58N4Xst62YlIp3vkF7RpEebi26lhNXz5850UJsDtEVf mO0sS3lZezKeS4bXddxuGANUIov2wm5aHzRy2fj/NggF5O92QXoISopVyQMi23OB9TdSZ6gXBZMhU Pv4NCXgkfSlkVzKuqMCjVXp8l4jlHo8oQrckGU1CsXQYVLP+HoMcQS4nZav5yWBwXcPuDH9JGm3nf ewrbMDEP6Ml/wk6EebzA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEwET-0002kL-9Q; Fri, 12 Apr 2019 13:28:41 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEwEP-0002iC-Uk for ath10k@lists.infradead.org; Fri, 12 Apr 2019 13:28:39 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9926261785; Fri, 12 Apr 2019 13:28:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1555075717; bh=IOnC3d2srXx6IX8l6BUh1Xet/IovSgBdXNg3n8N/F3A=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=htyoHRADmqfdZ8aZ1/hGaFajDx6b2RifeRYt//5PA96Lrtzc239GFllt/lGZ2xfr+ ulA8AFOgQtrnLDghyhEwjR+/TdpuGQeoOInGhX/APihgQ0zLiMj5aUIg3Xs1dwg/fJ CUTLEwQE9mU7LMXy5XdrklZ6vgCgwqNoaCA9v4uI= Received: from potku.adurom.net (88-114-240-156.elisa-laajakaista.fi [88.114.240.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: kvalo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 7977461544; Fri, 12 Apr 2019 13:28:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1555075717; bh=IOnC3d2srXx6IX8l6BUh1Xet/IovSgBdXNg3n8N/F3A=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=htyoHRADmqfdZ8aZ1/hGaFajDx6b2RifeRYt//5PA96Lrtzc239GFllt/lGZ2xfr+ ulA8AFOgQtrnLDghyhEwjR+/TdpuGQeoOInGhX/APihgQ0zLiMj5aUIg3Xs1dwg/fJ CUTLEwQE9mU7LMXy5XdrklZ6vgCgwqNoaCA9v4uI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 7977461544 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org Subject: [PATCH 3/6] ath10k: htt: don't use txdone_fifo with SDIO From: Kalle Valo To: ath10k@lists.infradead.org Date: Fri, 12 Apr 2019 16:28:34 +0300 Message-ID: <155507571386.32018.4599069777915701774.stgit@potku.adurom.net> In-Reply-To: <155507569645.32018.15231567732563770250.stgit@potku.adurom.net> References: <155507569645.32018.15231567732563770250.stgit@potku.adurom.net> User-Agent: StGit/0.17.1-17-ge4e0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190412_062838_169747_67FCCE4E X-CRM114-Status: GOOD ( 10.31 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alagu Sankar HTT High Latency (ATH10K_DEV_TYPE_HL) does not use txdone_fifo at all, we don't even initialise it by skipping ath10k_htt_tx_alloc_buf() in ath10k_htt_tx_start(). Because of this using QCA6174 SDIO ath10k_htt_rx_tx_compl_ind() will crash when it accesses unitialised txdone_fifo. So skip txdone_fifo when using High Latency mode. Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00007-QCARMSWP-1. Co-developed-by: Wen Gong Signed-off-by: Alagu Sankar Signed-off-by: Wen Gong Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath10k/htt_rx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index a20ea270d519..8d13d0c3e85e 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -2277,7 +2277,9 @@ static void ath10k_htt_rx_tx_compl_ind(struct ath10k *ar, * Note that with only one concurrent reader and one concurrent * writer, you don't need extra locking to use these macro. */ - if (!kfifo_put(&htt->txdone_fifo, tx_done)) { + if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL) { + ath10k_txrx_tx_unref(htt, &tx_done); + } else if (!kfifo_put(&htt->txdone_fifo, tx_done)) { ath10k_warn(ar, "txdone fifo overrun, msdu_id %d status %d\n", tx_done.msdu_id, tx_done.status); ath10k_txrx_tx_unref(htt, &tx_done); From patchwork Fri Apr 12 13:28:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 10898299 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 642751515 for ; Fri, 12 Apr 2019 13:28:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41F05286B4 for ; Fri, 12 Apr 2019 13:28:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3682628E12; Fri, 12 Apr 2019 13:28: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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D2C56286B4 for ; Fri, 12 Apr 2019 13:28:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:To:From:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/2lZ5PzJAf64ZNOPLlqrw49jq3N8Gm+XMnXrUWAnNbs=; b=uEDtEh4dbLv+zC 5UQKqApDcgULYNx9sXPJ2K68NDUcwkbt4eo2jUth0cW+28uKQ10c1R++B9GFmKSbdN7D642bsw0i7 7ai4GskGaiLg/wSeZAGUy4ZiMaognLqQdekyRYX4BUUZrx4cqbVoDrUmAPfEmbRYi7IUna9EIJvRP myp2mSI5B6KY+bAF0vA6XTcuy0ZD6qaoAntL6dmfnIvYbsyus1J3fUP8xiytnhpUY4P4p71BJFcDN 2dCC6vBOG9uSiNKcLTLvGmh1kuKRVtUoz9eVWcRXzNJVIgbj4eTV8so5RNfPn1ozrKcQH22pRvUWM 0vzAiljnKRiQ9VSMMT0g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEwEb-0002qH-C6; Fri, 12 Apr 2019 13:28:49 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEwEY-0002p1-TZ for ath10k@lists.infradead.org; Fri, 12 Apr 2019 13:28:48 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id A25B0615E3; Fri, 12 Apr 2019 13:28:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1555075726; bh=nsnvU3lPYJpM9h16jP2Mq8aGetDJICeUt3QinjyT3oc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=WmyiMSA7Mp6WWP5sg1SWj+pIhpWnMX8EpmZTc9dlSPrWhXqz9Rj8H4nNxoE0R8290 Kb7mR4ikZOhDN5BER6I1Cevta9oaqCQy61ykUxWwNi54/m9ULB4tUD7F6wyoF2jxTn ld0NINgFNoVq5FiqyX7OSE1LyZk++t8cobn1N30g= Received: from potku.adurom.net (88-114-240-156.elisa-laajakaista.fi [88.114.240.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: kvalo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 4408561576; Fri, 12 Apr 2019 13:28:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1555075725; bh=nsnvU3lPYJpM9h16jP2Mq8aGetDJICeUt3QinjyT3oc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=OYKrTBpHcvZ/7JsiFS1K40Ncd2Tmu5iSdnowwW0j3TzJHPERCSnIKBc/xRsw9audD kEpPaAsIajbqZWtQNZnqdHR8mn0YP+c9JWpKHXNeyffgFfE6NxYXq7x25yvUKgJusS I/5GAmw4qfO56TnabG/FaQmZ9dk+vSJ7CVttrVv4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4408561576 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org Subject: [PATCH 4/6] ath10k: initialise struct ath10k_bus params to zero From: Kalle Valo To: ath10k@lists.infradead.org Date: Fri, 12 Apr 2019 16:28:43 +0300 Message-ID: <155507572259.32018.5435832600956812976.stgit@potku.adurom.net> In-Reply-To: <155507569645.32018.15231567732563770250.stgit@potku.adurom.net> References: <155507569645.32018.15231567732563770250.stgit@potku.adurom.net> User-Agent: StGit/0.17.1-17-ge4e0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190412_062847_013293_BC404EFE X-CRM114-Status: GOOD ( 10.95 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This way we don't need to set every variable and give them to default, which is zero. This is also safer in case we forgot to initalise a new field in some of the bus modules. Compile tested only. Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath10k/ahb.c | 2 +- drivers/net/wireless/ath/ath10k/pci.c | 2 +- drivers/net/wireless/ath/ath10k/sdio.c | 2 +- drivers/net/wireless/ath/ath10k/snoc.c | 2 +- drivers/net/wireless/ath/ath10k/usb.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c index 0bf726c55736..f80854180e21 100644 --- a/drivers/net/wireless/ath/ath10k/ahb.c +++ b/drivers/net/wireless/ath/ath10k/ahb.c @@ -740,7 +740,7 @@ static int ath10k_ahb_probe(struct platform_device *pdev) enum ath10k_hw_rev hw_rev; size_t size; int ret; - struct ath10k_bus_params bus_params; + struct ath10k_bus_params bus_params = {}; of_id = of_match_device(ath10k_ahb_of_match, &pdev->dev); if (!of_id) { diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index 271f92c24d44..13c24cd977d2 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -3478,7 +3478,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev, struct ath10k *ar; struct ath10k_pci *ar_pci; enum ath10k_hw_rev hw_rev; - struct ath10k_bus_params bus_params; + struct ath10k_bus_params bus_params = {}; bool pci_ps; int (*pci_soft_reset)(struct ath10k *ar); int (*pci_hard_reset)(struct ath10k *ar); diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index d573d24624c0..bbfdc4d7cf5f 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -1954,7 +1954,7 @@ static int ath10k_sdio_probe(struct sdio_func *func, struct ath10k *ar; enum ath10k_hw_rev hw_rev; u32 dev_id_base; - struct ath10k_bus_params bus_params; + struct ath10k_bus_params bus_params = {}; int ret, i; /* Assumption: All SDIO based chipsets (so far) are QCA6174 based. diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c index 873cb4ce419b..845914f2eaf8 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -1249,7 +1249,7 @@ static int ath10k_snoc_resource_init(struct ath10k *ar) int ath10k_snoc_fw_indication(struct ath10k *ar, u64 type) { struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); - struct ath10k_bus_params bus_params; + struct ath10k_bus_params bus_params = {}; int ret; if (test_bit(ATH10K_SNOC_FLAG_UNREGISTERING, &ar_snoc->flags)) diff --git a/drivers/net/wireless/ath/ath10k/usb.c b/drivers/net/wireless/ath/ath10k/usb.c index 970cf69ac35f..2fb0fb40e86d 100644 --- a/drivers/net/wireless/ath/ath10k/usb.c +++ b/drivers/net/wireless/ath/ath10k/usb.c @@ -973,7 +973,7 @@ static int ath10k_usb_probe(struct usb_interface *interface, struct usb_device *dev = interface_to_usbdev(interface); int ret, vendor_id, product_id; enum ath10k_hw_rev hw_rev; - struct ath10k_bus_params bus_params; + struct ath10k_bus_params bus_params = {}; /* Assumption: All USB based chipsets (so far) are QCA9377 based. * If there will be newer chipsets that does not use the hw reg From patchwork Fri Apr 12 13:28:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 10898303 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 34E631669 for ; Fri, 12 Apr 2019 13:29:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C833286B4 for ; Fri, 12 Apr 2019 13:29:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1E8E2890F; Fri, 12 Apr 2019 13:29:07 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 95F01286B4 for ; Fri, 12 Apr 2019 13:29:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:To:From:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CgfWMVot4AYV+SPIMPOs1spJDcHdyaU+k91kwuZ/ldE=; b=WXZgLT8oci6dNX F0jWKynOkGPPPQ18sp2nkKcJsriB7zjtFtnuPYAb7Dt17ZPa/XGkxJz3XZbrbGoZ6aksArICF4LOy /g5u/z5uWH8OWzp1YBlas4kod2ZLfAOGoraERBPilQ/AhmqMu6YU+yxCroaREA4ZGu9cPonK2bU7q EAbouNF2oOq09OnuV6nqW1ImORmS5ixcVitRzqI7+4pvDTwMF0Zzg5xylRJlGsLgPouQOx4es9ZS6 q6ZnmzVWED3Fa8vUYWeNBAIgln3oi/RN+sV3X5il3jYytYlZ6QcpBNs4yNaXKPXQ/8ckQOphJEbyK lsnY5gPdmDvU/wdXQ/jA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEwEl-0002vv-VN; Fri, 12 Apr 2019 13:28:59 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEwEj-0002vD-31 for ath10k@lists.infradead.org; Fri, 12 Apr 2019 13:28:58 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id EE2EB615BE; Fri, 12 Apr 2019 13:28:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1555075736; bh=FlyOxdMOUqS2MSAO8lUpqTf8ORaBoXHirFVY+/CUD2c=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=V4zfmxEmtMU6mJEwHzfYL5Bk1QudIDWvgpo53bSfu9Lg+cZ7Rhy41JFhHP7g96nKg x/9V6HZ9u1Fh+B6ENXaPikOYEjlIWTUc6nAjNTym/xUwH+EQ3cwmPdnTMCKGYu5Z7L 2XXR34K1D9nK9K0IjEpWQWvpTE2b/5O6jWmk7Mu0= Received: from potku.adurom.net (88-114-240-156.elisa-laajakaista.fi [88.114.240.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: kvalo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 448F16177C; Fri, 12 Apr 2019 13:28:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1555075735; bh=FlyOxdMOUqS2MSAO8lUpqTf8ORaBoXHirFVY+/CUD2c=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=EUqaYnFao1HHjtLSVs+Lq/UmV5JFehDwchDrLCgzQkh2xoD6m27Y61OPHFspEugz6 873u5AC3ug83UU87D4e2ADfQXDFl63/lsU52+8wKg3Hdi2OFlhSPBg8hADO5f2/4dI WF0XY9RFMkw+MemerJv7kXEgTawMBsGwx4UvEXhg= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 448F16177C Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org Subject: [PATCH 5/6] ath10k: htt: support MSDU ids with SDIO From: Kalle Valo To: ath10k@lists.infradead.org Date: Fri, 12 Apr 2019 16:28:52 +0300 Message-ID: <155507573152.32018.18267130026274436463.stgit@potku.adurom.net> In-Reply-To: <155507569645.32018.15231567732563770250.stgit@potku.adurom.net> References: <155507569645.32018.15231567732563770250.stgit@potku.adurom.net> User-Agent: StGit/0.17.1-17-ge4e0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190412_062857_161603_B9D87D7F X-CRM114-Status: GOOD ( 15.40 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alagu Sankar Transmit completion for SDIO is similar to PCIe, modify the high latency path to allow SDIO modules to use the msdu id. kvalo: the original patch from Alagu enabled this only for SDIO but I'm not sure should we also enable this with USB. I'll use bus params to enable this for so that it's easy to enable also for USB later. Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00007-QCARMSWP-1. Co-developed-by: Wen Gong Signed-off-by: Alagu Sankar Signed-off-by: Wen Gong . Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath10k/core.h | 1 + drivers/net/wireless/ath/ath10k/htt_tx.c | 13 ++++++++++++- drivers/net/wireless/ath/ath10k/sdio.c | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index e08a17b01e03..f22cb3f49034 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -919,6 +919,7 @@ struct ath10k_bus_params { u32 chip_id; enum ath10k_dev_type dev_type; bool link_can_suspend; + bool hl_msdu_ids; }; struct ath10k { diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c index d8e9cc0bb772..88f880b601d8 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c @@ -1244,6 +1244,7 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm u8 tid = ath10k_htt_tx_get_tid(msdu, is_eth); u8 flags0 = 0; u16 flags1 = 0; + u16 msdu_id = 0; data_len = msdu->len; @@ -1291,6 +1292,16 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm } } + if (ar->bus_param.hl_msdu_ids) { + flags1 |= HTT_DATA_TX_DESC_FLAGS1_POSTPONED; + res = ath10k_htt_tx_alloc_msdu_id(htt, msdu); + if (res < 0) { + ath10k_err(ar, "msdu_id allocation failed %d\n", res); + goto out; + } + msdu_id = res; + } + skb_push(msdu, sizeof(*cmd_hdr)); skb_push(msdu, sizeof(*tx_desc)); cmd_hdr = (struct htt_cmd_hdr *)msdu->data; @@ -1300,7 +1311,7 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm tx_desc->flags0 = flags0; tx_desc->flags1 = __cpu_to_le16(flags1); tx_desc->len = __cpu_to_le16(data_len); - tx_desc->id = 0; + tx_desc->id = __cpu_to_le16(msdu_id); tx_desc->frags_paddr = 0; /* always zero */ /* Initialize peer_id to INVALID_PEER because this is NOT * Reinjection path diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index bbfdc4d7cf5f..d5073fac9509 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -2045,6 +2045,8 @@ static int ath10k_sdio_probe(struct sdio_func *func, bus_params.dev_type = ATH10K_DEV_TYPE_HL; /* TODO: don't know yet how to get chip_id with SDIO */ bus_params.chip_id = 0; + bus_params.hl_msdu_ids = true; + ret = ath10k_core_register(ar, &bus_params); if (ret) { ath10k_err(ar, "failed to register driver core: %d\n", ret); From patchwork Fri Apr 12 13:29:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 10898307 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B636D1515 for ; Fri, 12 Apr 2019 13:29:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95FAD288F8 for ; Fri, 12 Apr 2019 13:29:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A2B228E12; Fri, 12 Apr 2019 13:29:19 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 32585288F8 for ; Fri, 12 Apr 2019 13:29:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:To:From:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9HeusQzEkZlrxLALqcESMRGS/nPs1O+14LittMzKdJY=; b=GXcaJpBed/T/ET kamDwD1e+Yn4s08pNxQsxLrH7ve1gzc0coGg03FNU9J2JHi2osGGpa9v454INQPYtQEJBaZUfzg6l NMpNpzwyLemfRrhsC/wU7cQdU/2PWEbdd8a/CGFLpT9Grx2leMxcux5zOf9K6ZXiVIHUAg3+0diHN v/JnKN9D6L2u7gKqeCYhpBye/ZyzS7giRk75DtPmo07fMzPZZdT0aVHCwEyA7QqRuyg6lTLX54rpH xtunwchdFhCW+nJ5iDvs0iO26FgTHHcwaCvRhwphzpMtvbtYST4pME1ligYO810llsJidzk6RFjGO NNhue02tE74eDFB5eLew==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEwEy-00031c-Lk; Fri, 12 Apr 2019 13:29:12 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEwEw-000312-4b for ath10k@lists.infradead.org; Fri, 12 Apr 2019 13:29:11 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D5BB9615E8; Fri, 12 Apr 2019 13:29:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1555075749; bh=S50BPW/GkQXXaXvMOnu3qeYwlfwN4BWbhQvIB7432jA=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=ljXrKiJAa4TYmO9dbfnLGSbRWl9CSw44A75J5MQMNwi8HNWb4R1/Vgj0Sl5aead+6 3LH2wAVCLE7vUsgcYtUmh5g/mKhUkJ8DIajWZJVRyYgpTm2fGaH5ThiCSjAWNpQ6kH Pdw/tVF6PyNlchzE6nfP8r+biwX4b+DLhN53qswQ= Received: from potku.adurom.net (88-114-240-156.elisa-laajakaista.fi [88.114.240.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: kvalo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5752E615E8; Fri, 12 Apr 2019 13:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1555075749; bh=S50BPW/GkQXXaXvMOnu3qeYwlfwN4BWbhQvIB7432jA=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=ljXrKiJAa4TYmO9dbfnLGSbRWl9CSw44A75J5MQMNwi8HNWb4R1/Vgj0Sl5aead+6 3LH2wAVCLE7vUsgcYtUmh5g/mKhUkJ8DIajWZJVRyYgpTm2fGaH5ThiCSjAWNpQ6kH Pdw/tVF6PyNlchzE6nfP8r+biwX4b+DLhN53qswQ= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5752E615E8 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org Subject: [PATCH 6/6] ath10k: fix use-after-free on SDIO data frames From: Kalle Valo To: ath10k@lists.infradead.org Date: Fri, 12 Apr 2019 16:29:01 +0300 Message-ID: <155507574058.32018.14662612119958699740.stgit@potku.adurom.net> In-Reply-To: <155507569645.32018.15231567732563770250.stgit@potku.adurom.net> References: <155507569645.32018.15231567732563770250.stgit@potku.adurom.net> User-Agent: StGit/0.17.1-17-ge4e0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190412_062910_216554_AF2CEFBE X-CRM114-Status: GOOD ( 10.28 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP With SDIO there's a use after free after a data frame is transfered, call stack below. This happens because ath10k_htt_tx_hl() directly transmits the skb provided by mac80211 using ath10k_htc_send(), all other HTT functions use separate skb created with ath10k_htc_alloc_skb() to transmit the HTC packet. After the packet is transmitted mac80211 frees the skb in ieee80211_tx_status() but HTT layer expects that it still owns the skb, and frees it in ath10k_htt_htc_tx_complete(). To fix this take a reference of skb before sending it to HTC layer to make sure we still own the skb. Tested on QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00007-QCARMSWP-1. ath10k_htt_tx_hl() is only used by SDIO and USB so other busses (PCI, AHB and SNOC) should be unaffected. call stack of use-after-free: dump_backtrace+0x0/0x2d8 show_stack+0x20/0x2c __dump_stack+0x20/0x28 dump_stack+0xc8/0xec print_address_description+0x74/0x240 kasan_report+0x258/0x274 __asan_report_load4_noabort+0x20/0x28 skb_pull+0xbc/0x114 ath10k_htc_notify_tx_completion+0x190/0x2a4 [ath10k_core] ath10k_sdio_write_async_work+0x1e4/0x2c4 [ath10k_sdio] process_one_work+0x3d8/0x8b0 worker_thread+0x518/0x7e0 kthread+0x260/0x278 ret_from_fork+0x10/0x18 Allocated by one task: kasan_kmalloc+0xa0/0x13c kasan_slab_alloc+0x14/0x1c kmem_cache_alloc+0x144/0x208 __alloc_skb+0xec/0x394 alloc_skb_with_frags+0x8c/0x374 sock_alloc_send_pskb+0x520/0x5d4 sock_alloc_send_skb+0x40/0x50 __ip_append_data+0xf5c/0x1858 ip_make_skb+0x194/0x1d4 udp_sendmsg+0xf24/0x1ab8 inet_sendmsg+0x1b0/0x2e0 sock_sendmsg+0x88/0xa0 __sys_sendto+0x220/0x3a8 __arm64_sys_sendto+0x78/0x80 el0_svc_common+0x120/0x1e0 el0_svc_compat_handler+0x64/0x80 el0_svc_compat+0x8/0x18 Freed by another task: __kasan_slab_free+0x120/0x1d4 kasan_slab_free+0x10/0x1c kmem_cache_free+0x74/0x504 kfree_skbmem+0x88/0xc8 __kfree_skb+0x24/0x2c consume_skb+0x114/0x18c __ieee80211_tx_status+0xb7c/0xf60 [mac80211] ieee80211_tx_status+0x224/0x270 [mac80211] ath10k_txrx_tx_unref+0x564/0x950 [ath10k_core] ath10k_htt_t2h_msg_handler+0x178c/0x2a38 [ath10k_core] ath10k_htt_htc_t2h_msg_handler+0x20/0x30 [ath10k_core] ath10k_sdio_irq_handler+0xcc0/0x1654 [ath10k_sdio] process_sdio_pending_irqs+0xec/0x358 sdio_run_irqs+0x68/0xe4 sdio_irq_work+0x1c/0x28 process_one_work+0x3d8/0x8b0 worker_thread+0x518/0x7e0 kthread+0x260/0x278 ret_from_fork+0x10/0x18 Reported-by: Wen Gong Tested-by: Wen Gong Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath10k/htt_tx.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c index 88f880b601d8..78f07b7a3b21 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c @@ -1302,6 +1302,13 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm msdu_id = res; } + /* As msdu is freed by mac80211 (in ieee80211_tx_status()) and by + * ath10k (in ath10k_htt_htc_tx_complete()) we have to increase + * reference by one to avoid a use-after-free case and a double + * free. + */ + skb_get(msdu); + skb_push(msdu, sizeof(*cmd_hdr)); skb_push(msdu, sizeof(*tx_desc)); cmd_hdr = (struct htt_cmd_hdr *)msdu->data;