From: Christopher Faulet Date: Thu, 3 Aug 2023 15:17:15 +0000 (+0200) Subject: MINOR: stconn: Temporarily remove kernel splicing support X-Git-Tag: v2.9-dev8~38 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=8b89fe3d8ff5483c8d6e787465308ddb9b1bdf70;p=haproxy-3.0.git MINOR: stconn: Temporarily remove kernel splicing support mux-to-mux fast-forwarding will be added. To avoid mix with the splicing and simplify the commits, the kernel splicing support is removed from the stconn. CF_KERN_SPLICING flag is removed and the support is no longer tested in process_stream(). In the stconn part, rcv_pipe() callback function is no longer called. Reg-tests scripts testing the kernel splicing are temporarly marked as broken. --- diff --git a/include/haproxy/channel-t.h b/include/haproxy/channel-t.h index 8629f5f..6972edb 100644 --- a/include/haproxy/channel-t.h +++ b/include/haproxy/channel-t.h @@ -67,9 +67,7 @@ #define CF_STREAMER_FAST 0x00020000 /* the consumer seems to eat the stream very fast */ #define CF_WROTE_DATA 0x00040000 /* some data were sent from this buffer */ -/* unused 0x00080000 - 0x00100000 */ -#define CF_KERN_SPLICING 0x00200000 /* kernel splicing desired for this channel */ -/* unused 0x00400000 */ +/* unused 0x00080000 - 0x00400000 */ #define CF_AUTO_CONNECT 0x00800000 /* consumer may attempt to establish a new connection */ #define CF_DONT_READ 0x01000000 /* disable reading for now */ @@ -98,10 +96,9 @@ static forceinline char *chn_show_flags(char *buf, size_t len, const char *delim _(CF_WRITE_TIMEOUT, _(CF_WAKE_WRITE, _(CF_AUTO_CLOSE, _(CF_STREAMER, _(CF_STREAMER_FAST, _(CF_WROTE_DATA, - _(CF_KERN_SPLICING, _(CF_AUTO_CONNECT, _(CF_DONT_READ, _(CF_WAKE_ONCE, _(CF_FLT_ANALYZE, - _(CF_ISRESP))))))))))))))); + _(CF_ISRESP)))))))))))))); /* epilogue */ _(~0U); return buf; diff --git a/reg-tests/http-messaging/http_splicing.vtc b/reg-tests/http-messaging/http_splicing.vtc index e86680b..930d76f 100644 --- a/reg-tests/http-messaging/http_splicing.vtc +++ b/reg-tests/http-messaging/http_splicing.vtc @@ -9,6 +9,7 @@ feature cmd "$HAPROXY_PROGRAM $HAPROXY_ARGS -cc 'enabled(SPLICE)'" feature ignore_unknown_macro #REGTEST_TYPE=slow +#REGTEST_TYPE=broken server s1 { rxreq diff --git a/reg-tests/http-messaging/http_splicing_chunk.vtc b/reg-tests/http-messaging/http_splicing_chunk.vtc index e2e9f32..f9dd495 100644 --- a/reg-tests/http-messaging/http_splicing_chunk.vtc +++ b/reg-tests/http-messaging/http_splicing_chunk.vtc @@ -9,6 +9,7 @@ feature cmd "$HAPROXY_PROGRAM $HAPROXY_ARGS -cc 'enabled(SPLICE)'" feature ignore_unknown_macro #REGTEST_TYPE=slow +#REGTEST_TYPE=broken server s1 { rxreq diff --git a/src/stconn.c b/src/stconn.c index f208678..8af16de 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -1258,64 +1258,6 @@ static int sc_conn_recv(struct stconn *sc) ic->flags &= ~(CF_STREAMER | CF_STREAMER_FAST); } - /* First, let's see if we may splice data across the channel without - * using a buffer. - */ - if (sc_ep_test(sc, SE_FL_MAY_FASTFWD) && - (sc_ep_have_ff_data(sc_opposite(sc)) || ic->to_forward >= MIN_SPLICE_FORWARD) && - ic->flags & CF_KERN_SPLICING) { - if (c_data(ic)) { - /* We're embarrassed, there are already data pending in - * the buffer and we don't want to have them at two - * locations at a time. Let's indicate we need some - * place and ask the consumer to hurry. - */ - flags |= CO_RFL_BUF_FLUSH; - goto abort_splice; - } - - if (unlikely(sc_opposite(sc)->sedesc->iobuf.pipe == NULL)) { - if (pipes_used >= global.maxpipes || !(sc_opposite(sc)->sedesc->iobuf.pipe = get_pipe())) { - ic->flags &= ~CF_KERN_SPLICING; - goto abort_splice; - } - } - - ret = conn->mux->rcv_pipe(sc, sc_opposite(sc)->sedesc->iobuf.pipe, ic->to_forward); - if (ret < 0) { - /* splice not supported on this end, let's disable it */ - ic->flags &= ~CF_KERN_SPLICING; - goto abort_splice; - } - - if (ret > 0) { - if (ic->to_forward != CHN_INFINITE_FORWARD) - ic->to_forward -= ret; - ic->total += ret; - cur_read += ret; - ic->flags |= CF_READ_EVENT; - } - - if (sc_ep_test(sc, SE_FL_EOS | SE_FL_ERROR)) - goto end_recv; - - if (conn->flags & CO_FL_WAIT_ROOM) { - /* the pipe is full or we have read enough data that it - * could soon be full. Let's stop before needing to poll. - */ - sc_need_room(sc, 0); - goto done_recv; - } - - /* splice not possible (anymore), let's go on on standard copy */ - } - - abort_splice: - if (sc_ep_have_ff_data(sc_opposite(sc)) && unlikely(!sc_ep_ff_data(sc_opposite(sc)))) { - put_pipe(sc_opposite(sc)->sedesc->iobuf.pipe); - sc_opposite(sc)->sedesc->iobuf.pipe = NULL; - } - if (sc_ep_have_ff_data(sc_opposite(sc)) && ic->to_forward && !(flags & CO_RFL_BUF_FLUSH) && sc_ep_test(sc, SE_FL_MAY_FASTFWD)) { /* don't break splicing by reading, but still call rcv_buf() @@ -1597,19 +1539,6 @@ static int sc_conn_send(struct stconn *sc) if (!conn->mux) return 0; - if (sc_ep_have_ff_data(sc) && conn->xprt->snd_pipe && conn->mux->snd_pipe) { - ret = conn->mux->snd_pipe(sc, sc->sedesc->iobuf.pipe); - if (ret > 0) - did_send = 1; - - if (!sc_ep_ff_data(sc)) { - put_pipe(sc->sedesc->iobuf.pipe); - sc->sedesc->iobuf.pipe = NULL; - } - else - goto end; - } - /* At this point, the pipe is empty, but we may still have data pending * in the normal buffer. */ diff --git a/src/stream.c b/src/stream.c index 6ccbe86..0413ccd 100644 --- a/src/stream.c +++ b/src/stream.c @@ -2269,22 +2269,6 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) } } - /* check if it is wise to enable kernel splicing to forward request data */ - if (!(req->flags & CF_KERN_SPLICING) && - !(scf->flags & (SC_FL_EOS|SC_FL_ABRT_DONE)) && - req->to_forward && - (global.tune.options & GTUNE_USE_SPLICE) && - (sc_conn(scf) && __sc_conn(scf)->xprt && __sc_conn(scf)->xprt->rcv_pipe && - __sc_conn(scf)->mux && __sc_conn(scf)->mux->rcv_pipe) && - (sc_conn(scb) && __sc_conn(scb)->xprt && __sc_conn(scb)->xprt->snd_pipe && - __sc_conn(scb)->mux && __sc_conn(scb)->mux->snd_pipe) && - (pipes_used < global.maxpipes) && - (((sess->fe->options2|s->be->options2) & PR_O2_SPLIC_REQ) || - (((sess->fe->options2|s->be->options2) & PR_O2_SPLIC_AUT) && - (req->flags & CF_STREAMER_FAST)))) { - req->flags |= CF_KERN_SPLICING; - } - /* reflect what the L7 analysers have seen last */ rqf_last = req->flags; scf_flags = (scf_flags & ~(SC_FL_EOS|SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) | (scf->flags & (SC_FL_EOS|SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)); @@ -2460,22 +2444,6 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) } } - /* check if it is wise to enable kernel splicing to forward response data */ - if (!(res->flags & CF_KERN_SPLICING) && - !(scb->flags & (SC_FL_EOS|SC_FL_ABRT_DONE)) && - res->to_forward && - (global.tune.options & GTUNE_USE_SPLICE) && - (sc_conn(scf) && __sc_conn(scf)->xprt && __sc_conn(scf)->xprt->snd_pipe && - __sc_conn(scf)->mux && __sc_conn(scf)->mux->snd_pipe) && - (sc_conn(scb) && __sc_conn(scb)->xprt && __sc_conn(scb)->xprt->rcv_pipe && - __sc_conn(scb)->mux && __sc_conn(scb)->mux->rcv_pipe) && - (pipes_used < global.maxpipes) && - (((sess->fe->options2|s->be->options2) & PR_O2_SPLIC_RTR) || - (((sess->fe->options2|s->be->options2) & PR_O2_SPLIC_AUT) && - (res->flags & CF_STREAMER_FAST)))) { - res->flags |= CF_KERN_SPLICING; - } - /* reflect what the L7 analysers have seen last */ rpf_last = res->flags; scb_flags = (scb_flags & ~(SC_FL_EOS|SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) | (scb->flags & (SC_FL_EOS|SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED));