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;