From patchwork Tue Feb 21 16:15:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 9585069 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 3F2636042F for ; Tue, 21 Feb 2017 16:17:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C9A328527 for ; Tue, 21 Feb 2017 16:17:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FE9F285C6; Tue, 21 Feb 2017 16:17:40 +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 9F3CD28527 for ; Tue, 21 Feb 2017 16:17:39 +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=/pQXXiw0BaggIuKd8R8QeLqtrtF9J4hcHUP4TemOvCk=; b=mqD2ekJucAqqxK0fVR97tRR9Iz D4XXzfH+4Gm5+EK589ykoeiSdRCpT/NI8btPpu0lyACTflp5j6+KIFTuGfxUDycI2sg/AccdeVFI1 4VxZUWDdrHJW56OvoIZSDShj9pyK5IRIFDsNWT3Y0LU7h3dzKnLbhXSK4tfvKwD1UZMmgCydG3xwX fzeawsUrg8YcVzEWFHUb4UoQcE72fkl+xjFGdWCbrckxioB4vLcCEvoc+YZFKQMdSyZo4VakPrATt d1Klu3Lj3CgsOuIdvi9J98ThfQHy98qlijBIXHCpHoZC963d+1WlJej8ZU0HOGFAJrbIVbo2V1LUI XBXt5ukA==; 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 1cgD89-0007aJ-HA; Tue, 21 Feb 2017 16:17:33 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cgD7V-00071x-8L for ath10k@bombadil.infradead.org; Tue, 21 Feb 2017 16:16:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=yHZg1h10JcOdtE4c7othaVKDbkaoMa+v6JGgWjFeHpI=; b=s6s6M6onoPyv3vwnHnws2vIQq eqkyLhVbmsUnzZk4bzL8up6qixI9O9z+cY6QFIYNo06qF/ruWx2oa1OSgEqKBhhctwFK/XjbRTODf todTKrIZxmex+8+yfn61twtqZj4ySeVw15eOz1/FwK+sGpGt1NZKyryw7rYCLUBGAbQOOTtYLRGTQ ANW+3QoUZOXawr23ugCFd23LYAdrLHnHg23UU5j1qzI+cV/Z4EoUoQsUGbfkCYUai9PDsjCqxrlM1 xsNkTGiWm2GEzOT4k5Zr+maj5MW7f4WhamqDGFeR6NkKKxDKq6qZxZTj4Z/m5KGqkXCtAVM1KhJ2P Aia5eu4aw==; Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cgD7R-0007Gw-2I for ath10k@lists.infradead.org; Tue, 21 Feb 2017 16:16:52 +0000 Received: by mail-lf0-x242.google.com with SMTP id 90so4027080lfr.3 for ; Tue, 21 Feb 2017 08:16:28 -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=yHZg1h10JcOdtE4c7othaVKDbkaoMa+v6JGgWjFeHpI=; b=Ev56auc113KTBdDdMSpXZgh582paIQ2HOMAU6Mdo8QWmElsY2b3dF15iseKL28IMj4 fGzEKSaMF9LJK1UvObF8w0+a6QEE1r7PFqTY1nJH/PHg5T4xYhsR9ZW3sze6nhVYhbfa R3F1BWnXNUlVacK/42TXa8FxXX1PjArQghHLAuD6vlbTrlVSuBokjSWx0sbyX9TSF5BH SOfZL+uQRdhwKldP93xod3CZecmIRpxPKRNIwpgvQ5HNvLqEdm1WM/meGdUs5W8TGRk3 OzUnew04rvpS3sso4Vc62ibB4TNjk+xzEU5+urW7ubN1ZTbyynv9Z7o81ZTA14vD4Db3 rTWw== 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=yHZg1h10JcOdtE4c7othaVKDbkaoMa+v6JGgWjFeHpI=; b=Vcy71XklQmVr2p2wg54xvJfGWmG+cprq8G4VdLJm59sLzptVf3RAHBfzyPB0GfKzv6 CZtaK3f229qoeFFz4SSx2FNi4oop+jFTKCa80Glt4Ly3vNQ2Vc59gEqV0KXS4gOTyp1z 7DmiXsAaDit/goNpaCPQw4t41JcGPR1J3GE7Gus6VVLM9tXdzo+fzHMUD/NuzsyCEfTo /g9/dvUCxnvFZFF1zIwkIquRSG+O1Ms8cWRjR8sj7MuQfctkOaJwRCfcaN3jpCrM7StV CY9NWqZeuJxhXkIApNeIfO2AacmPPXmJtTpzPqP553v1hgQwuNP4EW9RitGN+mRpzIkZ MPsw== X-Gm-Message-State: AMke39l2Kl+CBAGiCGHMji6ZddITdMHcHS8iDhMxhLa5WREImLoshE3OC4dP5nf2eAkrQA== X-Received: by 10.46.20.66 with SMTP id 2mr7271244lju.87.1487693786569; Tue, 21 Feb 2017 08:16:26 -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.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Feb 2017 08:16:26 -0800 (PST) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [RFC v4 15/21] ath10k: per target configurablity of various items Date: Tue, 21 Feb 2017 17:15:35 +0100 Message-Id: <1487693741-10042-16-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_111649_484697_4277A49A X-CRM114-Status: GOOD ( 18.98 ) 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 Added ability to set bus type and configure the max number of peers in the ath10k_hw_params struct. With this functionality it is possible to have a different hw configuration depending on bus type for the same radio chipset. E.g. SDIO and USB devices using the same chipset as PCIe devices will potentially use different board files and perhaps other configuration parameters. One such parameter is the max number of peers. Instead of using a default value (suitable for PCIe devices) derived from the WMI op version, a per target value can be used instead. This is needed by the QCA9377 USB device in order to prevent the target fw to crash after HTT RX ring cfg is issued. Apparently, the QCA9377 HL device does not seem to handle the same amount of peers as the LL devices. Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/core.c | 33 +++++++++++++++++++++++-------- drivers/net/wireless/ath/ath10k/core.h | 7 ------- drivers/net/wireless/ath/ath10k/hw.h | 22 +++++++++++++++++++++ drivers/net/wireless/ath/ath10k/wmi-tlv.c | 4 ++-- 4 files changed, 49 insertions(+), 17 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 9d60f4b..6b667c7 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -1592,9 +1592,19 @@ static int ath10k_init_hw_params(struct ath10k *ar) for (i = 0; i < ARRAY_SIZE(ath10k_hw_params_list); i++) { hw_params = &ath10k_hw_params_list[i]; - if (hw_params->id == ar->target_version && - hw_params->dev_id == ar->dev_id) - break; + if (ar->is_high_latency) { + /* High latency devices will use different fw depending + * on if it is a USB or SDIO device. + */ + if (hw_params->bus == ar->hif.bus && + hw_params->id == ar->target_version && + hw_params->dev_id == ar->dev_id) + break; + } else { + if (hw_params->id == ar->target_version && + hw_params->dev_id == ar->dev_id) + break; + } } if (i == ARRAY_SIZE(ath10k_hw_params_list)) { @@ -1685,6 +1695,7 @@ static void ath10k_core_set_coverage_class_work(struct work_struct *work) static int ath10k_core_init_firmware_features(struct ath10k *ar) { struct ath10k_fw_file *fw_file = &ar->normal_mode_fw.fw_file; + int max_num_peers; if (test_bit(ATH10K_FW_FEATURE_WMI_10_2, fw_file->fw_features) && !test_bit(ATH10K_FW_FEATURE_WMI_10X, fw_file->fw_features)) { @@ -1764,7 +1775,7 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar) switch (fw_file->wmi_op_version) { case ATH10K_FW_WMI_OP_VERSION_MAIN: - ar->max_num_peers = TARGET_NUM_PEERS; + max_num_peers = TARGET_NUM_PEERS; ar->max_num_stations = TARGET_NUM_STATIONS; ar->max_num_vdevs = TARGET_NUM_VDEVS; ar->htt.max_num_pending_tx = TARGET_NUM_MSDU_DESC; @@ -1776,10 +1787,10 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar) case ATH10K_FW_WMI_OP_VERSION_10_2: case ATH10K_FW_WMI_OP_VERSION_10_2_4: if (ath10k_peer_stats_enabled(ar)) { - ar->max_num_peers = TARGET_10X_TX_STATS_NUM_PEERS; + max_num_peers = TARGET_10X_TX_STATS_NUM_PEERS; ar->max_num_stations = TARGET_10X_TX_STATS_NUM_STATIONS; } else { - ar->max_num_peers = TARGET_10X_NUM_PEERS; + max_num_peers = TARGET_10X_NUM_PEERS; ar->max_num_stations = TARGET_10X_NUM_STATIONS; } ar->max_num_vdevs = TARGET_10X_NUM_VDEVS; @@ -1788,7 +1799,7 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar) ar->max_spatial_stream = WMI_MAX_SPATIAL_STREAM; break; case ATH10K_FW_WMI_OP_VERSION_TLV: - ar->max_num_peers = TARGET_TLV_NUM_PEERS; + max_num_peers = TARGET_TLV_NUM_PEERS; ar->max_num_stations = TARGET_TLV_NUM_STATIONS; ar->max_num_vdevs = TARGET_TLV_NUM_VDEVS; ar->max_num_tdls_vdevs = TARGET_TLV_NUM_TDLS_VDEVS; @@ -1799,7 +1810,7 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar) ar->max_spatial_stream = WMI_MAX_SPATIAL_STREAM; break; case ATH10K_FW_WMI_OP_VERSION_10_4: - ar->max_num_peers = TARGET_10_4_NUM_PEERS; + max_num_peers = TARGET_10_4_NUM_PEERS; ar->max_num_stations = TARGET_10_4_NUM_STATIONS; ar->num_active_peers = TARGET_10_4_ACTIVE_PEERS; ar->max_num_vdevs = TARGET_10_4_NUM_VDEVS; @@ -1816,10 +1827,16 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar) break; case ATH10K_FW_WMI_OP_VERSION_UNSET: case ATH10K_FW_WMI_OP_VERSION_MAX: + default: WARN_ON(1); return -EINVAL; } + if (ar->hw_params.max_num_peers) + ar->max_num_peers = ar->hw_params.max_num_peers; + else + ar->max_num_peers = max_num_peers; + /* Backwards compatibility for firmwares without * ATH10K_FW_IE_HTT_OP_VERSION. */ diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 0c970fe..e3cdaba 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -88,13 +88,6 @@ struct ath10k; -enum ath10k_bus { - ATH10K_BUS_PCI, - ATH10K_BUS_AHB, - ATH10K_BUS_SDIO, - ATH10K_BUS_USB, -}; - static inline const char *ath10k_bus_str(enum ath10k_bus bus) { switch (bus) { diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h index 4055144..bc4fd43 100644 --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h @@ -20,6 +20,13 @@ #include "targaddrs.h" +enum ath10k_bus { + ATH10K_BUS_PCI, + ATH10K_BUS_AHB, + ATH10K_BUS_SDIO, + ATH10K_BUS_USB, +}; + #define ATH10K_FW_DIR "ath10k" #define QCA988X_2_0_DEVICE_ID (0x003c) @@ -447,6 +454,18 @@ struct ath10k_hw_params { /* hw specific clock control parameters */ const struct ath10k_hw_clk_params *hw_clk; int target_cpu_freq; + + /* max_num_peers can be used to override the setting derived from + * the WMI op version. If this value is non-zero, it will always + * be used instead of the default value derived from the WMI op + * version. + */ + int max_num_peers; + + /* Specifies whether or not the device is a high latency device */ + bool is_high_latency; + + enum ath10k_bus bus; }; struct htt_rx_desc; @@ -557,6 +576,9 @@ ath10k_rx_desc_get_l3_pad_bytes(struct ath10k_hw_params *hw, #define TARGET_TLV_NUM_MSDU_DESC (1024 + 32) #define TARGET_TLV_NUM_WOW_PATTERNS 22 +/* Target specific defines for QCA9377 high latency firmware */ +#define TARGET_QCA9377_HL_NUM_PEERS 15 + /* Diagnostic Window */ #define CE_DIAG_PIPE 7 diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c index f918802..754d445 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c @@ -1406,7 +1406,7 @@ static struct sk_buff *ath10k_wmi_tlv_op_gen_init(struct ath10k *ar) cmd->num_host_mem_chunks = __cpu_to_le32(ar->wmi.num_mem_chunks); cfg->num_vdevs = __cpu_to_le32(TARGET_TLV_NUM_VDEVS); - cfg->num_peers = __cpu_to_le32(TARGET_TLV_NUM_PEERS); + cfg->num_peers = __cpu_to_le32(ar->max_num_peers); if (test_bit(WMI_SERVICE_RX_FULL_REORDER, ar->wmi.svc_map)) { cfg->num_offload_peers = __cpu_to_le32(TARGET_TLV_NUM_VDEVS); @@ -1417,7 +1417,7 @@ static struct sk_buff *ath10k_wmi_tlv_op_gen_init(struct ath10k *ar) } cfg->num_peer_keys = __cpu_to_le32(2); - cfg->num_tids = __cpu_to_le32(TARGET_TLV_NUM_TIDS); + cfg->num_tids = __cpu_to_le32(ar->max_num_peers * 2); cfg->ast_skid_limit = __cpu_to_le32(0x10); cfg->tx_chain_mask = __cpu_to_le32(0x7); cfg->rx_chain_mask = __cpu_to_le32(0x7);