]> asedeno.scripts.mit.edu Git - linux.git/commit
sctp: implement make_datafrag for sctp_stream_interleave
authorXin Long <lucien.xin@gmail.com>
Fri, 8 Dec 2017 13:04:01 +0000 (21:04 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 11 Dec 2017 16:23:04 +0000 (11:23 -0500)
commit0c3f6f655487d12c7a0c16914c98c599043e88d3
tree4fa938da18a6b9e40ac49382ad03359d412ef1b3
parentad05a7a05ede28ba6dd935d9e932264a22518b1f
sctp: implement make_datafrag for sctp_stream_interleave

To avoid hundreds of checks for the different process on I-DATA chunk,
struct sctp_stream_interleave is defined as a group of functions used
to replace the codes in some place where it needs to do different job
according to if the asoc intl_enabled is set.

With these ops, it only needs to initialize asoc->stream.si with
sctp_stream_interleave_0 for normal data if asoc intl_enable is 0,
or sctp_stream_interleave_1 for idata if asoc intl_enable is set in
sctp_stream_init.

After that, the members in asoc->stream.si can be used directly in
some special places without checking asoc intl_enable.

make_datafrag is the first member for sctp_stream_interleave, it's
used to make data or idata frags, called in sctp_datamsg_from_user.
The old function sctp_make_datafrag_empty needs to be adjust some
to fit in this ops.

Note that as idata and data chunks have different length, it also
defines data_chunk_len for sctp_stream_interleave to describe the
chunk size.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sctp/sm.h
include/net/sctp/stream_interleave.h [new file with mode: 0644]
include/net/sctp/structs.h
net/sctp/Makefile
net/sctp/chunk.c
net/sctp/sm_make_chunk.c
net/sctp/stream.c
net/sctp/stream_interleave.c [new file with mode: 0644]