
Hi Claudiu,
On Wed, 13 Jan 2021 at 11:05, Claudiu Manoil claudiu.manoil@nxp.com wrote:
DSA stands for Distributed Switch Architecture and it covers switches that are connected to the CPU through an Ethernet link and generally use frame tags to pass information about the source/destination ports to/from CPU. Front panel ports are presented as regular ethernet devices in U-Boot and they are expected to support the typical networking commands. DSA switches may be cascaded, DSA class code does not currently support this.
Signed-off-by: Alex Marginean alexandru.marginean@nxp.com Signed-off-by: Claudiu Manoil claudiu.manoil@nxp.com
drivers/net/Kconfig | 14 ++ include/dm/uclass-id.h | 1 + include/net.h | 6 + include/net/dsa.h | 206 ++++++++++++++++ net/Makefile | 1 + net/dsa-uclass.c | 517 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 745 insertions(+) create mode 100644 include/net/dsa.h create mode 100644 net/dsa-uclass.c
Reviewed-by: Simon Glass sjg@chromium.org
I don't think it is necessary to have the 'if (!pdev)' checks around the place. We need a way in U-Boot to have checks like that to catch programming errors but to be able to turn them off in production code to reduce size.
I suppose a Kconfig would do it, with:
if (CONFIG_IS_ENABLED(SAFETY) && !pdev) return log_,msg_ref("safety", -ENODEV)
Also note that -ENODEV is used by drive rmodel so it generally isn't safe to return it as a logic error. I think in this case because it never happens, it should be OK.
Regards, Simon