]> git.ipfire.org Git - thirdparty/linux.git/commit
tty: serial: 8250_dma: use sgl with 2 nents to take care of buffer wrap
authorFerry Toth <ftoth@exalondelft.nl>
Tue, 16 Jul 2024 21:40:31 +0000 (23:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Jul 2024 10:32:30 +0000 (12:32 +0200)
commit59449c9dbdaa29e9e9e75f66e8cb71694cf2b0a6
treec310006d71c50877b7e3fbf0accf948916c598f8
parent68c341c888f448410de027ca4b3d113f2b437c54
tty: serial: 8250_dma: use sgl with 2 nents to take care of buffer wrap

Previously 8250_dma used a circular xmit->buf as DMA output buffer. This
causes messages that wrap around in the circular buffer to be
transmitted using 2 DMA transfers. Depending on baud rate and processor
load this can cause an interchar gap in the middle of the message. On
the receiving end the gap may cause a short receive timeout, possibly
long enough to terminate a DMA transfer, but too short to restart a
receive DMA transfer in time thus causing a receive buffer overrun.

This is especially a problem for devices with high speed UARTs (HSU)
where even deep 64 byte FIFO's are not sufficient to handle interrupt
latency.

The circular buffer has now been replaced by kfifo which requires a SG
list with a single entry, which still causes 2 dma transfers when a wrap
around occurs. Fix this by allowing up to 2 entries in the sgl.

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Ferry Toth <ftoth@exalondelft.nl>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20240716214055.102269-1-ftoth@exalondelft.nl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_dma.c