]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream-int: Remove SI_FL_DONT_WAKE to rely on CS flags instead
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 30 Mar 2022 13:30:03 +0000 (15:30 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 13 Apr 2022 13:10:14 +0000 (15:10 +0200)
Flag to not wake the stream up on I/O is now handled at the conn-stream
level. Thus SI_FL_DONT_WAKE stream-int flag is replaced by CS_FL_DONT_WAKE
conn-stream flags.

dev/flags/flags.c
include/haproxy/conn_stream-t.h
include/haproxy/stream_interface-t.h
src/cli.c
src/stream.c
src/stream_interface.c

index 8317b7550e832b537080ad716ae41cb5ed098f4b..6a8b5ab36ad4d2ab49fa4e6d419dfe72b0ff3469 100644 (file)
@@ -219,6 +219,7 @@ void show_cs_flags(unsigned int f)
                printf("0\n");
                return;
        }
+       SHOW_FLAG(f, CS_FL_DONT_WAKE);
        SHOW_FLAG(f, CS_FL_NOLINGER);
        SHOW_FLAG(f, CS_FL_NOHALF);
        SHOW_FLAG(f, CS_FL_ADDR_FROM_SET);
@@ -267,7 +268,6 @@ void show_si_flags(unsigned int f)
 
        SHOW_FLAG(f, SI_FL_WAIT_DATA);
        SHOW_FLAG(f, SI_FL_ISBACK);
-       SHOW_FLAG(f, SI_FL_DONT_WAKE);
        SHOW_FLAG(f, SI_FL_INDEP_STR);
        SHOW_FLAG(f, SI_FL_SRC_ADDR);
        SHOW_FLAG(f, SI_FL_WANT_GET);
index 877bace13ac08a78da549d53bf556e6606fc58e3..60cd9fa6d7f7ac3ab1661ecbfaad7e82b6b8b9d3 100644 (file)
@@ -85,6 +85,7 @@ enum {
 
        CS_FL_NOLINGER      = 0x00000008,  /* may close without lingering. One-shot. */
        CS_FL_NOHALF        = 0x00000010,  /* no half close, close both sides at once */
+       CS_FL_DONT_WAKE     = 0x00000020,  /* resync in progress, don't wake up */
 };
 
 /* cs_shutr() modes */
index ebd9d3515e828f2d90ecbfa1a7a64389dc90531f..6ffc3d4c68c8bbbc8f971498c468a8c9bd40408d 100644 (file)
@@ -86,7 +86,6 @@ enum {
        /* unused: 0x00000001, 0x00000002 */
        SI_FL_WAIT_DATA  = 0x00000008,  /* stream-int waits for more outgoing data to send */
        SI_FL_ISBACK     = 0x00000010,  /* 0 for front-side SI, 1 for back-side */
-       SI_FL_DONT_WAKE  = 0x00000020,  /* resync in progress, don't wake up */
        SI_FL_INDEP_STR  = 0x00000040,  /* independent streams = don't update rex on write */
        SI_FL_SRC_ADDR   = 0x00001000,  /* get the source ip/port with getsockname */
        /* unused: 0x00000200 */
index 4d0e293fc3d634b47affa8c4c1dc56997a2c48ac..f55999e034d0c9f723655d51f6180414474462f9 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2768,7 +2768,8 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
 
                cs_si(s->csb)->state = cs_si(s->csb)->prev_state = SI_ST_INI;
                cs_si(s->csb)->err_type = SI_ET_NONE;
-               cs_si(s->csb)->flags &= SI_FL_ISBACK | SI_FL_DONT_WAKE; /* we're in the context of process_stream */
+               cs_si(s->csb)->flags &= SI_FL_ISBACK; /* we're in the context of process_stream */
+               s->csb->flags &= CS_FL_ISBACK | CS_FL_DONT_WAKE; /* we're in the context of process_stream */
                s->req.flags &= ~(CF_SHUTW|CF_SHUTW_NOW|CF_AUTO_CONNECT|CF_WRITE_ERROR|CF_STREAMER|CF_STREAMER_FAST|CF_NEVER_WAIT|CF_WROTE_DATA);
                s->res.flags &= ~(CF_SHUTR|CF_SHUTR_NOW|CF_READ_ATTACHED|CF_READ_ERROR|CF_READ_NOEXP|CF_STREAMER|CF_STREAMER_FAST|CF_WRITE_PARTIAL|CF_NEVER_WAIT|CF_WROTE_DATA|CF_READ_NULL);
                s->flags &= ~(SF_DIRECT|SF_ASSIGNED|SF_ADDR_SET|SF_BE_ASSIGNED|SF_FORCE_PRST|SF_IGNORE_PRST);
index a42c8968f9401654b116f1d35186a2021fcda957..c2e0b24ddc22d5770a267518cc4459c6000cd214 100644 (file)
@@ -1616,9 +1616,9 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
        rqf_last = req->flags & ~CF_MASK_ANALYSER;
        rpf_last = res->flags & ~CF_MASK_ANALYSER;
 
-       /* we don't want the stream interface functions to recursively wake us up */
-       si_f->flags |= SI_FL_DONT_WAKE;
-       si_b->flags |= SI_FL_DONT_WAKE;
+       /* we don't want the conn-stream functions to recursively wake us up */
+       s->csf->flags |= CS_FL_DONT_WAKE;
+       s->csb->flags |= CS_FL_DONT_WAKE;
 
        /* update pending events */
        s->pending_events |= (state & TASK_WOKEN_ANY);
@@ -1675,8 +1675,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
                    !(s->flags & SF_CONN_EXP) &&
                    !((s->csf->endp->flags | s->csb->flags) & CS_EP_ERROR) &&
                    ((s->pending_events & TASK_WOKEN_ANY) == TASK_WOKEN_TIMER)) {
-                       si_f->flags &= ~SI_FL_DONT_WAKE;
-                       si_b->flags &= ~SI_FL_DONT_WAKE;
+                       s->csf->flags &= ~CS_FL_DONT_WAKE;
+                       s->csb->flags &= ~CS_FL_DONT_WAKE;
                        goto update_exp_and_leave;
                }
        }
