Lines Matching refs:stream

91 static void sctp_stream_outq_migrate(struct sctp_stream *stream,  in sctp_stream_outq_migrate()  argument
99 asoc = container_of(stream, struct sctp_association, stream); in sctp_stream_outq_migrate()
129 SCTP_SO(new, i)->ext = SCTP_SO(stream, i)->ext; in sctp_stream_outq_migrate()
130 SCTP_SO(stream, i)->ext = NULL; in sctp_stream_outq_migrate()
134 for (i = outcnt; i < stream->outcnt; i++) in sctp_stream_outq_migrate()
135 kfree(SCTP_SO(stream, i)->ext); in sctp_stream_outq_migrate()
138 static int sctp_stream_alloc_out(struct sctp_stream *stream, __u16 outcnt, in sctp_stream_alloc_out() argument
148 if (stream->out) { in sctp_stream_alloc_out()
149 fa_copy(out, stream->out, 0, min(outcnt, stream->outcnt)); in sctp_stream_alloc_out()
150 fa_free(stream->out); in sctp_stream_alloc_out()
153 if (outcnt > stream->outcnt) in sctp_stream_alloc_out()
154 fa_zero(out, stream->outcnt, (outcnt - stream->outcnt)); in sctp_stream_alloc_out()
156 stream->out = out; in sctp_stream_alloc_out()
161 static int sctp_stream_alloc_in(struct sctp_stream *stream, __u16 incnt, in sctp_stream_alloc_in() argument
171 if (stream->in) { in sctp_stream_alloc_in()
172 fa_copy(in, stream->in, 0, min(incnt, stream->incnt)); in sctp_stream_alloc_in()
173 fa_free(stream->in); in sctp_stream_alloc_in()
176 if (incnt > stream->incnt) in sctp_stream_alloc_in()
177 fa_zero(in, stream->incnt, (incnt - stream->incnt)); in sctp_stream_alloc_in()
179 stream->in = in; in sctp_stream_alloc_in()
184 int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt, in sctp_stream_init() argument
187 struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream); in sctp_stream_init()
195 if (outcnt == stream->outcnt) in sctp_stream_init()
199 sched->unsched_all(stream); in sctp_stream_init()
200 sctp_stream_outq_migrate(stream, NULL, outcnt); in sctp_stream_init()
201 sched->sched_all(stream); in sctp_stream_init()
203 ret = sctp_stream_alloc_out(stream, outcnt, gfp); in sctp_stream_init()
207 stream->outcnt = outcnt; in sctp_stream_init()
208 for (i = 0; i < stream->outcnt; i++) in sctp_stream_init()
209 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_stream_init()
211 sched->init(stream); in sctp_stream_init()
214 sctp_stream_interleave_init(stream); in sctp_stream_init()
218 ret = sctp_stream_alloc_in(stream, incnt, gfp); in sctp_stream_init()
220 sched->free(stream); in sctp_stream_init()
221 fa_free(stream->out); in sctp_stream_init()
222 stream->out = NULL; in sctp_stream_init()
223 stream->outcnt = 0; in sctp_stream_init()
227 stream->incnt = incnt; in sctp_stream_init()
233 int sctp_stream_init_ext(struct sctp_stream *stream, __u16 sid) in sctp_stream_init_ext() argument
240 SCTP_SO(stream, sid)->ext = soute; in sctp_stream_init_ext()
242 return sctp_sched_init_sid(stream, sid, GFP_KERNEL); in sctp_stream_init_ext()
245 void sctp_stream_free(struct sctp_stream *stream) in sctp_stream_free() argument
247 struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream); in sctp_stream_free()
250 sched->free(stream); in sctp_stream_free()
251 for (i = 0; i < stream->outcnt; i++) in sctp_stream_free()
252 kfree(SCTP_SO(stream, i)->ext); in sctp_stream_free()
253 fa_free(stream->out); in sctp_stream_free()
254 fa_free(stream->in); in sctp_stream_free()
257 void sctp_stream_clear(struct sctp_stream *stream) in sctp_stream_clear() argument
261 for (i = 0; i < stream->outcnt; i++) { in sctp_stream_clear()
262 SCTP_SO(stream, i)->mid = 0; in sctp_stream_clear()
263 SCTP_SO(stream, i)->mid_uo = 0; in sctp_stream_clear()
266 for (i = 0; i < stream->incnt; i++) in sctp_stream_clear()
267 SCTP_SI(stream, i)->mid = 0; in sctp_stream_clear()
270 void sctp_stream_update(struct sctp_stream *stream, struct sctp_stream *new) in sctp_stream_update() argument
272 struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream); in sctp_stream_update()
274 sched->unsched_all(stream); in sctp_stream_update()
275 sctp_stream_outq_migrate(stream, new, new->outcnt); in sctp_stream_update()
276 sctp_stream_free(stream); in sctp_stream_update()
278 stream->out = new->out; in sctp_stream_update()
279 stream->in = new->in; in sctp_stream_update()
280 stream->outcnt = new->outcnt; in sctp_stream_update()
281 stream->incnt = new->incnt; in sctp_stream_update()
283 sched->sched_all(stream); in sctp_stream_update()
304 static bool sctp_stream_outq_is_empty(struct sctp_stream *stream, in sctp_stream_outq_is_empty() argument
310 asoc = container_of(stream, struct sctp_association, stream); in sctp_stream_outq_is_empty()
320 if (SCTP_SO(stream, sid)->ext && in sctp_stream_outq_is_empty()
321 !list_empty(&SCTP_SO(stream, sid)->ext->outq)) in sctp_stream_outq_is_empty()
331 struct sctp_stream *stream = &asoc->stream; in sctp_send_reset_streams() local
361 if (str_list[i] >= stream->outcnt) in sctp_send_reset_streams()
370 if (str_list[i] >= stream->incnt) in sctp_send_reset_streams()
391 if (out && !sctp_stream_outq_is_empty(stream, str_nums, nstr_list)) { in sctp_send_reset_streams()
408 SCTP_SO(stream, str_list[i])->state = in sctp_send_reset_streams()
411 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_streams()
412 SCTP_SO(stream, i)->state = SCTP_STREAM_CLOSED; in sctp_send_reset_streams()
427 SCTP_SO(stream, str_list[i])->state = in sctp_send_reset_streams()
430 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_streams()
431 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_send_reset_streams()
444 struct sctp_stream *stream = &asoc->stream; in sctp_send_reset_assoc() local
464 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_assoc()
465 SCTP_SO(stream, i)->state = SCTP_STREAM_CLOSED; in sctp_send_reset_assoc()
475 for (i = 0; i < stream->outcnt; i++) in sctp_send_reset_assoc()
476 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_send_reset_assoc()
489 struct sctp_stream *stream = &asoc->stream; in sctp_send_add_streams() local
508 outcnt = stream->outcnt + out; in sctp_send_add_streams()
509 incnt = stream->incnt + in; in sctp_send_add_streams()
517 retval = sctp_stream_alloc_out(stream, outcnt, GFP_KERNEL); in sctp_send_add_streams()
538 stream->incnt = incnt; in sctp_send_add_streams()
539 stream->outcnt = outcnt; in sctp_send_add_streams()
587 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_outreq() local
649 if (ntohs(str_p[i]) >= stream->incnt) { in sctp_process_strreset_outreq()
656 SCTP_SI(stream, ntohs(str_p[i]))->mid = 0; in sctp_process_strreset_outreq()
658 for (i = 0; i < stream->incnt; i++) in sctp_process_strreset_outreq()
659 SCTP_SI(stream, i)->mid = 0; in sctp_process_strreset_outreq()
680 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_inreq() local
712 if (ntohs(str_p[i]) >= stream->outcnt) { in sctp_process_strreset_inreq()
718 if (!sctp_stream_outq_is_empty(stream, nums, str_p)) { in sctp_process_strreset_inreq()
730 SCTP_SO(stream, ntohs(str_p[i]))->state = in sctp_process_strreset_inreq()
733 for (i = 0; i < stream->outcnt; i++) in sctp_process_strreset_inreq()
734 SCTP_SO(stream, i)->state = SCTP_STREAM_CLOSED; in sctp_process_strreset_inreq()
761 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_tsnreq() local
803 asoc->stream.si->report_ftsn(&asoc->ulpq, max_tsn_seen); in sctp_process_strreset_tsnreq()
832 for (i = 0; i < stream->outcnt; i++) { in sctp_process_strreset_tsnreq()
833 SCTP_SO(stream, i)->mid = 0; in sctp_process_strreset_tsnreq()
834 SCTP_SO(stream, i)->mid_uo = 0; in sctp_process_strreset_tsnreq()
836 for (i = 0; i < stream->incnt; i++) in sctp_process_strreset_tsnreq()
837 SCTP_SI(stream, i)->mid = 0; in sctp_process_strreset_tsnreq()
857 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_addstrm_out() local
901 incnt = stream->incnt + in; in sctp_process_strreset_addstrm_out()
905 if (sctp_stream_alloc_in(stream, incnt, GFP_ATOMIC)) in sctp_process_strreset_addstrm_out()
908 stream->incnt = incnt; in sctp_process_strreset_addstrm_out()
927 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_addstrm_in() local
957 outcnt = stream->outcnt + out; in sctp_process_strreset_addstrm_in()
961 ret = sctp_stream_alloc_out(stream, outcnt, GFP_ATOMIC); in sctp_process_strreset_addstrm_in()
973 stream->outcnt = outcnt; in sctp_process_strreset_addstrm_in()
994 struct sctp_stream *stream = &asoc->stream; in sctp_process_strreset_resp() local
1029 sout = SCTP_SO(stream, ntohs(str_p[i])); in sctp_process_strreset_resp()
1034 for (i = 0; i < stream->outcnt; i++) { in sctp_process_strreset_resp()
1035 sout = SCTP_SO(stream, i); in sctp_process_strreset_resp()
1044 for (i = 0; i < stream->outcnt; i++) in sctp_process_strreset_resp()
1045 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_process_strreset_resp()
1081 asoc->stream.si->report_ftsn(&asoc->ulpq, mtsn); in sctp_process_strreset_resp()
1099 for (i = 0; i < stream->outcnt; i++) { in sctp_process_strreset_resp()
1100 SCTP_SO(stream, i)->mid = 0; in sctp_process_strreset_resp()
1101 SCTP_SO(stream, i)->mid_uo = 0; in sctp_process_strreset_resp()
1103 for (i = 0; i < stream->incnt; i++) in sctp_process_strreset_resp()
1104 SCTP_SI(stream, i)->mid = 0; in sctp_process_strreset_resp()
1107 for (i = 0; i < stream->outcnt; i++) in sctp_process_strreset_resp()
1108 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_process_strreset_resp()
1118 number = stream->outcnt - nums; in sctp_process_strreset_resp()
1121 for (i = number; i < stream->outcnt; i++) in sctp_process_strreset_resp()
1122 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; in sctp_process_strreset_resp()
1124 stream->outcnt = number; in sctp_process_strreset_resp()