Skip to content

Commit

Permalink
add rxfilter perf test to CI (#771)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfriesen authored Dec 19, 2024
1 parent 880a6d2 commit 56fb133
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 1 deletion.
46 changes: 45 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,50 @@ jobs:
path: artifacts/logs
if-no-files-found: ignore

rxfilter_perf_tests:
name: RX Filter Perf Tests
needs: [build]
strategy:
fail-fast: false
matrix:
windows: [Prerelease]
configuration: [Release]
platform: [x64, arm64]
runs-on:
- self-hosted
- "1ES.Pool=xdp-ci-perf${{ matrix.platform != 'x64' && format('-{0}', matrix.platform) || '' }}-gh"
- "1ES.ImageOverride=WS${{ matrix.windows }}${{ matrix.platform != 'x64' && format('-{0}', matrix.platform) || '' }}"
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
sparse-checkout: |
tools
- name: Download Artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
with:
name: bin_${{ matrix.configuration }}_${{ matrix.platform }}
path: artifacts/bin
- name: Check Drivers
shell: PowerShell
run: tools/check-drivers.ps1 -Config ${{ matrix.configuration }} -Platform ${{ matrix.platform }} -Verbose
- name: Prepare Machine
shell: PowerShell
run: tools/prepare-machine.ps1 -ForPerfTest -Platform ${{ matrix.platform }} -RequireNoReboot -Verbose
- name: Run rxfilter (drop)
shell: PowerShell
run: tools/rxfilterperf.ps1 -Config ${{ matrix.configuration }} -Platform ${{ matrix.platform }} -Verbose -Fndis -QueueCount 4 -Action Drop
- name: Upload Logs
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
if: ${{ always() }}
with:
name: logs_rxfilter_win${{ matrix.windows }}_${{ matrix.configuration }}_${{ matrix.platform }}
path: artifacts/logs
if-no-files-found: ignore
- name: Check Drivers
shell: PowerShell
run: tools/check-drivers.ps1 -Config ${{ matrix.configuration }} -Platform ${{ matrix.platform }} -Verbose

downlevel_functional_tests:
name: Downlevel Functional Tests
needs: build
Expand Down Expand Up @@ -560,7 +604,7 @@ jobs:
Complete:
name: Complete
if: always()
needs: [build, build_allpackage, onebranch_build_validation, functional_tests, stress_tests, pktfuzz_tests, perf_tests, ring_perf_tests, xskfwdkm_test, downlevel_functional_tests, create_artifacts]
needs: [build, build_allpackage, onebranch_build_validation, functional_tests, stress_tests, pktfuzz_tests, perf_tests, ring_perf_tests, rxfilter_perf_tests, xskfwdkm_test, downlevel_functional_tests, create_artifacts]
runs-on: ubuntu-latest
permissions: {} # No need for any permissions.
steps:
Expand Down
100 changes: 100 additions & 0 deletions tools/rxfilterperf.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
param (
[Parameter(Mandatory = $false)]
[ValidateSet("Debug", "Release")]
[string]$Config = "Debug",

[Parameter(Mandatory = $false)]
[ValidateSet("x64", "arm64")]
[string]$Platform = "x64",

[Parameter(Mandatory = $false)]
[ValidateSet("System", "Generic", "Native")]
[string]$XdpMode = "System",

[Parameter(Mandatory = $false)]
[int]$QueueCount = 1,

[Parameter(Mandatory = $false)]
[int]$Timeout = 30,

[Parameter(Mandatory=$false)]
[switch]$Fndis = $false,

[Parameter(Mandatory = $false)]
[string]$Action = "Drop"
)

Set-StrictMode -Version 'Latest'
$ErrorActionPreference = 'Stop'

# Important paths.
$RootDir = Split-Path $PSScriptRoot -Parent
. $RootDir\tools\common.ps1
$ArtifactsDir = Get-ArtifactBinPath -Config $Config -Platform $Platform
$LogsDir = "$RootDir\artifacts\logs"
$RxFilter = "$ArtifactsDir\test\rxfilter.exe"

# Ensure the output path exists.
New-Item -ItemType Directory -Force -Path $LogsDir | Out-Null
$RxFilterProcess = $null

$XdpmpPollProvider = "NDIS"
if ($Fndis) {
$XdpmpPollProvider = "FNDIS"
}

try {
if ($Fndis) {
Write-Verbose "installing fndis..."
& "$RootDir\tools\setup.ps1" -Install fndis -Config $Config -Platform $Platform
Write-Verbose "installed fndis."
}

Write-Verbose "installing xdp..."
& "$RootDir\tools\setup.ps1" -Install xdp -Config $Config -Platform $Platform
Write-Verbose "installed xdp."

Write-Verbose "installing xdpmp..."
& "$RootDir\tools\setup.ps1" -Install xdpmp -XdpmpPollProvider $XdpmpPollProvider -Config $Config -Platform $Platform
Write-Verbose "installed xdpmp."

Write-Verbose "Set-NetAdapterRss XDPMP -NumberOfReceiveQueues $QueueCount"
Set-NetAdapterRss XDPMP -NumberOfReceiveQueues $QueueCount

& "$RootDir\tools\log.ps1" -Start -Name rxfiltercpu -Profile CpuCswitchSample.Verbose -Config $Config -Platform $Platform

$ArgList = `
"-IfIndex", (Get-NetAdapter -Name XDPMP).ifIndex, `
"-QueueId", "*", "-MatchType" ,"All", "-Action", $Action, `
"-XdpMode", $XdpMode
Write-Verbose "$RxFilter $ArgList"
$RxFilterProcess = Start-Process $RxFilter -PassThru -ArgumentList $ArgList

& $RootDir\tools\xdpmpratesim.ps1 -AdapterName XDPMP -Unlimited

Write-Verbose "Start XDP counters:"
Get-Counter ((Get-Counter -ListSet XDP*).Paths) -ErrorAction Ignore | Out-String | Write-Verbose

$StartPackets = (Get-NetAdapterStatistics -Name XDPMP).ReceivedUnicastPackets
Start-Sleep -Seconds $Timeout
$EndPackets = (Get-NetAdapterStatistics -Name XDPMP).ReceivedUnicastPackets

Write-Verbose "End XDP counters:"
Get-Counter ((Get-Counter -ListSet XDP*).Paths) -ErrorAction Ignore | Out-String | Write-Verbose

& $RootDir\tools\xdpmpratesim.ps1 -AdapterName XDPMP -RxFramesPerInterval 1000

Write-Output "Filtered $(($EndPackets - $StartPackets)) packets in $Timeout seconds ($(($EndPackets - $StartPackets) / 1000 / $Timeout) Kpps)."
} finally {
if ($RxFilterProcess) {
Stop-Process -InputObject $RxFilterProcess
}

& "$RootDir\tools\log.ps1" -Stop -Name rxfiltercpu -Config $Config -Platform $Platform -ErrorAction 'Continue'

& "$RootDir\tools\setup.ps1" -Uninstall xdpmp -Config $Config -Platform $Platform -ErrorAction 'Continue'
& "$RootDir\tools\setup.ps1" -Uninstall xdp -Config $Config -Platform $Platform -ErrorAction 'Continue'
if ($Fndis) {
& "$RootDir\tools\setup.ps1" -Uninstall fndis -Config $Config -Platform $Platform -ErrorAction 'Continue'
}
}

0 comments on commit 56fb133

Please sign in to comment.