Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consume ebpf 0.20.0 and clean up #759

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions published/external/xdp/ebpfhook.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@
extern "C" {
#endif

//
// Older versions of eBPF defined conflicting versions of XDP structures.
// Define XDP versions only if eBPF has not already defined them.
//

#ifndef XDP_EXT_HELPER_FN_BASE

typedef struct xdp_md_ {
void *data; ///< Pointer to start of packet data.
void *data_end; ///< Pointer to end of packet data.
Expand Down Expand Up @@ -51,8 +44,6 @@ xdp_hook_t(
xdp_md_t *context
);

#endif // XDP_EXT_HELPER_FN_BASE

#ifdef __cplusplus
} // extern "C"
#endif
Expand Down
12 changes: 3 additions & 9 deletions src/xdp.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@
<ResolveNuGetPackages>false</ResolveNuGetPackages>
<HostPlatform>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)</HostPlatform>
<XdpWdkVersion>10.0.26100.2161</XdpWdkVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' != 'x64'">
<RestoreAdditionalProjectSources>$(SolutionDir)artifacts/nuget</RestoreAdditionalProjectSources>
<XdpEbpfVersion>0.20.0</XdpEbpfVersion>
</PropertyGroup>
<ItemGroup>
<!-- eBPF currently has separate packages for each architecture. -->
<PackageReference Include="eBPF-for-Windows" Version="0.18.0" GeneratePathProperty="true" Condition="'$(ImportEbpf)' == 'true' AND '$(Platform)' == 'x64'"/>
<PackageReference Include="eBPF-for-Windows.arm64" Version="0.20.0" GeneratePathProperty="true" Condition="'$(ImportEbpf)' == 'true' AND '$(Platform)' != 'x64'"/>
<PackageReference Include="eBPF-for-Windows.x64" Version="0.20.0" GeneratePathProperty="true" Condition="'$(ImportEbpf)' == 'true' AND '$(Platform)' != 'x64'"/>
<PackageReference Include="eBPF-for-Windows.$(Platform)" Version="$(XdpEbpfVersion)" GeneratePathProperty="true" Condition="'$(ImportEbpf)' == 'true'"/>
<PackageReference Include="eBPF-for-Windows.$(HostPlatform)" Version="$(XdpEbpfVersion)" GeneratePathProperty="true" Condition="'$(ImportEbpf)' == 'true' AND '$(HostPlatform)' != '$(Platform)'"/>
<PackageReference Include="Microsoft.Build.Tasks.Git" Version="1.0.0" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="1.0.0" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.SourceLink.Common" Version="1.0.0" />
Expand All @@ -37,7 +34,4 @@
<PropertyGroup>
<WntPackagePath>$(Pkgwin-net-test)\</WntPackagePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'x64'">
<EbpfHostBinPath>$(EbpfBinPath)</EbpfHostBinPath>
</PropertyGroup>
</Project>
10 changes: 3 additions & 7 deletions tools/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function Get-EbpfInstallPath {
}

function Get-EbpfMsiVersion {
return "0.18.0"
return "0.20.0"
}

# Returns the eBPF MSI full path
Expand All @@ -116,7 +116,7 @@ function Get-EbpfMsiFullPath {
)
$RootDir = Split-Path $PSScriptRoot -Parent
$EbpfVersion = Get-EbpfMsiVersion
return "$RootDir\artifacts\ebpfmsi\ebpf-for-windows.$EbpfVersion.$Platform.msi"
return "$RootDir\artifacts\ebpfmsi\ebpf-for-windows.$Platform.$EbpfVersion.msi"
}

function Get-EbpfMsiUrl {
Expand All @@ -125,11 +125,7 @@ function Get-EbpfMsiUrl {
[string]$Platform
)
$EbpfVersion = Get-EbpfMsiVersion -Platform $Platform
if ($Platform -eq "x64") {
return "https://github.com/microsoft/ebpf-for-windows/releases/download/Release-v$EbpfVersion/ebpf-for-windows.$EbpfVersion.msi"
} else {
return "https://github.com/microsoft/xdp-for-windows/releases/download/main-prerelease/ebpf-for-windows.$Platform.0.20.0.msi"
}
return "https://github.com/microsoft/ebpf-for-windows/releases/download/Release-v$EbpfVersion/ebpf-for-windows.$Platform.$EbpfVersion.msi"
}

function Get-FnVersion {
Expand Down
42 changes: 1 addition & 41 deletions tools/prepare-machine.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ $RootDir = Split-Path $PSScriptRoot -Parent
. $RootDir\tools\common.ps1

$ArtifactsDir = "$RootDir\artifacts"
$NugetDir = "$ArtifactsDir/nuget"

if (!$ForBuild -and !$ForEbpfBuild -and !$ForTest -and !$ForFunctionalTest -and !$ForSpinxskTest -and !$ForPerfTest -and !$ForLogging) {
Write-Error 'Must one of -ForBuild, -ForTest, -ForFunctionalTest, -ForSpinxskTest, -ForPerfTest, or -ForLogging'
Expand Down Expand Up @@ -116,36 +115,6 @@ function Download-CoreNet-Deps {
}
}

function Download-eBpf-Nuget {
param (
[Parameter()]
[string]$Platform
)
# Download private eBPF Nuget package.
$EbpfNugetVersion = "eBPF-for-Windows.$Platform.0.20.0"
$EbpfNugetBuild = ""
$EbpfNuget = "$EbpfNugetVersion$EbpfNugetBuild.nupkg"
$EbpfNugetUrl = "https://github.com/microsoft/xdp-for-windows/releases/download/main-prerelease/$EbpfNugetVersion$EbpfNugetBuild.nupkg"
$EbpfNugetRestoreDir = "$RootDir/packages/$EbpfNugetVersion"

if ($Force -and (Test-Path $NugetDir)) {
Remove-Item -Recurse -Force $NugetDir
}
if (!(Test-Path $NugetDir)) {
mkdir $NugetDir | Write-Verbose
}

if (!(Test-Path $NugetDir/$EbpfNuget)) {
# Remove any old builds of the package.
if (Test-Path $EbpfNugetRestoreDir) {
Remove-Item -Recurse -Force $EbpfNugetRestoreDir
}
Remove-Item -Force $NugetDir/$EbpfNugetVersion*

Invoke-WebRequest-WithRetry -Uri $EbpfNugetUrl -OutFile $NugetDir/$EbpfNuget
}
}

function Download-Ebpf-Msi {
# Download and extract private eBPF installer MSI package.
$EbpfMsiFullPath = Get-EbpfMsiFullPath -Platform $Platform
Expand Down Expand Up @@ -259,16 +228,7 @@ if ($Cleanup) {
}
} else {
if ($ForBuild) {
if (!(Test-Path $NugetDir)) {
mkdir $NugetDir | Write-Verbose
}

if ($Platform -eq "arm64") {
# Download prerelease versions for arm64, and a matching x64 for
# local cross-compile (bpf2c) binaries.
Download-eBpf-Nuget -Platform arm64
Download-eBpf-Nuget -Platform x64
}
# There are currently no pre-build steps required.
}

if ($ForEbpfBuild) {
Expand Down
Loading