From e2921ffad103cd0cf9a204f56380ce6138fe2c40 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 14 Feb 2024 15:15:09 +0100 Subject: [PATCH] MINOR: muxes: Announce support for zero-copy forwarding on consumer side 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 | 4 ++++ src/mux_h2.c | 6 ++++++ src/mux_pt.c | 2 +- src/mux_quic.c | 3 +++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/mux_h1.c b/src/mux_h1.c index 95e941290..a50c204fc 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -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) diff --git a/src/mux_h2.c b/src/mux_h2.c index 94724a2f9..9ddd1b990 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -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++; diff --git a/src/mux_pt.c b/src/mux_pt.c index 7ee77d277..32800047b 100644 --- a/src/mux_pt.c +++ b/src/mux_pt.c @@ -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; diff --git a/src/mux_quic.c b/src/mux_quic.c index 041a6853b..e4940e3c2 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -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;