CV-Bowen opened a new pull request, #22482:
URL: https://github.com/apache/nuttx/pull/22482

   ## Summary
   
   The SPI port receivers skip the CRC check of a frame whose `crc` field is 0,
   so a frame whose checksum happens to compute to 0 is sent as "no checksum"
   and never validated.
   
   `drivers/rpmsg/rpmsg_port_spi: never send a zero CRC`: send 1 in that case,
   so a zero `crc` field only means the sender did not compute one.
   `rpmsg_port_spi_crc16()` becomes a function (it was a macro) to hold the
   fold without evaluating the checksum twice.
   
   ## Impact
   
   - With `CONFIG_RPMSG_PORT_SPI_CRC` (selected by `RPMSG_PORT_RETX`, the
     default): a frame whose checksum is 0 now carries 1. A receiver without
     this change still accepts it (it skips the comparison when it computes
     0), so the two sides do not need to be updated together.
   - Without CRC: no change.
   
   ## Testing
   
   Host: Ubuntu 22.04.5 LTS x86_64.
   
   No in-tree configuration enables the SPI port drivers, so the 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 the 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 the commit.
   


-- 
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]

Reply via email to