On Mon, Sep 21, 2020 at 05:02:13AM +0200, Andrew Lunn wrote: > On Mon, Sep 21, 2020 at 12:23:18AM +0000, Vladimir Oltean wrote: > > On Mon, Sep 21, 2020 at 02:45:39AM +0300, Vladimir Oltean wrote: > > > This looks like a simple enough solution, but am I right that old > > > kernels, which ignore this new DEVLINK_ATTR_PORT_INDEX netlink > > > attribute, will consequently interpret any devlink command for a port as > > > being for a global region? Sure, in the end, that kernel will probably > > > fail anyway, due to the region name mismatch. And at the moment there > > > isn't any driver that registers a global and a port region with the same > > > name. But when that will happen, the user space tools of the future will > > > trigger incorrect behavior into the kernel of today, instead of it > > > reporting an unsupported operation as it should. Or am I > > > misunderstanding? > > > > Thinking about this more, I believe that the only conditions that need > > to be avoided are: > > - mlx4 should never create a port region called "cr-space" or "fw-health" > > - ice should never create a port region called "nvm-flash" or > > "device-caps" > > - netdevsim should never create a port region called "dummy" > > - mv88e6xxx should never create a port region called "global1", > > "global2" or "atu" > > > > Because these are the only region names supported by kernels that don't > > parse DEVLINK_ATTR_PORT_INDEX, I think we don't need to complicate the > > solution, and go with DEVLINK_ATTR_PORT_INDEX. > > It would be easy to check when adding a per port region if a global > region of the same name already exists. Checking when adding a global > region to see if there is a port region with the same name is a bit > more work, but doable.
See, I don't think that the check would be useful. By the time the new kernel understands DEVLINK_ATTR_PORT_INDEX, the global and port regions are already properly namespaced. So future drivers can have a port and a global region of the same name. The problem is only with kernels that don't understand DEVLINK_ATTR_PORT_INDEX. These only support global regions. The concern is that future port regions for these specific 4 drivers might confuse them. -Vladimir