Skip to contentSkip to conversation

mac80211: Clean up rate selection

PATCH In review Mattias Nissler 5 participants 15 messages Dec 8, 2007 – Dec 11, 2007 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1197112439.7472.34.camel@localhost

#1 lore raw

PATCH 1/4 mac80211: Clean up rate selection

Move some code out of rc80211_simple since it's probably needed for all rate selection algorithms. While at it, clean up the rate_control_get_rate() interface.

---
 net/mac80211/ieee80211_rate.c |   47 ++++++++++++++++++++++++++++
 net/mac80211/ieee80211_rate.h |   68 ++++++++++++++++++++++++++---------------
 net/mac80211/ieee80211_sta.c  |   13 +++-----
 net/mac80211/rc80211_simple.c |   64 ++++++--------------------------------
 net/mac80211/tx.c             |   42 +++++++++++--------------
 5 files changed, 124 insertions(+), 110 deletions(-)
net/mac80211/ieee80211_rate.c +47 -0
index 7254bd6..a2f8d64 100644
@@ -146,6 +146,53 @@ static void rate_control_release(struct kref *kref)
 	kfree(ctrl_ref);
 }
 
+void rate_control_get_rate(struct net_device *dev,
+			   struct ieee80211_hw_mode *mode, struct sk_buff *skb,
+			   struct rate_selection *sel)
+{
+	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+	struct rate_control_ref *ref = local->rate_ctrl;
+	struct ieee80211_sub_if_data *sdata;
+	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+	struct sta_info *sta = sta_info_get(local, hdr->addr1);
+	int i;
+	u16 fc;
+
+	memset(sel, 0, sizeof(struct rate_selection));
+
+	/* Send management frames and broadcast/multicast data using lowest
+	 * rate. */
+	fc = le16_to_cpu(hdr->frame_control);
+	if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
+	    (hdr->addr1[0] & 0x01))
+		sel->rate = rate_lowest(local, mode, sta);
+
+	/* If a forced rate is in effect, select it. */
+	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	if (sdata->bss && sdata->bss->force_unicast_rateidx > -1)
+		sel->rate = &mode->rates[sdata->bss->force_unicast_rateidx];
+
+	/* If we haven't found the rate yet, ask the rate control algo. */
+	if (!sel->rate)
+		ref->ops->get_rate(ref->priv, dev, mode, skb, sel);
+
+	/* Select a non-ERP backup rate. */
+	if (!sel->nonerp) {
+		for (i = 0; i < mode->num_rates - 1; i++) {
+			struct ieee80211_rate *rate = &mode->rates[i];
+			if (sel->rate->rate < rate->rate)
+				break;
+
+			if (rate_supported(sta, mode, i) &&
+			    !(rate->flags & IEEE80211_RATE_ERP))
+				sel->nonerp = rate;
+		}
+	}
+
+	if (sta)
+		sta_info_put(sta);
+}
+
 struct rate_control_ref *rate_control_get(struct rate_control_ref *ref)
 {
 	kref_get(&ref->kref);
net/mac80211/ieee80211_rate.h +43 -25

101 lines not on this page · raw message

net/mac80211/ieee80211_sta.c +5 -8
index 2a321f0..e55a9f4 100644
@@ -2208,9 +2208,8 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
 	struct sk_buff *skb;
 	struct ieee80211_mgmt *mgmt;
 	struct ieee80211_tx_control control;
-	struct ieee80211_rate *rate;
 	struct ieee80211_hw_mode *mode;
-	struct rate_control_extra extra;
+	struct rate_selection ratesel;
 	u8 *pos;
 	struct ieee80211_sub_if_data *sdata;
 
@@ -2295,18 +2294,16 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
 		}
 
 		memset(&control, 0, sizeof(control));
-		memset(&extra, 0, sizeof(extra));
-		extra.mode = local->oper_hw_mode;
-		rate = rate_control_get_rate(local, dev, skb, &extra);
-		if (!rate) {
+		rate_control_get_rate(dev, local->oper_hw_mode, skb, &ratesel);
+		if (!ratesel.rate) {
 			printk(KERN_DEBUG "%s: Failed to determine TX rate "
 			       "for IBSS beacon\n", dev->name);
 			break;
 		}
 		control.tx_rate =
 			((sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE) &&
-			(rate->flags & IEEE80211_RATE_PREAMBLE2)) ?
-			rate->val2 : rate->val;
+			(ratesel.rate->flags & IEEE80211_RATE_PREAMBLE2)) ?
+			ratesel.rate->val2 : ratesel.rate->val;
 		control.antenna_sel_tx = local->hw.conf.antenna_sel_tx;
 		control.power_level = local->hw.conf.power_level;
 		control.flags |= IEEE80211_TXCTL_NO_ACK;
