Enable WME QoS in IBSS mode by adding a WME information element to beacons and
probe respones and by checking for it and marking stations as WME capable if it
is present.
Signed-off-by: Bruno Randolf <[email protected]>
---
v3: use GFP_ATOMIC and re-organize nesting of "if" statements. allthough in
practice we would probaby always have the rates element i think it's more
correct to code it like this.
---
net/mac80211/ibss.c | 65 ++++++++++++++++++++++++++++++++++-----------------
1 files changed, 43 insertions(+), 22 deletions(-)
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 1a3aae5..ff60c02 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -173,6 +173,19 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
memcpy(skb_put(skb, ifibss->ie_len),
ifibss->ie, ifibss->ie_len);
+ if (local->hw.queues >= 4) {
+ pos = skb_put(skb, 9);
+ *pos++ = WLAN_EID_VENDOR_SPECIFIC;
+ *pos++ = 7; /* len */
+ *pos++ = 0x00; /* Microsoft OUI 00:50:F2 */
+ *pos++ = 0x50;
+ *pos++ = 0xf2;
+ *pos++ = 2; /* WME */
+ *pos++ = 0; /* WME info */
+ *pos++ = 1; /* WME ver */
+ *pos++ = 0; /* U-APSD no in use */
+ }
+
rcu_assign_pointer(ifibss->presp, skb);
sdata->vif.bss_conf.beacon_int = beacon_int;
@@ -266,37 +279,45 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
if (!channel || channel->flags & IEEE80211_CHAN_DISABLED)
return;
- if (sdata->vif.type == NL80211_IFTYPE_ADHOC && elems->supp_rates &&
+ if (sdata->vif.type == NL80211_IFTYPE_ADHOC &&
memcmp(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN) == 0) {
- supp_rates = ieee80211_sta_get_rates(local, elems, band);
rcu_read_lock();
-
sta = sta_info_get(sdata, mgmt->sa);
- if (sta) {
- 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);
+ if (elems->supp_rates) {
+ supp_rates = ieee80211_sta_get_rates(local, elems,
+ band);
+ if (sta) {
+ u32 prev_rates;
- if (sta->sta.supp_rates[band] != 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);
+
+ if (sta->sta.supp_rates[band] != prev_rates) {
#ifdef CONFIG_MAC80211_IBSS_DEBUG
- printk(KERN_DEBUG "%s: updated supp_rates set "
- "for %pM based on beacon/probe_response "
- "(0x%x -> 0x%x)\n",
- sdata->name, sta->sta.addr,
- prev_rates, sta->sta.supp_rates[band]);
+ printk(KERN_DEBUG
+ "%s: updated supp_rates set "
+ "for %pM based on beacon"
+ "/probe_resp (0x%x -> 0x%x)\n",
+ sdata->name, sta->sta.addr,
+ prev_rates,
+ sta->sta.supp_rates[band]);
#endif
- rate_control_rate_init(sta);
- }
- rcu_read_unlock();
- } else {
- rcu_read_unlock();
- ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa,
- supp_rates, GFP_KERNEL);
+ rate_control_rate_init(sta);
+ }
+ } else
+ sta = ieee80211_ibss_add_sta(sdata, mgmt->bssid,
+ mgmt->sa, supp_rates,
+ GFP_ATOMIC);
}
+
+ if (sta && elems->wmm_info)
+ set_sta_flags(sta, WLAN_STA_WME);
+
+ rcu_read_unlock();
}
bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems,
On Mon October 4 2010 20:21:40 Johannes Berg wrote:
> On Mon, 2010-10-04 at 11:17 +0900, Bruno Randolf wrote:
> > Enable WME QoS in IBSS mode by adding a WME information element to
> > beacons and probe respones and by checking for it and marking stations
> > as WME capable if it is present.
> >
> > Signed-off-by: Bruno Randolf <[email protected]>
> >
> > ---
> > v3: use GFP_ATOMIC and re-organize nesting of "if" statements. allthough
> > in practice we would probaby always have the rates element i think it's
> > more correct to code it like this.
>
> You're probably right, but shouldn't that be a separate patch? It
> doesn't relate to WME at all, afaict.
it does. before we only looked at elems->supp_rates, so it was o.k. to combine
that check into the first if (adhoc mode && bssid matches). now we also check
elems->wmm_info so we should make separate cases for each. as i noted, it
probably does not matter much in practice, since elems->supp_rates should be
present in all proper beacons and probe responses.
bruno
On Tue, 2010-10-05 at 10:24 +0900, Bruno Randolf wrote:
> On Mon October 4 2010 20:21:40 Johannes Berg wrote:
> > On Mon, 2010-10-04 at 11:17 +0900, Bruno Randolf wrote:
> > > Enable WME QoS in IBSS mode by adding a WME information element to
> > > beacons and probe respones and by checking for it and marking stations
> > > as WME capable if it is present.
> > >
> > > Signed-off-by: Bruno Randolf <[email protected]>
> > >
> > > ---
> > > v3: use GFP_ATOMIC and re-organize nesting of "if" statements. allthough
> > > in practice we would probaby always have the rates element i think it's
> > > more correct to code it like this.
> >
> > You're probably right, but shouldn't that be a separate patch? It
> > doesn't relate to WME at all, afaict.
>
> it does. before we only looked at elems->supp_rates, so it was o.k. to combine
> that check into the first if (adhoc mode && bssid matches). now we also check
> elems->wmm_info so we should make separate cases for each. as i noted, it
> probably does not matter much in practice, since elems->supp_rates should be
> present in all proper beacons and probe responses.
Fair enough, looks fine to me.
johannes
On Mon, 2010-10-04 at 11:17 +0900, Bruno Randolf wrote:
> Enable WME QoS in IBSS mode by adding a WME information element to beacons and
> probe respones and by checking for it and marking stations as WME capable if it
> is present.
>
> Signed-off-by: Bruno Randolf <[email protected]>
>
> ---
> v3: use GFP_ATOMIC and re-organize nesting of "if" statements. allthough in
> practice we would probaby always have the rates element i think it's more
> correct to code it like this.
You're probably right, but shouldn't that be a separate patch? It
doesn't relate to WME at all, afaict.
johannes