From patchwork Fri Mar 20 13:54:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 6056901 Return-Path: X-Original-To: patchwork-ath10k@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A86DB9F318 for ; Fri, 20 Mar 2015 13:57:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D24DF20523 for ; Fri, 20 Mar 2015 13:57:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0AEDD20522 for ; Fri, 20 Mar 2015 13:57:23 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YYxQN-0006lj-Df; Fri, 20 Mar 2015 13:57:19 +0000 Received: from mail-la0-x22e.google.com ([2a00:1450:4010:c03::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YYxQG-0006by-GA for ath10k@lists.infradead.org; Fri, 20 Mar 2015 13:57:13 +0000 Received: by labe2 with SMTP id e2so12273628lab.3 for ; Fri, 20 Mar 2015 06:56:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yDJ3v3NggUKW2SwzGIVifd11Z3pyPD5XdBPzfTF6spg=; b=D4rs9QmfFdhFY9Kb4mYnm2jNkkljPkqFAnSxjK58NRlogdeognsLfH8Ifl7RrPyesB P9pn/8ViPuSqaUXGBq6dmxDzOwLpuGcJGv2bbhJU+sIBcGklVZwpwU/9SeKeB5gUbSxR mBAiL8XrwFsIi0M/6E7VxlwtP7gM9vqt+uWpM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yDJ3v3NggUKW2SwzGIVifd11Z3pyPD5XdBPzfTF6spg=; b=hR3CPPnRjShZ6rI08/vFdYHIkr4/R9Y3Sq9PqUiJoD+w3loS3FDstnL3dTtQxnILWu OsJJUGYlL1+UEMyXO/PPkAvhKhZMIT6U+QvfOgEJPo2ICzlGFuf10/ObXcwdZVPRxx7g wrW+i8X2vU8Bb6fNKDBK92UiT0LjQ1+4QmK6EB5ZjDelmjvPzeY+QKsMqUuNYvaa59Z7 /K1RTDONxMCij3t97PaSy40sRuamXcKTbpKUDRT2w6OdM+UiNVfyAhNzNBt0fofDVf1B Z4sCMjxzOuTZ6nFwBXl5iaY/HaaoZubRNpGXa2ILg/cDXeEMx5KXV1fNAIc7UurltIBk UXMg== X-Gm-Message-State: ALoCoQmj/wKBnLu53U06MbRnBONCfhntf0ykv1YwYQKQLNGp9UEwcm6zFDeAMLiwabf9cJMyJWPe1eVZXWafVOkXQ0NtdJAmIabEpsd3DQArFBTaYWpnMVqxfzOI9mMt3L6axDnDuP1Ks28TGmieMNwueUqW6cwUxJgvmmc1WyYS8RXxE7mPo4o= X-Received: by 10.152.26.136 with SMTP id l8mr73629119lag.109.1426859810102; Fri, 20 Mar 2015 06:56:50 -0700 (PDT) Received: from bob.homerouter.cpe (apn-77-113-71-242.dynamic.gprs.plus.pl. [77.113.71.242]) by mx.google.com with ESMTPSA id us1sm955771lbc.1.2015.03.20.06.56.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Mar 2015 06:56:48 -0700 (PDT) From: Michal Kazior To: ath10k@lists.infradead.org Subject: [PATCH 2/9] ath10k: derive rate from bitrate Date: Fri, 20 Mar 2015 13:54:08 +0000 Message-Id: <1426859655-11797-3-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1426859655-11797-1-git-send-email-michal.kazior@tieto.com> References: <1426859655-11797-1-git-send-email-michal.kazior@tieto.com> X-DomainID: tieto.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150320_065712_737851_928BB700 X-CRM114-Status: UNSURE ( 9.86 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.8 (/) Cc: linux-wireless@vger.kernel.org, Michal Kazior X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There's no need to store rate values in hw_value. This frees up the hw_value for better future use. Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/mac.c | 47 +++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 456d671..5721196 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -42,19 +42,19 @@ static struct ieee80211_rate ath10k_rates[] = { /* CCK */ - RATETAB_ENT(10, 0x82, 0), - RATETAB_ENT(20, 0x84, 0), - RATETAB_ENT(55, 0x8b, 0), - RATETAB_ENT(110, 0x96, 0), + RATETAB_ENT(10, 0, 0), + RATETAB_ENT(20, 0, 0), + RATETAB_ENT(55, 0, 0), + RATETAB_ENT(110, 0, 0), /* OFDM */ - RATETAB_ENT(60, 0x0c, 0), - RATETAB_ENT(90, 0x12, 0), - RATETAB_ENT(120, 0x18, 0), - RATETAB_ENT(180, 0x24, 0), - RATETAB_ENT(240, 0x30, 0), - RATETAB_ENT(360, 0x48, 0), - RATETAB_ENT(480, 0x60, 0), - RATETAB_ENT(540, 0x6c, 0), + RATETAB_ENT(60, 0, 0), + RATETAB_ENT(90, 0, 0), + RATETAB_ENT(120, 0, 0), + RATETAB_ENT(180, 0, 0), + RATETAB_ENT(240, 0, 0), + RATETAB_ENT(360, 0, 0), + RATETAB_ENT(480, 0, 0), + RATETAB_ENT(540, 0, 0), }; #define ath10k_a_rates (ath10k_rates + 4) @@ -62,6 +62,25 @@ static struct ieee80211_rate ath10k_rates[] = { #define ath10k_g_rates (ath10k_rates + 0) #define ath10k_g_rates_size (ARRAY_SIZE(ath10k_rates)) +static bool ath10k_mac_bitrate_is_cck(int bitrate) +{ + switch (bitrate) { + case 10: + case 20: + case 55: + case 110: + return true; + } + + return false; +} + +static u8 ath10k_mac_bitrate_to_rate(int bitrate) +{ + return DIV_ROUND_UP(bitrate, 5) | + (ath10k_mac_bitrate_is_cck(bitrate) ? BIT(7) : 0); +} + /**********/ /* Crypto */ /**********/ @@ -1699,6 +1718,7 @@ static void ath10k_peer_assoc_h_rates(struct ath10k *ar, const struct ieee80211_supported_band *sband; const struct ieee80211_rate *rates; u32 ratemask; + u8 rate; int i; lockdep_assert_held(&ar->conf_mutex); @@ -1713,7 +1733,8 @@ static void ath10k_peer_assoc_h_rates(struct ath10k *ar, if (!(ratemask & 1)) continue; - rateset->rates[rateset->num_rates] = rates->hw_value; + rate = ath10k_mac_bitrate_to_rate(rates->bitrate); + rateset->rates[rateset->num_rates] = rate; rateset->num_rates++; } }