Skip to content

ethtool: Add support of channel #8

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

Closed
wants to merge 3 commits into from

Conversation

SteamedFish
Copy link

Equivalent to ethtool -l <nic_name> command.

Example code included.

Equivalent to `ethtool -l <nic_name>` command.

Example code included.
Copy link

@DmytroLinkin DmytroLinkin left a comment

Choose a reason for hiding this comment

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

Left few small comments.
I've tested the code - it works.


use futures::stream::TryStreamExt;

// Once we find a way to load netsimdev kernel module in CI, we can convert this

Choose a reason for hiding this comment

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

s/netsimdev/netdevsim/

Copy link
Author

Choose a reason for hiding this comment

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

This comment is copied from other examples provided in the project.
I'll submit a dedicated PR to fix this in all the code examples.

src/message.rs Outdated
Comment on lines 24 to 31
const ETHTOOL_MSG_LINKMODES_GET_REPLY: u8 = 4;
const ETHTOOL_MSG_RINGS_GET: u8 = 15;
const ETHTOOL_MSG_RINGS_GET_REPLY: u8 = 16;
const ETHTOOL_MSG_CHANNELS_GET: u8 = 17;
const ETHTOOL_MSG_CHANNELS_GET_REPLY: u8 = 18;
const ETHTOOL_MSG_COALESCE_GET: u8 = 19;
const ETHTOOL_MSG_COALESCE_GET_REPLY: u8 = 20;
const ETHTOOL_MSG_TSINFO_GET: u8 = 25;

Choose a reason for hiding this comment

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

This const list is quite confusing, because it actually mixes values from two separate lists. Isn't it better to have "userspace to kernel" and "kernel to userspace" separately?

@CosmicSpaceGoose CosmicSpaceGoose mentioned this pull request Jul 10, 2023
the const list comes from two different enums. Put them into two different enums
to make it clear.
Copy link
Member

@cathay4t cathay4t left a comment

Choose a reason for hiding this comment

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

Introducing new dependency should be carefully reviewed. In this case, it is not a stuff we cannot do elegantly by ourselves, hence please remove it the use of num_enum.

const ETHTOOL_MSG_TSINFO_GET: u8 = 25;
const ETHTOOL_MSG_TSINFO_GET_REPLY: u8 = 26;
#[repr(u8)]
#[derive(Debug, PartialEq, Eq, Clone, Copy, IntoPrimitive, FromPrimitive)]
Copy link
Member

Choose a reason for hiding this comment

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

In stead of introducing new dependency, please use From<u8> and remove #[repr(u8)].

PauseSet = 22,
TsInfoGet = 25,
#[num_enum(catch_all)]
UnSupport(u8),
Copy link
Member

Choose a reason for hiding this comment

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

Please use Other(u8) like other code. Yes this forbid you from using repr[u8], please impl From trait for it when needed.

PauseGetReply = 22,
TsInfoGetReply = 26,
#[num_enum(catch_all)]
UnSupport(u8),
Copy link
Member

Choose a reason for hiding this comment

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

Other(u8)

@cathay4t cathay4t added the Wait_Contributor Reviewed and waiting update label Jan 10, 2024
@ruocco
Copy link

ruocco commented Feb 28, 2024

Hello, I'm interested in this feature being merged (as well as the set support in #14 ).

@SteamedFish if you don't have time or have shifted priorities, do you mind if I jump in and complete this?

@SteamedFish
Copy link
Author

Hello, I'm interested in this feature being merged (as well as the set support in #14 ).

@SteamedFish if you don't have time or have shifted priorities, do you mind if I jump in and complete this?

Sure, I got several issues managing ethernet devices in virtual machines with netlink, I've switched to ioctl.

@cathay4t
Copy link
Member

cathay4t commented May 21, 2024

@SteamedFish Is that OK for me to close this PR since you moved to ioctl() approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Wait_Contributor Reviewed and waiting update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants