CLEANUP: quic: wrong use of eb*entry() macro

This wrong use has no consequence because the ->node member fields of
eb*node structs are the first.
This commit is contained in:
Frédéric Lécaille 2022-05-10 15:15:24 +02:00
parent 36b28ed012
commit a54e49d0b1
4 changed files with 26 additions and 26 deletions

View File

@ -137,7 +137,7 @@ static inline void free_quic_conn_cids(struct quic_conn *conn)
while (node) { while (node) {
struct quic_connection_id *cid; struct quic_connection_id *cid;
cid = eb64_entry(&node->node, struct quic_connection_id, seq_num); cid = eb64_entry(node, struct quic_connection_id, seq_num);
/* remove the CID from the receiver tree */ /* remove the CID from the receiver tree */
ebmb_delete(&cid->node); ebmb_delete(&cid->node);
@ -968,7 +968,7 @@ static inline int64_t quic_pktns_get_largest_acked_pn(struct quic_pktns *pktns)
if (!ar) if (!ar)
return -1; return -1;
return eb64_entry(&ar->node, struct quic_arng_node, first)->last; return eb64_entry(ar, struct quic_arng_node, first)->last;
} }
/* Increment the reference counter of <pkt> */ /* Increment the reference counter of <pkt> */
@ -995,7 +995,7 @@ static inline void quic_pktns_tx_pkts_release(struct quic_pktns *pktns)
struct quic_tx_packet *pkt; struct quic_tx_packet *pkt;
struct quic_frame *frm, *frmbak; struct quic_frame *frm, *frmbak;
pkt = eb64_entry(&node->node, struct quic_tx_packet, pn_node); pkt = eb64_entry(node, struct quic_tx_packet, pn_node);
node = eb64_next(node); node = eb64_next(node);
list_for_each_entry_safe(frm, frmbak, &pkt->frms, list) { list_for_each_entry_safe(frm, frmbak, &pkt->frms, list) {
LIST_DELETE(&frm->list); LIST_DELETE(&frm->list);
@ -1171,7 +1171,7 @@ static inline void qc_el_rx_pkts_del(struct quic_enc_level *qel)
node = eb64_first(&qel->rx.pkts); node = eb64_first(&qel->rx.pkts);
while (node) { while (node) {
struct quic_rx_packet *pkt = struct quic_rx_packet *pkt =
eb64_entry(&node->node, struct quic_rx_packet, pn_node); eb64_entry(node, struct quic_rx_packet, pn_node);
node = eb64_next(node); node = eb64_next(node);
eb64_delete(&pkt->pn_node); eb64_delete(&pkt->pn_node);
@ -1189,7 +1189,7 @@ static inline void qc_list_qel_rx_pkts(struct quic_enc_level *qel)
while (node) { while (node) {
struct quic_rx_packet *pkt; struct quic_rx_packet *pkt;
pkt = eb64_entry(&node->node, struct quic_rx_packet, pn_node); pkt = eb64_entry(node, struct quic_rx_packet, pn_node);
fprintf(stderr, "pkt@%p type=%d pn=%llu\n", fprintf(stderr, "pkt@%p type=%d pn=%llu\n",
pkt, pkt->type, (ull)pkt->pn_node.key); pkt, pkt->type, (ull)pkt->pn_node.key);
node = eb64_next(node); node = eb64_next(node);

View File

@ -278,7 +278,7 @@ static int quic_build_ack_frame(unsigned char **buf, const unsigned char *end,
struct quic_arng_node *ar_node, *prev_ar_node; struct quic_arng_node *ar_node, *prev_ar_node;
ar = eb64_last(&tx_ack->arngs->root); ar = eb64_last(&tx_ack->arngs->root);
ar_node = eb64_entry(&ar->node, struct quic_arng_node, first); ar_node = eb64_entry(ar, struct quic_arng_node, first);
TRACE_PROTO("ack range", QUIC_EV_CONN_PRSAFRM, TRACE_PROTO("ack range", QUIC_EV_CONN_PRSAFRM,
qc,, &ar_node->last, &ar_node->first.key); qc,, &ar_node->last, &ar_node->first.key);
if (!quic_enc_int(buf, end, ar_node->last) || if (!quic_enc_int(buf, end, ar_node->last) ||
@ -288,7 +288,7 @@ static int quic_build_ack_frame(unsigned char **buf, const unsigned char *end,
return 0; return 0;
while ((prev_ar = eb64_prev(ar))) { while ((prev_ar = eb64_prev(ar))) {
prev_ar_node = eb64_entry(&prev_ar->node, struct quic_arng_node, first); prev_ar_node = eb64_entry(prev_ar, struct quic_arng_node, first);
TRACE_PROTO("ack range", QUIC_EV_CONN_PRSAFRM, qc,, TRACE_PROTO("ack range", QUIC_EV_CONN_PRSAFRM, qc,,
&prev_ar_node->last, &prev_ar_node->first.key); &prev_ar_node->last, &prev_ar_node->first.key);
if (!quic_enc_int(buf, end, ar_node->first.key - prev_ar_node->last - 2) || if (!quic_enc_int(buf, end, ar_node->first.key - prev_ar_node->last - 2) ||
@ -296,7 +296,7 @@ static int quic_build_ack_frame(unsigned char **buf, const unsigned char *end,
return 0; return 0;
ar = prev_ar; ar = prev_ar;
ar_node = eb64_entry(&ar->node, struct quic_arng_node, first); ar_node = eb64_entry(ar, struct quic_arng_node, first);
} }
return 1; return 1;

View File

@ -180,7 +180,7 @@ void qc_stream_desc_free(struct qc_stream_desc *stream)
struct quic_stream *strm; struct quic_stream *strm;
struct quic_frame *frm; struct quic_frame *frm;
strm = eb64_entry(&frm_node->node, struct quic_stream, offset); strm = eb64_entry(frm_node, struct quic_stream, offset);
frm_node = eb64_next(frm_node); frm_node = eb64_next(frm_node);
eb64_delete(&strm->offset); eb64_delete(&strm->offset);

View File

@ -1502,7 +1502,7 @@ static int quic_stream_try_to_consume(struct quic_conn *qc,
struct quic_frame *frm; struct quic_frame *frm;
size_t offset, len; size_t offset, len;
strm = eb64_entry(&frm_node->node, struct quic_stream, offset); strm = eb64_entry(frm_node, struct quic_stream, offset);
offset = strm->offset.key; offset = strm->offset.key;
len = strm->len; len = strm->len;
@ -1635,7 +1635,7 @@ static inline struct eb64_node *qc_ackrng_pkts(struct quic_conn *qc,
while (node && node->key >= smallest) { while (node && node->key >= smallest) {
struct quic_frame *frm, *frmbak; struct quic_frame *frm, *frmbak;
pkt = eb64_entry(&node->node, struct quic_tx_packet, pn_node); pkt = eb64_entry(node, struct quic_tx_packet, pn_node);
*pkt_flags |= pkt->flags; *pkt_flags |= pkt->flags;
LIST_INSERT(newly_acked_pkts, &pkt->list); LIST_INSERT(newly_acked_pkts, &pkt->list);
TRACE_PROTO("Removing packet #", QUIC_EV_CONN_PRSAFRM, qc, NULL, &pkt->pn_node.key); TRACE_PROTO("Removing packet #", QUIC_EV_CONN_PRSAFRM, qc, NULL, &pkt->pn_node.key);
@ -1784,7 +1784,7 @@ static void qc_treat_ack_of_ack(struct quic_pktns *pktns,
struct quic_arng_node *ar_node; struct quic_arng_node *ar_node;
next_ar = eb64_next(ar); next_ar = eb64_next(ar);
ar_node = eb64_entry(&ar->node, struct quic_arng_node, first); ar_node = eb64_entry(ar, struct quic_arng_node, first);
if ((int64_t)ar_node->first.key > largest_acked_pn) if ((int64_t)ar_node->first.key > largest_acked_pn)
break; break;
@ -1960,7 +1960,7 @@ static inline int qc_parse_ack_frm(struct quic_conn *qc,
QUIC_EV_CONN_PRSAFRM, qc); QUIC_EV_CONN_PRSAFRM, qc);
} }
else { else {
time_sent = eb64_entry(&largest_node->node, time_sent = eb64_entry(largest_node,
struct quic_tx_packet, pn_node)->time_sent; struct quic_tx_packet, pn_node)->time_sent;
} }
} }
@ -2250,7 +2250,7 @@ static int qc_handle_bidi_strm_frm(struct quic_rx_packet *pkt,
*/ */
frm_node = eb64_first(&qcs->rx.frms); frm_node = eb64_first(&qcs->rx.frms);
while (frm_node) { while (frm_node) {
frm = eb64_entry(&frm_node->node, frm = eb64_entry(frm_node,
struct quic_rx_strm_frm, offset_node); struct quic_rx_strm_frm, offset_node);
ret = qcc_recv(qc->qcc, qcs->id, frm->len, ret = qcc_recv(qc->qcc, qcs->id, frm->len,
@ -2535,7 +2535,7 @@ static void qc_prep_hdshk_fast_retrans(struct quic_conn *qc,
node = eb64_first(pkts); node = eb64_first(pkts);
/* Skip the empty packet (they have already been retransmitted) */ /* Skip the empty packet (they have already been retransmitted) */
while (node) { while (node) {
pkt = eb64_entry(&node->node, struct quic_tx_packet, pn_node); pkt = eb64_entry(node, struct quic_tx_packet, pn_node);
if (!LIST_ISEMPTY(&pkt->frms) && !(pkt->flags & QUIC_FL_TX_PACKET_COALESCED)) if (!LIST_ISEMPTY(&pkt->frms) && !(pkt->flags & QUIC_FL_TX_PACKET_COALESCED))
break; break;
node = eb64_next(node); node = eb64_next(node);
@ -3412,7 +3412,7 @@ static int quic_build_post_handshake_frames(struct quic_conn *qc)
struct quic_connection_id *cid; struct quic_connection_id *cid;
cid = eb64_entry(&node->node, struct quic_connection_id, seq_num); cid = eb64_entry(node, struct quic_connection_id, seq_num);
if (cid->seq_num.key >= max) if (cid->seq_num.key >= max)
break; break;
@ -3438,7 +3438,7 @@ void quic_free_arngs(struct quic_arngs *arngs)
while (n) { while (n) {
struct eb64_node *next; struct eb64_node *next;
ar = eb64_entry(&n->node, struct quic_arng_node, first); ar = eb64_entry(n, struct quic_arng_node, first);
next = eb64_next(n); next = eb64_next(n);
eb64_delete(n); eb64_delete(n);
pool_free(pool_head_quic_arng, ar); pool_free(pool_head_quic_arng, ar);
@ -3472,8 +3472,8 @@ static int quic_rm_last_ack_ranges(struct quic_arngs *arngs, size_t limit)
if (!prev) if (!prev)
return 0; return 0;
last_node = eb64_entry(&last->node, struct quic_arng_node, first); last_node = eb64_entry(last, struct quic_arng_node, first);
prev_node = eb64_entry(&prev->node, struct quic_arng_node, first); prev_node = eb64_entry(prev, struct quic_arng_node, first);
arngs->enc_sz -= quic_int_getsize(last_node->last - last_node->first.key); arngs->enc_sz -= quic_int_getsize(last_node->last - last_node->first.key);
arngs->enc_sz -= quic_int_getsize(sack_gap(prev_node, last_node)); arngs->enc_sz -= quic_int_getsize(sack_gap(prev_node, last_node));
arngs->enc_sz -= quic_decint_size_diff(arngs->sz); arngs->enc_sz -= quic_decint_size_diff(arngs->sz);
@ -3496,16 +3496,16 @@ static void quic_arngs_set_enc_sz(struct quic_arngs *arngs)
if (!node) if (!node)
return; return;
ar = eb64_entry(&node->node, struct quic_arng_node, first); ar = eb64_entry(node, struct quic_arng_node, first);
arngs->enc_sz = quic_int_getsize(ar->last) + arngs->enc_sz = quic_int_getsize(ar->last) +
quic_int_getsize(ar->last - ar->first.key) + quic_int_getsize(arngs->sz - 1); quic_int_getsize(ar->last - ar->first.key) + quic_int_getsize(arngs->sz - 1);
while ((next = eb64_prev(node))) { while ((next = eb64_prev(node))) {
ar_next = eb64_entry(&next->node, struct quic_arng_node, first); ar_next = eb64_entry(next, struct quic_arng_node, first);
arngs->enc_sz += quic_int_getsize(sack_gap(ar, ar_next)) + arngs->enc_sz += quic_int_getsize(sack_gap(ar, ar_next)) +
quic_int_getsize(ar_next->last - ar_next->first.key); quic_int_getsize(ar_next->last - ar_next->first.key);
node = next; node = next;
ar = eb64_entry(&node->node, struct quic_arng_node, first); ar = eb64_entry(node, struct quic_arng_node, first);
} }
} }
@ -3577,7 +3577,7 @@ int quic_update_ack_ranges_list(struct quic_arngs *arngs,
} }
else { else {
struct quic_arng_node *le_ar = struct quic_arng_node *le_ar =
eb64_entry(&le->node, struct quic_arng_node, first); eb64_entry(le, struct quic_arng_node, first);
/* Already existing range */ /* Already existing range */
if (le_ar->last >= ar->last) if (le_ar->last >= ar->last)
@ -3606,7 +3606,7 @@ int quic_update_ack_ranges_list(struct quic_arngs *arngs,
while ((next = eb64_next(new))) { while ((next = eb64_next(new))) {
next_node = next_node =
eb64_entry(&next->node, struct quic_arng_node, first); eb64_entry(next, struct quic_arng_node, first);
if (new_node->last + 1 < next_node->first.key) if (new_node->last + 1 < next_node->first.key)
break; break;
@ -3681,7 +3681,7 @@ static inline int qc_treat_rx_crypto_frms(struct quic_enc_level *el,
while (node) { while (node) {
struct quic_rx_crypto_frm *cf; struct quic_rx_crypto_frm *cf;
cf = eb64_entry(&node->node, struct quic_rx_crypto_frm, offset_node); cf = eb64_entry(node, struct quic_rx_crypto_frm, offset_node);
if (cf->offset_node.key != el->rx.crypto.offset) if (cf->offset_node.key != el->rx.crypto.offset)
break; break;
@ -3725,7 +3725,7 @@ int qc_treat_rx_pkts(struct quic_enc_level *cur_el, struct quic_enc_level *next_
while (node) { while (node) {
struct quic_rx_packet *pkt; struct quic_rx_packet *pkt;
pkt = eb64_entry(&node->node, struct quic_rx_packet, pn_node); pkt = eb64_entry(node, struct quic_rx_packet, pn_node);
TRACE_PROTO("new packet", QUIC_EV_CONN_ELRXPKTS, TRACE_PROTO("new packet", QUIC_EV_CONN_ELRXPKTS,
ctx->qc, pkt, NULL, ctx->ssl); ctx->qc, pkt, NULL, ctx->ssl);
if (!qc_pkt_decrypt(pkt, qel)) { if (!qc_pkt_decrypt(pkt, qel)) {