|
@@ -1853,17 +1853,16 @@ cont:
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
- * link_defer_buf(): Sort a received out-of-sequence packet
|
|
|
|
- * into the deferred reception queue.
|
|
|
|
- * Returns the increase of the queue length,i.e. 0 or 1
|
|
|
|
|
|
+ * tipc_link_defer_pkt - Add out-of-sequence message to deferred reception queue
|
|
|
|
+ *
|
|
|
|
+ * Returns increase in queue length (i.e. 0 or 1)
|
|
*/
|
|
*/
|
|
|
|
|
|
-u32 tipc_link_defer_pkt(struct sk_buff **head,
|
|
|
|
- struct sk_buff **tail,
|
|
|
|
|
|
+u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail,
|
|
struct sk_buff *buf)
|
|
struct sk_buff *buf)
|
|
{
|
|
{
|
|
- struct sk_buff *prev = NULL;
|
|
|
|
- struct sk_buff *crs = *head;
|
|
|
|
|
|
+ struct sk_buff *queue_buf;
|
|
|
|
+ struct sk_buff **prev;
|
|
u32 seq_no = buf_seqno(buf);
|
|
u32 seq_no = buf_seqno(buf);
|
|
|
|
|
|
buf->next = NULL;
|
|
buf->next = NULL;
|
|
@@ -1881,31 +1880,30 @@ u32 tipc_link_defer_pkt(struct sk_buff **head,
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
|
|
- /* Scan through queue and sort it in */
|
|
|
|
- do {
|
|
|
|
- struct tipc_msg *msg = buf_msg(crs);
|
|
|
|
|
|
+ /* Locate insertion point in queue, then insert; discard if duplicate */
|
|
|
|
+ prev = head;
|
|
|
|
+ queue_buf = *head;
|
|
|
|
+ for (;;) {
|
|
|
|
+ u32 curr_seqno = buf_seqno(queue_buf);
|
|
|
|
|
|
- if (less(seq_no, msg_seqno(msg))) {
|
|
|
|
- buf->next = crs;
|
|
|
|
- if (prev)
|
|
|
|
- prev->next = buf;
|
|
|
|
- else
|
|
|
|
- *head = buf;
|
|
|
|
- return 1;
|
|
|
|
|
|
+ if (seq_no == curr_seqno) {
|
|
|
|
+ buf_discard(buf);
|
|
|
|
+ return 0;
|
|
}
|
|
}
|
|
- if (seq_no == msg_seqno(msg))
|
|
|
|
|
|
+
|
|
|
|
+ if (less(seq_no, curr_seqno))
|
|
break;
|
|
break;
|
|
- prev = crs;
|
|
|
|
- crs = crs->next;
|
|
|
|
- } while (crs);
|
|
|
|
|
|
|
|
- /* Message is a duplicate of an existing message */
|
|
|
|
|
|
+ prev = &queue_buf->next;
|
|
|
|
+ queue_buf = queue_buf->next;
|
|
|
|
+ }
|
|
|
|
|
|
- buf_discard(buf);
|
|
|
|
- return 0;
|
|
|
|
|
|
+ buf->next = queue_buf;
|
|
|
|
+ *prev = buf;
|
|
|
|
+ return 1;
|
|
}
|
|
}
|
|
|
|
|
|
-/**
|
|
|
|
|
|
+/*
|
|
* link_handle_out_of_seq_msg - handle arrival of out-of-sequence packet
|
|
* link_handle_out_of_seq_msg - handle arrival of out-of-sequence packet
|
|
*/
|
|
*/
|
|
|
|
|