From b199742d735d79551258e50a02b7cc2e88738b2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Wed, 20 Jan 2021 14:31:50 -0800 Subject: [PATCH] add placeholder ebpf programs for XDP tethering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test: atest, TreeHugger, the programs load Signed-off-by: Maciej Żenczykowski Change-Id: Idcacf0502719336c1b6a959fe6b782f2bce9d6b5 --- Tethering/bpf_progs/offload.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Tethering/bpf_progs/offload.c b/Tethering/bpf_progs/offload.c index 9d2aec45f4..cce94ee5d8 100644 --- a/Tethering/bpf_progs/offload.c +++ b/Tethering/bpf_progs/offload.c @@ -293,5 +293,30 @@ DEFINE_BPF_PROG("schedcls/tether_upstream4_rawip", AID_ROOT, AID_NETWORK_STACK, return TC_ACT_OK; } +// ----- XDP Support ----- + +#define DEFINE_XDP_PROG(str, func) \ + DEFINE_BPF_PROG_KVER(str, AID_ROOT, AID_NETWORK_STACK, func, KVER(5, 9, 0))(struct xdp_md *ctx) + +DEFINE_XDP_PROG("xdp/tether_downstream_ether", + xdp_tether_downstream_ether) { + return XDP_PASS; +} + +DEFINE_XDP_PROG("xdp/tether_downstream_rawip", + xdp_tether_downstream_rawip) { + return XDP_PASS; +} + +DEFINE_XDP_PROG("xdp/tether_upstream_ether", + xdp_tether_upstream_ether) { + return XDP_PASS; +} + +DEFINE_XDP_PROG("xdp/tether_upstream_rawip", + xdp_tether_upstream_rawip) { + return XDP_PASS; +} + LICENSE("Apache 2.0"); CRITICAL("netd");