^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /* SCTP kernel implementation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * (C) Copyright Red Hat Inc. 2017
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * These are definitions used by the stream schedulers, defined in RFC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * draft ndata (https://tools.ietf.org/html/draft-ietf-tsvwg-sctp-ndata-11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Please send any bug reports or fixes you make to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * email addresses:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * lksctp developers <linux-sctp@vger.kernel.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * Written or modified by:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #ifndef __sctp_stream_sched_h__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define __sctp_stream_sched_h__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) struct sctp_sched_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) /* Property handling for a given stream */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) int (*set)(struct sctp_stream *stream, __u16 sid, __u16 value,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) gfp_t gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) int (*get)(struct sctp_stream *stream, __u16 sid, __u16 *value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) /* Init the specific scheduler */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) int (*init)(struct sctp_stream *stream);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) /* Init a stream */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) int (*init_sid)(struct sctp_stream *stream, __u16 sid, gfp_t gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) /* Frees the entire thing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) void (*free)(struct sctp_stream *stream);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) /* Enqueue a chunk */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) void (*enqueue)(struct sctp_outq *q, struct sctp_datamsg *msg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* Dequeue a chunk */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct sctp_chunk *(*dequeue)(struct sctp_outq *q);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) /* Called only if the chunk fit the packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) void (*dequeue_done)(struct sctp_outq *q, struct sctp_chunk *chunk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) /* Sched all chunks already enqueued */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) void (*sched_all)(struct sctp_stream *steam);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /* Unched all chunks already enqueued */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) void (*unsched_all)(struct sctp_stream *steam);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) int sctp_sched_set_sched(struct sctp_association *asoc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) enum sctp_sched_type sched);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) int sctp_sched_get_sched(struct sctp_association *asoc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) int sctp_sched_set_value(struct sctp_association *asoc, __u16 sid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) __u16 value, gfp_t gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) int sctp_sched_get_value(struct sctp_association *asoc, __u16 sid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) __u16 *value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) void sctp_sched_dequeue_done(struct sctp_outq *q, struct sctp_chunk *ch);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) void sctp_sched_dequeue_common(struct sctp_outq *q, struct sctp_chunk *ch);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) int sctp_sched_init_sid(struct sctp_stream *stream, __u16 sid, gfp_t gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) struct sctp_sched_ops *sctp_sched_ops_from_stream(struct sctp_stream *stream);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) void sctp_sched_ops_register(enum sctp_sched_type sched,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) struct sctp_sched_ops *sched_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) void sctp_sched_ops_prio_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) void sctp_sched_ops_rr_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #endif /* __sctp_stream_sched_h__ */