From patchwork Sun Jun 3 18:20:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 10445523 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 F1C91601BC for ; Sun, 3 Jun 2018 18:22:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0F8928A4D for ; Sun, 3 Jun 2018 18:22:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5A0C28B1C; Sun, 3 Jun 2018 18:22:32 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, 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 7572D28A4D for ; Sun, 3 Jun 2018 18:22:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751309AbeFCSWS (ORCPT ); Sun, 3 Jun 2018 14:22:18 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:43448 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750991AbeFCSWO (ORCPT ); Sun, 3 Jun 2018 14:22:14 -0400 Received: by mail-lf0-f65.google.com with SMTP id n15-v6so4484062lfn.10 for ; Sun, 03 Jun 2018 11:22:13 -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=H5gtQik0Wu2Fep3uAm+gryfoCIpvK2TvqNY8IE35w6w=; b=SAmQRgWzj/8cqqV3n2YTnrttkZ9T4uYPcSCjCY0bUvW7KUpMxEi6tzkZDupjrxFuOg qh0oiHB+f+S2ysGdOa12NrmBEJPfIXNZlz4b7c3JgYePpSBYk3jGe5a7VmsQOlnO3k4L rSj7iYmFijn6D71e0QXEafyV6n9inl2PI8jajFrBW58SKn20WIluzMM8ceDs0NGvu2dN 4CUnkRqYSLKX9MQdDHKP2lBaqg0kDIvD/8h3/0BWMDwaGQjYimqhikVSLks2INZTjf7L unFazOnPj+MCW4JlM6xLiCYgs97B+Mil3MhcmOzB9dp7kSSrfsqOFM6IUeVSg8i3A5vz LKaw== 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=H5gtQik0Wu2Fep3uAm+gryfoCIpvK2TvqNY8IE35w6w=; b=bZH1N9VZq9zM2b7PQwsiGZgEbNbNIIyYsAawzzFv6cxaA7uuDwmMbXrOW5RyfY+/yG cjZjD0pOM0hVVkbQB+GBn1YiI52JHiIYfzrLPsG7MrWbdSf93vzogCx76MYHbkgdCiyd oCPlxqPasQKDRTEjZsoxswLi9LtKbeocqhKMF7UXBsxJ07/zuMAqIO8hYiB2faiFHbA3 F3YGdJ3fHgqsocp2QmITObfSDdhoAEOFADFp67K3fJ7/jRBNgTNP0gxYHlutc6sIUoy/ JrnvkIG6c0VNZaq/oGxO/lYcp4LXAuwM6gPiVZHg1ByYvG+2XR35NRBU0aqf64V2xlWn 20+A== X-Gm-Message-State: APt69E0Hot33Dk9rBF4ueyIiAe4bQLHcSpBgokcRrNeIKKGOAXLLOHMN +bVUeIdDr18uEwy9/m1yvn2ynw== X-Google-Smtp-Source: ADUXVKJ2A4PB2APmycLcSCQJFh4tojFuqQKuCGHFSQJTQ3/Weqg8U2qr6joWLEGyZVN0/5+Ezk9SFg== X-Received: by 2002:a2e:944d:: with SMTP id o13-v6mr1720255ljh.65.1528050133048; Sun, 03 Jun 2018 11:22:13 -0700 (PDT) Received: from localhost.localdomain (90-227-62-61-no75.tbcn.telia.com. [90.227.62.61]) by smtp.gmail.com with ESMTPSA id l200-v6sm4980562lfe.77.2018.06.03.11.22.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Jun 2018 11:22:12 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Cc: Erik Stromdahl Subject: [RFC v5 05/12] ath10k: add per target config of max_num_peers Date: Sun, 3 Jun 2018 20:20:22 +0200 Message-Id: <20180603182029.8914-6-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180603182029.8914-1-erik.stromdahl@gmail.com> References: <20180603182029.8914-1-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 This patch makes sure the value of max_num_peers matches num_peers in hw_params (if set to a non zero value). hw_params->num_peers is used in the TLV WMI init command. If ar->max_num_peers is not set to the same value, there is a risk that the user creates more peers than the maximum number of peers supported by the device. Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/core.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index a146c83d6ff9..8244e9184760 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -1986,6 +1986,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)) { @@ -2065,7 +2066,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; @@ -2077,10 +2078,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; @@ -2089,7 +2090,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; @@ -2100,7 +2101,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; @@ -2119,10 +2120,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.num_peers) + ar->max_num_peers = ar->hw_params.num_peers; + else + ar->max_num_peers = max_num_peers; + /* Backwards compatibility for firmwares without * ATH10K_FW_IE_HTT_OP_VERSION. */