From patchwork Sat Sep 30 17:37:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: silexcommon@gmail.com X-Patchwork-Id: 9979563 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 04DCA6056E for ; Sat, 30 Sep 2017 17:39:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1B0C28EFC for ; Sat, 30 Sep 2017 17:39:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D68B628EFF; Sat, 30 Sep 2017 17:39:05 +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=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 1509C28EFE for ; Sat, 30 Sep 2017 17:39:05 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=jopUKittMi8vQpCyVTNqhntIqcUF/FlFzgrgxrCw9AQ=; b=IkVGznk8lJpgh5CLinEPrQvc54 iG4vdwgmHVJtmqShdyPua3lea/PTCa1pS7WspC+EgGKHif0sTiyTigoSdKZRJXWLdMyBr5XbLfgtu DJwNTJyCHWM4Rl6aGjWU9u3yccKOU3Y9opPeaAwslQ4JDRgzCOmJhe0SmwDRh9C3bBXfVDANNRNaq 24T3TMCQTSMgAN5NMbbv9zHoy7weYKQKnRa1onRZXpns4N7cvu7OcCgBwf95vWvzjUQxZ8NPd432o rvBtVWqYj8fwp5uN08eH2eshGF6SThQthD9dCcX1VwPiwCIZ4mzhM4C0Xx7PlKeqxcXGUfEJjrgbD Imle17rw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dyLj6-0001Ww-9s; Sat, 30 Sep 2017 17:38:56 +0000 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dyLiz-0001On-4z for ath10k@lists.infradead.org; Sat, 30 Sep 2017 17:38:51 +0000 Received: by mail-pf0-x241.google.com with SMTP id i23so1766037pfi.2 for ; Sat, 30 Sep 2017 10:38: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; bh=9oCYcRVse4+M24ZjiCXILG4QIzulEYg+kpw3PUGMh34=; b=C1YkUJOvHd+xYNQTyKuNRd5Fhn9kITn3RR1ifhLRtGxdWkuBYikHUidczeMAbvWV+V 5wdB/tohI/7mByEXX7cqfQNzASiicOb4GQt/ccqqLL4QWAtmtELlXBbb8/pmW/vwEup5 /U2lI+nb/v9zEaGQGvwmlhT8RkqdwWMxzqnfHvxEVCREe8uczmIBPd3AIuOAHw/Q2NQ0 TaQ7VQuetlqEjK5FY5BERqcW1dX+J0k6O/hEEq9/RLrWHywM4yOxDA+JCt6Gse/Cp8k9 9mW0LKcx+ST8blgpPQ7HVpOAWPb1OW0ID2AR3s5WQlZLhxC++hNG9093FpP0zfbW0mxx sbrg== 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; bh=9oCYcRVse4+M24ZjiCXILG4QIzulEYg+kpw3PUGMh34=; b=ivH6FtCjC91txr32UQr7J35xM140FeOd++YoBZJ/16YNL4j5wCWNTR0MWw6AZWrt/l OS2gRnD8vviB9pD3tap0mouCs/rviemYrmzH9SBC0Q5BjomQwoV/gg4sH0A9ySHBoe6t fbCNezUwBHM8HuSak84sjTEviEHmY/8au923iM4gcB6qc2jA+zNopQnHwI8Y++ftEht1 +z4xZyvS5b5dk2SGC/BA8XSmeLOrp/T+uTyvV2D7H30Ch4rU2RpsKpCjDAt8txw+aUcr UUoQYqocKnIEeWqH8G0juwjFlMXLJhpbtRI+fHnp8SDhi/Xp6yDyUN2bdzYismVzHivB cYoA== X-Gm-Message-State: AHPjjUiT10fd6AUEH2SIncUdyP86I0jO5jzw7PyucisH41RfcqPsRWfV t8hXuXp3rwMzshlax8NVF5wS+TAVcVk= X-Google-Smtp-Source: AOwi7QDNkuJM9W+KoCgHxw1ltVXp+6qa7euVWcftiUzUrU5Sm+buNZhy58tlvGyCiP9oOjyxSF8ujQ== X-Received: by 10.99.107.73 with SMTP id g70mr6671443pgc.279.1506793108394; Sat, 30 Sep 2017 10:38:28 -0700 (PDT) Received: from localhost.localdomain ([171.60.245.167]) by smtp.gmail.com with ESMTPSA id q15sm11197640pgc.64.2017.09.30.10.38.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 30 Sep 2017 10:38:27 -0700 (PDT) From: silexcommon@gmail.com X-Google-Original-From: alagusankar@silex-india.com To: ath10k@lists.infradead.org Subject: [PATCH 01/11] ath10k_sdio: sdio htt data transfer fixes Date: Sat, 30 Sep 2017 23:07:38 +0530 Message-Id: <1506793068-27445-2-git-send-email-alagusankar@silex-india.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1506793068-27445-1-git-send-email-alagusankar@silex-india.com> References: <1506793068-27445-1-git-send-email-alagusankar@silex-india.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170930_103849_320739_CCC0026E X-CRM114-Status: GOOD ( 15.87 ) 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: Alagu Sankar , linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alagu Sankar The ath10k sdio firmware does not allow transmitting packets with the reduced tx completion HI_ACS option. sdio firmware uses 1544 as alternate credit size, which is not big enough for the maximum sized mac80211 frames. Disable both these HI_ACS flags for SDIO. Transmit completion for SDIO is similar to PCIe, via the T2H message HTT_T2H_MSG_TYPE_TX_COMPL_IND. Modify the high latency path to allow SDIO modules to use the htt transmit completion path. This differs from the high latency path taken by the USB devices. Signed-off-by: Alagu Sankar --- drivers/net/wireless/ath/ath10k/core.c | 20 +++++++++++++++++--- drivers/net/wireless/ath/ath10k/htt_rx.c | 6 ++++-- drivers/net/wireless/ath/ath10k/htt_tx.c | 24 +++++++++++++++++++----- 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 4351341..b4f66cd 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -494,11 +494,25 @@ static void ath10k_init_sdio(struct ath10k *ar) ath10k_bmi_write32(ar, hi_mbox_isr_yield_limit, 99); ath10k_bmi_read32(ar, hi_acs_flags, ¶m); - param |= (HI_ACS_FLAGS_SDIO_SWAP_MAILBOX_SET | - HI_ACS_FLAGS_SDIO_REDUCE_TX_COMPL_SET | - HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE); + /* Data transfer is not initiated, when reduced Tx completion + * is used for SDIO. disable it until fixed + */ + param &= ~HI_ACS_FLAGS_SDIO_REDUCE_TX_COMPL_SET; + + /* Alternate credit size of 1544 as used by SDIO firmware is + * not big enough for mac80211 / native wifi frames. disable it + */ + param &= ~HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE; + param |= HI_ACS_FLAGS_SDIO_SWAP_MAILBOX_SET; ath10k_bmi_write32(ar, hi_acs_flags, param); + + /* Explicitly set fwlog prints to zero as target may turn it on + * based on scratch registers. + */ + ath10k_bmi_read32(ar, hi_option_flag, ¶m); + param |= HI_OPTION_DISABLE_DBGLOG; + ath10k_bmi_write32(ar, hi_option_flag, param); } static int ath10k_init_configure_target(struct ath10k *ar) diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 569edd0..f025363 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -1764,7 +1764,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); @@ -2541,7 +2543,7 @@ bool ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb) break; } case HTT_T2H_MSG_TYPE_TX_COMPL_IND: - if (!ar->is_high_latency) + if (!(ar->hif.bus == ATH10K_BUS_USB)) ath10k_htt_rx_tx_compl_ind(htt->ar, skb); break; case HTT_T2H_MSG_TYPE_SEC_IND: { diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c index c74fc13..d7f59a2 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c @@ -153,7 +153,7 @@ void ath10k_htt_tx_txq_update(struct ieee80211_hw *hw, void ath10k_htt_tx_dec_pending(struct ath10k_htt *htt) { - if (htt->ar->is_high_latency) + if (htt->ar->hif.bus == ATH10K_BUS_USB) return; lockdep_assert_held(&htt->tx_lock); @@ -165,7 +165,7 @@ void ath10k_htt_tx_dec_pending(struct ath10k_htt *htt) int ath10k_htt_tx_inc_pending(struct ath10k_htt *htt) { - if (htt->ar->is_high_latency) + if (htt->ar->hif.bus == ATH10K_BUS_USB) return 0; lockdep_assert_held(&htt->tx_lock); @@ -454,7 +454,7 @@ void ath10k_htt_tx_destroy(struct ath10k_htt *htt) return; ath10k_htt_tx_free_cont_txbuf(htt); - if (!htt->ar->is_high_latency) + if (!(htt->ar->hif.bus == ATH10K_BUS_USB)) ath10k_htt_tx_free_txq(htt); ath10k_htt_tx_free_cont_frag_desc(htt); ath10k_htt_tx_free_txdone_fifo(htt); @@ -475,7 +475,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) @@ -975,6 +976,7 @@ int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txmode, u8 tid = ath10k_htt_tx_get_tid(msdu, is_eth); u8 flags0 = 0; u16 flags1 = 0; + u16 msdu_id = 0; data_len = msdu->len; @@ -1022,6 +1024,18 @@ int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txmode, } } + if (ar->hif.bus == ATH10K_BUS_SDIO) { + flags1 |= HTT_DATA_TX_DESC_FLAGS1_POSTPONED; + spin_lock_bh(&htt->tx_lock); + res = ath10k_htt_tx_alloc_msdu_id(htt, msdu); + spin_unlock_bh(&htt->tx_lock); + 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; @@ -1031,7 +1045,7 @@ int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txmode, 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