Skip to content

Commit 55d1e4a

Browse files
committed
MINOR: quic: Define ->get_info() control layer callback for QUIC
This low level callback may be called by several sample fetches for frontend connections like "fc_rtt", "fc_rttvar" etc. Define this callback for QUIC protocol as pointer to quic_get_info(). This latter supports these sample fetches: "fc_lost", "fc_reordering", "fc_rtt" and "fc_rttvar". Update the documentation consequently.
1 parent bb6a9b7 commit 55d1e4a

File tree

2 files changed

+41
-17
lines changed

2 files changed

+41
-17
lines changed

doc/configuration.txt

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22203,10 +22203,12 @@ fc_http_major : integer
2220322203
encoding and not on the version present in the request header.
2220422204

2220522205
fc_lost : integer
22206-
Returns the lost counter measured by the kernel for the client
22207-
connection. If the server connection is not established, if the connection is
22208-
not TCP or if the operating system does not support TCP_INFO, for example
22209-
Linux kernels before 2.4, the sample fetch fails.
22206+
If the connection is not TCP, nor QUIC, the sample fetch fails.
22207+
For QUIC, returns the number of lost QUIC packets by the client connection.
22208+
For TCP, returns the lost counter measured by the kernel for the client
22209+
connection. If the server connection is not established, or if the operating
22210+
system does not support TCP_INFO, for example Linux kernels before 2.4, the
22211+
sample fetch fails.
2221022212

2221122213
fc_nb_streams : integer
2221222214
Returns the number of streams opened on the frontend connection.
@@ -22247,10 +22249,12 @@ fc_rcvd_proxy : boolean
2224722249
header.
2224822250

2224922251
fc_reordering : integer
22250-
Returns the reordering counter measured by the kernel for the client
22251-
connection. If the server connection is not established, if the connection is
22252-
not TCP or if the operating system does not support TCP_INFO, for example
22253-
Linux kernels before 2.4, the sample fetch fails.
22252+
If the connection is not TCP, nor QUIC, the sample fetch fails.
22253+
For QUIC, return the number of QUIC reordered packets for the client connection.
22254+
For TCP, returns the reordering counter measured by the kernel for the client
22255+
connection. If the server connection is not established, or if the operating
22256+
system does not support TCP_INFO, for example Linux kernels before 2.4, the
22257+
sample fetch fails.
2225422258

2225522259
fc_retrans : integer
2225622260
Returns the retransmits counter measured by the kernel for the client
@@ -22259,20 +22263,22 @@ fc_retrans : integer
2225922263
Linux kernels before 2.4, the sample fetch fails.
2226022264

2226122265
fc_rtt(<unit>) : integer
22262-
Returns the Round Trip Time (RTT) measured by the kernel for the client
22266+
If the connection is not TCP, nor QUIC, the sample fetch fails.
22267+
For QUIC, returns Smoothed Round Trip Time for the client connection.
22268+
For TCP, returns the Round Trip Time (RTT) measured by the kernel for the client
2226322269
connection. <unit> is facultative, by default the unit is milliseconds. <unit>
2226422270
can be set to "ms" for milliseconds or "us" for microseconds. If the server
22265-
connection is not established, if the connection is not TCP or if the
22266-
operating system does not support TCP_INFO, for example Linux kernels before
22267-
2.4, the sample fetch fails.
22271+
connection is not established, or if the operating system does not support
22272+
TCP_INFO, for example Linux kernels before 2.4, the sample fetch fails.
2226822273

2226922274
fc_rttvar(<unit>) : integer
22270-
Returns the Round Trip Time (RTT) variance measured by the kernel for the
22271-
client connection. <unit> is facultative, by default the unit is milliseconds.
22275+
If the connection is not TCP, nor QUIC, the sample fetch fails.
22276+
For QUIC, returns Smoothed Round Trip Time variance for the client connection.
22277+
For TCP, returns the Round Trip Time (RTT) variance measured by the kernel for
22278+
the client connection. <unit> is facultative, by default the unit is milliseconds.
2227222279
<unit> can be set to "ms" for milliseconds or "us" for microseconds. If the
22273-
server connection is not established, if the connection is not TCP or if the
22274-
operating system does not support TCP_INFO, for example Linux kernels before
22275-
2.4, the sample fetch fails.
22280+
server connection is not established, or if the operating system does not
22281+
support TCP_INFO, for example Linux kernels before 2.4, the sample fetch fails.
2227622282

2227722283
fc_sacked : integer
2227822284
Returns the sacked counter measured by the kernel for the client connection.

src/proto_quic.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ static void quic_disable_listener(struct listener *listener);
6464
static int quic_bind_tid_prep(struct connection *conn, int new_tid);
6565
static void quic_bind_tid_commit(struct connection *conn);
6666
static void quic_bind_tid_reset(struct connection *conn);
67+
static int quic_get_info(struct connection *conn, long long int *info, int info_num);
6768

6869
/* Note: must not be declared <const> as its list will be overwritten */
6970
struct protocol proto_quic4 = {
@@ -85,6 +86,7 @@ struct protocol proto_quic4 = {
8586
.bind_tid_prep = quic_bind_tid_prep,
8687
.bind_tid_commit = quic_bind_tid_commit,
8788
.bind_tid_reset = quic_bind_tid_reset,
89+
.get_info = quic_get_info,
8890

8991
/* binding layer */
9092
.rx_suspend = udp_suspend_receiver,
@@ -131,6 +133,7 @@ struct protocol proto_quic6 = {
131133
.bind_tid_prep = quic_bind_tid_prep,
132134
.bind_tid_commit = quic_bind_tid_commit,
133135
.bind_tid_reset = quic_bind_tid_reset,
136+
.get_info = quic_get_info,
134137

135138
/* binding layer */
136139
.rx_suspend = udp_suspend_receiver,
@@ -694,6 +697,21 @@ static void quic_disable_listener(struct listener *l)
694697
fd_stop_recv(l->rx.fd);
695698
}
696699

700+
static int quic_get_info(struct connection *conn, long long int *info, int info_num)
701+
{
702+
struct quic_conn *qc = conn->handle.qc;
703+
704+
switch (info_num) {
705+
case 0: *info = qc->path->loss.srtt; break;
706+
case 1: *info = qc->path->loss.rtt_var; break;
707+
case 3: *info = qc->path->loss.nb_lost_pkt; break;
708+
case 7: *info = qc->path->loss.nb_reordered_pkt; break;
709+
default: return 0;
710+
}
711+
712+
return 1;
713+
}
714+
697715
/* change the connection's thread to <new_tid>. For frontend connections, the
698716
* target is a listener, and the caller is responsible for guaranteeing that
699717
* the listener assigned to the connection is bound to the requested thread.

0 commit comments

Comments
 (0)