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

TCX ebpf hook support #102

Merged
merged 8 commits into from
Oct 23, 2024
Merged

TCX ebpf hook support #102

merged 8 commits into from
Oct 23, 2024

Conversation

msherif1234
Copy link
Contributor

@msherif1234 msherif1234 commented Aug 13, 2024

fixes #92

  • define few APIs for TCX program type
  • add TCX operator and agent controller and ut
  • add TCX support to bpfapplication controller
  • add TCX intg test

depends on: bpfman/bpfman#1222

Copy link

codecov bot commented Aug 13, 2024

Codecov Report

Attention: Patch coverage is 27.29084% with 365 lines in your changes missing coverage. Please review.

Project coverage is 27.60%. Comparing base (7e4a74b) to head (aa3840d).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
...client/clientset/typed/apis/v1alpha1/tcxprogram.go 0.00% 97 Missing ⚠️
...entset/typed/apis/v1alpha1/fake/fake_tcxprogram.go 0.00% 63 Missing ⚠️
controllers/bpfman-agent/tcx-program.go 60.46% 43 Missing and 8 partials ⚠️
controllers/bpfman-operator/tcx-program.go 25.92% 38 Missing and 2 partials ⚠️
apis/v1alpha1/zz_generated.deepcopy.go 58.90% 28 Missing and 2 partials ⚠️
controllers/bpfman-agent/application-program.go 0.00% 27 Missing ⚠️
...lient/externalversions/apis/v1alpha1/tcxprogram.go 0.00% 21 Missing ⚠️
pkg/client/apis/v1alpha1/tcxprogram.go 0.00% 16 Missing ⚠️
cmd/bpfman-agent/main.go 0.00% 6 Missing ⚠️
cmd/bpfman-operator/main.go 0.00% 6 Missing ⚠️
... and 4 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #102      +/-   ##
==========================================
- Coverage   27.61%   27.60%   -0.02%     
==========================================
  Files          81       87       +6     
  Lines        6999     7499     +500     
==========================================
+ Hits         1933     2070     +137     
- Misses       4877     5228     +351     
- Partials      189      201      +12     
Flag Coverage Δ
unittests 27.60% <27.29%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@anfredette anfredette 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 except for the couple of comments. I think we should consider adding a priority option even if we don't support it right away. I like the idea of using labels to define an order, but I just don't see how it would work for tcx programs included in a BpfApplication CRD.

apis/v1alpha1/tcxProgram_types.go Outdated Show resolved Hide resolved
apis/v1alpha1/tcxProgram_types.go Show resolved Hide resolved
@msherif1234 msherif1234 marked this pull request as draft August 13, 2024 22:08
@msherif1234 msherif1234 changed the title WIP: initial APIs for new TCX ebpf hook WIP: TCX ebpf hook support Aug 14, 2024
Copy link
Contributor

mergify bot commented Aug 20, 2024

@msherif1234, this pull request is now in conflict and requires a rebase.

anfredette added a commit to anfredette/bpfman that referenced this pull request Aug 28, 2024
This PR introduces support for TCX based on the current implementation
in the astoycos Aya TCX branch. While minor API changes are
anticipated before Aya TCX merges, these are expected to be cosmetic
and should not significantly affect bpfman.

The PR implements a priority-based API, similar to the existing TC
API, with a key difference: TCX does not support "proceed_on"
configuration as it's not available in the kernel API. Flow
continuation is determined by the return value of the current program.

It's important to note that neither the Aya nor the kernel APIs
directly support priority. They utilize a relative positioning system,
requiring new TCX programs to be placed relative to existing ones. To
maintain usability across multiple independent applications, we’ve
preserved a TC-like priority API in bpfman, which internally maps to
Aya’s relative-ordering API.

