This is an automated email from the ASF dual-hosted git repository. GUIDINGLI pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 87c38010bab3289b1dcd3a4b156487da62c8a633 Author: zhangbo56 <[email protected]> AuthorDate: Thu Apr 23 10:17:53 2026 +0800 drivers/rpmsg/rpmsg_port_spi: return the tx buffer without RETX Without CONFIG_RPMSG_PORT_RETX nothing holds a sent DATA frame for a later ack, but the SPI master and slave completion paths only clear txhdr, so every sent frame leaks its tx buffer and the port stops sending once the tx queue is empty. Return the buffer there when RETX is disabled. The slave completion path also restarted an exchange whenever transferring was set, i.e. after every transfer. Only restart when another exchange was requested during the transfer (transferring > 1), as the master does. Signed-off-by: zhangbo56 <[email protected]> Signed-off-by: Bowen Wang <[email protected]> --- drivers/rpmsg/rpmsg_port_spi.c | 3 +++ drivers/rpmsg/rpmsg_port_spi_slave.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/rpmsg/rpmsg_port_spi.c b/drivers/rpmsg/rpmsg_port_spi.c index 4df8b647f42..fa00e441c1d 100644 --- a/drivers/rpmsg/rpmsg_port_spi.c +++ b/drivers/rpmsg/rpmsg_port_spi.c @@ -407,6 +407,9 @@ static void rpmsg_port_spi_complete_handler(FAR void *arg) if (rpspi->txhdr != NULL) { +#ifndef CONFIG_RPMSG_PORT_RETX + rpmsg_port_queue_return_buffer(&rpspi->port.txq, rpspi->txhdr); +#endif rpspi->txhdr = NULL; } else if (rpspi->cmdhdr->cmd == RPMSG_PORT_SPI_CMD_SHUTDOWN) diff --git a/drivers/rpmsg/rpmsg_port_spi_slave.c b/drivers/rpmsg/rpmsg_port_spi_slave.c index 4b61b7f759b..963657fe12f 100644 --- a/drivers/rpmsg/rpmsg_port_spi_slave.c +++ b/drivers/rpmsg/rpmsg_port_spi_slave.c @@ -485,6 +485,9 @@ static void rpmsg_port_spi_slave_notify(FAR struct spi_slave_dev_s *dev, if (rpspi->txhdr != NULL) { +#ifndef CONFIG_RPMSG_PORT_RETX + rpmsg_port_queue_return_buffer(&rpspi->port.txq, rpspi->txhdr); +#endif rpspi->txhdr = NULL; } else if (rpspi->cmdhdr->cmd == RPMSG_PORT_SPI_CMD_SHUTDOWN) @@ -603,7 +606,7 @@ static void rpmsg_port_spi_slave_notify(FAR struct spi_slave_dev_s *dev, unlock: spin_unlock_irqrestore(&rpspi->lock, flags); out: - if (atomic_xchg(&rpspi->transferring, 0) || + if (atomic_xchg(&rpspi->transferring, 0) > 1 || rpmsg_port_retx_is_pending(&rpspi->port) || (rpspi->txavail > 0 && rpmsg_port_queue_nused(&rpspi->port.txq) > 0)) {
