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: 10445549 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 5A727601BC for ; Sun, 3 Jun 2018 18:24:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4727E2886D for ; Sun, 3 Jun 2018 18:24:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37BBB28A4D; Sun, 3 Jun 2018 18:24:11 +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=-2.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 9249F286B3 for ; Sun, 3 Jun 2018 18:24:10 +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=ugEgWLfgWDk0NOIFRyt5plZAuFbdDPhVrPTiMLzW+Xk=; b=lN5s7gDeirWThoBA1VPsF6JXFD M4/idM82ZfoL38JXU3l9CB8UqZI0n2yraKWqOpN7NXZfUwuxlz7HDy/2eSX/bnkT3sRwaMKDJMm3V QlZFRTUykzsh+vgPfgmpivWMU5R775HMUpXf97Dlpbt3LcGryWW8F8+OqgTzK+u2NIFxSNse7Ojfj 7euwipHVsV+LtGsUTBTBiQNF2nyGoxC098Vuw2rmFvzo6+TY+lJTVLwj12zv2dE6QE27YTwRIKysf gbQrilxiHZ+qvRkzKeteeZs/u/jmCt9VoMQ093eVYNUd9NTRXR5kVZfms+vs3T3oHvYGN7sQ+P8BC vpwSIeAQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fPXff-0007Tk-KU; Sun, 03 Jun 2018 18:24:03 +0000 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fPXe5-0006VX-0M for ath10k@lists.infradead.org; Sun, 03 Jun 2018 18:22:43 +0000 Received: by mail-lf0-x244.google.com with SMTP id j13-v6so17336471lfb.13 for ; Sun, 03 Jun 2018 11:22:14 -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=Uw+p+34BkUHPvIvjthJqwnUkFtfY059nVd66i9ELSduRAXAnl8OHC7NcTMSSx7OwBD 6WRmFfeyTRECdvUR9VaKIQOH17ale9M+wNRICFh1aI0CZt0kJc1l5GLzzNcDYF69k4hQ 84IxcYak5NFJRsPOJgnxJ0ULSxbKXVgkuPTfsEAvMEllE7Se0hnbpUTLxl6Rs6Woeslo Uze4Pw4FqszdwNVlN4oYgwJiUaXhOI+298zM6TeCreLgPqCJdGk+rah6/NlTjAjlUxq6 V/BdHlADbyr6HiPaGTpT6dpyJhc4dg/cz54V72sxG4dTGcNnfJIVuSv+WkvvFiPw8Vxl DNKQ== X-Gm-Message-State: APt69E3ARxUkE3+dgvOFErJOfeGOp2DC/sQV9c9gBmv4dSq/glOgEWlI NWhKL0fJCrj1qzqXpnNJymc= 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180603_112225_069573_1AE74E74 X-CRM114-Status: GOOD ( 13.10 ) 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 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. */