]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: remove unneeded notification of txbuf room
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 27 Sep 2024 13:31:21 +0000 (15:31 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 1 Oct 2024 14:19:25 +0000 (16:19 +0200)
When a stream buffer is freed, qc_stream_desc notify MUX. This is useful
if MUX is waiting for Tx buffer allocation.

Remove this notification in qc_stream_desc(). This is because the
function is called when all stream data have been acknowledged and thus
notified. This function can also be called with some data
unacknowledged, but in this case this is only true just before
connection closure. As such, it is useful to notify the MUX in this
condition.

src/quic_stream.c

index 7181e003461eec8cc0add1ae6daff1e10a47425d..91f657d4766f674fd4194b7775eb455eb409b00d 100644 (file)
@@ -209,36 +209,32 @@ void qc_stream_desc_free(struct qc_stream_desc *stream, int closing)
        struct quic_conn *qc = stream->qc;
        struct eb64_node *frm_node;
        unsigned int free_count = 0;
-       uint64_t free_size = 0;
 
        /* This function only deals with released streams. */
        BUG_ON(!(stream->flags & QC_SD_FL_RELEASE));
 
        /* free remaining stream buffers */
        list_for_each_entry_safe(buf, buf_back, &stream->buf_list, list) {
-               if (!(b_data(&buf->buf)) || closing) {
-                       free_size += b_size(&buf->buf);
-                       if (buf->sbuf)
-                               pool_free(pool_head_sbuf, buf->buf.area);
-                       else
-                               b_free(&buf->buf);
-                       LIST_DELETE(&buf->list);
-                       pool_free(pool_head_quic_stream_buf, buf);
-                       ++free_count;
-               }
-       }
 
-       if (free_count) {
-               offer_buffers(NULL, free_count);
+               /* qc_stream_desc_free() can only be used after all data is
+                * acknowledged or on connection shutdown. In the contrary
+                * case, MUX must be notified about room available.
+                */
+               BUG_ON(b_data(&buf->buf) && !closing);
 
-               if (qc->mux_state == QC_MUX_READY) {
-                       if (!(stream->flags & QC_SD_FL_OOB_BUF)) {
-                               /* notify MUX about available buffers. */
-                               qcc_notify_buf(qc->qcc, free_size);
-                       }
-               }
+               if (buf->sbuf)
+                       pool_free(pool_head_sbuf, buf->buf.area);
+               else
+                       b_free(&buf->buf);
+
+               LIST_DELETE(&buf->list);
+               pool_free(pool_head_quic_stream_buf, buf);
+               ++free_count;
        }
 
+       if (free_count)
+               offer_buffers(NULL, free_count);
+
        /* qc_stream_desc might be freed before having received all its ACKs.
         * This is the case if some frames were retransmitted.
         */