From patchwork Fri Apr 5 10:06:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karl Beldan X-Patchwork-Id: 2397501 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id B0285DF2E5 for ; Fri, 5 Apr 2013 10:10:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752760Ab3DEKKL (ORCPT ); Fri, 5 Apr 2013 06:10:11 -0400 Received: from mail-wg0-f44.google.com ([74.125.82.44]:35778 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751178Ab3DEKKK (ORCPT ); Fri, 5 Apr 2013 06:10:10 -0400 Received: by mail-wg0-f44.google.com with SMTP id z12so3537045wgg.23 for ; Fri, 05 Apr 2013 03:10:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=AZeW6Kem4zckKP6/xQeojIHSyBEWU5a/cvypAI15Qz8=; b=sPjdsXZrVf/z7EgVn+lUPI3ALVEOQaDMYg6fWH7ZiLWmqy2oxb3C/dvKCc7qdOr88f UhpnErhlpu9BZar5GqC5wXho+Brb7+dGLbFcARJUcmN94DoI5lWBKsEnYetWDSusdPGm czP2BS83w9W0sNVX61ltvMB7VDYn6k4Lt2hGmXo8733umJ33t1kiQJ7YZjvK0CJoliAI UAUVAgGuFrifn/IqwaRl2QdRZzUP0AYJpFc2yXuDPzGvSGtMtjJ8x9UtsOFZRJXYIIEd Au2Z43Qtuns/DE6tG6nXrua5LKi8E5y+ckoVncRNhehZPKtTm5wWCE075FywyR2Fg6cv z3eg== X-Received: by 10.181.11.164 with SMTP id ej4mr2988506wid.29.1365156608830; Fri, 05 Apr 2013 03:10:08 -0700 (PDT) Received: from magnum.frso.rivierawaves.com (vpn.rivierawaves.com. [91.151.119.162]) by mx.google.com with ESMTPS id h10sm3097196wic.8.2013.04.05.03.10.06 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Apr 2013 03:10:07 -0700 (PDT) From: Karl Beldan To: Johannes Berg Cc: linux-wireless , Karl Beldan , Karl Beldan Subject: [PATCH] mac80211: always pick a basic rate to tx RTS/CTS for pre-HT rates Date: Fri, 5 Apr 2013 12:06:24 +0200 Message-Id: <1365156384-6699-1-git-send-email-karl.beldan@gmail.com> X-Mailer: git-send-email 1.8.2 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Karl Beldan When the 1st rate control entry is a pre-HT rate we want to set rts_cts_rate_idx "as the fastest basic rate that is not faster than the data rate"(code comments). But in case some bss allowed rate indexes are lower than the lowest bss basic rate, if the rate control selects a rate among the formers for its 1st rate control entry, rts_cts_rate_idx remains 0 and is not a basic rate index. This commit sets rts_cts_rate_idx to the lowest bss basic rate index in this situation. Note that the code assumes that lowest indexes == lowest bitrates. Signed-off-by: Karl Beldan --- net/mac80211/tx.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index aad0bf5..c93483f 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -712,19 +712,22 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) } /* - * set up the RTS/CTS rate as the fastest basic rate - * that is not faster than the data rate + * Set up the RTS/CTS rate as the fastest basic rate + * that is not faster than the data rate unless there + * is no basic rate slower than the data rate, in which + * case we pick the slowest basic rate * * XXX: Should this check all retry rates? */ if (!(info->control.rates[0].flags & IEEE80211_TX_RC_MCS)) { - s8 baserate = 0; + u32 basic_rates = tx->sdata->vif.bss_conf.basic_rates; + s8 baserate = basic_rates ? ffs(basic_rates - 1) : 0; rate = &sband->bitrates[info->control.rates[0].idx]; for (i = 0; i < sband->n_bitrates; i++) { /* must be a basic rate */ - if (!(tx->sdata->vif.bss_conf.basic_rates & BIT(i))) + if (!(basic_rates & BIT(i))) continue; /* must not be faster than the data rate */ if (sband->bitrates[i].bitrate > rate->bitrate)