net/mac80211/rc80211_simple.c +11 -53

99 lines not on this page · raw message

net/mac80211/tx.c +18 -24

83 lines not on this page · raw message

Signature · 1 line
1.5.3.4
maintainer
#2 lore raw

net/mac80211/ieee80211_rate.c static void rate_control_release(struct kref *kref) · line 168

Quoted 7 lines
net/mac80211/ieee80211_rate.c +6 -0
+	/* Send management frames and broadcast/multicast data using lowest
+	 * rate. */
+	fc = le16_to_cpu(hdr->frame_control);
+	if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
+	    (hdr->addr1[0] & 0x01))
+		sel->rate = rate_lowest(local, mode, sta);

I'm not sure but I don't think we want this. And you should use is_multicast_addr() or whatever it's called.

net/mac80211/ieee80211_rate.c static void rate_control_release(struct kref *kref) · line 173

Quoted 4 lines
net/mac80211/ieee80211_rate.c +4 -0
+	/* If a forced rate is in effect, select it. */
+	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	if (sdata->bss && sdata->bss->force_unicast_rateidx > -1)
+		sel->rate = &mode->rates[sdata->bss->force_unicast_rateidx];

That's good.

Quoted 6 lines
net/mac80211/ieee80211_rate.c +5 -0
+	/* If we haven't found the rate yet, ask the rate control algo. */
+	if (!sel->rate)
+		ref->ops->get_rate(ref->priv, dev, mode, skb, sel);
 
+	/* Select a non-ERP backup rate. */
+	if (!sel->nonerp) {

net/mac80211/ieee80211_rate.c static void rate_control_release(struct kref *kref) · line 190

Quoted 10 lines
net/mac80211/ieee80211_rate.c +10 -0
+		for (i = 0; i < mode->num_rates - 1; i++) {
+			struct ieee80211_rate *rate = &mode->rates[i];
+			if (sel->rate->rate < rate->rate)
+				break;
+
+			if (rate_supported(sta, mode, i) &&
+			    !(rate->flags & IEEE80211_RATE_ERP))
+				sel->nonerp = rate;
+		}
+	}

That I'm not sure about. This is the fallback rate?

johannes

#3 lore raw
Quoted 9 lines · Johannes Berg

net/mac80211/ieee80211_rate.c static void rate_control_release(struct kref *kref) · line 168

Quoted 6 lines
net/mac80211/ieee80211_rate.c +6 -0
+	/* Send management frames and broadcast/multicast data using lowest
+	 * rate. */
+	fc = le16_to_cpu(hdr->frame_control);
+	if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
+	    (hdr->addr1[0] & 0x01))
+		sel->rate = rate_lowest(local, mode, sta);

I'm not sure but I don't think we want this. And you should use is_multicast_addr() or whatever it's called.

This piece comes directly from the old "simple" algo. You're right about is_multicast_addr. I agree this is something we might to get rid of, but I leave that decision to you.

Quoted 12 lines

net/mac80211/ieee80211_rate.c static void rate_control_release(struct kref *kref) · line 173

Quoted 5 lines
net/mac80211/ieee80211_rate.c +4 -0
+	/* If a forced rate is in effect, select it. */
+	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	if (sdata->bss && sdata->bss->force_unicast_rateidx > -1)
+		sel->rate = &mode->rates[sdata->bss->force_unicast_rateidx];

That's good.

Quoted 3 lines
net/mac80211/ieee80211_rate.c +3 -0
+	/* If we haven't found the rate yet, ask the rate control algo. */
+	if (!sel->rate)
+		ref->ops->get_rate(ref->priv, dev, mode, skb, sel);
Quoted 14 lines

net/mac80211/ieee80211_rate.c static void rate_control_release(struct kref *kref) · line 190

