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

Add support for devlink DPIPE tables #3

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

kvadrage
Copy link

@kvadrage kvadrage commented Nov 8, 2019

Add DpipeTables() function to retrieve a list of all supported DPIPE tables for a specified device.

The following information is collected per DPIPE table:

  • devlink bus
  • devlink device
  • table name
  • table size
  • table counters_enabled flag

More info about DPIPE:
https://github.com/Mellanox/mlxsw/wiki/Pipeline-Debugging-(DPIPE)

Extend this function arguments list in order to support
passing netlink data (data []byte).

Signed-off-by: Alexander Petrovskiy <alexpe@mellanox.com>
Add DpipeTables() function to retrieve a list of all supported
DPIPE tables for a specified device.

The following information is collected per DPIPE table:
- devlink bus
- devlink device
- table name
- table size
- table counters_enabled flag

More info about DPIPE:
https://github.com/Mellanox/mlxsw/wiki/Pipeline-Debugging-(DPIPE)

Signed-off-by: Alexander Petrovskiy <alexpe@mellanox.com>
Signed-off-by: Alexander Petrovskiy <alexpe@mellanox.com>
@kvadrage
Copy link
Author

kvadrage commented Nov 8, 2019

I also added an integration test for DPIPE just to verify that it's working.
However, you need a specific setup with devlink device supporting DPIPE (I'm using Mellanox switch with mlxsw driver, for example) and this if the reason why tests are failing,

Looking forward to hear your feedback about this. Should I just remove this test or rework it somehow?

Copy link
Owner

@mdlayher mdlayher left a comment

Choose a reason for hiding this comment

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

We should also have a unit test for DPIPE tables just like what TestLinuxClientDevicesOK is doing. You can copy that for the structure. It simulates a netlink connection and verifies the correct encoding and decoding of attributes as a sanity check for environments that you don't want to manipulate your actual operating system via netlink.

client.go Outdated Show resolved Hide resolved
client.go Outdated Show resolved Hide resolved
client_linux.go Outdated Show resolved Hide resolved
client_linux.go Outdated Show resolved Hide resolved
client_linux.go Outdated Show resolved Hide resolved
client_linux.go Show resolved Hide resolved
tables = append(tables, tt...)
}

if len(tables) == 0 {
Copy link
Owner

Choose a reason for hiding this comment

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

I think it's okay to remove this check and just print the tables that were found. These "integration" tests are more so just a sanity check of the actual devlink interface at the moment. If there is a simulator kernel module of some sort we could use in CI though, that would be very helpful. Do you know of anything like that?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, there is a netdevsim module available, but it doesn't support DPIPE yet.
We can probably use it to test some other devlink features like devlink trap, for example.
More details on netdevsim and devlink trap:
https://cateee.net/lkddb/web-lkddb/NETDEVSIM.html
https://github.com/torvalds/linux/blob/master/Documentation/networking/devlink-trap.rst
https://github.com/jeffmerkey/leaf-linux/blob/master/tools/testing/selftests/drivers/net/netdevsim/devlink_trap.sh

Copy link
Owner

Choose a reason for hiding this comment

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

Awesome! I'll open an issue to look into this.

Signed-off-by: Alexander Petrovskiy <alexpe@mellanox.com>
Signed-off-by: Alexander Petrovskiy <alexpe@mellanox.com>
Change it to accept 'ae *netlink.AttributeEncoder' as an optional
argument to pass 'ae' with data to encode for netlink message
instead of data itself.

Signed-off-by: Alexander Petrovskiy <alexpe@mellanox.com>
Signed-off-by: Alexander Petrovskiy <alexpe@mellanox.com>
Signed-off-by: Alexander Petrovskiy <alexpe@mellanox.com>
Just print all DPIPE tables that are available.

Signed-off-by: Alexander Petrovskiy <alexpe@mellanox.com>
@kvadrage
Copy link
Author

Thank you for your review! I updated the PR.
Please check.

Copy link
Owner

@mdlayher mdlayher left a comment

Choose a reason for hiding this comment

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

Looking good overall! See my previous comment about adding a unit test for parsing out the DPIPE structures: #3 (review).

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.

2 participants