]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stconn: Temporarily remove kernel splicing support
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 3 Aug 2023 15:17:15 +0000 (17:17 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 17 Oct 2023 16:51:13 +0000 (18:51 +0200)
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.

include/haproxy/channel-t.h
reg-tests/http-messaging/http_splicing.vtc
reg-tests/http-messaging/http_splicing_chunk.vtc
src/stconn.c
src/stream.c

index 8629f5f1e9522f79f50a46039425a55010928994..6972edbba2eafe620abce1c0da0ed40a86a76031 100644 (file)
@@ -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;
index e86680bd55ee4004d514a815c05d9731033cdc66..930d76f19ea3e42eef47ce6d3844e22750004311 100644 (file)
@@ -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
index e2e9f32ddd04880eaee826166ee4f99d82f7203f..f9dd49543203ce9b5f98604d98b52e98238ee30a 100644 (file)
@@ -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
index f208678dabe6a7c5e162f9e148e6f63f5ba3c39b..8af16deb975e64eedf0e16b8f55192e31e50d0ed 100644 (file)
@@ -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.
         */
index 6ccbe86235aecc621382060696d4be4b02f0fc31..0413ccd60b874c789d27ff28bcd627022cb3a645 100644 (file)
@@ -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));