root/tools/testing/selftests/bpf/progs/xdp_redirect_map.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. SEC
  2. SEC
  3. SEC

   1 // SPDX-License-Identifier: GPL-2.0
   2 
   3 #include <linux/bpf.h>
   4 #include "bpf_helpers.h"
   5 
   6 struct {
   7         __uint(type, BPF_MAP_TYPE_DEVMAP);
   8         __uint(max_entries, 8);
   9         __uint(key_size, sizeof(int));
  10         __uint(value_size, sizeof(int));
  11 } tx_port SEC(".maps");
  12 
  13 SEC("redirect_map_0")
  14 int xdp_redirect_map_0(struct xdp_md *xdp)
  15 {
  16         return bpf_redirect_map(&tx_port, 0, 0);
  17 }
  18 
  19 SEC("redirect_map_1")
  20 int xdp_redirect_map_1(struct xdp_md *xdp)
  21 {
  22         return bpf_redirect_map(&tx_port, 1, 0);
  23 }
  24 
  25 SEC("redirect_map_2")
  26 int xdp_redirect_map_2(struct xdp_md *xdp)
  27 {
  28         return bpf_redirect_map(&tx_port, 2, 0);
  29 }
  30 
  31 char _license[] SEC("license") = "GPL";

/* [<][>][^][v][top][bottom][index][help] */