Add a memeber to the ieee80211_sta structure to indicate whether the STA
supports WME.
Signed-off-by: Arik Nemtsov <[email protected]>
---
v1->2: made member valid for drivers operating as STA or IBSS, in addition
to AP mode.
include/net/mac80211.h | 2 ++
net/mac80211/cfg.c | 5 ++++-
net/mac80211/ibss.c | 15 ++++++++++++---
net/mac80211/ieee80211_i.h | 2 +-
net/mac80211/mlme.c | 4 +++-
net/mac80211/rx.c | 3 ++-
6 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 8c7189c..c07c328 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -933,6 +933,7 @@ enum set_key_cmd {
* @aid: AID we assigned to the station if we're an AP
* @supp_rates: Bitmap of supported rates (per band)
* @ht_cap: HT capabilities of this STA; restricted to our own TX capabilities
+ * @wme: indicates whether the STA supports WME
* @drv_priv: data area for driver use, will always be aligned to
* sizeof(void *), size is determined in hw information.
*/
@@ -941,6 +942,7 @@ struct ieee80211_sta {
u8 addr[ETH_ALEN];
u16 aid;
struct ieee80211_sta_ht_cap ht_cap;
+ bool wme;
/* must be last */
u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index be70c70..e6e6b35 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -674,8 +674,11 @@ static void sta_apply_parameters(struct ieee80211_local *local,
if (mask & BIT(NL80211_STA_FLAG_WME)) {
sta->flags &= ~WLAN_STA_WME;
- if (set & BIT(NL80211_STA_FLAG_WME))
+ sta->sta.wme = false;
+ if (set & BIT(NL80211_STA_FLAG_WME)) {
sta->flags |= WLAN_STA_WME;
+ sta->sta.wme = true;
+ }
}
if (mask & BIT(NL80211_STA_FLAG_MFP)) {
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 421eaa6..efa1d86 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -310,11 +310,14 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
} else
sta = ieee80211_ibss_add_sta(sdata, mgmt->bssid,
mgmt->sa, supp_rates,
+ elems->wmm_info != NULL,
GFP_ATOMIC);
}
- if (sta && elems->wmm_info)
+ if (sta && elems->wmm_info) {
set_sta_flags(sta, WLAN_STA_WME);
+ sta->sta.wme = true;
+ }
rcu_read_unlock();
}
@@ -404,7 +407,8 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
ieee80211_sta_join_ibss(sdata, bss);
supp_rates = ieee80211_sta_get_rates(local, elems, band);
ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa,
- supp_rates, GFP_KERNEL);
+ supp_rates, elems->wmm_info != NULL,
+ GFP_KERNEL);
}
put_bss:
@@ -418,7 +422,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
*/
struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
u8 *bssid,u8 *addr, u32 supp_rates,
- gfp_t gfp)
+ bool wme, gfp_t gfp)
{
struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
struct ieee80211_local *local = sdata->local;
@@ -454,6 +458,11 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
sta->last_rx = jiffies;
set_sta_flags(sta, WLAN_STA_AUTHORIZED);
+ if (wme) {
+ set_sta_flags(sta, WLAN_STA_WME);
+ sta->sta.wme = true;
+ }
+
/* make sure mandatory rates are always added */
sta->sta.supp_rates[band] = supp_rates |
ieee80211_mandatory_rates(local, band);
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 2025af5..8e4eb95 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1119,7 +1119,7 @@ void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local);
void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata);
struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
u8 *bssid, u8 *addr, u32 supp_rates,
- gfp_t gfp);
+ bool wme, gfp_t gfp);
int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
struct cfg80211_ibss_params *params);
int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata);
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 4f6b267..749e649 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1535,8 +1535,10 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk,
if (ifmgd->flags & IEEE80211_STA_MFP_ENABLED)
set_sta_flags(sta, WLAN_STA_MFP);
- if (elems.wmm_param)
+ if (elems.wmm_param) {
set_sta_flags(sta, WLAN_STA_WME);
+ sta->sta.wme = true;
+ }
err = sta_info_insert(sta);
sta = NULL;
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 7fa8c6b..999f6be 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2652,7 +2652,8 @@ static int prepare_for_handlers(struct ieee80211_rx_data *rx,
else
rate_idx = status->rate_idx;
rx->sta = ieee80211_ibss_add_sta(sdata, bssid,
- hdr->addr2, BIT(rate_idx), GFP_ATOMIC);
+ hdr->addr2, BIT(rate_idx), false,
+ GFP_ATOMIC);
}
break;
case NL80211_IFTYPE_MESH_POINT:
--
1.7.4.1
When adding a station, use the information given in the mac80211
populated ieee80211_sta structure to determine if it supports WME.
Provide this information to the FW.
This patch depends on "mac80211: propagate information about
STA WME support down".
Signed-off-by: Arik Nemtsov <[email protected]>
---
drivers/net/wireless/wl12xx/cmd.c | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/cmd.c b/drivers/net/wireless/wl12xx/cmd.c
index b3a4f58..c7f6f60 100644
--- a/drivers/net/wireless/wl12xx/cmd.c
+++ b/drivers/net/wireless/wl12xx/cmd.c
@@ -1166,14 +1166,7 @@ int wl1271_cmd_add_sta(struct wl1271 *wl, struct ieee80211_sta *sta, u8 hlid)
cmd->bss_index = WL1271_AP_BSS_INDEX;
cmd->aid = sta->aid;
cmd->hlid = hlid;
-
- /*
- * FIXME: Does STA support QOS? We need to propagate this info from
- * hostapd. Currently not that important since this is only used for
- * sending the correct flavor of null-data packet in response to a
- * trigger.
- */
- cmd->wmm = 0;
+ cmd->wmm = sta->wme ? 1 : 0;
cmd->supported_rates = cpu_to_le32(wl1271_tx_enabled_rates_get(wl,
sta->supp_rates[wl->band]));
--
1.7.4.1
I wonder, would it make sense to _move_ the flag instead of trying to
keep it twice? Since the flag shouldn't ever change that could even
remove some locking around it in some hotpaths...
> diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
> index 421eaa6..efa1d86 100644
> --- a/net/mac80211/ibss.c
> +++ b/net/mac80211/ibss.c
> @@ -310,11 +310,14 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
> } else
> sta = ieee80211_ibss_add_sta(sdata, mgmt->bssid,
> mgmt->sa, supp_rates,
> + elems->wmm_info != NULL,
> GFP_ATOMIC);
> }
>
> - if (sta && elems->wmm_info)
> + if (sta && elems->wmm_info) {
> set_sta_flags(sta, WLAN_STA_WME);
> + sta->sta.wme = true;
> + }
This seems duplicate now that you're passing it into ibss_add_sta().
However, it's currently sort of necessary to keep it correct:
> @@ -2652,7 +2652,8 @@ static int prepare_for_handlers(struct ieee80211_rx_data *rx,
> else
> rate_idx = status->rate_idx;
> rx->sta = ieee80211_ibss_add_sta(sdata, bssid,
> - hdr->addr2, BIT(rate_idx), GFP_ATOMIC);
> + hdr->addr2, BIT(rate_idx), false,
> + GFP_ATOMIC);
> }
> break;
> case NL80211_IFTYPE_MESH_POINT:
since you're not parsing anything here. Which also seems strange, at
least you could check if it was a QoS frame?
In any case, it seems to me that the driver needs to know the WME flag
while adding the station, not only at some arbitrary point later, which
doesn't happen here.
Maybe you should make the flag be AP-mode only after all :-)
johannes
On Mon, Jun 27, 2011 at 15:36, Johannes Berg <[email protected]> wrote:
> I wonder, would it make sense to _move_ the flag instead of trying to
> keep it twice? Since the flag shouldn't ever change that could even
> remove some locking around it in some hotpaths...
I'm not sure, but I haven't seen any atomic operations on this flag in a tx/rx.
>
>> diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
>> index 421eaa6..efa1d86 100644
>> --- a/net/mac80211/ibss.c
>> +++ b/net/mac80211/ibss.c
>> @@ -310,11 +310,14 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
>> ? ? ? ? ? ? ? ? ? ? ? } else
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? sta = ieee80211_ibss_add_sta(sdata, mgmt->bssid,
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mgmt->sa, supp_rates,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? elems->wmm_info != NULL,
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? GFP_ATOMIC);
>> ? ? ? ? ? ? ? }
>>
>> - ? ? ? ? ? ? if (sta && elems->wmm_info)
>> + ? ? ? ? ? ? if (sta && elems->wmm_info) {
>> ? ? ? ? ? ? ? ? ? ? ? set_sta_flags(sta, WLAN_STA_WME);
>> + ? ? ? ? ? ? ? ? ? ? sta->sta.wme = true;
>> + ? ? ? ? ? ? }
>
> This seems duplicate now that you're passing it into ibss_add_sta().
Not really, the ibss_add_sta is not always called in the above code path.
>
> However, it's currently sort of necessary to keep it correct:
>
>> @@ -2652,7 +2652,8 @@ static int prepare_for_handlers(struct ieee80211_rx_data *rx,
>> ? ? ? ? ? ? ? ? ? ? ? else
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? rate_idx = status->rate_idx;
>> ? ? ? ? ? ? ? ? ? ? ? rx->sta = ieee80211_ibss_add_sta(sdata, bssid,
>> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? hdr->addr2, BIT(rate_idx), GFP_ATOMIC);
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? hdr->addr2, BIT(rate_idx), false,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? GFP_ATOMIC);
>> ? ? ? ? ? ? ? }
>> ? ? ? ? ? ? ? break;
>> ? ? ? case NL80211_IFTYPE_MESH_POINT:
>
> since you're not parsing anything here. Which also seems strange, at
> least you could check if it was a QoS frame?
>
> In any case, it seems to me that the driver needs to know the WME flag
> while adding the station, not only at some arbitrary point later, which
> doesn't happen here.
I admit it was a halfhearted attempt to introduce the flag. But
pre-parsing the packet here seemed ugly to me.
>
> Maybe you should make the flag be AP-mode only after all :-)
>
Yea I guess there's no use adding (fairly trivial) code that's not
really used by anyone.
Arik