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

Device Auto Detection #22

Open
wkz opened this issue Dec 5, 2022 · 0 comments
Open

Device Auto Detection #22

wkz opened this issue Dec 5, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@wkz
Copy link
Owner

wkz commented Dec 5, 2022

It would be great if mdio could auto detect commonly used devices and let the user access them with a simple alias.

Ideas:

  • Associate a simple numeric ID with each bus
  • Use sysfs to figure out PHY<->netdev associations
  • Use devlink to locate DSA switches
  • Probe buses to find devices

Create aliases based on:

  1. Associated netdev name, if available
  2. Object type combined with bus ID and address

Example usage:

root@box # mdio dev
DEV         TYPE     ADDR  BUS
mmd0-9      mmd       0x9  *et@30be0000!mdio!switch@4!mdio
mmd0-a      mmd       0xa  *et@30be0000!mdio!switch@4!mdio
eth3        mva       0x8  *et@30be0000!mdio!switch@4!mdio
eth4        mva       0x7  *et@30be0000!mdio!switch@4!mdio
mvls4-4     mvls      0x4  30be0000.ethernet-1
phy0-0      phy       0x0  *et@30be0000!mdio!switch@4!mdio
phy0-1      phy       0x1  *et@30be0000!mdio!switch@4!mdio
phy0-2      phy       0x2  *et@30be0000!mdio!switch@4!mdio
phy0-3      phy       0x3  *et@30be0000!mdio!switch@4!mdio
phy0-4      phy       0x4  *et@30be0000!mdio!switch@4!mdio
phy0-5      phy       0x5  *et@30be0000!mdio!switch@4!mdio
phy0-6      phy       0x6  *et@30be0000!mdio!switch@4!mdio

On such a system

  • mdio dev eth3 raw copper:1 would expand to:
    • mdio *et@30be0000!mdio!switch@4!mdio mva 8 raw copper:1
  • mdio dev mvls4-4 raw g1:0x1a would expand to:
    • mdio 30be0000.ethernet-1 mvls 4 raw g1:0x1a

etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants