const: constify remaining dev_pm_ops
[safe/jmp/linux-2.6] / net / sctp / ulpqueue.c
index d300f49..7b23803 100644 (file)
@@ -317,7 +317,7 @@ static void sctp_ulpq_store_reasm(struct sctp_ulpq *ulpq,
        }
 
        /* Insert before pos. */
-       __skb_insert(sctp_event2skb(event), pos->prev, pos, &ulpq->reasm);
+       __skb_queue_before(&ulpq->reasm, pos, sctp_event2skb(event));
 
 }
 
@@ -825,8 +825,7 @@ static void sctp_ulpq_store_ordered(struct sctp_ulpq *ulpq,
 
 
        /* Insert before pos. */
-       __skb_insert(sctp_event2skb(event), pos->prev, pos, &ulpq->lobby);
-
+       __skb_queue_before(&ulpq->lobby, pos, sctp_event2skb(event));
 }
 
 static struct sctp_ulpevent *sctp_ulpq_order(struct sctp_ulpq *ulpq,
@@ -874,6 +873,7 @@ static void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid)
        struct sctp_ulpevent *event;
        struct sctp_stream *in;
        struct sk_buff_head temp;
+       struct sk_buff_head *lobby = &ulpq->lobby;
        __u16 csid, cssn;
 
        in  = &ulpq->asoc->ssnmap->in;
@@ -881,7 +881,7 @@ static void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid)
        /* We are holding the chunks by stream, by SSN.  */
        skb_queue_head_init(&temp);
        event = NULL;
-       sctp_skb_for_each(pos, &ulpq->lobby, tmp) {
+       sctp_skb_for_each(pos, lobby, tmp) {
                cevent = (struct sctp_ulpevent *) pos->cb;
                csid = cevent->stream;
                cssn = cevent->ssn;
@@ -895,10 +895,10 @@ static void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid)
                        continue;
 
                /* see if this ssn has been marked by skipping */
-               if (!SSN_lte(cssn, sctp_ssn_peek(in, csid)))
+               if (!SSN_lt(cssn, sctp_ssn_peek(in, csid)))
                        break;
 
-               __skb_unlink(pos, &ulpq->lobby);
+               __skb_unlink(pos, lobby);
                if (!event)
                        /* Create a temporary list to collect chunks on.  */
                        event = sctp_skb2event(pos);
@@ -907,6 +907,22 @@ static void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid)
                __skb_queue_tail(&temp, pos);
        }
 
+       /* If we didn't reap any data, see if the next expected SSN
+        * is next on the queue and if so, use that.
+        */
+       if (event == NULL && pos != (struct sk_buff *)lobby) {
+               cevent = (struct sctp_ulpevent *) pos->cb;
+               csid = cevent->stream;
+               cssn = cevent->ssn;
+
+               if (csid == sid && cssn == sctp_ssn_peek(in, csid)) {
+                       sctp_ssn_next(in, csid);
+                       __skb_unlink(pos, lobby);
+                       __skb_queue_tail(&temp, pos);
+                       event = sctp_skb2event(pos);
+               }
+       }
+
        /* Send event to the ULP.  'event' is the sctp_ulpevent for
         * very first SKB on the 'temp' list.
         */