[PATCH v1 net-next] net: dsa: Allow only up to two HSR HW offloaded ports for KSZ9477
From: Lukasz Majewski
Date: Tue Jun 18 2024 - 09:38:05 EST
The KSZ9477 allows HSR in-HW offloading for any of two selected ports.
This patch adds check if one tries to use more than two ports with
HSR offloading enabled.
Signed-off-by: Lukasz Majewski <lukma@xxxxxxx>
---
drivers/net/dsa/microchip/ksz_common.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 2818e24e2a51..0d68f0a5bf19 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -3913,6 +3913,9 @@ static int ksz_hsr_join(struct dsa_switch *ds, int port, struct net_device *hsr,
if (ret)
return ret;
+ if (dev->chip_id == KSZ9477_CHIP_ID && hweight8(dev->hsr_ports) > 1)
+ return -EOPNOTSUPP;
+
ksz9477_hsr_join(ds, port, hsr);
dev->hsr_dev = hsr;
dev->hsr_ports |= BIT(port);
--
2.20.1