]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: dsa: microchip: implement .support_eee() only if needed
authorBastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
Mon, 8 Jun 2026 14:10:09 +0000 (16:10 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 13 Jun 2026 01:08:07 +0000 (18:08 -0700)
The .support_eee() operation is optional. Yet, it is implemented by the
KSZ switches through a common functon that reports false for every chip
except for KSZ8563, KSZ9563 and KSZ9893 from the KSZ9477 family.

Remove the implementation from the switches that don't support EEE.
Also remove .set_mac_eee() for them as .set_mac_eee() is gated by the
`support_eee` presence in the core.

Implement instead a ksz9477-specific support_eee for these three supported
switches.

Note that comment /* KSZ879x/KSZ877x/KSZ876x Errata DS80000687C Module 2 */
is completely removed because it concerns the KSZ87xx family that doesn't
support at all EEE.

Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
Link: https://patch.msgid.link/20260608-clean-ksz-3rd-v2-6-6e61b7be23c4@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/microchip/ksz8.c
drivers/net/dsa/microchip/ksz9477.c
drivers/net/dsa/microchip/ksz_common.c
drivers/net/dsa/microchip/ksz_common.h
drivers/net/dsa/microchip/lan937x_main.c

index ba708ad71c1ebc57a714c4b8070a97dde8526968..c0420954cb10c600d160cc7f59ae4ff8d4d001e2 100644 (file)
@@ -2566,8 +2566,6 @@ const struct dsa_switch_ops ksz8463_switch_ops = {
        .port_txtstamp          = ksz_port_txtstamp,
        .port_rxtstamp          = ksz_port_rxtstamp,
        .port_setup_tc          = ksz_setup_tc,
-       .support_eee            = ksz_support_eee,
-       .set_mac_eee            = ksz_set_mac_eee,
        .port_get_default_prio  = ksz_port_get_default_prio,
        .port_set_default_prio  = ksz_port_set_default_prio,
        .port_get_dscp_prio     = ksz_port_get_dscp_prio,
@@ -2623,8 +2621,6 @@ const struct dsa_switch_ops ksz87xx_switch_ops = {
        .port_txtstamp          = ksz_port_txtstamp,
        .port_rxtstamp          = ksz_port_rxtstamp,
        .port_setup_tc          = ksz_setup_tc,
-       .support_eee            = ksz_support_eee,
-       .set_mac_eee            = ksz_set_mac_eee,
        .port_get_default_prio  = ksz_port_get_default_prio,
        .port_set_default_prio  = ksz_port_set_default_prio,
        .port_get_dscp_prio     = ksz_port_get_dscp_prio,
@@ -2681,8 +2677,6 @@ const struct dsa_switch_ops ksz88xx_switch_ops = {
        .port_txtstamp          = ksz_port_txtstamp,
        .port_rxtstamp          = ksz_port_rxtstamp,
        .port_setup_tc          = ksz_setup_tc,
-       .support_eee            = ksz_support_eee,
-       .set_mac_eee            = ksz_set_mac_eee,
        .port_get_default_prio  = ksz_port_get_default_prio,
        .port_set_default_prio  = ksz_port_set_default_prio,
        .port_get_dscp_prio     = ksz_port_get_dscp_prio,
index a39541d29ad5baf2ac2390f55d9f638a69d298b0..e0b3724a75585e5f24ff95b7c90c4cf2d85a1770 100644 (file)
@@ -1909,6 +1909,54 @@ void ksz9477_phylink_mac_link_up(struct phylink_config *config,
        ksz9477_duplex_flowctrl(dev, port, duplex, tx_pause, rx_pause);
 }
 
+/**
+ * ksz9477_support_eee - Determine Energy Efficient Ethernet (EEE) support for a
+ *                       port
+ * @ds: Pointer to the DSA switch structure
+ * @port: Port number to check
+ *
+ * This function also documents devices where EEE was initially advertised but
+ * later withdrawn due to reliability issues, as described in official errata
+ * documents. These devices are explicitly listed to record known limitations,
+ * even if there is no technical necessity for runtime checks.
+ *
+ * Returns: true if the internal PHY on the given port supports fully
+ * operational EEE, false otherwise.
+ */
+static bool ksz9477_support_eee(struct dsa_switch *ds, int port)
+{
+       struct ksz_device *dev = ds->priv;
+
+       if (!dev->info->internal_phy[port])
+               return false;
+
+       switch (dev->chip_id) {
+       case KSZ8563_CHIP_ID:
+       case KSZ9563_CHIP_ID:
+       case KSZ9893_CHIP_ID:
+               return true;
+       default:
+               /* KSZ8567R Errata DS80000752C Module 4 */
+               /* KSZ9477S Errata DS80000754A Module 4 */
+               /* KSZ9567S Errata DS80000756A Module 4 */
+               /* KSZ9896C Errata DS80000757A Module 3 */
+               /* KSZ9897R Errata DS80000758C Module 4 */
+               /* Energy Efficient Ethernet (EEE) feature select must be
+                * manually disabled
+                *   The EEE feature is enabled by default, but it is not fully
+                *   operational. It must be manually disabled through register
+                *   controls. If not disabled, the PHY ports can auto-negotiate
+                *   to enable EEE, and this feature can cause link drops when
+                *   linked to another device supporting EEE.
+                *
+                * The same item appears in the errata for all switches above.
+                */
+               break;
+       }
+
+       return false;
+}
+
 static struct phylink_pcs *
 ksz9477_phylink_mac_select_pcs(struct phylink_config *config,
                               phy_interface_t interface)
@@ -1998,7 +2046,7 @@ const struct dsa_switch_ops ksz9477_switch_ops = {
        .cls_flower_add         = ksz9477_cls_flower_add,
        .cls_flower_del         = ksz9477_cls_flower_del,
        .port_setup_tc          = ksz_setup_tc,
-       .support_eee            = ksz_support_eee,
+       .support_eee            = ksz9477_support_eee,
        .set_mac_eee            = ksz_set_mac_eee,
        .port_get_default_prio  = ksz_port_get_default_prio,
        .port_set_default_prio  = ksz_port_set_default_prio,
index 33a20c2e0a8aaa0187c4a8d758012b3eb38adcb7..bebf697ec60a36252ea257d51f2a6be4bd08b905 100644 (file)
@@ -3052,63 +3052,6 @@ int ksz_max_mtu(struct dsa_switch *ds, int port)
        return -EOPNOTSUPP;
 }
 
-/**
- * ksz_support_eee - Determine Energy Efficient Ethernet (EEE) support for a
- *                   port
- * @ds: Pointer to the DSA switch structure
- * @port: Port number to check
- *
- * This function also documents devices where EEE was initially advertised but
- * later withdrawn due to reliability issues, as described in official errata
- * documents. These devices are explicitly listed to record known limitations,
- * even if there is no technical necessity for runtime checks.
- *
- * Returns: true if the internal PHY on the given port supports fully
- * operational EEE, false otherwise.
- */
-bool ksz_support_eee(struct dsa_switch *ds, int port)
-{
-       struct ksz_device *dev = ds->priv;
-
-       if (!dev->info->internal_phy[port])
-               return false;
-
-       switch (dev->chip_id) {
-       case KSZ8563_CHIP_ID:
-       case KSZ9563_CHIP_ID:
-       case KSZ9893_CHIP_ID:
-               return true;
-       case KSZ8567_CHIP_ID:
-               /* KSZ8567R Errata DS80000752C Module 4 */
-       case KSZ8765_CHIP_ID:
-       case KSZ8794_CHIP_ID:
-       case KSZ8795_CHIP_ID:
-               /* KSZ879x/KSZ877x/KSZ876x Errata DS80000687C Module 2 */
-       case KSZ9477_CHIP_ID:
-               /* KSZ9477S Errata DS80000754A Module 4 */
-       case KSZ9567_CHIP_ID:
-               /* KSZ9567S Errata DS80000756A Module 4 */
-       case KSZ9896_CHIP_ID:
-               /* KSZ9896C Errata DS80000757A Module 3 */
-       case KSZ9897_CHIP_ID:
-       case LAN9646_CHIP_ID:
-               /* KSZ9897R Errata DS80000758C Module 4 */
-               /* Energy Efficient Ethernet (EEE) feature select must be
-                * manually disabled
-                *   The EEE feature is enabled by default, but it is not fully
-                *   operational. It must be manually disabled through register
-                *   controls. If not disabled, the PHY ports can auto-negotiate
-                *   to enable EEE, and this feature can cause link drops when
-                *   linked to another device supporting EEE.
-                *
-                * The same item appears in the errata for all switches above.
-                */
-               break;
-       }
-
-       return false;
-}
-
 int ksz_set_mac_eee(struct dsa_switch *ds, int port,
                    struct ethtool_keee *e)
 {
index 4c3a551a5b60fa5edef12094c4523a12111cf988..344d27a8dba1312f1c1629ae08ebe9f99539060a 100644 (file)
@@ -482,7 +482,6 @@ void ksz_phylink_mac_link_down(struct phylink_config *config,
 
 int ksz_max_mtu(struct dsa_switch *ds, int port);
 
-bool ksz_support_eee(struct dsa_switch *ds, int port);
 int ksz_set_mac_eee(struct dsa_switch *ds, int port,
                    struct ethtool_keee *e);
 
index 69df378a40bfddb7f84d4f303e8fc78165040a8b..e1aba93d14385a0989b275ee9143d17698867ca6 100644 (file)
@@ -903,8 +903,6 @@ const struct dsa_switch_ops lan937x_switch_ops = {
        .port_txtstamp          = ksz_port_txtstamp,
        .port_rxtstamp          = ksz_port_rxtstamp,
        .port_setup_tc          = ksz_setup_tc,
-       .support_eee            = ksz_support_eee,
-       .set_mac_eee            = ksz_set_mac_eee,
        .port_get_default_prio  = ksz_port_get_default_prio,
        .port_set_default_prio  = ksz_port_set_default_prio,
        .port_get_dscp_prio     = ksz_port_get_dscp_prio,