-
Notifications
You must be signed in to change notification settings - Fork 3k
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
bpf: ipv6: optimize ipv6_addr_copy() #30029
Merged
julianwiedmann
merged 2 commits into
cilium:main
from
julianwiedmann:1.16-bpf-ipv6-addr-copy
Jan 11, 2024
Merged
bpf: ipv6: optimize ipv6_addr_copy() #30029
julianwiedmann
merged 2 commits into
cilium:main
from
julianwiedmann:1.16-bpf-ipv6-addr-copy
Jan 11, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
julianwiedmann
added
sig/datapath
Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
release-note/misc
This PR makes changes that have no direct user impact.
kind/complexity-issue
Relates to BPF complexity or program size issues
feature/ipv6
Relates to IPv6 protocol support
labels
Dec 21, 2023
/ci-verifier |
julianwiedmann
force-pushed
the
1.16-bpf-ipv6-addr-copy
branch
2 times, most recently
from
December 21, 2023 13:58
a2fbd16
to
616dafe
Compare
/ci-verifier |
julianwiedmann
force-pushed
the
1.16-bpf-ipv6-addr-copy
branch
2 times, most recently
from
December 21, 2023 14:35
4ff0d33
to
a240e26
Compare
/ci-verifier |
julianwiedmann
force-pushed
the
1.16-bpf-ipv6-addr-copy
branch
from
December 21, 2023 14:50
a240e26
to
cc1931c
Compare
/test |
Seen in verifier log where byte-by-byte copy happens: [...] ; if (nat_46x64) { 404: (16) if w5 == 0x1 goto pc+2437 ; R5=scalar(umax=4294967295,var_off=(0x0; 0xffffffff)) ; dst->d1 = src->d1; 405: (71) r2 = *(u8 *)(r1 +8) ; R1_w=pkt(off=0,r=40,imm=0) R2_w=scalar(umax=255,var_off=(0x0; 0xff)) 406: (71) r3 = *(u8 *)(r1 +9) ; R1_w=pkt(off=0,r=40,imm=0) R3_w=scalar(umax=255,var_off=(0x0; 0xff)) 407: (67) r3 <<= 8 ; R3_w=scalar(umax=65280,var_off=(0x0; 0xff00)) 408: (4f) r3 |= r2 ; R2_w=scalar(umax=255,var_off=(0x0; 0xff)) R3_w=scalar() 409: (71) r4 = *(u8 *)(r1 +10) ; R1_w=pkt(off=0,r=40,imm=0) R4_w=scalar(umax=255,var_off=(0x0; 0xff)) 410: (71) r2 = *(u8 *)(r1 +11) ; R1_w=pkt(off=0,r=40,imm=0) R2_w=scalar(umax=255,var_off=(0x0; 0xff)) 411: (67) r2 <<= 8 ; R2_w=scalar(umax=65280,var_off=(0x0; 0xff00)) 412: (4f) r2 |= r4 ; R2_w=scalar() R4_w=scalar(umax=255,var_off=(0x0; 0xff)) 413: (67) r2 <<= 16 ; R2_w=scalar(smax=9223372036854710272,umax=18446744073709486080,var_off=(0x0; 0xffffffffffff0000),s32_max=2147418112,u32_max=-65536) 414: (4f) r2 |= r3 ; R2_w=scalar() R3_w=scalar() 415: (71) r3 = *(u8 *)(r1 +13) ; R1_w=pkt(off=0,r=40,imm=0) R3_w=scalar(umax=255,var_off=(0x0; 0xff)) 416: (64) w3 <<= 8 ; R3_w=scalar(umax=65280,var_off=(0x0; 0xff00)) 417: (71) r4 = *(u8 *)(r1 +12) ; R1_w=pkt(off=0,r=40,imm=0) R4_w=scalar(umax=255,var_off=(0x0; 0xff)) 418: (4c) w3 |= w4 ; R3_w=scalar() R4_w=scalar(umax=255,var_off=(0x0; 0xff)) 419: (71) r4 = *(u8 *)(r1 +15) ; R1_w=pkt(off=0,r=40,imm=0) R4_w=scalar(umax=255,var_off=(0x0; 0xff)) 420: (64) w4 <<= 8 ; R4_w=scalar(umax=65280,var_off=(0x0; 0xff00)) 421: (71) r5 = *(u8 *)(r1 +14) ; R1_w=pkt(off=0,r=40,imm=0) R5_w=scalar(umax=255,var_off=(0x0; 0xff)) 422: (4c) w4 |= w5 ; R4_w=scalar() R5_w=scalar(umax=255,var_off=(0x0; 0xff)) 423: (64) w4 <<= 16 ; R4_w=scalar(umax=4294901760,var_off=(0x0; 0xffff0000),s32_max=2147418112) 424: (4c) w4 |= w3 ; R3_w=scalar() R4_w=scalar() 425: (67) r4 <<= 32 ; R4_w=scalar(smax=9223372032559808512,umax=18446744069414584320,var_off=(0x0; 0xffffffff00000000),s32_min=0,s32_max=0,u32_max=0) 426: (4f) r4 |= r2 ; R2_w=scalar() R4_w=scalar() ; dst->d1 = src->d1; 427: (7b) *(u64 *)(r10 -264) = r4 ; R4_w=scalar() R10=fp0 fp-264_w=mmmmmmmm ; dst->d2 = src->d2; [...] Signed-off-by: Daniel Borkmann <[email protected]> [jwi: add ipv6_addr_copy_unaligned() to tolerate some unaligned access] Signed-off-by: Julian Wiedmann <[email protected]>
Clean up some open-coded copy operations, so that they benefit from the optimizations in ipv6_addr_copy(). Signed-off-by: Julian Wiedmann <[email protected]>
julianwiedmann
force-pushed
the
1.16-bpf-ipv6-addr-copy
branch
from
January 8, 2024 11:46
cc1931c
to
9b81dd9
Compare
/test |
(fresh rebase to pick up the latest complexity test improvements) |
borkmann
approved these changes
Jan 11, 2024
maintainer-s-little-helper
bot
added
the
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
label
Jan 11, 2024
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
feature/ipv6
Relates to IPv6 protocol support
kind/complexity-issue
Relates to BPF complexity or program size issues
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
release-note/misc
This PR makes changes that have no direct user impact.
sig/datapath
Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refresh the optimization from #24341, it's a nice gain for IPv6 already.