diff options
author | Jesper Dangaard Brouer <brouer@redhat.com> | 2020-05-14 13:51:15 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-05-15 07:21:56 +0300 |
commit | 2a637c5b1aaf3b21418fadffad7e56ff27cee6f7 (patch) | |
tree | 4d87b314bcb0fb6fa15411505cb234946b6bb5c4 /include/net/xdp_sock.h | |
parent | d4ecdbf7aa2fa4feac09befb04cdaf44e6dc938b (diff) | |
download | linux-2a637c5b1aaf3b21418fadffad7e56ff27cee6f7.tar.xz |
xdp: For Intel AF_XDP drivers add XDP frame_sz
Intel drivers implement native AF_XDP zerocopy in separate C-files,
that have its own invocation of bpf_prog_run_xdp(). The setup of
xdp_buff is also handled in separately from normal code path.
This patch update XDP frame_sz for AF_XDP zerocopy drivers i40e, ice
and ixgbe, as the code changes needed are very similar. Introduce a
helper function xsk_umem_xdp_frame_sz() for calculating frame size.
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Cc: intel-wired-lan@lists.osuosl.org
Cc: Magnus Karlsson <magnus.karlsson@intel.com>
Link: https://lore.kernel.org/bpf/158945347511.97035.8536753731329475655.stgit@firesoul
Diffstat (limited to 'include/net/xdp_sock.h')
-rw-r--r-- | include/net/xdp_sock.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h index 67191ccaab85..abd72de25fa4 100644 --- a/include/net/xdp_sock.h +++ b/include/net/xdp_sock.h @@ -236,6 +236,12 @@ static inline u64 xsk_umem_adjust_offset(struct xdp_umem *umem, u64 address, else return address + offset; } + +static inline u32 xsk_umem_xdp_frame_sz(struct xdp_umem *umem) +{ + return umem->chunk_size_nohr + umem->headroom; +} + #else static inline int xsk_generic_rcv(struct xdp_sock *xs, struct xdp_buff *xdp) { @@ -366,6 +372,11 @@ static inline u64 xsk_umem_adjust_offset(struct xdp_umem *umem, u64 handle, return 0; } +static inline u32 xsk_umem_xdp_frame_sz(struct xdp_umem *umem) +{ + return 0; +} + static inline int __xsk_map_redirect(struct xdp_sock *xs, struct xdp_buff *xdp) { return -EOPNOTSUPP; |