-
Notifications
You must be signed in to change notification settings - Fork 151
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
Support detaching xdp_link-based attachments fix #361 #362
Conversation
/assign @tohojo |
e1d2153
to
5a17836
Compare
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.
The basic functionality is basically there, nice job! Just a whole bunch of nits :)
Also, it would be good to add a selftest for this; could you please write add a small test utility in libxdp/tests that does something like:
link = bpf_link_attach(ifindex);
mp = xdp_multiprog__get_from_ifindex(ifindex);
xdp_multiprog__detach(mp);
bpf_link_close(link);
You can look at some of the other examples in the tests/ directory for how to execute the tests from the test script :)
5a17836
to
e3a1628
Compare
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.
A few more nits, but we're getting there :)
033563e
to
e3b6a88
Compare
make run
Executing tests in separate net- and mount namespaces
Running tests from ./test-libxdp.sh
[test_link_so] PASS
[test_link_a] PASS
[test_old_dispatcher] PASS
[test_xdp_frags] PASS
[test_xsk_prog_refcnt_bpffs] PASS
[test_xsk_prog_refcnt_legacy] PASS
[test_xsk_non_privileged] SKIPPED
[test_link_dispatch] PASS |
e3b6a88
to
10bf826
Compare
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.
Only a few style nits and some missing cleanup, otherwise the test LGTM.
exit(EXIT_FAILURE); | ||
} | ||
|
||
static int check_link_detach(int ifindex) { |
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.
The indentation is off in this and the main()
function below. We use a single tab character per indentation level everywhere.
10bf826
to
971fe49
Compare
d183e41
to
651960d
Compare
When explicitly detaching from an interface we should also handle bpf_link-based attachments (by force-detaching the link). Fixes xdp-project#361. Signed-off-by: Mohamed Mahmoud <[email protected]>
Signed-off-by: Mohamed Mahmoud <[email protected]> [ fixup whitespace, rename test from link_dispatch to link_detach ] Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
651960d
to
aace046
Compare
supporting force detach for link based attachments using
xdp-loader unload -a <intf>
fixes #361