This PR also adds an integration test and example programs for TCX,
which have been successfully tested with Mohammed’s TCX bpfman-operator
PR (bpfman/bpfman-operator#102).

Additionally, due to TCX's requirement for kernel version 6.6 or
higher, GitHub Actions have been updated to use ubuntu-24.04.

Signed-off-by: Andre Fredette <[email protected]>
anfredette added a commit to anfredette/bpfman that referenced this pull request Sep 6, 2024
This PR introduces support for TCX based on the current implementation
in the astoycos Aya TCX branch. While minor API changes are
anticipated before Aya TCX merges, these are expected to be cosmetic
and should not significantly affect bpfman.

The PR implements a priority-based API, similar to the existing TC
API, with a key difference: TCX does not support "proceed_on"
configuration as it's not available in the kernel API. Flow
continuation is determined by the return value of the current program.

It's important to note that neither the Aya nor the kernel APIs
directly support priority. They utilize a relative positioning system,
requiring new TCX programs to be placed relative to existing ones. To
maintain usability across multiple independent applications, we’ve
preserved a TC-like priority API in bpfman, which internally maps to
Aya’s relative-ordering API.

This PR also adds an integration test and example programs for TCX,
which have been successfully tested with Mohammed’s TCX bpfman-operator
PR (bpfman/bpfman-operator#102).

Additionally, due to TCX's requirement for kernel version 6.6 or
higher, GitHub Actions have been updated to use ubuntu-24.04.

Signed-off-by: Andre Fredette <[email protected]>
anfredette added a commit to anfredette/bpfman that referenced this pull request Oct 7, 2024
This PR introduces support for TCX based on the current implementation
in the astoycos Aya TCX branch. While minor API changes are
anticipated before Aya TCX merges, these are expected to be cosmetic
and should not significantly affect bpfman.

The PR implements a priority-based API, similar to the existing TC
API, with a key difference: TCX does not support "proceed_on"
configuration as it's not available in the kernel API. Flow
continuation is determined by the return value of the current program.

It's important to note that neither the Aya nor the kernel APIs
directly support priority. They utilize a relative positioning system,
requiring new TCX programs to be placed relative to existing ones. To
maintain usability across multiple independent applications, we’ve
preserved a TC-like priority API in bpfman, which internally maps to
Aya’s relative-ordering API.

This PR also adds an integration test and example programs for TCX,
which have been successfully tested with Mohammed’s TCX bpfman-operator
PR (bpfman/bpfman-operator#102).

Additionally, due to TCX's requirement for kernel version 6.6 or
higher, GitHub Actions have been updated to use ubuntu-24.04.

Signed-off-by: Andre Fredette <[email protected]>
anfredette added a commit to anfredette/bpfman that referenced this pull request Oct 9, 2024
This PR introduces support for TCX based on the current implementation
in the astoycos Aya TCX branch. While minor API changes are
anticipated before Aya TCX merges, these are expected to be cosmetic
and should not significantly affect bpfman.

The PR implements a priority-based API, similar to the existing TC
API, with a key difference: TCX does not support "proceed_on"
configuration as it's not available in the kernel API. Flow
continuation is determined by the return value of the current program.

It's important to note that neither the Aya nor the kernel APIs
directly support priority. They utilize a relative positioning system,
requiring new TCX programs to be placed relative to existing ones. To
maintain usability across multiple independent applications, we’ve
preserved a TC-like priority API in bpfman, which internally maps to
Aya’s relative-ordering API.

This PR also adds an integration test and example programs for TCX,
which have been successfully tested with Mohammed’s TCX bpfman-operator
PR (bpfman/bpfman-operator#102).

Additionally, due to TCX's requirement for kernel version 6.6 or
higher, GitHub Actions have been updated to use ubuntu-24.04.

Signed-off-by: Andre Fredette <[email protected]>
Signed-off-by: Mohamed Mahmoud <[email protected]>
Signed-off-by: Mohamed Mahmoud <[email protected]>
Signed-off-by: Mohamed Mahmoud <[email protected]>
@msherif1234 msherif1234 changed the title WIP: TCX ebpf hook support TCX ebpf hook support Oct 21, 2024
@msherif1234 msherif1234 marked this pull request as ready for review October 21, 2024 21:40
@msherif1234
Copy link
Contributor Author

intg test seems to broken because of bpfman/bpfman#1324

@anfredette
Copy link
Contributor

anfredette commented Oct 22, 2024 via email


pods, err := env.Cluster().Client().CoreV1().Pods(tcxGoCounterUserspaceNs).List(ctx, metav1.ListOptions{LabelSelector: "name=go-tcx-counter"})
require.NoError(t, err)
gotcCounterPod := pods.Items[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

Should gotcCounterPod be gotcxCounterPod?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

require.NoError(t, err)
t.Logf("counter pod log %s", output.String())

return doTcCheck(t, output)
Copy link
Contributor

Choose a reason for hiding this comment

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

doTcxCheck?

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like we need a doTcxCheck() function. This is probably working because the tc test is also running and there are logs from that test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reused the Tc check since both look for the same string might be better to have one for tcx will do

Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't the TCX program have "TCX" in the log instead of "TC"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, I just looked, and it doesn't. I think it should, though. That's probably another reason I changed the TC, TCX, and XDP logs in the app counter example.

Copy link
Contributor

Choose a reason for hiding this comment

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

We can do that in a separate pr, though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or not. They're all in separate pods, so I guess it's clear. Sorry for the stream of consciousness as I remember how all this stuff works :-).

// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[0].reason`
// +kubebuilder:printcolumn:name="Direction",type=string,JSONPath=`.spec.direction`,priority=1
// +kubebuilder:printcolumn:name="InterfaceSelector",type=string,JSONPath=`.spec.interfaceselector`,priority=1
// +kubebuilder:printcolumn:name="Position",type=string,JSONPath=`.spec.position`,priority=1
Copy link
Contributor

Choose a reason for hiding this comment

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

Include the following as in Tc:
// +kubebuilder:printcolumn:name="Priority",type=string,JSONPath=.spec.priority,priority=1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok I had b4 we added pri to tcx will include

Copy link
Contributor

@anfredette anfredette left a comment

Choose a reason for hiding this comment

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

Mostly a few nits. I think the only real issue is the doTcxCheck() comment. Otherwise, this is looking good.

Signed-off-by: Mohamed Mahmoud <[email protected]>
@msherif1234
Copy link
Contributor Author

Mostly a few nits. I think the only real issue is the doTcxCheck() comment. Otherwise, this is looking good.
This isn't an issue since both log the same strings but I created one for tcx check to be more specific

Copy link
Contributor

@anfredette anfredette left a comment

Choose a reason for hiding this comment

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

/LGTM

@mergify mergify bot merged commit 0c0ba31 into bpfman:main Oct 23, 2024
16 checks passed
msherif1234 pushed a commit to msherif1234/bpfman-operator that referenced this pull request Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Operator support for TCX
2 participants