mirror of https://github.com/torvalds/linux.git
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> |
||
|---|---|---|
| .. | ||
| Kconfig | ||
| Makefile | ||
| conduit.c | ||
| conduit.h | ||
| devlink.c | ||
| devlink.h | ||
| dsa.c | ||
| dsa.h | ||
| netlink.c | ||
| netlink.h | ||
| port.c | ||
| port.h | ||
| stubs.c | ||
| switch.c | ||
| switch.h | ||
| tag.c | ||
| tag.h | ||
| tag_8021q.c | ||
| tag_8021q.h | ||
| tag_ar9331.c | ||
| tag_brcm.c | ||
| tag_dsa.c | ||
| tag_gswip.c | ||
| tag_hellcreek.c | ||
| tag_ksz.c | ||
| tag_lan9303.c | ||
| tag_mtk.c | ||
| tag_mxl-gsw1xx.c | ||
| tag_none.c | ||
| tag_ocelot.c | ||
| tag_ocelot_8021q.c | ||
| tag_qca.c | ||
| tag_rtl4_a.c | ||
| tag_rtl8_4.c | ||
| tag_rzn1_a5psw.c | ||
| tag_sja1105.c | ||
| tag_trailer.c | ||
| tag_vsc73xx_8021q.c | ||
| tag_xrs700x.c | ||
| tag_yt921x.c | ||
| trace.c | ||
| trace.h | ||
| user.c | ||
| user.h | ||