From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: netdev@vger.kernel.org
Cc: Andrew Lunn <andrew@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Woojung Huh <woojung.huh@microchip.com>,
UNGLinuxDriver@microchip.com
Subject: [PATCH net-next 05/15] net: dsa: tag_ksz: use the dsa_xmit_port_mask() helper
Date: Thu, 27 Nov 2025 14:08:52 +0200 [thread overview]
Message-ID: <20251127120902.292555-6-vladimir.oltean@nxp.com> (raw)
In-Reply-To: <20251127120902.292555-1-vladimir.oltean@nxp.com>
The "ksz8795", "ksz9893", "ksz9477" and "lan937x" tagging protocols
populate a bit mask for the TX ports.
Unlike the others, "ksz9477" also accelerates HSR packet duplication.
Make the HSR duplication logic available generically to all 4 taggers by
using the dsa_xmit_port_mask() function to set the TX port mask.
Cc: Woojung Huh <woojung.huh@microchip.com>
Cc: UNGLinuxDriver@microchip.com
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
net/dsa/tag_ksz.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c
index 0b7564b53790..9170a0148cc4 100644
--- a/net/dsa/tag_ksz.c
+++ b/net/dsa/tag_ksz.c
@@ -120,7 +120,6 @@ static struct sk_buff *ksz_common_rcv(struct sk_buff *skb,
static struct sk_buff *ksz8795_xmit(struct sk_buff *skb, struct net_device *dev)
{
- struct dsa_port *dp = dsa_user_to_port(dev);
struct ethhdr *hdr;
u8 *tag;
@@ -131,7 +130,7 @@ static struct sk_buff *ksz8795_xmit(struct sk_buff *skb, struct net_device *dev)
tag = skb_put(skb, KSZ_INGRESS_TAG_LEN);
hdr = skb_eth_hdr(skb);
- *tag = 1 << dp->index;
+ *tag = dsa_xmit_port_mask(skb, dev);
if (is_link_local_ether_addr(hdr->h_dest))
*tag |= KSZ8795_TAIL_TAG_OVERRIDE;
@@ -294,21 +293,12 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb,
tag = skb_put(skb, KSZ9477_INGRESS_TAG_LEN);
hdr = skb_eth_hdr(skb);
- val = BIT(dp->index);
-
+ val = dsa_xmit_port_mask(skb, dev);
val |= FIELD_PREP(KSZ9477_TAIL_TAG_PRIO, prio);
if (is_link_local_ether_addr(hdr->h_dest))
val |= KSZ9477_TAIL_TAG_OVERRIDE;
- if (dev->features & NETIF_F_HW_HSR_DUP) {
- struct net_device *hsr_dev = dp->hsr_dev;
- struct dsa_port *other_dp;
-
- dsa_hsr_foreach_port(other_dp, dp->ds, hsr_dev)
- val |= BIT(other_dp->index);
- }
-
*tag = cpu_to_be16(val);
return ksz_defer_xmit(dp, skb);
@@ -371,8 +361,7 @@ static struct sk_buff *ksz9893_xmit(struct sk_buff *skb,
tag = skb_put(skb, KSZ_INGRESS_TAG_LEN);
hdr = skb_eth_hdr(skb);
- *tag = BIT(dp->index);
-
+ *tag = dsa_xmit_port_mask(skb, dev);
*tag |= FIELD_PREP(KSZ9893_TAIL_TAG_PRIO, prio);
if (is_link_local_ether_addr(hdr->h_dest))
@@ -436,8 +425,7 @@ static struct sk_buff *lan937x_xmit(struct sk_buff *skb,
tag = skb_put(skb, LAN937X_EGRESS_TAG_LEN);
- val = BIT(dp->index);
-
+ val = dsa_xmit_port_mask(skb, dev);
val |= FIELD_PREP(LAN937X_TAIL_TAG_PRIO, prio);
if (is_link_local_ether_addr(hdr->h_dest))
--
2.43.0
next prev parent reply other threads:[~2025-11-27 12:09 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-27 12:08 [PATCH net-next 00/15] Introduce the dsa_xmit_port_mask() tagging protocol helper Vladimir Oltean
2025-11-27 12:08 ` [PATCH net-next 01/15] net: dsa: introduce " Vladimir Oltean
2025-11-27 12:08 ` [PATCH net-next 02/15] net: dsa: tag_brcm: use the dsa_xmit_port_mask() helper Vladimir Oltean
2025-11-27 13:29 ` Jonas Gorski
2025-11-27 13:42 ` Vladimir Oltean
2025-11-27 12:08 ` [PATCH net-next 03/15] net: dsa: tag_gswip: " Vladimir Oltean
2025-11-27 12:08 ` [PATCH net-next 04/15] net: dsa: tag_hellcreek: " Vladimir Oltean
2025-11-27 12:08 ` Vladimir Oltean [this message]
2025-11-27 12:08 ` [PATCH net-next 06/15] net: dsa: tag_mtk: " Vladimir Oltean
2025-11-27 12:08 ` [PATCH net-next 07/15] net: dsa: tag_mxl_gsw1xx: " Vladimir Oltean
2025-11-27 12:08 ` [PATCH net-next 08/15] net: dsa: tag_ocelot: " Vladimir Oltean
2025-11-27 12:08 ` [PATCH net-next 09/15] net: dsa: tag_qca: " Vladimir Oltean
2025-11-27 12:08 ` [PATCH net-next 10/15] net: dsa: tag_rtl4_a: " Vladimir Oltean
2025-12-31 3:17 ` Luiz Angelo Daros de Luca
2025-12-31 21:05 ` Linus Walleij
2025-11-27 12:08 ` [PATCH net-next 11/15] net: dsa: tag_rtl8_4: " Vladimir Oltean
2025-12-31 3:20 ` Luiz Angelo Daros de Luca
2025-12-31 21:05 ` Linus Walleij
2025-11-27 12:08 ` [PATCH net-next 12/15] net: dsa: tag_rzn1_a5psw: " Vladimir Oltean
2025-11-27 12:09 ` [PATCH net-next 13/15] net: dsa: tag_trailer: " Vladimir Oltean
2025-11-27 12:09 ` [PATCH net-next 14/15] net: dsa: tag_xrs700x: " Vladimir Oltean
2025-11-27 12:09 ` [PATCH net-next 15/15] net: dsa: tag_yt921x: " Vladimir Oltean
2025-11-29 4:10 ` [PATCH net-next 00/15] Introduce the dsa_xmit_port_mask() tagging protocol helper patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251127120902.292555-6-vladimir.oltean@nxp.com \
--to=vladimir.oltean@nxp.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=woojung.huh@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox