hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/samples/bpf/xdp_tx_iptunnel_kern.c
....@@ -16,22 +16,22 @@
1616 #include <linux/if_vlan.h>
1717 #include <linux/ip.h>
1818 #include <linux/ipv6.h>
19
-#include "bpf_helpers.h"
19
+#include <bpf/bpf_helpers.h>
2020 #include "xdp_tx_iptunnel_common.h"
2121
22
-struct bpf_map_def SEC("maps") rxcnt = {
23
- .type = BPF_MAP_TYPE_PERCPU_ARRAY,
24
- .key_size = sizeof(__u32),
25
- .value_size = sizeof(__u64),
26
- .max_entries = 256,
27
-};
22
+struct {
23
+ __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
24
+ __type(key, __u32);
25
+ __type(value, __u64);
26
+ __uint(max_entries, 256);
27
+} rxcnt SEC(".maps");
2828
29
-struct bpf_map_def SEC("maps") vip2tnl = {
30
- .type = BPF_MAP_TYPE_HASH,
31
- .key_size = sizeof(struct vip),
32
- .value_size = sizeof(struct iptnl_info),
33
- .max_entries = MAX_IPTNL_ENTRIES,
34
-};
29
+struct {
30
+ __uint(type, BPF_MAP_TYPE_HASH);
31
+ __type(key, struct vip);
32
+ __type(value, struct iptnl_info);
33
+ __uint(max_entries, MAX_IPTNL_ENTRIES);
34
+} vip2tnl SEC(".maps");
3535
3636 static __always_inline void count_tx(u32 protocol)
3737 {