Skip to content

Commit

Permalink
Merge branch 'master' into kazuho/path-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuho committed Mar 15, 2024
2 parents c046b60 + 69b2275 commit d0888b4
Show file tree
Hide file tree
Showing 32 changed files with 1,641 additions and 253 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: setup
run: |
sudo sysctl -w vm.mmap_rnd_bits=28 # new default is 32 that causes libasan crashes
- name: Run with Docker
shell: 'script -q -e -c "bash -xe {0}"'
run: |
Expand Down
15 changes: 5 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ INCLUDE(CMakePushCheckState)
INCLUDE(CheckCSourceCompiles)
INCLUDE(deps/picotls/cmake/boringssl-adjust.cmake)
INCLUDE(deps/picotls/cmake/dtrace-utils.cmake)
INCLUDE(deps/picotls/cmake/fusion.cmake)

FIND_PACKAGE(OpenSSL REQUIRED)
BORINGSSL_ADJUST()
Expand All @@ -20,15 +21,7 @@ IF (WITH_DTRACE)
MESSAGE(STATUS "Enabling USDT support")
ENDIF ()

CMAKE_PUSH_CHECK_STATE()
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -mavx2 -maes -mpclmul -mvaes -mvpclmulqdq")
CHECK_C_SOURCE_COMPILES("int main(void) {}" CC_HAS_AESNI256)
CMAKE_POP_CHECK_STATE()
IF (CC_HAS_AESNI256)
SET(WITH_FUSION_DEFAULT "ON")
ELSE ()
SET(WITH_FUSION_DEFAULT "OFF")
ENDIF ()
CHECK_FUSION_PREREQUISITES()
OPTION(WITH_FUSION "whether or not to use the Fusion AES-GCM engine in the cli binary" ${WITH_FUSION_DEFAULT})

