Re: [PATCH v3 08/15] serial: 8250_mxpcie: speed up TX using memory-mapped FIFO window

From: Jiri Slaby

Date: Thu Jul 09 2026 - 03:15:35 EST


On 09. 07. 26, 7:33, Crescent Hsieh wrote:
...
--- a/drivers/tty/serial/8250/8250_mxpcie.c
+++ b/drivers/tty/serial/8250/8250_mxpcie.c
...
@@ -318,6 +320,37 @@ static u16 mxpcie8250_rx_chars(struct uart_8250_port *up, u16 lsr)
return serial8250_rx_chars(up, lsr);
}
+static void mxpcie8250_tx_chars(struct uart_8250_port *up)
+{
+ struct uart_port *port = &up->port;
+ struct tty_port *tport = &port->state->port;
+ unsigned int count, txsize;
+ unsigned char c;
+
+ if (port->x_char) {
+ uart_xchar_out(port, UART_TX);
+ return;
+ }
+ if (uart_tx_stopped(port) || kfifo_is_empty(&tport->xmit_fifo)) {
+ port->ops->stop_tx(port);
+ return;
+ }
+ txsize = serial_in(up, MOXA_PUART_TX_FIFO_CNT);
+ count = min(kfifo_len(&tport->xmit_fifo), port->fifosize - txsize);
+
+ for (unsigned int i = 0; i < count; ++i) {
+ if (!uart_fifo_get(port, &c))
+ break;
+
+ serial_out(up, MOXA_PUART_TX_FIFO_MEM + i, c);
+ }
+ if (kfifo_len(&tport->xmit_fifo) < WAKEUP_CHARS)
+ uart_write_wakeup(port);
+
+ if (kfifo_is_empty(&tport->xmit_fifo) && !(up->capabilities & UART_CAP_RPM))
+ port->ops->stop_tx(port);

What's the reason not to use uart_port_tx() et al.?

thanks,
--
js
suse labs