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: L3 cleanups #23876
bpf: L3 cleanups #23876
Conversation
/test |
/test-1.16-4.19 |
1 similar comment
/test-1.16-4.19 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanups! One tiny comment, and the rest looks good to me.
Extract a helper for the shared logic between IPv4 and IPv6. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
l3_csum_replace() can be used in two ways: a) updating the packet's checksum after modifying a specific header field to a new value. b) updating the packet's checksum with an opaque diff, eg. after updating multiple fields. Add corresponding wrappers, so we don't have to worry about setting up all the parameter correctly. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
This code path modifies the .saddr and .daddr fields. Calculate & apply the corresponding csum diff in one go, thus saving one call to l3_csum_update() and avoiding an intermittent L3 header revalidation. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
e9e00b1
to
eefff62
Compare
Removed some trivial |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup! Small nit, not blocking, just in case you need to rebase or make other changes anyway
@@ -48,7 +63,7 @@ static __always_inline int ipv4_dec_ttl(struct __ctx_buff *ctx, int off, | |||
|
|||
new_ttl = ttl - 1; | |||
/* l3_csum_replace() takes at min 2 bytes, zero extended. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This comment doesn't make sense anymore with the new function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I would say it still makes sense, but refers to an implementation detail of ipv4_csum_update_by_value, which might be not obvious to a reader.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I was unsure what to do with this, so left it for now. Maybe turn it into proper documentation for ipv4_csum_update_by_value()
.
-> marking ready-to-merge |
Some L3-related cleanups that have accumulated. The csum helpers follow the usage outlined in the
l3_csum_replace()
man page.