From patchwork Mon Jun 12 15:03:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 9781307 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 3CD3460212 for ; Mon, 12 Jun 2017 15:03:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 293F226E51 for ; Mon, 12 Jun 2017 15:03:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1DEA02823D; Mon, 12 Jun 2017 15:03:26 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, 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 B534626E51 for ; Mon, 12 Jun 2017 15:03:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752354AbdFLPDZ (ORCPT ); Mon, 12 Jun 2017 11:03:25 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:33845 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751976AbdFLPDX (ORCPT ); Mon, 12 Jun 2017 11:03:23 -0400 Received: by mail-lf0-f68.google.com with SMTP id o28so9678921lfk.1 for ; Mon, 12 Jun 2017 08:03:22 -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=2/N+soRxZPJHeVZvGe4DMvXP7V6MBvQmh9N5dRkUwvk=; b=fgauyf6vWoNvw6PTHMsDWijdikZT+dM+xn//k7me2FkxcuezJ5eepFlbamEvnb4cqY NFf1+0yVIVLxCC9kkmDLspm4TJHgx/rJiw41aHoZM3AbVm2rLkptiAwXoXsgfhjDe5Ch PgXhZ10JgKlaTWVFHTjY5ciR/1cM1xCKyWhqomjYE+V5/WqQ7L2mBmpGPPQy1/3pY+i1 +//Hh6HwoKHGSug3DpqEaY+ZVkjMK4iJEZ5HYqm6d0aPIUcKk1BBkUpV+l5wW1xmZfJT lNo9GVBkKSdQBsYOKRRhxpW9fbwYb0ikoFGg89eORSYPRtoL2A7OEJtl6GZcj8Xn6Pa6 DZpQ== 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=2/N+soRxZPJHeVZvGe4DMvXP7V6MBvQmh9N5dRkUwvk=; b=dmOzL3sKFUEk2bsaKmY/88R/KEcrU20mncrCB+/R1F5Gf09w9nwIQ7lNl3I7edW/CK Cr54SQwZ8jyYp7WU0vbsVUD14VQs+gfv/zf+zRNaf11cNWrCRY1XMnaKBG4XT/G5KOK2 jnD+rbrwOeHn+ySzuCo8cmCU+Br+UlOaL1YcvaspL8YHpvmAOd/UKDAVcPKZBx0QbgYd hnU4WKM9z1/pgztDEVTDPXgs2l/BDI1FWyTRrB/s9mXJaAb51aL/jLkSyPshnEhT1HSD 3syaP109Hzilm4QTjFv3/HAXa6z4/AZK704+IuQySxsJtzuYgKvbvupqW4ar5+x+W/wm VTtw== X-Gm-Message-State: AODbwcBSgl0UYEFNljp4W8C5XuWUvwsZrq7AgRVZ/l1U6xoUdCo1xMmf XnFV76zI+wM/bA== X-Received: by 10.25.145.15 with SMTP id t15mr8208355lfd.65.1497279801194; Mon, 12 Jun 2017 08:03:21 -0700 (PDT) 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 n71sm2709253lje.14.2017.06.12.08.03.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Jun 2017 08:03:20 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Cc: Erik Stromdahl Subject: [RFC v2 02/10] ath10k: htt: RX ring config HL support Date: Mon, 12 Jun 2017 17:03:03 +0200 Message-Id: <1497279791-9598-3-git-send-email-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497279791-9598-1-git-send-email-erik.stromdahl@gmail.com> References: <1497279791-9598-1-git-send-email-erik.stromdahl@gmail.com> 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 Special HTT RX ring config message used by high latency devices. The main difference between HL and LL is that HL devices do not use shared memory between device and host and thus, no host paddr's are added to the RX config message. Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/htt.c | 5 +++- drivers/net/wireless/ath/ath10k/htt.h | 1 + drivers/net/wireless/ath/ath10k/htt_tx.c | 51 ++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/htt.c b/drivers/net/wireless/ath/ath10k/htt.c index cd160b1..29ed4af 100644 --- a/drivers/net/wireless/ath/ath10k/htt.c +++ b/drivers/net/wireless/ath/ath10k/htt.c @@ -258,7 +258,10 @@ int ath10k_htt_setup(struct ath10k_htt *htt) if (status) return status; - status = ath10k_htt_send_rx_ring_cfg_ll(htt); + if (ar->is_high_latency) + status = ath10k_htt_send_rx_ring_cfg_hl(htt); + else + status = ath10k_htt_send_rx_ring_cfg_ll(htt); if (status) { ath10k_warn(ar, "failed to setup rx ring: %d\n", status); diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h index 6305308..7ffa1d4 100644 --- a/drivers/net/wireless/ath/ath10k/htt.h +++ b/drivers/net/wireless/ath/ath10k/htt.h @@ -1805,6 +1805,7 @@ int ath10k_htt_h2t_ver_req_msg(struct ath10k_htt *htt); int ath10k_htt_h2t_stats_req(struct ath10k_htt *htt, u8 mask, u64 cookie); int ath10k_htt_send_frag_desc_bank_cfg(struct ath10k_htt *htt); int ath10k_htt_send_rx_ring_cfg_ll(struct ath10k_htt *htt); +int ath10k_htt_send_rx_ring_cfg_hl(struct ath10k_htt *htt); int ath10k_htt_h2t_aggr_cfg_msg(struct ath10k_htt *htt, u8 max_subfrms_ampdu, u8 max_subfrms_amsdu); diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c index 685faac..8d85f82 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c @@ -693,6 +693,57 @@ int ath10k_htt_send_rx_ring_cfg_ll(struct ath10k_htt *htt) return 0; } +int ath10k_htt_send_rx_ring_cfg_hl(struct ath10k_htt *htt) +{ + struct ath10k *ar = htt->ar; + struct sk_buff *skb; + struct htt_cmd *cmd; + struct htt_rx_ring_setup_ring *ring; + const int num_rx_ring = 1; + u16 flags; + int len; + int ret; + + /* + * the HW expects the buffer to be an integral number of 4-byte + * "words" + */ + BUILD_BUG_ON(!IS_ALIGNED(HTT_RX_BUF_SIZE, 4)); + BUILD_BUG_ON((HTT_RX_BUF_SIZE & HTT_MAX_CACHE_LINE_SIZE_MASK) != 0); + + len = sizeof(cmd->hdr) + sizeof(cmd->rx_setup.hdr) + + (sizeof(*ring) * num_rx_ring); + skb = ath10k_htc_alloc_skb(ar, len); + if (!skb) + return -ENOMEM; + + skb_put(skb, len); + + cmd = (struct htt_cmd *)skb->data; + ring = &cmd->rx_setup.rings[0]; + + cmd->hdr.msg_type = HTT_H2T_MSG_TYPE_RX_RING_CFG; + cmd->rx_setup.hdr.num_rings = 1; + + flags = 0; + flags |= HTT_RX_RING_FLAGS_MSDU_PAYLOAD; + flags |= HTT_RX_RING_FLAGS_UNICAST_RX; + flags |= HTT_RX_RING_FLAGS_MULTICAST_RX; + + memset(ring, 0, sizeof(*ring)); + ring->rx_ring_len = __cpu_to_le16(HTT_RX_RING_SIZE_MIN); + ring->rx_ring_bufsize = __cpu_to_le16(HTT_RX_BUF_SIZE); + ring->flags = __cpu_to_le16(flags); + + ret = ath10k_htc_send(&htt->ar->htc, htt->eid, skb); + if (ret) { + dev_kfree_skb_any(skb); + return ret; + } + + return 0; +} + int ath10k_htt_h2t_aggr_cfg_msg(struct ath10k_htt *htt, u8 max_subfrms_ampdu, u8 max_subfrms_amsdu)