[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230829121132.414335-3-lukma@denx.de>
Date: Tue, 29 Aug 2023 14:11:30 +0200
From: Lukasz Majewski <lukma@...x.de>
To: Tristram.Ha@...rochip.com, Eric Dumazet <edumazet@...gle.com>,
davem@...emloft.net, Woojung Huh <woojung.huh@...rochip.com>,
Vladimir Oltean <olteanv@...il.com>
Cc: Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, UNGLinuxDriver@...rochip.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Lukasz Majewski <lukma@...x.de>
Subject: [PATCH 2/4] net: dsa: Extend ksz9477 TAG setup to support HSR frames duplication
The KSZ9477 has support for HSR (High-Availability Seamless Redundancy).
One of its offloading (i.e. performed in the switch IC hardware) features
is to duplicate received frame to both HSR aware switch ports.
To achieve this goal - the tail TAG needs to be modified. To be more
specific, both ports must be marked as destination (egress) ones.
Moreover, according to AN3474 application note, the lookup bit (10)
should not be set in the tail tag.
Last but not least - the NETIF_F_HW_HSR_DUP flag indicates that the device
supports HSR and assures (in HSR core code) that frame is sent only once
from HOST to switch with tail tag indicating both ports.
Signed-off-by: Lukasz Majewski <lukma@...x.de>
---
net/dsa/tag_ksz.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c
index ea100bd25939..1410e7ed0f9a 100644
--- a/net/dsa/tag_ksz.c
+++ b/net/dsa/tag_ksz.c
@@ -293,6 +293,11 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb,
if (is_link_local_ether_addr(hdr->h_dest))
val |= KSZ9477_TAIL_TAG_OVERRIDE;
+ if (dev->features & NETIF_F_HW_HSR_DUP) {
+ val &= ~KSZ9477_TAIL_TAG_LOOKUP;
+ val |= dp->ds->hsr_ports;
+ }
+
*tag = cpu_to_be16(val);
return ksz_defer_xmit(dp, skb);
--
2.20.1
Powered by blists - more mailing lists