MINOR: quic: convert qc_stream_desc release field to flags

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.
This commit is contained in:
Amaury Denoyelle 2024-08-05 18:52:27 +02:00
parent 8f1fd96d17
commit bb9ac256a1
3 changed files with 9 additions and 7 deletions

View 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 */
};

View 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);
}

View 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) {