From patchwork Tue Apr 9 19:08:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 10891955 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 04D7B17E6 for ; Tue, 9 Apr 2019 19:13:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFA472880D for ; Tue, 9 Apr 2019 19:13:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3ED928938; Tue, 9 Apr 2019 19:13:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 837AD2880D for ; Tue, 9 Apr 2019 19:13:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ipvAU0/V9HmcWcmJWx2svx8frRi+IEzbtPsE4PrN164=; b=MKOtzG9913cyHn J/4uwwE9SOXfD6ZkXuyR4BGFNAAMdnURSbhHa9YuxMJkJfnQlGTcg+ZIGxz/dMxOvbE1JivKCWZ7R FUUI2Xi2w290ok+Apfib17cnc10wmqJp7SFRQiwGA13WyH4In1p38hsyC0SY8Wr1G8XwldxMaZ5rJ LZ9zNvvKrwUFUauotqRWEOif9M1HggwwYv6YtRUj4/JOZY548NdU5YJBZMUdUBsMnNG7iaYx8qGs8 5LOZlyHPULNfOgStEU9Hescd9JYw1qzhFAzyQaalXGWiJTnH9GkjplY6F9RGFmAZXXxPQt5SLWRY/ PYkdBxace5qcB+i+3oHg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDwBO-00020J-VM; Tue, 09 Apr 2019 19:13:22 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDwBE-0001ly-J8 for ath10k@lists.infradead.org; Tue, 09 Apr 2019 19:13:15 +0000 Received: by mail-lf1-x142.google.com with SMTP id o199so598222lfo.1 for ; Tue, 09 Apr 2019 12:13:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6MzNwas+kmvZBqXFHalYjmibG7bDEawjRv+w+Gt/Y+4=; b=H0Au3SmX5gAs+c5l4QrTplUbRGj0r3VxLcYT/wYK9n+ecLK65XKTMBHrME5Ne7gUXi LgYUs/sETeTfAcVvv0+1fTR0CWF97bJhXD3VOsFoBncz1bOO292Li9d6QJ4H6MMC/aDh ht6Q2NnC7p3S44p2d/Iu87BARAKCnp93abCsuAmLo36SjOpvVQ1LPOcg8ohlUejLo8bq OCbV7xMDArjJgb/V0ZEtM6wQf9jBpK6OvDAr35TYMxceDOBMQsKwltBUkIHUo/8EIbNf Pi41JMAkU+xRNkK1uFkICnEuQ6ebbyMqGDTIHGj+MjLf6dzP0oOqOY28f2xui3afxt+9 UAwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6MzNwas+kmvZBqXFHalYjmibG7bDEawjRv+w+Gt/Y+4=; b=PbkVH5I9gME+8Bdm1sQNFExnvWa5ijyhI3Yx1TpMGG9v7u7lnOlhATWOrj2Jc7uji3 M6yEIo74wx9XZ63q3sGGxYGlvHJ2HnhuALjq9S+x19b5JLeyupvU9WTdSHj7XQ9G8Zl4 q0ZNUpqXDoC4CerkPijkx4adIogoqLkOKkxa+Rq5nzbTsOQrFaM/VfO4Pbpe8YGP7jb4 camlHMlmFzSinoEQlGiMDIaSyPvZJ8AO4MEIF7yTuoD3GI1+R1FG8sVJz/E6wqY9xggV cyzVoT6N6LOgi3wo/YVqJ0ZPhNGAUxoWtvs5YT4qRFUaSm88YH7y6xkRijzPo9cjCt6U Yblg== X-Gm-Message-State: APjAAAXlGDk46JdASxt+/sNjxbQr7i2be9qHjr/P83b3OKTsbOQGHmzY XYwWl4O7JU6xn+gG30H0mSA= X-Google-Smtp-Source: APXvYqxU2XfwiOpjOnQOzw3phiopNazl9V+ZaRz5pCJUVcc2xDtcHLAGIH/8CSgWMYwx36wFYkVDDQ== X-Received: by 2002:a19:e30b:: with SMTP id a11mr9039046lfh.4.1554837191052; Tue, 09 Apr 2019 12:13:11 -0700 (PDT) Received: from localhost.localdomain (81-233-89-221-no75.tbcn.telia.com. [81.233.89.221]) by smtp.gmail.com with ESMTPSA id q64sm6807848ljq.76.2019.04.09.12.13.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 12:13:10 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [PATCH 4/6] ath10k: sdio: add MSDU ID allocation in HTT TX path Date: Tue, 9 Apr 2019 21:08:49 +0200 Message-Id: <20190409190851.4557-5-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190409190851.4557-1-erik.stromdahl@gmail.com> References: <20190409190851.4557-1-erik.stromdahl@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190409_121312_670018_B756C94E X-CRM114-Status: GOOD ( 13.16 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Erik Stromdahl , Alagu Sankar Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alagu Sankar This makes the SDIO HTT TX path more similar to PCIe. Transmit completion for SDIO is similar to PCIe, via the T2H message HTT_T2H_MSG_TYPE_TX_COMPL_IND. This means that we will create a unique MSDU ID for each transmitted frame just as we do in the PCIe case. As a result of this, the TX skb will be freed when we receive the HTT_T2H_MSG_TYPE_TX_COMPL_IND message. Thus, we must not free the skb in the HTT ep_tx_complete handler in the SDIO case. Co-developed-by: Erik Stromdahl Signed-off-by: Alagu Sankar Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/htt_rx.c | 4 +++- drivers/net/wireless/ath/ath10k/htt_tx.c | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index a20ea270d519..6e3331b96c0f 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -2277,7 +2277,9 @@ static void ath10k_htt_rx_tx_compl_ind(struct ath10k *ar, * Note that with only one concurrent reader and one concurrent * writer, you don't need extra locking to use these macro. */ - if (!kfifo_put(&htt->txdone_fifo, tx_done)) { + if (ar->hif.bus == ATH10K_BUS_SDIO) { + ath10k_txrx_tx_unref(htt, &tx_done); + } else if (!kfifo_put(&htt->txdone_fifo, tx_done)) { ath10k_warn(ar, "txdone fifo overrun, msdu_id %d status %d\n", tx_done.msdu_id, tx_done.status); ath10k_txrx_tx_unref(htt, &tx_done); diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c index 619c2b87b8bb..e5e6e206a52f 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c @@ -543,7 +543,8 @@ void ath10k_htt_tx_free(struct ath10k_htt *htt) void ath10k_htt_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb) { - dev_kfree_skb_any(skb); + if (!(ar->hif.bus == ATH10K_BUS_SDIO)) + dev_kfree_skb_any(skb); } void ath10k_htt_hif_tx_complete(struct ath10k *ar, struct sk_buff *skb) @@ -1244,6 +1245,7 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm u8 tid = ath10k_htt_tx_get_tid(msdu, is_eth); u8 flags0 = 0; u16 flags1 = 0; + u16 msdu_id = 0; data_len = msdu->len; @@ -1291,6 +1293,16 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm } } + if (ar->hif.bus == ATH10K_BUS_SDIO) { + flags1 |= HTT_DATA_TX_DESC_FLAGS1_POSTPONED; + res = ath10k_htt_tx_alloc_msdu_id(htt, msdu); + if (res < 0) { + ath10k_err(ar, "msdu_id allocation failed %d\n", res); + goto out; + } + msdu_id = res; + } + skb_push(msdu, sizeof(*cmd_hdr)); skb_push(msdu, sizeof(*tx_desc)); cmd_hdr = (struct htt_cmd_hdr *)msdu->data; @@ -1300,7 +1312,7 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm tx_desc->flags0 = flags0; tx_desc->flags1 = __cpu_to_le16(flags1); tx_desc->len = __cpu_to_le16(data_len); - tx_desc->id = 0; + tx_desc->id = __cpu_to_le16(msdu_id); tx_desc->frags_paddr = 0; /* always zero */ /* Initialize peer_id to INVALID_PEER because this is NOT * Reinjection path