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: 10906001 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 BA47F14DB for ; Wed, 17 Apr 2019 19:15:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A471B28ABE for ; Wed, 17 Apr 2019 19:15:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9900A28B9C; Wed, 17 Apr 2019 19:15:31 +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 DBAFA28ABE for ; Wed, 17 Apr 2019 19:15:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733217AbfDQTP3 (ORCPT ); Wed, 17 Apr 2019 15:15:29 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:34366 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732634AbfDQTP3 (ORCPT ); Wed, 17 Apr 2019 15:15:29 -0400 Received: by mail-lf1-f65.google.com with SMTP id h5so16794646lfm.1 for ; Wed, 17 Apr 2019 12:15:27 -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=UPPcwsPI+EP1qgSRjAe1PGW6anktQ3snlsGQ+zZ7pQIOs1CSuHM8tE2nJ0bKgXl0dQ 99IFnFMzA2F3x3Zxlva0oqKBpHGcw2rXQEWLoqIqrTaTyPiKd10I5T4b8f1eAk7GYnQw tSFys95WrTksJnMa6rLFNdsBtga4EvZLbbieVCPCkk36H9lw0drds9yA4ClLd+aDWKyj PEhX5rtWalj6Li4twB4pvjV5Lg1XwulX7si+9o5ReCsskDZT03QemThQqaosm5h4oEgr hPX/us6VwBMRxF/8p6y2gzDYtau8ha7iDGrJUooWec4XfUWjdfzse2KU/kkft9ckvcXg yUbQ== X-Gm-Message-State: APjAAAWOXhqBYA8J97PPoN9A/uIJ3qEZgkR4KM/U5BDNzuFIWx0vheXl OAz2Y4paZ8abVFB5Ov8jE4iP5EvX 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 Cc: Alagu Sankar , Erik Stromdahl 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 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. 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: 10906003 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 DE8DB1515 for ; Wed, 17 Apr 2019 19:15:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8EC528ABE for ; Wed, 17 Apr 2019 19:15:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C754F28B9B; Wed, 17 Apr 2019 19:15:31 +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 6DB8828B9F for ; Wed, 17 Apr 2019 19:15:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733305AbfDQTPa (ORCPT ); Wed, 17 Apr 2019 15:15:30 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:45948 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729291AbfDQTP3 (ORCPT ); Wed, 17 Apr 2019 15:15:29 -0400 Received: by mail-lf1-f67.google.com with SMTP id t11so15226490lfl.12 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=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=lMm6ESI2XYNPsV6JwWhOfR2HfRSUunYnoS2L1+NUlhoqnbNKiQ12pq0cuiqgDzaANW TICVmX6huPzoJT5Y69SbIf8emP5T65aP3I+dk8XXBDZGJJ6AWWgQ5o2cdVMn99A2l4Qs EaAlKX7Jbl0zTkJseegewSHZfKdTZj08rSYkLhLDDoG1OYXMhdGPmw8jk5K8tIxos6hR OGSh19JayXxWLI75pPxiEWeAEwQltFEQF6P8SepjiHSnobRMwkbcanD/Y8fXnIvnXYKy 9aEW8B7fr1OLiyoGRpCJtHQt966CvYGo5w+DQFUFNdbTBFAsVVrmx40ov58E3/gaGwjr Q5pA== X-Gm-Message-State: APjAAAXOp9EE5rnj1dc1pzjF8mq/UZAy3nq/TW0MklBDDrN05iKuaA+n rCMJ7DtXkV2wv7UAUQqqGc4= 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 Cc: Alagu Sankar , Erik Stromdahl 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 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 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: 10906005 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 E3EAE14DB for ; Wed, 17 Apr 2019 19:15:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD9D128A54 for ; Wed, 17 Apr 2019 19:15:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C183428B93; Wed, 17 Apr 2019 19:15:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-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 413C328AF6 for ; Wed, 17 Apr 2019 19:15:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733308AbfDQTPc (ORCPT ); Wed, 17 Apr 2019 15:15:32 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:43296 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733091AbfDQTPb (ORCPT ); Wed, 17 Apr 2019 15:15:31 -0400 Received: by mail-lf1-f66.google.com with SMTP id i68so8800233lfi.10 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=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=roqYFNu06EwBdFjcy4IuaG5s0fpQ4Ht8GC1YPDu9j6lIIntGXxMh7xiNn5RnNErm4p rwTUW5S+9mrrFSBVOSvAV/tCfWWSPh6qXlZB9blq9965NIkg1k9+Pr+9frvnShPstab0 zU/YoPnQF+lxi6Egn47CcPD+4Kgb49dysRaMRjfwpESLZsS9sqSpYAM1qxvMnrixA0v4 YS9cyVIaoZQh/TWCjaG4rQD1Z+2ApKsddV78XXJaWZoY3RSD88gdypqHQOM9ZhQ6j2xI huxf7v6MDHB7eB5W4iHjojXPs7GHdcFjINL8lHKv5U1Urh8vaLR0xu0j3+RpDj6kpf3V uTvw== X-Gm-Message-State: APjAAAVsSyr7EhPttesrD0NDLDIMfPe4sYZXePgrbzFAXXpeijwBv9DR mXdrsvla+otO/VfUVEABolWuimpf 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 Cc: Alagu Sankar , Erik Stromdahl 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 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. 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: 10906009 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 824C918FD 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 6F37128A93 for ; Wed, 17 Apr 2019 19:15:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5060328AF6; 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=-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 F263028AF6 for ; Wed, 17 Apr 2019 19:15:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733244AbfDQTPc (ORCPT ); Wed, 17 Apr 2019 15:15:32 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:37255 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732634AbfDQTPb (ORCPT ); Wed, 17 Apr 2019 15:15:31 -0400 Received: by mail-lf1-f68.google.com with SMTP id o19so15383329lfl.4 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=oswiubyG2AExm5QDPDm2Y8d+JV1NeAEsC9bRMQTFc+nj4OnkySuaKu68s6n4X6QeK2 ArsUEHv2ZoLnlt5yYIVROUG7GQN3qYkLTbt5rEav6Ht9t+vBIHogPY3klH3p+MYhjuTp gkZxhUhSvj9aRwhzsFQu4HjXvW6R//gPSJc3mVWypBQXSHi1UBCrgw4eiydSk5r1ka7r mKpaeBMjcEdEvHNfDi84eZiX09oTAungZpdDhKK7LNGPtcI0gN7syimjWErXDeYBNGIr PeIsoP2bqoNqB42DmmUFvu9PJE27R6V/qrtIbKSOUfE83rNQtIBJl7kDdbshRO5QAgvG 7gUw== X-Gm-Message-State: APjAAAXZbKCHD0xvfgX/CNT15AWVuWyiBcmWtm14rwZDL5uqrlyyRI2l wZEBgkTr/jk/3V2AG8Z3daQezCnB 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 Cc: Erik Stromdahl 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 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 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: 10906011 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 8477214DB for ; Wed, 17 Apr 2019 19:15:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71ACE28ABE for ; Wed, 17 Apr 2019 19:15:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EFCC28AFF; Wed, 17 Apr 2019 19:15:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-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 ED61828ADC for ; Wed, 17 Apr 2019 19:15:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732858AbfDQTPe (ORCPT ); Wed, 17 Apr 2019 15:15:34 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:39662 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729291AbfDQTPd (ORCPT ); Wed, 17 Apr 2019 15:15:33 -0400 Received: by mail-lf1-f67.google.com with SMTP id d12so3139476lfk.6 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=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=GdBOMRx1xcBrlsS1DDONSRf7in1maYc8UeHDaD+jBc5/Yx72mLY3qzVdXG9QMl2KP8 aPm718neQvIVe3bg/+Dxqxdo/8KYqDpburrHGPGsg9KTcEoNhekqGWYt/W60M31QMtlw mwowLqVhWKwVtUXhQmmmijDzZA4iu8276CQdm/CnW53UGanSnzfIc8Kjm5K5qLvcA2Z4 sCrI3tNgDDfwGv0xG+4CRZinH85cMpxYOvHi8LibQ9NXM9Xx+53mKw51Izay7cCyU4i9 PBdVVwtO0jOJ6S/ldx1KvZcHNdySi8HJ/bgAd6Bgw4uGQOvK1nZfk9/tldXxYHInDcpj bFIA== X-Gm-Message-State: APjAAAWk0KYlerhKsP42UPMPAJDFID3r1hLTrMnwwA2szcqjp/b87Phw 6trjk4JugWjX2DhbDgN8e50= 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 Cc: Erik Stromdahl 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 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 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.