From patchwork Tue Feb 21 16:15:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 9585089 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.web.codeaurora.org (Postfix) with ESMTP id C23486042F for ; Tue, 21 Feb 2017 16:23:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0B86285A3 for ; Tue, 21 Feb 2017 16:23:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5AA7285B8; Tue, 21 Feb 2017 16:23:29 +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=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM 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 4D527285A3 for ; Tue, 21 Feb 2017 16:23:29 +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=6+10GaVtCjITSUawcvN4ODgp18OCPu0c5K5WK0ujgHM=; b=TIVQ7Iw7VKjSSW7ga/s6qKTbUe QILMWy6iF5kfxOHDQQSo6043Zi1AykixIXx+eCXjHfwKbj9MtZeHcCadIKPRH4W3tSvE5+tuk4bM3 VE9fmB58VS7ra+Fvz3LlLE9P1TjUzyxoa/rMNR41t9yccuvlLb1PAfmHei0m+LxUVfxE+IR4ZHSBI n4o4IoNacaV3OAVAi7/xvu8lnbgTe3IBVVab4K+ToARqIE9D6TTvRotdM+Vp1wWnhEyLME+AYyZ6H 0/GmO1k49c5UFsPvp1CD6Rv64NblR/gCAprWQO47uMKaovhyYcdM38ZdXcjzVoilnOkr/WfsSiqxm aroS+opA==; 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 1cgDDo-0004ga-0I; Tue, 21 Feb 2017 16:23:24 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cgDCy-0003yz-DU for ath10k@bombadil.infradead.org; Tue, 21 Feb 2017 16:22:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Yr0QnHVnwGWJSl5XOb3+8eDivbjMer4BSshjpvR+5OI=; b=hUjkFo5o5fcLeDp7GWf8w4p7Y 0OjLnqhu0CJlob4zFDXLK0mPiVCuuSErl36HecnWYhQIi1x2DsM/gvtCwKm+YVVePkzmQ+llDMNzv KWHCAfLlaCjYSsUoLEzBhX3733RCGhuj76nXxB3K3V5kc1y34wAKhCRezZprqXlAMS+YoUMuP4URG ylo033000v25G/qVVFqflAIvG3OWlwD+U3BwYuOjpKcPuxaYZwkdcB3aALaDfIwSN5ytwy8bw2GHU XjAJgMQcy4ZUwFXdXjWCgeslqgLi7SrU4O0+JNKIbfC/NJEj0UikrixDbT7sCH4ha/FNQ5IJnZDSY bQWjdORMQ==; Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cgD7Q-0006hv-5b for ath10k@lists.infradead.org; Tue, 21 Feb 2017 16:16:53 +0000 Received: by mail-lf0-x243.google.com with SMTP id 86so5300513lfv.0 for ; Tue, 21 Feb 2017 08:16:30 -0800 (PST) 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=Yr0QnHVnwGWJSl5XOb3+8eDivbjMer4BSshjpvR+5OI=; b=dSReb1GkV2kJL+sg/HrmJyoeomkcEDs8y3WnhtTP8gIKJ9gpKMVwEDkLIM4qSbnaBK RO0qAt0yaw5mCVpUof6RsMxlBvJG3uJrcEjebFeeL2e/LRi0Qb6qAOJjXS752Mf+B3NR W8R/lnm1QNfCpwBpos8pvRpDrCTztChzVmTX9eUm1kBrO7PjqePvw3QyWhmcMtjwPaIq svYEWyM/Eu4dwbgzoXjZx2Cf42GdvlkjxvhHi35ypAg0cuQuxAw0D29Y6flaAg1TtR0C XMR2UhLcJ0+AC+RVDGTDSIDA85FTJNZo4aDwi0yxYf7CVkdOMgwndemjMygYEHIStSPI Eb/g== 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=Yr0QnHVnwGWJSl5XOb3+8eDivbjMer4BSshjpvR+5OI=; b=pQ1VHvdJ5v8W48rTkJkJpkrmFJJvanSUtSSj3EHn5BM/vAx52W/SN+o4GSMg9wcEmZ KK91l8AYUiegev5YNgdZ05Vb+wl0IAYfvM23pwofUXZKef+KE1LtHajpU8Ym3HFt49An /6kSeHr6FJoH4IzY+s5VVS3xy1IEvzmprTdWkmQhIzbXIABYWEWmtr3tCUeN1im3L6Ju qMMAGkweywywa5n2rs5GxfW/UqT4wVSzKGbX7TbZ4cUW1MOIJszizi/k0ItYD7cZW779 mjmvkXFL1Ll7tBbBA6Q1YRR2JfQ3T64buEg14PAV7L1P8n6BbTjExNPfwJH1cteG4aNB Rkfw== X-Gm-Message-State: AMke39mJead5Iq4Hc6T1l4hLbn8srNc2nrSkUUtjVuypiP7PgYCwg4PpM55/Qm/n6Tz25A== X-Received: by 10.25.41.10 with SMTP id p10mr8149264lfp.118.1487693789086; Tue, 21 Feb 2017 08:16:29 -0800 (PST) Received: from erik-mate-1604.lan (90-227-62-61-no75.tbcn.telia.com. [90.227.62.61]) by smtp.gmail.com with ESMTPSA id t29sm6336069ljd.39.2017.02.21.08.16.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Feb 2017 08:16:27 -0800 (PST) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [RFC v4 17/21] ath10k: htt: High latency TX support Date: Tue, 21 Feb 2017 17:15:37 +0100 Message-Id: <1487693741-10042-18-git-send-email-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487693741-10042-1-git-send-email-erik.stromdahl@gmail.com> References: <1487693741-10042-1-git-send-email-erik.stromdahl@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170221_161648_327371_7DD239FD X-CRM114-Status: GOOD ( 16.49 ) 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 MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add HTT TX function for HL interfaces. Intended for SDIO and USB. Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/htt.h | 9 ++-- drivers/net/wireless/ath/ath10k/htt_tx.c | 72 +++++++++++++++++++++++++++++++- drivers/net/wireless/ath/ath10k/mac.c | 5 ++- 3 files changed, 80 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h index bdee2e7..85ad46c 100644 --- a/drivers/net/wireless/ath/ath10k/htt.h +++ b/drivers/net/wireless/ath/ath10k/htt.h @@ -1822,9 +1822,12 @@ int ath10k_htt_tx_mgmt_inc_pending(struct ath10k_htt *htt, bool is_mgmt, int ath10k_htt_tx_alloc_msdu_id(struct ath10k_htt *htt, struct sk_buff *skb); void ath10k_htt_tx_free_msdu_id(struct ath10k_htt *htt, u16 msdu_id); int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *msdu); -int ath10k_htt_tx(struct ath10k_htt *htt, - enum ath10k_hw_txrx_mode txmode, - struct sk_buff *msdu); +int ath10k_htt_tx_ll(struct ath10k_htt *htt, + enum ath10k_hw_txrx_mode txmode, + struct sk_buff *msdu); +int ath10k_htt_tx_hl(struct ath10k_htt *htt, + enum ath10k_hw_txrx_mode txmode, + struct sk_buff *msdu); void ath10k_htt_rx_pktlog_completion_handler(struct ath10k *ar, struct sk_buff *skb); int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget); diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c index ca899e1..a714aa8 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c @@ -945,8 +945,76 @@ int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *msdu) return res; } -int ath10k_htt_tx(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txmode, - struct sk_buff *msdu) +#define HTT_TX_HL_NEEDED_HEADROOM \ + (unsigned int)(sizeof(struct htt_cmd_hdr) + \ + sizeof(struct htt_data_tx_desc) + \ + sizeof(struct ath10k_htc_hdr)) + +int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txmode, + struct sk_buff *msdu) +{ + struct ath10k *ar = htt->ar; + int res, data_len; + struct htt_cmd_hdr *cmd_hdr; + struct htt_data_tx_desc *tx_desc; + struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu); + u8 flags0; + u16 flags1 = 0; + + data_len = msdu->len; + flags0 = SM(txmode, HTT_DATA_TX_DESC_FLAGS0_PKT_TYPE); + + if (skb_cb->flags & ATH10K_SKB_F_NO_HWCRYPT) + flags0 |= HTT_DATA_TX_DESC_FLAGS0_NO_ENCRYPT; + + if (msdu->ip_summed == CHECKSUM_PARTIAL && + !test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { + flags1 |= HTT_DATA_TX_DESC_FLAGS1_CKSUM_L3_OFFLOAD; + flags1 |= HTT_DATA_TX_DESC_FLAGS1_CKSUM_L4_OFFLOAD; + } + + /* Prepend the HTT header and TX desc struct to the data message + * and realloc the skb if it does not have enough headroom. + */ + if (skb_headroom(msdu) < HTT_TX_HL_NEEDED_HEADROOM) { + struct sk_buff *tmp_skb = msdu; + + ath10k_dbg(htt->ar, ATH10K_DBG_HTT, + "Not enough headroom in skb. Current headroom: %u, needed: %u. Reallocating...\n", + skb_headroom(msdu), HTT_TX_HL_NEEDED_HEADROOM); + msdu = skb_realloc_headroom(msdu, HTT_TX_HL_NEEDED_HEADROOM); + kfree_skb(tmp_skb); + if (!msdu) { + ath10k_warn(htt->ar, "htt hl tx: Unable to realloc skb!\n"); + res = -ENOMEM; + goto out; + } + } + + skb_push(msdu, sizeof(*cmd_hdr)); + skb_push(msdu, sizeof(*tx_desc)); + cmd_hdr = (struct htt_cmd_hdr *)msdu->data; + tx_desc = (struct htt_data_tx_desc *)(msdu->data + sizeof(*cmd_hdr)); + + cmd_hdr->msg_type = HTT_H2T_MSG_TYPE_TX_FRM; + 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->frags_paddr = 0; /* always zero */ + /* Initialize peer_id to INVALID_PEER because this is NOT + * Reinjection path + */ + tx_desc->peerid = __cpu_to_le32(HTT_INVALID_PEERID); + + res = ath10k_htc_send(&htt->ar->htc, htt->eid, msdu); + +out: + return res; +} + +int ath10k_htt_tx_ll(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txmode, + struct sk_buff *msdu) { struct ath10k *ar = htt->ar; struct device *dev = ar->dev; diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 3029f25..6d2da19 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -3531,7 +3531,10 @@ static int ath10k_mac_tx_submit(struct ath10k *ar, switch (txpath) { case ATH10K_MAC_TX_HTT: - ret = ath10k_htt_tx(htt, txmode, skb); + if (ar->is_high_latency) + ret = ath10k_htt_tx_hl(htt, txmode, skb); + else + ret = ath10k_htt_tx_ll(htt, txmode, skb); break; case ATH10K_MAC_TX_HTT_MGMT: ret = ath10k_htt_mgmt_tx(htt, skb);