mirror of
https://github.com/xdp-project/bpf-examples.git
synced 2024-05-06 15:54:53 +00:00
Add edt_pacer01 only containing dummy tc program.
Want to make sure make system works and I can test load this prog. Signed-off-by: Jesper Dangaard Brouer <netoptimizer@brouer.com>
This commit is contained in:
committed by
Jesper Dangaard Brouer
parent
f4846b8297
commit
3ef00744da
@@ -1,7 +1,7 @@
|
|||||||
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
|
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
|
||||||
|
|
||||||
USER_TARGETS :=
|
USER_TARGETS :=
|
||||||
BPF_TARGETS := pacer01
|
BPF_TARGETS := edt_pacer01
|
||||||
|
|
||||||
LIB_DIR = ../lib
|
LIB_DIR = ../lib
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ include $(LIB_DIR)/common.mk
|
|||||||
# creating maps
|
# creating maps
|
||||||
#
|
#
|
||||||
.PHONY: strip_tc_obj
|
.PHONY: strip_tc_obj
|
||||||
strip_tc_obj: ${BPF_TARGETS :=.o}
|
strip_tc_obj: ${BPF_TARGETS:=.o}
|
||||||
$(Q) llvm-strip --no-strip-all --remove-section .BTF $?
|
$(Q) llvm-strip --no-strip-all --remove-section .BTF $?
|
||||||
|
|
||||||
all: strip_tc_obj
|
all: strip_tc_obj
|
||||||
|
|||||||
28
traffic-pacing-edt/edt_pacer01.c
Normal file
28
traffic-pacing-edt/edt_pacer01.c
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#include <linux/bpf.h>
|
||||||
|
#include <bpf/bpf_helpers.h>
|
||||||
|
#include <xdp/parsing_helpers.h>
|
||||||
|
|
||||||
|
char _license[] SEC("license") = "GPL";
|
||||||
|
|
||||||
|
SEC("classifier") int tc_dummy(struct __sk_buff *skb)
|
||||||
|
{
|
||||||
|
volatile void *data, *data_end;
|
||||||
|
int ret = BPF_OK;
|
||||||
|
struct ethhdr *eth;
|
||||||
|
|
||||||
|
data = (void *)(long)skb->data;
|
||||||
|
data_end = (void *)(long)skb->data_end;
|
||||||
|
eth = (struct ethhdr *)data;
|
||||||
|
|
||||||
|
if (data + sizeof(*eth) > data_end)
|
||||||
|
return BPF_DROP;
|
||||||
|
|
||||||
|
/* Keep ARP resolution working */
|
||||||
|
if (eth->h_proto == bpf_htons(ETH_P_ARP)) {
|
||||||
|
ret = BPF_OK;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user