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()
55 static void sctp_stream_free_ext(struct sctp_stream *stream, __u16 sid) in sctp_stream_free_ext() argument
59 if (!SCTP_SO(stream, sid)->ext) in sctp_stream_free_ext()
62 sched = sctp_sched_ops_from_stream(stream); in sctp_stream_free_ext()
63 sched->free_sid(stream, sid); in sctp_stream_free_ext()
64 kfree(SCTP_SO(stream, sid)->ext); in sctp_stream_free_ext()
65 SCTP_SO(stream, sid)->ext = NULL; in sctp_stream_free_ext()
72 static void sctp_stream_outq_migrate(struct sctp_stream *stream, in sctp_stream_outq_migrate() argument
77 if (stream->outcnt > outcnt) in sctp_stream_outq_migrate()
78 sctp_stream_shrink_out(stream, outcnt); in sctp_stream_outq_migrate()
87 SCTP_SO(new, i)->ext = SCTP_SO(stream, i)->ext; in sctp_stream_outq_migrate()
88 SCTP_SO(stream, i)->ext = NULL; in sctp_stream_outq_migrate()
92 for (i = outcnt; i < stream->outcnt; i++) in sctp_stream_outq_migrate()
93 sctp_stream_free_ext(stream, i); in sctp_stream_outq_migrate()
96 static int sctp_stream_alloc_out(struct sctp_stream *stream, __u16 outcnt, in sctp_stream_alloc_out() argument
101 if (outcnt <= stream->outcnt) in sctp_stream_alloc_out()
104 ret = genradix_prealloc(&stream->out, outcnt, gfp); in sctp_stream_alloc_out()
109 stream->outcnt = outcnt; in sctp_stream_alloc_out()
113 static int sctp_stream_alloc_in(struct sctp_stream *stream, __u16 incnt, in sctp_stream_alloc_in() argument
118 if (incnt <= stream->incnt) in sctp_stream_alloc_in()
121 ret = genradix_prealloc(&stream->in, incnt, gfp); in sctp_stream_alloc_in()
126 stream->incnt = incnt; in sctp_stream_alloc_in()
130 int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt, in sctp_stream_init() argument
133 struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream); in sctp_stream_init()
141 if (outcnt == stream->outcnt) in sctp_stream_init()
145 sched->unsched_all(stream); in sctp_stream_init()
146 sctp_stream_outq_migrate(stream, NULL, outcnt); in sctp_stream_init()
147 sched->sched_all(stream); in sctp_stream_init()
149 ret = sctp_stream_alloc_out(stream, outcnt, gfp); in sctp_stream_init()
153 for (i = 0; i < stream->outcnt; i++) in sctp_stream_init()
154 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_stream_init()
157 sctp_stream_interleave_init(stream); in sctp_stream_init()
161 return sctp_stream_alloc_in(stream, incnt, gfp); in sctp_stream_init()
164 int sctp_stream_init_ext(struct sctp_stream *stream, __u16 sid) in sctp_stream_init_ext() argument
172 SCTP_SO(stream, sid)->ext = soute; in sctp_stream_init_ext()
174 ret = sctp_sched_init_sid(stream, sid, GFP_KERNEL); in sctp_stream_init_ext()
176 kfree(SCTP_SO(stream, sid)->ext); in sctp_stream_init_ext()
177 SCTP_SO(stream, sid)->ext = NULL; in sctp_stream_init_ext()
183 void sctp_stream_free(struct sctp_stream *stream) in sctp_stream_free() argument
185 struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream); in sctp_stream_free()
188 sched->unsched_all(stream); in sctp_stream_free()
189 for (i = 0; i < stream->outcnt; i++) in sctp_stream_free()
190 sctp_stream_free_ext(stream, i); in sctp_stream_free()
191 genradix_free(&stream->out); in sctp_stream_free()
192 genradix_free(&stream->in); in sctp_stream_free()
195 void sctp_stream_clear(struct sctp_stream *stream) in sctp_stream_clear() argument
199 for (i = 0; i < stream->outcnt; i++) { in sctp_stream_clear()
200 SCTP_SO(stream, i)->mid = 0; in sctp_stream_clear()
201 SCTP_SO(stream, i)->mid_uo = 0; in sctp_stream_clear()
204 for (i = 0; i < stream->incnt; i++) in sctp_stream_clear()
205 SCTP_SI(stream, i)->mid = 0; in sctp_stream_clear()
208 void sctp_stream_update(struct sctp_stream *stream, struct sctp_stream *new) in sctp_stream_update() argument
210 struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream); in sctp_stream_update()
212 sched->unsched_all(stream); in sctp_stream_update()
213 sctp_stream_outq_migrate(stream, new, new->outcnt); in sctp_stream_update()
214 sctp_stream_free(stream); in sctp_stream_update()
216 stream->out = new->out; in sctp_stream_update()
217 stream->in = new->in; in sctp_stream_update()
218 stream->outcnt = new->outcnt; in sctp_stream_update()
219 stream->incnt = new->incnt; in sctp_stream_update()
221 sched->sched_all(stream); in sctp_stream_update()
241 static bool sctp_stream_outq_is_empty(struct sctp_stream *stream, in sctp_stream_outq_is_empty() argument
247 asoc = container_of(stream, struct sctp_association, stream); in sctp_stream_outq_is_empty()
257 if (SCTP_SO(stream, sid)->ext && in sctp_stream_outq_is_empty()
258 !list_empty(&SCTP_SO(stream, sid)->ext->outq)) in sctp_stream_outq_is_empty()
268 struct sctp_stream *stream = &asoc->stream; in sctp_send_reset_streams() local
298 if (str_list[i] >= stream->outcnt) in sctp_send_reset_streams()
307 if (str_list[i] >= stream->incnt) in sctp_send_reset_streams()
328 if (out && !sctp_stream_outq_is_empty(stream, str_nums, nstr_list)) { in sctp_send_reset_streams()
346 SCTP_SO(stream, str_list[i])->state = in sctp_send_reset_streams()
349 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_streams()
350 SCTP_SO(stream, i)->state = SCTP_STREAM_CLOSED; in sctp_send_reset_streams()
365 SCTP_SO(stream, str_list[i])->state = in sctp_send_reset_streams()
368 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_streams()
369 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_send_reset_streams()
382 struct sctp_stream *stream = &asoc->stream; in sctp_send_reset_assoc() local
402 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_assoc()
403 SCTP_SO(stream, i)->state = SCTP_STREAM_CLOSED; in sctp_send_reset_assoc()
413 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_assoc()
414 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_send_reset_assoc()
427 struct sctp_stream *stream = &asoc->stream; in sctp_send_add_streams() local
446 outcnt = stream->outcnt + out; in sctp_send_add_streams()
447 incnt = stream->incnt + in; in sctp_send_add_streams()
455 retval = sctp_stream_alloc_out(stream, outcnt, GFP_KERNEL); in sctp_send_add_streams()
522 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_outreq() local
557 if (ntohs(str_p[i]) >= stream->incnt) { in sctp_process_strreset_outreq()
589 SCTP_SI(stream, ntohs(str_p[i]))->mid = 0; in sctp_process_strreset_outreq()
591 for (i = 0; i < stream->incnt; i++) in sctp_process_strreset_outreq()
592 SCTP_SI(stream, i)->mid = 0; in sctp_process_strreset_outreq()
611 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_inreq() local
643 if (ntohs(str_p[i]) >= stream->outcnt) { in sctp_process_strreset_inreq()
649 if (!sctp_stream_outq_is_empty(stream, nums, str_p)) { in sctp_process_strreset_inreq()
661 SCTP_SO(stream, ntohs(str_p[i]))->state = in sctp_process_strreset_inreq()
664 for (i = 0; i < stream->outcnt; i++) in sctp_process_strreset_inreq()
665 SCTP_SO(stream, i)->state = SCTP_STREAM_CLOSED; in sctp_process_strreset_inreq()
689 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_tsnreq() local
731 asoc->stream.si->report_ftsn(&asoc->ulpq, max_tsn_seen); in sctp_process_strreset_tsnreq()
760 for (i = 0; i < stream->outcnt; i++) { in sctp_process_strreset_tsnreq()
761 SCTP_SO(stream, i)->mid = 0; in sctp_process_strreset_tsnreq()
762 SCTP_SO(stream, i)->mid_uo = 0; in sctp_process_strreset_tsnreq()
764 for (i = 0; i < stream->incnt; i++) in sctp_process_strreset_tsnreq()
765 SCTP_SI(stream, i)->mid = 0; in sctp_process_strreset_tsnreq()
785 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_addstrm_out() local
806 incnt = stream->incnt + in; in sctp_process_strreset_addstrm_out()
810 if (sctp_stream_alloc_in(stream, incnt, GFP_ATOMIC)) in sctp_process_strreset_addstrm_out()
836 stream->incnt = incnt; in sctp_process_strreset_addstrm_out()
855 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_addstrm_in() local
885 outcnt = stream->outcnt + out; in sctp_process_strreset_addstrm_in()
889 ret = sctp_stream_alloc_out(stream, outcnt, GFP_ATOMIC); in sctp_process_strreset_addstrm_in()
901 stream->outcnt = outcnt; in sctp_process_strreset_addstrm_in()
919 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_resp() local
954 sout = SCTP_SO(stream, ntohs(str_p[i])); in sctp_process_strreset_resp()
959 for (i = 0; i < stream->outcnt; i++) { in sctp_process_strreset_resp()
960 sout = SCTP_SO(stream, i); in sctp_process_strreset_resp()
969 for (i = 0; i < stream->outcnt; i++) in sctp_process_strreset_resp()
970 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_process_strreset_resp()
1008 asoc->stream.si->report_ftsn(&asoc->ulpq, mtsn); in sctp_process_strreset_resp()
1026 for (i = 0; i < stream->outcnt; i++) { in sctp_process_strreset_resp()
1027 SCTP_SO(stream, i)->mid = 0; in sctp_process_strreset_resp()
1028 SCTP_SO(stream, i)->mid_uo = 0; in sctp_process_strreset_resp()
1030 for (i = 0; i < stream->incnt; i++) in sctp_process_strreset_resp()
1031 SCTP_SI(stream, i)->mid = 0; in sctp_process_strreset_resp()
1034 for (i = 0; i < stream->outcnt; i++) in sctp_process_strreset_resp()
1035 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_process_strreset_resp()
1045 number = stream->outcnt - nums; in sctp_process_strreset_resp()
1048 for (i = number; i < stream->outcnt; i++) in sctp_process_strreset_resp()
1049 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_process_strreset_resp()
1051 sctp_stream_shrink_out(stream, number); in sctp_process_strreset_resp()
1052 stream->outcnt = number; in sctp_process_strreset_resp()