]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream-int: introduce new SI_FL_RXBLK flags
authorWilly Tarreau <w@1wt.eu>
Wed, 14 Nov 2018 10:24:08 +0000 (11:24 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 18 Nov 2018 20:41:45 +0000 (21:41 +0100)
The plan is to have the following flags to describe why a stream interface
doesn't produce data :

    - SI_FL_RXBLK_CHAN : the channel doesn't want it to receive
    - SI_FL_RXBLK_BUFF : waiting for a buffer allocation to complete
    - SI_FL_RXBLK_ROOM : more room is required in the channel to receive
    - SI_FL_RXBLK_SHUT : input now closed, nothing new will come
    - SI_FL_RX_WAIT_EP : waiting for the endpoint to produce more data

Applets like the CLI which consume complete commands at once and produce
large chunks of responses will for example be able to stop being woken up
by clearing SI_FL_WANT_GET and setting SI_FL_RXBLK_ROOM when the rx buffer
is full. Once called they will unblock WANT_GET. The flags were moved
together in readable form with the Rx bits using 2 hex digits and still
have some room to do a similar operation on the Tx path later, with the
WAIT_EP flag being represented alone on a digit.

contrib/debug/flags.c
include/types/stream_interface.h

index e0d191dd52c68cff441f7e510cfc366ccd810f1e..7ff6372cb5ae005ecbe533e59453ee6519b8c199 100644 (file)
@@ -201,8 +201,6 @@ void show_si_et(unsigned int f)
 
 void show_si_flags(unsigned int f)
 {
-       f &= 0xFFFF;
-
        printf("si->flags   = ");
        if (!f) {
                printf("SI_FL_NONE\n");
@@ -222,8 +220,14 @@ void show_si_flags(unsigned int f)
        SHOW_FLAG(f, SI_FL_WANT_PUT);
        SHOW_FLAG(f, SI_FL_WANT_GET);
 
+       SHOW_FLAG(f, SI_FL_RXBLK_CHAN);
+       SHOW_FLAG(f, SI_FL_RXBLK_BUFF);
+       SHOW_FLAG(f, SI_FL_RXBLK_ROOM);
+       SHOW_FLAG(f, SI_FL_RXBLK_SHUT);
+       SHOW_FLAG(f, SI_FL_RX_WAIT_EP);
+
        if (f) {
-               printf("EXTRA(0x%04x)", f);
+               printf("EXTRA(0x%08x)", f);
        }
        putchar('\n');
 }
index f63c0fd6dfdfbde7b3d94f052b1802416c2f333f..1f1716fe45736202b52b96bf72ed247f6e49c887 100644 (file)
@@ -64,7 +64,7 @@ enum {
        SI_FL_NONE       = 0x00000000,  /* nothing */
        SI_FL_EXP        = 0x00000001,  /* timeout has expired */
        SI_FL_ERR        = 0x00000002,  /* a non-recoverable error has occurred */
-       SI_FL_RXBLK_ROOM = 0x00000004,  /* stream-int waits for more buffer room to store incoming data */
+       /* unused:         0x00000004 */
        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 */
@@ -75,6 +75,13 @@ enum {
        SI_FL_WANT_PUT   = 0x00002000,  /* a stream-int would like to put some data into the buffer */
        SI_FL_WANT_GET   = 0x00004000,  /* a stream-int would like to get some data from the buffer */
        SI_FL_CLEAN_ABRT = 0x00008000,  /* SI_FL_ERR is used to report aborts, and not SHUTR */
+
+       SI_FL_RXBLK_CHAN = 0x00010000,  /* the channel doesn't want the stream-int to introduce data */
+       SI_FL_RXBLK_BUFF = 0x00020000,  /* stream-int waits for a buffer allocation to complete */
+       SI_FL_RXBLK_ROOM = 0x00040000,  /* stream-int waits for more buffer room to store incoming data */
+       SI_FL_RXBLK_SHUT = 0x00080000,  /* input is now closed, nothing new will ever come */
+       SI_FL_RXBLK_ANY  = 0x000F0000,  /* any of the RXBLK flags above */
+       SI_FL_RX_WAIT_EP = 0x00100000,  /* stream-int waits for more data from the end point */
 };
 
 /* A stream interface has 3 parts :