From patchwork Wed Nov 13 22:07:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karl Beldan X-Patchwork-Id: 3179801 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 8F2D4C045B for ; Wed, 13 Nov 2013 22:07:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B094320916 for ; Wed, 13 Nov 2013 22:07:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E0CD720914 for ; Wed, 13 Nov 2013 22:07:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751990Ab3KMWHp (ORCPT ); Wed, 13 Nov 2013 17:07:45 -0500 Received: from mail-wi0-f170.google.com ([209.85.212.170]:41393 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751966Ab3KMWHo (ORCPT ); Wed, 13 Nov 2013 17:07:44 -0500 Received: by mail-wi0-f170.google.com with SMTP id f4so2108700wiw.1 for ; Wed, 13 Nov 2013 14:07:43 -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=spGLLVD0a3ESg939rcluhKd9umTMEMqKfThrklV5VOs=; b=wGupGcEJejNUXqKcKkpw5uIxMPXkiYckYMJ/5kHYL8xLc7cc2akCxFPTYrUUm/8ToI I/ryxEVNSYAFVG9gptTeAPANkpeOhHrkuDNhjs19LRWz8YYRIHL/9U1CBpPXMx9bdkhv IlyGw65g9zZ8XNleYhTcY2N835tb5GNF8ooQxdIvlEj3pkNyvaBnJMLjEFiMWz3wDgKm wIImyqxnonC/4TqXJq/x1ID+pBZRPly/PVL+EUFMJdDLwgBMZuDlBzyKN6AU/u54Xldq 6JKHFFjODf8jzrzBsQkcA75+0eGsx7OETuWO9fNkkdCAfaF38zP+uV6UAG7EZWlseNwY +t5A== X-Received: by 10.194.170.133 with SMTP id am5mr3624558wjc.42.1384380463889; Wed, 13 Nov 2013 14:07:43 -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 ma3sm139627wic.1.2013.11.13.14.07.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Nov 2013 14:07:43 -0800 (PST) From: Karl Beldan To: Johannes Berg Cc: Felix Fietkau , linux-wireless , Karl Beldan Subject: [PATCH v2] mac80211: minstrel_ht: fix rates selection Date: Wed, 13 Nov 2013 23:07:07 +0100 Message-Id: <1384380427-12950-1-git-send-email-karl.beldan@gmail.com> X-Mailer: git-send-email 1.8.2 In-Reply-To: <5283ED31.1050606@openwrt.org> References: <5283ED31.1050606@openwrt.org> 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 When initializing rates selections starting indexes upon stats update, the minstrel_sta->max_* rates should be 'group * MCS_GROUP_RATES + i' not 'i'. This affects settings where one of the peers does not support any of the rates of the group 0 (i.e. when ht_cap.mcs.rx_mask[0] == 0). Signed-off-by: Karl Beldan Acked-by: Felix Fietkau --- net/mac80211/rc80211_minstrel_ht.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index 53db728..e2a57e2 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c @@ -277,13 +277,15 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) if (!(mg->supported & BIT(i))) continue; + index = MCS_GROUP_RATES * group + i; + /* initialize rates selections starting indexes */ if (!mg_rates_valid) { mg->max_tp_rate = mg->max_tp_rate2 = mg->max_prob_rate = i; if (!mi_rates_valid) { mi->max_tp_rate = mi->max_tp_rate2 = - mi->max_prob_rate = i; + mi->max_prob_rate = index; mi_rates_valid = true; } mg_rates_valid = true; @@ -291,7 +293,6 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) mr = &mg->rates[i]; mr->retry_updated = false; - index = MCS_GROUP_RATES * group + i; minstrel_calc_rate_ewma(mr); minstrel_ht_calc_tp(mi, group, i);