mirror of
https://github.com/torvalds/linux.git
synced 2026-04-24 09:35:52 -04:00
- create new netns - create veth pair (veTX+veRX) - setup AF_XDP socket for both interfaces - attach bpf to veRX - send packet via veTX - verify the packet has expected metadata at veRX Cc: John Fastabend <john.fastabend@gmail.com> Cc: David Ahern <dsahern@gmail.com> Cc: Martin KaFai Lau <martin.lau@linux.dev> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Willem de Bruijn <willemb@google.com> Cc: Jesper Dangaard Brouer <brouer@redhat.com> Cc: Anatoly Burakov <anatoly.burakov@intel.com> Cc: Alexander Lobakin <alexandr.lobakin@intel.com> Cc: Magnus Karlsson <magnus.karlsson@gmail.com> Cc: Maryam Tahhan <mtahhan@redhat.com> Cc: xdp-hints@xdp-project.net Cc: netdev@vger.kernel.org Signed-off-by: Stanislav Fomichev <sdf@google.com> Link: https://lore.kernel.org/r/20230119221536.3349901-12-sdf@google.com Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
24 lines
495 B
C
24 lines
495 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include <vmlinux.h>
|
|
#include "xdp_metadata.h"
|
|
#include <bpf/bpf_helpers.h>
|
|
#include <bpf/bpf_endian.h>
|
|
|
|
extern int bpf_xdp_metadata_rx_hash(const struct xdp_md *ctx,
|
|
__u32 *hash) __ksym;
|
|
|
|
int called;
|
|
|
|
SEC("freplace/rx")
|
|
int freplace_rx(struct xdp_md *ctx)
|
|
{
|
|
u32 hash = 0;
|
|
/* Call _any_ metadata function to make sure we don't crash. */
|
|
bpf_xdp_metadata_rx_hash(ctx, &hash);
|
|
called++;
|
|
return XDP_PASS;
|
|
}
|
|
|
|
char _license[] SEC("license") = "GPL";
|