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

fix: multiple xdp attach to one iface #27

Merged
merged 2 commits into from
Nov 30, 2023

Conversation

mojtaba-esk
Copy link
Member

Closes #22

This PR uses the chaining multiple XDP programs method. In reality we load only one xdp_main program which calls the underlying programs in a sequence if a packet is passed by the first program it goes through the next program and it keeps going.

To be able to activate a program (which is tied to a service) is running, we set its map value to something more than zero otherwise the service either is stopped or not started at all.

for example, a zero packet loss rate means it passes all packets and a zero bandwidth means an unlimited bandwidth.
Here is some tests results after making the fix:

Results:
Number of parallel connections per test: 100
Test duration per test: 60 seconds
expected bandwidth: 64 Kbps 	actual bandwidth: 0 bps
expected bandwidth: 128 Kbps 	actual bandwidth: 96 Kbps
expected bandwidth: 256 Kbps 	actual bandwidth: 109 Kbps
expected bandwidth: 512 Kbps 	actual bandwidth: 201 Kbps
expected bandwidth: 1024 Kbps 	actual bandwidth: 0 bps
expected bandwidth: 2 Mbps 	actual bandwidth: 1 Mbps
expected bandwidth: 4 Mbps 	actual bandwidth: 3 Mbps
expected bandwidth: 8 Mbps 	actual bandwidth: 5 Mbps
expected bandwidth: 16 Mbps 	actual bandwidth: 12 Mbps
expected bandwidth: 32 Mbps 	actual bandwidth: 27 Mbps
expected bandwidth: 64 Mbps 	actual bandwidth: 52 Mbps
expected bandwidth: 128 Mbps 	actual bandwidth: 106 Mbps
expected bandwidth: 256 Mbps 	actual bandwidth: 231 Mbps
expected bandwidth: 512 Mbps 	actual bandwidth: 403 Mbps
expected bandwidth: 1024 Mbps 	actual bandwidth: 959 Mbps
Results:
Number of packets per test: 50

Packet loss: 0% 	 Expected: 0%
Packet loss: 4% 	 Expected: 10%
Packet loss: 16% 	 Expected: 20%
Packet loss: 46% 	 Expected: 50%
Packet loss: 60% 	 Expected: 70%
Packet loss: +6 	 Expected: 80%
Packet loss: +29 	 Expected: 100%

As it can be seen, no changes observed in the tests, so the new changes should be ok to go.

@mojtaba-esk mojtaba-esk requested a review from a team November 30, 2023 12:41
@mojtaba-esk mojtaba-esk self-assigned this Nov 30, 2023
Copy link
Member

@smuu smuu left a comment

Choose a reason for hiding this comment

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

Tbh. I don't understand how this works, but if it works, it LGTM 👍

@mojtaba-esk mojtaba-esk merged commit 631032a into main Nov 30, 2023
8 of 9 checks passed
@mojtaba-esk mojtaba-esk deleted the mojtaba/fix-multiple-xdp-load-in-kernel branch November 30, 2023 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Load multiple XDP programs into the kernel
2 participants