From patchwork Wed Apr 17 19:14:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 10906007 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 75D7A17E6 for ; Wed, 17 Apr 2019 19:15:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BE4628B9C for ; Wed, 17 Apr 2019 19:15:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B5DE28B9B; Wed, 17 Apr 2019 19:15: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 E7A1728A93 for ; Wed, 17 Apr 2019 19:15: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: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=80oTEDb+zX+dHaG82KwTu2w+q882dskHBG4knE3HwIs=; b=cS4y4cgFIUSsIn ehaQa9E5d0L6FX+NEq5jxd+jSIGcp1dTbrg07BYJ7NgiHdO1q7FYch3xZ4lywdjVGfpASUKojDj0m VVKdITaApg67GpfLDi3SK54dn8eTMWryWHZj76n/ca0pjFIHBRZz8QSMu+WZDh0OTQMYOSbRsUof4 vS+nzpAsFE/nKArH47ZUV59JZLezmapwDi90bJhN80Bt6enzmMa5eshii+UzPyRB8nLAliqNVYz7u 8PFcGw8Vlu4jYPaIYJtQegNgvmdRvI+LGdalJ0ygY3FFoL2uHXAoXeNxXc+1vvzg910jB2ALTF9Zm RuLOAHCnpn4DQPWRi+0w==; 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 1hGq1s-0007Hn-Nl; Wed, 17 Apr 2019 19:15:32 +0000 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGq1o-0007F8-OI for ath10k@lists.infradead.org; Wed, 17 Apr 2019 19:15:29 +0000 Received: by mail-lf1-x141.google.com with SMTP id w23so19690890lfc.9 for ; Wed, 17 Apr 2019 12:15:28 -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=3PWgHfylOd7/V9eOJa0wx2I7Oy4kUSx7mENXgzd+VbU=; b=HWRLc+yFxQlwK+CEpkR3LXV53WlERIeIrLrw6DA1BhigJdzDhKLIZYviSHMFWtY6SP Q+m4Cwiz1oomdi0Fj44wYrhEj7CTdyjZ8fXYrY3LS3qOSJUvdAtJC4fCnt9mui8AImXI HkLdSM8uodtiPd5EYgbpwF5Jxzrmfk00BkACG0mkfmGn0fJ20Ielr9F7d8NNsCGLlg1S orTceo4QNfPLJsT2AlqhmuYfuHvtS2w+PLEGDcroXvR44oa9vS4L+41wSLlz7qwmgvIw KKFGyy7PNw+950VlcGz0c7XWzZoQHej4kU7t+uPnb3dvSeWhf2PxO5+8IzpL8RPH15Mm TZqA== 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=3PWgHfylOd7/V9eOJa0wx2I7Oy4kUSx7mENXgzd+VbU=; b=jJROEn+nvdl/V3kRimKQ6rBGSB7Kbew7x56fvxj5CPvEYjJ2aEcEW5Ny0+BZFvpljw Jkp6eNZr2aQekWs2Lmxpq55RBZnmC2ZXQsnH9PWSnR0NJfov8q8mBvno3328MzVuSXhb PYSZCfD32uPvHbnaul79IHAxK39XQkHsCoqP045DTtbrlHdjdmnNcXz65GECnx4cAPO8 CAxUHZc+BysQbOyWX+cz2okqSDJT5wfNuCWYZ/QK/Iq2FA7UtDseX7JaoIdw+XMWHUhk CdOVWvNqCKEYxhRkLjWq4N1qKDh5+ZmpRzKf5VMIfA+5536Y4iiszBRvuy5Jyc2goCSH TGTA== X-Gm-Message-State: APjAAAWXz25/c9E2wq/pFgg+c4tET1yDo+r0tqqP+ZCA+UMrzGyWN6Dz S8hFNQ11ySV3X0Og7WulEV0= X-Google-Smtp-Source: APXvYqxEDdzjflNKkq3brx8QJS5ylSinjqXQiW3VUQW54xKF9eDMUBpmMvxA2PGQX/+JX6kZ5JUsGA== X-Received: by 2002:ac2:5495:: with SMTP id t21mr12020513lfk.3.1555528526847; Wed, 17 Apr 2019 12:15:26 -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 j27sm11387203lfk.97.2019.04.17.12.15.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Apr 2019 12:15:26 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [PATCH v2 1/5] ath10k: add initialization of HTC header Date: Wed, 17 Apr 2019 21:14:59 +0200 Message-Id: <20190417191503.18814-2-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190417191503.18814-1-erik.stromdahl@gmail.com> References: <20190417191503.18814-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-20190417_121528_786950_CE016509 X-CRM114-Status: UNSURE ( 9.06 ) 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 , 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. Signed-off-by: Alagu Sankar Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/htc.c | 1 + 1 file changed, 1 insertion(+) 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)); From patchwork Wed Apr 17 19:15:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 10906015 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 0019414DB for ; Wed, 17 Apr 2019 19:15:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D746F28A93 for ; Wed, 17 Apr 2019 19:15:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CAE3E28A96; Wed, 17 Apr 2019 19:15:45 +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 7987928AF8 for ; Wed, 17 Apr 2019 19:15:45 +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=wU1tyTVFd5iEbLeTOtkX4+hVU9HTGJWuxWRHI6SODMw=; b=UgV6H69wmTWvuU /54ZpNoN0lQ4nYh+A57D06wiBm0+otcoX31k+ucq8aWin2FVOnY/RmufhgIDyrQLZ9b5BqFuDxWXe 2n5etQJnxRHUk53AY/G0kG63LSKSxZE5YCCjgXfdXVzV1zSH2drkJ9k+ZypgRAA3PmIYF+2M2VVmf ZqDJ3GkVHtrAda5+sH4UFfzUvtHnXhmWqKCzX3T0ZJjJmBAK2r9i4AL54klRUYA4CoTEiHFR9rZzl Cp4t61UrmQa/h+W8oONrs1/MxApHDedHVnN5OaQqdEfItECKyPgKKLue+Nv5D/PiNPr6SZnETvbPR KhvtX+M6sAaLRm9IK+sA==; 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 1hGq1u-0007KW-VZ; Wed, 17 Apr 2019 19:15:34 +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 1hGq1p-0007F9-JU for ath10k@lists.infradead.org; Wed, 17 Apr 2019 19:15:30 +0000 Received: by mail-lf1-x142.google.com with SMTP id w23so19690925lfc.9 for ; Wed, 17 Apr 2019 12:15:29 -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=7BeD/gfKhVLmh4MRlzIfvgwYkglG8WzGBT5xlk8Q0iE=; b=MMKpWSzMd/5QaHBHymjxwQRyqZwkWLj2b5L5ebbu5DQAakLuh/X17aZnUYnWNS9Gkm mhBWVCjxaJbLuABVSbgdBH4IP4qv887eln+dfgrYqOspmv723IhGLGkKg2EV2jvSIAk5 3t6umqSBYbvn1GoMLHL5CFVg+VwBmvA7EesuQ2gRIO87VYH6mdJlzhhE830Yjwz0hyrB EWFMCyRHQtwbVQFvsmNePUPyslb4+oXQ+qShmaYMMdJo7hd76dwvzfSO1Ml4cATwtFfu kVtxG9mIymNo0p8m2HXxhLpLSWNSdViYnSpqLEfzlIY4HAmUG7oYxcIhV8eTJq7z2a2H 7wQA== 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=7BeD/gfKhVLmh4MRlzIfvgwYkglG8WzGBT5xlk8Q0iE=; b=MJfoNMVR6USryZsq2ok7oe5mNkTdr5dhLLSMfA31YYIeRLMpwH7F6/xDc9Yt0TLQhT 6jt54X1t2YLDYexQR4JavdXUJz2MgOWxBi8B9vAnwhRKeqEz8KfboUZDlo9JRpj61PYW oXZ46MXMfcwJ5ZGTn1qTECcLi3GQ5uVjEQtxXWbOaVEhxYR6e6e8hEJeKkwGRNGNLfsQ a1Fa7wEzjd9nGY/3ZyHubl8FvTjdx0YEnBwMhRrAZqulHA5BscEm5P8MC7FdEK6hD8HW caCBTjcFOI9EVFkmgvK68eM4/ZQcQTS58ZTkGGSrgD2d2W0RUaFEFmPG6sGNy8HfRomy MPUQ== X-Gm-Message-State: APjAAAW0vXKa9k1uPCWlKByKLnGVITWPBVCiLBuslvkM5P6j58JHD5RK H6N5ndZsHosH4Lf1v86Q6II= X-Google-Smtp-Source: APXvYqyRTn83TMjd3XVuq/BUUDjybQ/dya9e/vNRu1Aii7T46weXexVaUjbWunMIiwK0sd2gG9Ce1w== X-Received: by 2002:a19:4b84:: with SMTP id y126mr7512835lfa.15.1555528527757; Wed, 17 Apr 2019 12:15:27 -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 j27sm11387203lfk.97.2019.04.17.12.15.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Apr 2019 12:15:27 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [PATCH v2 2/5] ath10k: high latency fixes for beacon buffer Date: Wed, 17 Apr 2019 21:15:00 +0200 Message-Id: <20190417191503.18814-3-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190417191503.18814-1-erik.stromdahl@gmail.com> References: <20190417191503.18814-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-20190417_121529_658051_7EA4C679 X-CRM114-Status: GOOD ( 11.83 ) 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 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 Signed-off-by: Erik Stromdahl --- 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 Wed Apr 17 19:15:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 10906019 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 5F2AA17E6 for ; Wed, 17 Apr 2019 19:15:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41A3328A96 for ; Wed, 17 Apr 2019 19:15:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4002428AF8; Wed, 17 Apr 2019 19:15:46 +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 CF17C28AF8 for ; Wed, 17 Apr 2019 19:15:45 +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=Nc4rKo3wyuu28rgymfjhQDfWFkvFNhUiSHrYqkFk9c0=; b=isgQEHUuuOrMpI BqIp4NLrJg2WSWwfmkvuS4t4EM+w9qrjeJIYVNL7TtT04HeA3iO0tDXLRfvFzTWgX8D2w7WVJxGVw N7AhF53+rv0Qk5EOFBCJZigfHzEXTvE9aRnS17gu8zL1efhyvhguNl5b/53vcrDpXD2JkPupFkTW4 PBjA+XV7s4K3zgZA4+UjjsJOsmhCe6ZkIm/bOtkC+PgW8HC8QngnqN7wSS8TqQIYPbfpwknr7EiEZ Zmz5yXSou8+x6Wg9WGi1CQ1aotPR5mzMn1rYhLjbKePv7BiKrG7huTQAafGAlM6OF4vb1dGUP1m1Q unqTXXO2R7MlCKMKJs1g==; 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 1hGq1y-0007P3-1D; Wed, 17 Apr 2019 19:15:38 +0000 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGq1q-0007FW-Gv for ath10k@lists.infradead.org; Wed, 17 Apr 2019 19:15:32 +0000 Received: by mail-lf1-x144.google.com with SMTP id w23so19690963lfc.9 for ; Wed, 17 Apr 2019 12:15:30 -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=jZ6xJSFXrr32q23CdgPPoHM1qKrQGi5+H6/8J0uQwE8=; b=Hx5YmAFetfno0GzwrgYrz62duOq7uF2hzvp2bvyGH7u8xYK6PFpNC5cf6wvf4XHsbn b2+uWybG8sgckIIcmnK1KAuTyIgU8ylnPooKo+oMiOAZl1ZdaVB/t18//N+OsfPDBKaH fmvJOqhaumXMekMeuERq2dd6jRKpZzRP1jNzSSIBmlRkhuCy2KXC2DJZJaYh3f1Wjbck xR2o6TmQQ/5aXHGA/A9o2ZxcLvbAnl+WB1zRcDrYfyd9S5qW/VC2HCMD3IDrYuuT+v8Z gLqFLk2o3nLh9gYLWZagoN9MgWduNyaS0Ng1xVtX9uhWSHgHAqzFOcwxgCkuw4BrBPjN eHLA== 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=jZ6xJSFXrr32q23CdgPPoHM1qKrQGi5+H6/8J0uQwE8=; b=klpyYKrhNMZBSEgzUR/+RYXxMBQgHQ0/u9tfL4QjBUkTRlTTl2VFnVizKl80qRTIRm vys1RlQCFfiBgmIFcJHyRweAgWDi5bmfVA3EA/F9L9Z9Zf0CFzWzVWbQkr4Gymbh4suG Jjk5LgrsOYGGXi4xs+5BX65ufd05aOSrF14bBsQsJ2JXNvsoPaJpVptWd58Ev/s/hgNW vtzp2D3rPWQItBp4/BHuhzir/VLMhfTSN0uMLrNOcG+J1wNpkBRNbOiC8WQNLthxvwu9 aUcDRcdwPnsXm7nSdvuvs/ixDRRybQtZ0wrVcFom1ShqBZJQcdPj41KX5XEGLwivqCJp sR+g== X-Gm-Message-State: APjAAAU4oFrYnntdO8rQJxZkt2cfRS+VxWBG8YCP8uoOdhnCvQifNErZ REK5tjbPC2gA1eYHnNRmXGw= X-Google-Smtp-Source: APXvYqy5TjJWEO6DvmONVda7/RFQRd5RtyJSEn5o8ZE2/ROrf1kKkZbx08moLLi9x3QJsfNgqPrRSQ== X-Received: by 2002:ac2:446b:: with SMTP id y11mr774792lfl.155.1555528528579; Wed, 17 Apr 2019 12:15:28 -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 j27sm11387203lfk.97.2019.04.17.12.15.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Apr 2019 12:15:28 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [PATCH v2 3/5] ath10k: sdio: read RX packets in bundles Date: Wed, 17 Apr 2019 21:15:01 +0200 Message-Id: <20190417191503.18814-4-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190417191503.18814-1-erik.stromdahl@gmail.com> References: <20190417191503.18814-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-20190417_121530_568182_01838908 X-CRM114-Status: GOOD ( 16.50 ) 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. On an imx6dl together with a QCA9377 SDIO device, the following performance increase was obtained with iperf: Before: [ 3] 0.0- 1.0 sec 3.38 MBytes 28.3 Mbits/sec After: [ 3] 0.0- 1.0 sec 7.12 MBytes 59.8 Mbits/sec Co-developed-by: Erik Stromdahl Signed-off-by: Alagu Sankar Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/sdio.c | 71 +++++++++++++++++++++----- drivers/net/wireless/ath/ath10k/sdio.h | 2 + 2 files changed, 60 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index d5073fac9509..b89732aad97c 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,73 @@ 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); + ret = ath10k_sdio_read(ar, ar_sdio->mbox_info.htc_addr, + skb->data, pkt->alloc_len); + if (ret) { + ath10k_warn(ar, "sdio_read error %d\n", ret); + goto err; + } + pkt->status = ret; - if (!ret) - skb_put(skb, pkt->act_len); + skb_put(skb, pkt->act_len); + return 0; + +err: + ar_sdio->n_rx_pkts = 0; + ath10k_sdio_mbox_free_rx_pkt(pkt); 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 = -ENOSPC; + ath10k_warn(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]; + skb_put(skb, pkt->act_len); + memcpy(skb->data, ar_sdio->sdio_read_buf + pkt_offset, + pkt->alloc_len); + pkt->status = 0; + 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 +729,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 +2038,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 Wed Apr 17 19:15:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 10906013 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 9FBEC14DB for ; Wed, 17 Apr 2019 19:15:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84D3428ADC for ; Wed, 17 Apr 2019 19:15:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 795AD28A96; Wed, 17 Apr 2019 19:15:42 +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 3A5F728AFF for ; Wed, 17 Apr 2019 19:15:42 +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=07QHKT6Ro1hHW0tJBXZAhQA7BKrfQ8c/GqZ3eBmXoK4=; b=uSNh5Mui488A+E jLUTH7n7i6VqhIy4IWOWWLexvJJ01MyfFi93TCn/dBge7D7RXFYDpEpmVTRCCiobbT7Xz0U6VkADc 6JFpbnIFUA4RBysxBjDvVGCeIAqkzegZxP98TDK3+cMgGocSSHXhm+F3X3wFXBDuEkGtjBqk8Mdq0 ChtygFNbvM/kRYB74OdZsYnrqf/+yAx6ntG4FHMGtKFHEG+195ckKByRrKfMOTIqB3hK8RLcponYP pVIQidy0qcQBDC56JCWBfHMElgHYfmic2Ow/FhUFm3dlDQokdej7YsfIZhYj4cd5f40gGar7pCGMF MRsjAiYNHX7yckjuKnMQ==; 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 1hGq20-0007Ta-Tx; Wed, 17 Apr 2019 19:15:40 +0000 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGq1q-0007Ft-S3 for ath10k@lists.infradead.org; Wed, 17 Apr 2019 19:15:32 +0000 Received: by mail-lf1-x141.google.com with SMTP id w23so19690982lfc.9 for ; Wed, 17 Apr 2019 12:15:30 -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=yZlYdkbsnuWRekasQAPicgHhW2O1in5TKogUwhEyeAY=; b=FUnjRqLAipT9GC80FeDYkIRkseovEPOjV56eFccMEEMB+GDfG9VdpNpCIGdH/bTFgi 8FzlrnAKp2/ST3mEAY5wCTwGMR4GuP9qjVts6Ik+/ngMv9Nlvmq9KGnHPGrR53S92bk1 HMK+q4UI7uTbn4SdtKtJZ+SXV5NXP0VsRRNGWLQOgws1wgR35bdezlnNrDAji+NykDF4 UqKauuD3c7GJuD7hhOq7UBqsK8kiYzCXOp6J45w8YdWu9hLR1fVKLA8KaATNqkEBrwlY SmpVd2SGCS2H+5i/eKK9T7RPLyKm6EvdkvZoSZQFNEEU0WhCKfl3bVth6YdBAUz9jegR eygQ== 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=yZlYdkbsnuWRekasQAPicgHhW2O1in5TKogUwhEyeAY=; b=RylfRlAGHy5FaUeRi6hWVjVxSH33ZzvijzLL9mj94ytkLHfk4vyVLgUBseRMPoKZfN Xed8m37CF1sy42GWoGa+bsUlMWSy+yieIOnZcXypWxEwh2vr0PUgp/N1wYtM6JJIM9hz mXUpophcZoFeF7dYWW2L+yfiVJZ4hNrqpJIb6dsVkEboL6vL4IWRgpRL3fTppxtTOfTl ZkNY/f3LA0o0iexZPj10FTDtoIQESu93WZc6nIIRM33Wr4VIQJQvs/zxba0ArsfK0twx uVo8j8+OElzgQ+jqeLQYMN4RTTGrzDXBEqE9sngeW4cwh6VAe5iG7oTltUPMmtSkRplQ 7sZA== X-Gm-Message-State: APjAAAUS6Airp9xa9O+LHDBDimSCNmnRHSqzrOJwhVXtfURGMkKnCTGB HoL/yP1Q8+GgtQWNNymqwfc= X-Google-Smtp-Source: APXvYqw1rKENYOyuvxq1zMqprYZEcR4yonZJjzg6pue8q26TahnEg2jB1QPrP+JgNrBT0M8A/vLu9Q== X-Received: by 2002:ac2:4551:: with SMTP id j17mr19496154lfm.141.1555528529381; Wed, 17 Apr 2019 12:15:29 -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 j27sm11387203lfk.97.2019.04.17.12.15.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Apr 2019 12:15:28 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [PATCH v2 4/5] ath10k: sdio: add missing error check Date: Wed, 17 Apr 2019 21:15:02 +0200 Message-Id: <20190417191503.18814-5-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190417191503.18814-1-erik.stromdahl@gmail.com> References: <20190417191503.18814-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-20190417_121530_903527_86F98C12 X-CRM114-Status: UNSURE ( 9.27 ) 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 b89732aad97c..b8b3059721ee 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 Wed Apr 17 19:15:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 10906021 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 C3FCD1515 for ; Wed, 17 Apr 2019 19:15:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA18528ABE for ; Wed, 17 Apr 2019 19:15:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9EAEA28AF8; Wed, 17 Apr 2019 19:15:52 +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.0 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,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 43F3328A92 for ; Wed, 17 Apr 2019 19:15:52 +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=RORGojVAK78cohuzEyFivrvGuF0u5y/5wyxcug0v+tU=; b=shpVIvYdU6A+Fo cPHJbViQ1zkHj/OBcP5/gWDbYk5PPgSskKRSmtcQuSVJDNjcQ8shUW/iHBaGiPb+Lh/XZiL8RN19/ POf7SADbJU/SmcDlYxwnA4jNWljdQjk8LF4X8Rm+sg/VpYlYU2W98TX+IyexzgixVmUBtMRtBeIL8 paLid9P5W5IzueITGoYPfxuVspRXzobIkz+p3Jg9al9dntu27rIXw4JInh29kTSNeNfvGmp+P4RQh 4GXblQV/4UYQbrFraQk+E6EGfcu8b1NM67EhWcN6dHCi79UhBnNzKJJX4c29QufezP0TfzK4TidBa Kpzp5aD5yWmIlb+J36zA==; 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 1hGq25-0007aO-3F; Wed, 17 Apr 2019 19:15:45 +0000 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGq1r-0007GD-Pa for ath10k@lists.infradead.org; Wed, 17 Apr 2019 19:15:35 +0000 Received: by mail-lf1-x141.google.com with SMTP id u17so19748135lfi.3 for ; Wed, 17 Apr 2019 12:15:31 -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=bW57d87UKSeqIsF8dbOx4NI+/s5uPkAlrYgKadNV5CU=; b=ipeoyJLUSK1sgKEIGYNZc7AtuOTanB0QLIg82Pxv6xHgUAFsOBPcxWqvc5a0U/TRdP xpVSuWa6K0ni39eqUWbUu3Kr9VasrS7w9MmmRhschM0irJXSMpCYt2A6Xolk6cvoXaYj RzYCXo6JNgNl6BjeOmXrdd40MpJXz0k+hsG1KdkVad6cAmRKkFcPVRH4sbNyP6Iyk9Ix 9uKoZ1pZubGjkZk6Anu8c9/5wuI4gJ9+gb/u7/5b5KbTEcdUMRmoJDVkzsxdmWoGdR8E eLHush5B6Esrv9sotiDkcBTks11oVWlf9vIqPcTDVp1+w4k36UpZd5vHJKxeqeKxfvqe l5kg== 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=bW57d87UKSeqIsF8dbOx4NI+/s5uPkAlrYgKadNV5CU=; b=Hr4WWL1fV4pp3P1j9f0Yx051TxF5q263nUo4wSn5SpW2KYCuMBY4CKx8xMDs8gVxev QnuFf3I6NIs/jMWgPmCveE8bXT74hDHfwjOfeoxRdd4Ofj8V6iRzgxb0I4t6HauW9M+x /u/WVEhXdCY+bAY+6sCY2zf4Lne+XzcRaAvjxNSRj9GGzb+tstZ7J0ITP0iovItAH+d6 jrT+O2+yG21WcvvNKc0AJ6UVzOooLL39AN0kH7MQWKV1Dlv+TCrS1n6e8HWe+OKIOVgT Wqgr+3+ajmEgtKb6uPO5ByWJrXBrFS++yiXbS8TcoW/8VCfetSEaIxXe2wMbFao5JUFk vsjQ== X-Gm-Message-State: APjAAAU/znr1x2c1+Dx8GjjVwEGbsySRmHoA0GBVb/euCCsKL5qBgQnd VU+88YGFnqh4jdrsZNUMCbY= X-Google-Smtp-Source: APXvYqwt2YzwEQJL9qpjMFhkzMgeb0xAgnsFJgQoyNqCUFu+PJSZAgHrnK7eeL+AseZOvbEcdjJUQQ== X-Received: by 2002:ac2:5326:: with SMTP id f6mr27181776lfh.100.1555528530172; Wed, 17 Apr 2019 12:15:30 -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 j27sm11387203lfk.97.2019.04.17.12.15.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Apr 2019 12:15:29 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [PATCH v2 5/5] ath10k: sdio: remove skb_trim in TX path Date: Wed, 17 Apr 2019 21:15:03 +0200 Message-Id: <20190417191503.18814-6-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190417191503.18814-1-erik.stromdahl@gmail.com> References: <20190417191503.18814-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-20190417_121531_988024_6B5E1F1E X-CRM114-Status: GOOD ( 15.45 ) 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 allocate a new buffer with enough space to contain both the TX data and padding. Since some skb's have multiple references, we can't use skb_put_padto() to extend and pad skb->data (since it causes a panic if there is more than one reference). Also, in order to avoid the following possible deadlock issue (reported by lockdep): [ 26.508508] Possible interrupt unsafe locking scenario: [ 26.508508] [ 26.515314] CPU0 CPU1 [ 26.519862] ---- ---- [ 26.524408] lock(fs_reclaim); [ 26.527573] local_irq_disable(); [ 26.533508] lock(_xmit_ETHER#2); [ 26.539453] lock(fs_reclaim); [ 26.545135] [ 26.547769] lock(_xmit_ETHER#2); [ 26.551370] [ 26.551370] *** DEADLOCK *** ... we use the GFP_NOFS flag with kzalloc() Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/sdio.c | 27 ++++++++++++++++++++------ drivers/net/wireless/ath/ath10k/sdio.h | 2 ++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index b8b3059721ee..68d8e2d1b2ed 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -1279,6 +1279,7 @@ static void ath10k_sdio_free_bus_req(struct ath10k *ar, { struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar); + kfree(bus_req->buf); memset(bus_req, 0, sizeof(*bus_req)); spin_lock_bh(&ar_sdio->lock); @@ -1294,7 +1295,7 @@ static void __ath10k_sdio_write_async(struct ath10k *ar, int ret; skb = req->skb; - ret = ath10k_sdio_write(ar, req->address, skb->data, skb->len); + ret = ath10k_sdio_write(ar, req->address, req->buf, req->buf_len); if (ret) ath10k_warn(ar, "failed to write skb to 0x%x asynchronously: %d", req->address, ret); @@ -1330,6 +1331,7 @@ static void ath10k_sdio_write_async_work(struct work_struct *work) static int ath10k_sdio_prep_async_req(struct ath10k *ar, u32 addr, struct sk_buff *skb, + size_t alloc_len, struct completion *comp, bool htc_msg, enum ath10k_htc_ep_id eid) { @@ -1343,9 +1345,17 @@ static int ath10k_sdio_prep_async_req(struct ath10k *ar, u32 addr, if (!bus_req) { ath10k_warn(ar, "unable to allocate bus request for async request\n"); - return -ENOMEM; + goto err; } + bus_req->buf_len = alloc_len; + bus_req->buf = kzalloc(alloc_len, GFP_NOFS); + if (!bus_req->buf) { + ath10k_warn(ar, + "unable to allocate data buffer for bus request\n"); + goto err_free_bus_req; + } + memcpy(bus_req->buf, skb->data, skb->len); bus_req->skb = skb; bus_req->eid = eid; bus_req->address = addr; @@ -1357,6 +1367,11 @@ static int ath10k_sdio_prep_async_req(struct ath10k *ar, u32 addr, spin_unlock_bh(&ar_sdio->wr_async_lock); return 0; + +err_free_bus_req: + ath10k_sdio_free_bus_req(ar, bus_req); +err: + return -ENOMEM; } /* IRQ handler */ @@ -1501,12 +1516,11 @@ 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); /* Write TX data to the end of the mbox address space */ address = ar_sdio->mbox_addr[eid] + ar_sdio->mbox_size[eid] - - skb->len; - ret = ath10k_sdio_prep_async_req(ar, address, skb, + padded_len; + ret = ath10k_sdio_prep_async_req(ar, address, skb, padded_len, NULL, true, eid); if (ret) return ret; @@ -1761,7 +1775,8 @@ static void ath10k_sdio_irq_disable(struct ath10k *ar) init_completion(&irqs_disabled_comp); ret = ath10k_sdio_prep_async_req(ar, MBOX_INT_STATUS_ENABLE_ADDRESS, - skb, &irqs_disabled_comp, false, 0); + skb, skb->len, &irqs_disabled_comp, + false, 0); if (ret) goto out; diff --git a/drivers/net/wireless/ath/ath10k/sdio.h b/drivers/net/wireless/ath/ath10k/sdio.h index 07e2cc6a3bd8..5a727993fbda 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.h +++ b/drivers/net/wireless/ath/ath10k/sdio.h @@ -105,6 +105,8 @@ struct ath10k_sdio_bus_request { u32 address; struct sk_buff *skb; + u8 *buf; + size_t buf_len; enum ath10k_htc_ep_id eid; int status; /* Specifies if the current request is an HTC message.