
Write Your First XDP Program to Drop Packets
Write, compile and attach an XDP program in C that drops UDP packets for one port, with the bounds checks the verifier demands and a test you can run.
Tag
255 posts

Write, compile and attach an XDP program in C that drops UDP packets for one port, with the bounds checks the verifier demands and a test you can run.

Raise the alignment of variables, structs and heap buffers with __attribute__((aligned(n))), alignas and aligned_alloc for cache lines, SIMD and DMA.

Linux splits interrupt work into a fast top half and a deferred bottom half. See what belongs in each, the four mechanisms, and how they trade latency and cost.

Remove struct padding with __attribute__((packed)) to match a wire format, then see the unaligned-access cost, the pointer warning and the memcpy alternative.

Copy .data from flash and zero .bss in a Cortex-M reset handler without bugs: alignment, the memset trap, empty sections and a debugger check to run.

Register, use and release an interrupt handler with request_irq and free_irq in a Linux 6.12 platform driver, with flags, return codes and common errors.

Rewrite float reductions, indirect gathers and early-exit loops in C so GCC and Clang vectorize them, using partial sums and blocked scans.

How a device tree compatible list is written, why the most specific name comes first, and how the kernel scores matches. Covers fallback strings and modaliases.

Send fixed-size messages between Zephyr threads and from ISRs with k_msgq, using K_MSGQ_DEFINE, put and get with timeouts, peek, purge and sizing rules.

Write a complete GNU ld linker script for an STM32F407: MEMORY regions, vector table, .text, .data with AT>, .bss, heap and stack reserve, and link-time checks.

Build a Quartus Prime Lite 23.1 project for a Cyclone IV E board from the command line with a QSF file, an SDC clock constraint, quartus_sh and quartus_pgm.

Enable nested virtualization on a KVM host, pass the vmx or svm flag to a guest with -cpu host and start a second-level VM, with the checks that prove it works.