From b49d9de0e66a5fe7570652186e3bb8c4a4d9f556 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Tue, 13 Jun 2023 13:08:00 +0100 Subject: [PATCH] The CC wake up deadline is now if we have TX allowance If we have TX allowance then there is no need to wait if we have something to send - the wake up deadline is immediate. Reviewed-by: Tomas Mraz Reviewed-by: Hugo Landau Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/21204) --- ssl/quic/cc_newreno.c | 15 ++++++++++----- test/quic_cc_test.c | 7 ++----- test/recipes/75-test_quicapi_data/ssltraceref.txt | 12 ++---------- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/ssl/quic/cc_newreno.c b/ssl/quic/cc_newreno.c index 850ff9899a8..de4c10c6a29 100644 --- a/ssl/quic/cc_newreno.c +++ b/ssl/quic/cc_newreno.c @@ -296,11 +296,16 @@ static uint64_t newreno_get_tx_allowance(OSSL_CC_DATA *cc) static OSSL_TIME newreno_get_wakeup_deadline(OSSL_CC_DATA *cc) { - /* - * The NewReno congestion controller does not vary its state in time, only - * in response to stimulus. - */ - return ossl_time_infinite(); + if (newreno_get_tx_allowance(cc) > 0) { + /* We have TX allowance now so wakeup immediately */ + return ossl_time_zero(); + } else { + /* + * The NewReno congestion controller does not vary its state in time, + * only in response to stimulus. + */ + return ossl_time_infinite(); + } } static int newreno_on_data_sent(OSSL_CC_DATA *cc, uint64_t num_bytes) diff --git a/test/quic_cc_test.c b/test/quic_cc_test.c index 8d75a642c84..a6b45e3ed6d 100644 --- a/test/quic_cc_test.c +++ b/test/quic_cc_test.c @@ -515,11 +515,8 @@ static int test_sanity(void) if (!TEST_uint64_t_ge(allowance = ccm->get_tx_allowance(cc), 1472)) goto err; - /* - * No wakeups should be scheduled currently as we don't currently implement - * pacing. - */ - if (!TEST_true(ossl_time_is_infinite(ccm->get_wakeup_deadline(cc)))) + /* There is TX allowance so wakeup should be immediate */ + if (!TEST_true(ossl_time_is_zero(ccm->get_wakeup_deadline(cc)))) goto err; /* No bytes should currently be in flight. */ diff --git a/test/recipes/75-test_quicapi_data/ssltraceref.txt b/test/recipes/75-test_quicapi_data/ssltraceref.txt index 095a945f6ea..e1510ccd87a 100644 --- a/test/recipes/75-test_quicapi_data/ssltraceref.txt +++ b/test/recipes/75-test_quicapi_data/ssltraceref.txt @@ -234,7 +234,7 @@ YeeuLO02zToHhnQ6KbPXOrQAqcL1kngO4g+j/ru+4AZThFkdkGnltvk= No extensions Received Datagram - Length: 256 + Length: 234 Received Packet Packet Type: Handshake Version: 0x00000001 @@ -267,8 +267,6 @@ Header: Finished, Length=32 verify_data (len=32): ???????????????????????????????????????????????????????????????? - -Received Frame: Ping Sent Frame: Ack (without ECN) Largest acked: 1 Ack delay (raw) 0 @@ -284,11 +282,5 @@ Sent Packet Source Conn Id: Payload length: 60 Packet Number: 0x00000000 -Sent Frame: Ack (without ECN) - Largest acked: 0 - Ack delay (raw) 0 - Ack range count: 0 - First ack range: 0 - Sent Datagram - Length: 115 + Length: 81 -- 2.47.2