[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220408113954.9749-1-ilpo.jarvinen@linux.intel.com>
Date: Fri, 8 Apr 2022 14:39:51 +0300
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: linux-serial@...r.kernel.org, Greg KH <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: linux-kernel@...r.kernel.org,
Gilles Buloz <gilles.buloz@...tron.com>,
Johan Hovold <johan@...nel.org>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
Subject: [PATCH v2 0/3] tty/serial: Process XON/XOFF robustly
XON/XOFF are used for software flow-control on serial lines.
XON and XOFF appear as characters within the stream but should
be processed as soon as possible.
The characters received by the UART drivers are in intermediate
buffers until TTY receives them. In the case where the TTY is
not read from, the characters may get stuck into those
intermediate buffers until user-space reads from the TTY. Among
the characters stuck in the buffers, can also be those XON/XOFF
flow control characters. A stuck flow-control character is not
very useful.
This patch series addresses the issue by checking if TTY is slow
to process characters, that is, eats less than the given amount.
If TTY is slow, a lookahead is invoked for the characters that
remain in the intermediate buffer(s).
Then at a later time, receive_buf needs to ensure the
flow-control actions are not retaken when those same characters
get pushed to TTY. The necessary guards for that are added by
the second patch of the series.
This patch series fixes an issue but I'm not able to pinpoint to
a specific commit id to provide a Fixes tag.
v1 -> v2:
- Add flow ctrl char funcs in separate change & rework logic a bit.
I believe it's now cleaner than it would have been with the
suggestions during v1 review, please recheck.
- Renamed n_tty_lookahead_special to n_tty_lookahead_flow_ctrl
- Fixed logic for START_CHAR == STOP_CHAR case
- Use unsigned int for lookahead_count in receive_buf call chain
- Use consistent types in lookahead call chain
- Improved indentation & line splits for function params
- Corrected tty_ldisc.h comments documenting tty_ldisc_ops
- Tweaked comment format
Ilpo Järvinen (3):
tty: Add functions for handling flow control chars
tty: Add lookahead param to receive_buf
tty: Implement lookahead to process XON/XOFF timely
drivers/accessibility/speakup/spk_ttyio.c | 2 +-
drivers/bluetooth/hci_ldisc.c | 2 +-
drivers/char/pcmcia/synclink_cs.c | 2 +-
drivers/input/serio/serport.c | 4 +-
drivers/isdn/capi/capi.c | 2 +-
drivers/misc/ti-st/st_core.c | 2 +-
drivers/net/caif/caif_serial.c | 4 +-
drivers/net/can/slcan.c | 2 +-
drivers/net/hamradio/6pack.c | 4 +-
drivers/net/hamradio/mkiss.c | 2 +-
drivers/net/mctp/mctp-serial.c | 2 +-
drivers/net/ppp/ppp_async.c | 2 +-
drivers/net/ppp/ppp_synctty.c | 2 +-
drivers/net/slip/slip.c | 2 +-
drivers/tty/n_gsm.c | 2 +-
drivers/tty/n_hdlc.c | 2 +-
drivers/tty/n_null.c | 2 +-
drivers/tty/n_tty.c | 99 ++++++++++++++++-------
drivers/tty/serdev/serdev-ttyport.c | 3 +-
drivers/tty/synclink_gt.c | 2 +-
drivers/tty/tty_buffer.c | 67 ++++++++++++---
drivers/tty/tty_io.c | 2 +-
drivers/tty/tty_port.c | 26 +++++-
drivers/tty/vt/selection.c | 2 +-
include/linux/tty_buffer.h | 1 +
include/linux/tty_flip.h | 2 +-
include/linux/tty_ldisc.h | 31 +++++--
include/linux/tty_port.h | 5 +-
net/nfc/nci/uart.c | 2 +-
sound/soc/codecs/cx20442.c | 2 +-
sound/soc/ti/ams-delta.c | 2 +-
31 files changed, 205 insertions(+), 81 deletions(-)
--
2.30.2
Powered by blists - more mailing lists