Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /* SCTP kernel implementation
0003  * (C) Copyright Red Hat Inc. 2017
0004  *
0005  * These are definitions used by the stream schedulers, defined in RFC
0006  * draft ndata (https://tools.ietf.org/html/draft-ietf-tsvwg-sctp-ndata-11)
0007  *
0008  * Please send any bug reports or fixes you make to the
0009  * email addresses:
0010  *    lksctp developers <linux-sctp@vger.kernel.org>
0011  *
0012  * Written or modified by:
0013  *   Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
0014  */
0015 
0016 #ifndef __sctp_stream_sched_h__
0017 #define __sctp_stream_sched_h__
0018 
0019 struct sctp_sched_ops {
0020     /* Property handling for a given stream */
0021     int (*set)(struct sctp_stream *stream, __u16 sid, __u16 value,
0022            gfp_t gfp);
0023     int (*get)(struct sctp_stream *stream, __u16 sid, __u16 *value);
0024 
0025     /* Init the specific scheduler */
0026     int (*init)(struct sctp_stream *stream);
0027     /* Init a stream */
0028     int (*init_sid)(struct sctp_stream *stream, __u16 sid, gfp_t gfp);
0029     /* Frees the entire thing */
0030     void (*free)(struct sctp_stream *stream);
0031 
0032     /* Enqueue a chunk */
0033     void (*enqueue)(struct sctp_outq *q, struct sctp_datamsg *msg);
0034     /* Dequeue a chunk */
0035     struct sctp_chunk *(*dequeue)(struct sctp_outq *q);
0036     /* Called only if the chunk fit the packet */
0037     void (*dequeue_done)(struct sctp_outq *q, struct sctp_chunk *chunk);
0038     /* Sched all chunks already enqueued */
0039     void (*sched_all)(struct sctp_stream *steam);
0040     /* Unched all chunks already enqueued */
0041     void (*unsched_all)(struct sctp_stream *steam);
0042 };
0043 
0044 int sctp_sched_set_sched(struct sctp_association *asoc,
0045              enum sctp_sched_type sched);
0046 int sctp_sched_get_sched(struct sctp_association *asoc);
0047 int sctp_sched_set_value(struct sctp_association *asoc, __u16 sid,
0048              __u16 value, gfp_t gfp);
0049 int sctp_sched_get_value(struct sctp_association *asoc, __u16 sid,
0050              __u16 *value);
0051 void sctp_sched_dequeue_done(struct sctp_outq *q, struct sctp_chunk *ch);
0052 
0053 void sctp_sched_dequeue_common(struct sctp_outq *q, struct sctp_chunk *ch);
0054 int sctp_sched_init_sid(struct sctp_stream *stream, __u16 sid, gfp_t gfp);
0055 struct sctp_sched_ops *sctp_sched_ops_from_stream(struct sctp_stream *stream);
0056 
0057 void sctp_sched_ops_register(enum sctp_sched_type sched,
0058                  struct sctp_sched_ops *sched_ops);
0059 void sctp_sched_ops_prio_init(void);
0060 void sctp_sched_ops_rr_init(void);
0061 
0062 #endif /* __sctp_stream_sched_h__ */