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 15:39:46 +0000 (16:39 +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.

(cherry picked from commit e2921ffad103cd0cf9a204f56380ce6138fe2c40)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>

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

index 81be253..c3c988c 100644 (file)
@@ -797,6 +797,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;
 
@@ -834,6 +836,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 b1500cb..44fc2a8 100644 (file)
@@ -1602,6 +1602,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
         */
@@ -1692,6 +1696,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 a4e4588..080c55b 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 67408e7..2cbca3e 100644 (file)
@@ -659,6 +659,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;