* [PATCH 1/4] mac80211: Clean up rate selection
[not found] <1197112439.7472.34.camel@localhost>
@ 2007-12-08 11:21 ` Mattias Nissler
2007-12-08 11:29 ` Johannes Berg
2007-12-08 11:21 ` [PATCH 2/4] iwlwifi: Update to changed mac80211 rate control interface Mattias Nissler
` (2 subsequent siblings)
3 siblings, 1 reply; 15+ messages in thread
From: Mattias Nissler @ 2007-12-08 11:21 UTC (permalink / raw)
To: linux-wireless; +Cc: Stefano Brivio, John W. Linville, Johannes Berg
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.
Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de>
---
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(-)
diff --git a/net/mac80211/ieee80211_rate.c b/net/mac80211/ieee80211_rate.c
index 7254bd6..a2f8d64 100644
--- a/net/mac80211/ieee80211_rate.c
+++ b/net/mac80211/ieee80211_rate.c
@@ -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);
diff --git a/net/mac80211/ieee80211_rate.h b/net/mac80211/ieee80211_rate.h
index 2368813..ceb7783 100644
--- a/net/mac80211/ieee80211_rate.h
+++ b/net/mac80211/ieee80211_rate.h
@@ -18,31 +18,24 @@
#include "ieee80211_i.h"
#include "sta_info.h"
-#define RATE_CONTROL_NUM_DOWN 20
-#define RATE_CONTROL_NUM_UP 15
-
-
-struct rate_control_extra {
- /* values from rate_control_get_rate() to the caller: */
- struct ieee80211_rate *probe; /* probe with this rate, or NULL for no
- * probing */
+struct rate_selection {
+ /* Selected transmission rate */
+ struct ieee80211_rate *rate;
+ /* Non-ERP rate to use if mac80211 decides it cannot use an ERP rate */
struct ieee80211_rate *nonerp;
-
- /* parameters from the caller to rate_control_get_rate(): */
- struct ieee80211_hw_mode *mode;
- u16 ethertype;
+ /* probe with this rate, or NULL for no probing */
+ struct ieee80211_rate *probe;
};
-
struct rate_control_ops {
struct module *module;
const char *name;
void (*tx_status)(void *priv, struct net_device *dev,
struct sk_buff *skb,
struct ieee80211_tx_status *status);
- struct ieee80211_rate *(*get_rate)(void *priv, struct net_device *dev,
- struct sk_buff *skb,
- struct rate_control_extra *extra);
+ void (*get_rate)(void *priv, struct net_device *dev,
+ struct ieee80211_hw_mode *mode, struct sk_buff *skb,
+ struct rate_selection *sel);
void (*rate_init)(void *priv, void *priv_sta,
struct ieee80211_local *local, struct sta_info *sta);
void (*clear)(void *priv);
@@ -75,6 +68,9 @@ void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
* first available algorithm. */
struct rate_control_ref *rate_control_alloc(const char *name,
struct ieee80211_local *local);
+void rate_control_get_rate(struct net_device *dev,
+ struct ieee80211_hw_mode *mode, struct sk_buff *skb,
+ struct rate_selection *sel);
struct rate_control_ref *rate_control_get(struct rate_control_ref *ref);
void rate_control_put(struct rate_control_ref *ref);
@@ -88,15 +84,6 @@ static inline void rate_control_tx_status(struct ieee80211_local *local,
}
-static inline struct ieee80211_rate *
-rate_control_get_rate(struct ieee80211_local *local, struct net_device *dev,
- struct sk_buff *skb, struct rate_control_extra *extra)
-{
- struct rate_control_ref *ref = local->rate_ctrl;
- return ref->ops->get_rate(ref->priv, dev, skb, extra);
-}
-
-
static inline void rate_control_rate_init(struct sta_info *sta,
struct ieee80211_local *local)
{
@@ -142,6 +129,37 @@ static inline void rate_control_remove_sta_debugfs(struct sta_info *sta)
#endif
}
+static inline int
+rate_supported(struct sta_info *sta, struct ieee80211_hw_mode *mode, int index)
+{
+ return (sta == NULL || sta->supp_rates & BIT(index)) &&
+ (mode->rates[index].flags & IEEE80211_RATE_SUPPORTED);
+}
+
+static inline int
+rate_lowest_index(struct ieee80211_local *local, struct ieee80211_hw_mode *mode,
+ struct sta_info *sta)
+{
+ int i;
+
+ for (i = 0; i < mode->num_rates; i++) {
+ if (rate_supported(sta, mode, i))
+ return i;
+ }
+
+ /* warn when we cannot find a rate. */
+ WARN_ON(i == 0);
+
+ return 0;
+}
+
+static inline struct ieee80211_rate *
+rate_lowest(struct ieee80211_local *local, struct ieee80211_hw_mode *mode,
+ struct sta_info *sta)
+{
+ return &mode->rates[rate_lowest_index(local, mode, sta)];
+}
+
/* functions for rate control related to a device */
int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 2a321f0..e55a9f4 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -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;
diff --git a/net/mac80211/rc80211_simple.c b/net/mac80211/rc80211_simple.c
index da72737..c1c8b76 100644
--- a/net/mac80211/rc80211_simple.c
+++ b/net/mac80211/rc80211_simple.c
@@ -23,6 +23,8 @@
/* This is a minimal implementation of TX rate controlling that can be used
* as the default when no improved mechanisms are available. */
+#define RATE_CONTROL_NUM_DOWN 20
+#define RATE_CONTROL_NUM_UP 15
#define RATE_CONTROL_EMERG_DEC 2
#define RATE_CONTROL_INTERVAL (HZ / 20)
@@ -87,26 +89,6 @@ static void rate_control_rate_dec(struct ieee80211_local *local,
}
}
-
-static struct ieee80211_rate *
-rate_control_lowest_rate(struct ieee80211_local *local,
- struct ieee80211_hw_mode *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;
- }
-
- printk(KERN_DEBUG "rate_control_lowest_rate - no supported rates "
- "found\n");
- return &mode->rates[0];
-}
-
-
struct global_rate_control {
int dummy;
};
@@ -216,56 +198,32 @@ static void rate_control_simple_tx_status(void *priv, struct net_device *dev,
}
-static struct ieee80211_rate *
+static void
rate_control_simple_get_rate(void *priv, struct net_device *dev,
+ struct ieee80211_hw_mode *mode,
struct sk_buff *skb,
- struct rate_control_extra *extra)
+ struct rate_selection *sel)
{
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
- struct ieee80211_sub_if_data *sdata;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
- struct ieee80211_hw_mode *mode = extra->mode;
struct sta_info *sta;
- int rateidx, nonerp_idx;
- u16 fc;
-
- memset(extra, 0, sizeof(*extra));
-
- fc = le16_to_cpu(hdr->frame_control);
- if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
- (hdr->addr1[0] & 0x01)) {
- /* Send management frames and broadcast/multicast data using
- * lowest rate. */
- /* TODO: this could probably be improved.. */
- return rate_control_lowest_rate(local, mode);
- }
+ int rateidx;
sta = sta_info_get(local, hdr->addr1);
- if (!sta)
- return rate_control_lowest_rate(local, mode);
-
- sdata = IEEE80211_DEV_TO_SUB_IF(dev);
- if (sdata->bss && sdata->bss->force_unicast_rateidx > -1)
- sta->txrate = sdata->bss->force_unicast_rateidx;
+ if (!sta) {
+ sel->rate = rate_lowest(local, mode, NULL);
+ return;
+ }
rateidx = sta->txrate;
if (rateidx >= mode->num_rates)
rateidx = mode->num_rates - 1;
- sta->last_txrate = rateidx;
- nonerp_idx = rateidx;
- while (nonerp_idx > 0 &&
- ((mode->rates[nonerp_idx].flags & IEEE80211_RATE_ERP) ||
- !(mode->rates[nonerp_idx].flags & IEEE80211_RATE_SUPPORTED) ||
- !(sta->supp_rates & BIT(nonerp_idx))))
- nonerp_idx--;
- extra->nonerp = &mode->rates[nonerp_idx];
-
sta_info_put(sta);
- return &mode->rates[rateidx];
+ sel->rate = &mode->rates[rateidx];
}
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 9ccf4b5..0ccc03d 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -567,21 +567,17 @@ ieee80211_tx_h_encrypt(struct ieee80211_txrx_data *tx)
static ieee80211_txrx_result
ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx)
{
- struct rate_control_extra extra;
+ struct rate_selection rsel;
if (likely(!tx->u.tx.rate)) {
- memset(&extra, 0, sizeof(extra));
- extra.mode = tx->u.tx.mode;
- extra.ethertype = tx->ethertype;
-
- tx->u.tx.rate = rate_control_get_rate(tx->local, tx->dev,
- tx->skb, &extra);
- if (unlikely(extra.probe != NULL)) {
+ rate_control_get_rate(tx->dev, tx->u.tx.mode, tx->skb, &rsel);
+ tx->u.tx.rate = rsel.rate;
+ if (unlikely(rsel.probe != NULL)) {
tx->u.tx.control->flags |=
IEEE80211_TXCTL_RATE_CTRL_PROBE;
tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG;
tx->u.tx.control->alt_retry_rate = tx->u.tx.rate->val;
- tx->u.tx.rate = extra.probe;
+ tx->u.tx.rate = rsel.probe;
} else
tx->u.tx.control->alt_retry_rate = -1;
@@ -592,14 +588,14 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx)
if (tx->u.tx.mode->mode == MODE_IEEE80211G &&
(tx->sdata->flags & IEEE80211_SDATA_USE_PROTECTION) &&
- (tx->flags & IEEE80211_TXRXD_FRAGMENTED) && extra.nonerp) {
+ (tx->flags & IEEE80211_TXRXD_FRAGMENTED) && rsel.nonerp) {
tx->u.tx.last_frag_rate = tx->u.tx.rate;
- if (extra.probe)
+ if (rsel.probe)
tx->flags &= ~IEEE80211_TXRXD_TXPROBE_LAST_FRAG;
else
tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG;
- tx->u.tx.rate = extra.nonerp;
- tx->u.tx.control->rate = extra.nonerp;
+ tx->u.tx.rate = rsel.nonerp;
+ tx->u.tx.control->rate = rsel.nonerp;
tx->u.tx.control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE;
} else {
tx->u.tx.last_frag_rate = tx->u.tx.rate;
@@ -1665,8 +1661,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id,
struct net_device *bdev;
struct ieee80211_sub_if_data *sdata = NULL;
struct ieee80211_if_ap *ap = NULL;
- struct ieee80211_rate *rate;
- struct rate_control_extra extra;
+ struct rate_selection rsel;
u8 *b_head, *b_tail;
int bh_len, bt_len;
@@ -1710,14 +1705,13 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id,
}
if (control) {
- memset(&extra, 0, sizeof(extra));
- extra.mode = local->oper_hw_mode;
-
- rate = rate_control_get_rate(local, local->mdev, skb, &extra);
- if (!rate) {
+ rate_control_get_rate(local->mdev, local->oper_hw_mode, skb,
+ &rsel);
+ if (!rsel.rate) {
if (net_ratelimit()) {
- printk(KERN_DEBUG "%s: ieee80211_beacon_get: no rate "
- "found\n", wiphy_name(local->hw.wiphy));
+ printk(KERN_DEBUG "%s: ieee80211_beacon_get: "
+ "no rate found\n",
+ wiphy_name(local->hw.wiphy));
}
dev_kfree_skb(skb);
return NULL;
@@ -1725,8 +1719,8 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id,
control->tx_rate =
((sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE) &&
- (rate->flags & IEEE80211_RATE_PREAMBLE2)) ?
- rate->val2 : rate->val;
+ (rsel.rate->flags & IEEE80211_RATE_PREAMBLE2)) ?
+ rsel.rate->val2 : rsel.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;
--
1.5.3.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/4] iwlwifi: Update to changed mac80211 rate control interface
[not found] <1197112439.7472.34.camel@localhost>
2007-12-08 11:21 ` [PATCH 1/4] mac80211: Clean up rate selection Mattias Nissler
@ 2007-12-08 11:21 ` Mattias Nissler
2007-12-08 13:19 ` Stefano Brivio
2007-12-08 11:21 ` [PATCH 3/4] mac80211: Add PID TX rate control algorithm Mattias Nissler
2007-12-08 11:21 ` [PATCH 4/4] mac80211: Make PID rate control the default and remove rc80211_simple Mattias Nissler
3 siblings, 1 reply; 15+ messages in thread
From: Mattias Nissler @ 2007-12-08 11:21 UTC (permalink / raw)
To: linux-wireless; +Cc: Stefano Brivio, John W. Linville, Johannes Berg
This brings iwlwifi rate control code back in sync with mac80211.
Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de>
---
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(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index adcd106..022cea0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -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 = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
index 4b6aa96..4455a5f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -1667,55 +1667,26 @@ static void rs_initialize_lq(struct iwl4965_priv *priv,
return;
}
-static struct ieee80211_rate *rs_get_lowest_rate(struct ieee80211_local
- *local)
+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)
{
- 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 struct ieee80211_rate *rs_get_rate(void *priv_rate,
- struct net_device *dev,
- struct sk_buff *skb,
- struct rate_control_extra
- *extra)
-{
-
int i;
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct sta_info *sta;
- u16 fc;
struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate;
struct iwl4965_rate_scale_priv *lq;
IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n");
- memset(extra, 0, sizeof(*extra));
-
- fc = le16_to_cpu(hdr->frame_control);
- if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1)) {
- /* Send management frames and broadcast/multicast data using
- * lowest rate. */
- /* TODO: this could probably be improved.. */
- return rs_get_lowest_rate(local);
- }
-
sta = sta_info_get(local, hdr->addr1);
if (!sta || !sta->rate_ctrl_priv) {
+ sel->rate = rate_lowest(local, local->oper_hw_mode, sta);
if (sta)
sta_info_put(sta);
- return rs_get_lowest_rate(local);
+ return;
}
lq = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv;
@@ -1742,11 +1713,13 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate,
}
done:
+ if ((i < 0) || (i > IWL_RATE_COUNT)) {
+ sel->rate = rate_lowest(local, local->oper_hw_mode, sta);
+ return;
+ }
sta_info_put(sta);
- if ((i < 0) || (i > IWL_RATE_COUNT))
- return rs_get_lowest_rate(local);
- return &priv->ieee_rates[i];
+ sel->rate = &priv->ieee_rates[i];
}
static void *rs_alloc_sta(void *priv, gfp_t gfp)
--
1.5.3.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 3/4] mac80211: Add PID TX rate control algorithm
[not found] <1197112439.7472.34.camel@localhost>
2007-12-08 11:21 ` [PATCH 1/4] mac80211: Clean up rate selection Mattias Nissler
2007-12-08 11:21 ` [PATCH 2/4] iwlwifi: Update to changed mac80211 rate control interface Mattias Nissler
@ 2007-12-08 11:21 ` Mattias Nissler
2007-12-08 11:21 ` [PATCH 4/4] mac80211: Make PID rate control the default and remove rc80211_simple Mattias Nissler
3 siblings, 0 replies; 15+ messages in thread
From: Mattias Nissler @ 2007-12-08 11:21 UTC (permalink / raw)
To: linux-wireless; +Cc: Stefano Brivio, John W. Linville, Johannes Berg
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.
Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de>
---
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
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index ce176e6..ebe3360 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -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
diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile
index 1e6237b..62c01ca 100644
--- a/net/mac80211/Makefile
+++ b/net/mac80211/Makefile
@@ -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 \
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 59350b8..62eaed4 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -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();
diff --git a/net/mac80211/ieee80211_rate.h b/net/mac80211/ieee80211_rate.h
index ceb7783..8520184 100644
--- a/net/mac80211/ieee80211_rate.h
+++ b/net/mac80211/ieee80211_rate.h
@@ -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);
diff --git a/net/mac80211/rc80211_pid.c b/net/mac80211/rc80211_pid.c
new file mode 100644
index 0000000..c1a39ef
--- /dev/null
+++ b/net/mac80211/rc80211_pid.c
@@ -0,0 +1,368 @@
+/*
+ * Copyright 2002-2005, Instant802 Networks, Inc.
+ * Copyright 2005, Devicescape Software, Inc.
+ * Copyright 2007, Mattias Nissler <mattias.nissler@gmx.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/netdevice.h>
+#include <linux/types.h>
+#include <linux/skbuff.h>
+
+#include <net/mac80211.h>
+#include "ieee80211_rate.h"
+
+
+/* This is an implementation of TX rate control algorithm that uses a PID
+ * controller. Given a target failed frames rate, the controller decides about
+ * TX rate changes to meet the target failed frames rate.
+ *
+ * The controller basically computes the following:
+ *
+ * adj = CP * err + CI * err_avg + CD * (err - last_err)
+ *
+ * where
+ * adj adjustment value that is used to switch TX rate (see below)
+ * err current error: target vs. current failed frames percentage
+ * last_err last error
+ * err_avg average (i.e. poor man's integral) of recent errors
+ * CP Proportional coefficient
+ * CI Integral coefficient
+ * CD Derivative coefficient
+ *
+ * CP, CI, CD are subject to careful tuning.
+ *
+ * The integral component uses a exponential moving average approach instead of
+ * an actual sliding window. Advantage is that we don't need to keep an array of
+ * the last N error values and computation is easier.
+ *
+ * Once we have the adj value, we need to map it to a TX rate to be selected.
+ * For now, we depend on the rates to be ordered in a way such that more robust
+ * rates (i.e. such that exhibit a lower framed failed percentage) come first.
+ * E.g. for the 802.11b/g case, we first have the b rates in ascending order,
+ * then the g rates. The adj simply decides the index of the TX rate in the list
+ * to switch to (relative to the current TX rate entry).
+ *
+ * Note that for the computations we use a fixed-point representation to avoid
+ * floating point arithmetic. Hence, all values are shifted left by
+ * RC_PID_ARITH_SHIFT.
+ */
+
+/* Sampling frequency for measuring percentage of failed frames. */
+#define RC_PID_INTERVAL (HZ / 1)
+
+/* Exponential averaging smoothness (used for I part of PID controller) */
+#define RC_PID_SMOOTHING_SHIFT 3
+#define RC_PID_SMOOTHING (1 << RC_PID_SMOOTHING_SHIFT)
+
+/* Fixed point arithmetic shifting amount. */
+#define RC_PID_ARITH_SHIFT 8
+
+/* Fixed point arithmetic factor. */
+#define RC_PID_ARITH_FACTOR (1 << RC_PID_ARITH_SHIFT)
+
+/* Proportional PID component coefficient. */
+#define RC_PID_COEFF_P 15
+/* Integral PID component coefficient. */
+#define RC_PID_COEFF_I 10
+/* Derivative PID component coefficient. */
+#define RC_PID_COEFF_D 15
+
+/* Target failed frames rate for the PID controller. NB: This effectively gives
+ * maximum failed frames percentage we're willing to accept. If communication is
+ * good, the controller will fail to adjust failed frames percentage to the
+ * target. This is intentional.
+ */
+#define RC_PID_TARGET_PF (20 << RC_PID_ARITH_SHIFT)
+
+struct rc_pid_sta_info {
+ unsigned long last_change;
+ unsigned long last_sample;
+
+ u32 tx_num_failed;
+ u32 tx_num_xmit;
+
+ /* Average failed frames percentage error (i.e. actual vs. target
+ * percentage), scaled by RC_PID_SMOOTHING. This value is a
+ * smoothed by using a exponentail weighted average technique:
+ *
+ * (SMOOTHING - 1) * err_avg_old + err
+ * err_avg = -----------------------------------
+ * SMOOTHING
+ *
+ * where err_avg is the new approximation, err_avg_old the previous one
+ * and err is the error w.r.t. to the current failed frames percentage
+ * sample. Note that the bigger SMOOTHING the more weight is given to
+ * the previous estimate, resulting in smoother behavior (i.e.
+ * corresponding to a longer integration window).
+ *
+ * For computation, we actually don't use the above formula, but this
+ * one:
+ *
+ * err_avg_scaled = err_avg_old_scaled - err_avg_old + err
+ *
+ * where:
+ * err_avg_scaled = err * SMOOTHING
+ * err_avg_old_scaled = err_avg_old * SMOOTHING
+ *
+ * This avoids floating point numbers and the per_failed_old value can
+ * easily be obtained by shifting per_failed_old_scaled right by
+ * RC_PID_SMOOTHING_SHIFT.
+ */
+ s32 err_avg_sc;
+
+ /* Last framed failes percentage sample */
+ u32 last_pf;
+};
+
+/* Algorithm parameters. We keep them on a per-algorithm approach, so they can
+ * be tuned individually for each interface.
+ */
+struct rc_pid_info {
+
+ /* The failed frames percentage target. */
+ u32 target;
+
+ /* P, I and D coefficients. */
+ s32 coeff_p;
+ s32 coeff_i;
+ s32 coeff_d;
+};
+
+
+static void rate_control_pid_adjust_rate(struct ieee80211_local *local,
+ struct sta_info *sta, int adj)
+{
+ struct ieee80211_sub_if_data *sdata;
+ struct ieee80211_hw_mode *mode;
+ int newidx = sta->txrate + adj;
+ int maxrate;
+ int back = (adj > 0) ? 1 : -1;
+
+ sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
+ if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) {
+ /* forced unicast rate - do not change STA rate */
+ return;
+ }
+
+ mode = local->oper_hw_mode;
+ maxrate = sdata->bss ? sdata->bss->max_ratectrl_rateidx : -1;
+
+ if (newidx < 0)
+ newidx = 0;
+ else if (newidx >= mode->num_rates)
+ newidx = mode->num_rates - 1;
+
+ while (newidx != sta->txrate) {
+ if (rate_supported(sta, mode, newidx) &&
+ (maxrate < 0 || newidx <= maxrate)) {
+ sta->txrate = newidx;
+ break;
+ }
+
+ newidx += back;
+ }
+}
+
+static void rate_control_pid_sample(struct rc_pid_info *pinfo,
+ struct ieee80211_local *local,
+ struct sta_info *sta)
+{
+ struct rc_pid_sta_info *spinfo = sta->rate_ctrl_priv;
+ u32 pf;
+ s32 err_avg;
+ s32 err_prop;
+ s32 err_int;
+ s32 err_der;
+ int adj;
+
+ spinfo = sta->rate_ctrl_priv;
+ spinfo->last_sample = jiffies;
+
+ /* If no frames were transmitted, we assume the old sample is
+ * still a good measurement and copy it. */
+ if (spinfo->tx_num_xmit == 0)
+ pf = spinfo->last_pf;
+ else {
+ pf = spinfo->tx_num_failed * 100 / spinfo->tx_num_xmit;
+ pf <<= RC_PID_ARITH_SHIFT;
+
+ spinfo->tx_num_xmit = 0;
+ spinfo->tx_num_failed = 0;
+ }
+
+ /* Compute the proportional, integral and derivative errors. */
+ err_prop = RC_PID_TARGET_PF - pf;
+
+ err_avg = spinfo->err_avg_sc >> RC_PID_SMOOTHING_SHIFT;
+ spinfo->err_avg_sc = spinfo->err_avg_sc - err_avg + err_prop;
+ err_int = spinfo->err_avg_sc >> RC_PID_SMOOTHING_SHIFT;
+
+ err_der = pf - spinfo->last_pf;
+ spinfo->last_pf = pf;
+
+ /* Compute the controller output. */
+ adj = (err_prop * pinfo->coeff_p + err_int * pinfo->coeff_i
+ + err_der * pinfo->coeff_d);
+
+ /* We need to do an arithmetic right shift. ISO C says this is
+ * implementation defined for negative left operands. Hence, be
+ * careful to get it right, also for negative values. */
+ adj = (adj < 0) ? -((-adj) >> (2 * RC_PID_ARITH_SHIFT)) :
+ adj >> (2 * RC_PID_ARITH_SHIFT);
+
+ /* Change rate. */
+ if (adj)
+ rate_control_pid_adjust_rate(local, sta, adj);
+}
+
+static void rate_control_pid_tx_status(void *priv, struct net_device *dev,
+ struct sk_buff *skb,
+ struct ieee80211_tx_status *status)
+{
+ struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+ struct rc_pid_info *pinfo = priv;
+ struct sta_info *sta;
+ struct rc_pid_sta_info *spinfo;
+
+ sta = sta_info_get(local, hdr->addr1);
+
+ if (!sta)
+ return;
+
+ spinfo = sta->rate_ctrl_priv;
+ spinfo->tx_num_xmit++;
+
+ /* We count frames that totally failed to be transmitted as two bad
+ * frames, those that made it out but had some retries as one good and
+ * one bad frame. */
+ if (status->excessive_retries) {
+ spinfo->tx_num_failed += 2;
+ spinfo->tx_num_xmit++;
+ } else if (status->retry_count) {
+ spinfo->tx_num_failed++;
+ spinfo->tx_num_xmit++;
+ }
+
+ if (status->excessive_retries) {
+ sta->tx_retry_failed++;
+ sta->tx_num_consecutive_failures++;
+ sta->tx_num_mpdu_fail++;
+ } else {
+ sta->last_ack_rssi[0] = sta->last_ack_rssi[1];
+ sta->last_ack_rssi[1] = sta->last_ack_rssi[2];
+ sta->last_ack_rssi[2] = status->ack_signal;
+ sta->tx_num_consecutive_failures = 0;
+ sta->tx_num_mpdu_ok++;
+ }
+ sta->tx_retry_count += status->retry_count;
+ sta->tx_num_mpdu_fail += status->retry_count;
+
+ /* Update PID controller state. */
+ if (time_after(jiffies, spinfo->last_sample + RC_PID_INTERVAL))
+ rate_control_pid_sample(pinfo, local, sta);
+
+ sta_info_put(sta);
+}
+
+
+static void
+rate_control_pid_get_rate(void *priv, 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 ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+ struct sta_info *sta;
+ int rateidx;
+
+ sta = sta_info_get(local, hdr->addr1);
+
+ if (!sta) {
+ sel->rate = rate_lowest(local, mode, NULL);
+ sta_info_put(sta);
+ return;
+ }
+
+ rateidx = sta->txrate;
+
+ if (rateidx >= mode->num_rates)
+ rateidx = mode->num_rates - 1;
+
+ sta_info_put(sta);
+
+ sel->rate = &mode->rates[rateidx];
+}
+
+
+static void rate_control_pid_rate_init(void *priv, void *priv_sta,
+ struct ieee80211_local *local,
+ struct sta_info *sta)
+{
+ /* TODO: This routine should consider using RSSI from previous packets
+ * as we need to have IEEE 802.1X auth succeed immediately after assoc..
+ * Until that method is implemented, we will use the lowest supported
+ * rate as a workaround. */
+ sta->txrate = rate_lowest_index(local, local->oper_hw_mode, sta);
+}
+
+
+static void *rate_control_pid_alloc(struct ieee80211_local *local)
+{
+ struct rc_pid_info *pinfo;
+
+ pinfo = kmalloc(sizeof(*pinfo), GFP_ATOMIC);
+
+ pinfo->target = RC_PID_TARGET_PF;
+ pinfo->coeff_p = RC_PID_COEFF_P;
+ pinfo->coeff_i = RC_PID_COEFF_I;
+ pinfo->coeff_d = RC_PID_COEFF_D;
+
+ return pinfo;
+}
+
+
+static void rate_control_pid_free(void *priv)
+{
+ struct rc_pid_info *pinfo = priv;
+ kfree(pinfo);
+}
+
+
+static void rate_control_pid_clear(void *priv)
+{
+}
+
+
+static void *rate_control_pid_alloc_sta(void *priv, gfp_t gfp)
+{
+ struct rc_pid_sta_info *spinfo;
+
+ spinfo = kzalloc(sizeof(*spinfo), gfp);
+
+ return spinfo;
+}
+
+
+static void rate_control_pid_free_sta(void *priv, void *priv_sta)
+{
+ struct rc_pid_sta_info *spinfo = priv_sta;
+ kfree(spinfo);
+}
+
+struct rate_control_ops mac80211_rcpid = {
+ .name = "pid",
+ .tx_status = rate_control_pid_tx_status,
+ .get_rate = rate_control_pid_get_rate,
+ .rate_init = rate_control_pid_rate_init,
+ .clear = rate_control_pid_clear,
+ .alloc = rate_control_pid_alloc,
+ .free = rate_control_pid_free,
+ .alloc_sta = rate_control_pid_alloc_sta,
+ .free_sta = rate_control_pid_free_sta,
+};
--
1.5.3.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 4/4] mac80211: Make PID rate control the default and remove rc80211_simple
[not found] <1197112439.7472.34.camel@localhost>
` (2 preceding siblings ...)
2007-12-08 11:21 ` [PATCH 3/4] mac80211: Add PID TX rate control algorithm Mattias Nissler
@ 2007-12-08 11:21 ` Mattias Nissler
3 siblings, 0 replies; 15+ messages in thread
From: Mattias Nissler @ 2007-12-08 11:21 UTC (permalink / raw)
To: linux-wireless; +Cc: Stefano Brivio, John W. Linville, Johannes Berg
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.
Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de>
---
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
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index ebe3360..825dd0f 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -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
diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile
index 62c01ca..0b5bd12 100644
--- a/net/mac80211/Makefile
+++ b/net/mac80211/Makefile
@@ -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 := \
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 62eaed4..5d36ff8 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -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
diff --git a/net/mac80211/ieee80211_rate.c b/net/mac80211/ieee80211_rate.c
index a2f8d64..9e7580c 100644
--- a/net/mac80211/ieee80211_rate.c
+++ b/net/mac80211/ieee80211_rate.c
@@ -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) {
diff --git a/net/mac80211/ieee80211_rate.h b/net/mac80211/ieee80211_rate.h
index 8520184..643705c 100644
--- a/net/mac80211/ieee80211_rate.h
+++ b/net/mac80211/ieee80211_rate.h
@@ -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;
diff --git a/net/mac80211/rc80211_simple.c b/net/mac80211/rc80211_simple.c
deleted file mode 100644
index c1c8b76..0000000
--- a/net/mac80211/rc80211_simple.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * Copyright 2002-2005, Instant802 Networks, Inc.
- * Copyright 2005, Devicescape Software, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/init.h>
-#include <linux/netdevice.h>
-#include <linux/types.h>
-#include <linux/slab.h>
-#include <linux/skbuff.h>
-#include <linux/compiler.h>
-
-#include <net/mac80211.h>
-#include "ieee80211_i.h"
-#include "ieee80211_rate.h"
-#include "debugfs.h"
-
-
-/* This is a minimal implementation of TX rate controlling that can be used
- * as the default when no improved mechanisms are available. */
-
-#define RATE_CONTROL_NUM_DOWN 20
-#define RATE_CONTROL_NUM_UP 15
-
-#define RATE_CONTROL_EMERG_DEC 2
-#define RATE_CONTROL_INTERVAL (HZ / 20)
-#define RATE_CONTROL_MIN_TX 10
-
-static void rate_control_rate_inc(struct ieee80211_local *local,
- struct sta_info *sta)
-{
- struct ieee80211_sub_if_data *sdata;
- struct ieee80211_hw_mode *mode;
- int i = sta->txrate;
- int maxrate;
-
- sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
- if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) {
- /* forced unicast rate - do not change STA rate */
- return;
- }
-
- mode = local->oper_hw_mode;
- maxrate = sdata->bss ? sdata->bss->max_ratectrl_rateidx : -1;
-
- if (i > mode->num_rates)
- i = mode->num_rates - 2;
-
- while (i + 1 < mode->num_rates) {
- i++;
- if (sta->supp_rates & BIT(i) &&
- mode->rates[i].flags & IEEE80211_RATE_SUPPORTED &&
- (maxrate < 0 || i <= maxrate)) {
- sta->txrate = i;
- break;
- }
- }
-}
-
-
-static void rate_control_rate_dec(struct ieee80211_local *local,
- struct sta_info *sta)
-{
- struct ieee80211_sub_if_data *sdata;
- struct ieee80211_hw_mode *mode;
- int i = sta->txrate;
-
- sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
- if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) {
- /* forced unicast rate - do not change STA rate */
- return;
- }
-
- mode = local->oper_hw_mode;
- if (i > mode->num_rates)
- i = mode->num_rates;
-
- while (i > 0) {
- i--;
- if (sta->supp_rates & BIT(i) &&
- mode->rates[i].flags & IEEE80211_RATE_SUPPORTED) {
- sta->txrate = i;
- break;
- }
- }
-}
-
-struct global_rate_control {
- int dummy;
-};
-
-struct sta_rate_control {
- unsigned long last_rate_change;
- u32 tx_num_failures;
- u32 tx_num_xmit;
-
- unsigned long avg_rate_update;
- u32 tx_avg_rate_sum;
- u32 tx_avg_rate_num;
-
-#ifdef CONFIG_MAC80211_DEBUGFS
- struct dentry *tx_avg_rate_sum_dentry;
- struct dentry *tx_avg_rate_num_dentry;
-#endif
-};
-
-
-static void rate_control_simple_tx_status(void *priv, struct net_device *dev,
- struct sk_buff *skb,
- struct ieee80211_tx_status *status)
-{
- struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
- struct sta_info *sta;
- struct sta_rate_control *srctrl;
-
- sta = sta_info_get(local, hdr->addr1);
-
- if (!sta)
- return;
-
- srctrl = sta->rate_ctrl_priv;
- srctrl->tx_num_xmit++;
- if (status->excessive_retries) {
- srctrl->tx_num_failures++;
- sta->tx_retry_failed++;
- sta->tx_num_consecutive_failures++;
- sta->tx_num_mpdu_fail++;
- } else {
- sta->last_ack_rssi[0] = sta->last_ack_rssi[1];
- sta->last_ack_rssi[1] = sta->last_ack_rssi[2];
- sta->last_ack_rssi[2] = status->ack_signal;
- sta->tx_num_consecutive_failures = 0;
- sta->tx_num_mpdu_ok++;
- }
- sta->tx_retry_count += status->retry_count;
- sta->tx_num_mpdu_fail += status->retry_count;
-
- if (time_after(jiffies,
- srctrl->last_rate_change + RATE_CONTROL_INTERVAL) &&
- srctrl->tx_num_xmit > RATE_CONTROL_MIN_TX) {
- u32 per_failed;
- srctrl->last_rate_change = jiffies;
-
- per_failed = (100 * sta->tx_num_mpdu_fail) /
- (sta->tx_num_mpdu_fail + sta->tx_num_mpdu_ok);
- /* TODO: calculate average per_failed to make adjusting
- * parameters easier */
-#if 0
- if (net_ratelimit()) {
- printk(KERN_DEBUG "MPDU fail=%d ok=%d per_failed=%d\n",
- sta->tx_num_mpdu_fail, sta->tx_num_mpdu_ok,
- per_failed);
- }
-#endif
-
- /*
- * XXX: Make these configurable once we have an
- * interface to the rate control algorithms
- */
- if (per_failed > RATE_CONTROL_NUM_DOWN) {
- rate_control_rate_dec(local, sta);
- } else if (per_failed < RATE_CONTROL_NUM_UP) {
- rate_control_rate_inc(local, sta);
- }
- srctrl->tx_avg_rate_sum += status->control.rate->rate;
- srctrl->tx_avg_rate_num++;
- srctrl->tx_num_failures = 0;
- srctrl->tx_num_xmit = 0;
- } else if (sta->tx_num_consecutive_failures >=
- RATE_CONTROL_EMERG_DEC) {
- rate_control_rate_dec(local, sta);
- }
-
- if (srctrl->avg_rate_update + 60 * HZ < jiffies) {
- srctrl->avg_rate_update = jiffies;
- if (srctrl->tx_avg_rate_num > 0) {
-#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
- DECLARE_MAC_BUF(mac);
- printk(KERN_DEBUG "%s: STA %s Average rate: "
- "%d (%d/%d)\n",
- dev->name, print_mac(mac, sta->addr),
- srctrl->tx_avg_rate_sum /
- srctrl->tx_avg_rate_num,
- srctrl->tx_avg_rate_sum,
- srctrl->tx_avg_rate_num);
-#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
- srctrl->tx_avg_rate_sum = 0;
- srctrl->tx_avg_rate_num = 0;
- }
- }
-
- sta_info_put(sta);
-}
-
-
-static void
-rate_control_simple_get_rate(void *priv, 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 ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
- struct sta_info *sta;
- int rateidx;
-
- sta = sta_info_get(local, hdr->addr1);
-
- if (!sta) {
- sel->rate = rate_lowest(local, mode, NULL);
- return;
- }
-
- rateidx = sta->txrate;
-
- if (rateidx >= mode->num_rates)
- rateidx = mode->num_rates - 1;
-
- sta_info_put(sta);
-
- sel->rate = &mode->rates[rateidx];
-}
-
-
-static void rate_control_simple_rate_init(void *priv, void *priv_sta,
- struct ieee80211_local *local,
- struct sta_info *sta)
-{
- struct ieee80211_hw_mode *mode;
- int i;
- sta->txrate = 0;
- mode = local->oper_hw_mode;
- /* TODO: This routine should consider using RSSI from previous packets
- * as we need to have IEEE 802.1X auth succeed immediately after assoc..
- * Until that method is implemented, we will use the lowest supported rate
- * as a workaround, */
- for (i = 0; i < mode->num_rates; i++) {
- if ((sta->supp_rates & BIT(i)) &&
- (mode->rates[i].flags & IEEE80211_RATE_SUPPORTED)) {
- sta->txrate = i;
- break;
- }
- }
-}
-
-
-static void * rate_control_simple_alloc(struct ieee80211_local *local)
-{
- struct global_rate_control *rctrl;
-
- rctrl = kzalloc(sizeof(*rctrl), GFP_ATOMIC);
-
- return rctrl;
-}
-
-
-static void rate_control_simple_free(void *priv)
-{
- struct global_rate_control *rctrl = priv;
- kfree(rctrl);
-}
-
-
-static void rate_control_simple_clear(void *priv)
-{
-}
-
-
-static void * rate_control_simple_alloc_sta(void *priv, gfp_t gfp)
-{
- struct sta_rate_control *rctrl;
-
- rctrl = kzalloc(sizeof(*rctrl), gfp);
-
- return rctrl;
-}
-
-
-static void rate_control_simple_free_sta(void *priv, void *priv_sta)
-{
- struct sta_rate_control *rctrl = priv_sta;
- kfree(rctrl);
-}
-
-#ifdef CONFIG_MAC80211_DEBUGFS
-
-static int open_file_generic(struct inode *inode, struct file *file)
-{
- file->private_data = inode->i_private;
- return 0;
-}
-
-static ssize_t sta_tx_avg_rate_sum_read(struct file *file,
- char __user *userbuf,
- size_t count, loff_t *ppos)
-{
- struct sta_rate_control *srctrl = file->private_data;
- char buf[20];
-
- sprintf(buf, "%d\n", srctrl->tx_avg_rate_sum);
- return simple_read_from_buffer(userbuf, count, ppos, buf, strlen(buf));
-}
-
-static const struct file_operations sta_tx_avg_rate_sum_ops = {
- .read = sta_tx_avg_rate_sum_read,
- .open = open_file_generic,
-};
-
-static ssize_t sta_tx_avg_rate_num_read(struct file *file,
- char __user *userbuf,
- size_t count, loff_t *ppos)
-{
- struct sta_rate_control *srctrl = file->private_data;
- char buf[20];
-
- sprintf(buf, "%d\n", srctrl->tx_avg_rate_num);
- return simple_read_from_buffer(userbuf, count, ppos, buf, strlen(buf));
-}
-
-static const struct file_operations sta_tx_avg_rate_num_ops = {
- .read = sta_tx_avg_rate_num_read,
- .open = open_file_generic,
-};
-
-static void rate_control_simple_add_sta_debugfs(void *priv, void *priv_sta,
- struct dentry *dir)
-{
- struct sta_rate_control *srctrl = priv_sta;
-
- srctrl->tx_avg_rate_num_dentry =
- debugfs_create_file("rc_simple_sta_tx_avg_rate_num", 0400,
- dir, srctrl, &sta_tx_avg_rate_num_ops);
- srctrl->tx_avg_rate_sum_dentry =
- debugfs_create_file("rc_simple_sta_tx_avg_rate_sum", 0400,
- dir, srctrl, &sta_tx_avg_rate_sum_ops);
-}
-
-static void rate_control_simple_remove_sta_debugfs(void *priv, void *priv_sta)
-{
- struct sta_rate_control *srctrl = priv_sta;
-
- debugfs_remove(srctrl->tx_avg_rate_sum_dentry);
- debugfs_remove(srctrl->tx_avg_rate_num_dentry);
-}
-#endif
-
-struct rate_control_ops mac80211_rcsimple = {
- .name = "simple",
- .tx_status = rate_control_simple_tx_status,
- .get_rate = rate_control_simple_get_rate,
- .rate_init = rate_control_simple_rate_init,
- .clear = rate_control_simple_clear,
- .alloc = rate_control_simple_alloc,
- .free = rate_control_simple_free,
- .alloc_sta = rate_control_simple_alloc_sta,
- .free_sta = rate_control_simple_free_sta,
-#ifdef CONFIG_MAC80211_DEBUGFS
- .add_sta_debugfs = rate_control_simple_add_sta_debugfs,
- .remove_sta_debugfs = rate_control_simple_remove_sta_debugfs,
-#endif
-};
--
1.5.3.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 1/4] mac80211: Clean up rate selection
2007-12-08 11:21 ` [PATCH 1/4] mac80211: Clean up rate selection Mattias Nissler
@ 2007-12-08 11:29 ` Johannes Berg
2007-12-08 11:33 ` Mattias Nissler
0 siblings, 1 reply; 15+ messages in thread
From: Johannes Berg @ 2007-12-08 11:29 UTC (permalink / raw)
To: Mattias Nissler; +Cc: linux-wireless, Stefano Brivio, John W. Linville
[-- Attachment #1: Type: text/plain, Size: 1225 bytes --]
> + /* 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.
> + /* 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.
> + /* 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;
> + }
> + }
That I'm not sure about. This is the fallback rate?
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/4] mac80211: Clean up rate selection
2007-12-08 11:29 ` Johannes Berg
@ 2007-12-08 11:33 ` Mattias Nissler
2007-12-08 11:36 ` Mattias Nissler
2007-12-08 11:36 ` Johannes Berg
0 siblings, 2 replies; 15+ messages in thread
From: Mattias Nissler @ 2007-12-08 11:33 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Stefano Brivio, John W. Linville
On Sat, 2007-12-08 at 12:29 +0100, Johannes Berg wrote:
> > + /* 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.
>
> > + /* 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.
>
> > + /* 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;
> > + }
> > + }
>
> 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
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/4] mac80211: Clean up rate selection
2007-12-08 11:33 ` Mattias Nissler
@ 2007-12-08 11:36 ` Mattias Nissler
2007-12-08 11:36 ` Johannes Berg
1 sibling, 0 replies; 15+ messages in thread
From: Mattias Nissler @ 2007-12-08 11:36 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Stefano Brivio, John W. Linville
On Sat, 2007-12-08 at 12:33 +0100, Mattias Nissler wrote:
> >
> > > + /* 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;
> > > + }
> > > + }
> >
> > 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.
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/4] mac80211: Clean up rate selection
2007-12-08 11:33 ` Mattias Nissler
2007-12-08 11:36 ` Mattias Nissler
@ 2007-12-08 11:36 ` Johannes Berg
2007-12-08 11:45 ` Mattias Nissler
1 sibling, 1 reply; 15+ messages in thread
From: Johannes Berg @ 2007-12-08 11:36 UTC (permalink / raw)
To: Mattias Nissler; +Cc: linux-wireless, Stefano Brivio, John W. Linville
[-- Attachment #1: Type: text/plain, Size: 1181 bytes --]
On Sat, 2007-12-08 at 12:33 +0100, Mattias Nissler wrote:
> On Sat, 2007-12-08 at 12:29 +0100, Johannes Berg wrote:
> > > + /* 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.
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.
> 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
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/4] mac80211: Clean up rate selection
2007-12-08 11:36 ` Johannes Berg
@ 2007-12-08 11:45 ` Mattias Nissler
2007-12-08 11:56 ` Johannes Berg
0 siblings, 1 reply; 15+ messages in thread
From: Mattias Nissler @ 2007-12-08 11:45 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Stefano Brivio, John W. Linville
On Sat, 2007-12-08 at 12:36 +0100, Johannes Berg wrote:
> On Sat, 2007-12-08 at 12:33 +0100, Mattias Nissler wrote:
> > On Sat, 2007-12-08 at 12:29 +0100, Johannes Berg wrote:
> > > > + /* 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.
>
> 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.
>
> > 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
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/4] mac80211: Clean up rate selection
2007-12-08 11:45 ` Mattias Nissler
@ 2007-12-08 11:56 ` Johannes Berg
0 siblings, 0 replies; 15+ messages in thread
From: Johannes Berg @ 2007-12-08 11:56 UTC (permalink / raw)
To: Mattias Nissler; +Cc: linux-wireless, Stefano Brivio, John W. Linville
[-- Attachment #1: Type: text/plain, Size: 675 bytes --]
> > 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.
> > > 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
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/4] iwlwifi: Update to changed mac80211 rate control interface
2007-12-08 11:21 ` [PATCH 2/4] iwlwifi: Update to changed mac80211 rate control interface Mattias Nissler
@ 2007-12-08 13:19 ` Stefano Brivio
2007-12-11 21:10 ` mohamed salim abbas
0 siblings, 1 reply; 15+ messages in thread
From: Stefano Brivio @ 2007-12-08 13:19 UTC (permalink / raw)
To: Mattias Nissler; +Cc: linux-wireless, John W. Linville, Johannes Berg
On Sat, 08 Dec 2007 12:21:51 +0100
Mattias Nissler <mattias.nissler@gmx.de> wrote:
> This brings iwlwifi rate control code back in sync with mac80211.
>
> Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de>
It doesn't apply:
> @@ -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;
> struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
--
Ciao
Stefano
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/4] iwlwifi: Update to changed mac80211 rate control interface
2007-12-08 13:19 ` Stefano Brivio
@ 2007-12-11 21:10 ` mohamed salim abbas
2007-12-11 21:19 ` Michael Buesch
` (2 more replies)
0 siblings, 3 replies; 15+ messages in thread
From: mohamed salim abbas @ 2007-12-11 21:10 UTC (permalink / raw)
To: Stefano Brivio
Cc: Mattias Nissler, linux-wireless, John W. Linville, Johannes Berg
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
On 12/8/07, Stefano Brivio <stefano.brivio@polimi.it> wrote:
> On Sat, 08 Dec 2007 12:21:51 +0100
> Mattias Nissler <mattias.nissler@gmx.de> wrote:
>
> > This brings iwlwifi rate control code back in sync with mac80211.
> >
> > Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de>
>
> It doesn't apply:
>
> > @@ -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;
>
> > 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 majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/4] iwlwifi: Update to changed mac80211 rate control interface
2007-12-11 21:10 ` mohamed salim abbas
@ 2007-12-11 21:19 ` Michael Buesch
2007-12-11 21:48 ` Stefano Brivio
2007-12-11 21:54 ` Mattias Nissler
2 siblings, 0 replies; 15+ messages in thread
From: Michael Buesch @ 2007-12-11 21:19 UTC (permalink / raw)
To: mohamed salim abbas
Cc: Stefano Brivio, Mattias Nissler, linux-wireless, John W. Linville,
Johannes Berg
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?
--
Greetings Michael.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/4] iwlwifi: Update to changed mac80211 rate control interface
2007-12-11 21:10 ` mohamed salim abbas
2007-12-11 21:19 ` Michael Buesch
@ 2007-12-11 21:48 ` Stefano Brivio
2007-12-11 21:54 ` Mattias Nissler
2 siblings, 0 replies; 15+ messages in thread
From: Stefano Brivio @ 2007-12-11 21:48 UTC (permalink / raw)
To: mohamed salim abbas
Cc: Mattias Nissler, linux-wireless, John W. Linville, Johannes Berg
On Tue, 11 Dec 2007 13:10:38 -0800
"mohamed salim abbas" <mabbaswireless@gmail.com> wrote:
> 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.
--
Ciao
Stefano
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/4] iwlwifi: Update to changed mac80211 rate control interface
2007-12-11 21:10 ` mohamed salim abbas
2007-12-11 21:19 ` Michael Buesch
2007-12-11 21:48 ` Stefano Brivio
@ 2007-12-11 21:54 ` Mattias Nissler
2 siblings, 0 replies; 15+ messages in thread
From: Mattias Nissler @ 2007-12-11 21:54 UTC (permalink / raw)
To: mohamed salim abbas
Cc: Stefano Brivio, linux-wireless, John W. Linville, Johannes Berg
On Tue, 2007-12-11 at 13:10 -0800, 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. 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
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2007-12-11 21:55 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1197112439.7472.34.camel@localhost>
2007-12-08 11:21 ` [PATCH 1/4] mac80211: Clean up rate selection Mattias Nissler
2007-12-08 11:29 ` Johannes Berg
2007-12-08 11:33 ` Mattias Nissler
2007-12-08 11:36 ` Mattias Nissler
2007-12-08 11:36 ` Johannes Berg
2007-12-08 11:45 ` Mattias Nissler
2007-12-08 11:56 ` Johannes Berg
2007-12-08 11:21 ` [PATCH 2/4] iwlwifi: Update to changed mac80211 rate control interface Mattias Nissler
2007-12-08 13:19 ` Stefano Brivio
2007-12-11 21:10 ` mohamed salim abbas
2007-12-11 21:19 ` Michael Buesch
2007-12-11 21:48 ` Stefano Brivio
2007-12-11 21:54 ` Mattias Nissler
2007-12-08 11:21 ` [PATCH 3/4] mac80211: Add PID TX rate control algorithm Mattias Nissler
2007-12-08 11:21 ` [PATCH 4/4] mac80211: Make PID rate control the default and remove rc80211_simple Mattias Nissler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).