]> err.no Git - linux-2.6/blobdiff - net/mac80211/rc80211_pid_algo.c
Merge branch 'core/softirq' of git://git.kernel.org/pub/scm/linux/kernel/git/tip...
[linux-2.6] / net / mac80211 / rc80211_pid_algo.c
index 4a51647a41af4bcd1c06af2afe14e32d02ce5636..bcd27c1d75941d8b56d1802d99d1d0209c5c1187 100644 (file)
 #include <linux/skbuff.h>
 #include <linux/debugfs.h>
 #include <net/mac80211.h>
-#include "ieee80211_rate.h"
-#ifdef CONFIG_MAC80211_MESH
+#include "rate.h"
 #include "mesh.h"
-#endif
-
 #include "rc80211_pid.h"
 
 
@@ -80,7 +77,7 @@ static void rate_control_pid_adjust_rate(struct ieee80211_local *local,
        int cur_sorted, new_sorted, probe, tmp, n_bitrates, band;
        int cur = sta->txrate_idx;
 
-       sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
+       sdata = sta->sdata;
        sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
        band = sband->band;
        n_bitrates = sband->n_bitrates;
@@ -152,7 +149,7 @@ static void rate_control_pid_sample(struct rc_pid_info *pinfo,
                                    struct sta_info *sta)
 {
 #ifdef CONFIG_MAC80211_MESH
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
+       struct ieee80211_sub_if_data *sdata = sta->sdata;
 #endif
        struct rc_pid_sta_info *spinfo = sta->rate_ctrl_priv;
        struct rc_pid_rateinfo *rinfo = pinfo->rinfo;
@@ -252,23 +249,25 @@ static void rate_control_pid_tx_status(void *priv, struct net_device *dev,
        unsigned long period;
        struct ieee80211_supported_band *sband;
 
+       rcu_read_lock();
+
        sta = sta_info_get(local, hdr->addr1);
        sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
 
        if (!sta)
-               return;
+               goto unlock;
 
        /* Don't update the state if we're not controlling the rate. */
-       sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
+       sdata = sta->sdata;
        if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) {
                sta->txrate_idx = sdata->bss->max_ratectrl_rateidx;
-               return;
+               goto unlock;
        }
 
        /* Ignore all frames that were sent with a different rate than the rate
         * we currently advise mac80211 to use. */
        if (status->control.tx_rate != &sband->bitrates[sta->txrate_idx])
-               goto ignore;
+               goto unlock;
 
        spinfo = sta->rate_ctrl_priv;
        spinfo->tx_num_xmit++;
@@ -306,8 +305,8 @@ static void rate_control_pid_tx_status(void *priv, struct net_device *dev,
        if (time_after(jiffies, spinfo->last_sample + period))
                rate_control_pid_sample(pinfo, local, sta);
 
-ignore:
-       sta_info_put(sta);
+ unlock:
+       rcu_read_unlock();
 }
 
 static void rate_control_pid_get_rate(void *priv, struct net_device *dev,
@@ -322,6 +321,8 @@ static void rate_control_pid_get_rate(void *priv, struct net_device *dev,
        int rateidx;
        u16 fc;
 
+       rcu_read_lock();
+
        sta = sta_info_get(local, hdr->addr1);
 
        /* Send management frames and broadcast/multicast data using lowest
@@ -330,8 +331,7 @@ static void rate_control_pid_get_rate(void *priv, struct net_device *dev,
        if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
            is_multicast_ether_addr(hdr->addr1) || !sta) {
                sel->rate = rate_lowest(local, sband, sta);
-               if (sta)
-                       sta_info_put(sta);
+               rcu_read_unlock();
                return;
        }
 
@@ -347,7 +347,7 @@ static void rate_control_pid_get_rate(void *priv, struct net_device *dev,
 
        sta->last_txrate_idx = rateidx;
 
-       sta_info_put(sta);
+       rcu_read_unlock();
 
        sel->rate = &sband->bitrates[rateidx];
 
@@ -398,13 +398,25 @@ static void *rate_control_pid_alloc(struct ieee80211_local *local)
                return NULL;
        }
 
+       pinfo->target = RC_PID_TARGET_PF;
+       pinfo->sampling_period = RC_PID_INTERVAL;
+       pinfo->coeff_p = RC_PID_COEFF_P;
+       pinfo->coeff_i = RC_PID_COEFF_I;
+       pinfo->coeff_d = RC_PID_COEFF_D;
+       pinfo->smoothing_shift = RC_PID_SMOOTHING_SHIFT;
+       pinfo->sharpen_factor = RC_PID_SHARPENING_FACTOR;
+       pinfo->sharpen_duration = RC_PID_SHARPENING_DURATION;
+       pinfo->norm_offset = RC_PID_NORM_OFFSET;
+       pinfo->rinfo = rinfo;
+       pinfo->oldrate = 0;
+
        /* Sort the rates. This is optimized for the most common case (i.e.
         * almost-sorted CCK+OFDM rates). Kind of bubble-sort with reversed
         * mapping too. */
        for (i = 0; i < sband->n_bitrates; i++) {
                rinfo[i].index = i;
                rinfo[i].rev_index = i;
-               if (pinfo->fast_start)
+               if (RC_PID_FAST_START)
                        rinfo[i].diff = 0;
                else
                        rinfo[i].diff = i * pinfo->norm_offset;
@@ -425,19 +437,6 @@ static void *rate_control_pid_alloc(struct ieee80211_local *local)
                        break;
        }
 
-       pinfo->target = RC_PID_TARGET_PF;
-       pinfo->sampling_period = RC_PID_INTERVAL;
-       pinfo->coeff_p = RC_PID_COEFF_P;
-       pinfo->coeff_i = RC_PID_COEFF_I;
-       pinfo->coeff_d = RC_PID_COEFF_D;
-       pinfo->smoothing_shift = RC_PID_SMOOTHING_SHIFT;
-       pinfo->sharpen_factor = RC_PID_SHARPENING_FACTOR;
-       pinfo->sharpen_duration = RC_PID_SHARPENING_DURATION;
-       pinfo->norm_offset = RC_PID_NORM_OFFSET;
-       pinfo->fast_start = RC_PID_FAST_START;
-       pinfo->rinfo = rinfo;
-       pinfo->oldrate = 0;
-
 #ifdef CONFIG_MAC80211_DEBUGFS
        de = &pinfo->dentries;
        de->dir = debugfs_create_dir("rc80211_pid",
@@ -465,9 +464,6 @@ static void *rate_control_pid_alloc(struct ieee80211_local *local)
        de->norm_offset = debugfs_create_u32("norm_offset",
                                             S_IRUSR | S_IWUSR, de->dir,
                                             &pinfo->norm_offset);
-       de->fast_start = debugfs_create_bool("fast_start",
-                                            S_IRUSR | S_IWUSR, de->dir,
-                                            &pinfo->fast_start);
 #endif
 
        return pinfo;
@@ -479,7 +475,6 @@ static void rate_control_pid_free(void *priv)
 #ifdef CONFIG_MAC80211_DEBUGFS
        struct rc_pid_debugfs_entries *de = &pinfo->dentries;
 
-       debugfs_remove(de->fast_start);
        debugfs_remove(de->norm_offset);
        debugfs_remove(de->sharpen_duration);
        debugfs_remove(de->sharpen_factor);