MINOR: quic: define quic_cc_path MTU as constant

Future commits will implement GSO support to be able to emit multiple
datagrams in a single syscall invocation. This will be used every time
there is more data to sent than the UDP network MTU.

No change will be done for Tx buffer encoding, in particular when using
extra metadata datagram header. When GSO will be used, length field will
contain the total length of all datagrams to emit in a single GSO
syscall send. As such, QUIC send functions will detect that GSO is in
use if total length is greater than MTU.

This last assumption forces to ensure that MTU is constant. Indeed, in
case qc_send() is interrupted, Tx buffer will be left with prepared
datagrams. These datagrams will be emitted at the next qc_send()
invocation. If MTU would change during these two calls, it would be
impossible to know if GSO was used or not. To prevent this, mark <mtu>
field of quic_cc_path as constant.
This commit is contained in:
Amaury Denoyelle 2024-05-30 14:49:46 +02:00
parent 35470d5185
commit 96a34d79d9
2 changed files with 3 additions and 3 deletions

View File

@ -96,8 +96,8 @@ struct quic_cc_path {
/* Packet loss detection information. */
struct quic_loss loss;
/* MTU. */
size_t mtu;
/* MTU. Must be constant for GSO support. */
const size_t mtu;
/* Congestion window. */
uint64_t cwnd;
/* The current maximum congestion window value reached. */

View File

@ -84,7 +84,7 @@ static inline void quic_cc_path_init(struct quic_cc_path *path, int ipv4, unsign
max_dgram_sz = ipv4 ? QUIC_INITIAL_IPV4_MTU : QUIC_INITIAL_IPV6_MTU;
quic_loss_init(&path->loss);
path->mtu = max_dgram_sz;
*(size_t *)&path->mtu = max_dgram_sz;
path->cwnd = QUIC_MIN(10 * max_dgram_sz, QUIC_MAX(max_dgram_sz << 1, 14720U));
path->mcwnd = path->cwnd;
path->max_cwnd = max_cwnd;