linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: Add WME information element for IBSS
@ 2010-09-16  8:34 Bruno Randolf
  2010-09-16  9:37 ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Bruno Randolf @ 2010-09-16  8:34 UTC (permalink / raw)
  To: johannes, linville; +Cc: linux-wireless

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 <br1@einfach.org>
---
 net/mac80211/ibss.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 1a3aae5..95fe43f 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;
@@ -294,9 +307,12 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
 			rcu_read_unlock();
 		} else {
 			rcu_read_unlock();
-			ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa,
-					       supp_rates, GFP_KERNEL);
+
+			sta = ieee80211_ibss_add_sta(sdata, mgmt->bssid,
+					mgmt->sa, supp_rates, GFP_KERNEL);
 		}
+		if (sta && elems->wmm_info)
+			set_sta_flags(sta, WLAN_STA_WME);
 	}
 
 	bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems,


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mac80211: Add WME information element for IBSS
  2010-09-16  8:34 [PATCH] mac80211: Add WME information element for IBSS Bruno Randolf
@ 2010-09-16  9:37 ` Johannes Berg
  2010-10-01  5:15   ` Bruno Randolf
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2010-09-16  9:37 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, linux-wireless

On Thu, 2010-09-16 at 17:34 +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.

>  			rcu_read_unlock();
> -			ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa,
> -					       supp_rates, GFP_KERNEL);
> +
> +			sta = ieee80211_ibss_add_sta(sdata, mgmt->bssid,
> +					mgmt->sa, supp_rates, GFP_KERNEL);
>  		}
> +		if (sta && elems->wmm_info)
> +			set_sta_flags(sta, WLAN_STA_WME);

NACK, this is obviously racy.

johannes


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mac80211: Add WME information element for IBSS
  2010-09-16  9:37 ` Johannes Berg
@ 2010-10-01  5:15   ` Bruno Randolf
  2010-10-01  8:13     ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Bruno Randolf @ 2010-10-01  5:15 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linville, linux-wireless

On Thu September 16 2010 18:37:33 Johannes Berg wrote:
> On Thu, 2010-09-16 at 17:34 +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.
> > 
> >  			rcu_read_unlock();
> > 
> > -			ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa,
> > -					       supp_rates, GFP_KERNEL);
> > +
> > +			sta = ieee80211_ibss_add_sta(sdata, mgmt->bssid,
> > +					mgmt->sa, supp_rates, GFP_KERNEL);
> > 
> >  		}
> > 
> > +		if (sta && elems->wmm_info)
> > +			set_sta_flags(sta, WLAN_STA_WME);
> 
> NACK, this is obviously racy.

sorry for the late reply.

better like this?

@@ -291,11 +304,16 @@ static void ieee80211_rx_bss_info(struct 
ieee80211_sub_if_data *sdata,
 #endif
                                rate_control_rate_init(sta);
                        }
+                       if (elems->wmm_info)
+                               set_sta_flags(sta, WLAN_STA_WME);
                        rcu_read_unlock();
                } else {
                        rcu_read_unlock();
-                       ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa,
-                                              supp_rates, GFP_KERNEL);
+
+                       sta = ieee80211_ibss_add_sta(sdata, mgmt->bssid,
+                                       mgmt->sa, supp_rates, GFP_KERNEL);
+                       if (sta && elems->wmm_info)
+                               set_sta_flags(sta, WLAN_STA_WME);
                }
        }

if not, i don't get it... could you explain how it should be done properly?

thanks,
bruno

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mac80211: Add WME information element for IBSS
  2010-10-01  5:15   ` Bruno Randolf
@ 2010-10-01  8:13     ` Johannes Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2010-10-01  8:13 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, linux-wireless

On Fri, 2010-10-01 at 14:15 +0900, Bruno Randolf wrote:

> +                       if (elems->wmm_info)
> +                               set_sta_flags(sta, WLAN_STA_WME);
>                         rcu_read_unlock();
>                 } else {
>                         rcu_read_unlock();
> -                       ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa,
> -                                              supp_rates, GFP_KERNEL);
> +
> +                       sta = ieee80211_ibss_add_sta(sdata, mgmt->bssid,
> +                                       mgmt->sa, supp_rates, GFP_KERNEL);
> +                       if (sta && elems->wmm_info)
> +                               set_sta_flags(sta, WLAN_STA_WME);

If you want to use the sta pointer, you need this code to be before
rcu_read_unlock(), not after.

johannes


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-01  8:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-16  8:34 [PATCH] mac80211: Add WME information element for IBSS Bruno Randolf
2010-09-16  9:37 ` Johannes Berg
2010-10-01  5:15   ` Bruno Randolf
2010-10-01  8:13     ` Johannes Berg

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).