diff options
author | Konstantin Khorenko <khorenko@virtuozzo.com> | 2018-08-10 13:11:42 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-08-11 15:25:15 -0400 |
commit | 05364ca03cfd419caecb292fede20eb39667eaae (patch) | |
tree | 134bb5ed07d0dccfb47220d5b760c5e2be8a673f /net/sctp/stream_sched.c | |
parent | b70f1f3af47f4a21a25678f9ee587ed7986d62f8 (diff) |
net/sctp: Make wrappers for accessing in/out streams
This patch introduces wrappers for accessing in/out streams indirectly.
This will enable to replace physically contiguous memory arrays
of streams with flexible arrays (or maybe any other appropriate
mechanism) which do memory allocation on a per-page basis.
Signed-off-by: Oleg Babin <obabin@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/stream_sched.c')
-rw-r--r-- | net/sctp/stream_sched.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/net/sctp/stream_sched.c b/net/sctp/stream_sched.c index f5fcd425232a..a6c04a94b08f 100644 --- a/net/sctp/stream_sched.c +++ b/net/sctp/stream_sched.c | |||
@@ -161,7 +161,7 @@ int sctp_sched_set_sched(struct sctp_association *asoc, | |||
161 | 161 | ||
162 | /* Give the next scheduler a clean slate. */ | 162 | /* Give the next scheduler a clean slate. */ |
163 | for (i = 0; i < asoc->stream.outcnt; i++) { | 163 | for (i = 0; i < asoc->stream.outcnt; i++) { |
164 | void *p = asoc->stream.out[i].ext; | 164 | void *p = SCTP_SO(&asoc->stream, i)->ext; |
165 | 165 | ||
166 | if (!p) | 166 | if (!p) |
167 | continue; | 167 | continue; |
@@ -175,7 +175,7 @@ int sctp_sched_set_sched(struct sctp_association *asoc, | |||
175 | asoc->outqueue.sched = n; | 175 | asoc->outqueue.sched = n; |
176 | n->init(&asoc->stream); | 176 | n->init(&asoc->stream); |
177 | for (i = 0; i < asoc->stream.outcnt; i++) { | 177 | for (i = 0; i < asoc->stream.outcnt; i++) { |
178 | if (!asoc->stream.out[i].ext) | 178 | if (!SCTP_SO(&asoc->stream, i)->ext) |
179 | continue; | 179 | continue; |
180 | 180 | ||
181 | ret = n->init_sid(&asoc->stream, i, GFP_KERNEL); | 181 | ret = n->init_sid(&asoc->stream, i, GFP_KERNEL); |
@@ -217,7 +217,7 @@ int sctp_sched_set_value(struct sctp_association *asoc, __u16 sid, | |||
217 | if (sid >= asoc->stream.outcnt) | 217 | if (sid >= asoc->stream.outcnt) |
218 | return -EINVAL; | 218 | return -EINVAL; |
219 | 219 | ||
220 | if (!asoc->stream.out[sid].ext) { | 220 | if (!SCTP_SO(&asoc->stream, sid)->ext) { |
221 | int ret; | 221 | int ret; |
222 | 222 | ||
223 | ret = sctp_stream_init_ext(&asoc->stream, sid); | 223 | ret = sctp_stream_init_ext(&asoc->stream, sid); |
@@ -234,7 +234,7 @@ int sctp_sched_get_value(struct sctp_association *asoc, __u16 sid, | |||
234 | if (sid >= asoc->stream.outcnt) | 234 | if (sid >= asoc->stream.outcnt) |
235 | return -EINVAL; | 235 | return -EINVAL; |
236 | 236 | ||
237 | if (!asoc->stream.out[sid].ext) | 237 | if (!SCTP_SO(&asoc->stream, sid)->ext) |
238 | return 0; | 238 | return 0; |
239 | 239 | ||
240 | return asoc->outqueue.sched->get(&asoc->stream, sid, value); | 240 | return asoc->outqueue.sched->get(&asoc->stream, sid, value); |
@@ -252,7 +252,7 @@ void sctp_sched_dequeue_done(struct sctp_outq *q, struct sctp_chunk *ch) | |||
252 | * priority stream comes in. | 252 | * priority stream comes in. |
253 | */ | 253 | */ |
254 | sid = sctp_chunk_stream_no(ch); | 254 | sid = sctp_chunk_stream_no(ch); |
255 | sout = &q->asoc->stream.out[sid]; | 255 | sout = SCTP_SO(&q->asoc->stream, sid); |
256 | q->asoc->stream.out_curr = sout; | 256 | q->asoc->stream.out_curr = sout; |
257 | return; | 257 | return; |
258 | } | 258 | } |
@@ -272,8 +272,9 @@ void sctp_sched_dequeue_common(struct sctp_outq *q, struct sctp_chunk *ch) | |||
272 | int sctp_sched_init_sid(struct sctp_stream *stream, __u16 sid, gfp_t gfp) | 272 | int sctp_sched_init_sid(struct sctp_stream *stream, __u16 sid, gfp_t gfp) |
273 | { | 273 | { |
274 | struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream); | 274 | struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream); |
275 | struct sctp_stream_out_ext *ext = SCTP_SO(stream, sid)->ext; | ||
275 | 276 | ||
276 | INIT_LIST_HEAD(&stream->out[sid].ext->outq); | 277 | INIT_LIST_HEAD(&ext->outq); |
277 | return sched->init_sid(stream, sid, gfp); | 278 | return sched->init_sid(stream, sid, gfp); |
278 | } | 279 | } |
279 | 280 | ||