aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/node.h
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2011-05-10 14:52:07 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2011-05-10 16:50:41 -0400
commit020abf03cd659388f94cb328e1e1df0656e0d7ff (patch)
tree40d05011708ad1b4a05928d167eb120420581aa6 /net/tipc/node.h
parent0ff8fbc61727c926883eec381fbd3d32d1fab504 (diff)
parent693d92a1bbc9e42681c42ed190bd42b636ca876f (diff)
Merge tag 'v2.6.39-rc7'
in order to pull in changes in drivers/media/dvb/firewire/ and sound/firewire/.
Diffstat (limited to 'net/tipc/node.h')
-rw-r--r--net/tipc/node.h61
1 files changed, 24 insertions, 37 deletions
diff --git a/net/tipc/node.h b/net/tipc/node.h
index fff331b2d26c..5c61afc7a0b9 100644
--- a/net/tipc/node.h
+++ b/net/tipc/node.h
@@ -2,7 +2,7 @@
2 * net/tipc/node.h: Include file for TIPC node management routines 2 * net/tipc/node.h: Include file for TIPC node management routines
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, 2010-2011, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -39,15 +39,15 @@
39 39
40#include "node_subscr.h" 40#include "node_subscr.h"
41#include "addr.h" 41#include "addr.h"
42#include "cluster.h" 42#include "net.h"
43#include "bearer.h" 43#include "bearer.h"
44 44
45/** 45/**
46 * struct tipc_node - TIPC node structure 46 * struct tipc_node - TIPC node structure
47 * @addr: network address of node 47 * @addr: network address of node
48 * @lock: spinlock governing access to structure 48 * @lock: spinlock governing access to structure
49 * @owner: pointer to cluster that node belongs to 49 * @hash: links to adjacent nodes in unsorted hash chain
50 * @next: pointer to next node in sorted list of cluster's nodes 50 * @list: links to adjacent nodes in sorted list of cluster's nodes
51 * @nsub: list of "node down" subscriptions monitoring node 51 * @nsub: list of "node down" subscriptions monitoring node
52 * @active_links: pointers to active links to node 52 * @active_links: pointers to active links to node
53 * @links: pointers to all links to node 53 * @links: pointers to all links to node
@@ -55,8 +55,6 @@
55 * @cleanup_required: non-zero if cleaning up after a prior loss of contact 55 * @cleanup_required: non-zero if cleaning up after a prior loss of contact
56 * @link_cnt: number of links to node 56 * @link_cnt: number of links to node
57 * @permit_changeover: non-zero if node has redundant links to this system 57 * @permit_changeover: non-zero if node has redundant links to this system
58 * @routers: bitmap (used for multicluster communication)
59 * @last_router: (used for multicluster communication)
60 * @bclink: broadcast-related info 58 * @bclink: broadcast-related info
61 * @supported: non-zero if node supports TIPC b'cast capability 59 * @supported: non-zero if node supports TIPC b'cast capability
62 * @acked: sequence # of last outbound b'cast message acknowledged by node 60 * @acked: sequence # of last outbound b'cast message acknowledged by node
@@ -72,8 +70,8 @@
72struct tipc_node { 70struct tipc_node {
73 u32 addr; 71 u32 addr;
74 spinlock_t lock; 72 spinlock_t lock;
75 struct cluster *owner; 73 struct hlist_node hash;
76 struct tipc_node *next; 74 struct list_head list;
77 struct list_head nsub; 75 struct list_head nsub;
78 struct link *active_links[2]; 76 struct link *active_links[2];
79 struct link *links[MAX_BEARERS]; 77 struct link *links[MAX_BEARERS];
@@ -81,8 +79,6 @@ struct tipc_node {
81 int working_links; 79 int working_links;
82 int cleanup_required; 80 int cleanup_required;
83 int permit_changeover; 81 int permit_changeover;
84 u32 routers[512/32];
85 int last_router;
86 struct { 82 struct {
87 int supported; 83 int supported;
88 u32 acked; 84 u32 acked;
@@ -96,44 +92,35 @@ struct tipc_node {
96 } bclink; 92 } bclink;
97}; 93};
98 94
95#define NODE_HTABLE_SIZE 512
96extern struct list_head tipc_node_list;
97
98/*
99 * A trivial power-of-two bitmask technique is used for speed, since this
100 * operation is done for every incoming TIPC packet. The number of hash table
101 * entries has been chosen so that no hash chain exceeds 8 nodes and will
102 * usually be much smaller (typically only a single node).
103 */
104static inline unsigned int tipc_hashfn(u32 addr)
105{
106 return addr & (NODE_HTABLE_SIZE - 1);
107}
108
99extern u32 tipc_own_tag; 109extern u32 tipc_own_tag;
100 110
111struct tipc_node *tipc_node_find(u32 addr);
101struct tipc_node *tipc_node_create(u32 addr); 112struct tipc_node *tipc_node_create(u32 addr);
102void tipc_node_delete(struct tipc_node *n_ptr); 113void tipc_node_delete(struct tipc_node *n_ptr);
103struct tipc_node *tipc_node_attach_link(struct link *l_ptr); 114void tipc_node_attach_link(struct tipc_node *n_ptr, struct link *l_ptr);
104void tipc_node_detach_link(struct tipc_node *n_ptr, struct link *l_ptr); 115void tipc_node_detach_link(struct tipc_node *n_ptr, struct link *l_ptr);
105void tipc_node_link_down(struct tipc_node *n_ptr, struct link *l_ptr); 116void tipc_node_link_down(struct tipc_node *n_ptr, struct link *l_ptr);
106void tipc_node_link_up(struct tipc_node *n_ptr, struct link *l_ptr); 117void tipc_node_link_up(struct tipc_node *n_ptr, struct link *l_ptr);
107int tipc_node_has_active_links(struct tipc_node *n_ptr); 118int tipc_node_active_links(struct tipc_node *n_ptr);
108int tipc_node_has_redundant_links(struct tipc_node *n_ptr); 119int tipc_node_redundant_links(struct tipc_node *n_ptr);
109u32 tipc_node_select_router(struct tipc_node *n_ptr, u32 ref);
110struct tipc_node *tipc_node_select_next_hop(u32 addr, u32 selector);
111int tipc_node_is_up(struct tipc_node *n_ptr); 120int tipc_node_is_up(struct tipc_node *n_ptr);
112void tipc_node_add_router(struct tipc_node *n_ptr, u32 router);
113void tipc_node_remove_router(struct tipc_node *n_ptr, u32 router);
114struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space); 121struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space);
115struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space); 122struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space);
116 123
117static inline struct tipc_node *tipc_node_find(u32 addr)
118{
119 if (likely(in_own_cluster(addr)))
120 return tipc_local_nodes[tipc_node(addr)];
121 else if (tipc_addr_domain_valid(addr)) {
122 struct cluster *c_ptr = tipc_cltr_find(addr);
123
124 if (c_ptr)
125 return c_ptr->nodes[tipc_node(addr)];
126 }
127 return NULL;
128}
129
130static inline struct tipc_node *tipc_node_select(u32 addr, u32 selector)
131{
132 if (likely(in_own_cluster(addr)))
133 return tipc_local_nodes[tipc_node(addr)];
134 return tipc_node_select_next_hop(addr, selector);
135}
136
137static inline void tipc_node_lock(struct tipc_node *n_ptr) 124static inline void tipc_node_lock(struct tipc_node *n_ptr)
138{ 125{
139 spin_lock_bh(&n_ptr->lock); 126 spin_lock_bh(&n_ptr->lock);