|
|
Log in / Subscribe / Register

Introduce the dsa_xmit_port_mask() tagging protocol helper

From:  Vladimir Oltean <vladimir.oltean-AT-nxp.com>
To:  netdev-AT-vger.kernel.org
Subject:  [PATCH net-next 00/15] Introduce the dsa_xmit_port_mask() tagging protocol helper
Date:  Thu, 27 Nov 2025 14:08:47 +0200
Message-ID:  <20251127120902.292555-1-vladimir.oltean@nxp.com>
Cc:  Andrew Lunn <andrew-AT-lunn.ch>, "David S. Miller" <davem-AT-davemloft.net>, Eric Dumazet <edumazet-AT-google.com>, Jakub Kicinski <kuba-AT-kernel.org>, Paolo Abeni <pabeni-AT-redhat.com>, Alvin Šipraga <alsi-AT-bang-olufsen.dk>, Clément Léger <clement.leger-AT-bootlin.com>, Daniel Golle <daniel-AT-makrotopia.org>, David Yang <mmyangfl-AT-gmail.com>, DENG Qingfang <dqfext-AT-gmail.com>, Florian Fainelli <florian.fainelli-AT-broadcom.com>, George McCollister <george.mccollister-AT-gmail.com>, Hauke Mehrtens <hauke-AT-hauke-m.de>, Jonas Gorski <jonas.gorski-AT-gmail.com>, Kurt Kanzenbach <kurt-AT-linutronix.de>, Linus Walleij <linus.walleij-AT-linaro.org>, linux-renesas-soc-AT-vger.kernel.org, Sean Wang <sean.wang-AT-mediatek.com>, UNGLinuxDriver-AT-microchip.com, Woojung Huh <woojung.huh-AT-microchip.com>
Archive-link:  Article

What
----

Some DSA tags have just the port number in the TX header format, others
have a bit field where in theory, multiple bits can be set, even though
DSA only sets one.

The latter kind is now making use of a dsa_xmit_port_mask() helper,
which will decide when to set more than 1 bit in that mask.

Why
---

David Yang has pointed out in a recently posted patch that HSR packet
duplication on transmission can be offloaded even on HSR-unaware
switches. This should be made generally available to all DSA switches.

How to test
-----------

These patches just lay the groundwork, and there should be no functional
change - so for this set, regression testing is all that's necessary.

For testing the HSR packet duplication idea, I've put together a branch:
https://github.com/vladimiroltean/linux/commits/dsa-simpl...
where most drivers are patched to call dsa_port_simple_hsr_join() and
dsa_port_simple_hsr_leave().

Assuming there are volunteers to also test the latter, one can enable
CONFIG_HSR and create a HSR device using:
$ ip link add name hsr0 type hsr slave1 swp0 slave2 swp1 supervision 45 version 1

This needs to be connected using 2 cables to another system where the
same command was run. Then, one should be able to ping the other board
through the hsr0 interface.

Without the Github branch, a ping over HSR should increase the DSA
conduit interface's TX counters by 2 packets. With the Github branch,
the TX counters should increase by only 1 packet.

Why so many patches
-------------------

To avoid the situation where a patch has to be backported, conflicts
with the work done here, pulls this in as a dependency, and that pulls
in 13 other unrelated drivers. These don't have any dependencies between
each other and can be cherry-picked at will (except they all depend on
patch 1/15).

When will you post the rest of the patches from the Github branch
-----------------------------------------------------------------

Tomorrow. This will leave some time for some early feedback while still
having a chance to catch v6.19.

Thanks for reading!

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: David Yang <mmyangfl@gmail.com>
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: linux-renesas-soc@vger.kernel.org
Cc: Sean Wang <sean.wang@mediatek.com>
Cc: UNGLinuxDriver@microchip.com
Cc: Woojung Huh <woojung.huh@microchip.com>

Vladimir Oltean (15):
  net: dsa: introduce the dsa_xmit_port_mask() tagging protocol helper
  net: dsa: tag_brcm: use the dsa_xmit_port_mask() helper
  net: dsa: tag_gswip: use the dsa_xmit_port_mask() helper
  net: dsa: tag_hellcreek: use the dsa_xmit_port_mask() helper
  net: dsa: tag_ksz: use the dsa_xmit_port_mask() helper
  net: dsa: tag_mtk: use the dsa_xmit_port_mask() helper
  net: dsa: tag_mxl_gsw1xx: use the dsa_xmit_port_mask() helper
  net: dsa: tag_ocelot: use the dsa_xmit_port_mask() helper
  net: dsa: tag_qca: use the dsa_xmit_port_mask() helper
  net: dsa: tag_rtl4_a: use the dsa_xmit_port_mask() helper
  net: dsa: tag_rtl8_4: use the dsa_xmit_port_mask() helper
  net: dsa: tag_rzn1_a5psw: use the dsa_xmit_port_mask() helper
  net: dsa: tag_trailer: use the dsa_xmit_port_mask() helper
  net: dsa: tag_xrs700x: use the dsa_xmit_port_mask() helper
  net: dsa: tag_yt921x: use the dsa_xmit_port_mask() helper

 net/dsa/tag.h            | 18 ++++++++++++++++++
 net/dsa/tag_brcm.c       |  8 ++++----
 net/dsa/tag_gswip.c      |  6 ++----
 net/dsa/tag_hellcreek.c  |  3 +--
 net/dsa/tag_ksz.c        | 20 ++++----------------
 net/dsa/tag_mtk.c        |  3 ++-
 net/dsa/tag_mxl-gsw1xx.c |  7 ++++---
 net/dsa/tag_ocelot.c     |  6 ++----
 net/dsa/tag_qca.c        |  3 +--
 net/dsa/tag_rtl4_a.c     |  2 +-
 net/dsa/tag_rtl8_4.c     |  3 +--
 net/dsa/tag_rzn1_a5psw.c |  3 +--
 net/dsa/tag_trailer.c    |  3 +--
 net/dsa/tag_xrs700x.c    |  8 +-------
 net/dsa/tag_yt921x.c     |  8 +++-----
 15 files changed, 46 insertions(+), 55 deletions(-)

-- 
2.43.0




Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds