Re: Per CPU map not being transferred to user space

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think I found the problem. It is necessary to run the statistics
display application in the same network namespace where the user level
filter and the eBPF kernel code are running; I think even in the same
'ip netns exec' instance.

On Wed, 30 Nov 2022 at 13:58, Chris Ward <tjcw01@xxxxxxxxx> wrote:
>
> I have a test case similar to code in xdp-project/xdp-tutorial/ which
> maintains a statistic map in a per-cpu array, and user-space code
> which displays the statistics periodically.
>
> When I run this, the user space code always displays zeros. I have
> instrumented my eBPF kernel code with bpf_trace_printk and it appears
> to be putting the correct values into the map. The user code is
> iterating over all possible CPUs, but is always finding zeros in the
> per-cpu array slots.
>
> Can anybody tell me what is going wrong ?
>
> My test case is here
> https://github.com/tjcw/bpf-examples/tree/tjcw-integration-1.2-ebpftrace/AF_XDP-filter
> ; af_xdp_kern.c is the eBPF code, af_xdp_user.c is the userspace code
> which drives the eBPF code, and filter-xdp_stats.c is the code which
> should display the statistics. It all builds with 'make' in that
> directory, and there is a run script which I use with
> tjcw@r28b29-n10:~/workspace/bpf-examples/AF_XDP-filter/netperf-namespace$
> sudo FILTER=af_xdp_kern ./run.sh
> to run the user code and eBPF code with data being transferred between
> 2 network namespaces on the machine.
> While it is running,
> tjcw@r28b29-n10:~/workspace/bpf-examples/AF_XDP-filter$ sudo
> ./filter-xdp_stats
> should display statistics, but in fact displays zeros.
>
> My test case is coded to the '1.0' BPF interface, where the code in
> xdp-tutorial is coded to the pre-release BPF interface.
>
> Thanks for all the help you can give !
>
> Chris Ward, IBM



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux