Re: [PATCH net-next 7/9] net: dsa: microchip: implement port_hsr_join for KSZ9477 only

From: Bastien Curutchet

Date: Tue Jun 02 2026 - 10:13:41 EST


Hi again Paolo,

On 6/2/26 2:35 PM, Bastien Curutchet wrote:
Hi Paolo,

On 6/1/26 11:03 AM, Paolo Abeni wrote:
On 5/26/26 11:47 AM, Bastien Curutchet (Schneider Electric) wrote:
@@ -1744,12 +1784,20 @@ void ksz9477_hsr_join(struct dsa_switch *ds, int port, struct net_device *hsr)
      /* Setup HW supported features for lan HSR ports */
      user = dsa_to_port(ds, port)->user;
      user->features |= KSZ9477_SUPPORTED_HSR_FEATURES;
+
+    dev->hsr_dev = hsr;
+    dev->hsr_ports |= BIT(port);
+
+    return 0;
  }
-void ksz9477_hsr_leave(struct dsa_switch *ds, int port, struct net_device *hsr)
+static int ksz9477_hsr_leave(struct dsa_switch *ds, int port,
+                 struct net_device *hsr)
  {
      struct ksz_device *dev = ds->priv;
+    WARN_ON(dev->chip_id != KSZ9477_CHIP_ID);

Since the new op is used only by the relevant switch version, I think
you could/should remove the above warning.


Ack, will do.


I'm having second thoughts now that I'm about to do it.

This HSR feature is only supported by the KSZ9477 itself, not by all the switches using ksz9477_switch_ops. A check is done against the KSZ9477_CHIP_ID in ksz9477_hsr_join(). This WARN_ON is kind of symmetric with the ksz9477_hsr_join()'s check so, IMHO, it makes sense to keep it.



Best regards,
Bastien