af-xdp

af-xdp is a skill for Claude Code, Codex from mohitmishra786/low-level-dev-skills. It costs 81 tokens per session (2,140 once invoked), scanned A, original, MIT.

Technical guidance for AF_XDP, a Linux networking interface that lets user-space programs process packets received from a network card. It covers packet rings, shared memory, XDP programs, and copy or zero-copy operation.

In plain words
What is it for?
Use it when creating AF_XDP sockets, configuring UMEM and receive or transmit rings, redirecting XDP traffic, integrating libbpf, comparing copy with zero-copy mode, or building packet processors, load balancers, and intrusion-detection data paths.
Why use it?
It helps developers understand the kernel and user-space parts needed for fast packet processing without relying on raw sockets or the full DPDK framework.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when creating AF_XDP sockets, configuring UMEM and receive or transmit rings, redirecting XDP traffic, integrating libbpf, comparing copy with zero-copy mode, or building packet processors, load balancers, and intrusion-detection data paths.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mohitmishra786/low-level-dev-skills/af-xdp
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mohitmishra786/low-level-dev-skills --skill af-xdp
Clone the repo
git clone --depth 1 https://github.com/mohitmishra786/low-level-dev-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for af-xdp

README.md
[![agentmods](https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/af-xdp/github.svg)](https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/af-xdp)
Your own site
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/af-xdp"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/af-xdp/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for af-xdp

Your own site · 80×15
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/af-xdp"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/af-xdp.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 81 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,140 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00081 $0.02140
Opus 5 $0.00041 $0.01070
Sonnet 5 $0.00016 $0.00428
Haiku 4.5 $0.00008 $0.00214

Measured 11d ago against content hash 143df941c0b9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

af-xdp scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/async-io/af-xdp/SKILL.md · 237 lines

How it starts

The opening of the file, as written. The whole thing — 237 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AF_XDP

Purpose

Guide agents through AF_XDP sockets for high-performance packet I/O: socket creation, UMEM setup, fill/completion/RX/TX rings, XDP programs with XDP_REDIRECT to XSK, copy vs zero-copy modes, libbpf helpers, performance comparison with DPDK, and production use cases.

When to Use

  • Building a userspace packet processor with lower overhead than raw sockets
  • Redirecting XDP-filtered traffic to userspace without DPDK complexity
  • Implementing a custom load balancer or IDS dataplane
  • Comparing zero-copy vs copy mode on your NIC/driver
  • Integrating with existing libbpf/XDP infrastructure
  • Need kernel cooperation (firewall rules) plus userspace processing

Workflow

1. Architecture overview

NIC → XDP program (BPF) → XDP_REDIRECT → AF_XDP socket → userspace
                ↓
           XDP_DROP/PASS/TX

Components:

  • UMEM — shared memory region for frames
  • Fill ring — userspace provides empty frame addresses to kernel
  • Completion ring — kernel returns completed TX frames
  • RX ring — kernel delivers received packets
  • TX ring — userspace submits packets for transmission

2. UMEM and XSK socket creation

#include <bpf/xsk.h>
#include <bpf/libbpf.h>
#include <xdp/xsk.h>

#define NUM_FRAMES     4096
#define FRAME_SIZE     XSK_UMEM__DEFAULT_FRAME_SIZE
#define RX_BATCH_SIZE  64

struct xsk_umem_info {
    struct xsk_ring_prod fill;
    struct xsk_ring_cons comp;
    struct xsk_umem *umem;
    void *buffer;
};

struct xsk_socket_info {
    struct xsk_ring_cons rx;
    struct xsk_ring_prod tx;
    struct xsk_socket *xsk;
};

int xsk_setup(struct xsk_umem_info *umem_info,
              struct xsk_socket_info *xsk_info,
              int ifindex, int queue_id, int xsk_flags)
{
    umem_info->buffer = mmap(NULL, NUM_FRAMES * FRAME_SIZE,
        PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);

    struct xsk_umem_config umem_cfg = {
        .fill_size = XSK_RING_PROD__DEFAULT_NUM_DESCS,
        .comp_size = XSK_RING_CONS__DEFAULT_NUM_DESCS,
        .frame_size = FRAME_SIZE,
        .frame_headroom = XSK_UMEM__DEFAULT_FRAME_HEADROOM,
        .flags = 0,
    };

    int ret = xsk_umem__create(&umem_info->umem, umem_info->buffer,
        NUM_FRAMES * FRAME_SIZE, &umem_info->fill, &umem_info->comp,
        &umem_cfg);
    if (ret)
        return ret;

    struct xsk_socket_config xsk_cfg = {
        .rx_size = XSK_RING_CONS__DEFAULT_NUM_DESCS,
        .tx_size = XSK_RING_PROD__DEFAULT_NUM_DESCS,
        .libbpf_flags = XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD,
        .xdp_flags = XDP_FLAGS_UPDATE_IF_NOEXIST,
        .bind_flags = xsk_flags,  // XDP_ZEROCOPY or XDP_COPY
    };

    return xsk_socket__create(&xsk_info->xsk, "eth0", queue_id,
        umem_info->umem, &xsk_info->rx, &xsk_info->tx, &xsk_cfg);
}

Read the full file on GitHub · 237 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 237 lines · 81 tokens per session scan A 143df941c0b9

Subscribe to this mod's changes

af-xdp is a skill published in the GitHub repository mohitmishra786/low-level-dev-skills (201 stars, last pushed 2mo ago), licensed MIT. It adds 81 tokens to every session and 2,140 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.