aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorJon Paul Maloy <jon.maloy@ericsson.com>2015-07-30 18:24:20 -0400
committerDavid S. Miller <davem@davemloft.net>2015-07-30 20:25:14 -0400
commit5045f7b9009f1455268b98cecbcc271663934c85 (patch)
treeb7398fdb0cca2fc7ac69fa8f699e451d3d895a1c /net/tipc
parent6e498158a827fd515b514842e9a06bdf0f75ab86 (diff)
tipc: move protocol message sending away from link FSM
The implementation of the link FSM currently takes decisions about and sends out link protocol messages. This is unnecessary, since such actions are not the result of any link state change, and are even decided based on non-FSM state information ("silent_intv_cnt"). We now move the sending of unicast link protocol messages to the function tipc_link_timeout(), and the initial broadcast synchronization message to tipc_node_link_up(). The latter is done because a link instance should not need to know whether it is the first or second link to a destination. Such information is now restricted to and handled by the link aggregation layer in node.c Tested-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')
-rw-r--r--net/tipc/link.c51
-rw-r--r--net/tipc/link.h2
-rw-r--r--net/tipc/node.c1
3 files changed, 33 insertions, 21 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index d5f4005f388f..9a3ccf910c49 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -134,8 +134,6 @@ static void tipc_link_build_proto_msg(struct tipc_link *l, int mtyp, bool probe,
134 struct sk_buff_head *xmitq); 134 struct sk_buff_head *xmitq);
135static void link_reset_statistics(struct tipc_link *l_ptr); 135static void link_reset_statistics(struct tipc_link *l_ptr);
136static void link_print(struct tipc_link *l_ptr, const char *str); 136static void link_print(struct tipc_link *l_ptr, const char *str);
137static void tipc_link_build_bcast_sync_msg(struct tipc_link *l,
138 struct sk_buff_head *xmitq);
139static void tipc_link_sync_rcv(struct tipc_node *n, struct sk_buff *buf); 137static void tipc_link_sync_rcv(struct tipc_node *n, struct sk_buff *buf);
140static int tipc_link_input(struct tipc_link *l, struct sk_buff *skb); 138static int tipc_link_input(struct tipc_link *l, struct sk_buff *skb);
141static bool tipc_data_input(struct tipc_link *l, struct sk_buff *skb); 139static bool tipc_data_input(struct tipc_link *l, struct sk_buff *skb);
@@ -245,8 +243,8 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
245 * Give a newly added peer node the sequence number where it should 243 * Give a newly added peer node the sequence number where it should
246 * start receiving and acking broadcast packets. 244 * start receiving and acking broadcast packets.
247 */ 245 */
248static void tipc_link_build_bcast_sync_msg(struct tipc_link *l, 246void tipc_link_build_bcast_sync_msg(struct tipc_link *l,
249 struct sk_buff_head *xmitq) 247 struct sk_buff_head *xmitq)
250{ 248{
251 struct sk_buff *skb; 249 struct sk_buff *skb;
252 struct sk_buff_head list; 250 struct sk_buff_head list;
@@ -272,7 +270,7 @@ static void tipc_link_build_bcast_sync_msg(struct tipc_link *l,
272static int tipc_link_fsm_evt(struct tipc_link *l, int evt, 270static int tipc_link_fsm_evt(struct tipc_link *l, int evt,
273 struct sk_buff_head *xmitq) 271 struct sk_buff_head *xmitq)
274{ 272{
275 int mtyp = 0, rc = 0; 273 int rc = 0;
276 struct tipc_link *pl; 274 struct tipc_link *pl;
277 enum { 275 enum {
278 LINK_RESET = 1, 276 LINK_RESET = 1,
@@ -380,17 +378,7 @@ static int tipc_link_fsm_evt(struct tipc_link *l, int evt,
380 } 378 }
381 if (actions & LINK_ACTIVATE) 379 if (actions & LINK_ACTIVATE)
382 rc = TIPC_LINK_UP_EVT; 380 rc = TIPC_LINK_UP_EVT;
383 if (actions & (SND_STATE | SND_PROBE)) 381
384 mtyp = STATE_MSG;
385 if (actions & SND_RESET)
386 mtyp = RESET_MSG;
387 if (actions & SND_ACTIVATE)
388 mtyp = ACTIVATE_MSG;
389 if (actions & (SND_PROBE | SND_STATE | SND_RESET | SND_ACTIVATE))
390 tipc_link_build_proto_msg(l, mtyp, actions & SND_PROBE,
391 0, 0, 0, xmitq);
392 if (actions & SND_BCAST_SYNC)
393 tipc_link_build_bcast_sync_msg(l, xmitq);
394 return rc; 382 return rc;
395} 383}
396 384
@@ -440,16 +428,37 @@ static void link_profile_stats(struct tipc_link *l)
440int tipc_link_timeout(struct tipc_link *l, struct sk_buff_head *xmitq) 428int tipc_link_timeout(struct tipc_link *l, struct sk_buff_head *xmitq)
441{ 429{
442 int rc = 0; 430 int rc = 0;
431 int mtyp = STATE_MSG;
432 bool xmit = false;
433 bool prb = false;
443 434
444 if (l->exec_mode == TIPC_LINK_BLOCKED) 435 if (l->exec_mode == TIPC_LINK_BLOCKED)
445 return rc; 436 return rc;
446 437
447 link_profile_stats(l); 438 link_profile_stats(l);
448 if (l->silent_intv_cnt) 439
449 rc = tipc_link_fsm_evt(l, SILENCE_EVT, xmitq); 440 if (l->state == TIPC_LINK_WORKING) {
450 else if (link_working(l) && tipc_bclink_acks_missing(l->owner)) 441 if (!l->silent_intv_cnt) {
451 tipc_link_build_proto_msg(l, STATE_MSG, 0, 0, 0, 0, xmitq); 442 if (tipc_bclink_acks_missing(l->owner))
452 l->silent_intv_cnt++; 443 xmit = true;
444 } else if (l->silent_intv_cnt <= l->abort_limit) {
445 xmit = true;
446 prb = true;
447 } else {
448 l->exec_mode = TIPC_LINK_BLOCKED;
449 rc |= TIPC_LINK_DOWN_EVT;
450 }
451 l->silent_intv_cnt++;
452 } else if (l->state == TIPC_LINK_RESETTING) {
453 xmit = true;
454 mtyp = RESET_MSG;
455 } else if (l->state == TIPC_LINK_ESTABLISHING) {
456 xmit = true;
457 mtyp = ACTIVATE_MSG;
458 }
459 if (xmit)
460 tipc_link_build_proto_msg(l, mtyp, prb, 0, 0, 0, xmitq);
461
453 return rc; 462 return rc;
454} 463}
455 464
diff --git a/net/tipc/link.h b/net/tipc/link.h
index e377d9ba41c5..b317c4df9079 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -212,6 +212,8 @@ struct tipc_link *tipc_link_create(struct tipc_node *n,
212 struct sk_buff_head *namedq); 212 struct sk_buff_head *namedq);
213void tipc_link_tnl_prepare(struct tipc_link *l, struct tipc_link *tnl, 213void tipc_link_tnl_prepare(struct tipc_link *l, struct tipc_link *tnl,
214 int mtyp, struct sk_buff_head *xmitq); 214 int mtyp, struct sk_buff_head *xmitq);
215void tipc_link_build_bcast_sync_msg(struct tipc_link *l,
216 struct sk_buff_head *xmitq);
215void tipc_link_reset_fragments(struct tipc_link *l_ptr); 217void tipc_link_reset_fragments(struct tipc_link *l_ptr);
216int tipc_link_is_up(struct tipc_link *l_ptr); 218int tipc_link_is_up(struct tipc_link *l_ptr);
217int tipc_link_is_active(struct tipc_link *l_ptr); 219int tipc_link_is_active(struct tipc_link *l_ptr);
diff --git a/net/tipc/node.c b/net/tipc/node.c
index b0372bb107f6..9e20acffb3d4 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -335,6 +335,7 @@ static void tipc_node_link_up(struct tipc_node *n, int bearer_id,
335 *slot0 = bearer_id; 335 *slot0 = bearer_id;
336 *slot1 = bearer_id; 336 *slot1 = bearer_id;
337 nl->exec_mode = TIPC_LINK_OPEN; 337 nl->exec_mode = TIPC_LINK_OPEN;
338 tipc_link_build_bcast_sync_msg(nl, xmitq);
338 node_established_contact(n); 339 node_established_contact(n);
339 return; 340 return;
340 } 341 }