Skip to content

Commit 714f1ec

Browse files
committed
packet02: in xdp_parser_func use xdp_stats header helpers
This adds xdp_stats_map to packet02 --progsec xdp_packet_parser, that can be read via the xdp_stats tool. Signed-off-by: Jesper Dangaard Brouer <[email protected]>
1 parent 64d550b commit 714f1ec

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packet02-rewriting/xdp_prog_kern.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
// The parsing helper functions from the packet01 lesson have moved here
88
#include "../common/parsing_helpers.h"
99

10+
/* Defines xdp_stats_map */
11+
#include "../common/xdp_stats_kern_user.h"
12+
#include "../common/xdp_stats_kern.h"
13+
1014
/* Pops the outermost VLAN tag off the packet. Returns the popped VLAN ID on
1115
* success or -1 on failure.
1216
*/
@@ -141,7 +145,7 @@ int xdp_parser_func(struct xdp_md *ctx)
141145
action = XDP_DROP;
142146
}
143147
out:
144-
return action;
148+
return xdp_stats_record_action(ctx, action);
145149
}
146150

147151
char _license[] SEC("license") = "GPL";

0 commit comments

Comments
 (0)