This directory contains solutions to all the assignments in the basic01, basic02, basic03, and basic04 lessons.
This lesson doesn’t contain any assignments except to repeat the steps listed in the lesson readme file.
No code is needed, just repeat the steps listed in the assignment description.
Just add the following section to the xdp_prog_kern.c program and follow the steps listed in the assignment description:
SEC("xdp_abort") int xdp_abort_func(struct xdp_md *ctx) { return XDP_ABORTED; } The solutions to all three assignments can be found in the following files:
- The common_kern_user.h file contains the new structure
datarecdefinition. - The xdp_prog_kern.c file contains the new
xdp_stats_mapmap definition and the updatedxdp_stats_record_actionfunction.
Note that for use in later lessons/assignments the code was moved to the following files: xdp_stats_kern_user.h and xdp_stats_kern.h. So in order to use the xdp_stats_record_action function in later XDP programs, just include the following header files:
#include "../common/xdp_stats_kern_user.h" #include "../common/xdp_stats_kern.h"
For a user-space application, only the former header is needed.
See the xdp_stats.c program in this directory.
See the xdp_loader.c program in this directory.