From patchwork Wed Mar 9 09:02:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helmut Schaa X-Patchwork-Id: 620721 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p299367T025805 for ; Wed, 9 Mar 2011 09:03:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756843Ab1CIJCt (ORCPT ); Wed, 9 Mar 2011 04:02:49 -0500 Received: from mail-ey0-f174.google.com ([209.85.215.174]:51005 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756811Ab1CIJCr (ORCPT ); Wed, 9 Mar 2011 04:02:47 -0500 Received: by eyx24 with SMTP id 24so77477eyx.19 for ; Wed, 09 Mar 2011 01:02:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=rprTOmVucgoXeOdh5GfQGRlZiAk1X75gxdaexgxpBAw=; b=Ajh0YEbJ+SFiKAQn2KE0wXtpDBbYikn3WTa440RDUfWT/kycdby1scuvlapal4EnvE muRmxcohNapWwQaspqPGm9Fbhgsw1B8Qw6iJVgj3qB7ybivgEd5vFNY6XoimUZSWC+cc uaYVJv7eNIQ5Q735TttPccOpz9NSBXCYPf/d0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=VUc7lTWMacyeEsKRlvFGuWRAg9Yck/cw695rQdlb5/6Mb24n3DwoYSCb5NtQeTqsoL Bqm5DBXRuq5sJKKRkLNClpIZVD/J0ZLrBEM7Agf1gxKjP+pYkIGRH/mZaSre7T/k+sIi KvGyZFBECRac0RORkZWdbQD2aueWiXUuuPKM0= Received: by 10.213.10.68 with SMTP id o4mr4338301ebo.74.1299661366154; Wed, 09 Mar 2011 01:02:46 -0800 (PST) Received: from localhost.localdomain (p5495A785.dip.t-dialin.net [84.149.167.133]) by mx.google.com with ESMTPS id x54sm1338003eeh.11.2011.03.09.01.02.43 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 09 Mar 2011 01:02:44 -0800 (PST) From: Helmut Schaa To: linville@tuxdriver.com Cc: linux-wireless@vger.kernel.org, johannes@sipsolutions.net, nbd@openwrt.org, Helmut Schaa Subject: [PATCHv2] mac80211: Shortcut minstrel_ht rate setup for non-MRR capable devices Date: Wed, 9 Mar 2011 10:02:38 +0100 Message-Id: <1299661358-8843-1-git-send-email-helmut.schaa@googlemail.com> X-Mailer: git-send-email 1.7.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 09 Mar 2011 09:03:08 +0000 (UTC) diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index 775cf15..0985324 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c @@ -603,19 +603,46 @@ minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, sample = true; minstrel_ht_set_rate(mp, mi, &ar[0], sample_idx, txrc, true, false); - minstrel_ht_set_rate(mp, mi, &ar[1], mi->max_tp_rate, - txrc, false, false); info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; } else { minstrel_ht_set_rate(mp, mi, &ar[0], mi->max_tp_rate, txrc, false, false); - minstrel_ht_set_rate(mp, mi, &ar[1], mi->max_tp_rate2, - txrc, false, true); } - minstrel_ht_set_rate(mp, mi, &ar[2], mi->max_prob_rate, txrc, false, !sample); - ar[3].count = 0; - ar[3].idx = -1; + if (mp->hw->max_rates >= 3) { + /* + * At least 3 tx rates supported, use + * sample_rate -> max_tp_rate -> max_prob_rate for sampling and + * max_tp_rate -> max_tp_rate2 -> max_prob_rate by default. + */ + if (sample_idx >= 0) + minstrel_ht_set_rate(mp, mi, &ar[1], mi->max_tp_rate, + txrc, false, false); + else + minstrel_ht_set_rate(mp, mi, &ar[1], mi->max_tp_rate2, + txrc, false, true); + + minstrel_ht_set_rate(mp, mi, &ar[2], mi->max_prob_rate, + txrc, false, !sample); + + ar[3].count = 0; + ar[3].idx = -1; + } else if (mp->hw->max_rates == 2) { + /* + * Only 2 tx rates supported, use + * sample_rate -> max_prob_rate for sampling and + * max_tp_rate -> max_prob_rate by default. + */ + minstrel_ht_set_rate(mp, mi, &ar[1], mi->max_prob_rate, + txrc, false, !sample); + + ar[2].count = 0; + ar[2].idx = -1; + } else { + /* Not using MRR, only use the first rate */ + ar[1].count = 0; + ar[1].idx = -1; + } mi->total_packets++;