Search Linux Wireless

Re: [RFT] mac80211/drivers: rewrite the rate control API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 >=


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux