diff options
| author | David S. Miller <davem@davemloft.net> | 2017-12-11 09:58:39 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2017-12-11 09:58:39 -0500 |
| commit | 9944a0f2f502e4501fccb1dc0a64a6012c83dd97 (patch) | |
| tree | 98769c3324dd57bc2070c08852c9bf1f272ba2b8 /net/mac80211/mesh_pathtbl.c | |
| parent | a0b586fa75a69578ecf10b40582eed9b35de2432 (diff) | |
| parent | 64e0cd0d3540dbbdf6661943025409e6b31d5178 (diff) | |
Merge branch 'rhashtable-New-features-in-walk-and-bucket'
Tom Herbert says:
====================
rhashtable: New features in walk and bucket
This patch contains some changes to related rhashtable:
- Above allow rhashtable_walk_start to return void
- Add a functon to peek at the next entry during a walk
- Abstract out function to compute a has for a table
- A library function to alloc a spinlocks bucket array
- Call the above function for rhashtable locks allocation
Tested: Exercised using various operations on an ILA xlat
table.
v2:
- Apply feedback from Herbert. Don't change semantics of resize
event reporting and -EAGAIN, just simplify API for callers that
ignore those.
- Add end_of_table in iter to reliably tell when the iterator has
reached to the eno.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac80211/mesh_pathtbl.c')
| -rw-r--r-- | net/mac80211/mesh_pathtbl.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index 86c8dfef56a4..a5125624a76d 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c | |||
| @@ -257,9 +257,7 @@ __mesh_path_lookup_by_idx(struct mesh_table *tbl, int idx) | |||
| 257 | if (ret) | 257 | if (ret) |
| 258 | return NULL; | 258 | return NULL; |
| 259 | 259 | ||
| 260 | ret = rhashtable_walk_start(&iter); | 260 | rhashtable_walk_start(&iter); |
| 261 | if (ret && ret != -EAGAIN) | ||
| 262 | goto err; | ||
| 263 | 261 | ||
| 264 | while ((mpath = rhashtable_walk_next(&iter))) { | 262 | while ((mpath = rhashtable_walk_next(&iter))) { |
| 265 | if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN) | 263 | if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN) |
| @@ -269,7 +267,6 @@ __mesh_path_lookup_by_idx(struct mesh_table *tbl, int idx) | |||
| 269 | if (i++ == idx) | 267 | if (i++ == idx) |
| 270 | break; | 268 | break; |
| 271 | } | 269 | } |
| 272 | err: | ||
| 273 | rhashtable_walk_stop(&iter); | 270 | rhashtable_walk_stop(&iter); |
| 274 | rhashtable_walk_exit(&iter); | 271 | rhashtable_walk_exit(&iter); |
| 275 | 272 | ||
| @@ -513,9 +510,7 @@ void mesh_plink_broken(struct sta_info *sta) | |||
| 513 | if (ret) | 510 | if (ret) |
| 514 | return; | 511 | return; |
| 515 | 512 | ||
| 516 | ret = rhashtable_walk_start(&iter); | 513 | rhashtable_walk_start(&iter); |
| 517 | if (ret && ret != -EAGAIN) | ||
| 518 | goto out; | ||
| 519 | 514 | ||
| 520 | while ((mpath = rhashtable_walk_next(&iter))) { | 515 | while ((mpath = rhashtable_walk_next(&iter))) { |
| 521 | if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN) | 516 | if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN) |
| @@ -535,7 +530,6 @@ void mesh_plink_broken(struct sta_info *sta) | |||
| 535 | WLAN_REASON_MESH_PATH_DEST_UNREACHABLE, bcast); | 530 | WLAN_REASON_MESH_PATH_DEST_UNREACHABLE, bcast); |
| 536 | } | 531 | } |
| 537 | } | 532 | } |
| 538 | out: | ||
| 539 | rhashtable_walk_stop(&iter); | 533 | rhashtable_walk_stop(&iter); |
| 540 | rhashtable_walk_exit(&iter); | 534 | rhashtable_walk_exit(&iter); |
| 541 | } | 535 | } |
| @@ -584,9 +578,7 @@ void mesh_path_flush_by_nexthop(struct sta_info *sta) | |||
| 584 | if (ret) | 578 | if (ret) |
| 585 | return; | 579 | return; |
| 586 | 580 | ||
| 587 | ret = rhashtable_walk_start(&iter); | 581 | rhashtable_walk_start(&iter); |
| 588 | if (ret && ret != -EAGAIN) | ||
| 589 | goto out; | ||
| 590 | 582 | ||
| 591 | while ((mpath = rhashtable_walk_next(&iter))) { | 583 | while ((mpath = rhashtable_walk_next(&iter))) { |
| 592 | if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN) | 584 | if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN) |
| @@ -597,7 +589,7 @@ void mesh_path_flush_by_nexthop(struct sta_info *sta) | |||
| 597 | if (rcu_access_pointer(mpath->next_hop) == sta) | 589 | if (rcu_access_pointer(mpath->next_hop) == sta) |
| 598 | __mesh_path_del(tbl, mpath); | 590 | __mesh_path_del(tbl, mpath); |
| 599 | } | 591 | } |
| 600 | out: | 592 | |
| 601 | rhashtable_walk_stop(&iter); | 593 | rhashtable_walk_stop(&iter); |
| 602 | rhashtable_walk_exit(&iter); | 594 | rhashtable_walk_exit(&iter); |
| 603 | } | 595 | } |
| @@ -614,9 +606,7 @@ static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata, | |||
| 614 | if (ret) | 606 | if (ret) |
| 615 | return; | 607 | return; |
| 616 | 608 | ||
| 617 | ret = rhashtable_walk_start(&iter); | 609 | rhashtable_walk_start(&iter); |
| 618 | if (ret && ret != -EAGAIN) | ||
| 619 | goto out; | ||
| 620 | 610 | ||
| 621 | while ((mpath = rhashtable_walk_next(&iter))) { | 611 | while ((mpath = rhashtable_walk_next(&iter))) { |
| 622 | if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN) | 612 | if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN) |
| @@ -627,7 +617,7 @@ static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata, | |||
| 627 | if (ether_addr_equal(mpath->mpp, proxy)) | 617 | if (ether_addr_equal(mpath->mpp, proxy)) |
| 628 | __mesh_path_del(tbl, mpath); | 618 | __mesh_path_del(tbl, mpath); |
| 629 | } | 619 | } |
| 630 | out: | 620 | |
| 631 | rhashtable_walk_stop(&iter); | 621 | rhashtable_walk_stop(&iter); |
| 632 | rhashtable_walk_exit(&iter); | 622 | rhashtable_walk_exit(&iter); |
| 633 | } | 623 | } |
| @@ -642,9 +632,7 @@ static void table_flush_by_iface(struct mesh_table *tbl) | |||
| 642 | if (ret) | 632 | if (ret) |
| 643 | return; | 633 | return; |
| 644 | 634 | ||
| 645 | ret = rhashtable_walk_start(&iter); | 635 | rhashtable_walk_start(&iter); |
| 646 | if (ret && ret != -EAGAIN) | ||
| 647 | goto out; | ||
| 648 | 636 | ||
| 649 | while ((mpath = rhashtable_walk_next(&iter))) { | 637 | while ((mpath = rhashtable_walk_next(&iter))) { |
| 650 | if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN) | 638 | if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN) |
| @@ -653,7 +641,7 @@ static void table_flush_by_iface(struct mesh_table *tbl) | |||
| 653 | break; | 641 | break; |
| 654 | __mesh_path_del(tbl, mpath); | 642 | __mesh_path_del(tbl, mpath); |
| 655 | } | 643 | } |
| 656 | out: | 644 | |
| 657 | rhashtable_walk_stop(&iter); | 645 | rhashtable_walk_stop(&iter); |
| 658 | rhashtable_walk_exit(&iter); | 646 | rhashtable_walk_exit(&iter); |
| 659 | } | 647 | } |
| @@ -873,9 +861,7 @@ void mesh_path_tbl_expire(struct ieee80211_sub_if_data *sdata, | |||
| 873 | if (ret) | 861 | if (ret) |
| 874 | return; | 862 | return; |
| 875 | 863 | ||
| 876 | ret = rhashtable_walk_start(&iter); | 864 | rhashtable_walk_start(&iter); |
| 877 | if (ret && ret != -EAGAIN) | ||
| 878 | goto out; | ||
| 879 | 865 | ||
| 880 | while ((mpath = rhashtable_walk_next(&iter))) { | 866 | while ((mpath = rhashtable_walk_next(&iter))) { |
| 881 | if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN) | 867 | if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN) |
| @@ -887,7 +873,7 @@ void mesh_path_tbl_expire(struct ieee80211_sub_if_data *sdata, | |||
| 887 | time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE)) | 873 | time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE)) |
| 888 | __mesh_path_del(tbl, mpath); | 874 | __mesh_path_del(tbl, mpath); |
| 889 | } | 875 | } |
| 890 | out: | 876 | |
| 891 | rhashtable_walk_stop(&iter); | 877 | rhashtable_walk_stop(&iter); |
| 892 | rhashtable_walk_exit(&iter); | 878 | rhashtable_walk_exit(&iter); |
| 893 | } | 879 | } |
