Re: Adhoc networking, was Re: compat-wireless and minstrel

Adam Wozniak
2009-11-17T17:39:45Z

Johannes Berg wrote:
> No, point a) is incorrect -- it is the _basic_ rate set only, not the
> entire rate set. Hence not knowing which rates a station actually
> supports.
>
In either case, having minstrel use all rates doesn't seem like it
should hurt much. This is the patch I'm running with now, and it seems
to work. The changes in ibss.c make sure supp_rates is initialized
properly, and that rate control is called when a change occurs. If
other stuff is working right (?) this should help PID and other rate
control algorithms. The changes in rc80211_minstrel.c make it ignore
the supported rates set and just try everything.

diff -upr compat-wireless-2009-11-17/net/mac80211/ibss.c
compat-wireless-2009-11-17a/net/mac80211/ibss.c
--- compat-wireless-2009-11-17/net/mac80211/ibss.c 2009-11-16
21:17:21.000000000 -0800
+++ compat-wireless-2009-11-17a/net/mac80211/ibss.c 2009-11-17
09:01:54.287720290 -0800
@@ -246,9 +246,13 @@ static void ieee80211_rx_bss_info(struct
if (!channel || channel->flags & IEEE80211_CHAN_DISABLED)
return;

+ supp_rates = ieee80211_sta_get_rates(local, elems, band);
+
+ /* make sure mandatory rates are always added */
+ supp_rates |= ieee80211_mandatory_rates(local, band);
+
if (sdata->vif.type == NL80211_IFTYPE_ADHOC && elems->supp_rates &&
memcmp(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN) == 0) {
- supp_rates = ieee80211_sta_get_rates(local, elems, band);

rcu_read_lock();

@@ -257,12 +261,10 @@ static void ieee80211_rx_bss_info(struct
u32 prev_rates;

prev_rates = sta->sta.supp_rates[band];
- /* make sure mandatory rates are always added */
- sta->sta.supp_rates[band] = supp_rates |
- ieee80211_mandatory_rates(local, band);
+ sta->sta.supp_rates[band] = supp_rates;

+ if (sta->sta.supp_rates[band] != prev_rates) {
#ifdef CONFIG_MAC80211_IBSS_DEBUG
- if (sta->sta.supp_rates[band] != prev_rates)
printk(KERN_DEBUG "%s: updated supp_rates set "
"for %pM based on beacon info (0x%llx | "
"0x%llx -> 0x%llx)\n",
@@ -272,6 +274,8 @@ static void ieee80211_rx_bss_info(struct
(unsigned long long) supp_rates,
(unsigned long long) sta->sta.supp_rates[band]);
#endif
+ rate_control_rate_init(sta);
+ }
} else
ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa,
supp_rates);

@@ -415,6 +419,15 @@ struct sta_info *ieee80211_ibss_add_sta(
sta->sta.supp_rates[band] = supp_rates |
ieee80211_mandatory_rates(local, band);

+#ifdef CONFIG_MAC80211_IBSS_DEBUG
+ printk(KERN_DEBUG "%s: initialized supp_rates set "
+ "for %pM (0x%llx) (band %d)\n",
+ sdata->dev->name,
+ sta->sta.addr,
+ (unsigned long long) sta->sta.supp_rates[band],
+ band);
+#endif
+
rate_control_rate_init(sta);

if (sta_info_insert(sta))
diff -upr compat-wireless-2009-11-17/net/mac80211/rc80211_minstrel.c
compat-wireless-2009-11-17a/net/mac80211/rc80211_minstrel.c
--- compat-wireless-2009-11-17/net/mac80211/rc80211_minstrel.c
2009-11-16 21:17:21.000000000 -0800
+++ compat-wireless-2009-11-17a/net/mac80211/rc80211_minstrel.c
2009-11-17 09:02:25.544628968 -0800
@@ -395,8 +395,6 @@ minstrel_rate_init(void *priv, struct ie
unsigned int tx_time_single;
unsigned int cw = mp->cw_min;

- if (!rate_supported(sta, sband->band, i))
- continue;
n++;
memset(mr, 0, sizeof(*mr));