forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/net/mac80211/wme.c
....@@ -1,10 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright 2004, Instant802 Networks, Inc.
34 * Copyright 2013-2014 Intel Mobile Communications GmbH
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License version 2 as
7
- * published by the Free Software Foundation.
85 */
96
107 #include <linux/netdevice.h>
....@@ -141,71 +138,24 @@
141138 return ieee80211_downgrade_queue(sdata, NULL, skb);
142139 }
143140
144
-/* Indicate which queue to use. */
145
-u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
146
- struct sk_buff *skb)
141
+u16 __ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
142
+ struct sta_info *sta, struct sk_buff *skb)
147143 {
148
- struct ieee80211_local *local = sdata->local;
149
- struct sta_info *sta = NULL;
150
- const u8 *ra = NULL;
151
- bool qos = false;
152144 struct mac80211_qos_map *qos_map;
153
- u16 ret;
145
+ bool qos;
154146
155
- if (local->hw.queues < IEEE80211_NUM_ACS || skb->len < 6) {
156
- skb->priority = 0; /* required for correct WPA/11i MIC */
157
- return 0;
158
- }
159
-
160
- rcu_read_lock();
161
- switch (sdata->vif.type) {
162
- case NL80211_IFTYPE_AP_VLAN:
163
- sta = rcu_dereference(sdata->u.vlan.sta);
164
- if (sta) {
165
- qos = sta->sta.wme;
166
- break;
167
- }
168
- /* fall through */
169
- case NL80211_IFTYPE_AP:
170
- ra = skb->data;
171
- break;
172
- case NL80211_IFTYPE_WDS:
173
- ra = sdata->u.wds.remote_addr;
174
- break;
175
-#ifdef CONFIG_MAC80211_MESH
176
- case NL80211_IFTYPE_MESH_POINT:
147
+ /* all mesh/ocb stations are required to support WME */
148
+ if (sta && (sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
149
+ sdata->vif.type == NL80211_IFTYPE_OCB))
177150 qos = true;
178
- break;
179
-#endif
180
- case NL80211_IFTYPE_STATION:
181
- /* might be a TDLS station */
182
- sta = sta_info_get(sdata, skb->data);
183
- if (sta)
184
- qos = sta->sta.wme;
185
-
186
- ra = sdata->u.mgd.bssid;
187
- break;
188
- case NL80211_IFTYPE_ADHOC:
189
- ra = skb->data;
190
- break;
191
- case NL80211_IFTYPE_OCB:
192
- /* all stations are required to support WME */
193
- qos = true;
194
- break;
195
- default:
196
- break;
197
- }
198
-
199
- if (!sta && ra && !is_multicast_ether_addr(ra)) {
200
- sta = sta_info_get(sdata, ra);
201
- if (sta)
202
- qos = sta->sta.wme;
203
- }
151
+ else if (sta)
152
+ qos = sta->sta.wme;
153
+ else
154
+ qos = false;
204155
205156 if (!qos) {
206157 skb->priority = 0; /* required for correct WPA/11i MIC */
207
- ret = IEEE80211_AC_BE;
208
- goto out;
158
+ return IEEE80211_AC_BE;
209159 }
210160
211161 if (skb->protocol == sdata->control_port_protocol) {
....@@ -220,8 +170,61 @@
220170 &qos_map->qos_map : NULL);
221171
222172 downgrade:
223
- ret = ieee80211_downgrade_queue(sdata, sta, skb);
224
- out:
173
+ return ieee80211_downgrade_queue(sdata, sta, skb);
174
+}
175
+
176
+
177
+/* Indicate which queue to use. */
178
+u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
179
+ struct sk_buff *skb)
180
+{
181
+ struct ieee80211_local *local = sdata->local;
182
+ struct sta_info *sta = NULL;
183
+ const u8 *ra = NULL;
184
+ u16 ret;
185
+
186
+ /* when using iTXQ, we can do this later */
187
+ if (local->ops->wake_tx_queue)
188
+ return 0;
189
+
190
+ if (local->hw.queues < IEEE80211_NUM_ACS || skb->len < 6) {
191
+ skb->priority = 0; /* required for correct WPA/11i MIC */
192
+ return 0;
193
+ }
194
+
195
+ rcu_read_lock();
196
+ switch (sdata->vif.type) {
197
+ case NL80211_IFTYPE_AP_VLAN:
198
+ sta = rcu_dereference(sdata->u.vlan.sta);
199
+ if (sta)
200
+ break;
201
+ fallthrough;
202
+ case NL80211_IFTYPE_AP:
203
+ ra = skb->data;
204
+ break;
205
+ case NL80211_IFTYPE_WDS:
206
+ ra = sdata->u.wds.remote_addr;
207
+ break;
208
+ case NL80211_IFTYPE_STATION:
209
+ /* might be a TDLS station */
210
+ sta = sta_info_get(sdata, skb->data);
211
+ if (sta)
212
+ break;
213
+
214
+ ra = sdata->u.mgd.bssid;
215
+ break;
216
+ case NL80211_IFTYPE_ADHOC:
217
+ ra = skb->data;
218
+ break;
219
+ default:
220
+ break;
221
+ }
222
+
223
+ if (!sta && ra && !is_multicast_ether_addr(ra))
224
+ sta = sta_info_get(sdata, ra);
225
+
226
+ ret = __ieee80211_select_queue(sdata, sta, skb);
227
+
225228 rcu_read_unlock();
226229 return ret;
227230 }