From patchwork Mon Sep 10 05:39:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriram R X-Patchwork-Id: 10593573 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 69B39112B for ; Mon, 10 Sep 2018 05:40:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 568E228E78 for ; Mon, 10 Sep 2018 05:40:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46BA728E7A; Mon, 10 Sep 2018 05:40: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_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 DBD0528E78 for ; Mon, 10 Sep 2018 05:40: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: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:In-Reply-To: References:List-Owner; bh=lduasWUiqmPADvtroclxgpqMeTWp/1RI3ahD4BlmXuo=; b=NoR hU/ZmMY3xguXUc6Ooid2jZcf1CaFhHJQKnyPQnaLN6q65LgI2bh7cmU/MnMqVozGSlr8os0qkDVih YJZ3SYJEBRYlROR3zs2ajXNC1RG0pZCoU76w/Q7+1hVvH0IzTh4ElDpg3DxOkaTXl5htSF1yiqK6e JDQsTjnxQKEPDDsd/V1LtIj++TCS++StSZZ4EOZf56lnMoZOM4QYT73e1fWvCrDJnPfzK6Cbc22Y8 1iiRiGrEZUlZrizUeURHEzd+c8+0Yu0yRhIqJmqbKVWPt9W0eaQ5HqwDN0mj9drhDlVree47g+EX/ dScJtwei/lXMQEhcuODF5fL+wSzDUSg==; 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 1fzEvd-0006Tf-Hl; Mon, 10 Sep 2018 05:40:05 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzEvZ-000642-Bd for ath10k@lists.infradead.org; Mon, 10 Sep 2018 05:40:03 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C7CC8607DD; Mon, 10 Sep 2018 05:39:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1536557988; bh=LKv3aGk53SBUE2nSSaSP4cQDeMObeUDKii5JlkIQJgo=; h=From:To:Cc:Subject:Date:From; b=Ze1f8Px23xnd8Bey/BEs4j82guYXmhLMhnm8P4OhsV5vaPgOj+Jpd2WYk05SCRs+B ODGQfP+FGx21fRD8spyEeDFwy37OB5HYETiXmO2PRBVcEVfJCh5G/1e1boM69yoEe4 8VpkIovnGFpl9Uo/7uK0niagmSPDee8orWFImpng= Received: from checstp253621-lin.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: srirrama@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id DAB2E601B4; Mon, 10 Sep 2018 05:39:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1536557988; bh=LKv3aGk53SBUE2nSSaSP4cQDeMObeUDKii5JlkIQJgo=; h=From:To:Cc:Subject:Date:From; b=Ze1f8Px23xnd8Bey/BEs4j82guYXmhLMhnm8P4OhsV5vaPgOj+Jpd2WYk05SCRs+B ODGQfP+FGx21fRD8spyEeDFwy37OB5HYETiXmO2PRBVcEVfJCh5G/1e1boM69yoEe4 8VpkIovnGFpl9Uo/7uK0niagmSPDee8orWFImpng= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org DAB2E601B4 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=srirrama@codeaurora.org From: Sriram R To: ath10k@lists.infradead.org Subject: [PATCH] ath10k: Add support for configuring management packet rate Date: Mon, 10 Sep 2018 11:09:40 +0530 Message-Id: <1536557980-11895-1-git-send-email-srirrama@codeaurora.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180909_224001_510461_94532910 X-CRM114-Status: GOOD ( 12.79 ) 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: linux-wireless@vger.kernel.org, Sriram R MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP By default the firmware uses 1Mbps and 6Mbps rate for management packets in 2G and 5G bands respectively. But when the user selects different basic rates from the userspace, we need to send the management packets at the lowest basic rate selected by the user. This change makes use of WMI_VDEV_PARAM_MGMT_RATE param for configuring the management packets rate to the firmware. Chipsets Tested : QCA988X, QCA9887, QCA9984 FW Tested : 10.2.4-1.0-41, 10.4-3.6.104 Signed-off-by: Sriram R --- drivers/net/wireless/ath/ath10k/mac.c | 45 +++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 496772d..0b2ca9e 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -157,6 +157,22 @@ u8 ath10k_mac_bitrate_to_idx(const struct ieee80211_supported_band *sband, return 0; } +static int ath10k_mac_get_rate_hw_value(int bitrate) +{ + int i; + u8 hw_value_prefix = 0; + + if (ath10k_mac_bitrate_is_cck(bitrate)) + hw_value_prefix = WMI_RATE_PREAMBLE_CCK << 6; + + for (i = 0; i < sizeof(ath10k_rates); i++) { + if (ath10k_rates[i].bitrate == bitrate) + return hw_value_prefix | ath10k_rates[i].hw_value; + } + + return -EINVAL; +} + static int ath10k_mac_get_max_vht_mcs_map(u16 mcs_map, int nss) { switch ((mcs_map >> (2 * nss)) & 0x3) { @@ -5452,9 +5468,10 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw, struct cfg80211_chan_def def; u32 vdev_param, pdev_param, slottime, preamble; u16 bitrate, hw_value; - u8 rate; - int rateidx, ret = 0; + u8 rate, basic_rate_idx; + int rateidx, ret = 0, hw_rate_code; enum nl80211_band band; + const struct ieee80211_supported_band *sband; mutex_lock(&ar->conf_mutex); @@ -5660,6 +5677,30 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw, arvif->vdev_id, ret); } + if (changed & BSS_CHANGED_BASIC_RATES) { + if (WARN_ON(ath10k_mac_vif_chan(vif, &def))) { + mutex_unlock(&ar->conf_mutex); + return; + } + + sband = ar->hw->wiphy->bands[def.chan->band]; + basic_rate_idx = ffs(vif->bss_conf.basic_rates) - 1; + bitrate = sband->bitrates[basic_rate_idx].bitrate; + + hw_rate_code = ath10k_mac_get_rate_hw_value(bitrate); + if (hw_rate_code < 0) { + ath10k_warn(ar, "bitrate not supported %d\n", bitrate); + mutex_unlock(&ar->conf_mutex); + return; + } + + vdev_param = ar->wmi.vdev_param->mgmt_rate; + ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, + hw_rate_code); + if (ret) + ath10k_warn(ar, "failed to set mgmt tx rate %d\n", ret); + } + mutex_unlock(&ar->conf_mutex); }