Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: dsa: tag_ksz: Extend ksz9477_xmit() for HSR frame 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.

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@denx.de>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Lukasz Majewski and committed by
Paolo Abeni
5e5db71a 6715042c

+8
+8
net/dsa/tag_ksz.c
··· 293 293 if (is_link_local_ether_addr(hdr->h_dest)) 294 294 val |= KSZ9477_TAIL_TAG_OVERRIDE; 295 295 296 + if (dev->features & NETIF_F_HW_HSR_DUP) { 297 + struct net_device *hsr_dev = dp->hsr_dev; 298 + struct dsa_port *other_dp; 299 + 300 + dsa_hsr_foreach_port(other_dp, dp->ds, hsr_dev) 301 + val |= BIT(other_dp->index); 302 + } 303 + 296 304 *tag = cpu_to_be16(val); 297 305 298 306 return ksz_defer_xmit(dp, skb);