xdp-for-windows
Copilot instructions492 starsChanged 7 months agoMITView on GitHub
XDP for Windows is a high-performance Windows packet processing framework inspired by Linux XDP. It enables sending and receiving network packets at high rates by bypassing most of the OS networking stack. Key facts: - Languages: C (kernel drivers), C++ (user-mode tests/samples), PowerShell (build/test scripts) - Frameworks: Windows Driver Kit (WDK), NDIS, TAEF (test framework) - Target: Windows Server 2019/2022 and Prerelease builds, x64 and arm64 platforms - Build Tool: MSBuild via Visual Studio Developer Command Prompt Always run builds…
In this repositoryOne other file it gives its agents.
- xdp-testingSkill
The file
We split this copilot-instructions.md into the rules it gives an agent
11 rules. About 0 are common, 2 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 53
Important: Use /nodeReuse:false to avoid cached state issues with WDK's build tasks.
- Very specific: line 62
All testing must occur on a separate test machine.
- Distinctive: line 134
When adding functional tests:
- Very specific: line 135
Add test implementation to test/functional/lib/tests.cpp
- Very specific: line 136
Add function declaration to test/functional/lib/tests.h
- Very specific: line 137
Add TAEF wrapper to test/functional/taef/tests.cpp using TEST_METHOD or TEST_METHOD_PRERELEASE
- Very specific: line 156
Build fails with WDK task errors: Add /nodeReuse:false to msbuild command
- Distinctive: line 158
Missing submodules: Run git submodule update --init --recursive
- Very specific: line 159
NuGet restore fails: Ensure tools/nuget.config is used via /p:RestoreConfigFile=tools/nuget.config
- Very specific: line 164
File Editing: Always read the file before editing to ensure you have the exact context (whitespace, indentation) for replace_string_in_file.
- Very specific: line 165
GUID generation: Always use New-Guid in PowerShell or uuidgen.exe to generate new GUIDs.
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Copilot Instructions for XDP for Windows
Repository Overview
XDP for Windows is a high-performance Windows packet processing framework inspired by Linux XDP. It enables sending and receiving network packets at high rates by bypassing most of the OS networking stack.
Key facts:
- Languages: C (kernel drivers), C++ (user-mode tests/samples), PowerShell (build/test scripts)
- Frameworks: Windows Driver Kit (WDK), NDIS, TAEF (test framework)
- Target: Windows Server 2019/2022 and Prerelease builds, x64 and arm64 platforms
- Build Tool: MSBuild via Visual Studio Developer Command Prompt
Build Instructions
Prerequisites
- Visual Studio 2022+ with:
- "Desktop development with C++" workload
- Latest Spectre-mitigated libs
- C++ Address Sanitizer
- C++ Clang Compiler for Windows
- NuGet CLI 6.3.1+
- Git submodules initialized (
git submodule update --init --recursive)
Building
Always run builds from a Visual Studio Developer Command Prompt.
- Prepare the machine (downloads dependencies):
.\tools\prepare-machine.ps1 -ForBuild - Restore NuGet packages (required before every build if packages changed):
msbuild.exe xdp.sln /t:restore /p:RestoreConfigFile=tools/nuget.config /p:Configuration=Debug /p:Platform=x64 - Prepare for eBPF compilation (if building eBPF programs):
.\tools\prepare-machine.ps1 -ForEbpfBuild - Build the solution:
msbuild xdp.sln /m /p:Configuration=Debug /p:Platform=x64 /p:SignMode=TestSign /p:IsAdmin=true /nodeReuse:false
Or use the convenience script:
.\tools\build.ps1Important: Use /nodeReuse:false to avoid cached state issues with WDK's build tasks.
Build Configurations
- Config:
DebugorRelease - Platform:
x64orarm64 - Build artifacts:
artifacts\bin\{Platform}_{Config}\
Testing
All testing must occur on a separate test machine. Do not try to run
tests locally. Always pass -ComputerName <machine> explicitly on
every test command — see the xdp-testing skill below.
For everything else about test execution and bugcheck recovery
(remote PowerShell setup, kd attach over named pipe, the
inject/build/bugcheck/.reboot/check-drivers -Force recovery loop,
how to derive default test parameters from CI, the persist-until-clean
recovery doctrine, opt-in -Force recovery flags), use the
xdp-testing skill. The skill is
auto-loaded whenever an agent runs any tools\*.ps1 test or recovery
command, attaches kd, or analyzes a bugcheck.
Quick reference for the most common scripts:
.\tools\functional.ps1 -ComputerName <machine> -ListTestCases
.\tools\functional.ps1 -ComputerName <machine> -TestCaseFilter "Name=GenericBinding"
.\tools\spinxsk.ps1 -ComputerName <machine> -Minutes 5
.\tools\check-drivers.ps1 -ComputerName <machine> -ForceProject Layout
xdp.sln # Main solution file
src/ # Source code
xdp/ # Core XDP driver (xdp.sys)
xdplwf/ # LWF (Lightweight Filter) driver
xdpapi/ # User-mode API library (deprecated, use header-only API)
xdpetw/ # ETW manifest
xdpinstaller/ # MSI installer
xdpruntime/ # Runtime packaging
published/external/ # Public API headers
afxdp.h # AF_XDP socket API
afxdp_experimental.h # Experimental AF_XDP features
xdpapi.h # XDP control API
xdp/ # XDP kernel/user shared definitions
test/ # Test code
functional/ # TAEF functional tests
lib/tests.cpp # Test implementation
taef/tests.cpp # TAEF wrappers
spinxsk/ # Stress test tool
xdpmp/ # Test miniport driver
samples/ # Sample applications
rxfilter/ # RX filtering sample
xskfwd/ # XSK forwarding sample
tools/ # PowerShell scripts
build.ps1 # Build script
functional.ps1 # Functional test runner
prepare-machine.ps1 # Machine setup
setup.ps1 # Component installation
submodules/ # Git submodules
cxplat/ # Cross-platform utilities
ndis-driver-library/ # NDIS helpers
wil/ # Windows Implementation LibrariesCI Pipeline
GitHub Actions CI runs on pull requests (.github/workflows/ci.yml):
- Build: Debug/Release × x64/arm64
- Functional Tests: Windows 2022/Prerelease
- Stress Tests (spinxsk): With driver verifier and fault injection
- Performance Tests: XSK perf, ring perf, RX filter perf
- Fuzz Tests: Packet parsing fuzzer (pktfuzz)
- CodeQL: Security analysis (on scheduled runs)
CI uses test-signed drivers and requires test signing enabled on test machines.
Adding Tests
When adding functional tests:
- Add test implementation to
test/functional/lib/tests.cpp - Add function declaration to
test/functional/lib/tests.h - Add TAEF wrapper to
test/functional/taef/tests.cppusingTEST_METHODorTEST_METHOD_PRERELEASE
Pattern: Copy existing similar tests (e.g., GenericRxChecksumOffload* for RX offload tests).
Key Files for Common Changes
- RX data path:
src/xdplwf/recv.c,src/xdp/rx.c - TX data path:
src/xdplwf/send.c,src/xdp/tx.c - XSK sockets:
src/xdp/xsk.c - Public APIs:
published/external/headers
Version Information
- Current version:
src/xdp.props(XdpMajorVersion, XdpMinorVersion, XdpPatchVersion) - eBPF dependency:
src/xdp.props(XdpEbpfVersion) - WDK version:
src/xdp.props(XdpWdkVersion)
Troubleshooting
- Build fails with WDK task errors: Add
/nodeReuse:falseto msbuild command - Test signing required: The code can't be run on developer machines.
- Missing submodules: Run
git submodule update --init --recursive - NuGet restore fails: Ensure
tools/nuget.configis used via/p:RestoreConfigFile=tools/nuget.config
Development Environment Notes
- No
grep: The environment is Windows (PowerShell). Do not try to rungrepin the terminal. Use thegrep_searchtool orSelect-String(viarun_in_terminal) instead. - File Editing: Always read the file before editing to ensure you have the exact context (whitespace, indentation) for
replace_string_in_file. Never guess the content of a file; exact matching is required for search-and-replace operations. - GUID generation: Always use
New-Guidin PowerShell oruuidgen.exeto generate new GUIDs. Do not attempt to create GUIDs using any other method.
Trust These Instructions
These instructions are validated. Only search the codebase if information here is incomplete or found to be in error during execution.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

