diff options
author | Jon Paul Maloy <jon.maloy@ericsson.com> | 2017-01-18 13:50:51 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-20 12:10:16 -0500 |
commit | 2ae0b8af1fe35ddaa2e46704ae31a2f9cac0349d (patch) | |
tree | fb6ff13876c71217c98fad4456695b479f81e64f /net/tipc/bcast.c | |
parent | 9999974a8318b605ebae08a87e86232659e56a52 (diff) |
tipc: add functionality to lookup multicast destination nodes
As a further preparation for the upcoming 'replicast' functionality,
we add some necessary structs and functions for looking up and returning
a list of all nodes that host destinations for a given multicast message.
Reviewed-by: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/bcast.c')
-rw-r--r-- | net/tipc/bcast.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index 325627612bac..412d3351abb7 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c | |||
@@ -39,9 +39,8 @@ | |||
39 | #include "socket.h" | 39 | #include "socket.h" |
40 | #include "msg.h" | 40 | #include "msg.h" |
41 | #include "bcast.h" | 41 | #include "bcast.h" |
42 | #include "name_distr.h" | ||
43 | #include "link.h" | 42 | #include "link.h" |
44 | #include "node.h" | 43 | #include "name_table.h" |
45 | 44 | ||
46 | #define BCLINK_WIN_DEFAULT 50 /* bcast link window size (default) */ | 45 | #define BCLINK_WIN_DEFAULT 50 /* bcast link window size (default) */ |
47 | #define BCLINK_WIN_MIN 32 /* bcast minimum link window size */ | 46 | #define BCLINK_WIN_MIN 32 /* bcast minimum link window size */ |
@@ -434,3 +433,33 @@ void tipc_bcast_stop(struct net *net) | |||
434 | kfree(tn->bcbase); | 433 | kfree(tn->bcbase); |
435 | kfree(tn->bcl); | 434 | kfree(tn->bcl); |
436 | } | 435 | } |
436 | |||
437 | void tipc_nlist_init(struct tipc_nlist *nl, u32 self) | ||
438 | { | ||
439 | memset(nl, 0, sizeof(*nl)); | ||
440 | INIT_LIST_HEAD(&nl->list); | ||
441 | nl->self = self; | ||
442 | } | ||
443 | |||
444 | void tipc_nlist_add(struct tipc_nlist *nl, u32 node) | ||
445 | { | ||
446 | if (node == nl->self) | ||
447 | nl->local = true; | ||
448 | else if (u32_push(&nl->list, node)) | ||
449 | nl->remote++; | ||
450 | } | ||
451 | |||
452 | void tipc_nlist_del(struct tipc_nlist *nl, u32 node) | ||
453 | { | ||
454 | if (node == nl->self) | ||
455 | nl->local = false; | ||
456 | else if (u32_del(&nl->list, node)) | ||
457 | nl->remote--; | ||
458 | } | ||
459 | |||
460 | void tipc_nlist_purge(struct tipc_nlist *nl) | ||
461 | { | ||
462 | u32_list_purge(&nl->list); | ||
463 | nl->remote = 0; | ||
464 | nl->local = 0; | ||
465 | } | ||