From: Lad Prabhakar <prab…@bp.renesas.com> Add a distinct DSA tag protocol for the RZ/T2H ETHSW to separate its semantics from the RZ/N1 A5PSW, even though both use the same tagged frame structure. The on wire layout is identical, but the ControlData bit assignments differ between the two switch families. The common tagged frame format is: +----------------------+-------------------------------+ | Field | Size (octets) | +----------------------+-------------------------------+ | Preamble | 7 | | SFD | 1 | | Destination Address | 6 | | Source Address | 6 | | ControlTag (0xE001) | 2 | | ControlData | 2 | | ControlData2 | 4 (timestamp, portmask) | | Type/Length | 2 | | Payload | 0..1500 / 0..9000 | | Pad | 0..42 | | FCS | 4 | +----------------------+-------------------------------+ The differences arise in the ControlData interpretation: ControlData field (bits): +---------+-----------------------------+ | SoC | Meaning | +---------+-----------------------------+ | RZ/N1 | [0-3]: ingress port | | | [4-15]: reserved | +---------+-----------------------------+ | RZ/T2H | [0-3]: ingress port | | | [4]: timestamp timer select | | | [5]: reserved | | | [6]: RED period indicator | | | [7-15]: reserved | +---------+-----------------------------+ Because these semantics diverge, register a new DSA_TAG_PROTO_RZT2H_ETHSW protocol and corresponding tag driver. Update the Kconfig help and module description to reflect the additional switch support. Signed-off-by: Lad Prabhakar <prab…@bp.renesas.com> --- v6: - Squashed the kconfig changes into this patch - Updated commit message to reflect the Kconfig changes v5: https://lore.kernel.org/all/2026…@bp.renesas.com/ - Rebased on next so DSA_TAG_PROTO_RZT2H_ETHSW_VALUE is updated v4: https://lore.kernel.org/all/2026…@bp.renesas.com/ - No change v3: https://lore.kernel.org/all/2026…@bp.renesas.com/ - No change v2: https://lore.kernel.org/all/2026…@bp.renesas.com/ - Updated commit message v1: https://lore.kernel.org/all/2025…@bp.renesas.com/ --- include/net/dsa.h | 2 ++ include/uapi/linux/if_ether.h | 2 +- net/dsa/Kconfig | 9 +++++---- net/dsa/tag_rzn1_a5psw.c | 23 ++++++++++++++++++++--- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index 09f3043d57f0..a81fe7ae4d18 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -63,6 +63,7 @@ struct tc_action; #define DSA_TAG_PROTO_MT7628_VALUE 35 #define DSA_TAG_PROTO_KS8995_VALUE 36 #define DSA_TAG_PROTO_LAN9645X_VALUE 37 +#define DSA_TAG_PROTO_RZT2H_ETHSW_VALUE 38 enum dsa_tag_protocol { DSA_TAG_PROTO_NONE = DSA_TAG_PROTO_NONE_VALUE, @@ -103,6 +104,7 @@ enum dsa_tag_protocol { DSA_TAG_PROTO_MT7628 = DSA_TAG_PROTO_MT7628_VALUE, DSA_TAG_PROTO_KS8995 = DSA_TAG_PROTO_KS8995_VALUE, DSA_TAG_PROTO_LAN9645X = DSA_TAG_PROTO_LAN9645X_VALUE, + DSA_TAG_PROTO_RZT2H_ETHSW = DSA_TAG_PROTO_RZT2H_ETHSW_VALUE, }; struct dsa_switch; diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h index 1ffac52c39df..9fd25c5d96c9 100644 --- a/include/uapi/linux/if_ether.h +++ b/include/uapi/linux/if_ether.h @@ -121,7 +121,7 @@ #define ETH_P_YT921X 0x9988 /* Motorcomm YT921x DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_DSA_8021Q 0xDADB /* Fake VLAN Header for DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ -#define ETH_P_DSA_A5PSW 0xE001 /* A5PSW Tag Value [ NOT AN OFFICIALLY REGISTERED ID ] */ +#define ETH_P_DSA_A5PSW 0xE001 /* A5PSW/ETHSW Tag Value [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_IFE 0xED3E /* ForCES inter-FE LFB type */ #define ETH_P_AF_IUCV 0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_NXP_NETC 0xFD3A /* NXP NETC DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig index bdeb60af764b..3c18314aee95 100644 --- a/net/dsa/Kconfig +++ b/net/dsa/Kconfig @@ -199,11 +199,12 @@ config NET_DSA_TAG_RTL8_4 switches with 8 byte protocol 4 tags, such as the Realtek RTL8365MB-VC. config NET_DSA_TAG_RZN1_A5PSW - tristate "Tag driver for Renesas RZ/N1 A5PSW switch" + tristate "Tag driver for Renesas RZ/N1 A5PSW and RZ/T2H, RZ/N2H ETHSW" help - Say Y or M if you want to enable support for tagging frames for - Renesas RZ/N1 embedded switch that uses an 8 byte tag located after - destination MAC address. + Say Y or M if you want to enable frame tagging support for embedded + switches found on Renesas RZ/N1 (A5PSW) and RZ/T2H, RZ/N2H (ETHSW) + SoCs. These switches use an 8-byte tag located after the destination + MAC address. config NET_DSA_TAG_LAN9303 tristate "Tag driver for SMSC/Microchip LAN9303 family of switches" diff --git a/net/dsa/tag_rzn1_a5psw.c b/net/dsa/tag_rzn1_a5psw.c index 957663c7c101..fc84f9f109f0 100644 --- a/net/dsa/tag_rzn1_a5psw.c +++ b/net/dsa/tag_rzn1_a5psw.c @@ -23,6 +23,7 @@ */ #define A5PSW_NAME "a5psw" +#define ETHSW_NAME "ethsw" #define A5PSW_TAG_LEN 8 #define A5PSW_CTRL_DATA_FORCE_FORWARD BIT(0) @@ -111,8 +112,24 @@ static const struct dsa_device_ops a5psw_netdev_ops = { .rcv = a5psw_tag_rcv, .needed_headroom = A5PSW_TAG_LEN, }; +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_RZN1_A5PSW, A5PSW_NAME); +DSA_TAG_DRIVER(a5psw_netdev_ops); -MODULE_DESCRIPTION("DSA tag driver for Renesas RZ/N1 A5PSW switch"); +static const struct dsa_device_ops ethsw_netdev_ops = { + .name = ETHSW_NAME, + .proto = DSA_TAG_PROTO_RZT2H_ETHSW, + .xmit = a5psw_tag_xmit, + .rcv = a5psw_tag_rcv, + .needed_headroom = A5PSW_TAG_LEN, +}; +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_RZT2H_ETHSW, ETHSW_NAME); +DSA_TAG_DRIVER(ethsw_netdev_ops); + +static struct dsa_tag_driver *dsa_tag_driver_array[] = { + &DSA_TAG_DRIVER_NAME(a5psw_netdev_ops), + &DSA_TAG_DRIVER_NAME(ethsw_netdev_ops), +}; +module_dsa_tag_drivers(dsa_tag_driver_array); + +MODULE_DESCRIPTION("DSA tag driver for Renesas RZ/N1 A5PSW and RZ/T2H ETHSW switches"); MODULE_LICENSE("GPL v2"); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_RZN1_A5PSW, A5PSW_NAME); -module_dsa_tag_driver(a5psw_netdev_ops);
-- 2.56.1