Re: [PATCH v2 net-next] net: dsa: Allow only up to two HSR HW offloaded ports for KSZ9477

From: Vladimir Oltean
Date: Wed Jun 19 2024 - 12:04:52 EST


On Wed, Jun 19, 2024 at 06:48:14PM +0300, Vladimir Oltean wrote:
> Granted, this isn't an actual functional problem, but given that you
> are fixing a newly developed feature for net-next, and that this is API
> that gets progressively harder to change as more devices implement
> offloads, I would expect a more obvious signaling mechanism to exist
> for this, and now seems a good time to do it, rather than opting for the
> most minimal fix.

Actually I'm not even so sure about this basic fact, that it isn't a
functional problem already.

xrs700x_hsr_join() has explicit checks for port 1 and 2. Obviously it
expects those ports to be ring ports.

But if you configure from user space ports 0 and 1 to be ring ports,
and port 2 to be an interlink port, the kernel will accept that
configuration. It will return -EOPNOTSUPP for port 0, falling back to
software mode for the first ring port, then accept offload for ring
ports 1 and 2. But it doesn't match what user space requested, because
port 2 should be interlink...

I think you really should pass the port type down to drivers and reject
offloading interlink ports...