From patchwork Wed Sep 16 02:24:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Roskin X-Patchwork-Id: 47804 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8G2OgMG000869 for ; Wed, 16 Sep 2009 02:24:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752496AbZIPCYh (ORCPT ); Tue, 15 Sep 2009 22:24:37 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751794AbZIPCYh (ORCPT ); Tue, 15 Sep 2009 22:24:37 -0400 Received: from c60.cesmail.net ([216.154.195.49]:39800 "EHLO c60.cesmail.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751245AbZIPCYh (ORCPT ); Tue, 15 Sep 2009 22:24:37 -0400 Received: from unknown (HELO smtprelay1.cesmail.net) ([192.168.1.111]) by c60.cesmail.net with ESMTP; 15 Sep 2009 22:24:39 -0400 Received: from mj.roinet.com (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by smtprelay1.cesmail.net (Postfix) with ESMTPSA id 62FD834C69; Tue, 15 Sep 2009 22:24:34 -0400 (EDT) Subject: [PATCH] rc80211_minstrel: fix contention window calculation To: Dan Halperin , linux-wireless@vger.kernel.org, "John W. Linville" From: Pavel Roskin Date: Tue, 15 Sep 2009 22:24:30 -0400 Message-ID: <20090916022430.27557.93510.stgit@mj.roinet.com> User-Agent: StGit/0.15-rc3 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The contention window is supposed to be a power of two minus one, i.e. 15, 31, 63, 127... minstrel_rate_init() forgets to subtract 1, so the sequence becomes 15, 32, 66, 134... Bug reported by Dan Halperin Signed-off-by: Pavel Roskin --- net/mac80211/rc80211_minstrel.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c index 7c51429..6e5d68b 100644 --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c @@ -418,7 +418,7 @@ minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband, /* contention window */ tx_time_single += t_slot + min(cw, mp->cw_max); - cw = (cw + 1) << 1; + cw = (cw << 1) | 1; tx_time += tx_time_single; tx_time_cts += tx_time_single + mi->sp_ack_dur;