aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/node.c
diff options
context:
space:
mode:
authorJon Paul Maloy <jon.maloy@ericsson.com>2015-07-16 16:54:20 -0400
committerDavid S. Miller <davem@davemloft.net>2015-07-20 23:41:14 -0400
commitd3a43b907ae688af6cb753c53cd7de05f3c1ba85 (patch)
treeb21793fdb903042e7fa094856ae477cf7928090b /net/tipc/node.c
parent9d13ec65ede775f896c3da1cfa35283afe2f796c (diff)
tipc: move link creation from neighbor discoverer to node
As a step towards turning links into node internal entities, we move the creation of links from the neighbor discovery logics to the node's link control logics. We also create an additional entry for the link's media address in the newly introduced struct tipc_link_entry, since this is where it is needed in the upcoming commits. The current copy in struct tipc_link is kept for now, but will be removed later. Reviewed-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/node.c')
-rw-r--r--net/tipc/node.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c
index db46e5d1d156..06f642abdf38 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -334,6 +334,33 @@ bool tipc_node_is_up(struct tipc_node *n)
334 return n->active_links[0]; 334 return n->active_links[0];
335} 335}
336 336
337void tipc_node_check_dest(struct tipc_node *n, struct tipc_bearer *b,
338 bool *link_up, bool *addr_match,
339 struct tipc_media_addr *maddr)
340{
341 struct tipc_link *l = n->links[b->identity].link;
342 struct tipc_media_addr *curr = &n->links[b->identity].maddr;
343
344 *link_up = l && tipc_link_is_up(l);
345 *addr_match = l && !memcmp(curr, maddr, sizeof(*maddr));
346}
347
348bool tipc_node_update_dest(struct tipc_node *n, struct tipc_bearer *b,
349 struct tipc_media_addr *maddr)
350{
351 struct tipc_link *l = n->links[b->identity].link;
352 struct tipc_media_addr *curr = &n->links[b->identity].maddr;
353
354 if (!l)
355 l = tipc_link_create(n, b, maddr);
356 if (!l)
357 return false;
358 memcpy(&l->media_addr, maddr, sizeof(*maddr));
359 memcpy(curr, maddr, sizeof(*maddr));
360 tipc_link_reset(l);
361 return true;
362}
363
337void tipc_node_attach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr) 364void tipc_node_attach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
338{ 365{
339 n_ptr->links[l_ptr->bearer_id].link = l_ptr; 366 n_ptr->links[l_ptr->bearer_id].link = l_ptr;