1 From: Sriram R <quic_srirrama@quicinc.com>
2 Date: Thu, 18 Aug 2022 12:35:42 +0530
3 Subject: [PATCH] wifi: mac80211: mesh fast xmit support
5 Currently fast xmit is supported in AP, STA and other device types where
6 the destination doesn't change for the lifetime of its association by
7 caching the static parts of the header that can be reused directly for
8 every Tx such as addresses and updates only mutable header fields such as
10 This technique is not directly applicable for a Mesh device type due
11 to the dynamic nature of the topology and protocol. The header is built
12 based on the destination mesh device which is proxying a certain external
13 device and based on the Mesh destination the next hop changes.
14 And the RA/A1 which is the next hop for reaching the destination can
15 vary during runtime as per the best route based on airtime. To accommodate
16 these changes and to come up with a solution to avoid overhead during header
17 generation, the headers comprising the MAC, Mesh and LLC part are cached
18 whenever data for a certain external destination is sent.
19 This cached header is reused every time a data is sent to that external
22 To ensure the changes in network are reflected in these cached headers,
23 flush affected cached entries on path changes, as well as other conditions
24 that currently trigger a fast xmit check in other modes (key changes etc.)
26 In order to keep the cache small, use a short timeout for expiring cache
29 Co-developed-by: Felix Fietkau <nbd@nbd.name>
30 Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
31 Signed-off-by: Felix Fietkau <nbd@nbd.name>
34 --- a/net/mac80211/ieee80211_i.h
35 +++ b/net/mac80211/ieee80211_i.h
37 extern const struct cfg80211_ops mac80211_config_ops;
39 struct ieee80211_local;
40 +struct mhdr_cache_entry;
42 /* Maximum number of broadcast/multicast frames to buffer when some of the
43 * associated stations are using power saving. */
44 @@ -655,6 +656,20 @@ struct mesh_table {
45 atomic_t entries; /* Up to MAX_MESH_NEIGHBOURS */
49 + * struct mesh_hdr_cache - mesh fast xmit header cache
51 + * @rhead: hash table containing struct mhdr_cache_entry, using skb DA as key
52 + * @walk_head: linked list containing all mhdr_cache_entry objects
53 + * @walk_lock: lock protecting walk_head and rhead
54 + * @enabled: indicates if header cache is initialized
56 +struct mesh_hdr_cache {
57 + struct rhashtable rhead;
58 + struct hlist_head walk_head;
59 + spinlock_t walk_lock;
62 struct ieee80211_if_mesh {
63 struct timer_list housekeeping_timer;
64 struct timer_list mesh_path_timer;
65 @@ -733,6 +748,7 @@ struct ieee80211_if_mesh {
66 struct mesh_table mpp_paths; /* Store paths for MPP&MAP */
67 int mesh_paths_generation;
68 int mpp_paths_generation;
69 + struct mesh_hdr_cache hdr_cache;
72 #ifdef CPTCFG_MAC80211_MESH
73 @@ -1998,6 +2014,9 @@ int ieee80211_tx_control_port(struct wip
74 int link_id, u64 *cookie);
75 int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev,
76 const u8 *buf, size_t len);
77 +void __ieee80211_mesh_xmit_fast(struct ieee80211_sub_if_data *sdata,
78 + struct mhdr_cache_entry *entry,
79 + struct sk_buff *skb);
82 void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
83 --- a/net/mac80211/mesh.c
84 +++ b/net/mac80211/mesh.c
85 @@ -780,6 +780,8 @@ static void ieee80211_mesh_housekeeping(
86 changed = mesh_accept_plinks_update(sdata);
87 ieee80211_mbss_info_change_notify(sdata, changed);
89 + mesh_hdr_cache_gc(sdata);
91 mod_timer(&ifmsh->housekeeping_timer,
92 round_jiffies(jiffies +
93 IEEE80211_MESH_HOUSEKEEPING_INTERVAL));
94 --- a/net/mac80211/mesh.h
95 +++ b/net/mac80211/mesh.h
96 @@ -122,11 +122,49 @@ struct mesh_path {
97 u8 rann_snd_addr[ETH_ALEN];
99 unsigned long last_preq_to_root;
100 + unsigned long fast_xmit_check;
103 u32 path_change_count;
106 +#define MESH_HEADER_CACHE_MAX_SIZE 512
107 +#define MESH_HEADER_CACHE_THRESHOLD_SIZE 384
108 +#define MESH_HEADER_CACHE_TIMEOUT 8000 /* msecs */
109 +#define MESH_HEADER_MAX_LEN 68 /* mac+mesh+rfc1042 hdr */
112 + * struct mhdr_cache_entry - Cached Mesh header entry
113 + * @addr_key: The Ethernet DA which is the key for this entry
114 + * @hdr: The cached header
115 + * @machdr_len: Total length of the mac header
116 + * @hdrlen: Length of this header entry
117 + * @key: Key corresponding to the nexthop stored in the header
118 + * @pn_offs: Offset to PN which is updated for every xmit
119 + * @band: band used for tx
120 + * @walk_list: list containing all the cached header entries
121 + * @rhash: rhashtable pointer
122 + * @mpath: The Mesh path corresponding to the Mesh DA
123 + * @mppath: The MPP entry corresponding to this DA
124 + * @timestamp: Last used time of this entry
125 + * @rcu: rcu to free this entry
126 + * @path_change_count: Stored path change value corresponding to the mpath
128 +struct mhdr_cache_entry {
129 + u8 addr_key[ETH_ALEN] __aligned(2);
130 + u8 hdr[MESH_HEADER_MAX_LEN];
135 + struct ieee80211_key __rcu *key;
136 + struct hlist_node walk_list;
137 + struct rhash_head rhash;
138 + struct mesh_path *mpath, *mppath;
139 + unsigned long timestamp;
140 + struct rcu_head rcu;
143 /* Recent multicast cache */
144 /* RMC_BUCKETS must be a power of 2, maximum 256 */
145 #define RMC_BUCKETS 256
146 @@ -298,6 +336,15 @@ void mesh_path_discard_frame(struct ieee
147 void mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata);
149 bool mesh_action_is_path_sel(struct ieee80211_mgmt *mgmt);
150 +struct mhdr_cache_entry *
151 +mesh_get_cached_hdr(struct ieee80211_sub_if_data *sdata, const u8 *addr);
152 +void mesh_cache_hdr(struct ieee80211_sub_if_data *sdata,
153 + struct sk_buff *skb, struct mesh_path *mpath);
154 +void mesh_hdr_cache_gc(struct ieee80211_sub_if_data *sdata);
155 +void mesh_hdr_cache_flush(struct ieee80211_sub_if_data *sdata, const u8 *addr,
157 +void mesh_refresh_path(struct ieee80211_sub_if_data *sdata,
158 + struct mesh_path *mpath, const u8 *addr);
160 #ifdef CPTCFG_MAC80211_MESH
162 --- a/net/mac80211/mesh_hwmp.c
163 +++ b/net/mac80211/mesh_hwmp.c
164 @@ -491,8 +491,11 @@ static u32 hwmp_route_info_get(struct ie
168 - if (rcu_access_pointer(mpath->next_hop) != sta)
169 + if (rcu_access_pointer(mpath->next_hop) != sta) {
170 mpath->path_change_count++;
171 + mesh_hdr_cache_flush(mpath->sdata, mpath->dst,
174 mesh_path_assign_nexthop(mpath, sta);
175 mpath->flags |= MESH_PATH_SN_VALID;
176 mpath->metric = new_metric;
177 @@ -539,8 +542,11 @@ static u32 hwmp_route_info_get(struct ie
181 - if (rcu_access_pointer(mpath->next_hop) != sta)
182 + if (rcu_access_pointer(mpath->next_hop) != sta) {
183 mpath->path_change_count++;
184 + mesh_hdr_cache_flush(mpath->sdata, mpath->dst,
187 mesh_path_assign_nexthop(mpath, sta);
188 mpath->metric = last_hop_metric;
189 mpath->exp_time = time_after(mpath->exp_time, exp_time)
190 @@ -977,7 +983,7 @@ free:
191 * Locking: the function must be called from within a rcu read lock block.
194 -static void mesh_queue_preq(struct mesh_path *mpath, u8 flags)
195 +void mesh_queue_preq(struct mesh_path *mpath, u8 flags)
197 struct ieee80211_sub_if_data *sdata = mpath->sdata;
198 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
199 @@ -1215,6 +1221,20 @@ static int mesh_nexthop_lookup_nolearn(s
203 +void mesh_refresh_path(struct ieee80211_sub_if_data *sdata,
204 + struct mesh_path *mpath, const u8 *addr)
206 + if (mpath->flags & (MESH_PATH_REQ_QUEUED | MESH_PATH_FIXED |
207 + MESH_PATH_RESOLVING))
210 + if (time_after(jiffies,
212 + msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) &&
213 + (!addr || ether_addr_equal(sdata->vif.addr, addr)))
214 + mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH);
218 * mesh_nexthop_lookup - put the appropriate next hop on a mesh frame. Calling
219 * this function is considered "using" the associated mpath, so preempt a path
220 @@ -1242,19 +1262,18 @@ int mesh_nexthop_lookup(struct ieee80211
221 if (!mpath || !(mpath->flags & MESH_PATH_ACTIVE))
224 - if (time_after(jiffies,
226 - msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) &&
227 - ether_addr_equal(sdata->vif.addr, hdr->addr4) &&
228 - !(mpath->flags & MESH_PATH_RESOLVING) &&
229 - !(mpath->flags & MESH_PATH_FIXED))
230 - mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH);
231 + mesh_refresh_path(sdata, mpath, hdr->addr4);
233 next_hop = rcu_dereference(mpath->next_hop);
235 memcpy(hdr->addr1, next_hop->sta.addr, ETH_ALEN);
236 memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN);
237 ieee80211_mps_set_frame_flags(sdata, next_hop, hdr);
238 + /* Cache the whole header so as to use next time rather than resolving
239 + * and building it every time
241 + if (ieee80211_hw_check(&sdata->local->hw, SUPPORT_FAST_XMIT))
242 + mesh_cache_hdr(sdata, skb, mpath);
246 --- a/net/mac80211/mesh_pathtbl.c
247 +++ b/net/mac80211/mesh_pathtbl.c
250 #include "ieee80211_i.h"
252 +#include <linux/rhashtable.h>
254 static void mesh_path_free_rcu(struct mesh_table *tbl, struct mesh_path *mpath);
256 @@ -32,6 +33,41 @@ static const struct rhashtable_params me
257 .hashfn = mesh_table_hash,
260 +static const struct rhashtable_params mesh_hdr_rht_params = {
262 + .automatic_shrinking = true,
263 + .key_len = ETH_ALEN,
264 + .key_offset = offsetof(struct mhdr_cache_entry, addr_key),
265 + .head_offset = offsetof(struct mhdr_cache_entry, rhash),
266 + .hashfn = mesh_table_hash,
269 +static void __mesh_hdr_cache_entry_free(void *ptr, void *tblptr)
271 + struct mhdr_cache_entry *mhdr = ptr;
273 + kfree_rcu(mhdr, rcu);
276 +static void mesh_hdr_cache_deinit(struct ieee80211_sub_if_data *sdata)
278 + struct mesh_hdr_cache *cache;
280 + cache = &sdata->u.mesh.hdr_cache;
281 + rhashtable_free_and_destroy(&cache->rhead,
282 + __mesh_hdr_cache_entry_free, NULL);
285 +static void mesh_hdr_cache_init(struct ieee80211_sub_if_data *sdata)
287 + struct mesh_hdr_cache *cache;
289 + cache = &sdata->u.mesh.hdr_cache;
290 + rhashtable_init(&cache->rhead, &mesh_hdr_rht_params);
291 + INIT_HLIST_HEAD(&cache->walk_head);
292 + spin_lock_init(&cache->walk_lock);
295 static inline bool mpath_expired(struct mesh_path *mpath)
297 return (mpath->flags & MESH_PATH_ACTIVE) &&
298 @@ -381,6 +417,211 @@ struct mesh_path *mesh_path_new(struct i
302 +struct mhdr_cache_entry *
303 +mesh_get_cached_hdr(struct ieee80211_sub_if_data *sdata, const u8 *addr)
305 + struct mesh_path *mpath, *mppath;
306 + struct mhdr_cache_entry *entry;
307 + struct mesh_hdr_cache *cache;
309 + cache = &sdata->u.mesh.hdr_cache;
310 + entry = rhashtable_lookup(&cache->rhead, addr, mesh_hdr_rht_params);
314 + mpath = rcu_dereference(entry->mpath);
315 + mppath = rcu_dereference(entry->mppath);
316 + if (!(mpath->flags & MESH_PATH_ACTIVE) || mpath_expired(mpath))
319 + mesh_refresh_path(sdata, mpath, NULL);
321 + mppath->exp_time = jiffies;
322 + entry->timestamp = jiffies;
327 +void mesh_cache_hdr(struct ieee80211_sub_if_data *sdata,
328 + struct sk_buff *skb, struct mesh_path *mpath)
330 + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
331 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
332 + struct mesh_hdr_cache *cache;
333 + struct mhdr_cache_entry *mhdr, *old_mhdr;
334 + struct ieee80211s_hdr *meshhdr;
335 + struct sta_info *next_hop;
336 + struct ieee80211_key *key;
337 + struct mesh_path *mppath;
342 + if (sdata->noack_map)
345 + if (!ieee80211_is_data_qos(hdr->frame_control))
348 + hdrlen = ieee80211_hdrlen(hdr->frame_control);
349 + meshhdr = (struct ieee80211s_hdr *)(skb->data + hdrlen);
350 + meshhdr_len = ieee80211_get_mesh_hdrlen(meshhdr);
352 + cache = &sdata->u.mesh.hdr_cache;
353 + if (atomic_read(&cache->rhead.nelems) >= MESH_HEADER_CACHE_MAX_SIZE)
356 + next_hop = rcu_dereference(mpath->next_hop);
360 + if ((meshhdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) {
361 + /* This is required to keep the mppath alive */
362 + mppath = mpp_path_lookup(sdata, meshhdr->eaddr1);
365 + } else if (ieee80211_has_a4(hdr->frame_control)) {
371 + /* rate limit, in case fast xmit can't be enabled */
372 + if (mppath->fast_xmit_check == jiffies)
375 + mppath->fast_xmit_check = jiffies;
377 + key = rcu_access_pointer(next_hop->ptk[next_hop->ptk_idx]);
379 + key = rcu_access_pointer(sdata->default_unicast_key);
382 + bool gen_iv, iv_spc;
384 + gen_iv = key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV;
385 + iv_spc = key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE;
387 + if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) ||
388 + (key->flags & KEY_FLAG_TAINTED))
391 + switch (key->conf.cipher) {
392 + case WLAN_CIPHER_SUITE_CCMP:
393 + case WLAN_CIPHER_SUITE_CCMP_256:
396 + if (gen_iv || iv_spc)
397 + hdrlen += IEEE80211_CCMP_HDR_LEN;
399 + case WLAN_CIPHER_SUITE_GCMP:
400 + case WLAN_CIPHER_SUITE_GCMP_256:
403 + if (gen_iv || iv_spc)
404 + hdrlen += IEEE80211_GCMP_HDR_LEN;
411 + if (WARN_ON_ONCE(hdrlen + meshhdr_len + sizeof(rfc1042_header) >
412 + MESH_HEADER_MAX_LEN))
415 + mhdr = kzalloc(sizeof(*mhdr), GFP_ATOMIC);
419 + memcpy(mhdr->addr_key, mppath->dst, ETH_ALEN);
420 + mhdr->machdr_len = hdrlen;
421 + mhdr->hdrlen = mhdr->machdr_len + meshhdr_len + sizeof(rfc1042_header);
422 + rcu_assign_pointer(mhdr->mpath, mpath);
423 + if (meshhdr->flags & MESH_FLAGS_AE)
424 + rcu_assign_pointer(mhdr->mppath, mppath);
425 + rcu_assign_pointer(mhdr->key, key);
426 + mhdr->timestamp = jiffies;
427 + mhdr->band = info->band;
428 + mhdr->pn_offs = pn_offs;
431 + memcpy(mhdr->hdr, skb->data, pn_offs);
432 + memcpy(mhdr->hdr + mhdr->machdr_len, skb->data + pn_offs,
433 + mhdr->hdrlen - mhdr->machdr_len);
435 + memcpy(mhdr->hdr, skb->data, mhdr->hdrlen);
439 + hdr = (struct ieee80211_hdr *)mhdr->hdr;
440 + hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
443 + spin_lock_bh(&cache->walk_lock);
444 + old_mhdr = rhashtable_lookup_get_insert_fast(&cache->rhead,
446 + mesh_hdr_rht_params);
447 + if (likely(!old_mhdr))
448 + hlist_add_head(&mhdr->walk_list, &cache->walk_head);
451 + spin_unlock_bh(&cache->walk_lock);
454 +static void mesh_hdr_cache_entry_free(struct mesh_hdr_cache *cache,
455 + struct mhdr_cache_entry *entry)
457 + hlist_del_rcu(&entry->walk_list);
458 + rhashtable_remove_fast(&cache->rhead, &entry->rhash, mesh_hdr_rht_params);
459 + kfree_rcu(entry, rcu);
462 +void mesh_hdr_cache_gc(struct ieee80211_sub_if_data *sdata)
464 + unsigned long timeout = msecs_to_jiffies(MESH_HEADER_CACHE_TIMEOUT);
465 + struct mesh_hdr_cache *cache;
466 + struct mhdr_cache_entry *entry;
467 + struct hlist_node *n;
469 + cache = &sdata->u.mesh.hdr_cache;
470 + if (atomic_read(&cache->rhead.nelems) < MESH_HEADER_CACHE_THRESHOLD_SIZE)
473 + spin_lock_bh(&cache->walk_lock);
474 + hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list)
475 + if (!time_is_after_jiffies(entry->timestamp + timeout))
476 + mesh_hdr_cache_entry_free(cache, entry);
477 + spin_unlock_bh(&cache->walk_lock);
480 +void mesh_hdr_cache_flush(struct ieee80211_sub_if_data *sdata, const u8 *addr,
483 + struct mesh_hdr_cache *cache = &sdata->u.mesh.hdr_cache;
484 + struct mhdr_cache_entry *entry;
485 + struct hlist_node *n;
487 + cache = &sdata->u.mesh.hdr_cache;
488 + spin_lock_bh(&cache->walk_lock);
490 + /* Only one header per mpp address is expected in the header cache */
492 + entry = rhashtable_lookup(&cache->rhead, addr,
493 + mesh_hdr_rht_params);
495 + mesh_hdr_cache_entry_free(cache, entry);
499 + hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list)
500 + if (ether_addr_equal(entry->mpath->dst, addr))
501 + mesh_hdr_cache_entry_free(cache, entry);
504 + spin_unlock_bh(&cache->walk_lock);
508 * mesh_path_add - allocate and add a new path to the mesh path table
509 * @dst: destination address of the path (ETH_ALEN length)
510 @@ -521,6 +762,8 @@ static void mesh_path_free_rcu(struct me
512 static void __mesh_path_del(struct mesh_table *tbl, struct mesh_path *mpath)
514 + mesh_hdr_cache_flush(mpath->sdata, mpath->dst,
515 + tbl == &mpath->sdata->u.mesh.mpp_paths);
516 hlist_del_rcu(&mpath->walk_list);
517 rhashtable_remove_fast(&tbl->rhead, &mpath->rhash, mesh_rht_params);
518 mesh_path_free_rcu(tbl, mpath);
519 @@ -747,6 +990,7 @@ void mesh_path_fix_nexthop(struct mesh_p
521 mpath->flags = MESH_PATH_FIXED | MESH_PATH_SN_VALID;
522 mesh_path_activate(mpath);
523 + mesh_hdr_cache_flush(mpath->sdata, mpath->dst, false);
524 spin_unlock_bh(&mpath->state_lock);
525 ewma_mesh_fail_avg_init(&next_hop->mesh->fail_avg);
526 /* init it at a low value - 0 start is tricky */
527 @@ -758,6 +1002,7 @@ void mesh_pathtbl_init(struct ieee80211_
529 mesh_table_init(&sdata->u.mesh.mesh_paths);
530 mesh_table_init(&sdata->u.mesh.mpp_paths);
531 + mesh_hdr_cache_init(sdata);
535 @@ -785,6 +1030,7 @@ void mesh_path_expire(struct ieee80211_s
537 void mesh_pathtbl_unregister(struct ieee80211_sub_if_data *sdata)
539 + mesh_hdr_cache_deinit(sdata);
540 mesh_table_free(&sdata->u.mesh.mesh_paths);
541 mesh_table_free(&sdata->u.mesh.mpp_paths);
543 --- a/net/mac80211/rx.c
544 +++ b/net/mac80211/rx.c
545 @@ -2791,6 +2791,7 @@ ieee80211_rx_mesh_data(struct ieee80211_
546 if (mesh_hdr->flags & MESH_FLAGS_AE) {
547 struct mesh_path *mppath;
549 + bool update = false;
552 proxied_addr = mesh_hdr->eaddr1;
553 @@ -2806,11 +2807,18 @@ ieee80211_rx_mesh_data(struct ieee80211_
554 mpp_path_add(sdata, proxied_addr, eth->h_source);
556 spin_lock_bh(&mppath->state_lock);
557 - if (!ether_addr_equal(mppath->mpp, eth->h_source))
558 + if (!ether_addr_equal(mppath->mpp, eth->h_source)) {
559 memcpy(mppath->mpp, eth->h_source, ETH_ALEN);
562 mppath->exp_time = jiffies;
563 spin_unlock_bh(&mppath->state_lock);
566 + /* flush fast xmit cache if the address path changed */
568 + mesh_hdr_cache_flush(sdata, proxied_addr, true);
573 --- a/net/mac80211/tx.c
574 +++ b/net/mac80211/tx.c
575 @@ -3021,6 +3021,9 @@ void ieee80211_check_fast_xmit(struct st
576 if (!ieee80211_hw_check(&local->hw, SUPPORT_FAST_XMIT))
579 + if (ieee80211_vif_is_mesh(&sdata->vif))
580 + mesh_hdr_cache_flush(sdata, sta->addr, false);
582 /* Locking here protects both the pointer itself, and against concurrent
583 * invocations winning data access races to, e.g., the key pointer that
585 @@ -3723,6 +3726,155 @@ free:
589 +void __ieee80211_mesh_xmit_fast(struct ieee80211_sub_if_data *sdata,
590 + struct mhdr_cache_entry *entry,
591 + struct sk_buff *skb)
593 + struct ieee80211_local *local = sdata->local;
594 + struct ieee80211_tx_data tx = {};
595 + struct ieee80211_tx_info *info;
596 + struct ieee80211_key *key;
597 + struct ieee80211_hdr *hdr;
598 + struct mesh_path *mpath;
599 + ieee80211_tx_result r;
600 + struct sta_info *sta;
603 + if (!IS_ENABLED(CPTCFG_MAC80211_MESH))
606 + info = IEEE80211_SKB_CB(skb);
607 + memset(info, 0, sizeof(*info));
608 + info->band = entry->band;
609 + info->control.vif = &sdata->vif;
610 + info->flags = IEEE80211_TX_CTL_FIRST_FRAGMENT |
611 + IEEE80211_TX_CTL_DONTFRAG;
613 + info->control.flags = IEEE80211_TX_CTRL_FAST_XMIT;
615 +#ifdef CONFIG_MAC80211_DEBUGFS
616 + if (local->force_tx_status)
617 + info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
620 + mpath = entry->mpath;
622 + sta = rcu_dereference(mpath->next_hop);
624 + __skb_queue_head_init(&tx.skbs);
626 + tx.flags = IEEE80211_TX_UNICAST;
633 + hdr = (struct ieee80211_hdr *)skb->data;
634 + tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
635 + *ieee80211_get_qos_ctl(hdr) = tid;
637 + ieee80211_aggr_check(sdata, sta, skb);
639 + if (ieee80211_queue_skb(local, sdata, sta, skb))
642 + r = ieee80211_xmit_fast_finish(sdata, sta, entry->pn_offs, key, &tx);
643 + if (r == TX_DROP) {
648 + __skb_queue_tail(&tx.skbs, skb);
649 + ieee80211_tx_frags(local, &sdata->vif, sta, &tx.skbs, false);
653 +static bool ieee80211_mesh_xmit_fast(struct ieee80211_sub_if_data *sdata,
654 + struct sk_buff *skb, u32 ctrl_flags)
656 + struct ieee80211_local *local = sdata->local;
657 + struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
658 + struct mhdr_cache_entry *entry;
659 + struct ieee80211s_hdr *meshhdr;
660 + u8 sa[ETH_ALEN] __aligned(2);
661 + struct sta_info *sta;
662 + bool copy_sa = false;
665 + if (ctrl_flags & IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP)
668 + if (ifmsh->mshcfg.dot11MeshNolearn)
671 + if (!ieee80211_hw_check(&local->hw, SUPPORT_FAST_XMIT))
674 + /* Add support for these cases later */
675 + if (ifmsh->ps_peers_light_sleep || ifmsh->ps_peers_deep_sleep)
678 + if (is_multicast_ether_addr(skb->data))
681 + ethertype = (skb->data[12] << 8) | skb->data[13];
682 + if (ethertype < ETH_P_802_3_MIN)
685 + if (skb->sk && skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)
688 + if (skb->ip_summed == CHECKSUM_PARTIAL) {
689 + skb_set_transport_header(skb, skb_checksum_start_offset(skb));
690 + if (skb_checksum_help(skb))
694 + entry = mesh_get_cached_hdr(sdata, skb->data);
698 + /* Avoid extra work in this path */
699 + if (skb_headroom(skb) < (entry->hdrlen - ETH_HLEN + 2))
702 + /* If the skb is shared we need to obtain our own copy */
703 + if (skb_shared(skb)) {
704 + struct sk_buff *oskb = skb;
706 + skb = skb_clone(skb, GFP_ATOMIC);
713 + sta = rcu_dereference(entry->mpath->next_hop);
714 + skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb));
716 + meshhdr = (struct ieee80211s_hdr *)(entry->hdr + entry->machdr_len);
717 + if ((meshhdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) {
718 + /* preserve SA from eth header for 6-addr frames */
719 + ether_addr_copy(sa, skb->data + ETH_ALEN);
723 + memcpy(skb_push(skb, entry->hdrlen - 2 * ETH_ALEN), entry->hdr,
726 + meshhdr = (struct ieee80211s_hdr *)(skb->data + entry->machdr_len);
727 + put_unaligned_le32(atomic_inc_return(&sdata->u.mesh.mesh_seqnum),
729 + meshhdr->ttl = sdata->u.mesh.mshcfg.dot11MeshTTL;
731 + ether_addr_copy(meshhdr->eaddr2, sa);
733 + __ieee80211_mesh_xmit_fast(sdata, entry, skb);
738 static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
739 struct sta_info *sta,
740 struct ieee80211_fast_tx *fast_tx,
741 @@ -4244,8 +4396,14 @@ void __ieee80211_subif_start_xmit(struct
745 + sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift);
749 + if (ieee80211_vif_is_mesh(&sdata->vif) &&
750 + ieee80211_mesh_xmit_fast(sdata, skb, ctrl_flags))
753 if (ieee80211_lookup_ra_sta(sdata, skb, &sta))
756 @@ -4255,8 +4413,6 @@ void __ieee80211_subif_start_xmit(struct
757 skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb));
758 ieee80211_aggr_check(sdata, sta, skb);
760 - sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift);
763 struct ieee80211_fast_tx *fast_tx;