From patchwork Tue Nov 12 14:30:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karl Beldan X-Patchwork-Id: 3172951 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6F32FC045B for ; Tue, 12 Nov 2013 14:31:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ACE50204D1 for ; Tue, 12 Nov 2013 14:31:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6FBE5204EB for ; Tue, 12 Nov 2013 14:31:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755381Ab3KLObP (ORCPT ); Tue, 12 Nov 2013 09:31:15 -0500 Received: from mail-wg0-f45.google.com ([74.125.82.45]:52466 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755300Ab3KLObO (ORCPT ); Tue, 12 Nov 2013 09:31:14 -0500 Received: by mail-wg0-f45.google.com with SMTP id a1so2179377wgh.24 for ; Tue, 12 Nov 2013 06:31:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4oWPC5kgsJhZ1ldMh2ZGEhmz+FjQ1WG3JQrrT5Vaan0=; b=mcCNvjATBTcvNzEzMWLfvRoCIlrYmuL5lxa1YVyMbQOQ4UGpht+z+cjuQX9YYUCghM 8/o+5zOsLVffB3/EBmiI3NCvhkeZ4xSZ/LHmKETReUq9wajpKer3fpRmjBtCnJzDNOHv RNzTZ8pYAGLfqohtKBa6tHvYtkvGJ9sNpDIKq7hthULEmkBT+8jIYgAjOyednvGb9pcP ys6b71sRQaOSwRHR9OPicLvt+NyJi2nnrU600tKlszS8TSWOugEEuZjSOoO+CSqYV1hj mo3dmIjzMbfEdNF3psXHi3s9Y1iPIomfP5U4OmONPezpZMp1oI6vYujASGGGW1aKR4cb MWBA== X-Received: by 10.180.189.80 with SMTP id gg16mr16550142wic.32.1384266672728; Tue, 12 Nov 2013 06:31:12 -0800 (PST) Received: from magnum.frso.rivierawaves.com (ppp-seco11pa2-46-193-143.43.wb.wifirst.net. [46.193.143.43]) by mx.google.com with ESMTPSA id gg20sm46024405wic.1.2013.11.12.06.31.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Nov 2013 06:31:12 -0800 (PST) From: Karl Beldan To: Johannes Berg Cc: Felix Fietkau , linux-wireless , Karl Beldan , Karl Beldan Subject: [RFC 2/2] fixup! mac80211: minstrel_ht: add basic support for VHT rates <= 80MHz Date: Tue, 12 Nov 2013 15:30:25 +0100 Message-Id: <1384266625-22431-2-git-send-email-karl.beldan@gmail.com> X-Mailer: git-send-email 1.8.2 In-Reply-To: <1384266625-22431-1-git-send-email-karl.beldan@gmail.com> References: <1384266625-22431-1-git-send-email-karl.beldan@gmail.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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 From: Karl Beldan Signed-off-by: Karl Beldan --- net/mac80211/rc80211_minstrel_ht.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index dd81516..c3aa1a9 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c @@ -52,6 +52,7 @@ [GROUP_IDX(_streams, _sgi, _ht40)] = { \ .streams = _streams, \ .flags = \ + IEEE80211_TX_RC_MCS | \ (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) | \ (_ht40 ? IEEE80211_TX_RC_40_MHZ_WIDTH : 0), \ .duration = { \ @@ -79,6 +80,7 @@ [VHT_GROUP_IDX(_streams, _sgi, _bw)] = { \ .streams = _streams, \ .flags = \ + IEEE80211_TX_RC_VHT_MCS | \ (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) | \ (_bw == BW_80 ? IEEE80211_TX_RC_80_MHZ_WIDTH : \ _bw == BW_40 ? IEEE80211_TX_RC_40_MHZ_WIDTH : 0), \ @@ -115,6 +117,7 @@ #define CCK_GROUP \ [MINSTREL_CCK_GROUP] = { \ .streams = 0, \ + .flags = 0, \ .duration = { \ CCK_DURATION_LIST(false), \ CCK_DURATION_LIST(true) \ @@ -721,7 +724,7 @@ minstrel_ht_set_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; struct minstrel_rate_stats *mr; u8 idx; - u16 flags; + u16 flags = group->flags; mr = minstrel_get_ratestats(mi, index); if (!mr->retry_updated) @@ -737,17 +740,13 @@ minstrel_ht_set_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, ratetbl->rate[offset].count_rts = mr->retry_count_rtscts; } - if (index / MCS_GROUP_RATES == MINSTREL_CCK_GROUP) { + if (index / MCS_GROUP_RATES == MINSTREL_CCK_GROUP) idx = mp->cck_rates[index % ARRAY_SIZE(mp->cck_rates)]; - flags = 0; - } else if (index / MCS_GROUP_RATES >= MINSTREL_VHT_GROUP_0) { + else if (flags & IEEE80211_TX_RC_VHT_MCS) idx = ((group->streams - 1) << 4) | ((index % MCS_GROUP_RATES) & ~0xF); - flags = IEEE80211_TX_RC_VHT_MCS | group->flags; - } else { + else idx = index % MCS_GROUP_RATES + (group->streams - 1) * 8; - flags = IEEE80211_TX_RC_MCS | group->flags; - } if (offset > 0) { ratetbl->rate[offset].count = ratetbl->rate[offset].count_rts; @@ -924,18 +923,15 @@ minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, if (sample_idx / MCS_GROUP_RATES == MINSTREL_CCK_GROUP) { int idx = sample_idx % ARRAY_SIZE(mp->cck_rates); rate->idx = mp->cck_rates[idx]; - rate->flags = 0; - return; - } else if (sample_idx / MCS_GROUP_RATES >= MINSTREL_VHT_GROUP_0) { - rate->flags = IEEE80211_TX_RC_VHT_MCS | sample_group->flags; + } else if (sample_group->flags & IEEE80211_TX_RC_VHT_MCS) { ieee80211_rate_set_vht(rate, sample_idx % MCS_GROUP_RATES, sample_group->streams); - return; + } else { + rate->idx = sample_idx % MCS_GROUP_RATES + + (sample_group->streams - 1) * 8; } - rate->idx = sample_idx % MCS_GROUP_RATES + - (sample_group->streams - 1) * 8; - rate->flags = IEEE80211_TX_RC_MCS | sample_group->flags; + rate->flags = sample_group->flags; } static void @@ -1033,10 +1029,8 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband, continue; } -#ifdef CONFIG_MAC80211_RC_MINSTREL_VHT /* FIXME otherwise MINSTREL_VHT_GROUP_0 is 0 */ - if (vht_only && i < MINSTREL_VHT_GROUP_0) + if (vht_only && !(gflags & IEEE80211_TX_RC_VHT_MCS)) continue; -#endif if (gflags & IEEE80211_TX_RC_SHORT_GI) { if (gflags & IEEE80211_TX_RC_40_MHZ_WIDTH) { @@ -1057,7 +1051,7 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband, minstrel_mcs_groups[i].streams > 1) continue; - if (i >= MINSTREL_VHT_GROUP_0) { + if (gflags & IEEE80211_TX_RC_VHT_MCS) { int bw; if (!vht_cap->vht_supported) continue;