From patchwork Tue Apr 9 19:08:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 10891941 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 92E5B1800 for ; Tue, 9 Apr 2019 19:13:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77A5B2880D for ; Tue, 9 Apr 2019 19:13:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BC9928938; Tue, 9 Apr 2019 19:13:15 +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_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,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 1BB402880D for ; Tue, 9 Apr 2019 19:13:15 +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:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=M9lCGEs+Tz36H0VlG/rq5YSGpRx5c29m98uM0r1NN8k=; b=q3a3Fsa+KqkDLQ gvOtrS5giJ3ZOeK/0CiRfQg95x4M1dmpB2epnY+8udYS5ia7a35WZi5XvnXPb8BFlzTyTzchzRUNm Ge0xPR2EcPJ3qYIUe9XluOinpSy7xdaQoQBZb/KF2Hk5MbQFy2xi8RzpQxzcHQCSSFkbDv5ydpsqZ SeoWKBv1IMSjsdbYR0UBaLNgbTtvHwWsOIHa1vaJJnOoKoItiwnnNCfEAmi3cHsihcPFv2n2sPQ2S khvA+zW94am2nIELFsp/2X62gGFcj+AjtMj+uB9l3y/3G4+5Hp0KzlaXyvgMbsYGefDJNO7npHshK p47wEYzP5ajXCb0D0Qxg==; 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 1hDwBG-0001no-67; Tue, 09 Apr 2019 19:13:14 +0000 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDwBC-0001kp-1e for ath10k@lists.infradead.org; Tue, 09 Apr 2019 19:13:11 +0000 Received: by mail-lj1-x242.google.com with SMTP id f18so15484484lja.10 for ; Tue, 09 Apr 2019 12:13:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W6Bi6Zd+xlYB7BEidk7J7o7FjU63HXTJmOjt8n1/y+Y=; b=pA1pFrjMlmq/KfbLyF/VAyaYXoH2Q5994JlraOctwdYvWkL3xYb6KB1U6RbWdPnulD /B9R5lREwV1h7BEMP5P8+vvIs8PVa93rIDwzHZsNBRu5wAfKGUqBYSmKYNOGLAsQR1J3 uhRMEJEYDG6DqXqsqxo68pYGTr52yfyELS1bwGS0EYNeN8a+s4qXWGuLB5KC8QLICWdk esvq61U+VUADIRPcUGXlSyq8/eU5IBEBd4+bvEhdNhTTl25fguvyYgYvEbH9WLUsQ7eo a/EADjKFEDaz3q9V4v6dO9milFRsVt349gu52JForlIIBuzSRZP8qfkYak34C4way+cR N2iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W6Bi6Zd+xlYB7BEidk7J7o7FjU63HXTJmOjt8n1/y+Y=; b=nsFwuBQuPDgEvvpiKxfEoVNhqTaDOLsbeFEVVtEUYGF9Ac1hNW9DivtNpQUKQ0plJ1 YoOilaXtZltVE3LFotcWRT8vN8XMtGGV8fYoGb8EtKyCYhEAJVV3RVk+uF5YxQ7eQYxz CYsPgjsjfVr8NX9ffSrIiS2jqGoto0dRaY2XQAO7Xfg56NxEk/qxp1wV2zgGnsqIQ8HG j6PWK4gxb/FiHQ2HTY96WhANDqcz/WTlb80/0QB3/FYQHi9he+tvaPoj24mDM/5mGBcK 9e4xBI+bjQ0CyGhr2Eh2ljxYBRfVtBLVw9qYeGrGmgcrAK46dplqSucq08V+ATAoFFhn 9/UA== X-Gm-Message-State: APjAAAWY2x8dDbOWf36vP/WWaT9peeTejrQ7yyS+rLym5Bsw/jMjVpob 1KmdOzW/wnD1JVYCqqbvfsY= X-Google-Smtp-Source: APXvYqydxppC0vLz3qTRX6s6ocXeNZ3M89n4OLaqN5PDKlo1Tp4x4UhEQnDYhnI1zwO0e1Iu6MD5jw== X-Received: by 2002:a2e:9a91:: with SMTP id p17mr20553831lji.127.1554837188123; Tue, 09 Apr 2019 12:13:08 -0700 (PDT) Received: from localhost.localdomain (81-233-89-221-no75.tbcn.telia.com. [81.233.89.221]) by smtp.gmail.com with ESMTPSA id q64sm6807848ljq.76.2019.04.09.12.13.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 12:13:07 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [PATCH 1/6] ath10k: use clean packet headers Date: Tue, 9 Apr 2019 21:08:46 +0200 Message-Id: <20190409190851.4557-2-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190409190851.4557-1-erik.stromdahl@gmail.com> References: <20190409190851.4557-1-erik.stromdahl@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190409_121310_084070_3B007F36 X-CRM114-Status: GOOD ( 10.36 ) 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: Alagu Sankar Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alagu Sankar HTC header carries junk values that may be interpreted by the firmware differently. Enable credit update only if flow control is enabled for the corresponding endpoint. PLL clock setting sequence does not mask the PLL_CONTROL register value. Side effect of not masking the values is not known as the entire pll clock setting sequence is undocumented. Signed-off-by: Alagu Sankar --- drivers/net/wireless/ath/ath10k/htc.c | 1 + drivers/net/wireless/ath/ath10k/hw.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c index 805a7f8a04f2..1d4d1a1992fe 100644 --- a/drivers/net/wireless/ath/ath10k/htc.c +++ b/drivers/net/wireless/ath/ath10k/htc.c @@ -73,6 +73,7 @@ static void ath10k_htc_prepare_tx_skb(struct ath10k_htc_ep *ep, struct ath10k_htc_hdr *hdr; hdr = (struct ath10k_htc_hdr *)skb->data; + memset(hdr, 0, sizeof(struct ath10k_htc_hdr)); hdr->eid = ep->eid; hdr->len = __cpu_to_le16(skb->len - sizeof(*hdr)); diff --git a/drivers/net/wireless/ath/ath10k/hw.c b/drivers/net/wireless/ath/ath10k/hw.c index ad082b7d7643..cfc232f1fdbc 100644 --- a/drivers/net/wireless/ath/ath10k/hw.c +++ b/drivers/net/wireless/ath/ath10k/hw.c @@ -814,6 +814,8 @@ static int ath10k_hw_qca6174_enable_pll_clock(struct ath10k *ar) if (ret) return -EINVAL; + reg_val &= ~(WLAN_PLL_CONTROL_REFDIV_MASK | WLAN_PLL_CONTROL_DIV_MASK | + WLAN_PLL_CONTROL_NOPWD_MASK); reg_val |= (SM(hw_clk->refdiv, WLAN_PLL_CONTROL_REFDIV) | SM(hw_clk->div, WLAN_PLL_CONTROL_DIV) | SM(1, WLAN_PLL_CONTROL_NOPWD)); From patchwork Tue Apr 9 19:08:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 10891951 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 5D3C4922 for ; Tue, 9 Apr 2019 19:13:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4460E2880D for ; Tue, 9 Apr 2019 19:13:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 389BA28938; Tue, 9 Apr 2019 19:13: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_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,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 E67E92880D for ; Tue, 9 Apr 2019 19:13:18 +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:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=z3+Kxr9H35FqeD6AEyw90PE9TR+YpLs4npkyVehduR0=; b=KWfhjSAJDOXX1X zLAeizNZSnyUAUeJdPfJc16GuRroebqm2chwfXxWhgDoPkMAKiOOAok8VG83h27v6Wu3t8FYLllfA EzwITwnFLwbacb7NH+MCYdKCCOstIS/X3xsDb1/lTeETCJOSFHE7jxFLjwIoF2aVNRnalmX7MjZs7 J3FqJQAgV2jGWrjg/cr3xTdiOG8C/yh0j828spyi9Hs9x6LANqAOG1fPzHQsIoWfbC9az4n0LU+85 hntHmvYKjwf/aVyK760BYDYl5NRacSHXeWjONaSE5lt4REEEyhW6h3cINR64dJ8cgpujKkdOVGfzW 9oDN0f1cqAuw5VXKLggg==; 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 1hDwBI-0001r8-Lb; Tue, 09 Apr 2019 19:13:16 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDwBC-0001ks-Vu for ath10k@lists.infradead.org; Tue, 09 Apr 2019 19:13:12 +0000 Received: by mail-lf1-x142.google.com with SMTP id u17so3900665lfi.3 for ; Tue, 09 Apr 2019 12:13:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JTmqFgNzwEMzX2/VlhCrZe+jbyHjEvWhfr0MDtw6xTw=; b=pC1ZcmoTKR3Ap0XaWQQc4TYYu/EHakvd5TXVBzTZqL98eum0L5KOGxZFwvkhHQDbkL UQXlme+c9QhKsEbDUoszUwP55TXZ4UK94uc3VnD92hbND6KxU2zkUPtaT/oX40xmHrAM Nkt20Pno7YKQlnKRzd5nxGKyhWOpAOsYNB/FVnD5ZeTJ4XMBm2DZROA69JWRfSJtvukE TRfS7l3m0cI7ARtIwvAoNKbhze7qAkkColOQOr0DgXPXB+tVFWK8etj5gSqYuBjZtHgt upAaZhGflDFiVzoPfq9vZ7KpWVRh6nUnQwV0a23WbgecI8Ik3Cczj3G9FO5teFH6ttww mp3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JTmqFgNzwEMzX2/VlhCrZe+jbyHjEvWhfr0MDtw6xTw=; b=K7RlIDEMPBMQ8souGrhjdsvX7/m0xkJQyZUeBUY/+f/4k9tBhGZLDcPfcA35zMGX2r KgqpsvbcgyrsxNkidLLWQgUgmqEjcn0LYampRydWySMdxSr+xkabQW40p7i3GTKcyJPs Q9Sb/Ywno74DDdIQ8tsDTDenVXy8ITRtiH/gg8IsiD6b2IVfaBL4HIlxLJTcnHdTQdHJ p70ejCyF3s3gQ3WCWjaCY8bhdlBjxQUXo7bbJIVxE27ar+vCO2By9zZWPMXr3ze1HPaj aqWU1nJisVeXv/eNgkSUjJxhJnwhhAinvUAmOiJP1X6laumYQL2Zt4WhMjYdcM0feasd wOVQ== X-Gm-Message-State: APjAAAVuhciARHuUisAu1jIdO2+LlElKOF/2BspPl8t25Hbj8rWuRAnf TDPnNS8F4MypIk7Tykgy1vo= X-Google-Smtp-Source: APXvYqwjtw/cM8UKKmcgwTqXVc4IPi2Wtt0XLMfSe6E1k+AFaD6A9De9eWAkEVpY9ZpRqJxJyfmyRQ== X-Received: by 2002:a19:e30a:: with SMTP id a10mr4246969lfh.58.1554837189007; Tue, 09 Apr 2019 12:13:09 -0700 (PDT) Received: from localhost.localdomain (81-233-89-221-no75.tbcn.telia.com. [81.233.89.221]) by smtp.gmail.com with ESMTPSA id q64sm6807848ljq.76.2019.04.09.12.13.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 12:13:08 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [PATCH 2/6] ath10k: high latency fixes for beacon buffer Date: Tue, 9 Apr 2019 21:08:47 +0200 Message-Id: <20190409190851.4557-3-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190409190851.4557-1-erik.stromdahl@gmail.com> References: <20190409190851.4557-1-erik.stromdahl@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190409_121311_051968_4776FADF X-CRM114-Status: GOOD ( 11.84 ) 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: Alagu Sankar Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alagu Sankar Beacon buffer for high latency devices does not use DMA. other similar buffer allocation methods in the driver have already been modified for high latency path. Fix the beacon buffer allocation left out in the earlier high latency changes. Signed-off-by: Alagu Sankar --- drivers/net/wireless/ath/ath10k/mac.c | 31 ++++++++++++++++++++------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index c9e700b844f8..2dd99ce44453 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -953,8 +953,12 @@ static void ath10k_mac_vif_beacon_cleanup(struct ath10k_vif *arvif) ath10k_mac_vif_beacon_free(arvif); if (arvif->beacon_buf) { - dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, - arvif->beacon_buf, arvif->beacon_paddr); + if (ar->dev_type == ATH10K_DEV_TYPE_HL) + kfree(arvif->beacon_buf); + else + dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, + arvif->beacon_buf, + arvif->beacon_paddr); arvif->beacon_buf = NULL; } } @@ -5210,10 +5214,17 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, if (vif->type == NL80211_IFTYPE_ADHOC || vif->type == NL80211_IFTYPE_MESH_POINT || vif->type == NL80211_IFTYPE_AP) { - arvif->beacon_buf = dma_alloc_coherent(ar->dev, - IEEE80211_MAX_FRAME_LEN, - &arvif->beacon_paddr, - GFP_ATOMIC); + if (ar->dev_type == ATH10K_DEV_TYPE_HL) { + arvif->beacon_buf = kmalloc(IEEE80211_MAX_FRAME_LEN, + GFP_KERNEL); + arvif->beacon_paddr = (dma_addr_t)arvif->beacon_buf; + } else { + arvif->beacon_buf = + dma_alloc_coherent(ar->dev, + IEEE80211_MAX_FRAME_LEN, + &arvif->beacon_paddr, + GFP_ATOMIC); + } if (!arvif->beacon_buf) { ret = -ENOMEM; ath10k_warn(ar, "failed to allocate beacon buffer: %d\n", @@ -5424,8 +5435,12 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, err: if (arvif->beacon_buf) { - dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, - arvif->beacon_buf, arvif->beacon_paddr); + if (ar->dev_type == ATH10K_DEV_TYPE_HL) + kfree(arvif->beacon_buf); + else + dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, + arvif->beacon_buf, + arvif->beacon_paddr); arvif->beacon_buf = NULL; } From patchwork Tue Apr 9 19:08:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 10891953 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 3E460922 for ; Tue, 9 Apr 2019 19:13:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23ECB2880D for ; Tue, 9 Apr 2019 19:13:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 180DF28938; Tue, 9 Apr 2019 19:13:22 +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_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,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 B13982880D for ; Tue, 9 Apr 2019 19:13:21 +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:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5ukidqk2RyrpKvIsDmGoIiDtMFhgflK4ElqIftg+R7o=; b=D1EDnwtOjVxxl4 mkMd5EM3E/BByGspT+EOyLwxCHF9JoiJ3HtokOXj8IaZunUuAWHlCo6OYQ++Z2+fJqGml03R3tnHO 0kgqlrff3aNlMaYHs8MWBMUOKINClUmSP8hO15c75KfwT/MmotA+pj+tNBOk/rnLNNKYzqHnHtAsU 9Zeo/3A/YZsD/7rFqdTAK7WjHZS9IMLduaHm6g925tC6m+K3lUIkyTWIrIJYJQclp8CKh1WFOYO8b bEM/5rI7YQ7f8Rt0kx20rAkebsysoIdVePO4UJmfvpzj4Ytz64Ww4UoUkhIRQuj9rHSrx6Tg5We9o ZQnNC9G+eGtbI/YWfD8w==; 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 1hDwBL-0001vM-O1; Tue, 09 Apr 2019 19:13:19 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDwBD-0001lI-PU for ath10k@lists.infradead.org; Tue, 09 Apr 2019 19:13:13 +0000 Received: by mail-lj1-x244.google.com with SMTP id h16so15472181ljg.11 for ; Tue, 09 Apr 2019 12:13:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JYMoKVrYtQm5gciQWqLuKoh7pCSY8jTg6gPbHA/ChgE=; b=ozvv9UcmdeY2INPMjJwr8BZ+YjylxjPAmnwG6rI+nxxP1ZKB5ilWhScrfp9hN9G9xp aIfqtTDfJyn9N0dwVJJnwyAC1x2yih1gRhoDZyLjdwjqB+B08AGKow+pkmWwpx3+3qOK cNYUROiYvumwc/dhstShlGhQIddFYekMlXu9FrtUmXnLPJxsTG3jJSW4txG7tm0/i8FQ GMQujR1ObMtalSTCIKJ1ZrL8bXpGMyQf8dCx0+b4XtcVqCG2vA70enofVFLiLrrjw8Kl 8Bans6z6Sc+fu73lLVgztH6rSKkL8bv/oEfoBEFy3TR2bHOUPwPUHr/RKFo7J+ww1W8h aNFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JYMoKVrYtQm5gciQWqLuKoh7pCSY8jTg6gPbHA/ChgE=; b=eszeV0S/TyiQR3vZmvHr83oA3SO02qVr7TY+YoZg9VchpNRdrH/pChU4VCH1Vsf1Fg oiyCZTDK9g+l1JJg12PhRUe+MCkWqzsKc1V1blfjkueWmOyCMeKobB23LdvepsBDCYai 2orZgQiCK2G+CbJHdExbmNTy3up7sakaZiX5OtxZclI9YKSXCuAQiR5HBhooNRL+ws9c Rq3CGSZPVdgUtAig76Oocerlb+1gqwBySOhvZO4xCxFXjJu55bU9woZPIDjLPvWApPPG n/v76sNjUuFqOsFK27DsB0Imah2TjyVKC7GrAHvbw76RV4mRuT6Fe34zkc9PxMWo+wIY 9t/Q== X-Gm-Message-State: APjAAAX/ibulE1jNrxZf5r6pNdWDTrdaOS5ismbzZNacxPKtRXL2PkOT ReN98ylBGkFpUoM2gpecySo= X-Google-Smtp-Source: APXvYqzz9A2cPp9mok38/b0qWhdNrdRbotf8rKouYY6tJJTQTZ/t584ZG+69YhSbFPvXVGlgYXVTqw== X-Received: by 2002:a2e:9597:: with SMTP id w23mr14736366ljh.111.1554837189881; Tue, 09 Apr 2019 12:13:09 -0700 (PDT) Received: from localhost.localdomain (81-233-89-221-no75.tbcn.telia.com. [81.233.89.221]) by smtp.gmail.com with ESMTPSA id q64sm6807848ljq.76.2019.04.09.12.13.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 12:13:09 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [PATCH 3/6] ath10k: sdio: read RX packets in bundles Date: Tue, 9 Apr 2019 21:08:48 +0200 Message-Id: <20190409190851.4557-4-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190409190851.4557-1-erik.stromdahl@gmail.com> References: <20190409190851.4557-1-erik.stromdahl@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190409_121311_824642_A511F069 X-CRM114-Status: GOOD ( 16.63 ) 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: Erik Stromdahl , Alagu Sankar Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alagu Sankar The existing implementation of initiating multiple sdio transfers for receive bundling is slowing down the receive speed. Instead of having one sdio transfer for each packet in the bundle, we read all packets in one sdio transfer. This results in significant performance improvement on some targets. Co-developed-by: Erik Stromdahl Signed-off-by: Alagu Sankar Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/sdio.c | 66 +++++++++++++++++++++----- drivers/net/wireless/ath/ath10k/sdio.h | 2 + 2 files changed, 55 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index fae56c67766f..295e1e7ec3b0 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -24,6 +24,8 @@ #include "trace.h" #include "sdio.h" +#define ATH10K_SDIO_READ_BUF_SIZE (32 * 1024) + /* inlined helper functions */ static inline int ath10k_sdio_calc_txrx_padded_len(struct ath10k_sdio *ar_sdio, @@ -618,41 +620,68 @@ static int ath10k_sdio_mbox_rx_alloc(struct ath10k *ar, return ret; } -static int ath10k_sdio_mbox_rx_packet(struct ath10k *ar, - struct ath10k_sdio_rx_data *pkt) +static int ath10k_sdio_mbox_rx_fetch(struct ath10k *ar) { struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar); + struct ath10k_sdio_rx_data *pkt = &ar_sdio->rx_pkts[0]; struct sk_buff *skb = pkt->skb; int ret; - ret = ath10k_sdio_readsb(ar, ar_sdio->mbox_info.htc_addr, - skb->data, pkt->alloc_len); - pkt->status = ret; - if (!ret) + ret = ath10k_sdio_read(ar, ar_sdio->mbox_info.htc_addr, + skb->data, pkt->alloc_len); + if (ret) { + ar_sdio->n_rx_pkts = 0; + ath10k_sdio_mbox_free_rx_pkt(pkt); + } else { + pkt->status = ret; skb_put(skb, pkt->act_len); + } return ret; } -static int ath10k_sdio_mbox_rx_fetch(struct ath10k *ar) +static int ath10k_sdio_mbox_rx_fetch_bundle(struct ath10k *ar) { struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar); + struct ath10k_sdio_rx_data *pkt; int ret, i; + u32 pkt_offset = 0, pkt_bundle_len = 0; + + for (i = 0; i < ar_sdio->n_rx_pkts; i++) + pkt_bundle_len += ar_sdio->rx_pkts[i].alloc_len; + + if (pkt_bundle_len > ATH10K_SDIO_READ_BUF_SIZE) { + ret = -ENOMEM; + ath10k_err(ar, "bundle size (%d) exceeding limit %d\n", + pkt_bundle_len, ATH10K_SDIO_READ_BUF_SIZE); + goto err; + } + + ret = ath10k_sdio_readsb(ar, ar_sdio->mbox_info.htc_addr, + ar_sdio->sdio_read_buf, pkt_bundle_len); + if (ret) + goto err; for (i = 0; i < ar_sdio->n_rx_pkts; i++) { - ret = ath10k_sdio_mbox_rx_packet(ar, - &ar_sdio->rx_pkts[i]); - if (ret) - goto err; + struct sk_buff *skb = ar_sdio->rx_pkts[i].skb; + + pkt = &ar_sdio->rx_pkts[i]; + memcpy(skb->data, ar_sdio->sdio_read_buf + pkt_offset, + pkt->alloc_len); + pkt->status = 0; + skb_put(skb, pkt->act_len); + pkt_offset += pkt->alloc_len; } return 0; err: /* Free all packets that was not successfully fetched. */ - for (; i < ar_sdio->n_rx_pkts; i++) + for (i = 0; i < ar_sdio->n_rx_pkts; i++) ath10k_sdio_mbox_free_rx_pkt(&ar_sdio->rx_pkts[i]); + ar_sdio->n_rx_pkts = 0; + return ret; } @@ -695,7 +724,10 @@ static int ath10k_sdio_mbox_rxmsg_pending_handler(struct ath10k *ar, */ *done = false; - ret = ath10k_sdio_mbox_rx_fetch(ar); + if (ar_sdio->n_rx_pkts > 1) + ret = ath10k_sdio_mbox_rx_fetch_bundle(ar); + else + ret = ath10k_sdio_mbox_rx_fetch(ar); /* Process fetched packets. This will potentially update * n_lookaheads depending on if the packets contain lookahead @@ -2001,6 +2033,14 @@ static int ath10k_sdio_probe(struct sdio_func *func, goto err_core_destroy; } + ar_sdio->sdio_read_buf = devm_kzalloc(ar->dev, + ATH10K_SDIO_READ_BUF_SIZE, + GFP_KERNEL); + if (!ar_sdio->sdio_read_buf) { + ret = -ENOMEM; + goto err_core_destroy; + } + ar_sdio->func = func; sdio_set_drvdata(func, ar_sdio); diff --git a/drivers/net/wireless/ath/ath10k/sdio.h b/drivers/net/wireless/ath/ath10k/sdio.h index b8c7ac0330bd..07e2cc6a3bd8 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.h +++ b/drivers/net/wireless/ath/ath10k/sdio.h @@ -196,6 +196,8 @@ struct ath10k_sdio { struct ath10k *ar; struct ath10k_sdio_irq_data irq_data; + u8 *sdio_read_buf; + /* temporary buffer for BMI requests */ u8 *bmi_buf; From patchwork Tue Apr 9 19:08:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 10891955 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 04D7B17E6 for ; Tue, 9 Apr 2019 19:13:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFA472880D for ; Tue, 9 Apr 2019 19:13:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3ED928938; Tue, 9 Apr 2019 19:13:24 +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_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,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 837AD2880D for ; Tue, 9 Apr 2019 19:13:24 +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:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ipvAU0/V9HmcWcmJWx2svx8frRi+IEzbtPsE4PrN164=; b=MKOtzG9913cyHn J/4uwwE9SOXfD6ZkXuyR4BGFNAAMdnURSbhHa9YuxMJkJfnQlGTcg+ZIGxz/dMxOvbE1JivKCWZ7R FUUI2Xi2w290ok+Apfib17cnc10wmqJp7SFRQiwGA13WyH4In1p38hsyC0SY8Wr1G8XwldxMaZ5rJ LZ9zNvvKrwUFUauotqRWEOif9M1HggwwYv6YtRUj4/JOZY548NdU5YJBZMUdUBsMnNG7iaYx8qGs8 5LOZlyHPULNfOgStEU9Hescd9JYw1qzhFAzyQaalXGWiJTnH9GkjplY6F9RGFmAZXXxPQt5SLWRY/ PYkdBxace5qcB+i+3oHg==; 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 1hDwBO-00020J-VM; Tue, 09 Apr 2019 19:13:22 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDwBE-0001ly-J8 for ath10k@lists.infradead.org; Tue, 09 Apr 2019 19:13:15 +0000 Received: by mail-lf1-x142.google.com with SMTP id o199so598222lfo.1 for ; Tue, 09 Apr 2019 12:13:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6MzNwas+kmvZBqXFHalYjmibG7bDEawjRv+w+Gt/Y+4=; b=H0Au3SmX5gAs+c5l4QrTplUbRGj0r3VxLcYT/wYK9n+ecLK65XKTMBHrME5Ne7gUXi LgYUs/sETeTfAcVvv0+1fTR0CWF97bJhXD3VOsFoBncz1bOO292Li9d6QJ4H6MMC/aDh ht6Q2NnC7p3S44p2d/Iu87BARAKCnp93abCsuAmLo36SjOpvVQ1LPOcg8ohlUejLo8bq OCbV7xMDArjJgb/V0ZEtM6wQf9jBpK6OvDAr35TYMxceDOBMQsKwltBUkIHUo/8EIbNf Pi41JMAkU+xRNkK1uFkICnEuQ6ebbyMqGDTIHGj+MjLf6dzP0oOqOY28f2xui3afxt+9 UAwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6MzNwas+kmvZBqXFHalYjmibG7bDEawjRv+w+Gt/Y+4=; b=PbkVH5I9gME+8Bdm1sQNFExnvWa5ijyhI3Yx1TpMGG9v7u7lnOlhATWOrj2Jc7uji3 M6yEIo74wx9XZ63q3sGGxYGlvHJ2HnhuALjq9S+x19b5JLeyupvU9WTdSHj7XQ9G8Zl4 q0ZNUpqXDoC4CerkPijkx4adIogoqLkOKkxa+Rq5nzbTsOQrFaM/VfO4Pbpe8YGP7jb4 camlHMlmFzSinoEQlGiMDIaSyPvZJ8AO4MEIF7yTuoD3GI1+R1FG8sVJz/E6wqY9xggV cyzVoT6N6LOgi3wo/YVqJ0ZPhNGAUxoWtvs5YT4qRFUaSm88YH7y6xkRijzPo9cjCt6U Yblg== X-Gm-Message-State: APjAAAXlGDk46JdASxt+/sNjxbQr7i2be9qHjr/P83b3OKTsbOQGHmzY XYwWl4O7JU6xn+gG30H0mSA= X-Google-Smtp-Source: APXvYqxU2XfwiOpjOnQOzw3phiopNazl9V+ZaRz5pCJUVcc2xDtcHLAGIH/8CSgWMYwx36wFYkVDDQ== X-Received: by 2002:a19:e30b:: with SMTP id a11mr9039046lfh.4.1554837191052; Tue, 09 Apr 2019 12:13:11 -0700 (PDT) Received: from localhost.localdomain (81-233-89-221-no75.tbcn.telia.com. [81.233.89.221]) by smtp.gmail.com with ESMTPSA id q64sm6807848ljq.76.2019.04.09.12.13.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 12:13:10 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [PATCH 4/6] ath10k: sdio: add MSDU ID allocation in HTT TX path Date: Tue, 9 Apr 2019 21:08:49 +0200 Message-Id: <20190409190851.4557-5-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190409190851.4557-1-erik.stromdahl@gmail.com> References: <20190409190851.4557-1-erik.stromdahl@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190409_121312_670018_B756C94E X-CRM114-Status: GOOD ( 13.16 ) 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: Erik Stromdahl , Alagu Sankar Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alagu Sankar This makes the SDIO HTT TX path more similar to PCIe. Transmit completion for SDIO is similar to PCIe, via the T2H message HTT_T2H_MSG_TYPE_TX_COMPL_IND. This means that we will create a unique MSDU ID for each transmitted frame just as we do in the PCIe case. As a result of this, the TX skb will be freed when we receive the HTT_T2H_MSG_TYPE_TX_COMPL_IND message. Thus, we must not free the skb in the HTT ep_tx_complete handler in the SDIO case. Co-developed-by: Erik Stromdahl Signed-off-by: Alagu Sankar Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/htt_rx.c | 4 +++- drivers/net/wireless/ath/ath10k/htt_tx.c | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index a20ea270d519..6e3331b96c0f 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->hif.bus == ATH10K_BUS_SDIO) { + 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); diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c index 619c2b87b8bb..e5e6e206a52f 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c @@ -543,7 +543,8 @@ void ath10k_htt_tx_free(struct ath10k_htt *htt) void ath10k_htt_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb) { - dev_kfree_skb_any(skb); + if (!(ar->hif.bus == ATH10K_BUS_SDIO)) + dev_kfree_skb_any(skb); } void ath10k_htt_hif_tx_complete(struct ath10k *ar, struct sk_buff *skb) @@ -1244,6 +1245,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 +1293,16 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm } } + if (ar->hif.bus == ATH10K_BUS_SDIO) { + 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 +1312,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 From patchwork Tue Apr 9 19:08:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 10891957 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 61F6C17E6 for ; Tue, 9 Apr 2019 19:13:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 498352880D for ; Tue, 9 Apr 2019 19:13:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C5ED28938; Tue, 9 Apr 2019 19:13:28 +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_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,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 ED4492880D for ; Tue, 9 Apr 2019 19:13:27 +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:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bhq2krn8ygkPgfPVwUCwQtkAm/1vCt/t1T20/1Uq2VU=; b=oL52J3FqQ3JUh3 CBDEE0+E91nLt0FLBVcCgDcnQTNlwwy+//Ii/CeUPFrHw/9oUzHLUd4pqiDUM+/nzHTqjzib2k5JV 7ww/81E8crNV/co5heFAjp0I3eHLL74Sr2uYjn1rnTqOx3BeL2wKtlTLv2OrgbmNThECjeLulKVS/ TGpld7M/iXNQlYSQNyKWx+8AexnTgptRiXSoieHKjO7QPD4jehTolKwQygcdXFtE5ni3Mx00ft/7a GVjrZfucLVxTet6PDe5Pv42aoBB6zAYMCiL7YSPc4k9HmbgmD0zj3SaSHxqAFQ6Z9Woqi3T1LgYN2 uJvXclQbecBg5OM1+J2A==; 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 1hDwBR-00024t-Vj; Tue, 09 Apr 2019 19:13:25 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDwBF-0001mI-H7 for ath10k@lists.infradead.org; Tue, 09 Apr 2019 19:13:15 +0000 Received: by mail-lj1-x244.google.com with SMTP id j89so15536992ljb.1 for ; Tue, 09 Apr 2019 12:13:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3jf7/3Wcpi0foIcFTrOIi7geeJuAbQU85kMpO8kay/o=; b=rAnTJJIUQ9lxjUTBnu3mbOvLRNJ7une05H3PUjGOLeXnVdcW091vW6AEz13kU64D5n C3TFZZjuGMazpeB65t9DE4htgAFSrQczvyG3PtRGF67jzpo0OJkFsMh+lASn2P6dhH1G s2gIyq8VG7CEPc6I6GOHc2NT5kPl+41INmdid/KcaM7llEHooQ7enZlJI13uiqGdaJGb 4Ao8868JjNZPk4p01BEv0a5VB/KErYMF53i2F1M0bYSRf8vhEQ68VRaDlmntl7p52rqC OT3/RCj3NO71fUSycwNwJRomD9MFjAzhlZoXZWFNT/b4aMI8hHGFWbFidDQIBvRq2Xpc 2AGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3jf7/3Wcpi0foIcFTrOIi7geeJuAbQU85kMpO8kay/o=; b=SUKhglgNWFv/uosdQerWI4py10SxR1LArmBG2AjKrG1yDOOuIooODR6Fs39iyZCDDQ 21IpCr5clS4Bqm+581eq6GZKB7tmaM6sbabo+0+0RzWwMll0SHdRWcX2dzdmN0lxgwcG 1kCfLCzWjPNGSN00hsCf9F8NmBtlloJB/igapfCyWU8DEnbFJFgwA55clKvUWctbjsPT alppMJ0j5hoWVqTupM5RI3VC5zXT1TxyGC43itd8qeb8c9E2Ef5mEB4d/1/F2dHA+A38 SN7CMHC24R/4gFtLuRI6VNFmiJFMN1xFQdBUlaQwxbiFvUVV4Z2mxzdIyq++CxkVVEBB +kHg== X-Gm-Message-State: APjAAAUldEj9I6dTJfxQGpFfQKW8EpzKAeeKkSeMDQLYzfJs3OUA6QuL KkjHVTKHursa4dREc4tFHpM= X-Google-Smtp-Source: APXvYqzseMVHi/zp2dLhKoFEYoelUgs68BX8p1VKuSrL/qFlGOzWDIE/FmiHVhECZY05srrr6gZpQw== X-Received: by 2002:a2e:2e04:: with SMTP id u4mr11410205lju.37.1554837192057; Tue, 09 Apr 2019 12:13:12 -0700 (PDT) Received: from localhost.localdomain (81-233-89-221-no75.tbcn.telia.com. [81.233.89.221]) by smtp.gmail.com with ESMTPSA id q64sm6807848ljq.76.2019.04.09.12.13.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 12:13:11 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [PATCH 5/6] ath10k: sdio: add missing error check Date: Tue, 9 Apr 2019 21:08:50 +0200 Message-Id: <20190409190851.4557-6-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190409190851.4557-1-erik.stromdahl@gmail.com> References: <20190409190851.4557-1-erik.stromdahl@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190409_121313_811733_42856F0E X-CRM114-Status: UNSURE ( 9.26 ) 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: Erik Stromdahl Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Although not likely, the bundle allocation might fail. Add proper error check and warning print. Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/sdio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index 295e1e7ec3b0..3eb241cb8a25 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -586,6 +586,11 @@ static int ath10k_sdio_mbox_rx_alloc(struct ath10k *ar, act_len, &bndl_cnt); + if (ret) { + ath10k_warn(ar, "alloc_bundle error %d\n", ret); + goto err; + } + n_lookaheads += bndl_cnt; i += bndl_cnt; /*Next buffer will be the last in the bundle */ From patchwork Tue Apr 9 19:08:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 10891959 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 D2BB717E6 for ; Tue, 9 Apr 2019 19:13:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBC3A2880D for ; Tue, 9 Apr 2019 19:13:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B03CC28938; Tue, 9 Apr 2019 19:13:34 +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_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,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 D6DCB2880D for ; Tue, 9 Apr 2019 19:13:32 +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:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PQIu6dGnYLZp93njX4Pgox+E0OY6gTYfQkAvH419VOk=; b=VfIkU0qvzuZJtJ HvkBj/9vT18m+7tQ+rFyRq+44EWiRNfoRHuIrN3qsnv8OEc2gxYgDU5SzzgAmyM9SDel6U1reG4J0 f8Xh3xVjZRTB9C1IRhIvLewy/a9W4qRcqhpM1wng6ptqbtolWD2F157FkhTHrB8A23q05+c7fiEJR R/b1QJnjYLupxKAGO2K/KlJCp6GZuprhJl4Eq2QYVcEb9jDqRDIXbxFwTAcroTJ0BPewieUztDBIn EtlEmjt5CyR5uLR3awwcavNWllbL7yYQsvOWojf/uphLK/7fqADXPk9+0RXt9d83dkvdUlmJhSbXB JdDbM9kas8hEYomxybXA==; 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 1hDwBW-0002B7-0f; Tue, 09 Apr 2019 19:13:30 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDwBG-0001nE-Hj for ath10k@lists.infradead.org; Tue, 09 Apr 2019 19:13:19 +0000 Received: by mail-lj1-x244.google.com with SMTP id h21so3768066ljk.13 for ; Tue, 09 Apr 2019 12:13:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/ZgmwsOUvL4cKbF6D9YKv0p4xEXY9j80R7avVYQ6UI0=; b=H3bCQx3exrZ0HBPbVbu6n0uCFMuB4H1sYutNKjDZRNIHpagZwfeNWuKhhpWwto2BzQ hjbj2h0o71K148CKobrgRqK9mGNcgBQi9NcnABFC9z97q38X4J0PuSjWoJ0ZREKIi53L kAhue8PlIXsDE3XL8Fy9MbBHTKbpBrq+32PkS+nrhlhhBIzcZ8bB+SoYMVltRLkjosC/ +hgYwxjycmayVB/TERuDbZ02RNPZrrSzF+2sJ26PDE6pWRsCr+BixIhniG2Sh7rBWxpa UV6fA1ntEtJPRhHuCptxnV7BVZC2SYysrjzR/L94FHDmjy5ixFnrRKYfk+prCCvwGsrw I4xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/ZgmwsOUvL4cKbF6D9YKv0p4xEXY9j80R7avVYQ6UI0=; b=YZ6w0m+4qdj3ABjVV7eKpxLUZrv3UeiUAMVI+35TjWd/pECZkf4+9Ff7pavk2QVbBd kqjJfB9H5GGSG7kqLy/MHG51GW6KXJsJ9j/Xsq0LTRfJbfntd6fpWhC972aukdyqX3hl AVOERu29feI8hEaUdk3p3R9ska6qBLcPBKGTucU5gUpxEeC+taKtiBs+4pRO+pIEe+Iu mENFUNGGVkTjihrP+oOXxiw3p8aE6uyHYVSJ+fskKGJhVFQHhs0JmMZ58pfV9rNeQzV6 oT0x+e/Byxtc5uqXJZfQa5++AFgt/84k3kpajyw+K4i/wLskj7q9cL9vq4CYZzXpXOB0 iWnw== X-Gm-Message-State: APjAAAUEOETJ1aQAwq43NridpCIkByBRy/IUh3XLZgQmx2ohg4uyq/3F GeLZ9FC8RonOw1KJBLX3fic= X-Google-Smtp-Source: APXvYqx9staw3h/hQ7QTrkRRwaxoH0Z/0nyV6Zy3AFumUaN7lcxZe9XrFEsKhHGoSWGnlNA8HgkOCA== X-Received: by 2002:a2e:998d:: with SMTP id w13mr20579638lji.110.1554837192973; Tue, 09 Apr 2019 12:13:12 -0700 (PDT) Received: from localhost.localdomain (81-233-89-221-no75.tbcn.telia.com. [81.233.89.221]) by smtp.gmail.com with ESMTPSA id q64sm6807848ljq.76.2019.04.09.12.13.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 12:13:12 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [PATCH 6/6] ath10k: sdio: replace skb_trim with explicit set of skb->len Date: Tue, 9 Apr 2019 21:08:51 +0200 Message-Id: <20190409190851.4557-7-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190409190851.4557-1-erik.stromdahl@gmail.com> References: <20190409190851.4557-1-erik.stromdahl@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190409_121314_752539_87DFF153 X-CRM114-Status: GOOD ( 11.87 ) 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: Erik Stromdahl Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes a bug with padding of the skb data buffer. Since skb_trim can only be used to reduce the skb len, it is useless when we pad (increase the length of) the skb. Instead we must set skb->len directly. Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/sdio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index 3eb241cb8a25..989e3f563f3d 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -1496,7 +1496,12 @@ static int ath10k_sdio_hif_tx_sg(struct ath10k *ar, u8 pipe_id, skb = items[i].transfer_context; padded_len = ath10k_sdio_calc_txrx_padded_len(ar_sdio, skb->len); - skb_trim(skb, padded_len); + /* FIXME: unsure if just extending the skb len is the right + * thing to do since we might read outside the skb->data + * buffer. But we really don't want to realloc the skb just to + * pad the length. + */ + skb->len = padded_len; /* Write TX data to the end of the mbox address space */ address = ar_sdio->mbox_addr[eid] + ar_sdio->mbox_size[eid] -