Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless <linux-wireless@vger.kernel.org>
Cc: Vasanthakumar Thiagarajan <vasanth@atheros.com>,
	Felix Fietkau <nbd@openwrt.org>
Subject: Re: [RFT] mac80211/drivers: rewrite the rate control API
Date: Sat, 11 Oct 2008 15:16:14 +0200	[thread overview]
Message-ID: <1223730974.29811.39.camel@johannes.berg> (raw)
In-Reply-To: <1223682964.29811.13.camel@johannes.berg> (sfid-20081011_015617_239108_FC7ED5DA)

On Sat, 2008-10-11 at 01:56 +0200, Johannes Berg wrote:
> So after the previous changes we were still unhappy with how
> convoluted the API is and decided to make things simpler for
> everybody. This completely changes the rate control API, now
> taking into account 802.11n with MCS rates and more control,
> most drivers don't support that though.

This was missing the RTS/CTS rate setting, which this patch adds, I'll
fold that in later, comments?

--- everything.orig/net/mac80211/tx.c	2008-10-11 15:01:51.000000000 +0200
+++ everything/net/mac80211/tx.c	2008-10-11 15:14:53.000000000 +0200
@@ -507,6 +507,33 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
 		return TX_CONTINUE;
 	}
 
+	/*
+	 * set up the RTS/CTS rate as the fastest basic rate
+	 * that is not faster than the data rate
+	 *
+	 * XXX: Should this check all retry rates?
+	 */
+	if (!(info->control.rates[0].flags & IEEE80211_TX_RC_MCS)) {
+		s8 baserate = 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)))
+				continue;
+			/* must not be faster than the data rate */
+			if (sband->bitrates[i].bitrate > rate->bitrate)
+				continue;
+			/* maximum */
+			if (sband->bitrates[baserate].bitrate <
+			     sband->bitrates[i].bitrate)
+				baserate = i;
+		}
+
+		info->control.rts_cts_rate_idx = baserate;
+	}
+
 	for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
 		/*
 		 * make sure there's no valid rate following
@@ -532,11 +559,9 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
 		}
 
 		/* set up RTS protection if desired */
-		if (rts) {
+		if (rts)
 			info->control.rates[i].flags |=
 				IEEE80211_TX_RC_USE_RTS_CTS;
-			rts = true;
-		}
 
 		/* RC is busted */
 		if (WARN_ON(info->control.rates[i].idx >=



  reply	other threads:[~2008-10-11 13:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-10 23:56 [RFT] mac80211/drivers: rewrite the rate control API Johannes Berg
2008-10-11 13:16 ` Johannes Berg [this message]
2008-10-11 23:55 ` [RFT v2] " Johannes Berg
2008-10-11 23:58   ` [RFT] p54: implement MRR Johannes Berg
2008-10-12  0:06     ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1223730974.29811.39.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@openwrt.org \
    --cc=vasanth@atheros.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox