From patchwork Fri Mar 20 13:54:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 6056971 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 B21899F318 for ; Fri, 20 Mar 2015 13:57:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DEBAC201BC for ; Fri, 20 Mar 2015 13:57:36 +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 1955D20520 for ; Fri, 20 Mar 2015 13:57:36 +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 1YYxQa-0006t8-AN; Fri, 20 Mar 2015 13:57:32 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YYxQW-0006qC-EX for ath10k@bombadil.infradead.org; Fri, 20 Mar 2015 13:57:28 +0000 Received: from mail-lb0-x234.google.com ([2a00:1450:4010:c04::234]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YYxQT-0000W6-KP for ath10k@lists.infradead.org; Fri, 20 Mar 2015 13:57:27 +0000 Received: by lbbrr9 with SMTP id rr9so11376220lbb.0 for ; Fri, 20 Mar 2015 06:56:58 -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=62JD/qVakPaeM8llq6s48UUWQ/m0PWwgdtJxI7jMs44=; b=RNZzzlNdjkGAnJzvptjU/B/nn6nI9KZLlHA2Tm29pi3LMbdL6CPPEo7dyDbjiOG/g9 LmwJGAJUu/lFEpoT4hKzrwTveA+OEv2+fAbWloEDlQ+EgIYlV37xMUDCCfGZlKhGisSW nfCTW44srDrMTZJm0Uhne1LQs4nn/8XaUPQ/4= 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=62JD/qVakPaeM8llq6s48UUWQ/m0PWwgdtJxI7jMs44=; b=HZUFUnlnjB05ayxySDmOcMNvyd9I/CoodXVbXf+SqvfxKMC3+9nBE5lhrnhmGaNJOO ++g3oscfKBv0oF34dVeyejuN1Qm+Av0ebxNBtW7OEtNw1QI8TNQNWoRc3yxZ+zMguYkt Z0kXb5U766mn8H9J4CEcTODOhmbKk23ixRDqY+4ONclam41i1SDavolkQnWyKSsfafKa C6fkkk9Nm+ebmpYIpN7GrPXhI3ltUBss9qKKhiEzjDJVLfQHUEsTASsXuBQqw4RYIhs3 QacMIhqUBoBmQzU69O8SMCxFzfhnvAbIvS71Go9/km5QOfrGUGQgIksKsU8SoP+F8trr dn8Q== X-Gm-Message-State: ALoCoQnAiW+54pfQ2/0fehVi329belFcqOnIwkh75TihawZN7DH6extapjPKXc2jOlCtDTKoSpd8lw7vl7NLsf8LTBOlz7wAIOuqgO2aCDi3cQRiwH1cbQPfC+CVoYVci+JBHUWwpSaahppbqpNgtBpTov7nCezplOPsvL5ZOZS54xTz5zATNcc= X-Received: by 10.152.87.66 with SMTP id v2mr11996117laz.62.1426859818321; Fri, 20 Mar 2015 06:56:58 -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.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Mar 2015 06:56:57 -0700 (PDT) From: Michal Kazior To: ath10k@lists.infradead.org Subject: [PATCH 9/9] ath10k: document ofdm/5ghz rate offset with a macro Date: Fri, 20 Mar 2015 13:54:15 +0000 Message-Id: <1426859655-11797-10-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_095725_978952_B53C6998 X-CRM114-Status: GOOD ( 10.19 ) X-Spam-Score: -2.7 (--) 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 Don't use literal values for offsets. While at it rename a function so it is more clear what it checks for. This finally takes care of the last magic 5GHz/OFDM offset. Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/mac.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index c39a300..bdd9baa 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -60,8 +60,11 @@ static struct ieee80211_rate ath10k_rates[] = { { .bitrate = 540, .hw_value = ATH10K_HW_RATE_OFDM_54M }, }; -#define ath10k_a_rates (ath10k_rates + 4) -#define ath10k_a_rates_size (ARRAY_SIZE(ath10k_rates) - 4) +#define ATH10K_MAC_FIRST_OFDM_RATE_IDX 4 + +#define ath10k_a_rates (ath10k_rates + ATH10K_MAC_FIRST_OFDM_RATE_IDX) +#define ath10k_a_rates_size (ARRAY_SIZE(ath10k_rates) - \ + ATH10K_MAC_FIRST_OFDM_RATE_IDX) #define ath10k_g_rates (ath10k_rates + 0) #define ath10k_g_rates_size (ARRAY_SIZE(ath10k_rates)) @@ -2001,10 +2004,10 @@ static void ath10k_peer_assoc_h_qos(struct ath10k *ar, sta->addr, !!(arg->peer_flags & WMI_PEER_QOS)); } -static bool ath10k_mac_sta_has_11g_rates(struct ieee80211_sta *sta) +static bool ath10k_mac_sta_has_ofdm_only(struct ieee80211_sta *sta) { - /* First 4 rates in ath10k_rates are CCK (11b) rates. */ - return sta->supp_rates[IEEE80211_BAND_2GHZ] >> 4; + return sta->supp_rates[IEEE80211_BAND_2GHZ] >> + ATH10K_MAC_FIRST_OFDM_RATE_IDX; } static void ath10k_peer_assoc_h_phymode(struct ath10k *ar, @@ -2026,7 +2029,7 @@ static void ath10k_peer_assoc_h_phymode(struct ath10k *ar, phymode = MODE_11NG_HT40; else phymode = MODE_11NG_HT20; - } else if (ath10k_mac_sta_has_11g_rates(sta)) { + } else if (ath10k_mac_sta_has_ofdm_only(sta)) { phymode = MODE_11G; } else { phymode = MODE_11B;