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 e76abd6a9e31fe409cc7bcc823a75ac3ea25f97e Author: Bowen Wang <[email protected]> AuthorDate: Mon Jul 13 20:32:48 2026 +0800 drivers/rpmsg/rpmsg_port_spi: log the retx state of rx frames The rx logs only printed a fixed set of fields, which is not enough to tell whether an SPI frame was misaligned, a single field was corrupted, or the retx sequence state was involved. Extend the rx logs in both the master (rpmsg_port_spi_complete_handler) and slave (rpmsg_port_spi_slave_notify) paths so each first prints the non-retx common fields unconditionally, then appends a second line with the retx state (seqno/ackno/min_seq and the local expected rx_next) under CONFIG_RPMSG_PORT_RETX. This covers the entry "received" log and the malformed / CRC-fail drop logs, so the failure mode can be read straight from the log. This is diagnostics only; no behavioral change. Signed-off-by: Bowen Wang <[email protected]> --- drivers/rpmsg/rpmsg_port_spi.c | 26 ++++++++++++++++++++++---- drivers/rpmsg/rpmsg_port_spi_slave.c | 26 ++++++++++++++++++++++---- 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/drivers/rpmsg/rpmsg_port_spi.c b/drivers/rpmsg/rpmsg_port_spi.c index fa00e441c1d..4cafe79a8aa 100644 --- a/drivers/rpmsg/rpmsg_port_spi.c +++ b/drivers/rpmsg/rpmsg_port_spi.c @@ -404,6 +404,11 @@ static void rpmsg_port_spi_complete_handler(FAR void *arg) rpmsginfo("received cmd:%u avail:%u\n", rpspi->rxhdr->cmd, rpspi->rxhdr->avail); +#ifdef CONFIG_RPMSG_PORT_RETX + rpmsginfo("received retx state: seq=%u ack=%u min_seq=%u\n", + rpspi->rxhdr->seqno, rpspi->rxhdr->ackno, + rpspi->rxhdr->min_seq); +#endif if (rpspi->txhdr != NULL) { @@ -420,8 +425,15 @@ static void rpmsg_port_spi_complete_handler(FAR void *arg) if (rpspi->rxhdr->len < sizeof(struct rpmsg_port_header_s) || rpspi->rxhdr->len > rpspi->port.rxq.len) { - rpmsgerr("drop malformed rx: len=%u crc=%u cmd=%u\n", - rpspi->rxhdr->len, rpspi->rxhdr->crc, rpspi->rxhdr->cmd); + rpmsgerr("drop malformed rx: len=%u crc=%u cmd=%u avail=%u\n", + rpspi->rxhdr->len, rpspi->rxhdr->crc, rpspi->rxhdr->cmd, + rpspi->rxhdr->avail); +#ifdef CONFIG_RPMSG_PORT_RETX + rpmsgerr("malformed rx retx state: seq=%u ack=%u min_seq=%u " + "rx_next=%u\n", + rpspi->rxhdr->seqno, rpspi->rxhdr->ackno, + rpspi->rxhdr->min_seq, rpspi->port.retx.rx_next); +#endif goto out; } @@ -431,8 +443,14 @@ static void rpmsg_port_spi_complete_handler(FAR void *arg) if (crc != 0 && rpspi->rxhdr->crc != crc) { - rpmsgerr("crc check fail received: %u calculated: %u\n", - rpspi->rxhdr->crc, crc); + rpmsgerr("crc check fail received: %u calculated: %u " + "len=%u cmd=%u\n", + rpspi->rxhdr->crc, crc, rpspi->rxhdr->len, + rpspi->rxhdr->cmd); +#ifdef CONFIG_RPMSG_PORT_RETX + rpmsgerr("retx crc check fail received: seq=%u\n", + rpspi->rxhdr->seqno); +#endif goto out; } } diff --git a/drivers/rpmsg/rpmsg_port_spi_slave.c b/drivers/rpmsg/rpmsg_port_spi_slave.c index 963657fe12f..d61d7420695 100644 --- a/drivers/rpmsg/rpmsg_port_spi_slave.c +++ b/drivers/rpmsg/rpmsg_port_spi_slave.c @@ -482,6 +482,11 @@ static void rpmsg_port_spi_slave_notify(FAR struct spi_slave_dev_s *dev, rpmsginfo("received cmd:%u avail:%u\n", rpspi->rxhdr->cmd, rpspi->rxhdr->avail); +#ifdef CONFIG_RPMSG_PORT_RETX + rpmsginfo("received retx state: seq=%u ack=%u min_seq=%u\n", + rpspi->rxhdr->seqno, rpspi->rxhdr->ackno, + rpspi->rxhdr->min_seq); +#endif if (rpspi->txhdr != NULL) { @@ -498,8 +503,15 @@ static void rpmsg_port_spi_slave_notify(FAR struct spi_slave_dev_s *dev, if (rpspi->rxhdr->len < sizeof(struct rpmsg_port_header_s) || rpspi->rxhdr->len > rpspi->port.rxq.len) { - rpmsgerr("drop malformed rx: len=%u crc=%u cmd=%u\n", - rpspi->rxhdr->len, rpspi->rxhdr->crc, rpspi->rxhdr->cmd); + rpmsgerr("drop malformed rx: len=%u crc=%u cmd=%u avail=%u\n", + rpspi->rxhdr->len, rpspi->rxhdr->crc, rpspi->rxhdr->cmd, + rpspi->rxhdr->avail); +#ifdef CONFIG_RPMSG_PORT_RETX + rpmsgerr("malformed rx retx state: seq=%u ack=%u min_seq=%u " + "rx_next=%u\n", + rpspi->rxhdr->seqno, rpspi->rxhdr->ackno, + rpspi->rxhdr->min_seq, rpspi->port.retx.rx_next); +#endif goto out; } @@ -509,8 +521,14 @@ static void rpmsg_port_spi_slave_notify(FAR struct spi_slave_dev_s *dev, if (crc != 0 && rpspi->rxhdr->crc != crc) { - rpmsgerr("crc check fail received: %u calculated: %u\n", - rpspi->rxhdr->crc, crc); + rpmsgerr("crc check fail received: %u calculated: %u " + "len=%u cmd=%u\n", + rpspi->rxhdr->crc, crc, rpspi->rxhdr->len, + rpspi->rxhdr->cmd); +#ifdef CONFIG_RPMSG_PORT_RETX + rpmsgerr("retx crc check fail received: seq=%u\n", + rpspi->rxhdr->seqno); +#endif goto out; } }
