From 94f7907d65d228d8cc148183909cc4b8c746fc20 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 14 Nov 2018 11:24:08 +0100 Subject: [PATCH] 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. --- contrib/debug/flags.c | 10 +++++++--- include/types/stream_interface.h | 9 ++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/contrib/debug/flags.c b/contrib/debug/flags.c index e0d191dd5..7ff6372cb 100644 --- a/contrib/debug/flags.c +++ b/contrib/debug/flags.c @@ -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'); } diff --git a/include/types/stream_interface.h b/include/types/stream_interface.h index f63c0fd6d..1f1716fe4 100644 --- a/include/types/stream_interface.h +++ b/include/types/stream_interface.h @@ -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 :