Lines Matching refs:stream
25 static void sctp_stream_shrink_out(struct sctp_stream *stream, __u16 outcnt) in sctp_stream_shrink_out() argument
31 asoc = container_of(stream, struct sctp_association, stream); in sctp_stream_shrink_out()
59 static void sctp_stream_outq_migrate(struct sctp_stream *stream, in sctp_stream_outq_migrate() argument
64 if (stream->outcnt > outcnt) in sctp_stream_outq_migrate()
65 sctp_stream_shrink_out(stream, outcnt); in sctp_stream_outq_migrate()
74 SCTP_SO(new, i)->ext = SCTP_SO(stream, i)->ext; in sctp_stream_outq_migrate()
75 SCTP_SO(stream, i)->ext = NULL; in sctp_stream_outq_migrate()
79 for (i = outcnt; i < stream->outcnt; i++) { in sctp_stream_outq_migrate()
80 kfree(SCTP_SO(stream, i)->ext); in sctp_stream_outq_migrate()
81 SCTP_SO(stream, i)->ext = NULL; in sctp_stream_outq_migrate()
85 static int sctp_stream_alloc_out(struct sctp_stream *stream, __u16 outcnt, in sctp_stream_alloc_out() argument
90 if (outcnt <= stream->outcnt) in sctp_stream_alloc_out()
93 ret = genradix_prealloc(&stream->out, outcnt, gfp); in sctp_stream_alloc_out()
98 stream->outcnt = outcnt; in sctp_stream_alloc_out()
102 static int sctp_stream_alloc_in(struct sctp_stream *stream, __u16 incnt, in sctp_stream_alloc_in() argument
107 if (incnt <= stream->incnt) in sctp_stream_alloc_in()
110 ret = genradix_prealloc(&stream->in, incnt, gfp); in sctp_stream_alloc_in()
115 stream->incnt = incnt; in sctp_stream_alloc_in()
119 int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt, in sctp_stream_init() argument
122 struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream); in sctp_stream_init()
130 if (outcnt == stream->outcnt) in sctp_stream_init()
134 sched->unsched_all(stream); in sctp_stream_init()
135 sctp_stream_outq_migrate(stream, NULL, outcnt); in sctp_stream_init()
136 sched->sched_all(stream); in sctp_stream_init()
138 ret = sctp_stream_alloc_out(stream, outcnt, gfp); in sctp_stream_init()
142 for (i = 0; i < stream->outcnt; i++) in sctp_stream_init()
143 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_stream_init()
146 sctp_stream_interleave_init(stream); in sctp_stream_init()
150 ret = sctp_stream_alloc_in(stream, incnt, gfp); in sctp_stream_init()
157 sched->free(stream); in sctp_stream_init()
158 genradix_free(&stream->in); in sctp_stream_init()
160 genradix_free(&stream->out); in sctp_stream_init()
161 stream->outcnt = 0; in sctp_stream_init()
166 int sctp_stream_init_ext(struct sctp_stream *stream, __u16 sid) in sctp_stream_init_ext() argument
174 SCTP_SO(stream, sid)->ext = soute; in sctp_stream_init_ext()
176 ret = sctp_sched_init_sid(stream, sid, GFP_KERNEL); in sctp_stream_init_ext()
178 kfree(SCTP_SO(stream, sid)->ext); in sctp_stream_init_ext()
179 SCTP_SO(stream, sid)->ext = NULL; in sctp_stream_init_ext()
185 void sctp_stream_free(struct sctp_stream *stream) in sctp_stream_free() argument
187 struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream); in sctp_stream_free()
190 sched->free(stream); in sctp_stream_free()
191 for (i = 0; i < stream->outcnt; i++) in sctp_stream_free()
192 kfree(SCTP_SO(stream, i)->ext); in sctp_stream_free()
193 genradix_free(&stream->out); in sctp_stream_free()
194 genradix_free(&stream->in); in sctp_stream_free()
197 void sctp_stream_clear(struct sctp_stream *stream) in sctp_stream_clear() argument
201 for (i = 0; i < stream->outcnt; i++) { in sctp_stream_clear()
202 SCTP_SO(stream, i)->mid = 0; in sctp_stream_clear()
203 SCTP_SO(stream, i)->mid_uo = 0; in sctp_stream_clear()
206 for (i = 0; i < stream->incnt; i++) in sctp_stream_clear()
207 SCTP_SI(stream, i)->mid = 0; in sctp_stream_clear()
210 void sctp_stream_update(struct sctp_stream *stream, struct sctp_stream *new) in sctp_stream_update() argument
212 struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream); in sctp_stream_update()
214 sched->unsched_all(stream); in sctp_stream_update()
215 sctp_stream_outq_migrate(stream, new, new->outcnt); in sctp_stream_update()
216 sctp_stream_free(stream); in sctp_stream_update()
218 stream->out = new->out; in sctp_stream_update()
219 stream->in = new->in; in sctp_stream_update()
220 stream->outcnt = new->outcnt; in sctp_stream_update()
221 stream->incnt = new->incnt; in sctp_stream_update()
223 sched->sched_all(stream); in sctp_stream_update()
243 static bool sctp_stream_outq_is_empty(struct sctp_stream *stream, in sctp_stream_outq_is_empty() argument
249 asoc = container_of(stream, struct sctp_association, stream); in sctp_stream_outq_is_empty()
259 if (SCTP_SO(stream, sid)->ext && in sctp_stream_outq_is_empty()
260 !list_empty(&SCTP_SO(stream, sid)->ext->outq)) in sctp_stream_outq_is_empty()
270 struct sctp_stream *stream = &asoc->stream; in sctp_send_reset_streams() local
300 if (str_list[i] >= stream->outcnt) in sctp_send_reset_streams()
309 if (str_list[i] >= stream->incnt) in sctp_send_reset_streams()
330 if (out && !sctp_stream_outq_is_empty(stream, str_nums, nstr_list)) { in sctp_send_reset_streams()
348 SCTP_SO(stream, str_list[i])->state = in sctp_send_reset_streams()
351 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_streams()
352 SCTP_SO(stream, i)->state = SCTP_STREAM_CLOSED; in sctp_send_reset_streams()
367 SCTP_SO(stream, str_list[i])->state = in sctp_send_reset_streams()
370 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_streams()
371 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_send_reset_streams()
384 struct sctp_stream *stream = &asoc->stream; in sctp_send_reset_assoc() local
404 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_assoc()
405 SCTP_SO(stream, i)->state = SCTP_STREAM_CLOSED; in sctp_send_reset_assoc()
415 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_assoc()
416 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_send_reset_assoc()
429 struct sctp_stream *stream = &asoc->stream; in sctp_send_add_streams() local
448 outcnt = stream->outcnt + out; in sctp_send_add_streams()
449 incnt = stream->incnt + in; in sctp_send_add_streams()
457 retval = sctp_stream_alloc_out(stream, outcnt, GFP_KERNEL); in sctp_send_add_streams()
524 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_outreq() local
559 if (ntohs(str_p[i]) >= stream->incnt) { in sctp_process_strreset_outreq()
591 SCTP_SI(stream, ntohs(str_p[i]))->mid = 0; in sctp_process_strreset_outreq()
593 for (i = 0; i < stream->incnt; i++) in sctp_process_strreset_outreq()
594 SCTP_SI(stream, i)->mid = 0; in sctp_process_strreset_outreq()
613 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_inreq() local
645 if (ntohs(str_p[i]) >= stream->outcnt) { in sctp_process_strreset_inreq()
651 if (!sctp_stream_outq_is_empty(stream, nums, str_p)) { in sctp_process_strreset_inreq()
663 SCTP_SO(stream, ntohs(str_p[i]))->state = in sctp_process_strreset_inreq()
666 for (i = 0; i < stream->outcnt; i++) in sctp_process_strreset_inreq()
667 SCTP_SO(stream, i)->state = SCTP_STREAM_CLOSED; in sctp_process_strreset_inreq()
691 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_tsnreq() local
733 asoc->stream.si->report_ftsn(&asoc->ulpq, max_tsn_seen); in sctp_process_strreset_tsnreq()
762 for (i = 0; i < stream->outcnt; i++) { in sctp_process_strreset_tsnreq()
763 SCTP_SO(stream, i)->mid = 0; in sctp_process_strreset_tsnreq()
764 SCTP_SO(stream, i)->mid_uo = 0; in sctp_process_strreset_tsnreq()
766 for (i = 0; i < stream->incnt; i++) in sctp_process_strreset_tsnreq()
767 SCTP_SI(stream, i)->mid = 0; in sctp_process_strreset_tsnreq()
787 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_addstrm_out() local
808 incnt = stream->incnt + in; in sctp_process_strreset_addstrm_out()
812 if (sctp_stream_alloc_in(stream, incnt, GFP_ATOMIC)) in sctp_process_strreset_addstrm_out()
838 stream->incnt = incnt; in sctp_process_strreset_addstrm_out()
857 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_addstrm_in() local
887 outcnt = stream->outcnt + out; in sctp_process_strreset_addstrm_in()
891 ret = sctp_stream_alloc_out(stream, outcnt, GFP_ATOMIC); in sctp_process_strreset_addstrm_in()
903 stream->outcnt = outcnt; in sctp_process_strreset_addstrm_in()
921 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_resp() local
956 sout = SCTP_SO(stream, ntohs(str_p[i])); in sctp_process_strreset_resp()
961 for (i = 0; i < stream->outcnt; i++) { in sctp_process_strreset_resp()
962 sout = SCTP_SO(stream, i); in sctp_process_strreset_resp()
971 for (i = 0; i < stream->outcnt; i++) in sctp_process_strreset_resp()
972 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_process_strreset_resp()
1010 asoc->stream.si->report_ftsn(&asoc->ulpq, mtsn); in sctp_process_strreset_resp()
1028 for (i = 0; i < stream->outcnt; i++) { in sctp_process_strreset_resp()
1029 SCTP_SO(stream, i)->mid = 0; in sctp_process_strreset_resp()
1030 SCTP_SO(stream, i)->mid_uo = 0; in sctp_process_strreset_resp()
1032 for (i = 0; i < stream->incnt; i++) in sctp_process_strreset_resp()
1033 SCTP_SI(stream, i)->mid = 0; in sctp_process_strreset_resp()
1036 for (i = 0; i < stream->outcnt; i++) in sctp_process_strreset_resp()
1037 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_process_strreset_resp()
1047 number = stream->outcnt - nums; in sctp_process_strreset_resp()
1050 for (i = number; i < stream->outcnt; i++) in sctp_process_strreset_resp()
1051 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_process_strreset_resp()
1053 sctp_stream_shrink_out(stream, number); in sctp_process_strreset_resp()
1054 stream->outcnt = number; in sctp_process_strreset_resp()