aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-12-22 04:15:30 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-12-22 15:44:22 -0500
commit172128468f61e16e1427238278b9ad775584aa89 (patch)
tree2089bf1afd912c0b3ee0d486ed4be3a94517ca41 /net
parentdb7ec38d8e99f449856c11ffaef363a8eb5af90f (diff)
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>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/wme.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index 58e75bbc1f91..28bc084dbfb9 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -59,26 +59,22 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
59{ 59{
60 struct ieee80211_local *local = sdata->local; 60 struct ieee80211_local *local = sdata->local;
61 struct sta_info *sta = NULL; 61 struct sta_info *sta = NULL;
62 u32 sta_flags = 0;
63 const u8 *ra = NULL; 62 const u8 *ra = NULL;
64 bool qos = false; 63 bool qos = false;
65 64
66 if (local->hw.queues < 4 || skb->len < 6) { 65 if (local->hw.queues < 4 || skb->len < 6) {
67 skb->priority = 0; /* required for correct WPA/11i MIC */ 66 skb->priority = 0; /* required for correct WPA/11i MIC */
68 return min_t(u16, local->hw.queues - 1, 67 return min_t(u16, local->hw.queues - 1, IEEE80211_AC_BE);
69 ieee802_1d_to_ac[skb->priority]);
70 } 68 }
71 69
72 rcu_read_lock(); 70 rcu_read_lock();
73 switch (sdata->vif.type) { 71 switch (sdata->vif.type) {
74 case NL80211_IFTYPE_AP_VLAN: 72 case NL80211_IFTYPE_AP_VLAN:
75 rcu_read_lock();
76 sta = rcu_dereference(sdata->u.vlan.sta); 73 sta = rcu_dereference(sdata->u.vlan.sta);
77 if (sta) 74 if (sta) {
78 sta_flags = get_sta_flags(sta); 75 qos = get_sta_flags(sta) & WLAN_STA_WME;
79 rcu_read_unlock();
80 if (sta)
81 break; 76 break;
77 }
82 case NL80211_IFTYPE_AP: 78 case NL80211_IFTYPE_AP:
83 ra = skb->data; 79 ra = skb->data;
84 break; 80 break;
@@ -107,17 +103,13 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
107 if (!sta && ra && !is_multicast_ether_addr(ra)) { 103 if (!sta && ra && !is_multicast_ether_addr(ra)) {
108 sta = sta_info_get(sdata, ra); 104 sta = sta_info_get(sdata, ra);
109 if (sta) 105 if (sta)
110 sta_flags = get_sta_flags(sta); 106 qos = get_sta_flags(sta) & WLAN_STA_WME;
111 } 107 }
112
113 if (sta_flags & WLAN_STA_WME)
114 qos = true;
115
116 rcu_read_unlock(); 108 rcu_read_unlock();
117 109
118 if (!qos) { 110 if (!qos) {
119 skb->priority = 0; /* required for correct WPA/11i MIC */ 111 skb->priority = 0; /* required for correct WPA/11i MIC */
120 return ieee802_1d_to_ac[skb->priority]; 112 return IEEE80211_AC_BE;
121 } 113 }
122 114
123 /* use the data classifier to determine what 802.1d tag the 115 /* use the data classifier to determine what 802.1d tag the