]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: encapsulate QCC tasklet wakeup
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 16 Oct 2024 15:56:15 +0000 (17:56 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 19 Nov 2024 15:16:48 +0000 (16:16 +0100)
QUIC MUX will be responsible to drive emission with pacing. This will be
implemented via setting TASK_F_USR1 before I/O tasklet wakeup. To
prepare this, encapsulate each I/O tasklet wakeup into a new function
qcc_wakeup().

This commit is purely refactoring prior to pacing implementation into
QUIC MUX.

include/haproxy/mux_quic.h
src/mux_quic.c
src/quic_conn.c

index 6e497c700a84c39fe1463eeb3a73291a082aec4c..bfdf4dd1caad4823ccd245750c6120c4a9233086 100644 (file)
@@ -124,6 +124,8 @@ static inline void qcs_wait_http_req(struct qcs *qcs)
 
 void qcc_show_quic(struct qcc *qcc);
 
+void qcc_wakeup(struct qcc *qcc);
+
 #endif /* USE_QUIC */
 
 #endif /* _HAPROXY_MUX_QUIC_H */
index 217c4c9aa8ec30616b40446f3f03c68dc67cd9a3..0db4f91779601e29b78ca7a6c828747c7448137f 100644 (file)
@@ -396,6 +396,11 @@ static void qcc_refresh_timeout(struct qcc *qcc)
        TRACE_LEAVE(QMUX_EV_QCS_NEW, qcc->conn);
 }
 
+void qcc_wakeup(struct qcc *qcc)
+{
+       tasklet_wakeup(qcc->wait_event.tasklet);
+}
+
 /* Mark a stream as open if it was idle. This can be used on every
  * successful emission/reception operation to update the stream state.
  */
@@ -721,7 +726,7 @@ void qcc_set_error(struct qcc *qcc, int err, int app)
         * is too tedious too not forget a wakeup outside of this function for
         * the moment.
         */
-       tasklet_wakeup(qcc->wait_event.tasklet);
+       qcc_wakeup(qcc);
 }
 
 /* Increment glitch counter for <qcc> connection by <inc> steps. If configured
@@ -1075,7 +1080,7 @@ static void qcs_consume(struct qcs *qcs, uint64_t bytes)
                frm->max_stream_data.max_stream_data = qcs->rx.msd;
 
                LIST_APPEND(&qcc->lfctl.frms, &frm->list);
-               tasklet_wakeup(qcc->wait_event.tasklet);
+               qcc_wakeup(qcc);
        }
 
  conn_fctl:
@@ -1093,7 +1098,7 @@ static void qcs_consume(struct qcs *qcs, uint64_t bytes)
                frm->max_data.max_data = qcc->lfctl.md;
 
                LIST_APPEND(&qcs->qcc->lfctl.frms, &frm->list);
-               tasklet_wakeup(qcs->qcc->wait_event.tasklet);
+               qcc_wakeup(qcc);
        }
 
        TRACE_LEAVE(QMUX_EV_QCS_RECV, qcc->conn, qcs);
@@ -1353,7 +1358,7 @@ void qcc_reset_stream(struct qcs *qcs, int err)
        }
 
        qcc_send_stream(qcs, 1, 0);
-       tasklet_wakeup(qcc->wait_event.tasklet);
+       qcc_wakeup(qcc);
 }
 
 /* Register <qcs> stream for emission of STREAM, STOP_SENDING or RESET_STREAM.
@@ -1401,7 +1406,7 @@ void qcc_abort_stream_read(struct qcs *qcs)
        qcs->flags |= (QC_SF_TO_STOP_SENDING|QC_SF_READ_ABORTED);
 
        qcc_send_stream(qcs, 1, 0);
-       tasklet_wakeup(qcc->wait_event.tasklet);
+       qcc_wakeup(qcc);
 
  end:
        TRACE_LEAVE(QMUX_EV_QCC_NEW, qcc->conn, qcs);
@@ -1434,7 +1439,7 @@ int qcc_install_app_ops(struct qcc *qcc, const struct qcc_app_ops *app_ops)
                        TRACE_ERROR("app ops finalize error", QMUX_EV_QCC_NEW, qcc->conn);
                        goto err;
                }
-               tasklet_wakeup(qcc->wait_event.tasklet);
+               qcc_wakeup(qcc);
        }
 
        TRACE_LEAVE(QMUX_EV_QCC_NEW, qcc->conn);
@@ -1613,7 +1618,7 @@ int qcc_recv_max_data(struct qcc *qcc, uint64_t max)
                TRACE_DATA("increase remote max-data", QMUX_EV_QCC_RECV, qcc->conn);
 
                if (unblock_real)
-                       tasklet_wakeup(qcc->wait_event.tasklet);
+                       qcc_wakeup(qcc);
 
                if (unblock_soft)
                        qcc_notify_fctl(qcc);
@@ -1659,7 +1664,7 @@ int qcc_recv_max_stream_data(struct qcc *qcc, uint64_t id, uint64_t max)
                        TRACE_DATA("increase remote max-stream-data", QMUX_EV_QCC_RECV|QMUX_EV_QCS_RECV, qcc->conn, qcs);
                        if (unblock_real) {
                                /* TODO optim: only wakeup IO-CB if stream has data to sent. */
