Re: [RFC 3/4] wwan: add interface creation support
From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Date: 2021-06-02 12:46:13
Also in:
netdev
Hello Johannes, On Wed, Jun 2, 2021 at 10:38 AM Johannes Berg [off-list ref] wrote:
quoted
Wow, this is a perfect solution! I just could not help but praise this proposal :)Heh.quoted
When researching the latest WWAN device drivers and related discussions, I began to assume that implementing the netdev management API without the dummy (no-op) netdev is only possible using genetlink. But this usage of a regular device specified by its name as a parent for netdev creation is so natural and clear that I believe in RTNL again. Let me place my 2 cents. Maybe the parent device attribute should be made generic? E.g. call it IFLA_PARENT_DEV_NAME, with usage semantics similar to the IFLA_LINK attribute for VLAN interfaces. The case when a user needs to create a netdev on behalf of a regular device is not WWAN specific, IMHO. So, other drivers could benefit from such attribute too. To be honest, I can not recall any driver that could immediately start using such attribute, but the situation with the need for such attribute seems to be quite common.That's a good question/thought. I mean, in principle this is trivial, right? Just add a IFLA_PARENT_DEV_NAME like you say, and use it instead of IFLA_WWAN_DEV_NAME. It'd come out of tb[] instead of data[] and in this case would remove the need to add the additional data[] argument to rtnl_create_link() in my patch, since it's in tb[] then.
Yep, exactly.
The only thing I'd be worried about is that different implementations use it for different meanings, but I guess that's not that big a deal?
The spectrum of sane use of the IFLA_PARENT_DEV_NAME attribute by various subsystems and (or) drivers will be quite narrow. It should do exactly what its name says - identify a parent device. We can not handle the attribute in the common rtnetlink code since rtnetlink does not know the HW configuration details. That is why IFLA_PARENT_DEV_NAME should be handled by the RTNL ->newlink() callback. But after all the processing, the device that is identified by the IFLA_PARENT_DEV_NAME attribute should appear in the netdev->dev.parent field with help of SET_NETDEV_DEV(). Eventually RTNL will be able to fill IFLA_PARENT_DEV_NAME during the netdevs dump on its own, taking data from netdev->dev.parent. I assume that IFLA_PARENT_DEV_NAME could replace the IFLA_LINK attribute usage in such drivers as MBIM and RMNET. But the best way to evolve these drivers is to make them WWAN-subsystem-aware using the WWAN interface configuration API from your proposal, IMHO. -- Sergey