mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
MINOR: quic: Move some counters from [rt]x quic_conn anonymous struct
Move rx.bytes, tx.bytes and tx.prep_bytes quic_conn struct member to bytes anonymous struct (bytes.rx, bytes.tx and bytes.prep member respectively). They are moved before being defined into a bytes anonoymous struct common to a future struct to be defined. Consequently adapt the code.
This commit is contained in:
parent
a45f90dd4e
commit
f7ab5918d1
@ -510,18 +510,20 @@ struct quic_conn {
|
|||||||
struct connection *conn;
|
struct connection *conn;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
/* Number of sent bytes. */
|
|
||||||
uint64_t bytes;
|
|
||||||
/* Number of bytes for prepared packets */
|
/* Number of bytes for prepared packets */
|
||||||
uint64_t prep_bytes;
|
uint64_t prep;
|
||||||
|
/* Number of sent bytes. */
|
||||||
|
uint64_t tx;
|
||||||
|
/* Number of received bytes. */
|
||||||
|
uint64_t rx;
|
||||||
|
} bytes;
|
||||||
|
struct {
|
||||||
/* Transport parameters sent by the peer */
|
/* Transport parameters sent by the peer */
|
||||||
struct quic_transport_params params;
|
struct quic_transport_params params;
|
||||||
/* Send buffer used to write datagrams. */
|
/* Send buffer used to write datagrams. */
|
||||||
struct buffer buf;
|
struct buffer buf;
|
||||||
} tx;
|
} tx;
|
||||||
struct {
|
struct {
|
||||||
/* Number of received bytes. */
|
|
||||||
uint64_t bytes;
|
|
||||||
/* Transport parameters the peer will receive */
|
/* Transport parameters the peer will receive */
|
||||||
struct quic_transport_params params;
|
struct quic_transport_params params;
|
||||||
/* RX buffer */
|
/* RX buffer */
|
||||||
|
@ -474,7 +474,7 @@ static inline size_t quic_path_prep_data(struct quic_path *path)
|
|||||||
*/
|
*/
|
||||||
static inline size_t quic_may_send_bytes(struct quic_conn *qc)
|
static inline size_t quic_may_send_bytes(struct quic_conn *qc)
|
||||||
{
|
{
|
||||||
return 3 * qc->rx.bytes - qc->tx.prep_bytes;
|
return 3 * qc->bytes.rx - qc->bytes.prep;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CRYPTO data buffer handling functions. */
|
/* CRYPTO data buffer handling functions. */
|
||||||
|
@ -149,7 +149,7 @@ int quic_peer_validated_addr(struct quic_conn *qc)
|
|||||||
qc->state >= QUIC_HS_ST_COMPLETE)
|
qc->state >= QUIC_HS_ST_COMPLETE)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
BUG_ON(qc->tx.prep_bytes > 3 * qc->rx.bytes);
|
BUG_ON(qc->bytes.prep > 3 * qc->bytes.rx);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1133,11 +1133,11 @@ struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
|
|||||||
TLS_EXTENSION_QUIC_TRANSPORT_PARAMETERS_DRAFT:
|
TLS_EXTENSION_QUIC_TRANSPORT_PARAMETERS_DRAFT:
|
||||||
TLS_EXTENSION_QUIC_TRANSPORT_PARAMETERS;
|
TLS_EXTENSION_QUIC_TRANSPORT_PARAMETERS;
|
||||||
/* TX part. */
|
/* TX part. */
|
||||||
qc->tx.bytes = qc->tx.prep_bytes = 0;
|
qc->bytes.tx = qc->bytes.prep = 0;
|
||||||
memset(&qc->tx.params, 0, sizeof(qc->tx.params));
|
memset(&qc->tx.params, 0, sizeof(qc->tx.params));
|
||||||
qc->tx.buf = BUF_NULL;
|
qc->tx.buf = BUF_NULL;
|
||||||
/* RX part. */
|
/* RX part. */
|
||||||
qc->rx.bytes = 0;
|
qc->bytes.rx = 0;
|
||||||
memset(&qc->rx.params, 0, sizeof(qc->rx.params));
|
memset(&qc->rx.params, 0, sizeof(qc->rx.params));
|
||||||
qc->rx.buf = b_make(qc->rx.buf.area, QUIC_CONN_RX_BUFSZ, 0, 0);
|
qc->rx.buf = b_make(qc->rx.buf.area, QUIC_CONN_RX_BUFSZ, 0, 0);
|
||||||
for (i = 0; i < QCS_MAX_TYPES; i++)
|
for (i = 0; i < QCS_MAX_TYPES; i++)
|
||||||
|
@ -2559,7 +2559,7 @@ int quic_dgram_parse(struct quic_dgram *dgram, struct quic_conn *from_qc,
|
|||||||
* if this datagram could be associated to a connection.
|
* if this datagram could be associated to a connection.
|
||||||
*/
|
*/
|
||||||
if (dgram->qc)
|
if (dgram->qc)
|
||||||
dgram->qc->rx.bytes += dgram->len;
|
dgram->qc->bytes.rx += dgram->len;
|
||||||
|
|
||||||
/* This must never happen. */
|
/* This must never happen. */
|
||||||
BUG_ON(pos > end);
|
BUG_ON(pos > end);
|
||||||
|
@ -500,9 +500,9 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
|
|||||||
(unsigned long)pkt->pn_node.key,
|
(unsigned long)pkt->pn_node.key,
|
||||||
quic_pktns_char(qc, pkt->pktns),
|
quic_pktns_char(qc, pkt->pktns),
|
||||||
(unsigned long long)pkt->in_flight_len);
|
(unsigned long long)pkt->in_flight_len);
|
||||||
chunk_appendf(&trace_buf, " rx.bytes=%llu tx.bytes=%llu",
|
chunk_appendf(&trace_buf, " bytes.rx=%llu bytes.tx=%llu",
|
||||||
(unsigned long long)qc->rx.bytes,
|
(unsigned long long)qc->bytes.rx,
|
||||||
(unsigned long long)qc->tx.bytes);
|
(unsigned long long)qc->bytes.tx);
|
||||||
list_for_each_entry(frm, &pkt->frms, list) {
|
list_for_each_entry(frm, &pkt->frms, list) {
|
||||||
chunk_appendf(&trace_buf, " frm@%p", frm);
|
chunk_appendf(&trace_buf, " frm@%p", frm);
|
||||||
chunk_frm_appendf(&trace_buf, frm);
|
chunk_frm_appendf(&trace_buf, frm);
|
||||||
|
@ -626,7 +626,7 @@ int qc_send_ppkts(struct buffer *buf, struct ssl_sock_ctx *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
b_del(buf, dglen + headlen);
|
b_del(buf, dglen + headlen);
|
||||||
qc->tx.bytes += tmpbuf.data;
|
qc->bytes.tx += tmpbuf.data;
|
||||||
time_sent = now_ms;
|
time_sent = now_ms;
|
||||||
|
|
||||||
for (pkt = first_pkt; pkt; pkt = next_pkt) {
|
for (pkt = first_pkt; pkt; pkt = next_pkt) {
|
||||||
@ -2477,8 +2477,8 @@ static struct quic_tx_packet *qc_build_pkt(unsigned char **pos,
|
|||||||
|
|
||||||
/* Consume a packet number */
|
/* Consume a packet number */
|
||||||
qel->pktns->tx.next_pn++;
|
qel->pktns->tx.next_pn++;
|
||||||
qc->tx.prep_bytes += pkt->len;
|
qc->bytes.prep += pkt->len;
|
||||||
if (qc->tx.prep_bytes >= 3 * qc->rx.bytes && !quic_peer_validated_addr(qc)) {
|
if (qc->bytes.prep >= 3 * qc->bytes.rx && !quic_peer_validated_addr(qc)) {
|
||||||
qc->flags |= QUIC_FL_CONN_ANTI_AMPLIFICATION_REACHED;
|
qc->flags |= QUIC_FL_CONN_ANTI_AMPLIFICATION_REACHED;
|
||||||
TRACE_PROTO("anti-amplification limit reached", QUIC_EV_CONN_TXPKT, qc);
|
TRACE_PROTO("anti-amplification limit reached", QUIC_EV_CONN_TXPKT, qc);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user