| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2008, 2009 open80211s Ltd. |
|---|
| 3 | 4 | * 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. |
|---|
| 8 | 5 | */ |
|---|
| 9 | 6 | |
|---|
| 10 | 7 | #include <linux/etherdevice.h> |
|---|
| .. | .. |
|---|
| 79 | 76 | } |
|---|
| 80 | 77 | |
|---|
| 81 | 78 | /** |
|---|
| 82 | | - * |
|---|
| 83 | 79 | * mesh_path_assign_nexthop - update mesh path next hop |
|---|
| 84 | 80 | * |
|---|
| 85 | 81 | * @mpath: mesh path to update |
|---|
| .. | .. |
|---|
| 147 | 143 | } |
|---|
| 148 | 144 | |
|---|
| 149 | 145 | /** |
|---|
| 150 | | - * |
|---|
| 151 | 146 | * mesh_path_move_to_queue - Move or copy frames from one mpath queue to another |
|---|
| 152 | 147 | * |
|---|
| 153 | 148 | * This function is used to transfer or copy frames from an unresolved mpath to |
|---|
| .. | .. |
|---|
| 159 | 154 | * |
|---|
| 160 | 155 | * The gate mpath must be an active mpath with a valid mpath->next_hop. |
|---|
| 161 | 156 | * |
|---|
| 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) |
|---|
| 163 | 158 | * @from_mpath: The failed mpath |
|---|
| 164 | 159 | * @copy: When true, copy all the frames to the new mpath queue. When false, |
|---|
| 165 | 160 | * move them. |
|---|
| .. | .. |
|---|
| 221 | 216 | { |
|---|
| 222 | 217 | struct mesh_path *mpath; |
|---|
| 223 | 218 | |
|---|
| 224 | | - mpath = rhashtable_lookup_fast(&tbl->rhead, dst, mesh_rht_params); |
|---|
| 219 | + mpath = rhashtable_lookup(&tbl->rhead, dst, mesh_rht_params); |
|---|
| 225 | 220 | |
|---|
| 226 | 221 | if (mpath && mpath_expired(mpath)) { |
|---|
| 227 | 222 | spin_lock_bh(&mpath->state_lock); |
|---|
| .. | .. |
|---|
| 408 | 403 | { |
|---|
| 409 | 404 | struct mesh_table *tbl; |
|---|
| 410 | 405 | struct mesh_path *mpath, *new_mpath; |
|---|
| 411 | | - int ret; |
|---|
| 412 | 406 | |
|---|
| 413 | 407 | if (ether_addr_equal(dst, sdata->vif.addr)) |
|---|
| 414 | 408 | /* never add ourselves as neighbours */ |
|---|
| .. | .. |
|---|
| 426 | 420 | |
|---|
| 427 | 421 | tbl = sdata->u.mesh.mesh_paths; |
|---|
| 428 | 422 | 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); |
|---|
| 441 | 428 | spin_unlock_bh(&tbl->walk_lock); |
|---|
| 442 | 429 | |
|---|
| 443 | | - if (ret) { |
|---|
| 430 | + if (mpath) { |
|---|
| 444 | 431 | kfree(new_mpath); |
|---|
| 445 | 432 | |
|---|
| 446 | | - if (ret != -EEXIST) |
|---|
| 447 | | - return ERR_PTR(ret); |
|---|
| 433 | + if (IS_ERR(mpath)) |
|---|
| 434 | + return mpath; |
|---|
| 448 | 435 | |
|---|
| 449 | 436 | new_mpath = mpath; |
|---|
| 450 | 437 | } |
|---|
| .. | .. |
|---|
| 731 | 718 | void mesh_path_discard_frame(struct ieee80211_sub_if_data *sdata, |
|---|
| 732 | 719 | struct sk_buff *skb) |
|---|
| 733 | 720 | { |
|---|
| 734 | | - kfree_skb(skb); |
|---|
| 721 | + ieee80211_free_txskb(&sdata->local->hw, skb); |
|---|
| 735 | 722 | sdata->u.mesh.mshstats.dropped_frames_no_route++; |
|---|
| 736 | 723 | } |
|---|
| 737 | 724 | |
|---|