Quoted 12 lines
net/mac80211/ieee80211_rate.c +12 -0
+	/* Select a non-ERP backup rate. */
+	if (!sel->nonerp) {
+		for (i = 0; i < mode->num_rates - 1; i++) {
+			struct ieee80211_rate *rate = &mode->rates[i];
+			if (sel->rate->rate < rate->rate)
+				break;
+
+			if (rate_supported(sta, mode, i) &&
+			    !(rate->flags & IEEE80211_RATE_ERP))
+				sel->nonerp = rate;
+		}
+	}

That I'm not sure about. This is the fallback rate?

Yes. It's after the get_rate() call so the algorithm can override it. But if it doesn't we compute it ourselves.

Mattias

#4 lore raw
Quoted 20 lines · Mattias Nissler
Quoted 5 lines
Quoted 4 lines
net/mac80211/ieee80211_rate.c +3 -0
+	/* If we haven't found the rate yet, ask the rate control algo. */
+	if (!sel->rate)
+		ref->ops->get_rate(ref->priv, dev, mode, skb, sel);
Quoted 14 lines

net/mac80211/ieee80211_rate.c static void rate_control_release(struct kref *kref) · line 190

Quoted 12 lines
net/mac80211/ieee80211_rate.c +12 -0
+	/* Select a non-ERP backup rate. */
+	if (!sel->nonerp) {
+		for (i = 0; i < mode->num_rates - 1; i++) {
+			struct ieee80211_rate *rate = &mode->rates[i];
+			if (sel->rate->rate < rate->rate)
+				break;
+
+			if (rate_supported(sta, mode, i) &&
+			    !(rate->flags & IEEE80211_RATE_ERP))
+				sel->nonerp = rate;
+		}
+	}

That I'm not sure about. This is the fallback rate?

Quoted 2 lines

Yes. It's after the get_rate() call so the algorithm can override it. But if it doesn't we compute it ourselves.

To be a little more specific, it's the non-extended-rate-set rate. So the code falls back to this one e.g. if it's an AP has 80211.g but stations that are only 80211.b

Mattias

maintainer
#5 lore raw
In reply to Mattias Nissler
Quoted 11 lines · Mattias Nissler
Quoted 9 lines · Johannes Berg

net/mac80211/ieee80211_rate.c static void rate_control_release(struct kref *kref) · line 168

Quoted 6 lines
net/mac80211/ieee80211_rate.c +6 -0
+	/* Send management frames and broadcast/multicast data using lowest
+	 * rate. */
+	fc = le16_to_cpu(hdr->frame_control);
+	if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
+	    (hdr->addr1[0] & 0x01))
+		sel->rate = rate_lowest(local, mode, sta);

I'm not sure but I don't think we want this. And you should use is_multicast_addr() or whatever it's called.

Quoted 3 lines

This piece comes directly from the old "simple" algo. You're right about is_multicast_addr. I agree this is something we might to get rid of, but I leave that decision to you.

Right, but I guess that Intel's algorithms do something different and this would break it. IMHO that decision should stay in the algorithm itself.

Quoted 2 lines

Yes. It's after the get_rate() call so the algorithm can override it. But if it doesn't we compute it ourselves.

Hmm. Then the algorithm can't specify "no fallback rate", can it? Well, this will have to be reviewed anyway when the API is changed to support minstrel.

johannes

#6 lore raw
Quoted 12 lines · Johannes Berg
Quoted 11 lines · Mattias Nissler
Quoted 9 lines · Johannes Berg

net/mac80211/ieee80211_rate.c static void rate_control_release(struct kref *kref) · line 168

Quoted 6 lines
net/mac80211/ieee80211_rate.c +6 -0
+	/* Send management frames and broadcast/multicast data using lowest
+	 * rate. */
+	fc = le16_to_cpu(hdr->frame_control);
+	if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
+	    (hdr->addr1[0] & 0x01))
+		sel->rate = rate_lowest(local, mode, sta);

I'm not sure but I don't think we want this. And you should use is_multicast_addr() or whatever it's called.

Quoted 7 lines
Quoted 3 lines

This piece comes directly from the old "simple" algo. You're right about is_multicast_addr. I agree this is something we might to get rid of, but I leave that decision to you.

Right, but I guess that Intel's algorithms do something different and this would break it. IMHO that decision should stay in the algorithm itself.

Actually, I carefully check the iwlwifi code and it copies this exact code. Finding it in there as well actually convinced me to move it out of the rate control.

