Lines Matching refs:ulpq
52 static struct sctp_ulpevent * sctp_ulpq_reasm(struct sctp_ulpq *ulpq,
60 struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *ulpq, in sctp_ulpq_init() argument
63 memset(ulpq, 0, sizeof(struct sctp_ulpq)); in sctp_ulpq_init()
65 ulpq->asoc = asoc; in sctp_ulpq_init()
66 skb_queue_head_init(&ulpq->reasm); in sctp_ulpq_init()
67 skb_queue_head_init(&ulpq->lobby); in sctp_ulpq_init()
68 ulpq->pd_mode = 0; in sctp_ulpq_init()
69 ulpq->malloced = 0; in sctp_ulpq_init()
71 return ulpq; in sctp_ulpq_init()
76 static void sctp_ulpq_flush(struct sctp_ulpq *ulpq) in sctp_ulpq_flush() argument
81 while ((skb = __skb_dequeue(&ulpq->lobby)) != NULL) { in sctp_ulpq_flush()
86 while ((skb = __skb_dequeue(&ulpq->reasm)) != NULL) { in sctp_ulpq_flush()
94 void sctp_ulpq_free(struct sctp_ulpq *ulpq) in sctp_ulpq_free() argument
96 sctp_ulpq_flush(ulpq); in sctp_ulpq_free()
97 if (ulpq->malloced) in sctp_ulpq_free()
98 kfree(ulpq); in sctp_ulpq_free()
102 int sctp_ulpq_tail_data(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk, in sctp_ulpq_tail_data() argument
117 event = sctp_ulpq_reasm(ulpq, event); in sctp_ulpq_tail_data()
125 event = sctp_ulpq_order(ulpq, event); in sctp_ulpq_tail_data()
130 sctp_ulpq_tail_event(ulpq, event); in sctp_ulpq_tail_data()
156 static int sctp_ulpq_clear_pd(struct sctp_ulpq *ulpq) in sctp_ulpq_clear_pd() argument
158 ulpq->pd_mode = 0; in sctp_ulpq_clear_pd()
159 return sctp_clear_pd(ulpq->asoc->base.sk); in sctp_ulpq_clear_pd()
164 int sctp_ulpq_tail_event(struct sctp_ulpq *ulpq, struct sctp_ulpevent *event) in sctp_ulpq_tail_event() argument
166 struct sock *sk = ulpq->asoc->base.sk; in sctp_ulpq_tail_event()
187 } else if (ulpq->pd_mode) { in sctp_ulpq_tail_event()
211 sctp_ulpq_clear_pd(ulpq); in sctp_ulpq_tail_event()
228 static inline void sctp_ulpq_store_reasm(struct sctp_ulpq *ulpq, in sctp_ulpq_store_reasm() argument
238 pos = skb_peek_tail(&ulpq->reasm); in sctp_ulpq_store_reasm()
240 __skb_queue_tail(&ulpq->reasm, sctp_event2skb(event)); in sctp_ulpq_store_reasm()
248 __skb_queue_tail(&ulpq->reasm, sctp_event2skb(event)); in sctp_ulpq_store_reasm()
253 skb_queue_walk(&ulpq->reasm, pos) { in sctp_ulpq_store_reasm()
262 __skb_insert(sctp_event2skb(event), pos->prev, pos, &ulpq->reasm); in sctp_ulpq_store_reasm()
350 static inline struct sctp_ulpevent *sctp_ulpq_retrieve_reassembled(struct sctp_ulpq *ulpq) in sctp_ulpq_retrieve_reassembled() argument
373 skb_queue_walk(&ulpq->reasm, pos) { in sctp_ulpq_retrieve_reassembled()
409 static inline struct sctp_ulpevent *sctp_ulpq_retrieve_partial(struct sctp_ulpq *ulpq) in sctp_ulpq_retrieve_partial() argument
422 if (skb_queue_empty(&ulpq->reasm)) in sctp_ulpq_retrieve_partial()
430 skb_queue_walk(&ulpq->reasm, pos) { in sctp_ulpq_retrieve_partial()
473 static struct sctp_ulpevent *sctp_ulpq_reasm(struct sctp_ulpq *ulpq, in sctp_ulpq_reasm() argument
484 sctp_ulpq_store_reasm(ulpq, event); in sctp_ulpq_reasm()
485 if (!ulpq->pd_mode) in sctp_ulpq_reasm()
486 retval = sctp_ulpq_retrieve_reassembled(ulpq); in sctp_ulpq_reasm()
494 ctsnap = sctp_tsnmap_get_ctsn(&ulpq->asoc->peer.tsn_map); in sctp_ulpq_reasm()
496 retval = sctp_ulpq_retrieve_partial(ulpq); in sctp_ulpq_reasm()
503 static inline struct sctp_ulpevent *sctp_ulpq_retrieve_first(struct sctp_ulpq *ulpq) in sctp_ulpq_retrieve_first() argument
515 if (skb_queue_empty(&ulpq->reasm)) in sctp_ulpq_retrieve_first()
522 skb_queue_walk(&ulpq->reasm, pos) { in sctp_ulpq_retrieve_first()
561 static inline void sctp_ulpq_retrieve_ordered(struct sctp_ulpq *ulpq, in sctp_ulpq_retrieve_ordered() argument
572 in = &ulpq->asoc->ssnmap->in; in sctp_ulpq_retrieve_ordered()
575 sctp_skb_for_each(pos, &ulpq->lobby, tmp) { in sctp_ulpq_retrieve_ordered()
602 static inline void sctp_ulpq_store_ordered(struct sctp_ulpq *ulpq, in sctp_ulpq_store_ordered() argument
610 pos = skb_peek_tail(&ulpq->lobby); in sctp_ulpq_store_ordered()
612 __skb_queue_tail(&ulpq->lobby, sctp_event2skb(event)); in sctp_ulpq_store_ordered()
623 __skb_queue_tail(&ulpq->lobby, sctp_event2skb(event)); in sctp_ulpq_store_ordered()
628 __skb_queue_tail(&ulpq->lobby, sctp_event2skb(event)); in sctp_ulpq_store_ordered()
635 skb_queue_walk(&ulpq->lobby, pos) { in sctp_ulpq_store_ordered()
648 __skb_insert(sctp_event2skb(event), pos->prev, pos, &ulpq->lobby); in sctp_ulpq_store_ordered()
652 static struct sctp_ulpevent *sctp_ulpq_order(struct sctp_ulpq *ulpq, in sctp_ulpq_order() argument
665 in = &ulpq->asoc->ssnmap->in; in sctp_ulpq_order()
672 sctp_ulpq_store_ordered(ulpq, event); in sctp_ulpq_order()
682 sctp_ulpq_retrieve_ordered(ulpq, event); in sctp_ulpq_order()
690 static inline void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq) in sctp_ulpq_reap_ordered() argument
699 in = &ulpq->asoc->ssnmap->in; in sctp_ulpq_reap_ordered()
702 sctp_skb_for_each(pos, &ulpq->lobby, tmp) { in sctp_ulpq_reap_ordered()
727 sctp_ulpq_tail_event(ulpq, event); in sctp_ulpq_reap_ordered()
731 void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn) in sctp_ulpq_skip() argument
736 in = &ulpq->asoc->ssnmap->in; in sctp_ulpq_skip()
748 sctp_ulpq_reap_ordered(ulpq); in sctp_ulpq_skip()
753 static __u16 sctp_ulpq_renege_order(struct sctp_ulpq *ulpq, __u16 needed) in sctp_ulpq_renege_order() argument
761 tsnmap = &ulpq->asoc->peer.tsn_map; in sctp_ulpq_renege_order()
763 while ((skb = __skb_dequeue_tail(&ulpq->lobby)) != NULL) { in sctp_ulpq_renege_order()
778 static __u16 sctp_ulpq_renege_frags(struct sctp_ulpq *ulpq, __u16 needed) in sctp_ulpq_renege_frags() argument
786 tsnmap = &ulpq->asoc->peer.tsn_map; in sctp_ulpq_renege_frags()
789 while ((skb = __skb_dequeue_tail(&ulpq->reasm)) != NULL) { in sctp_ulpq_renege_frags()
804 void sctp_ulpq_partial_delivery(struct sctp_ulpq *ulpq, in sctp_ulpq_partial_delivery() argument
810 asoc = ulpq->asoc; in sctp_ulpq_partial_delivery()
816 event = sctp_ulpq_retrieve_first(ulpq); in sctp_ulpq_partial_delivery()
819 sctp_ulpq_tail_event(ulpq, event); in sctp_ulpq_partial_delivery()
821 ulpq->pd_mode = 1; in sctp_ulpq_partial_delivery()
828 void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk, in sctp_ulpq_renege() argument
834 asoc = ulpq->asoc; in sctp_ulpq_renege()
845 freed = sctp_ulpq_renege_order(ulpq, needed); in sctp_ulpq_renege()
847 freed += sctp_ulpq_renege_frags(ulpq, needed - freed); in sctp_ulpq_renege()
855 sctp_ulpq_tail_data(ulpq, chunk, gfp); in sctp_ulpq_renege()
857 sctp_ulpq_partial_delivery(ulpq, chunk, gfp); in sctp_ulpq_renege()
868 void sctp_ulpq_abort_pd(struct sctp_ulpq *ulpq, int gfp) in sctp_ulpq_abort_pd() argument
873 if (!ulpq->pd_mode) in sctp_ulpq_abort_pd()
876 sk = ulpq->asoc->base.sk; in sctp_ulpq_abort_pd()
879 ev = sctp_ulpevent_make_pdapi(ulpq->asoc, in sctp_ulpq_abort_pd()
886 if (sctp_ulpq_clear_pd(ulpq) || ev) in sctp_ulpq_abort_pd()