[GSoC'20 Weekly Update - Week 1] eBPF XDP Hook
Ankur Kothiwal
ankur at freebsd.org
Wed Jun 10 17:37:13 UTC 2020
Hi all,
Project: Implement eBPF XDP for FreeBSD by extending VirtIO ethernet
driver if_vtnet
The goal of this project is to extend an existing FreeBSD network
driver,VirtIO if_vtnet to be able to call into an eBPF program when
processing a newly received packet. The driver will perform the basic
actions of XDP like PASS and DROP the packet as specified by the
program. The project will also implement new map type and other eBPF
helper functions.The aim of this project is to add new probe sites
into the kernel that will call eBPF functions.
Mentor: Ryan Stone <rstone@> and Hiroki Sato <hrs@>
The aim for the design implementation was to register a struct
ebpf_probe when an interface is registered with pfil(9), and when a
program is attached to the ebpf probe, we will add a hook to the pfil
head for the interface to add a hook we used ebpf_activate_probe()).
But currently it is very specific to syscall probes.
So for the activating probe, we modified the ebpf_activate_probe to be
of general use and moved the syscall related active probe to a new
function ebpf_active_syscall_probe().
When initializing syscall probes, the activate pointer points to the
ebpf_active_sycall_probe() function and when the XDP probe is
registered, the function pointer can be set to a XDP related function.
To register with pfil_add_hook, we used the ebpf_probe_fire() as a
wrapper function to be used as general function and for syscall
related callback we created a new function ebpf_syscall_probe_fire().
Project GSoC Wiki: https://wiki.freebsd.org/SummerOfCodeIdeas#eBPF_XDP_Hooks
Github Repo for the code: https://github.com/rysto32/freebsd/tree/ebpf-import
For above related commits refer:
https://github.com/Ankurk99/freebsd/tree/ebpf-import
Thank you for reading. Please feel free to share your feedback and suggestions.
Thanks and Regards
Ankur Kothiwal
More information about the soc-status
mailing list