# CMake defaults to a Debug build, whereas quicly defaults to an optimized (Release) build
Expand Down Expand Up @@ -75,10 +68,12 @@ SET(QUICLY_LIBRARY_FILES
SET(UNITTEST_SOURCE_FILES
deps/picotest/picotest.c
t/frame.c
t/jumpstart.c
t/local_cid.c
t/loss.c
t/lossy.c
t/maxsender.c
t/pacer.c
t/ranges.c
t/rate.c
t/remote_cid.c
Expand Down Expand Up @@ -134,7 +129,7 @@ ADD_EXECUTABLE(udpfw t/udpfw.c)

ADD_CUSTOM_TARGET(check env BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} WITH_DTRACE=${WITH_DTRACE} prove --exec "sh -c" -v ${CMAKE_CURRENT_BINARY_DIR}/*.t t/*.t
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS cli test.t)
DEPENDS cli udpfw test.t)

ADD_CUSTOM_TARGET(format clang-format -i `git ls-files include lib src t | egrep '\\.[ch]$$'`)

Expand Down
2 changes: 1 addition & 1 deletion deps/picotest
2 changes: 1 addition & 1 deletion examples/echo.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ static int run_loop(int fd, quicly_conn_t *client)
tv.tv_sec = delta / 1000;
tv.tv_usec = (delta % 1000) * 1000;
} else {
tv.tv_sec = 1000;
tv.tv_sec = 0;
tv.tv_usec = 0;
}
FD_ZERO(&readfds);
Expand Down
79 changes: 76 additions & 3 deletions include/quicly.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ extern "C" {
#define QUICLY_PACKET_TYPE_RETRY (QUICLY_LONG_HEADER_BIT | QUICLY_QUIC_BIT | 0x30)
#define QUICLY_PACKET_TYPE_BITMASK 0xf0

#define QUICLY_PACKET_IS_LONG_HEADER(first_byte) (((first_byte)&QUICLY_LONG_HEADER_BIT) != 0)
#define QUICLY_PACKET_IS_LONG_HEADER(first_byte) (((first_byte) & QUICLY_LONG_HEADER_BIT) != 0)

/**
* Version 1.
Expand All @@ -74,7 +74,7 @@ extern "C" {
*/
#define QUICLY_PROTOCOL_VERSION_DRAFT27 0xff00001b

#define QUICLY_PACKET_IS_INITIAL(first_byte) (((first_byte)&0xf0) == 0xc0)
#define QUICLY_PACKET_IS_INITIAL(first_byte) (((first_byte) & 0xf0) == 0xc0)

#define QUICLY_STATELESS_RESET_PACKET_MIN_LEN 39

Expand Down Expand Up @@ -334,10 +334,32 @@ struct st_quicly_context_t {
* once path validation fails for the specified number of times, packets arriving on new tuples will be dropped
*/
uint64_t max_path_validation_failures;
/**
* Jumpstart CWND to be used when there is no previous information. If set to zero, slow start is used. Note jumpstart is
* possible only when the use_pacing flag is set.
*/
uint32_t default_jumpstart_cwnd_packets;
/**
* Maximum jumpstart CWND to be used for connections with previous delivery rate information (i.e., resuming connections). If
* set to zero, slow start is used.
*/
uint32_t max_jumpstart_cwnd_packets;
/**
* expand client hello so that it does not fit into one datagram
*/
unsigned expand_client_hello : 1;
/**
* whether to use ECN on the send side; ECN is always on on the receive side
*/
unsigned enable_ecn : 1;
/**
* if pacing should be used
*/
unsigned use_pacing : 1;
/**
* if CC should take app-limited into consideration
*/
unsigned respect_app_limited : 1;
/**
*
*/
Expand Down Expand Up @@ -462,6 +484,14 @@ struct st_quicly_conn_streamgroup_state_t {
* Total number of packets received out of order. \
*/ \
uint64_t received_out_of_order; \
/** \
* connection-wide counters for ECT(0), ECT(1), CE \
*/ \
uint64_t received_ecn_counts[3]; \
/** \
* connection-wide ack-received counters for ECT(0), ECT(1), CE \
*/ \
uint64_t acked_ecn_counts[3]; \
/** \
* Total number of packets sent on promoted paths. \
*/ \
Expand Down Expand Up @@ -522,6 +552,14 @@ struct st_quicly_conn_streamgroup_state_t {
* number of alternate paths that were closed due to Connection ID being unavailable \
*/ \
uint64_t closed_no_dcid; \
/** \
* number of paths that were ECN-capable \
*/ \
uint64_t ecn_validated; \
/** \
* number of paths that were deemed as ECN black holes \
*/ \
uint64_t ecn_failed; \
} num_paths; \
/** \
* Total number of each frame being sent / received. \
Expand All @@ -543,7 +581,33 @@ struct st_quicly_conn_streamgroup_state_t {
/** \
* Total number of events where `initial_handshake_sent` exceeds limit. \
*/ \
uint64_t num_initial_handshake_exceeded
uint64_t num_initial_handshake_exceeded; \
/** \
* jumpstart parameters and the CWND being adopted (see also quicly_cc_t::cwnd_exiting_jumpstart) \
*/ \
struct { \
uint64_t prev_rate; \
uint32_t prev_rtt; \
uint32_t new_rtt; \
uint32_t cwnd; \
} jumpstart; \
/** \
* some contents of the last token sent \
*/ \
struct { \
/** \
* when sent, relative to the creation time of the connection \
*/ \
int64_t at; \
/** \
* delivery rate \
*/ \
uint64_t rate; \
/** \
* rtt \
*/ \
uint32_t rtt; \
} token_sent

typedef struct st_quicly_stats_t {
/**
Expand Down Expand Up @@ -848,6 +912,10 @@ typedef struct st_quicly_decoded_packet_t {
uint64_t pn;
uint64_t key_phase;
} decrypted;
/**
* ECN bits
*/
uint8_t ecn : 2;
/**
*
*/
Expand All @@ -862,6 +930,7 @@ struct st_quicly_address_token_plaintext_t {
enum { QUICLY_ADDRESS_TOKEN_TYPE_RETRY, QUICLY_ADDRESS_TOKEN_TYPE_RESUMPTION } type;
uint64_t issued_at;
quicly_address_t local, remote;
unsigned address_mismatch : 1;
union {
struct {
quicly_cid_t original_dcid;
Expand Down Expand Up @@ -1065,6 +1134,10 @@ size_t quicly_send_retry(quicly_context_t *ctx, ptls_aead_context_t *token_encry
*/
int quicly_send(quicly_conn_t *conn, quicly_address_t *dest, quicly_address_t *src, struct iovec *datagrams, size_t *num_datagrams,
void *buf, size_t bufsize);
/**
* returns ECN bits to be set for the packets built by the last invocation of `quicly_send`
*/
uint8_t quicly_send_get_ecn_bits(quicly_conn_t *conn);
/**
*
*/
Expand Down
Loading

0 comments on commit d0888b4

Please sign in to comment.