Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map key size mismatch when using xdp-loader. #25

Closed
stevelorenz opened this issue May 12, 2020 · 3 comments
Closed

Map key size mismatch when using xdp-loader. #25

stevelorenz opened this issue May 12, 2020 · 3 comments

Comments

@stevelorenz
Copy link

Dear developers of xdp-tools,

Thanks so much for your great effort! I am a PhD student and want to implement something using XDP. Therefore, I successfully set up the development environment using xdp-tool and started to follow xdp-tutorial. I mainly want to use the xdp-loader provided by xdp-tool to make loading/unloading stuff easier. When tried basic04 in xdp-tutorial, the xdp-loader does not work properly in pinning the map.

I run following command to load the XDP program on lo interface with a given pin path. It works fine without error (I have checked with xdp-loader status).

xdp-loader load -m skb -p /sys/fs/bpf lo ./xdp_prog_kern.o

Then I can see the map file in /sys/fs/bpf/programs/lo/xdp_pass. Then I modified the xdp-stats.c to use /sys/fs/bpf/programs as pin_dir and xdp_pass as the map name. Then I recompile the xdp_stats and run it with following command:

./xdp_stats --dev lo

It shows the following error:

ERR: check_map_fd_info() Map key size(-677305523) mismatch expected size(4)
ERR: map via FD not compatible 

So the user space program can find the map file but the key size is wrong when calling check_map_fd_info. This example works fine when I use the xdp_loader.c instead of the xdp-loader utility provided by the xdp-tools(xdp_loader.c pins the maps in /sys/fs/bpf/lo/xdp_stats_map).

Am I doing something wrong here? Could you please give me some hints? Thanks so much for your help.

  • xdp-tool version: release: 0.0.3
  • xdp-tutorial version: master:b13cfb8e6bef6c85017bb1ffdf6f2922a87fdb21
@tohojo
Copy link
Member

tohojo commented May 12, 2020

Yeah, xdp-tools assumes somewhat newer versions of most of the BPF infrastructure than the tutorial currently does, so these two are not quite compatible, I'm afraid. The map pinning issue just came up over on xdp-tutorial, actually; see xdp-project/xdp-tutorial#125

@stevelorenz
Copy link
Author

Thanks so much for your response. 😄 I didn't know about this issue. So I will now firstly finish the tutorial using the infrastructure provided in xdp-tutorial. And look at xdp-tools's implementation when I finish the tutorial (So after becoming a XDP advanced newbie 😉 ).

@tohojo
Copy link
Member

tohojo commented May 12, 2020 via email

@tohojo tohojo closed this as completed Sep 28, 2020
astoycos pushed a commit to astoycos/xdp-tools that referenced this issue Nov 2, 2023
* Changed UDS Timeout behaviour
UDS Timeout will now be disabled with a value of -1.
If it is set to 0 or unspecified, it will be set to the default value of 30.
Any value between 30 and 300 will be accepted and remain as is.

* Changed dockerfile to not include iproute2
iproute2 has been removed from the dockerfile as a potential sdl concern

* Added semver range to image Go version
Go version in image should now use latest 1.16 release of Go

* Golint removed from Makefile
Golint has been deprecated and superceded by Golangci-lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants