Commit graph

10 commits

Author SHA1 Message Date
Victor Boivie
a866228db1 dcsctp: Use third_party/crc32c for integrity check
CRC32c is used in SCTP for integrity checking, and the
third_party/crc32c library (https://github.com/google/crc32c) which has
been optimized for SSE42 and arm64 and has a much faster fallback
implementation for other architectures.

Running ./out/Release/dcsctp_benchmark
Run on (12 X 4500 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x6)
  L1 Instruction 32 KiB (x6)
  L2 Unified 1024 KiB (x6)
  L3 Unified 8448 KiB (x1)
Load Average: 11.01, 17.53, 17.11
------------------------------------------------------------------------------
Benchmark                    Time             CPU   Iterations UserCounters...
------------------------------------------------------------------------------
BM_PumpData/1              676 ns          676 ns      1034087 bytes_per_second=1.41063M/s items_per_second=1.47916M/s
BM_PumpData/8              671 ns          671 ns      1041809 bytes_per_second=11.3643M/s items_per_second=1.48955M/s
BM_PumpData/128            725 ns          725 ns       967170 bytes_per_second=168.398M/s items_per_second=1.37952M/s
BM_PumpData/512            800 ns          800 ns       873854 bytes_per_second=610.125M/s items_per_second=1.24954M/s
BM_PumpData/1024           911 ns          911 ns       775785 bytes_per_second=1072.2M/s items_per_second=1097.93k/s
BM_PumpData/2048          1988 ns         1988 ns       352444 bytes_per_second=982.409M/s items_per_second=502.993k/s
BM_PumpData/4096          3893 ns         3893 ns       179999 bytes_per_second=1003.31M/s items_per_second=256.848k/s
BM_PumpData/8192          7477 ns         7477 ns        92790 bytes_per_second=1044.88M/s items_per_second=133.745k/s
BM_PumpData/65536        97156 ns        97153 ns         7089 bytes_per_second=643.318M/s items_per_second=10.2931k/s
BM_EchoServer/1            634 ns          634 ns      1130860 bytes_per_second=1.50512M/s items_per_second=1.57823M/s
BM_EchoServer/8            614 ns          614 ns      1136372 bytes_per_second=12.4286M/s items_per_second=1.62904M/s
BM_EchoServer/128          644 ns          644 ns      1073464 bytes_per_second=189.618M/s items_per_second=1.55335M/s
BM_EchoServer/512          734 ns          734 ns       949487 bytes_per_second=665.181M/s items_per_second=1.36229M/s
BM_EchoServer/1024         836 ns          836 ns       838010 bytes_per_second=1.14046G/s items_per_second=1.19586M/s
BM_EchoServer/2048        1939 ns         1939 ns       345067 bytes_per_second=1007.27M/s items_per_second=515.724k/s
BM_EchoServer/4096        3984 ns         3983 ns       176047 bytes_per_second=980.737M/s items_per_second=251.069k/s
BM_EchoServer/8192        7486 ns         7484 ns        95780 bytes_per_second=1043.85M/s items_per_second=133.613k/s
BM_EchoServer/65536      92360 ns        92346 ns         7821 bytes_per_second=676.805M/s items_per_second=10.8289k/s

No-Presubmit: True
Bug: webrtc:12614
Change-Id: Iff21035ee78b263ee0e4b0fe3d07eea24064b921
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215002
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33842}
2021-04-27 10:12:44 +00:00
Victor Boivie
5ec1d0b25c dcsctp: Add missing test
This was missing in the build file, and caught in post-review at:
https://webrtc-review.googlesource.com/c/src/+/213347

Bug: webrtc:12614
Change-Id: I1870c1e305913b2195df801487b99549b02b2558
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215065
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33824}
2021-04-25 15:18:48 +00:00
Victor Boivie
0b0afaa81a dcsctp: Add Chunk Validators
The SCTP RFCs aren't very strict in specifying when a chunk or parameter
is invalid, so most chunks and/or parameters must be accepted but they
may need some cleaning to avoid a lot of error handling deeper in the
chunk handling code.

Bug: webrtc:12614
Change-Id: I723f08cbdc26e1a1b78463b6137340e638089037
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214966
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33788}
2021-04-20 13:37:22 +00:00
Florent Castelli
1fded2f5ad dcsctp: Fix build dependencies
Adding fuzzers to the build made "gn gen --check" discover a lot
of dependency errors between various components of dcSCTP.

Bug: webrtc:12614
Change-Id: I0b2dd7321aec2624da417f413c727bd11b4743e5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215003
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Victor Boivie <boivie@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33705}
2021-04-13 10:14:00 +00:00
Victor Boivie
471fc8c329 dcsctp: Add SCTP packet
This represents the wire encoding/decoding of SCTP packets.

Bug: webrtc:12614
Change-Id: Id7a4e4654f29eea126ea3058333f5c625606446b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213349
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33650}
2021-04-08 09:25:44 +00:00
Victor Boivie
b87746b155 dcsctp: Add parameters, error causes and chunks
Quite a large commit, but mostly trivial. It adds all the (in dcSCTP)
supported parameters, error causes and chunks as an object model, with
serializers and deserializers. They are verified with packet captures
where available, that have been captured with Wireshark against a
reference implementation.

This _could_ be split in parameter/ as one commit, error_cause/ in the
following, and chunk/ as the third, but as each chunk/parameter is
completely isolated from the other, reviewing it should be linear with
the number of chunks/parameters and having them in more commits wouldn't
change that, taken all those three commits into account.

Bug: webrtc:12614
Change-Id: Ie83c9a22cae6e3a39e35ef26fd532837a6387a08
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213347
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33625}
2021-04-06 10:28:18 +00:00
Victor Boivie
5457ec05b4 dcsctp: Add data container
Represents data that is either received and extracted from a
DATA/I-DATA chunk, or data that is supposed to be sent, and
wrapped in a DATA/I-DATA chunk (depending on peer capabilities).

Bug: webrtc:12614
Change-Id: Iea831fa7ca939783a438f178740508e484920312
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213346
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33608}
2021-03-31 18:25:38 +00:00
Victor Boivie
fe6c819b31 dcsctp: Add CRC32C generator
Implemented from RFC4960 with test vectors from RFC3720.

Bug: webrtc:12614
Change-Id: If03a41d1ac4acecc3e5840c015878df271b14a1b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213344
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33606}
2021-03-31 15:02:02 +00:00
Victor Boivie
3dffa81541 dcsctp: Add TLV trait
Various entities in SCTP are padded data blocks, with a type and
length field at fixed offsets, all stored in a 4-byte header. This is
called the Type-Length-Value format, or TLV for short.

See e.g. https://tools.ietf.org/html/rfc4960#section-3.2 and
https://tools.ietf.org/html/rfc4960#section-3.2.1

This templated class, which is used as a trait[1], is configurable -
a struct passed in as template parameter.

[1] https://en.wikipedia.org/wiki/Trait_(computer_programming)

Bug: webrtc:12614
Change-Id: I52c2b5056931aba5fb23419406314136b5a4f650
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213180
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33602}
2021-03-31 12:52:38 +00:00
Victor Boivie
7d3c49a171 dcsctp: Add bounded byte reader and writer
Packets, chunks, parameters and error causes - the SCTP entities
that are sent on the wire - are buffers with fields that are stored
in big endian and that generally consist of a fixed header size, and
a variable sized part, that can e.g. be encoded sub-fields or
serialized strings.

The BoundedByteReader and BoundedByteWriter utilities make it easy
to read those fields with as much aid from the compiler as possible,
by having compile-time assertions that fields are not accessed
outside the buffer's span.

There are some byte reading functionality already in modules/rtp_rtcp,
but that module would be a bit unfortunate to depend on, and doesn't
have the compile time bounds checking that is the biggest feature of
this abstraction of an rtc::ArrayView.

Bug: webrtc:12614
Change-Id: I9fc641aff22221018dda9add4e2c44853c0f64f0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212967
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33597}
2021-03-31 08:27:37 +00:00