Skip to content

bpf: Refactor meta, ipsec/hostdev_ingress#10766

Merged
joestringer merged 3 commits intocilium:masterfrom
joestringer:submit/refactor-bpf-stack-ingress
Apr 7, 2020
Merged

bpf: Refactor meta, ipsec/hostdev_ingress#10766
joestringer merged 3 commits intocilium:masterfrom
joestringer:submit/refactor-bpf-stack-ingress

Conversation

@joestringer
Copy link
Copy Markdown
Member

A couple of non-functional datapath changes:

  • Rename bpf_clear_cb() -> bpf_clear_meta() to be consistent with other meta (cb) functions
  • Combine bpf_ipsec.c and bpf_hostdev_ingress.c, since they were very similar.

@joestringer joestringer added pending-review kind/cleanup This includes no functional changes. release-note/misc This PR makes changes that have no direct user impact. labels Mar 30, 2020
@joestringer joestringer requested review from a team and jrfastab March 30, 2020 21:37
@joestringer joestringer requested review from a team as code owners March 30, 2020 21:37
@joestringer
Copy link
Copy Markdown
Member Author

test-me-please

Comment thread bpf/bpf_hostdev_ingress.c
__u32 magic = ctx_load_meta(ctx, 0);

if (magic == MARK_MAGIC_TO_PROXY) {
if ((magic & MARK_MAGIC_HOST_MASK) == MARK_MAGIC_ENCRYPT) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@jrfastab would we be safe to also use 0xFFFF to mask here? At the moment it's only masking on 0x0F00 so any 0xXEXX value would match.

I refrained from making any changes like this in this PR since it's intended only as a cleanup, no functional changes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this should be OK I can't think of any reason why this wouldn't work.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

followup question for extra points, how confident are you that the CI would pick up a regression if I made this change? ;-)

Comment thread bpf/init.sh
bpf_load $HOST_DEV1 "" "ingress" bpf_hostdev_ingress.c bpf_hostdev_ingress.o to-host $CALLS_MAP
# bpf_ipsec.o is also needed by proxy redirects, so we load it unconditionally
bpf_load $HOST_DEV2 "" "ingress" bpf_ipsec.c bpf_ipsec.o from-netdev $CALLS_MAP
bpf_load $HOST_DEV2 "" "ingress" bpf_hostdev_ingress.c bpf_hostdev_ingress.o to-host $CALLS_MAP
Copy link
Copy Markdown
Member Author

@joestringer joestringer Mar 30, 2020

Choose a reason for hiding this comment

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

We can follow up to avoid the double-compile here (it's already compiled twice in master today).

@coveralls
Copy link
Copy Markdown

coveralls commented Mar 30, 2020

Coverage Status

Coverage increased (+0.02%) to 45.495% when pulling 794c03f on joestringer:submit/refactor-bpf-stack-ingress into b9d2105 on cilium:master.

Copy link
Copy Markdown
Member

@qmonnet qmonnet left a comment

Choose a reason for hiding this comment

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

Looks good, one nit on patch 2. For patch 1, what about updating set_identity_cb() and set_encrypt_key_cb() as well?

Comment thread bpf/bpf_hostdev_ingress.c Outdated
@joestringer joestringer force-pushed the submit/refactor-bpf-stack-ingress branch from 4416490 to 0cca91a Compare April 1, 2020 19:04
@joestringer joestringer requested a review from qmonnet April 1, 2020 19:04
@joestringer joestringer force-pushed the submit/refactor-bpf-stack-ingress branch from 0cca91a to 38aa4db Compare April 1, 2020 19:05
@joestringer
Copy link
Copy Markdown
Member Author

test-me-please

@joestringer
Copy link
Copy Markdown
Member Author

@qmonnet New patch in the middle for your suggestions on identity/encrypt. I patched up the other nit as well.

@joestringer
Copy link
Copy Markdown
Member Author

Full green CI, just need to rebase.

The rest of the functions that interact with the skb->cb refer to it as
'meta', rename this function to be consistent so it's clear that they're
changing the same fields.

Signed-off-by: Joe Stringer <joe@cilium.io>
* set_identity()       -> set_identity_mark()
* set_identity_cb()    -> set_identity_meta()
* set_encrypt_key()    -> set_encrypt_key_mark()
* set_encrypt_key_cb() -> set_encrypt_key_meta()

Signed-off-by: Joe Stringer <joe@cilium.io>
bpf_ipsec.c had a superset of the functionality, handling encryption as
well as proxying, but bpf_hostdev_ingress.c had the better name. Combine
the two for great justice.

Signed-off-by: Joe Stringer <joe@cilium.io>
@joestringer joestringer force-pushed the submit/refactor-bpf-stack-ingress branch from 38aa4db to 794c03f Compare April 2, 2020 18:22
@joestringer
Copy link
Copy Markdown
Member Author

test-me-please

@joestringer
Copy link
Copy Markdown
Member Author

Hit #10838 on regular ginkgo run and #10821 on the 4.19 kernel run. Both are known flakes.

@joestringer
Copy link
Copy Markdown
Member Author

test-me-please

@joestringer joestringer merged commit ae5588c into cilium:master Apr 7, 2020
@joestringer joestringer deleted the submit/refactor-bpf-stack-ingress branch April 7, 2020 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup This includes no functional changes. release-note/misc This PR makes changes that have no direct user impact.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants