CV-Bowen opened a new pull request, #22546: URL: https://github.com/apache/nuttx/pull/22546
## Summary The rpmsg_port frame checksum is gated by `CONFIG_RPMSG_PORT_UART_CRC` and `CONFIG_RPMSG_PORT_SPI_CRC`, both off by default (SPI only gets it through `CONFIG_RPMSG_PORT_RETX`), so a corrupted frame goes undetected. The receivers also skip the check when the crc field is zero, so a frame whose crc field was zeroed in transit is accepted as valid. Remove both options: the checksum (`xorsum16()`) is always computed on transmit and always verified on receive, including frames carrying `crc == 0`. SPI keeps folding a zero checksum to 1, so a valid SPI frame never carries 0. ## Impact BREAKING CHANGE: `CONFIG_RPMSG_PORT_UART_CRC` and `CONFIG_RPMSG_PORT_SPI_CRC` are removed. A peer built without them sends `crc == 0`, which this side now rejects, so both ends of an rpmsg_port link (UART or SPI) must be updated together. No in-tree defconfig sets either option. Peers that already had the checksum enabled interoperate unchanged. The documentation of the UART frame format is updated. ## Testing Host: Ubuntu 22.04.5 LTS x86_64, QEMU version 10.2.1, sim: cc (Ubuntu 13.1.0-8ubuntu1~22.04) 13.1.0, qemu-armv8a: aarch64-none-elf-gcc (Arm GNU Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 20221205 **Runtime, rpmsg_port_uart.** `qemu-armv8a:rpserver` + `qemu-armv8a:rpproxy` run two links: server <-> proxy over rptun_ivshmem and server2 <-> proxy2 over rpmsg_port_uart. Both images were built with `LIBC_ENVPATH` and `BINFMT_CHECKEXEC` disabled, which current master needs for nxinit to start nsh there. `rpmsg ping all 10 1024 3 0` on each side, with the two images built from different trees: | server image | proxy image | ivshmem link | port_uart link | |---|---|---|---| | master | master | 10/10 | 10/10 | | this PR | this PR | 10/10 | 10/10 | | master | this PR | 10/10 | 0/10, ret -2007 | With this PR on both sides every UART frame carries and passes the checksum. The mixed row is the incompatibility noted above: the master server sends `crc == 0` and the PR proxy rejects those frames. <details><summary>mixed: master server, PR proxy</summary> ``` [ 8.727573] [ 8] [ EMERG] [server] ping #1 end at 8.727501440: 10 of 10 done, ret 0 [ 25.237904] [ 8] [ EMERG] [server] ping #1 end at 25.237899488: 0 of 10 done, ret -2007 [ 68.615241] [ 9] [ EMERG] [proxy] ping #1 end at 68.615185520: 10 of 10 done, ret 0 [ 85.138299] [ 9] [ EMERG] [proxy] ping #1 end at 85.138291136: 0 of 10 done, ret -2007 ``` </details> **Build, rpmsg_port_spi.** 0 warnings each, with all rpmsg_port objects compiled (`rpmsg_port.c`, `rpmsg_port_spi.c`, `rpmsg_port_spi_slave.c`, `rpmsg_port_uart.c`): - `qemu-armv8a:rpserver` + `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` - the same with `CONFIG_RPMSG_PORT_RETX=n` - `qemu-armv7a:rpserver` with the same SPI options - `sim:rpserver_uart` SPI was not run: no SPI link is available in QEMU or sim. **Baseline.** sim:rpserver/rpproxy and qemu-armv8a:rpserver/rpproxy boot and pass the fixed rpmsg cases (dump, ping, rpmsgfs; 15/15). checkpatch passes. -- 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]
