From: Amaury Denoyelle Date: Mon, 5 Aug 2024 16:52:27 +0000 (+0200) Subject: MINOR: quic: convert qc_stream_desc release field to flags X-Git-Tag: v3.0.5~4 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=cbdf1ecb1951d29d97d70b6b9daa0278fcedd261;p=haproxy-3.0.git MINOR: quic: convert qc_stream_desc release field to flags qc_stream_desc had a field used as a boolean. Convert it with a new field and QC_SD_FL_RELEASE value as equivalent. The purpose of this patch is to be able to extend qc_stream_desc by adding newer flags values. This patch is required for the following patch BUG/MEDIUM: quic: handle retransmit for standalone FIN STREAM As such, it must be backported prior to it. (cherry picked from commit bb9ac256a1e5468535b8242dc762e7bb0d9a8bf3) Signed-off-by: Christopher Faulet --- diff --git a/include/haproxy/quic_stream-t.h b/include/haproxy/quic_stream-t.h index e10ca6d..ec3f431 100644 --- a/include/haproxy/quic_stream-t.h +++ b/include/haproxy/quic_stream-t.h @@ -19,6 +19,8 @@ struct qc_stream_buf { struct list list; /* element for qc_stream_desc list */ }; +#define QC_SD_FL_RELEASE 0x00000001 /* set when MUX has finished to use this stream */ + /* QUIC STREAM descriptor. * * This structure is the low-level counterpart of the QUIC STREAM at the MUX @@ -39,7 +41,7 @@ struct qc_stream_desc { uint64_t ack_offset; /* last acknowledged offset */ struct eb_root acked_frms; /* ACK frames tree for non-contiguous ACK ranges */ - int release; /* set to 1 when the MUX has finished to use this stream */ + int flags; /* QC_SD_FL_* values */ void *ctx; /* MUX specific context */ }; diff --git a/src/quic_conn.c b/src/quic_conn.c index de7b9ba..1244f03 100644 --- a/src/quic_conn.c +++ b/src/quic_conn.c @@ -1452,7 +1452,7 @@ void quic_conn_release(struct quic_conn *qc) /* all streams attached to the quic-conn are released, so * qc_stream_desc_free will liberate the stream instance. */ - BUG_ON(!stream->release); + BUG_ON(!(stream->flags & QC_SD_FL_RELEASE)); qc_stream_desc_free(stream, 1); } diff --git a/src/quic_stream.c b/src/quic_stream.c index e153660..da071df 100644 --- a/src/quic_stream.c +++ b/src/quic_stream.c @@ -78,7 +78,7 @@ struct qc_stream_desc *qc_stream_desc_new(uint64_t id, enum qcs_type type, void stream->acked_frms = EB_ROOT; stream->ack_offset = 0; - stream->release = 0; + stream->flags = 0; stream->ctx = ctx; return stream; @@ -99,9 +99,9 @@ void qc_stream_desc_release(struct qc_stream_desc *stream, return; /* A stream can be released only one time. */ - BUG_ON(stream->release); + BUG_ON(stream->flags & QC_SD_FL_RELEASE); - stream->release = 1; + stream->flags |= QC_SD_FL_RELEASE; stream->ctx = NULL; if (stream->buf) { @@ -166,7 +166,7 @@ int qc_stream_desc_ack(struct qc_stream_desc **stream, size_t offset, size_t len qc_stream_buf_free(s, &stream_buf); /* Free stream instance if already released and no buffers left. */ - if (s->release && LIST_ISEMPTY(&s->buf_list)) { + if ((s->flags & QC_SD_FL_RELEASE) && LIST_ISEMPTY(&s->buf_list)) { qc_stream_desc_free(s, 0); *stream = NULL; } @@ -187,7 +187,7 @@ void qc_stream_desc_free(struct qc_stream_desc *stream, int closing) unsigned int free_count = 0; /* This function only deals with released streams. */ - BUG_ON(!stream->release); + BUG_ON(!(stream->flags & QC_SD_FL_RELEASE)); /* free remaining stream buffers */ list_for_each_entry_safe(buf, buf_back, &stream->buf_list, list) {