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/sctp/socket.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/sctp/socket.c')
-rw-r--r-- | net/sctp/socket.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index eb17a911aa29..3e55daa37e66 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -4676,20 +4676,11 @@ int sctp_get_sctp_info(struct sock *sk, struct sctp_association *asoc, | |||
4676 | EXPORT_SYMBOL_GPL(sctp_get_sctp_info); | 4676 | EXPORT_SYMBOL_GPL(sctp_get_sctp_info); |
4677 | 4677 | ||
4678 | /* use callback to avoid exporting the core structure */ | 4678 | /* use callback to avoid exporting the core structure */ |
4679 | int sctp_transport_walk_start(struct rhashtable_iter *iter) | 4679 | void sctp_transport_walk_start(struct rhashtable_iter *iter) |
4680 | { | 4680 | { |
4681 | int err; | ||
4682 | |||
4683 | rhltable_walk_enter(&sctp_transport_hashtable, iter); | 4681 | rhltable_walk_enter(&sctp_transport_hashtable, iter); |
4684 | 4682 | ||
4685 | err = rhashtable_walk_start(iter); | 4683 | rhashtable_walk_start(iter); |
4686 | if (err && err != -EAGAIN) { | ||
4687 | rhashtable_walk_stop(iter); | ||
4688 | rhashtable_walk_exit(iter); | ||
4689 | return err; | ||
4690 | } | ||
4691 | |||
4692 | return 0; | ||
4693 | } | 4684 | } |
4694 | 4685 | ||
4695 | void sctp_transport_walk_stop(struct rhashtable_iter *iter) | 4686 | void sctp_transport_walk_stop(struct rhashtable_iter *iter) |
@@ -4780,12 +4771,10 @@ int sctp_for_each_transport(int (*cb)(struct sctp_transport *, void *), | |||
4780 | struct net *net, int *pos, void *p) { | 4771 | struct net *net, int *pos, void *p) { |
4781 | struct rhashtable_iter hti; | 4772 | struct rhashtable_iter hti; |
4782 | struct sctp_transport *tsp; | 4773 | struct sctp_transport *tsp; |
4783 | int ret; | 4774 | int ret = 0; |
4784 | 4775 | ||
4785 | again: | 4776 | again: |
4786 | ret = sctp_transport_walk_start(&hti); | 4777 | sctp_transport_walk_start(&hti); |
4787 | if (ret) | ||
4788 | return ret; | ||
4789 | 4778 | ||
4790 | tsp = sctp_transport_get_idx(net, &hti, *pos + 1); | 4779 | tsp = sctp_transport_get_idx(net, &hti, *pos + 1); |
4791 | for (; !IS_ERR_OR_NULL(tsp); tsp = sctp_transport_get_next(net, &hti)) { | 4780 | for (; !IS_ERR_OR_NULL(tsp); tsp = sctp_transport_get_next(net, &hti)) { |