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 return sctp_stream_alloc_in(stream, incnt, gfp); 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()
230 static bool sctp_stream_outq_is_empty(struct sctp_stream *stream, in sctp_stream_outq_is_empty() argument
236 asoc = container_of(stream, struct sctp_association, stream); in sctp_stream_outq_is_empty()
246 if (SCTP_SO(stream, sid)->ext && in sctp_stream_outq_is_empty()
247 !list_empty(&SCTP_SO(stream, sid)->ext->outq)) in sctp_stream_outq_is_empty()
257 struct sctp_stream *stream = &asoc->stream; in sctp_send_reset_streams() local
287 if (str_list[i] >= stream->outcnt) in sctp_send_reset_streams()
296 if (str_list[i] >= stream->incnt) in sctp_send_reset_streams()
317 if (out && !sctp_stream_outq_is_empty(stream, str_nums, nstr_list)) { in sctp_send_reset_streams()
335 SCTP_SO(stream, str_list[i])->state = in sctp_send_reset_streams()
338 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_streams()
339 SCTP_SO(stream, i)->state = SCTP_STREAM_CLOSED; in sctp_send_reset_streams()
354 SCTP_SO(stream, str_list[i])->state = in sctp_send_reset_streams()
357 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_streams()
358 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_send_reset_streams()
371 struct sctp_stream *stream = &asoc->stream; in sctp_send_reset_assoc() local
391 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_assoc()
392 SCTP_SO(stream, i)->state = SCTP_STREAM_CLOSED; in sctp_send_reset_assoc()
402 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_assoc()
403 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_send_reset_assoc()
416 struct sctp_stream *stream = &asoc->stream; in sctp_send_add_streams() local
435 outcnt = stream->outcnt + out; in sctp_send_add_streams()
436 incnt = stream->incnt + in; in sctp_send_add_streams()
444 retval = sctp_stream_alloc_out(stream, outcnt, GFP_KERNEL); in sctp_send_add_streams()
511 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_outreq() local
546 if (ntohs(str_p[i]) >= stream->incnt) { in sctp_process_strreset_outreq()
578 SCTP_SI(stream, ntohs(str_p[i]))->mid = 0; in sctp_process_strreset_outreq()
580 for (i = 0; i < stream->incnt; i++) in sctp_process_strreset_outreq()
581 SCTP_SI(stream, i)->mid = 0; in sctp_process_strreset_outreq()
600 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_inreq() local
632 if (ntohs(str_p[i]) >= stream->outcnt) { in sctp_process_strreset_inreq()
638 if (!sctp_stream_outq_is_empty(stream, nums, str_p)) { in sctp_process_strreset_inreq()
650 SCTP_SO(stream, ntohs(str_p[i]))->state = in sctp_process_strreset_inreq()
653 for (i = 0; i < stream->outcnt; i++) in sctp_process_strreset_inreq()
654 SCTP_SO(stream, i)->state = SCTP_STREAM_CLOSED; in sctp_process_strreset_inreq()
678 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_tsnreq() local
720 asoc->stream.si->report_ftsn(&asoc->ulpq, max_tsn_seen); in sctp_process_strreset_tsnreq()
749 for (i = 0; i < stream->outcnt; i++) { in sctp_process_strreset_tsnreq()
750 SCTP_SO(stream, i)->mid = 0; in sctp_process_strreset_tsnreq()
751 SCTP_SO(stream, i)->mid_uo = 0; in sctp_process_strreset_tsnreq()
753 for (i = 0; i < stream->incnt; i++) in sctp_process_strreset_tsnreq()
754 SCTP_SI(stream, i)->mid = 0; in sctp_process_strreset_tsnreq()
774 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_addstrm_out() local
795 incnt = stream->incnt + in; in sctp_process_strreset_addstrm_out()
799 if (sctp_stream_alloc_in(stream, incnt, GFP_ATOMIC)) in sctp_process_strreset_addstrm_out()
825 stream->incnt = incnt; in sctp_process_strreset_addstrm_out()
844 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_addstrm_in() local
874 outcnt = stream->outcnt + out; in sctp_process_strreset_addstrm_in()
878 ret = sctp_stream_alloc_out(stream, outcnt, GFP_ATOMIC); in sctp_process_strreset_addstrm_in()
890 stream->outcnt = outcnt; in sctp_process_strreset_addstrm_in()
908 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_resp() local
943 sout = SCTP_SO(stream, ntohs(str_p[i])); in sctp_process_strreset_resp()
948 for (i = 0; i < stream->outcnt; i++) { in sctp_process_strreset_resp()
949 sout = SCTP_SO(stream, i); in sctp_process_strreset_resp()
958 for (i = 0; i < stream->outcnt; i++) in sctp_process_strreset_resp()
959 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_process_strreset_resp()
997 asoc->stream.si->report_ftsn(&asoc->ulpq, mtsn); in sctp_process_strreset_resp()
1015 for (i = 0; i < stream->outcnt; i++) { in sctp_process_strreset_resp()
1016 SCTP_SO(stream, i)->mid = 0; in sctp_process_strreset_resp()
1017 SCTP_SO(stream, i)->mid_uo = 0; in sctp_process_strreset_resp()
1019 for (i = 0; i < stream->incnt; i++) in sctp_process_strreset_resp()
1020 SCTP_SI(stream, i)->mid = 0; in sctp_process_strreset_resp()
1023 for (i = 0; i < stream->outcnt; i++) in sctp_process_strreset_resp()
1024 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_process_strreset_resp()
1034 number = stream->outcnt - nums; in sctp_process_strreset_resp()
1037 for (i = number; i < stream->outcnt; i++) in sctp_process_strreset_resp()
1038 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_process_strreset_resp()
1040 sctp_stream_shrink_out(stream, number); in sctp_process_strreset_resp()
1041 stream->outcnt = number; in sctp_process_strreset_resp()