aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2011-10-24 15:26:24 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2011-12-27 11:33:53 -0500
commit3655959143ebf1fd32e28a448d204be2f7f13e99 (patch)
tree441e42f4e55fedf7d262a3d43ba356a1598f36c5
parent10745cd5990542447268f60078133df8b1ee960b (diff)
tipc: Ignore broadcast acknowledgements that are out-of-range
Adds checks to TIPC's broadcast link so that it ignores any acknowledgement message containing a sequence number that does not correspond to an unacknowledged message currently in the broadcast link's transmit queue. This change prevents the broadcast link from becoming stalled if a newly booted node receives stale broadcast link acknowledgement information from another node that has not yet fully synchronized its end of the broadcast link to reflect the current state of the new node's end. Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r--net/tipc/bcast.c35
-rw-r--r--net/tipc/link.c6
-rw-r--r--net/tipc/link.h6
-rw-r--r--net/tipc/node.c3
4 files changed, 37 insertions, 13 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 4609819ea807..15eb74458748 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -237,14 +237,36 @@ void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked)
237 struct sk_buff *next; 237 struct sk_buff *next;
238 unsigned int released = 0; 238 unsigned int released = 0;
239 239
240 if (less_eq(acked, n_ptr->bclink.acked))
241 return;
242
243 spin_lock_bh(&bc_lock); 240 spin_lock_bh(&bc_lock);
244 241
245 /* Skip over packets that node has previously acknowledged */ 242 /* Bail out if tx queue is empty (no clean up is required) */
246
247 crs = bcl->first_out; 243 crs = bcl->first_out;
244 if (!crs)
245 goto exit;
246
247 /* Determine which messages need to be acknowledged */
248 if (acked == INVALID_LINK_SEQ) {
249 /*
250 * Contact with specified node has been lost, so need to
251 * acknowledge sent messages only (if other nodes still exist)
252 * or both sent and unsent messages (otherwise)
253 */
254 if (bclink->bcast_nodes.count)
255 acked = bcl->fsm_msg_cnt;
256 else
257 acked = bcl->next_out_no;
258 } else {
259 /*
260 * Bail out if specified sequence number does not correspond
261 * to a message that has been sent and not yet acknowledged
262 */
263 if (less(acked, buf_seqno(crs)) ||
264 less(bcl->fsm_msg_cnt, acked) ||
265 less_eq(acked, n_ptr->bclink.acked))
266 goto exit;
267 }
268
269 /* Skip over packets that node has previously acknowledged */
248 while (crs && less_eq(buf_seqno(crs), n_ptr->bclink.acked)) 270 while (crs && less_eq(buf_seqno(crs), n_ptr->bclink.acked))
249 crs = crs->next; 271 crs = crs->next;
250 272
@@ -255,8 +277,6 @@ void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked)
255 277
256 if (crs != bcl->next_out) 278 if (crs != bcl->next_out)
257 bcbuf_decr_acks(crs); 279 bcbuf_decr_acks(crs);
258 else if (bclink->bcast_nodes.count)
259 break;
260 else { 280 else {
261 bcbuf_set_acks(crs, 0); 281 bcbuf_set_acks(crs, 0);
262 bcl->next_out = next; 282 bcl->next_out = next;
@@ -281,6 +301,7 @@ void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked)
281 } 301 }
282 if (unlikely(released && !list_empty(&bcl->waiting_ports))) 302 if (unlikely(released && !list_empty(&bcl->waiting_ports)))
283 tipc_link_wakeup_ports(bcl, 0); 303 tipc_link_wakeup_ports(bcl, 0);
304exit:
284 spin_unlock_bh(&bc_lock); 305 spin_unlock_bh(&bc_lock);
285} 306}
286 307
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 332915e43043..4eff342326e2 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -1733,10 +1733,8 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
1733 1733
1734 /* Release acked messages */ 1734 /* Release acked messages */
1735 1735
1736 if (less(n_ptr->bclink.acked, msg_bcast_ack(msg))) { 1736 if (tipc_node_is_up(n_ptr) && n_ptr->bclink.supported)
1737 if (tipc_node_is_up(n_ptr) && n_ptr->bclink.supported) 1737 tipc_bclink_acknowledge(n_ptr, msg_bcast_ack(msg));
1738 tipc_bclink_acknowledge(n_ptr, msg_bcast_ack(msg));
1739 }
1740 1738
1741 crs = l_ptr->first_out; 1739 crs = l_ptr->first_out;
1742 while ((crs != l_ptr->next_out) && 1740 while ((crs != l_ptr->next_out) &&
diff --git a/net/tipc/link.h b/net/tipc/link.h
index e56cb532913e..78792399d667 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -45,6 +45,12 @@
45#define PUSH_FINISHED 2 45#define PUSH_FINISHED 2
46 46
47/* 47/*
48 * Out-of-range value for link sequence numbers
49 */
50
51#define INVALID_LINK_SEQ 0x10000
52
53/*
48 * Link states 54 * Link states
49 */ 55 */
50 56
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 1861ae915f17..e530de279be9 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -351,8 +351,7 @@ static void node_lost_contact(struct tipc_node *n_ptr)
351 } 351 }
352 352
353 tipc_bclink_remove_node(n_ptr->addr); 353 tipc_bclink_remove_node(n_ptr->addr);
354 tipc_bclink_acknowledge(n_ptr, 354 tipc_bclink_acknowledge(n_ptr, INVALID_LINK_SEQ);
355 mod(n_ptr->bclink.acked + 10000));
356 if (n_ptr->addr < tipc_own_addr) 355 if (n_ptr->addr < tipc_own_addr)
357 tipc_own_tag--; 356 tipc_own_tag--;
358 357