On Wed, Oct 30, 2024 at 7:27 AM Stanislav Fomichev sdf@fomichev.me wrote:
The goal of the series is to simplify and make it possible to use ncdevmem in an automated way from the ksft python wrapper.
ncdevmem is slowly mutated into a state where it uses stdout to print the payload and the python wrapper is added to make sure the arrived payload matches the expected one.
v6:
- fix compilation issue in 'Unify error handling' patch (Jakub)
Since I saw a compilation failures on a couple of iterations I cherry-picked this locally and tested compilation. I'm seeing this:
sudo CFLAGS="-static" make -C ./tools/testing/selftests/drivers/net/hw TARGETS=ncdevmem 2>&1 make: Entering directory '/usr/local/google/home/almasrymina/cos-kernel/tools/testing/selftests/drivers/net/hw' CC ncdevmem In file included from ncdevmem.c:63: /usr/local/google/home/almasrymina/cos-kernel/tools/testing/selftests/../../../tools/net/ynl/generated/ethtool-user.h:23:43: warning: ‘enum ethtool_header_flags’ declared inside parameter list will not be visible outside of this definition or declaration 23 | const char *ethtool_header_flags_str(enum ethtool_header_flags value); | ^~~~~~~~~~~~~~~~~~~~ /usr/local/google/home/almasrymina/cos-kernel/tools/testing/selftests/../../../tools/net/ynl/generated/ethtool-user.h:25:41: warning: ‘enum ethtool_module_fw_flash_status’ declared inside parameter list will not be visible outside of this definition or declaration 25 | ethtool_module_fw_flash_status_str(enum ethtool_module_fw_flash_status value); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/google/home/almasrymina/cos-kernel/tools/testing/selftests/../../../tools/net/ynl/generated/ethtool-user.h:6766:45: error: field ‘status’ has incomplete type 6766 | enum ethtool_module_fw_flash_status status; | ^~~~~~ ncdevmem.c: In function ‘do_server’: ncdevmem.c:517:37: error: storage size of ‘token’ isn’t known 517 | struct dmabuf_token token; | ^~~~~ ncdevmem.c:542:47: error: ‘SCM_DEVMEM_DMABUF’ undeclared (first use in this function) 542 | (cm->cmsg_type != SCM_DEVMEM_DMABUF && | ^~~~~~~~~~~~~~~~~ ncdevmem.c:542:47: note: each undeclared identifier is reported only once for each function it appears in ncdevmem.c:543:47: error: ‘SCM_DEVMEM_LINEAR’ undeclared (first use in this function) 543 | cm->cmsg_type != SCM_DEVMEM_LINEAR)) { | ^~~~~~~~~~~~~~~~~ ncdevmem.c:557:52: error: invalid use of undefined type ‘struct dmabuf_cmsg’ 557 | dmabuf_cmsg->frag_size); | ^~ ncdevmem.c:562:56: error: invalid use of undefined type ‘struct dmabuf_cmsg’ 562 | token.token_start = dmabuf_cmsg->frag_token; | ^~ ncdevmem.c:566:42: error: ‘SO_DEVMEM_DONTNEED’ undeclared (first use in this function) 566 | SO_DEVMEM_DONTNEED, &token, | ^~~~~~~~~~~~~~~~~~ ncdevmem.c:573:56: error: invalid use of undefined type ‘struct dmabuf_cmsg’ 573 | token.token_start = dmabuf_cmsg->frag_token; | ^~ ncdevmem.c:576:54: error: invalid use of undefined type ‘struct dmabuf_cmsg’ 576 | total_received += dmabuf_cmsg->frag_size; | ^~ ncdevmem.c:579:44: error: invalid use of undefined type ‘struct dmabuf_cmsg’ 579 | dmabuf_cmsg->frag_offset >> PAGE_SHIFT, | ^~ ncdevmem.c:580:44: error: invalid use of undefined type ‘struct dmabuf_cmsg’ 580 | dmabuf_cmsg->frag_offset % getpagesize(), | ^~ ncdevmem.c:581:44: error: invalid use of undefined type ‘struct dmabuf_cmsg’ 581 | dmabuf_cmsg->frag_offset, | ^~ ncdevmem.c:582:44: error: invalid use of undefined type ‘struct dmabuf_cmsg’ 582 | dmabuf_cmsg->frag_size, dmabuf_cmsg->frag_token, | ^~ ncdevmem.c:582:68: error: invalid use of undefined type ‘struct dmabuf_cmsg’ 582 | dmabuf_cmsg->frag_size, dmabuf_cmsg->frag_token, | ^~ ncdevmem.c:583:60: error: invalid use of undefined type ‘struct dmabuf_cmsg’ 583 | total_received, dmabuf_cmsg->dmabuf_id); | ^~ ncdevmem.c:585:40: error: invalid use of undefined type ‘struct dmabuf_cmsg’ 585 | if (dmabuf_cmsg->dmabuf_id != dmabuf_id) | ^~ ncdevmem.c:589:40: error: invalid use of undefined type ‘struct dmabuf_cmsg’ 589 | if (dmabuf_cmsg->frag_size % getpagesize()) | ^~ ncdevmem.c:595:65: error: invalid use of undefined type ‘struct dmabuf_cmsg’ 595 | dmabuf_cmsg->frag_offset, | ^~ ncdevmem.c:596:65: error: invalid use of undefined type ‘struct dmabuf_cmsg’ 596 | dmabuf_cmsg->frag_size); | ^~ ncdevmem.c:601:60: error: invalid use of undefined type ‘struct dmabuf_cmsg’ 601 | dmabuf_cmsg->frag_offset, | ^~ ncdevmem.c:602:52: error: invalid use of undefined type ‘struct dmabuf_cmsg’ 602 | dmabuf_cmsg->frag_size); | ^~ ncdevmem.c:604:73: error: invalid use of undefined type ‘struct dmabuf_cmsg’ 604 | print_nonzero_bytes(tmp_mem, dmabuf_cmsg->frag_size); | ^~ make: *** [../../../lib.mk:222: /usr/local/google/home/almasrymina/cos-kernel/tools/testing/selftests/drivers/net/hw/ncdevmem] Error 1 make: Leaving directory '/usr/local/google/home/almasrymina/cos-kernel/tools/testing/selftests/drivers/net/hw'
The errors are still there even without the CFLAGS="-static". Can you take a look before merge?