Re: [PATCH 4/4] cpsw: add switchdev support
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Date: 2018-05-24 13:32:39
On Thu, May 24, 2018 at 03:12:29PM +0200, Andrew Lunn wrote:
Device tree is supposed to describe the hardware. Using that hardware in different ways is not something you should describe in DT.
The new switchdev mode is applied with a .config option in the kernel. What you see is pre-existing code, so i am not sure if i should change it in this patchset. Your point is valid though and we are on the same page.
There are also a lot of IS_ENABLED() here, which i don't like. It is a lot better than #ifdef, but we should try to do better.
I don't like it either i just tried to clean up code in "hot path" with ifdefs. In theory this should replace "switch mode" in the near future so the ifdefs will go away
It would be good to split this cleanly into three parts. A generic library, which does not care about DUAL_MAC or SWITCHDEV. A driver which implements legacy DUAL MAC etc. And a driver which implements SWITCHDEV. We can then give this new switchdev driver a different compatible. It i still encoding in device tree how to use the hardware, but it is more implicit, rather than explicit.
Good idea, i'll sent the next version like that Thanks, Ilias