]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: muxes: Announce support for zero-copy forwarding on consumer side
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 14 Feb 2024 14:15:09 +0000 (15:15 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 14 Feb 2024 14:15:10 +0000 (15:15 +0100)
It is unused for now, but the muxes announce their support of the zero-copy
forwarding on consumer side. All muxes, except the fgci one, are supported
it.

src/mux_h1.c
src/mux_h2.c
src/mux_pt.c
src/mux_quic.c

index 95e9412901454ac938fe5617fa9c0b875f2a976f..a50c204fca985e11abe37c008aced37521d9ce3e 100644 (file)
@@ -830,6 +830,8 @@ static struct h1s *h1c_frt_stream_new(struct h1c *h1c, struct stconn *sc, struct
         * especially if headers were already forwarded. But it is not
         * mandatory.
         */
+       if (!(global.tune.no_zero_copy_fwd & NO_ZERO_COPY_FWD_H1_SND))
+               se_fl_set(h1s->sd, SE_FL_MAY_FASTFWD_CONS);
        se_expect_no_data(h1s->sd);
        h1s->sess = sess;
 
@@ -867,6 +869,8 @@ static struct h1s *h1c_bck_stream_new(struct h1c *h1c, struct stconn *sc, struct
        h1s->sd = sc->sedesc;
        h1s->sess = sess;
 
+       if (!(global.tune.no_zero_copy_fwd & NO_ZERO_COPY_FWD_H1_SND))
+               se_fl_set(h1s->sd, SE_FL_MAY_FASTFWD_CONS);
        h1c->state = H1_CS_RUNNING;
 
        if (h1c->px->options2 & PR_O2_RSPBUG_OK)
index 94724a2f9a0bd46a46f466073f5b9dfa56a3211b..9ddd1b990bc1a3c50440be03d47ff415ef6a8163 100644 (file)
@@ -1659,6 +1659,10 @@ static struct h2s *h2c_frt_stream_new(struct h2c *h2c, int id, struct buffer *in
        h2s->sd->se   = h2s;
        h2s->sd->conn = h2c->conn;
        se_fl_set(h2s->sd, SE_FL_T_MUX | SE_FL_ORPHAN | SE_FL_NOT_FIRST);
+
+       if (!(global.tune.no_zero_copy_fwd & NO_ZERO_COPY_FWD_H2_SND))
+               se_fl_set(h2s->sd, SE_FL_MAY_FASTFWD_CONS);
+
        /* The request is not finished, don't expect data from the opposite side
         * yet
         */
@@ -1749,6 +1753,8 @@ static struct h2s *h2c_bck_stream_new(struct h2c *h2c, struct stconn *sc, struct
        h2s->sess = sess;
        h2c->nb_sc++;
 
+       if (!(global.tune.no_zero_copy_fwd & NO_ZERO_COPY_FWD_H2_SND))
+               se_fl_set(h2s->sd, SE_FL_MAY_FASTFWD_CONS);
        /* on the backend we can afford to only count total streams upon success */
        h2c->stream_cnt++;
 
index 7ee77d277d9aba84df3cfc2d1a40450558e3b884..32800047b630c1cb712b16e27fa63db34ab25156 100644 (file)
@@ -325,7 +325,7 @@ static int mux_pt_init(struct connection *conn, struct proxy *prx, struct sessio
        conn->ctx = ctx;
        se_fl_set(ctx->sd, SE_FL_RCV_MORE);
        if (global.tune.options & GTUNE_USE_SPLICE)
-               se_fl_set(ctx->sd, SE_FL_MAY_FASTFWD_PROD);
+               se_fl_set(ctx->sd, SE_FL_MAY_FASTFWD_PROD|SE_FL_MAY_FASTFWD_CONS);
 
        TRACE_LEAVE(PT_EV_CONN_NEW, conn);
        return 0;
index 041a6853b4e6319f56da357864fd2126f2a02283..e4940e3c27be7f04aca6a7654525489a0b25b8fd 100644 (file)
@@ -675,6 +675,9 @@ struct stconn *qcs_attach_sc(struct qcs *qcs, struct buffer *buf, char fin)
        se_fl_set(qcs->sd, SE_FL_T_MUX | SE_FL_ORPHAN | SE_FL_NOT_FIRST);
        se_expect_no_data(qcs->sd);
 
+       if (!(global.tune.no_zero_copy_fwd & NO_ZERO_COPY_FWD_QUIC_SND))
+               se_fl_set(qcs->sd, SE_FL_MAY_FASTFWD_CONS);
+
        /* TODO duplicated from mux_h2 */
        sess->t_idle = ns_to_ms(now_ns - sess->accept_ts) - sess->t_handshake;