]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: convert qc_stream_desc release field to flags
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 5 Aug 2024 16:52:27 +0000 (18:52 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 6 Aug 2024 16:00:17 +0000 (18:00 +0200)
qc_stream_desc had a field <release> used as a boolean. Convert it with
a new <flags> 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.

include/haproxy/quic_stream-t.h
src/quic_conn.c
src/quic_stream.c

index e10ca6da032ce9dba008dfe093664c9ff6723b98..ec3f431ba0bb6c91cdf33fa4f2292cb011b46b3b 100644 (file)
@@ -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 */
 };
index 3019c848d0b59df2cb19469a5a717960949c7ec7..6516696967d6c9fba113d57eead6fd83537a9701 100644 (file)
@@ -1401,7 +1401,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);
        }
 
index e153660db20d36f2edc97d3cbbddf20c451c0ca4..da071dfbf8a1bd3946cbd24e5064622517547b5c 100644 (file)
@@ -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) {