-                               tasklet_wakeup(qcc->wait_event.tasklet);
+                               qcc_wakeup(qcc);
                        }
 
                        if (unblock_soft) {
@@ -1909,7 +1914,7 @@ static int qcc_release_remote_stream(struct qcc *qcc, uint64_t id)
                        frm->max_streams_bidi.max_streams = qcc->lfctl.ms_bidi +
                                                            qcc->lfctl.cl_bidi_r;
                        LIST_APPEND(&qcc->lfctl.frms, &frm->list);
-                       tasklet_wakeup(qcc->wait_event.tasklet);
+                       qcc_wakeup(qcc);
 
                        qcc->lfctl.ms_bidi += qcc->lfctl.cl_bidi_r;
                        qcc->lfctl.cl_bidi_r = 0;
@@ -2416,7 +2421,7 @@ static int qcc_io_send(struct qcc *qcc)
                }
 
                if (!qfctl_rblocked(&qcc->tx.fc))
-                       tasklet_wakeup(qcc->wait_event.tasklet);
+                       qcc_wakeup(qcc);
        }
 
  out:
@@ -2959,7 +2964,7 @@ static int qmux_init(struct connection *conn, struct proxy *prx,
                LIST_APPEND(&mux_stopping_data[tid].list, &conn->stopping_list);
 
        /* init read cycle */
-       tasklet_wakeup(qcc->wait_event.tasklet);
+       qcc_wakeup(qcc);
 
        TRACE_LEAVE(QMUX_EV_QCC_NEW, conn);
        return 0;
@@ -3105,7 +3110,7 @@ static size_t qmux_strm_rcv_buf(struct stconn *sc, struct buffer *buf,
 
                qcs->flags &= ~QC_SF_DEM_FULL;
                if (!(qcc->flags & QC_CF_ERRL))
-                       tasklet_wakeup(qcc->wait_event.tasklet);
+                       qcc_wakeup(qcc);
        }
 
        TRACE_LEAVE(QMUX_EV_STRM_RECV, qcc->conn, qcs);
@@ -3169,7 +3174,7 @@ static size_t qmux_strm_snd_buf(struct stconn *sc, struct buffer *buf,
                if (data || fin)
                        qcc_send_stream(qcs, 0, data);
                if (!(qcs->qcc->wait_event.events & SUB_RETRY_SEND))
-                       tasklet_wakeup(qcs->qcc->wait_event.tasklet);
+                       qcc_wakeup(qcs->qcc);
        }
 
  end:
@@ -3290,7 +3295,7 @@ static size_t qmux_strm_done_ff(struct stconn *sc)
        if (data || qcs->flags & QC_SF_FIN_STREAM)
                qcc_send_stream(qcs, 0, data);
        if (!(qcs->qcc->wait_event.events & SUB_RETRY_SEND))
-               tasklet_wakeup(qcc->wait_event.tasklet);
+               qcc_wakeup(qcc);
 
   end:
        TRACE_LEAVE(QMUX_EV_STRM_SEND, qcs->qcc->conn, qcs);
@@ -3388,7 +3393,7 @@ static void qmux_strm_shut(struct stconn *sc, unsigned int mode, struct se_abort
                        qcc_reset_stream(qcs, 0);
                }
 
-               tasklet_wakeup(qcc->wait_event.tasklet);
+               qcc_wakeup(qcc);
        }
 
  out:
index afb9b26a212fe940f8ec31e30b1a6ab6ffd50c0a..dd2df5307d09222f598c311a84c9fa2859c093e3 100644 (file)
@@ -1807,7 +1807,7 @@ void qc_notify_err(struct quic_conn *qc)
                 * is made between MUX and quic-conn layer, wake up could be
                 * conducted only with qc.subs.
                 */
-               tasklet_wakeup(qc->qcc->wait_event.tasklet);
+               qcc_wakeup(qc->qcc);
        }
 
        TRACE_LEAVE(QUIC_EV_CONN_CLOSE, qc);