MINOR: stream-int: introduce new SI_FL_RXBLK flags

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.
This commit is contained in:
Willy Tarreau 2018-11-14 11:24:08 +01:00
parent d0f5bbcd64
commit 94f7907d65
2 changed files with 15 additions and 4 deletions

View File

@ -201,8 +201,6 @@ void show_si_et(unsigned int f)
void show_si_flags(unsigned int f) void show_si_flags(unsigned int f)
{ {
f &= 0xFFFF;
printf("si->flags = "); printf("si->flags = ");
if (!f) { if (!f) {
printf("SI_FL_NONE\n"); 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_PUT);
SHOW_FLAG(f, SI_FL_WANT_GET); 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) { if (f) {
printf("EXTRA(0x%04x)", f); printf("EXTRA(0x%08x)", f);
} }
putchar('\n'); putchar('\n');
} }

View File

@ -64,7 +64,7 @@ enum {
SI_FL_NONE = 0x00000000, /* nothing */ SI_FL_NONE = 0x00000000, /* nothing */
SI_FL_EXP = 0x00000001, /* timeout has expired */ SI_FL_EXP = 0x00000001, /* timeout has expired */
SI_FL_ERR = 0x00000002, /* a non-recoverable error has occurred */ 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_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_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_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_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_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_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 : /* A stream interface has 3 parts :