bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: xdp/bpf application getting unexpected ENOTSOCK
@ 2022-11-24 15:21 Chris Ward
  2022-11-25 11:53 ` Chris Ward
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Ward @ 2022-11-24 15:21 UTC (permalink / raw)
  To: bpf

The reason was a mismatch between the levels of libxdp and libbpf in
use. To fix this it was necessary to add -fPIC to the CFLAGS when
building libbpf. I have raised a PR
https://github.com/libbpf/libbpf/pull/631 with the fix and a little
more detail as to why I need it. Please review and merge.

Chris Ward, IBM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: xdp/bpf application getting unexpected ENOTSOCK
  2022-11-24 15:21 xdp/bpf application getting unexpected ENOTSOCK Chris Ward
@ 2022-11-25 11:53 ` Chris Ward
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Ward @ 2022-11-25 11:53 UTC (permalink / raw)
  To: bpf

After more debugging, the reason turned out to be related to the level
of libxdp called out by the bpf-examples. 'master' level of libxdp
works; the first commit level of libxdp that works for me is
tjcw@tjcw-KVM:~/workspace/bpf-examples/lib/xdp-tools$ git bisect old
b572cd6b5a6462280db389b94586c2b5450887a9 is the first new commit
commit b572cd6b5a6462280db389b94586c2b5450887a9
Author: Magnus Karlsson <magnus.karlsson@intel.com>
Date:   Mon Sep 12 12:32:26 2022 +0000

    xsk: remove unused variable outstanding_tx

    Remove the unused variable outstanding_tx.

    Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>

 lib/libxdp/xsk.c | 2 --
 1 file changed, 2 deletions(-)
tjcw@tjcw-KVM:~/workspace/bpf-examples/lib/xdp-tools$

I believe Toke is going to adjust the submodule level of libxdp that
is selected for bpf-examples to use.

On Thu, 24 Nov 2022 at 15:21, Chris Ward <tjcw01@gmail.com> wrote:
>
> The reason was a mismatch between the levels of libxdp and libbpf in
> use. To fix this it was necessary to add -fPIC to the CFLAGS when
> building libbpf. I have raised a PR
> https://github.com/libbpf/libbpf/pull/631 with the fix and a little
> more detail as to why I need it. Please review and merge.
>
> Chris Ward, IBM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: xdp/bpf application getting unexpected ENOTSOCK
  2022-11-24 10:25 Chris Ward
@ 2022-11-24 10:42 ` Chris Ward
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Ward @ 2022-11-24 10:42 UTC (permalink / raw)
  To: bpf

I have just tried running the test case again, in a freshly-installed
Ubuntu 22.10 VM. I have checked out the 'latest' xdp-project/xdp-tools
and run 'make install' for libbpf and libxdp.
This time I get a trace which ends with
+ export LD_LIBRARY_PATH=/usr/local/lib
+ LD_LIBRARY_PATH=/usr/local/lib
+ ns2_pid=6487
+ sleep 20
+ ./af_xdp_user -S -d vpeer2 -Q 1 --filename ./af_xdp_kern.o
main cfg.filename=./af_xdp_kern.o
main Opening program file ./af_xdp_kern.o
libxdp: Couldn't find xdp program in bpf object
main xdp_prog=0xfffffffffffffffe

What am I doing wrong?

Chris Ward, IBM

On Thu, 24 Nov 2022 at 10:25, Chris Ward <tjcw01@gmail.com> wrote:
>
> I am writing a bpf/xdp example which I hope to put in
> xdp-project/bpf-examples when it is done. But I am finding that I get
> an unexpected ENOTSOCK return code from a bpf_map_update_elem function
> call. My test case is here
> https://github.com/tjcw/bpf-examples/tree/tjcw-integration-0.3/AF_XDP-filter
> ; see its README.md for what it does.
>
> I have a matching test case here
> https://github.com/tjcw/xdp-tutorial/tree/master/ebpf-filter which
> works normally.
>
> The problem may be a diffent libbpf level; the AF_XDP_filter version
> of the test case is running with libbpf set up by "git submodule
> update --init", where the ebpf-filter version has libbpf set up by the
> 'bleeding edge' libbpf being checked out at ~tjcw/workspace. I will
> try again with more careful version control.
>
> The last few lines written by the test case are
> libbpf: elf: skipping unrecognized data section(7) xdp_metadata
> libbpf: elf: skipping unrecognized data section(7) xdp_metadata
> xsk_socket__create_shared_named_prog returns 0
> bpf_map_update_elem(9,0x7ffcaea02670,0x7ffcaea02674,0)
> bpf_map_update_elem returns -88
> ERROR: Cannot set up socket 0
> ERROR: Can't setup AF_XDP sockets "Socket operation on non-socket"
>
> the full log of the test case is available here
> https://github.com/libbpf/libbpf/issues/630
>
> Thanks for any light you can throw on the issue !
>
> Chris Ward, IBM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* xdp/bpf application getting unexpected ENOTSOCK
@ 2022-11-24 10:25 Chris Ward
  2022-11-24 10:42 ` Chris Ward
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Ward @ 2022-11-24 10:25 UTC (permalink / raw)
  To: bpf

I am writing a bpf/xdp example which I hope to put in
xdp-project/bpf-examples when it is done. But I am finding that I get
an unexpected ENOTSOCK return code from a bpf_map_update_elem function
call. My test case is here
https://github.com/tjcw/bpf-examples/tree/tjcw-integration-0.3/AF_XDP-filter
; see its README.md for what it does.

I have a matching test case here
https://github.com/tjcw/xdp-tutorial/tree/master/ebpf-filter which
works normally.

The problem may be a diffent libbpf level; the AF_XDP_filter version
of the test case is running with libbpf set up by "git submodule
update --init", where the ebpf-filter version has libbpf set up by the
'bleeding edge' libbpf being checked out at ~tjcw/workspace. I will
try again with more careful version control.

The last few lines written by the test case are
libbpf: elf: skipping unrecognized data section(7) xdp_metadata
libbpf: elf: skipping unrecognized data section(7) xdp_metadata
xsk_socket__create_shared_named_prog returns 0
bpf_map_update_elem(9,0x7ffcaea02670,0x7ffcaea02674,0)
bpf_map_update_elem returns -88
ERROR: Cannot set up socket 0
ERROR: Can't setup AF_XDP sockets "Socket operation on non-socket"

the full log of the test case is available here
https://github.com/libbpf/libbpf/issues/630

Thanks for any light you can throw on the issue !

Chris Ward, IBM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-25 11:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-24 15:21 xdp/bpf application getting unexpected ENOTSOCK Chris Ward
2022-11-25 11:53 ` Chris Ward
  -- strict thread matches above, loose matches on Subject: below --
2022-11-24 10:25 Chris Ward
2022-11-24 10:42 ` Chris Ward

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).