Skip to content

Latest commit

 

History

History
130 lines (91 loc) · 3.06 KB

development.md

File metadata and controls

130 lines (91 loc) · 3.06 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 or newer is required.

    during installation, ensure the following packages/components are installed:

    • "Desktop development with C++" (via "Workload")
    • Latest Spectre-mitigated libs (via "Individual components")
    • C++ Address Sanitizer (via "Individual components")
    • C++ Clang Compiler for Windows
  • 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.
  • 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