forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/net/mac80211/mesh_pathtbl.c
....@@ -1,10 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2008, 2009 open80211s Ltd.
34 * Author: Luis Carlos Cobo <luisca@cozybit.com>
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/etherdevice.h>
....@@ -79,7 +76,6 @@
7976 }
8077
8178 /**
82
- *
8379 * mesh_path_assign_nexthop - update mesh path next hop
8480 *
8581 * @mpath: mesh path to update
....@@ -147,7 +143,6 @@
147143 }
148144
149145 /**
150
- *
151146 * mesh_path_move_to_queue - Move or copy frames from one mpath queue to another
152147 *
153148 * This function is used to transfer or copy frames from an unresolved mpath to
....@@ -159,7 +154,7 @@
159154 *
160155 * The gate mpath must be an active mpath with a valid mpath->next_hop.
161156 *
162
- * @mpath: An active mpath the frames will be sent to (i.e. the gate)
157
+ * @gate_mpath: An active mpath the frames will be sent to (i.e. the gate)
163158 * @from_mpath: The failed mpath
164159 * @copy: When true, copy all the frames to the new mpath queue. When false,
165160 * move them.
....@@ -221,7 +216,7 @@
221216 {
222217 struct mesh_path *mpath;
223218
224
- mpath = rhashtable_lookup_fast(&tbl->rhead, dst, mesh_rht_params);
219
+ mpath = rhashtable_lookup(&tbl->rhead, dst, mesh_rht_params);
225220
226221 if (mpath && mpath_expired(mpath)) {
227222 spin_lock_bh(&mpath->state_lock);
....@@ -408,7 +403,6 @@
408403 {
409404 struct mesh_table *tbl;
410405 struct mesh_path *mpath, *new_mpath;
411
- int ret;
412406
413407 if (ether_addr_equal(dst, sdata->vif.addr))
414408 /* never add ourselves as neighbours */
....@@ -426,25 +420,18 @@
426420
427421 tbl = sdata->u.mesh.mesh_paths;
428422 spin_lock_bh(&tbl->walk_lock);
429
- do {
430
- ret = rhashtable_lookup_insert_fast(&tbl->rhead,
431
- &new_mpath->rhash,
432
- mesh_rht_params);
433
-
434
- if (ret == -EEXIST)
435
- mpath = rhashtable_lookup_fast(&tbl->rhead,
436
- dst,
437
- mesh_rht_params);
438
- else if (!ret)
439
- hlist_add_head(&new_mpath->walk_list, &tbl->walk_head);
440
- } while (unlikely(ret == -EEXIST && !mpath));
423
+ mpath = rhashtable_lookup_get_insert_fast(&tbl->rhead,
424
+ &new_mpath->rhash,
425
+ mesh_rht_params);
426
+ if (!mpath)
427
+ hlist_add_head(&new_mpath->walk_list, &tbl->walk_head);
441428 spin_unlock_bh(&tbl->walk_lock);
442429
443
- if (ret) {
430
+ if (mpath) {
444431 kfree(new_mpath);
445432
446
- if (ret != -EEXIST)
447
- return ERR_PTR(ret);
433
+ if (IS_ERR(mpath))
434
+ return mpath;
448435
449436 new_mpath = mpath;
450437 }
....@@ -731,7 +718,7 @@
731718 void mesh_path_discard_frame(struct ieee80211_sub_if_data *sdata,
732719 struct sk_buff *skb)
733720 {
734
- kfree_skb(skb);
721
+ ieee80211_free_txskb(&sdata->local->hw, skb);
735722 sdata->u.mesh.mshstats.dropped_frames_no_route++;
736723 }
737724