Skip to content

loader: XDP attach type fallback logic#44209

Merged
ti-mo merged 2 commits intocilium:mainfrom
dylandreimerink:feature/xdp-attach-type-updowngrade
Feb 20, 2026
Merged

loader: XDP attach type fallback logic#44209
ti-mo merged 2 commits intocilium:mainfrom
dylandreimerink:feature/xdp-attach-type-updowngrade

Conversation

@dylandreimerink
Copy link
Member

@dylandreimerink dylandreimerink commented Feb 5, 2026

Due to changes in newer kernels and the cilium/ebpf library, XDP programs will in future be loaded as ebpf.AttachXDP. However, older Cilium versions will have already created links with ebpf.AttachNone programs. The kernel does not allow us to change the program of a link if its attach type does not match.

This means that we can only use the new XDP attach type when a link is newly created. This commit adds logic which detects errors on link update and attempts to load and attach with the other attach type instead. So when upgrading from an older version to a newer version, new links are created as XDP attach type, but existing links will remain using the AttachNone. On downgrade, all links will be created with AttachNone, and existing links will continue to use AttachXDP.

Fixes: #44063

Enable Cilium upgrade and downgrade when existing XDP attach types differ from new XDP programs

@dylandreimerink dylandreimerink added area/loader Impacts the loading of BPF programs into the kernel. release-note/bug This PR fixes an issue in a previous release of Cilium. needs-backport/1.19 This PR / issue needs backporting to the v1.19 branch labels Feb 5, 2026
@dylandreimerink
Copy link
Member Author

/test

@dylandreimerink dylandreimerink force-pushed the feature/xdp-attach-type-updowngrade branch 2 times, most recently from 3740a48 to be08864 Compare February 9, 2026 10:34
@dylandreimerink
Copy link
Member Author

/test

Copy link
Contributor

@ti-mo ti-mo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Left some comments.

@dylandreimerink dylandreimerink force-pushed the feature/xdp-attach-type-updowngrade branch from a48d416 to 885c3c0 Compare February 11, 2026 14:36
@ti-mo ti-mo self-assigned this Feb 19, 2026
@ti-mo ti-mo force-pushed the feature/xdp-attach-type-updowngrade branch from 885c3c0 to 2014352 Compare February 19, 2026 18:57
@ti-mo ti-mo changed the title datapath/loader: Implement XDP attach type fallback logic loader: XDP attach type fallback logic Feb 19, 2026
@ti-mo
Copy link
Contributor

ti-mo commented Feb 19, 2026

/test

dylandreimerink and others added 2 commits February 19, 2026 20:00
Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
Due to changes in newer kernels and the cilium/ebpf library, XDP
programs will in future be loaded as ebpf.AttachXDP. However, older
Cilium versions will have already created links with ebpf.AttachNone
programs. The kernel does not allow us to change the program of a link
if its attach type does not match.

This means that we can only use the new XDP attach type when a link is
newly created. This commit adds logic which detects errors on link
update and attempts to load and attach with the other attach type
instead. So when upgrading from an older version to a newer version,
new links are created as XDP attach type, but existing links will remain
using the AttachNone. On downgrade, all links will be created with
AttachNone, and existing links will continue to use AttachXDP.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
Co-authored-by: Timo Beckers <timo@isovalent.com>
@ti-mo ti-mo force-pushed the feature/xdp-attach-type-updowngrade branch from 2014352 to e7b9529 Compare February 19, 2026 19:00
@ti-mo
Copy link
Contributor

ti-mo commented Feb 19, 2026

/test

@ti-mo ti-mo marked this pull request as ready for review February 20, 2026 12:27
@ti-mo ti-mo requested review from a team as code owners February 20, 2026 12:27
@ti-mo ti-mo enabled auto-merge February 20, 2026 12:27
Copy link
Member

@HadrienPatte HadrienPatte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vendor LGTM

@ti-mo ti-mo added this pull request to the merge queue Feb 20, 2026
Merged via the queue into cilium:main with commit c861775 Feb 20, 2026
91 of 93 checks passed
@ti-mo ti-mo added backport-pending/1.19 The backport for Cilium 1.19.x for this PR is in progress. needs-backport/1.18 This PR / issue needs backporting to the v1.18 branch and removed needs-backport/1.19 This PR / issue needs backporting to the v1.19 branch labels Feb 23, 2026
@ti-mo ti-mo added backport-pending/1.18 The backport for Cilium 1.18.x for this PR is in progress. and removed needs-backport/1.18 This PR / issue needs backporting to the v1.18 branch labels Feb 23, 2026
@github-actions github-actions bot added backport-done/1.18 The backport for Cilium 1.18.x for this PR is done. backport-done/1.19 The backport for Cilium 1.19.x for this PR is done. and removed backport-pending/1.18 The backport for Cilium 1.18.x for this PR is in progress. backport-pending/1.19 The backport for Cilium 1.19.x for this PR is in progress. labels Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/loader Impacts the loading of BPF programs into the kernel. backport-done/1.18 The backport for Cilium 1.18.x for this PR is done. backport-done/1.19 The backport for Cilium 1.19.x for this PR is done. release-note/bug This PR fixes an issue in a previous release of Cilium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XDP program upgrade/downgrade between v1.19 and main broken

4 participants