]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[riscv] Add optimised TCP/IP checksumming
authorMichael Brown <mcb30@ipxe.org>
Thu, 10 Jul 2025 11:50:00 +0000 (12:50 +0100)
committerMichael Brown <mcb30@ipxe.org>
Thu, 10 Jul 2025 12:32:45 +0000 (13:32 +0100)
commit634d9abefbb896e0c563ede4b6a7df40d0948501
tree7cb4d796a8e74685a69f9cacb87f4953655b5e21
parent101ef74a6e7ed29af42f9d5432504b437e75374d
[riscv] Add optimised TCP/IP checksumming

Add a RISC-V assembly language implementation of TCP/IP checksumming,
which is around 50x faster than the generic algorithm.  The main loop
checksums aligned xlen-bit words, using almost entirely compressible
instructions and accumulating carries in a separate register to allow
folding to be deferred until after all loops have completed.

Experimentation on a C910 CPU suggests that this achieves around four
bytes per clock cycle, which is comparable to the x86 implementation.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/riscv/core/riscv_tcpip.S [new file with mode: 0644]
src/arch/riscv/include/bits/tcpip.h [new file with mode: 0644]