Quoted 5 lines
Quoted 3 lines

Yes. It's after the get_rate() call so the algorithm can override it. But if it doesn't we compute it ourselves.

Hmm. Then the algorithm can't specify "no fallback rate", can it?

Correct. But why would you want that to be possible?

Mattias

maintainer
#7 lore raw
Quoted 8 lines
Quoted 4 lines

Right, but I guess that Intel's algorithms do something different and this would break it. IMHO that decision should stay in the algorithm itself.

Actually, I carefully check the iwlwifi code and it copies this exact code. Finding it in there as well actually convinced me to move it out of the rate control.

Heh, ok. Let's leave it like this then.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Yes. It's after the get_rate() call so the algorithm can override it. But if it doesn't we compute it ourselves.

Hmm. Then the algorithm can't specify "no fallback rate", can it?

Correct. But why would you want that to be possible?

No idea :)

johannes

#8 lore raw

PATCH 2/4 iwlwifi: Update to changed mac80211 rate control interface

In reply to a message not in the archive

This brings iwlwifi rate control code back in sync with mac80211.

---
 drivers/net/wireless/iwlwifi/iwl-3945-rs.c |   44 ++++----------------------
 drivers/net/wireless/iwlwifi/iwl-4965-rs.c |   47 ++++++----------------------
 2 files changed, 17 insertions(+), 74 deletions(-)
drivers/net/wireless/iwlwifi/iwl-3945-rs.c +7 -37
index adcd106..022cea0 100644
@@ -560,22 +560,6 @@ static void rs_tx_status(void *priv_rate,
 	return;
 }
 
