On Sat, Jan 26, 2013 at 3:04 PM, Johannes Berg <johannes@xxxxxxxxxxxxxxxx> wrote: > >> + sband = local->hw.wiphy->bands[band]; >> + bitrates = sband->bitrates; > > It might be interesting to loop once here and build a bitmap (in an > unsigned long) of rates marked ERP_G. Something like > > erp_rates = 0; > for (i = 0; i < sband->n_bitrates; i++) > if (bitrates[i].flags & ...) > erp_rates |= BIT(i); > > >> + rcu_read_lock(); >> + list_for_each_entry_rcu(sta, &local->sta_list, list) { >> + if (sdata != sta->sdata || >> + sta->plink_state != NL80211_PLINK_ESTAB) >> + continue; >> + >> + short_slot = false; >> + rates = sta->sta.supp_rates[band]; >> + for_each_set_bit(i, (unsigned long *)&rates, >> + sizeof(rates) * BITS_PER_BYTE) { >> + if (bitrates[i].flags & IEEE80211_RATE_ERP_G) { >> + short_slot = true; >> + break; >> + } >> + } >> + >> + if (!short_slot) >> + break; > > Then the inner bitrate loop here becomes just > > if (!(rates & erp_rates)) { > short_slot = false; > break; > } Huh, that's actually pretty nice. I don't really get why the for_each_set_bit() is broken on big endian 64-bit systems, but hey this approach takes care of that concern :) > which assumes "short_slot = true" as a precondition to going into the > sta loop. > > (although that does change the overall logic to enable short slot when > NO stations are present) Sure. We'll disable it when not locally supported anyway. Thanks. -- Thomas -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html