aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sctp/structs.h
diff options
context:
space:
mode:
authorMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>2017-10-03 18:20:13 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-03 19:27:29 -0400
commit5bbbbe32a43199c2b9ea5ea66fab6241c64beb51 (patch)
tree689b8896bcbcc50cfbc4554d79577cec95bb39f2 /include/net/sctp/structs.h
parent2fc019f790312e703efa1a44204c586112a430dc (diff)
sctp: introduce stream scheduler foundations
This patch introduces the hooks necessary to do stream scheduling, as per RFC Draft ndata. It also introduces the first scheduler, which is what we do today but now factored out: first come first served (FCFS). With stream scheduling now we have to track which chunk was enqueued on which stream and be able to select another other than the in front of the main outqueue. So we introduce a list on sctp_stream_out_ext structure for this purpose. We reuse sctp_chunk->transmitted_list space for the list above, as the chunk cannot belong to the two lists at the same time. By using the union in there, we can have distinct names for these moments. sctp_sched_ops are the operations expected to be implemented by each scheduler. The dequeueing is a bit particular to this implementation but it is to match how we dequeue packets today. We first dequeue and then check if it fits the packet and if not, we requeue it at head. Thus why we don't have a peek operation but have dequeue_done instead, which is called once the chunk can be safely considered as transmitted. The check removed from sctp_outq_flush is now performed by sctp_stream_outq_migrate, which is only called during assoc setup. (sctp_sendmsg() also checks for it) The only operation that is foreseen but not yet added here is a way to signalize that a new packet is starting or that the packet is done, for round robin scheduler per packet, but is intentionally left to the patch that actually implements it. Support for I-DATA chunks, also described in this RFC, with user message interleaving is straightforward as it just requires the schedulers to probe for the feature and ignore datamsg boundaries when dequeueing. See-also: https://tools.ietf.org/html/draft-ietf-tsvwg-sctp-ndata-13 Tested-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sctp/structs.h')
-rw-r--r--include/net/sctp/structs.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index c48f7999fe9b..3c22a30fd71b 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -84,7 +84,6 @@ struct sctp_ulpq;
84struct sctp_ep_common; 84struct sctp_ep_common;
85struct crypto_shash; 85struct crypto_shash;
86struct sctp_stream; 86struct sctp_stream;
87struct sctp_stream_out;
88 87
89 88
90#include <net/sctp/tsnmap.h> 89#include <net/sctp/tsnmap.h>
@@ -531,8 +530,12 @@ struct sctp_chunk {
531 /* How many times this chunk have been sent, for prsctp RTX policy */ 530 /* How many times this chunk have been sent, for prsctp RTX policy */
532 int sent_count; 531 int sent_count;
533 532
534 /* This is our link to the per-transport transmitted list. */ 533 union {
535 struct list_head transmitted_list; 534 /* This is our link to the per-transport transmitted list. */
535 struct list_head transmitted_list;
536 /* List in specific stream outq */
537 struct list_head stream_list;
538 };
536 539
537 /* This field is used by chunks that hold fragmented data. 540 /* This field is used by chunks that hold fragmented data.
538 * For the first fragment this is the list that holds the rest of 541 * For the first fragment this is the list that holds the rest of
@@ -1019,6 +1022,9 @@ struct sctp_outq {
1019 /* Data pending that has never been transmitted. */ 1022 /* Data pending that has never been transmitted. */
1020 struct list_head out_chunk_list; 1023 struct list_head out_chunk_list;
1021 1024
1025 /* Stream scheduler being used */
1026 struct sctp_sched_ops *sched;
1027
1022 unsigned int out_qlen; /* Total length of queued data chunks. */ 1028 unsigned int out_qlen; /* Total length of queued data chunks. */
1023 1029
1024 /* Error of send failed, may used in SCTP_SEND_FAILED event. */ 1030 /* Error of send failed, may used in SCTP_SEND_FAILED event. */
@@ -1325,6 +1331,7 @@ struct sctp_inithdr_host {
1325struct sctp_stream_out_ext { 1331struct sctp_stream_out_ext {
1326 __u64 abandoned_unsent[SCTP_PR_INDEX(MAX) + 1]; 1332 __u64 abandoned_unsent[SCTP_PR_INDEX(MAX) + 1];
1327 __u64 abandoned_sent[SCTP_PR_INDEX(MAX) + 1]; 1333 __u64 abandoned_sent[SCTP_PR_INDEX(MAX) + 1];
1334 struct list_head outq; /* chunks enqueued by this stream */
1328}; 1335};
1329 1336
1330struct sctp_stream_out { 1337struct sctp_stream_out {
@@ -1342,6 +1349,8 @@ struct sctp_stream {
1342 struct sctp_stream_in *in; 1349 struct sctp_stream_in *in;
1343 __u16 outcnt; 1350 __u16 outcnt;
1344 __u16 incnt; 1351 __u16 incnt;
1352 /* Current stream being sent, if any */
1353 struct sctp_stream_out *out_curr;
1345}; 1354};
1346 1355
1347#define SCTP_STREAM_CLOSED 0x00 1356#define SCTP_STREAM_CLOSED 0x00