-
Notifications
You must be signed in to change notification settings - Fork 286
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 reconstruction of SchedClassifierLink
#445
Conversation
✅ Deploy Preview for aya-rs-docs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
6bd00bb
to
08d9b86
Compare
bed7e8b
to
0d8fd95
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.
Looks good, but docs need work.
d1622d2
to
449e342
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.
LGTM, thanks!
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.
LGTM
Ping @alessandrod - this one is good to go but requires a LGTM from you since API changes are involved. |
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.
Great work as always! See comments
aya/src/programs/tc.rs
Outdated
handle: u32, | ||
) -> Result<SchedClassifierLink, ProgramError> { | ||
let if_index = | ||
ifindex_from_ifname(if_name).map_err(|io_error| TcError::NetlinkError { io_error })?; |
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.
This shoulld just return io::Error
I think? if_nametoindex
uses ioctls not netlink
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.
That sounds fine. I copied the error mapping from the original attach()
function, but I can change this, and I guess I should change the other instance as well.
It is based on aya with the following prs: aya-rs/aya#462 aya-rs/aya#445 (w/445 modified to work with 462) Signed-off-by: Andre Fredette <afredette@redhat.com>
It is based on aya with the following prs: aya-rs/aya#462 aya-rs/aya#445 (w/445 modified to work with 462) Signed-off-by: Andre Fredette <afredette@redhat.com>
8439f02
to
3a031d5
Compare
I think I've addressed the comments. Please take a look when you get a chance. |
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.
Thanks!
This is the proposed solution for Step 2 of issue aya-rs#414 “For cases where you have done program.take_link() to manage ownership of TcLink we need an API similar to PinnedLink::from_pin that can reconstruct a TcLink” As long as a user application continues to run after executing `take_link()`, the `SchedClassifierLink` returned can be used to detach the program. However, if we want to handle cases where the application exits or crashes, we need a way to save and reconstruct the link, and to do that, we also need to know the information required for the reconstruction -- namely, the `interface`, `attach_type`, `priority`, and `handle`. The user knows the first two because they are required to execute `attach()` in the first place; however, the user will not know the others if they let the system choose them. This pr solves the problems by adding an `impl` for `SchedClassifierLink` with an accessor for `tc_options` and a `new()` function. Signed-off-by: Andre Fredette <afredette@redhat.com>
Also modified the impl a bit to work as described in the example. Signed-off-by: Andre Fredette <afredette@redhat.com>
Co-authored-by: Dave Tucker <dave@dtucker.co.uk> Signed-off-by: Andre Fredette <afredette@redhat.com>
Signed-off-by: Andre Fredette <afredette@redhat.com>
Avoids name confilct with pr aya-rs#462 Signed-off-by: Andre Fredette <afredette@redhat.com>
Signed-off-by: Andre Fredette <afredette@redhat.com>
- Rename `new_tc_link` to `attached` - Simplified example for `attached` The following was not requested in reviews: - Moved example from `SchedClassifierLink` tor `SchedClassifierLink::attached' since we're only showing an example of that one method Signed-off-by: Andre Fredette <afredette@redhat.com>
It was redundant with the one provided in define_link_wrapper Signed-off-by: Andre Fredette <afredette@redhat.com>
6b70311
to
6766532
Compare
Signed-off-by: Andre Fredette <afredette@redhat.com>
@alessandrod, I'd appreciate it if you could take a look when you get a chance. |
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.
Thanks! Just a couple of docs nits
Signed-off-by: Andre Fredette <afredette@redhat.com>
Signed-off-by: Andre Fredette <afredette@redhat.com>
This is the proposed solution for Step 2 of issue #414
As long as a user application continues to run after executing
take_link()
, theSchedClassifierLink
returned can be used to detach the program. However, if we want to handle cases where the application exits or crashes, we need a way to save and reconstruct the link, and to do that, we also need to know the information required for the reconstruction -- namely, theinterface
,attach_type
,priority
, andhandle
. The user knows the first two because they are required to executeattach()
in the first place; however, the user will not know the others if they let the system choose them.This pr solves the problems by adding an
impl
forSchedClassifierLink
with accessors forpriority
andhandle
, and anew()
function.Signed-off-by: Andre Fredette afredette@redhat.com