On 2019-09-13 12:21, Laatz, Kevin wrote:
On 13/09/2019 05:59, Björn Töpel wrote:
On Thu, 12 Sep 2019 at 17:47, Kevin Laatz <kevin.laatz@xxxxxxxxx> wrote:
Currently, xsk_umem_adjust_offset exists as a kernel internal function.
This patch adds xsk_umem__adjust_offset to libbpf so that it can be used
from userspace. This will take the responsibility of properly storing
the
offset away from the application, making it less error prone.
Since xsk_umem__adjust_offset is called on a per-packet basis, we
need to
inline the function to avoid any performance regressions. In order to
inline xsk_umem__adjust_offset, we need to add it to xsk.h.
Unfortunately
this means that we can't dereference the xsk_umem_config struct directly
since it is defined only in xsk.c. We therefore add an extra API to
return
the flags field to the user from the structure, and have the inline
function use this flags field directly.
Can you expand this to a series, with an additional patch where these
functions are used in XDP socket sample application, so it's more
clear for users?
These functions are currently not required in the xdpsock application
and I think forcing them in would be messy :-). However, an example of
the use of these functions could be seen in the DPDK AF_XDP PMD. There
is a patch herehttp://patches.dpdk.org/patch/58624/ ; where we currently
do the offset adjustment to the handle manually, but with this patch we
could replace it with xsk_umem__adjust_offset and have a real use
example of the functions being used.
Would this be enough for an example?
Fair enough! :-)
Acked-by: Björn Töpel <bjorn.topel@xxxxxxxxx>
Thanks,
Kevin