From patchwork Fri Mar 20 13:54:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 6056831 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1E3F9BF90F for ; Fri, 20 Mar 2015 13:57:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2503320522 for ; Fri, 20 Mar 2015 13:57:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3360920523 for ; Fri, 20 Mar 2015 13:57:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752390AbbCTN47 (ORCPT ); Fri, 20 Mar 2015 09:56:59 -0400 Received: from mail-lb0-f172.google.com ([209.85.217.172]:34138 "EHLO mail-lb0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752252AbbCTN44 (ORCPT ); Fri, 20 Mar 2015 09:56:56 -0400 Received: by lbbsy1 with SMTP id sy1so75918703lbb.1 for ; Fri, 20 Mar 2015 06:56:55 -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=0IbEpnk40qfcFD6ENE49Xb/4I9MGeI6enFblh4eAehw=; b=Kkb5NB19eoQiewqcHtcmLD91HdHjMOk0r8FrivHtd/5KTvDbxzYK3MnMf+rcJllfsL IyVVIdj6YXRadsTZ4IcXrWlPT7VqunxROfsq3iAOjkb1u0qkwDDylMQTVEFDlRapTTWp UD6K5L3JS878d7cIlaQ9q69Ia7/IP1Pbc43QI= 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=0IbEpnk40qfcFD6ENE49Xb/4I9MGeI6enFblh4eAehw=; b=OEuwRwv4oO9b2XM86c7yCLQRd4kD6LKpPu51G/sOZLklfEXMSCC0AKtQTUom5V0+N8 skHYKIz2uxqKTUtNeHyHPzzMpquuOod2YYslWpICWPX+XZwUFIjzWZxpEezQUh0id0mH tH9OrKCnOzw78fuvj5RUaHHclCSiTrkZZNvwjHFtwcEoX/qwI7BFiuBgAjH48dthMjtL tBwU9c+1ky+ddQvSSnMOZujeVISMMsFo0i06VVh6o0VDf170XGVsYiKT6qPp/s2ZVFdE rhE1LJLDFZvFHmI4yv1UpEpjQFKDSahg6TGK1Q2DsjugIDY3I2vjSikLX1HgrIyVPV5m dMgg== X-Gm-Message-State: ALoCoQmiAa1q8jZeucPF1Tsnb4b7JVxzqyeC0/YP6SbYOLGwxkxcaKEoYN8ZdnQ0l4oi/sx7ZTVTVu3BOm2LSRV93LvlwC1JWtV1WHY6Krlo5lUv2DBWH1vIHDJFhb+8GYEHBL4GOPv1 X-Received: by 10.152.22.229 with SMTP id h5mr73448388laf.21.1426859814911; Fri, 20 Mar 2015 06:56:54 -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.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Mar 2015 06:56:54 -0700 (PDT) From: Michal Kazior To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Michal Kazior Subject: [PATCH 6/9] ath10k: simplify fixed rate selection Date: Fri, 20 Mar 2015 13:54:12 +0000 Message-Id: <1426859655-11797-7-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 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham 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 Use the existing ieee80211_rate array instead of definining separate one. This gets rid of the ugly 4-index offset when dealing with 5GHz band. Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/mac.c | 56 +++++++++++------------------------ 1 file changed, 17 insertions(+), 39 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 72fbdc2..877afde 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -35,21 +35,19 @@ /*********/ static struct ieee80211_rate ath10k_rates[] = { - /* CCK */ - { .bitrate = 10 }, - { .bitrate = 20 }, - { .bitrate = 55 }, - { .bitrate = 110 }, - - /* OFDM */ - { .bitrate = 60 }, - { .bitrate = 90 }, - { .bitrate = 120 }, - { .bitrate = 180 }, - { .bitrate = 240 }, - { .bitrate = 360 }, - { .bitrate = 480 }, - { .bitrate = 540 }, + { .bitrate = 10, .hw_value = ATH10K_HW_RATE_CCK_LP_1M }, + { .bitrate = 20, .hw_value = ATH10K_HW_RATE_CCK_LP_2M }, + { .bitrate = 55, .hw_value = ATH10K_HW_RATE_CCK_LP_5_5M }, + { .bitrate = 110, .hw_value = ATH10K_HW_RATE_CCK_LP_11M }, + + { .bitrate = 60, .hw_value = ATH10K_HW_RATE_OFDM_6M }, + { .bitrate = 90, .hw_value = ATH10K_HW_RATE_OFDM_9M }, + { .bitrate = 120, .hw_value = ATH10K_HW_RATE_OFDM_12M }, + { .bitrate = 180, .hw_value = ATH10K_HW_RATE_OFDM_18M }, + { .bitrate = 240, .hw_value = ATH10K_HW_RATE_OFDM_24M }, + { .bitrate = 360, .hw_value = ATH10K_HW_RATE_OFDM_36M }, + { .bitrate = 480, .hw_value = ATH10K_HW_RATE_OFDM_48M }, + { .bitrate = 540, .hw_value = ATH10K_HW_RATE_OFDM_54M }, }; #define ath10k_a_rates (ath10k_rates + 4) @@ -4970,22 +4968,6 @@ exit: return ret; } -/* Helper table for legacy fixed_rate/bitrate_mask */ -static const u8 cck_ofdm_rate[] = { - ATH10K_HW_RATE_CCK_LP_1M, - ATH10K_HW_RATE_CCK_LP_2M, - ATH10K_HW_RATE_CCK_LP_5_5M, - ATH10K_HW_RATE_CCK_LP_11M, - ATH10K_HW_RATE_OFDM_6M, - ATH10K_HW_RATE_OFDM_9M, - ATH10K_HW_RATE_OFDM_12M, - ATH10K_HW_RATE_OFDM_18M, - ATH10K_HW_RATE_OFDM_24M, - ATH10K_HW_RATE_OFDM_36M, - ATH10K_HW_RATE_OFDM_48M, - ATH10K_HW_RATE_OFDM_54M, -}; - /* Check if only one bit set */ static int ath10k_check_single_mask(u32 mask) { @@ -5133,6 +5115,7 @@ ath10k_bitrate_mask_rate(struct ath10k *ar, u8 *fixed_rate, u8 *fixed_nss) { + struct ieee80211_supported_band *sband; u8 rate = 0, pream = 0, nss = 0, i; enum wmi_rate_preamble preamble; @@ -5146,17 +5129,12 @@ ath10k_bitrate_mask_rate(struct ath10k *ar, case WMI_RATE_PREAMBLE_CCK: case WMI_RATE_PREAMBLE_OFDM: i = ffs(mask->control[band].legacy) - 1; + sband = &ar->mac.sbands[band]; - if (band == IEEE80211_BAND_2GHZ && i < 4) - pream = WMI_RATE_PREAMBLE_CCK; - - if (band == IEEE80211_BAND_5GHZ) - i += 4; - - if (i >= ARRAY_SIZE(cck_ofdm_rate)) + if (WARN_ON(i >= sband->n_bitrates)) return false; - rate = cck_ofdm_rate[i]; + rate = sband->bitrates[i].hw_value; break; case WMI_RATE_PREAMBLE_HT: for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++)