[PATCH 1/5] net: Introduce DSA class for Ethernet switches

Simon Glass sjg at chromium.org
Thu Jan 14 16:42:23 CET 2021


Hi Claudiu,

On Wed, 13 Jan 2021 at 11:05, Claudiu Manoil <claudiu.manoil at 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 at nxp.com>
> Signed-off-by: Claudiu Manoil <claudiu.manoil at 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 at 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


More information about the U-Boot mailing list