linux/net/dsa
Vladimir Oltean 0e75bfe340 net: dsa: add simple HSR offload helpers
It turns out that HSR offloads are so fine-grained that many DSA
switches can do a small part even though they weren't specifically
designed for the protocols supported by that driver (HSR and PRP).

Specifically NETIF_F_HW_HSR_DUP - it is simple packet duplication on
transmit, towards all (aka 2) ports members of the HSR device.

For many DSA switches, we know how to duplicate a packet, even though we
never typically use that feature. The transmit port mask from the
tagging protocol can have multiple bits set, and the switch should send
the packet once to every port with a bit set from that mask.

Nonetheless, not all tagging protocols are like this, and sometimes the
port is a single numeric value rather than a bit mask. For that reason,
and also because switches can sometimes change tagging protocols for
different ones, we need to make HSR offload helpers opt-in.

For devices that can do nothing else HSR-specific, we introduce
dsa_port_simple_hsr_join() and dsa_port_simple_hsr_leave(). These
functions monitor when two user ports of the same switch are part of the
same HSR device, and when that condition is true, they toggle the
NETIF_F_HW_HSR_DUP feature flag of both net devices.

Normally only dsa_port_simple_hsr_join() and dsa_port_simple_hsr_leave()
are needed. The dsa_port_simple_hsr_validate() helper is just to see
what kind of configuration could be offloadable using the generic
helpers. This is used by switch drivers which are not currently using
the right tagging protocol to offload this HSR ring, but could in
principle offload it after changing the tagger.

Suggested-by: David Yang <mmyangfl@gmail.com>
Cc: "Alvin Šipraga" <alsi@bang-olufsen.dk>
Cc: Chester A. Unal" <chester.a.unal@arinc9.com>
Cc: "Clément Léger" <clement.leger@bootlin.com>
Cc: Daniel Golle <daniel@makrotopia.org>
Cc: DENG Qingfang <dqfext@gmail.com>
Cc: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: George McCollister <george.mccollister@gmail.com>
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Cc: Jonas Gorski <jonas.gorski@gmail.com>
Cc: Kurt Kanzenbach <kurt@linutronix.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Sean Wang <sean.wang@mediatek.com>
Cc: UNGLinuxDriver@microchip.com
Cc: Woojung Huh <woojung.huh@microchip.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://patch.msgid.link/20251130131657.65080-6-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-12-01 16:45:07 -08:00
..
Kconfig net: dsa: add tagging driver for MaxLinear GSW1xx switch family 2025-11-06 14:16:17 -08:00
Makefile net: dsa: add tagging driver for MaxLinear GSW1xx switch family 2025-11-06 14:16:17 -08:00
conduit.c net: dsa: append ethtool counters of all hidden ports to conduit 2025-11-25 17:33:55 -08:00
conduit.h
devlink.c devlink: pass extack through to devlink_param::get() 2025-11-20 19:01:22 -08:00
devlink.h
dsa.c net: dsa: add simple HSR offload helpers 2025-12-01 16:45:07 -08:00
dsa.h
netlink.c
netlink.h
port.c net: dsa: avoid calling ds->ops->port_hsr_leave() when unoffloaded 2025-12-01 16:45:06 -08:00
port.h
stubs.c
switch.c
switch.h
tag.c net: dsa: provide a software untagging function on RX for VLAN-aware bridges 2024-08-16 09:59:32 +01:00
tag.h net: dsa: introduce the dsa_xmit_port_mask() tagging protocol helper 2025-11-28 20:03:39 -08:00
tag_8021q.c net: dsa: avoid refcount warnings when ds->ops->tag_8021q_vlan_del() fails 2025-04-16 18:14:44 -07:00
tag_8021q.h net: dsa: tag_sja1105: refactor skb->dev assignment to dsa_tag_8021q_find_user() 2024-07-15 06:55:15 -07:00
tag_ar9331.c net: fill in MODULE_DESCRIPTION()s for DSA tags 2024-01-05 08:06:19 -08:00
tag_brcm.c net: dsa: tag_brcm: use the dsa_xmit_port_mask() helper 2025-11-28 20:03:39 -08:00
tag_dsa.c net: fill in MODULE_DESCRIPTION()s for DSA tags 2024-01-05 08:06:19 -08:00
tag_gswip.c net: dsa: tag_gswip: use the dsa_xmit_port_mask() helper 2025-11-28 20:03:39 -08:00
tag_hellcreek.c net: dsa: tag_hellcreek: use the dsa_xmit_port_mask() helper 2025-11-28 20:03:39 -08:00
tag_ksz.c net: dsa: tag_ksz: use the dsa_xmit_port_mask() helper 2025-11-28 20:03:39 -08:00
tag_lan9303.c net: fill in MODULE_DESCRIPTION()s for DSA tags 2024-01-05 08:06:19 -08:00
tag_mtk.c net: dsa: tag_mtk: use the dsa_xmit_port_mask() helper 2025-11-28 20:03:40 -08:00
tag_mxl-gsw1xx.c net: dsa: tag_mxl_gsw1xx: use the dsa_xmit_port_mask() helper 2025-11-28 20:03:40 -08:00
tag_none.c net: fill in MODULE_DESCRIPTION()s for DSA tags 2024-01-05 08:06:19 -08:00
tag_ocelot.c net: dsa: tag_ocelot: use the dsa_xmit_port_mask() helper 2025-11-28 20:03:40 -08:00
tag_ocelot_8021q.c Kthreads affinity follow either of 4 existing different patterns: 2025-01-21 17:10:05 -08:00
tag_qca.c net: dsa: tag_qca: use the dsa_xmit_port_mask() helper 2025-11-28 20:03:40 -08:00
tag_rtl4_a.c net: dsa: tag_rtl4_a: use the dsa_xmit_port_mask() helper 2025-11-28 20:03:40 -08:00
tag_rtl8_4.c net: dsa: tag_rtl8_4: use the dsa_xmit_port_mask() helper 2025-11-28 20:03:40 -08:00
tag_rzn1_a5psw.c net: dsa: tag_rzn1_a5psw: use the dsa_xmit_port_mask() helper 2025-11-28 20:03:41 -08:00
tag_sja1105.c treewide: Introduce kthread_run_worker[_on_cpu]() 2025-01-08 18:15:03 +01:00
tag_trailer.c net: dsa: tag_trailer: use the dsa_xmit_port_mask() helper 2025-11-28 20:03:41 -08:00
tag_vsc73xx_8021q.c net: dsa: vsc73xx: introduce tag 8021q for vsc73xx 2024-07-15 06:55:15 -07:00
tag_xrs700x.c net: dsa: tag_xrs700x: use the dsa_xmit_port_mask() helper 2025-11-28 20:03:41 -08:00
tag_yt921x.c net: dsa: tag_yt921x: use the dsa_xmit_port_mask() helper 2025-11-28 20:03:41 -08:00
trace.c
trace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
user.c net: s/dev_close_many/netif_close_many/ 2025-07-18 17:27:47 -07:00
user.h net: dsa: update the unicast MAC address when changing conduit 2024-06-10 13:48:06 +01:00