@@ -2393,8 +2393,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
                goto resync_request;
 
        /* we're interested in getting wakeups again */
-       si_f->flags &= ~SI_FL_DONT_WAKE;
-       si_b->flags &= ~SI_FL_DONT_WAKE;
+       s->csf->flags &= ~CS_FL_DONT_WAKE;
+       s->csb->flags &= ~CS_FL_DONT_WAKE;
 
        /* This is needed only when debugging is enabled, to indicate
         * client-side or server-side close. Please note that in the unlikely
@@ -2448,7 +2448,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
                s->pending_events = 0;
 
        update_exp_and_leave:
-               /* Note: please ensure that if you branch here you disable SI_FL_DONT_WAKE */
+               /* Note: please ensure that if you branch here you disable CS_FL_DONT_WAKE */
                t->expire = tick_first((tick_is_expired(t->expire, now_ms) ? 0 : t->expire),
                                       tick_first(tick_first(req->rex, req->wex),
                                                  tick_first(res->rex, res->wex)));
index 2c196ce4416e9fdecd954b15dc5184781ca19091..66f4980cedafddf2b00dff5522ad1262f9c351ad 100644 (file)
@@ -188,7 +188,7 @@ static void stream_int_shutr(struct stream_interface *si)
        }
 
        /* note that if the task exists, it must unregister itself once it runs */
-       if (!(si->flags & SI_FL_DONT_WAKE))
+       if (!(si->cs->flags & CS_FL_DONT_WAKE))
                task_wakeup(si_task(si), TASK_WOKEN_IO);
 }
 
@@ -246,7 +246,7 @@ static void stream_int_shutw(struct stream_interface *si)
        }
 
        /* note that if the task exists, it must unregister itself once it runs */
-       if (!(si->flags & SI_FL_DONT_WAKE))
+       if (!(si->cs->flags & CS_FL_DONT_WAKE))
                task_wakeup(si_task(si), TASK_WOKEN_IO);
 }
 
@@ -266,7 +266,7 @@ static void stream_int_chk_rcv(struct stream_interface *si)
        else {
                /* (re)start reading */
                tasklet_wakeup(si->wait_event.tasklet);
-               if (!(si->flags & SI_FL_DONT_WAKE))
+               if (!(si->cs->flags & CS_FL_DONT_WAKE))
                        task_wakeup(si_task(si), TASK_WOKEN_IO);
        }
 }
@@ -294,7 +294,7 @@ static void stream_int_chk_snd(struct stream_interface *si)
        if (!tick_isset(oc->wex))
                oc->wex = tick_add_ifset(now_ms, oc->wto);
 
-       if (!(si->flags & SI_FL_DONT_WAKE))
+       if (!(si->cs->flags & CS_FL_DONT_WAKE))
                task_wakeup(si_task(si), TASK_WOKEN_IO);
 }
 
@@ -1237,7 +1237,7 @@ static void stream_int_chk_snd_conn(struct stream_interface *si)
                   ((channel_is_empty(oc) && !oc->to_forward) ||
                    !si_state_in(si->state, SI_SB_EST))))) {
        out_wakeup:
-               if (!(si->flags & SI_FL_DONT_WAKE))
+               if (!(si->cs->flags & CS_FL_DONT_WAKE))
                        task_wakeup(si_task(si), TASK_WOKEN_IO);
        }
 }