From patchwork Mon Nov 11 12:10:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karl Beldan X-Patchwork-Id: 3167261 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CADE69F3AE for ; Mon, 11 Nov 2013 12:12:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9CA9D20103 for ; Mon, 11 Nov 2013 12:12:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E6BAA200D5 for ; Mon, 11 Nov 2013 12:12:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753009Ab3KKMMN (ORCPT ); Mon, 11 Nov 2013 07:12:13 -0500 Received: from mail-wg0-f42.google.com ([74.125.82.42]:56305 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752890Ab3KKMMM (ORCPT ); Mon, 11 Nov 2013 07:12:12 -0500 Received: by mail-wg0-f42.google.com with SMTP id k14so2098519wgh.3 for ; Mon, 11 Nov 2013 04:12:11 -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=fhYGC5X2coTodoeZ/uYkWHdal7cvd48MecPLfVbLHpQ=; b=NbmtKfdOOXD/ulOlZjNhSlK7pprDsICk44SLEJQfJoRz77+TfN4YWLdm7adpEYivmt INH5ut2gNYgTuDYp9cSCucxC+Rym5JVvfNwzDufD1HsUdThQ41TCKRK4PjmUWZJZppch xia17X8sg9VqpIYaaQshzzDxMFX28rEpHw33XTOBX9akIa4sFcnX3tA9nQ8sDIWcTjTM oc9cGatmDMTyW9CsM2CaStqQH2TqrTKOIZM0GNWjdgj7JOJm2DigH14+l2ahf8NUiP4w R4kzV40guempmcHuou3a0CrpBMltQ4l5/R8RLs9sHhH8N7ZpcwJVYAX6Fa3tPEY3ncx+ N1+w== X-Received: by 10.180.75.39 with SMTP id z7mr12152713wiv.9.1384171930977; Mon, 11 Nov 2013 04:12:10 -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 hv5sm33611637wib.2.2013.11.11.04.12.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Nov 2013 04:12:10 -0800 (PST) From: Karl Beldan To: Johannes Berg Cc: Felix Fietkau , linux-wireless , Karl Beldan Subject: [PATCH v2] mac80211: minstrel_ht: do not sample unsupported rates Date: Mon, 11 Nov 2013 13:10:49 +0100 Message-Id: <1384171849-21058-1-git-send-email-karl.beldan@gmail.com> X-Mailer: git-send-email 1.8.2 In-Reply-To: <527D14B7.3090204@openwrt.org> References: <527D14B7.3090204@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 ATM minstrel_ht does not check whether a sampling rate is supported. Unsupported rates attempts can trigger when there are holes in bitfields of supported MCSes belonging to the same group (e.g many devices are MCS32 capable without MCS33->39 capable, also we systematically have a hole for CCK rates). I originally replaced an unsupported sample index with the fls of the bitfield of supported indexes of the sta current sample group, instead, this change simply drops the sample attempt, as suggested by Felix. This is not a problem in minstrel which fills a per STA sample table with only supported rates (though only at init). Signed-off-by: Karl Beldan --- net/mac80211/rc80211_minstrel_ht.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index aeec401..1076bca 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c @@ -701,12 +701,16 @@ minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) if (!mi->sample_tries) return -1; - mg = &mi->groups[mi->sample_group]; + sample_group = mi->sample_group; + mg = &mi->groups[sample_group]; sample_idx = sample_table[mg->column][mg->index]; + minstrel_next_sample_idx(mi); + + if (!(mg->supported & BIT(sample_idx))) + return -1; + mr = &mg->rates[sample_idx]; - sample_group = mi->sample_group; sample_idx += sample_group * MCS_GROUP_RATES; - minstrel_next_sample_idx(mi); /* * Sampling might add some overhead (RTS, no aggregation)