-static struct ieee80211_rate *iwl3945_get_lowest_rate(struct ieee80211_local
-						  *local)
-{
-	struct ieee80211_hw_mode *mode = local->oper_hw_mode;
-	int i;
-
-	for (i = 0; i < mode->num_rates; i++) {
-		struct ieee80211_rate *rate = &mode->rates[i];
-
-		if (rate->flags & IEEE80211_RATE_SUPPORTED)
-			return rate;
-	}
-
-	return &mode->rates[0];
-}
-
 static u16 iwl3945_get_adjacent_rate(struct iwl3945_rate_scale_priv *rs_priv,
 				 u8 index, u16 rate_mask, int phymode)
 {
@@ -654,10 +638,9 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rate_scale_priv *rs_priv,
  * rate table and must reference the driver allocated rate table
  *
  */
-static struct ieee80211_rate *rs_get_rate(void *priv_rate,
-					  struct net_device *dev,
-					  struct sk_buff *skb,
-					  struct rate_control_extra *extra)
+static void rs_get_rate(void *priv_rate, struct net_device *dev,
+			struct ieee80211_hw_mode *mode, struct sk_buff *skb,
+			struct rate_selection *sel)
 {
 	u8 low = IWL_RATE_INVALID;
 	u8 high = IWL_RATE_INVALID;
@@ -674,32 +657,19 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate,
 	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
 	struct sta_info *sta;
-	u16 fc, rate_mask;
+	u16 rate_mask;
 	struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate;
 	DECLARE_MAC_BUF(mac);
 
 	IWL_DEBUG_RATE("enter\n");
 
-	memset(extra, 0, sizeof(*extra));
-
-	fc = le16_to_cpu(hdr->frame_control);
-	if (((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) ||
-	    (is_multicast_ether_addr(hdr->addr1))) {
-		/* Send management frames and broadcast/multicast data using
-		 * lowest rate. */
-		/* TODO: this could probably be improved.. */
-		IWL_DEBUG_RATE("leave: lowest rate (not data or is "
-			       "multicast)\n");
-
-		return iwl3945_get_lowest_rate(local);
-	}
-
 	sta = sta_info_get(local, hdr->addr1);
 	if (!sta || !sta->rate_ctrl_priv) {
 		IWL_DEBUG_RATE("leave: No STA priv data to update!\n");
+		sel->rate = rate_lowest(local, local->oper_hw_mode, sta);
 		if (sta)
 			sta_info_put(sta);
-		return NULL;
+		return;
 	}
 
 	rate_mask = sta->supp_rates;
@@ -844,7 +814,7 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate,
 
 	IWL_DEBUG_RATE("leave: %d\n", index);
 
-	return &priv->ieee_rates[index];
+	sel->rate = &priv->ieee_rates[index];
 }
 
 static struct rate_control_ops rs_ops = {
drivers/net/wireless/iwlwifi/iwl-4965-rs.c +10 -37

76 lines not on this page · raw message

Signature · 1 line
1.5.3.4
#9 lore raw

Re: [PATCH 2/4] iwlwifi: Update to changed mac80211 rate control interface

Quoted 3 lines · On Sat, 08 Dec 2007 12:21:51 +0100 Mattias Nissler <[email protected]>…

This brings iwlwifi rate control code back in sync with mac80211.

It doesn't apply:

Review static struct ieee80211_rate *rs_get_rate(void *priv_rate, · line 657

Quoted 2 lines
(quoted diff) +0 -0
@@ -674,32 +657,19 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate,
 	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);

struct ieee80211_conf *conf = &local->hw.conf;

Review static struct ieee80211_rate *rs_get_rate(void *priv_rate, · line 658

Quoted 1 line
(quoted diff) +0 -0
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;

--
Ciao
Stefano

#10 lore raw

Re: [PATCH 2/4] iwlwifi: Update to changed mac80211 rate control interface

for any non data frame we should use the lowest rate. the firmware might not like it if higher rate been used. I just checked out latest of mac80211 the rate scaling functions have not changed with this patch it wont work.
Mohamed

Quoted 25 lines · Stefano Brivio
Quoted 3 lines · On Sat, 08 Dec 2007 12:21:51 +0100 Mattias Nissler <[email protected]>…

This brings iwlwifi rate control code back in sync with mac80211.

It doesn't apply:

Review static struct ieee80211_rate *rs_get_rate(void *priv_rate, · line 657

Quoted 2 lines
(quoted diff) +0 -0
@@ -674,32 +657,19 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate,
      struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);

struct ieee80211_conf *conf = &local->hw.conf;

Review static struct ieee80211_rate *rs_get_rate(void *priv_rate, · line 658

Quoted 1 line
(quoted diff) +0 -0
      struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;

--
Ciao
Stefano
-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw

Re: [PATCH 2/4] iwlwifi: Update to changed mac80211 rate control interface

Quoted 2 lines · On Tuesday 11 December 2007 22:10:38 mohamed salim abbas wrote:

for any non data frame we should use the lowest rate. the firmware might not like it if higher rate been used.

Why not fix the firmware?

Signature · 1 line
Greetings Michael.
#12 lore raw

Re: [PATCH 2/4] iwlwifi: Update to changed mac80211 rate control interface

In reply to mohamed salim abbas
Quoted 4 lines · mohamed salim abbas

for any non data frame we should use the lowest rate. the firmware might not like it if higher rate been used. I just checked out latest of mac80211 the rate scaling functions have not changed with this patch it wont work.

Note that the patch shouldn't change iwlwifi's rate control behaviour. So if it breaks iwlwifi, I have a bug in my patch. Have you applied the complete patchset? The selection of the lowest rate for non-data frames is moved into mac80211 in the first patch of the series.

Mattias

#13 lore raw

Re: [PATCH 2/4] iwlwifi: Update to changed mac80211 rate control interface

In reply to mohamed salim abbas
Quoted 4 lines · On Tue, 11 Dec 2007 13:10:38 -0800 "mohamed salim abbas"…

for any non data frame we should use the lowest rate. the firmware might not like it if higher rate been used. I just checked out latest of mac80211 the rate scaling functions have not changed with this patch it wont work.

Please:
1) don't do top-posting;
2) reply to the appropriate message.

Signature · 2 lines
Ciao
Stefano
#14 lore raw

PATCH 3/4 mac80211: Add PID TX rate control algorithm

In reply to a message not in the archive

Add a new rate control algorithm based on a PID controller. It samples the percentage of failed frames over time, feeds the result into the controller and uses it's output to control the TX rate.

---
 net/mac80211/Kconfig          |   12 ++
 net/mac80211/Makefile         |    1 +
 net/mac80211/ieee80211.c      |   27 +++-
 net/mac80211/ieee80211_rate.h |    3 +
 net/mac80211/rc80211_pid.c    |  368 +++++++++++++++++++++++++++++++++++++++++
 5 files changed, 406 insertions(+), 5 deletions(-)
 create mode 100644 net/mac80211/rc80211_pid.c
net/mac80211/Kconfig +12 -0
index ce176e6..ebe3360 100644
@@ -25,6 +25,18 @@ config MAC80211_RCSIMPLE
 	  Say Y unless you know you will have another algorithm
 	  available.
 
+config MAC80211_RCPID
+	bool "'PID' rate control algorithm" if EMBEDDED
+	default y
+	depends on MAC80211
+	help
+	  This option enables a TX rate control algorithm for
+	  mac80211 that uses a PID controller to select the TX
+	  rate.
+
+	  Say Y unless you're sure you want to use a different
+	  rate control algorithm.
+
 config MAC80211_LEDS
 	bool "Enable LED triggers"
 	depends on MAC80211 && LEDS_TRIGGERS
net/mac80211/Makefile +1 -0
index 1e6237b..62c01ca 100644
@@ -4,6 +4,7 @@ mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o
 mac80211-objs-$(CONFIG_MAC80211_DEBUGFS) += debugfs.o debugfs_sta.o debugfs_netdev.o debugfs_key.o
 mac80211-objs-$(CONFIG_NET_SCHED) += wme.o
 mac80211-objs-$(CONFIG_MAC80211_RCSIMPLE) += rc80211_simple.o
+mac80211-objs-$(CONFIG_MAC80211_RCPID) += rc80211_pid.o
 
 mac80211-objs := \
 	ieee80211.o \
net/mac80211/ieee80211.c +22 -5
index 59350b8..62eaed4 100644
@@ -1260,23 +1260,37 @@ static int __init ieee80211_init(void)
 #ifdef CONFIG_MAC80211_RCSIMPLE
 	ret = ieee80211_rate_control_register(&mac80211_rcsimple);
 	if (ret)
-		return ret;
+		goto fail;
+#endif
+
+#ifdef CONFIG_MAC80211_RCPID
+	ret = ieee80211_rate_control_register(&mac80211_rcpid);
+	if (ret)
+		goto fail;
 #endif
 
 	ret = ieee80211_wme_register();
 	if (ret) {
-#ifdef CONFIG_MAC80211_RCSIMPLE
-		ieee80211_rate_control_unregister(&mac80211_rcsimple);
-#endif
 		printk(KERN_DEBUG "ieee80211_init: failed to "
 		       "initialize WME (err=%d)\n", ret);
-		return ret;
+		goto fail;
 	}
 
 	ieee80211_debugfs_netdev_init();
 	ieee80211_regdomain_init();
 
 	return 0;
+
+fail:
+
+#ifdef CONFIG_MAC80211_RCSIMPLE
+	ieee80211_rate_control_unregister(&mac80211_rcsimple);
+#endif
+#ifdef CONFIG_MAC80211_RCPID
+	ieee80211_rate_control_unregister(&mac80211_rcpid);
+#endif
+
+	return ret;
 }
 
 static void __exit ieee80211_exit(void)
@@ -1284,6 +1298,9 @@ static void __exit ieee80211_exit(void)
 #ifdef CONFIG_MAC80211_RCSIMPLE
 	ieee80211_rate_control_unregister(&mac80211_rcsimple);
 #endif
+#ifdef CONFIG_MAC80211_RCPID
+	ieee80211_rate_control_unregister(&mac80211_rcpid);
+#endif
 
 	ieee80211_wme_unregister();
 	ieee80211_debugfs_netdev_exit();
net/mac80211/ieee80211_rate.h +3 -0
index ceb7783..8520184 100644
@@ -61,6 +61,9 @@ struct rate_control_ref {
 /* default 'simple' algorithm */
 extern struct rate_control_ops mac80211_rcsimple;
 
+/* 'PID' algorithm */
+extern struct rate_control_ops mac80211_rcpid;
+
 int ieee80211_rate_control_register(struct rate_control_ops *ops);
 void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
 
net/mac80211/rc80211_pid.c new file +368 -0

368 lines not on this page · raw message

Signature · 1 line
1.5.3.4
#15 lore raw

PATCH 4/4 mac80211: Make PID rate control the default and remove rc80211_simple

In reply to a message not in the archive

This makes the new PID TX rate control algorithm the default and removes the old rc80211_simple rate control algorithm. The simple algorithm was flawed in several ways: It wasn't responsive at all and didn't age the information it was relying on properly. The PID algorithm allows us to tune characteristics such as responsiveness by adjusting parameters and was found to generally behave better.

---
 net/mac80211/Kconfig          |   12 --
 net/mac80211/Makefile         |    1 -
 net/mac80211/ieee80211.c      |   12 --
 net/mac80211/ieee80211_rate.c |    2 +-
 net/mac80211/ieee80211_rate.h |    3 -
 net/mac80211/rc80211_simple.c |  366 -----------------------------------------
 6 files changed, 1 insertions(+), 395 deletions(-)
 delete mode 100644 net/mac80211/rc80211_simple.c
net/mac80211/Kconfig +0 -12
index ebe3360..825dd0f 100644
@@ -13,18 +13,6 @@ config MAC80211
 	This option enables the hardware independent IEEE 802.11
 	networking stack.
 
-config MAC80211_RCSIMPLE
-	bool "'simple' rate control algorithm" if EMBEDDED
-	default y
-	depends on MAC80211
-	help
-	  This option allows you to turn off the 'simple' rate
-	  control algorithm in mac80211. If you do turn it off,
-	  you absolutely need another rate control algorithm.
-
-	  Say Y unless you know you will have another algorithm
-	  available.
-
 config MAC80211_RCPID
 	bool "'PID' rate control algorithm" if EMBEDDED
 	default y
net/mac80211/Makefile +0 -1
index 62c01ca..0b5bd12 100644
@@ -3,7 +3,6 @@ obj-$(CONFIG_MAC80211) += mac80211.o
 mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o
 mac80211-objs-$(CONFIG_MAC80211_DEBUGFS) += debugfs.o debugfs_sta.o debugfs_netdev.o debugfs_key.o
 mac80211-objs-$(CONFIG_NET_SCHED) += wme.o
-mac80211-objs-$(CONFIG_MAC80211_RCSIMPLE) += rc80211_simple.o
 mac80211-objs-$(CONFIG_MAC80211_RCPID) += rc80211_pid.o
 
 mac80211-objs := \
net/mac80211/ieee80211.c +0 -12
index 62eaed4..5d36ff8 100644
@@ -1257,12 +1257,6 @@ static int __init ieee80211_init(void)
 
 	BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb));
 
-#ifdef CONFIG_MAC80211_RCSIMPLE
-	ret = ieee80211_rate_control_register(&mac80211_rcsimple);
-	if (ret)
-		goto fail;
-#endif
-
 #ifdef CONFIG_MAC80211_RCPID
 	ret = ieee80211_rate_control_register(&mac80211_rcpid);
 	if (ret)
@@ -1283,9 +1277,6 @@ static int __init ieee80211_init(void)
 
 fail:
 
-#ifdef CONFIG_MAC80211_RCSIMPLE
-	ieee80211_rate_control_unregister(&mac80211_rcsimple);
-#endif
 #ifdef CONFIG_MAC80211_RCPID
 	ieee80211_rate_control_unregister(&mac80211_rcpid);
 #endif
@@ -1295,9 +1286,6 @@ fail:
 
 static void __exit ieee80211_exit(void)
 {
-#ifdef CONFIG_MAC80211_RCSIMPLE
-	ieee80211_rate_control_unregister(&mac80211_rcsimple);
-#endif
 #ifdef CONFIG_MAC80211_RCPID
 	ieee80211_rate_control_unregister(&mac80211_rcpid);
 #endif
net/mac80211/ieee80211_rate.c +1 -1
index a2f8d64..9e7580c 100644
@@ -96,7 +96,7 @@ ieee80211_rate_control_ops_get(const char *name)
 	struct rate_control_ops *ops;
 
 	if (!name)
-		name = "simple";
+		name = "pid";
 
 	ops = ieee80211_try_rate_control_ops_get(name);
 	if (!ops) {
net/mac80211/ieee80211_rate.h +0 -3
index 8520184..643705c 100644
@@ -58,9 +58,6 @@ struct rate_control_ref {
 	struct kref kref;
 };
 
-/* default 'simple' algorithm */
-extern struct rate_control_ops mac80211_rcsimple;
-
 /* 'PID' algorithm */
 extern struct rate_control_ops mac80211_rcpid;
 
net/mac80211/rc80211_simple.c deleted +0 -366

366 lines not on this page · raw message

Signature · 1 line
1.5.3.4