mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
mac80211: cleanup select_queue
There's a redundant rcu_read_lock/unlock pair, a redundant variable, and a few redundant accesses to the 1d_to_ac array. Fix this to make the code neater and easier to follow. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
db7ec38d8e
commit
172128468f
1 changed files with 6 additions and 14 deletions
|
@ -59,26 +59,22 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
|
||||||
{
|
{
|
||||||
struct ieee80211_local *local = sdata->local;
|
struct ieee80211_local *local = sdata->local;
|
||||||
struct sta_info *sta = NULL;
|
struct sta_info *sta = NULL;
|
||||||
u32 sta_flags = 0;
|
|
||||||
const u8 *ra = NULL;
|
const u8 *ra = NULL;
|
||||||
bool qos = false;
|
bool qos = false;
|
||||||
|
|
||||||
if (local->hw.queues < 4 || skb->len < 6) {
|
if (local->hw.queues < 4 || skb->len < 6) {
|
||||||
skb->priority = 0; /* required for correct WPA/11i MIC */
|
skb->priority = 0; /* required for correct WPA/11i MIC */
|
||||||
return min_t(u16, local->hw.queues - 1,
|
return min_t(u16, local->hw.queues - 1, IEEE80211_AC_BE);
|
||||||
ieee802_1d_to_ac[skb->priority]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
switch (sdata->vif.type) {
|
switch (sdata->vif.type) {
|
||||||
case NL80211_IFTYPE_AP_VLAN:
|
case NL80211_IFTYPE_AP_VLAN:
|
||||||
rcu_read_lock();
|
|
||||||
sta = rcu_dereference(sdata->u.vlan.sta);
|
sta = rcu_dereference(sdata->u.vlan.sta);
|
||||||
if (sta)
|
if (sta) {
|
||||||
sta_flags = get_sta_flags(sta);
|
qos = get_sta_flags(sta) & WLAN_STA_WME;
|
||||||
rcu_read_unlock();
|
|
||||||
if (sta)
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case NL80211_IFTYPE_AP:
|
case NL80211_IFTYPE_AP:
|
||||||
ra = skb->data;
|
ra = skb->data;
|
||||||
break;
|
break;
|
||||||
|
@ -107,17 +103,13 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
|
||||||
if (!sta && ra && !is_multicast_ether_addr(ra)) {
|
if (!sta && ra && !is_multicast_ether_addr(ra)) {
|
||||||
sta = sta_info_get(sdata, ra);
|
sta = sta_info_get(sdata, ra);
|
||||||
if (sta)
|
if (sta)
|
||||||
sta_flags = get_sta_flags(sta);
|
qos = get_sta_flags(sta) & WLAN_STA_WME;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sta_flags & WLAN_STA_WME)
|
|
||||||
qos = true;
|
|
||||||
|
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
if (!qos) {
|
if (!qos) {
|
||||||
skb->priority = 0; /* required for correct WPA/11i MIC */
|
skb->priority = 0; /* required for correct WPA/11i MIC */
|
||||||
return ieee802_1d_to_ac[skb->priority];
|
return IEEE80211_AC_BE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* use the data classifier to determine what 802.1d tag the
|
/* use the data classifier to determine what 802.1d tag the
|
||||||
|
|
Loading…
Reference in a new issue