Skip to content

Latest commit

 

History

History
128 lines (90 loc) · 3.25 KB

development.md

File metadata and controls

128 lines (90 loc) · 3.25 KB

How to develop XDP for Windows

Get the code

Clone this repo and ensure all submodules are cloned with the --recursive option:

git clone https://github.com/microsoft/xdp-for-windows.git --recursive

Or, if the repo was already cloned nonrecursively:

git submodule update --init --recursive

Build the code

Prerequisites

  • Visual Studio
    • Visual Studio 2022 is recommended; Visual Studio 2019 or newer is required.
    • Latest Spectre-mitigated libs (via "Individual components" section of Visual Studio Installer)
  • Windows Driver Kit
    • WDK for Windows 11, version 22H2 (version 10.0.22621.x) is recommended; WDK for Windows Server 2022 LTSC or newer is required.
  • LLVM 11.0.1
    • This is required to build eBPF programs. XDP drivers do not require LLVM.
    • The eBPF project is currently incompatible with newer LLVM versions.
  • NuGet Windows x86 Commandline
    • Version 6.3.1 or higher is required by the eBPF-for-Windows project.

Building

Run in a Visual Studio "Developer Command Prompt":

.\tools\build.ps1

Test the code

The test machine must have the "artifacts" and "tools" directories from the repo, either by cloning the repo and building the code or by copying them from another system. The file layout is assumed to be identical to that of the repo.

Running functional tests

One-time setup:

.\tools\prepare-machine.ps1 -ForFunctionalTest

Running the tests:

.\tools\functional.ps1

Querying the list of test cases:

.\tools\functional.ps1 -ListTestCases

Running a specific test case:

.\tools\functional.ps1 -TestCaseFilter "Name=GenericBinding"

After the test, convert the logs:

.\tools\log.ps1 -Convert -Name xdpfunc

Running spinxsk

One-time setup:

.\tools\prepare-machine.ps1 -ForSpinxskTest

Optionally, disable the legacy TDX/TDI driver stack for greater reliability:

#
# Disable TDX and its dependent service NetBT. These drivers are implicated in
# some NDIS control path hangs.
#
reg.exe add HKLM\SYSTEM\CurrentControlSet\Services\netbt /v Start /d 4 /t REG_DWORD /f
reg.exe add HKLM\SYSTEM\CurrentControlSet\Services\tdx /v Start /d 4 /t REG_DWORD /f
shutdown.exe /r /f /t 0

Running the test:

.\tools\spinxsk.ps1 -XdpmpPollProvider FNDIS -QueueCount 2 -Minutes 100

Or, to run until ctrl+c is pressed:

.\tools\spinxsk.ps1 -XdpmpPollProvider FNDIS -QueueCount 2

After the test, convert the logs:

.\tools\log.ps1 -Convert -Name spinxsk

Configuration

XDPMP poll-mode provider

NDIS:

Set-NetAdapterAdvancedProperty -Name XDPMP -RegistryKeyword PollProvider -DisplayValue NDIS
Set-NetAdapterDataPathConfiguration -Name XDPMP -Profile Passive

FNDIS:

Set-NetAdapterAdvancedProperty -Name XDPMP -RegistryKeyword PollProvider -DisplayValue FNDIS