Lines Matching refs:stream

29 static void sctp_stream_outq_migrate(struct sctp_stream *stream,  in sctp_stream_outq_migrate()  argument
37 asoc = container_of(stream, struct sctp_association, stream); in sctp_stream_outq_migrate()
67 SCTP_SO(new, i)->ext = SCTP_SO(stream, i)->ext; in sctp_stream_outq_migrate()
68 SCTP_SO(stream, i)->ext = NULL; in sctp_stream_outq_migrate()
72 for (i = outcnt; i < stream->outcnt; i++) { in sctp_stream_outq_migrate()
73 kfree(SCTP_SO(stream, i)->ext); in sctp_stream_outq_migrate()
74 SCTP_SO(stream, i)->ext = NULL; in sctp_stream_outq_migrate()
78 static int sctp_stream_alloc_out(struct sctp_stream *stream, __u16 outcnt, in sctp_stream_alloc_out() argument
83 if (outcnt <= stream->outcnt) in sctp_stream_alloc_out()
86 ret = genradix_prealloc(&stream->out, outcnt, gfp); in sctp_stream_alloc_out()
90 stream->outcnt = outcnt; in sctp_stream_alloc_out()
94 static int sctp_stream_alloc_in(struct sctp_stream *stream, __u16 incnt, in sctp_stream_alloc_in() argument
99 if (incnt <= stream->incnt) in sctp_stream_alloc_in()
102 ret = genradix_prealloc(&stream->in, incnt, gfp); in sctp_stream_alloc_in()
106 stream->incnt = incnt; in sctp_stream_alloc_in()
110 int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt, in sctp_stream_init() argument
113 struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream); in sctp_stream_init()
121 if (outcnt == stream->outcnt) in sctp_stream_init()
125 sched->unsched_all(stream); in sctp_stream_init()
126 sctp_stream_outq_migrate(stream, NULL, outcnt); in sctp_stream_init()
127 sched->sched_all(stream); in sctp_stream_init()
129 ret = sctp_stream_alloc_out(stream, outcnt, gfp); in sctp_stream_init()
133 for (i = 0; i < stream->outcnt; i++) in sctp_stream_init()
134 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_stream_init()
137 sctp_stream_interleave_init(stream); in sctp_stream_init()
141 ret = sctp_stream_alloc_in(stream, incnt, gfp); in sctp_stream_init()
143 sched->free(stream); in sctp_stream_init()
144 genradix_free(&stream->out); in sctp_stream_init()
145 stream->outcnt = 0; in sctp_stream_init()
153 int sctp_stream_init_ext(struct sctp_stream *stream, __u16 sid) in sctp_stream_init_ext() argument
161 SCTP_SO(stream, sid)->ext = soute; in sctp_stream_init_ext()
163 ret = sctp_sched_init_sid(stream, sid, GFP_KERNEL); in sctp_stream_init_ext()
165 kfree(SCTP_SO(stream, sid)->ext); in sctp_stream_init_ext()
166 SCTP_SO(stream, sid)->ext = NULL; in sctp_stream_init_ext()
172 void sctp_stream_free(struct sctp_stream *stream) in sctp_stream_free() argument
174 struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream); in sctp_stream_free()
177 sched->free(stream); in sctp_stream_free()
178 for (i = 0; i < stream->outcnt; i++) in sctp_stream_free()
179 kfree(SCTP_SO(stream, i)->ext); in sctp_stream_free()
180 genradix_free(&stream->out); in sctp_stream_free()
181 genradix_free(&stream->in); in sctp_stream_free()
184 void sctp_stream_clear(struct sctp_stream *stream) in sctp_stream_clear() argument
188 for (i = 0; i < stream->outcnt; i++) { in sctp_stream_clear()
189 SCTP_SO(stream, i)->mid = 0; in sctp_stream_clear()
190 SCTP_SO(stream, i)->mid_uo = 0; in sctp_stream_clear()
193 for (i = 0; i < stream->incnt; i++) in sctp_stream_clear()
194 SCTP_SI(stream, i)->mid = 0; in sctp_stream_clear()
197 void sctp_stream_update(struct sctp_stream *stream, struct sctp_stream *new) in sctp_stream_update() argument
199 struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream); in sctp_stream_update()
201 sched->unsched_all(stream); in sctp_stream_update()
202 sctp_stream_outq_migrate(stream, new, new->outcnt); in sctp_stream_update()
203 sctp_stream_free(stream); in sctp_stream_update()
205 stream->out = new->out; in sctp_stream_update()
206 stream->in = new->in; in sctp_stream_update()
207 stream->outcnt = new->outcnt; in sctp_stream_update()
208 stream->incnt = new->incnt; in sctp_stream_update()
210 sched->sched_all(stream); in sctp_stream_update()
231 static bool sctp_stream_outq_is_empty(struct sctp_stream *stream, in sctp_stream_outq_is_empty() argument
237 asoc = container_of(stream, struct sctp_association, stream); in sctp_stream_outq_is_empty()
247 if (SCTP_SO(stream, sid)->ext && in sctp_stream_outq_is_empty()
248 !list_empty(&SCTP_SO(stream, sid)->ext->outq)) in sctp_stream_outq_is_empty()
258 struct sctp_stream *stream = &asoc->stream; in sctp_send_reset_streams() local
288 if (str_list[i] >= stream->outcnt) in sctp_send_reset_streams()
297 if (str_list[i] >= stream->incnt) in sctp_send_reset_streams()
318 if (out && !sctp_stream_outq_is_empty(stream, str_nums, nstr_list)) { in sctp_send_reset_streams()
336 SCTP_SO(stream, str_list[i])->state = in sctp_send_reset_streams()
339 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_streams()
340 SCTP_SO(stream, i)->state = SCTP_STREAM_CLOSED; in sctp_send_reset_streams()
355 SCTP_SO(stream, str_list[i])->state = in sctp_send_reset_streams()
358 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_streams()
359 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_send_reset_streams()
372 struct sctp_stream *stream = &asoc->stream; in sctp_send_reset_assoc() local
392 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_assoc()
393 SCTP_SO(stream, i)->state = SCTP_STREAM_CLOSED; in sctp_send_reset_assoc()
403 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_assoc()
404 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_send_reset_assoc()
417 struct sctp_stream *stream = &asoc->stream; in sctp_send_add_streams() local
436 outcnt = stream->outcnt + out; in sctp_send_add_streams()
437 incnt = stream->incnt + in; in sctp_send_add_streams()
445 retval = sctp_stream_alloc_out(stream, outcnt, GFP_KERNEL); in sctp_send_add_streams()
512 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_outreq() local
547 if (ntohs(str_p[i]) >= stream->incnt) { in sctp_process_strreset_outreq()
579 SCTP_SI(stream, ntohs(str_p[i]))->mid = 0; in sctp_process_strreset_outreq()
581 for (i = 0; i < stream->incnt; i++) in sctp_process_strreset_outreq()
582 SCTP_SI(stream, i)->mid = 0; in sctp_process_strreset_outreq()
601 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_inreq() local
633 if (ntohs(str_p[i]) >= stream->outcnt) { in sctp_process_strreset_inreq()
639 if (!sctp_stream_outq_is_empty(stream, nums, str_p)) { in sctp_process_strreset_inreq()
651 SCTP_SO(stream, ntohs(str_p[i]))->state = in sctp_process_strreset_inreq()
654 for (i = 0; i < stream->outcnt; i++) in sctp_process_strreset_inreq()
655 SCTP_SO(stream, i)->state = SCTP_STREAM_CLOSED; in sctp_process_strreset_inreq()
679 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_tsnreq() local
721 asoc->stream.si->report_ftsn(&asoc->ulpq, max_tsn_seen); in sctp_process_strreset_tsnreq()
750 for (i = 0; i < stream->outcnt; i++) { in sctp_process_strreset_tsnreq()
751 SCTP_SO(stream, i)->mid = 0; in sctp_process_strreset_tsnreq()
752 SCTP_SO(stream, i)->mid_uo = 0; in sctp_process_strreset_tsnreq()
754 for (i = 0; i < stream->incnt; i++) in sctp_process_strreset_tsnreq()
755 SCTP_SI(stream, i)->mid = 0; in sctp_process_strreset_tsnreq()
775 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_addstrm_out() local
796 incnt = stream->incnt + in; in sctp_process_strreset_addstrm_out()
800 if (sctp_stream_alloc_in(stream, incnt, GFP_ATOMIC)) in sctp_process_strreset_addstrm_out()
826 stream->incnt = incnt; in sctp_process_strreset_addstrm_out()
845 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_addstrm_in() local
875 outcnt = stream->outcnt + out; in sctp_process_strreset_addstrm_in()
879 ret = sctp_stream_alloc_out(stream, outcnt, GFP_ATOMIC); in sctp_process_strreset_addstrm_in()
891 stream->outcnt = outcnt; in sctp_process_strreset_addstrm_in()
909 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_resp() local
944 sout = SCTP_SO(stream, ntohs(str_p[i])); in sctp_process_strreset_resp()
949 for (i = 0; i < stream->outcnt; i++) { in sctp_process_strreset_resp()
950 sout = SCTP_SO(stream, i); in sctp_process_strreset_resp()
959 for (i = 0; i < stream->outcnt; i++) in sctp_process_strreset_resp()
960 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_process_strreset_resp()
998 asoc->stream.si->report_ftsn(&asoc->ulpq, mtsn); in sctp_process_strreset_resp()
1016 for (i = 0; i < stream->outcnt; i++) { in sctp_process_strreset_resp()
1017 SCTP_SO(stream, i)->mid = 0; in sctp_process_strreset_resp()
1018 SCTP_SO(stream, i)->mid_uo = 0; in sctp_process_strreset_resp()
1020 for (i = 0; i < stream->incnt; i++) in sctp_process_strreset_resp()
1021 SCTP_SI(stream, i)->mid = 0; in sctp_process_strreset_resp()
1024 for (i = 0; i < stream->outcnt; i++) in sctp_process_strreset_resp()
1025 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_process_strreset_resp()
1035 number = stream->outcnt - nums; in sctp_process_strreset_resp()
1038 for (i = number; i < stream->outcnt; i++) in sctp_process_strreset_resp()
1039 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_process_strreset_resp()
1041 stream->outcnt = number; in sctp_process_strreset_resp()