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: 10891935 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-2.web.codeaurora.org (Postfix) with ESMTP id 0413E922 for ; Tue, 9 Apr 2019 19:13:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4D192880D for ; Tue, 9 Apr 2019 19:13:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D8A1C28938; Tue, 9 Apr 2019 19:13:12 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,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 197642880D for ; Tue, 9 Apr 2019 19:13:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726702AbfDITNL (ORCPT ); Tue, 9 Apr 2019 15:13:11 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:42057 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726559AbfDITNK (ORCPT ); Tue, 9 Apr 2019 15:13:10 -0400 Received: by mail-lj1-f193.google.com with SMTP id v22so15495905lje.9 for ; Tue, 09 Apr 2019 12:13:08 -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=NCwF7PLAziPQuNiRPpVJ5CgEEtds2wUmG6gN2h9Q7NVUaiPDA4prrFsMHuSwrY6c4T 6e5O+Hai+gKpEZAD86Lw+/l2ov3vK8SaqEG3nRbeZ0weLWDHkhuR7I0J/MLSY33s09Wv oS4AJ8b9SKPUNmRxG/0TXyGx2mXRh2yLpFqOMSmkAIGjNe9TOICo1szowVnknkEoP2F3 3j7PmjMVKB/zzj4xdRlMk8wM+MJrOcWLFfcViVQ+IXtFtgOMHscLrkTx90IydsiO1NiV PEQV+j+4T12v0QJM51tEfy6xcp9TaIatkKb4qTBK3iSmSS8BGQJ0lkzRZJrbiVwQROqM UXkA== X-Gm-Message-State: APjAAAVbwYgCG14GuRtUQIRwUaCu9vC/6U91xBBgEBWJlLECvRts86Vr 6igJ/i22aC2YXJQCbLov+fM= 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 Cc: Alagu Sankar 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 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 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: 10891937 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-2.web.codeaurora.org (Postfix) with ESMTP id 6F8741800 for ; Tue, 9 Apr 2019 19:13:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B8EF2880D for ; Tue, 9 Apr 2019 19:13:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4FB6F28924; Tue, 9 Apr 2019 19:13:13 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,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 ED8BD2893A for ; Tue, 9 Apr 2019 19:13:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726739AbfDITNM (ORCPT ); Tue, 9 Apr 2019 15:13:12 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:38828 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726529AbfDITNL (ORCPT ); Tue, 9 Apr 2019 15:13:11 -0400 Received: by mail-lf1-f66.google.com with SMTP id u24so6290967lfg.5 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=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=taGhvcNJHmsQ0lEArrI1vOpcYA1j/zG9vcUkgQ4l2kEoq3tFkz2ZAvGcqMzZDooV9f U242awiAHlPh+NCoY+fk0Wyb4zlHaY3nI6SpX99BZY2nxQoYIHzuImA2XXPKH7iuYNak 6w4z0Yl0v3OjcszsUjBLOswiZlPJT4hVvtdePulZQLyAKp0JyanVUglK8c6N/ftQ9XRA Yk5Wj/Z+LgETv3otaBLw16wBwe2sWd4dzxxN5WaKCNlb+pk1cbsrIhr+Vi1cy8l8Ir/P TgEtBsLvWNgcQOui8en/1DwZWeR5G1QnAGTbeZjN7A0DHGGD/ua/iI5OFFT33g65Wu19 0qoQ== X-Gm-Message-State: APjAAAV3g4rnwe4LWIDk6OsfnKmC4sjG758Enq3dlY6ruGV8b74XitsX G/AWXpaMQE/D5S7mH+y/2Pc= 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 Cc: Alagu Sankar 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 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 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: 10891947 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-2.web.codeaurora.org (Postfix) with ESMTP id 0AE9D17E6 for ; Tue, 9 Apr 2019 19:13:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9E762880D for ; Tue, 9 Apr 2019 19:13:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE46328938; Tue, 9 Apr 2019 19:13:16 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,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 6CAE228924 for ; Tue, 9 Apr 2019 19:13:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726720AbfDITNN (ORCPT ); Tue, 9 Apr 2019 15:13:13 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:42061 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726663AbfDITNN (ORCPT ); Tue, 9 Apr 2019 15:13:13 -0400 Received: by mail-lj1-f196.google.com with SMTP id v22so15496006lje.9 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=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=oS0HDCJk9dQlgMp+QrdEzIwebCyWAeOjaxvmOs+ffuU2pvBR6YdNnLZcprVIlG7st7 5HaCJcCHdOmYVZFRG/WL3++3DkLmz25HmrJwDAujc5UUXOFNqy2W0PFVPvqdg99j8vbq m1MAf86BLGRsY7uIOA9GifPsAfX7fdM1e45RU5lKAiCTUzYZyStlt+eZy7eZRQ0BQviT tqalqVYzyQgHWt/neaBAX1ztGeoKRJMqe0Mql+3dABPoO596n+jlB0E3XJ8FWUDXnF9q PIEVh4fe1Q/JUtK5ukEQwV9275FMdBNItf4Cog1bTgCXo7gmSSWJZVa3A0OZbyotKzm7 tSrQ== X-Gm-Message-State: APjAAAWGGGGy+chmmInr5R/8YgQBj+RYVluZ3/ck3/Tl5jR0U4lNA7oO ksjG20WR8p9XB0Cm6AUdyt4= 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 Cc: Alagu Sankar , Erik Stromdahl 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 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 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: 10891939 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-2.web.codeaurora.org (Postfix) with ESMTP id EBB4E17E6 for ; Tue, 9 Apr 2019 19:13:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7DAA2880D for ; Tue, 9 Apr 2019 19:13:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CAF6C28938; Tue, 9 Apr 2019 19:13:14 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,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 665A72880D for ; Tue, 9 Apr 2019 19:13:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726753AbfDITNN (ORCPT ); Tue, 9 Apr 2019 15:13:13 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:39132 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726559AbfDITNM (ORCPT ); Tue, 9 Apr 2019 15:13:12 -0400 Received: by mail-lf1-f65.google.com with SMTP id z9so4642037lfh.6 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=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=Mx6c3Qgx39M7cFgPucVUHf2LKwbBFCsqeW6arLYZCqlDD6RfyMap3/9gLQI5RYgVLN HlDd6YyJLjSBmrTASRDmhwglYELpn7tmHDF/17Fx+H6w3lkc3YdFDa2EB4wiCmlk8Xli aSzMbY3xfzewfhvxQ0Pdp16ZNIKmIPaB+0Rxhl+GNXMrI5QNTh8bMxzTHqBG01Nz1gs5 Mt3Z+ovvzDjkWj1IWy7ZSii6I+P88CPNS8sLzBkQnphWhewHqsZhouPQnYCTtlZmA4Fi dPy1Vcb9cDxReiFETWsfSR8vrJHPOP5t1dMROhKXqevcvvVq+TA3efb40qe3EAJ3fRsd 8owg== X-Gm-Message-State: APjAAAWpJybI9Wx217E5k1cwf2Zt0AQFZ6NVs2kh1VDuQ543ASkJPMN7 OvibwA+sq6/YEwDSvVGc51A= 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 Cc: Alagu Sankar , Erik Stromdahl 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 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 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: 10891945 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-2.web.codeaurora.org (Postfix) with ESMTP id 933951800 for ; Tue, 9 Apr 2019 19:13:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81A652880D for ; Tue, 9 Apr 2019 19:13:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 75FEA28938; Tue, 9 Apr 2019 19:13:16 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,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 338D52893A for ; Tue, 9 Apr 2019 19:13:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726757AbfDITNP (ORCPT ); Tue, 9 Apr 2019 15:13:15 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:36100 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726529AbfDITNO (ORCPT ); Tue, 9 Apr 2019 15:13:14 -0400 Received: by mail-lj1-f193.google.com with SMTP id r24so3765698ljg.3 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=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=XoSJnggwhUMhGcyrXXSfhDc1hBpqKPFGgA6UQHfIVhpUvSio7VGE8IHLyGIxfymkdA s6rdLaXWB/6bcM8e7K1uk0s0OvyYokP7cE5v4VXJ0wRFfZkiwfBHcMpSyd0kwPaYXiXQ KZ1tv/QUmjsXNzdDfkQHh0bNt1wZPkiqhrx3p6+8AXRNzTP4WBPj+61e8mBdY2DS4u/a RtuZNQeaFQj8AyBV6ZuWSrB6zgLQmtrm+zjnWzGbOkN7fWMK8aYletHGMo/p/S9ZOLOH 04EqFLvWK4rizaXO0o/OJ0mhIXOHcZiQuKZCIXqyy+TCLUr3mI31Vu+9SOxzMD1qoKYg ojvQ== X-Gm-Message-State: APjAAAXejOF1N7Phl9bDJUZTEVUeGR33gu0LqUc5zFaGIO1R9L2GHDvE Me6FnNokoVAl8wtZJ3duvpmCpBky 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 Cc: Erik Stromdahl 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 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 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: 10891949 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-2.web.codeaurora.org (Postfix) with ESMTP id 2D5A917E6 for ; Tue, 9 Apr 2019 19:13:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BD7A2880D for ; Tue, 9 Apr 2019 19:13:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1034328938; Tue, 9 Apr 2019 19:13:18 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,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 B8EAA2880D for ; Tue, 9 Apr 2019 19:13:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726768AbfDITNR (ORCPT ); Tue, 9 Apr 2019 15:13:17 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:43869 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726663AbfDITNP (ORCPT ); Tue, 9 Apr 2019 15:13:15 -0400 Received: by mail-lj1-f196.google.com with SMTP id f18so15484700lja.10 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=/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=C/a1CVz/6UaFoOnke/CD2QEuK2tB1H6u4eWL+EBvjhHLKoy0+0ArNBYxAp/yUFL3NF I7rjzRHe+230dZ9Sm8FgHkyjkGckw0GtiO+bdL8qIOkNyMY55J0e5k603LSjiDNQbWhc 48sOPXfpfsbiTfxGsh3q9N3HNrfI8JAgfiWuOzYmSxD+VRoAcnI/gPYPDEKY2lesqJkv Jq2j4YK+OrejAQAR3+ByyS/QNi/ZY3eOQmE0fOfW1Afku88O8griTLOxmki7Z2qKabZg IkMBGp2t01TtXrqfHZpdT+XoQbh3UsckIKjKenz32EJ0TqkEz+3kiovdc2TDZdtWq5Uh Ktzw== X-Gm-Message-State: APjAAAXy6bAKoyedHzj89G0BzKq5+D/Ln45nFAoK8mP5xOuQmqe2QXX3 llzniYLI9V6cZAL33ds7jPm8ca3k 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 Cc: Erik Stromdahl 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 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 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] -