aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAllan Stephens <Allan.Stephens@windriver.com>2011-04-21 20:05:25 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2011-05-10 16:04:01 -0400
commit1209966cd5d2ec7f89ad2ed58a6a342aa8ea8712 (patch)
tree9de9cbaf37a33ae5be16f3d57eb10f9b3aaef216 /net
parent691a62075922b43b2b03def87ebcfdfbf0cd2ed8 (diff)
tipc: Add monitoring of number of nodes discovered by bearer
Augments TIPC's discovery object to track the number of neighboring nodes having an active link to the associated bearer. This means tipc_disc_update_link_req() becomes either one of: tipc_disc_add_dest() or: tipc_disc_remove_dest() depending on the code flow direction of things. Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/tipc/bearer.c4
-rw-r--r--net/tipc/discover.c32
-rw-r--r--net/tipc/discover.h3
3 files changed, 31 insertions, 8 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 5fcd1c1214fd..85209eadfae6 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -344,15 +344,15 @@ struct sk_buff *tipc_bearer_get_names(void)
344void tipc_bearer_add_dest(struct tipc_bearer *b_ptr, u32 dest) 344void tipc_bearer_add_dest(struct tipc_bearer *b_ptr, u32 dest)
345{ 345{
346 tipc_nmap_add(&b_ptr->nodes, dest); 346 tipc_nmap_add(&b_ptr->nodes, dest);
347 tipc_disc_update_link_req(b_ptr->link_req);
348 tipc_bcbearer_sort(); 347 tipc_bcbearer_sort();
348 tipc_disc_add_dest(b_ptr->link_req);
349} 349}
350 350
351void tipc_bearer_remove_dest(struct tipc_bearer *b_ptr, u32 dest) 351void tipc_bearer_remove_dest(struct tipc_bearer *b_ptr, u32 dest)
352{ 352{
353 tipc_nmap_remove(&b_ptr->nodes, dest); 353 tipc_nmap_remove(&b_ptr->nodes, dest);
354 tipc_disc_update_link_req(b_ptr->link_req);
355 tipc_bcbearer_sort(); 354 tipc_bcbearer_sort();
355 tipc_disc_remove_dest(b_ptr->link_req);
356} 356}
357 357
358/* 358/*
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index dba47673124d..3cb232d1f5dc 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -53,6 +53,7 @@
53 * @bearer: bearer issuing requests 53 * @bearer: bearer issuing requests
54 * @dest: destination address for request messages 54 * @dest: destination address for request messages
55 * @domain: network domain to which links can be established 55 * @domain: network domain to which links can be established
56 * @num_nodes: number of nodes currently discovered (i.e. with an active link)
56 * @buf: request message to be (repeatedly) sent 57 * @buf: request message to be (repeatedly) sent
57 * @timer: timer governing period between requests 58 * @timer: timer governing period between requests
58 * @timer_intv: current interval between requests (in ms) 59 * @timer_intv: current interval between requests (in ms)
@@ -61,6 +62,7 @@ struct link_req {
61 struct tipc_bearer *bearer; 62 struct tipc_bearer *bearer;
62 struct tipc_media_addr dest; 63 struct tipc_media_addr dest;
63 u32 domain; 64 u32 domain;
65 int num_nodes;
64 struct sk_buff *buf; 66 struct sk_buff *buf;
65 struct timer_list timer; 67 struct timer_list timer;
66 unsigned int timer_intv; 68 unsigned int timer_intv;
@@ -216,15 +218,12 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr)
216} 218}
217 219
218/** 220/**
219 * tipc_disc_update_link_req - update frequency of periodic link setup requests 221 * disc_update - update frequency of periodic link setup requests
220 * @req: ptr to link request structure 222 * @req: ptr to link request structure
221 */ 223 */
222 224
223void tipc_disc_update_link_req(struct link_req *req) 225static void disc_update(struct link_req *req)
224{ 226{
225 if (!req)
226 return;
227
228 if (req->timer_intv == TIPC_LINK_REQ_SLOW) { 227 if (req->timer_intv == TIPC_LINK_REQ_SLOW) {
229 if (!req->bearer->nodes.count) { 228 if (!req->bearer->nodes.count) {
230 req->timer_intv = TIPC_LINK_REQ_FAST; 229 req->timer_intv = TIPC_LINK_REQ_FAST;
@@ -241,6 +240,28 @@ void tipc_disc_update_link_req(struct link_req *req)
241} 240}
242 241
243/** 242/**
243 * tipc_disc_add_dest - increment set of discovered nodes
244 * @req: ptr to link request structure
245 */
246
247void tipc_disc_add_dest(struct link_req *req)
248{
249 req->num_nodes++;
250 disc_update(req);
251}
252
253/**
254 * tipc_disc_remove_dest - decrement set of discovered nodes
255 * @req: ptr to link request structure
256 */
257
258void tipc_disc_remove_dest(struct link_req *req)
259{
260 req->num_nodes--;
261 disc_update(req);
262}
263
264/**
244 * disc_send_msg - send link setup request message 265 * disc_send_msg - send link setup request message
245 * @req: ptr to link request structure 266 * @req: ptr to link request structure
246 */ 267 */
@@ -307,6 +328,7 @@ int tipc_disc_create(struct tipc_bearer *b_ptr,
307 memcpy(&req->dest, dest, sizeof(*dest)); 328 memcpy(&req->dest, dest, sizeof(*dest));
308 req->bearer = b_ptr; 329 req->bearer = b_ptr;
309 req->domain = dest_domain; 330 req->domain = dest_domain;
331 req->num_nodes = 0;
310 req->timer_intv = TIPC_LINK_REQ_INIT; 332 req->timer_intv = TIPC_LINK_REQ_INIT;
311 k_init_timer(&req->timer, (Handler)disc_timeout, (unsigned long)req); 333 k_init_timer(&req->timer, (Handler)disc_timeout, (unsigned long)req);
312 k_start_timer(&req->timer, req->timer_intv); 334 k_start_timer(&req->timer, req->timer_intv);
diff --git a/net/tipc/discover.h b/net/tipc/discover.h
index d6e44e3dcdbc..a3af595b86cb 100644
--- a/net/tipc/discover.h
+++ b/net/tipc/discover.h
@@ -42,7 +42,8 @@ struct link_req;
42int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest, 42int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest,
43 u32 dest_domain); 43 u32 dest_domain);
44void tipc_disc_delete(struct link_req *req); 44void tipc_disc_delete(struct link_req *req);
45void tipc_disc_update_link_req(struct link_req *req); 45void tipc_disc_add_dest(struct link_req *req);
46void tipc_disc_remove_dest(struct link_req *req);
46void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr); 47void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr);
47 48
48#endif 49#endif