Re: [PATCH net-next v2] mctp i2c: add sysfs control for mux child netdevs
From: Kenny Hsieh
Date: Tue Nov 03 2026 - 10:12:15 EST
Hi Matt,
On Mon, 2026-11-02 at 17:04 +0800, Matt Johnston wrote:
> An alternative could be to create sysfs attributes under the mctp-i2c device
> instance itself (the i2c slave).
>
> Mux buses could have mctp-i2c netdevs instantiated with
>
> echo "i2c-6" > /sys/bus/i2c/devices/2-1060/add_mctp_controller
>
> (where i2c-6 is a child mux bus of i2c-2, and i2c-2 0x60 is a mctp-i2c i2c
> device).
>
> "echo i2c-6 > .../2-1060/remove_mctp_controller" would remove the mctp-i2c
> netdev.
> Setting a root node as an mctp controller would involve writing its own name
> to the attribute file.
>
> How does that look to you?
I like that a lot better. Since the attributes live on the mctp-i2c
device, they can just go in dev_groups and the driver core creates and
removes them for us. So I can drop the per-adapter tracking list, and
the remove ordering and probe walk races Sashiko found go away with it.
Let me know if you'd rather have any of these differently:
- adding a bus that already has a netdev, or removing one that
doesn't, just returns success
- a bus that isn't in this controller's mux tree gets -EINVAL
- a bus name that doesn't exist, e.g. i2c-9999, gets -ENODEV
BR,
Kenny