CV-Bowen opened a new pull request, #22486:
URL: https://github.com/apache/nuttx/pull/22486
## Summary
Depends on apache/nuttx#22485
Harden and instrument the SPI port rx path:
- `drivers/rpmsg/rpmsg_port_spi: log the retx state of rx frames`: the rx,
malformed-frame and CRC-failure logs also print the retx state
(`seqno`/`ackno`/`min_seq` and the local `rx_next`).
- `drivers/rpmsg/rpmsg_port_spi: log when rx recovers after errors`: count
consecutive rx errors (and seqno mismatches in
`rpmsg_port_retx_rx_valid()`) and print one "recovered after N errors"
line when a frame passes again.
- `drivers/rpmsg/rpmsg_port_spi: validate the rx CRC of a zero crc field`:
a torn frame with `crc == 0` skipped the CRC check and reached the retx
state machine. With CRC enabled a valid frame never has a zero CRC
(apache/nuttx#22482), so check it unconditionally.
- `drivers/rpmsg/rpmsg_port_spi: validate rx cmd and bound min_seq advance`:
drop frames with an unknown `cmd`, which bypassed the seqno validation, and
only let a peer's `min_seq` move `rx_next` forward by at most the rx queue
depth; a torn `min_seq == 0` was read as 12616 frames ahead and stalled the
rx channel.
## Impact
- Frames that are corrupted in the `crc`, `cmd` or `min_seq` fields are now
dropped instead of being processed.
- More rx error logs; `struct rpmsg_port_queue_s` gains a `num` field (the
total buffer count).
## Testing
Host: Ubuntu 22.04.5 LTS x86_64.
No in-tree configuration enables the SPI port drivers, so each commit was
built
with a test-only overlay on top of the rpserver configurations:
`CONFIG_SPI=y CONFIG_SPI_SLAVE=y CONFIG_IOEXPANDER=y
CONFIG_IOEXPANDER_RPMSG=y
CONFIG_RPMSG_PORT_SPI=y CONFIG_RPMSG_PORT_SPI_SLAVE=y`, plus the 64-bit
cast fix of apache/nuttx#P221 for the qemu-armv8a builds (master does not
build the SPI ports on 64-bit targets without it). 0 warnings for each commit
in all of:
- `qemu-armv8a:rpserver` + overlay (aarch64-none-elf-gcc 13.4), RETX on
- the same with `RPMSG_PORT_RETX=n` and `RPMSG_PORT_SPI_CRC=n`
- `qemu-armv7a:rpserver` + overlay (arm-none-eabi-gcc 10.3), RETX on
- `sim:rpserver_uart` (rpmsg_port_uart)
No SPI hardware is available, so the SPI changes are build-only.
No regression in rpmsg: sim:rpserver/rpproxy and qemu-armv8a:rpserver/rpproxy
boot and pass the fixed rpmsg cases (dump, ping, rpmsgfs). The qemu-armv8a
pair talks over rpmsg_port_uart as well as ivshmem (`rpmsg ping all` covers
both), with `RPMSG_PORT_RETX=y`.
checkpatch passes on all commits.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]