net: phylink: pass neg_mode into .pcs_get_state() method
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Mon, 13 Jan 2025 09:22:29 +0000 (09:22 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 15 Jan 2025 21:23:30 +0000 (13:23 -0800)
Pass the current neg_mode into the .pcs_get_state() method. Update all
users of phylink PCS.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Tested-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/E1tXGeT-000Et3-4L@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
20 files changed:
drivers/net/dsa/b53/b53_serdes.c
drivers/net/dsa/mt7530.c
drivers/net/dsa/mv88e6xxx/pcs-6185.c
drivers/net/dsa/mv88e6xxx/pcs-6352.c
drivers/net/dsa/mv88e6xxx/pcs-639x.c
drivers/net/dsa/qca/qca8k-8xxx.c
drivers/net/ethernet/cadence/macb_main.c
drivers/net/ethernet/freescale/fman/fman_dtsec.c
drivers/net/ethernet/marvell/mvneta.c
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
drivers/net/ethernet/marvell/prestera/prestera_main.c
drivers/net/ethernet/meta/fbnic/fbnic_phylink.c
drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c
drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c
drivers/net/ethernet/xilinx/xilinx_axienet_main.c
drivers/net/pcs/pcs-lynx.c
drivers/net/pcs/pcs-mtk-lynxi.c
drivers/net/pcs/pcs-xpcs.c
drivers/net/phy/phylink.c
include/linux/phylink.h

index 3f8a491ce885b369bfedd1bf161b7d2c03b3e7a3..4730982b684003ef049f8fc489d55f864593b66c 100644 (file)
@@ -99,8 +99,8 @@ static void b53_serdes_an_restart(struct phylink_pcs *pcs)
                         SERDES_MII_BLK, reg);
 }
 
-static void b53_serdes_get_state(struct phylink_pcs *pcs,
-                                 struct phylink_link_state *state)
+static void b53_serdes_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
+                                struct phylink_link_state *state)
 {
        struct b53_device *dev = pcs_to_b53_pcs(pcs)->dev;
        u8 lane = pcs_to_b53_pcs(pcs)->lane;
index d2d0f091e49e915c6fcfbde1d196672b87e1f356..1c83af805209cae40c56138fa8f72261e396f58c 100644 (file)
@@ -2994,7 +2994,7 @@ static int mt753x_pcs_validate(struct phylink_pcs *pcs,
        return 0;
 }
 
-static void mt7530_pcs_get_state(struct phylink_pcs *pcs,
+static void mt7530_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
                                 struct phylink_link_state *state)
 {
        struct mt7530_priv *priv = pcs_to_mt753x_pcs(pcs)->priv;
index 5a27d047a38ecc78f656c24b511845f37d34662b..75ed1fa500a5c0cbfd74db7289ee3f02ad3d04b2 100644 (file)
@@ -55,6 +55,7 @@ static irqreturn_t mv88e6185_pcs_handle_irq(int irq, void *dev_id)
 }
 
 static void mv88e6185_pcs_get_state(struct phylink_pcs *pcs,
+                                   unsigned int neg_mode,
                                    struct phylink_link_state *state)
 {
        struct mv88e6185_pcs *mpcs = pcs_to_mv88e6185_pcs(pcs);
index 88f624b654702e98334ef286b7caf0660a0f1fe8..143fe21d18349cfc03cac32a2782fc0ee395c24a 100644 (file)
@@ -158,6 +158,7 @@ static void marvell_c22_pcs_disable(struct phylink_pcs *pcs)
 }
 
 static void marvell_c22_pcs_get_state(struct phylink_pcs *pcs,
+                                     unsigned int neg_mode,
                                      struct phylink_link_state *state)
 {
        struct marvell_c22_pcs *mpcs = pcs_to_marvell_c22_pcs(pcs);
index d758a6c1b226380f7b9335a73ce90fdc2e65ddce..026b7bfb7ee5b5b762355a316d916d6165d3bb97 100644 (file)
@@ -257,6 +257,7 @@ static int mv88e639x_sgmii_pcs_post_config(struct phylink_pcs *pcs,
 }
 
 static void mv88e639x_sgmii_pcs_get_state(struct phylink_pcs *pcs,
+                                         unsigned int neg_mode,
                                          struct phylink_link_state *state)
 {
        struct mv88e639x_pcs *mpcs = sgmii_pcs_to_mv88e639x_pcs(pcs);
@@ -395,6 +396,7 @@ static void mv88e639x_xg_pcs_disable(struct mv88e639x_pcs *mpcs)
 }
 
 static void mv88e639x_xg_pcs_get_state(struct phylink_pcs *pcs,
+                                      unsigned int neg_mode,
                                       struct phylink_link_state *state)
 {
        struct mv88e639x_pcs *mpcs = xg_pcs_to_mv88e639x_pcs(pcs);
@@ -889,6 +891,7 @@ static int mv88e6393x_xg_pcs_post_config(struct phylink_pcs *pcs,
 }
 
 static void mv88e6393x_xg_pcs_get_state(struct phylink_pcs *pcs,
+                                       unsigned int neg_mode,
                                        struct phylink_link_state *state)
 {
        struct mv88e639x_pcs *mpcs = xg_pcs_to_mv88e639x_pcs(pcs);
@@ -896,7 +899,7 @@ static void mv88e6393x_xg_pcs_get_state(struct phylink_pcs *pcs,
        int err;
 
        if (state->interface != PHY_INTERFACE_MODE_USXGMII)
-               return mv88e639x_xg_pcs_get_state(pcs, state);
+               return mv88e639x_xg_pcs_get_state(pcs, neg_mode, state);
 
        state->link = false;
 
index 750fc76a6e116a0d50a0595b74599e32892cb9ca..e8cb4da15dbe4374c00496ddb4631e4804a91ddb 100644 (file)
@@ -1491,7 +1491,7 @@ static struct qca8k_pcs *pcs_to_qca8k_pcs(struct phylink_pcs *pcs)
        return container_of(pcs, struct qca8k_pcs, pcs);
 }
 
-static void qca8k_pcs_get_state(struct phylink_pcs *pcs,
+static void qca8k_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
                                struct phylink_link_state *state)
 {
        struct qca8k_priv *priv = pcs_to_qca8k_pcs(pcs)->priv;
index 640f500f989d5b3de36b9ddcb8ccb8e8863aead3..48496209fb16445d15ffd2f18f8d5e61fd2e29c9 100644 (file)
@@ -568,6 +568,7 @@ static void macb_usx_pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode,
 }
 
 static void macb_usx_pcs_get_state(struct phylink_pcs *pcs,
+                                  unsigned int neg_mode,
                                   struct phylink_link_state *state)
 {
        struct macb *bp = container_of(pcs, struct macb, phylink_usx_pcs);
@@ -598,7 +599,7 @@ static int macb_usx_pcs_config(struct phylink_pcs *pcs,
        return 0;
 }
 
-static void macb_pcs_get_state(struct phylink_pcs *pcs,
+static void macb_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
                               struct phylink_link_state *state)
 {
        state->link = 0;
index 85617bb94959f3789d75766bce8f3e11a7b321d5..c47108c820ea0c072c928390f36a4031fef2b96a 100644 (file)
@@ -755,7 +755,7 @@ static struct fman_mac *pcs_to_dtsec(struct phylink_pcs *pcs)
        return container_of(pcs, struct fman_mac, pcs);
 }
 
-static void dtsec_pcs_get_state(struct phylink_pcs *pcs,
+static void dtsec_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
                                struct phylink_link_state *state)
 {
        struct fman_mac *dtsec = pcs_to_dtsec(pcs);
index fe6261b8154090311495f6feae3d167bff654915..9e79a60baebc9c1b79faef0354f05d64354372cc 100644 (file)
@@ -3983,7 +3983,7 @@ static unsigned int mvneta_pcs_inband_caps(struct phylink_pcs *pcs,
        return LINK_INBAND_DISABLE;
 }
 
-static void mvneta_pcs_get_state(struct phylink_pcs *pcs,
+static void mvneta_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
                                 struct phylink_link_state *state)
 {
        struct mvneta_port *pp = mvneta_pcs_to_port(pcs);
index f85229a3084419124b49f4b0aa76751d04b91021..d294580f483252b48045b2553a9d836c86104f28 100644 (file)
@@ -6188,6 +6188,7 @@ static struct mvpp2_port *mvpp2_pcs_gmac_to_port(struct phylink_pcs *pcs)
 }
 
 static void mvpp2_xlg_pcs_get_state(struct phylink_pcs *pcs,
+                                   unsigned int neg_mode,
                                    struct phylink_link_state *state)
 {
        struct mvpp2_port *port = mvpp2_pcs_xlg_to_port(pcs);
@@ -6247,6 +6248,7 @@ static unsigned int mvpp2_gmac_pcs_inband_caps(struct phylink_pcs *pcs,
 }
 
 static void mvpp2_gmac_pcs_get_state(struct phylink_pcs *pcs,
+                                    unsigned int neg_mode,
                                     struct phylink_link_state *state)
 {
        struct mvpp2_port *port = mvpp2_pcs_gmac_to_port(pcs);
index 22ca6ee9665eb41cd4ea3acbe9122b063908afbb..440a4c42b405fb71117803ebcdf44fc66292d09e 100644 (file)
@@ -280,6 +280,7 @@ prestera_mac_select_pcs(struct phylink_config *config,
 }
 
 static void prestera_pcs_get_state(struct phylink_pcs *pcs,
+                                  unsigned int neg_mode,
                                   struct phylink_link_state *state)
 {
        struct prestera_port *port = container_of(pcs, struct prestera_port,
index 1a5e1e719b3096f90e5ca49d77574bf8970219a1..bb11fc83367d886c8d27e451b70f611eb120d84f 100644 (file)
@@ -15,7 +15,7 @@ fbnic_pcs_to_net(struct phylink_pcs *pcs)
 }
 
 static void
-fbnic_phylink_pcs_get_state(struct phylink_pcs *pcs,
+fbnic_phylink_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
                            struct phylink_link_state *state)
 {
        struct fbnic_net *fbn = fbnic_pcs_to_net(pcs);
index 1d63903f9006da9062ab47f083a4270f8967bd11..a761777259bfda06c03d26ad4ef230d32bd5026c 100644 (file)
@@ -88,6 +88,7 @@ static struct lan966x_port *lan966x_pcs_to_port(struct phylink_pcs *pcs)
 }
 
 static void lan966x_pcs_get_state(struct phylink_pcs *pcs,
+                                 unsigned int neg_mode,
                                  struct phylink_link_state *state)
 {
        struct lan966x_port *port = lan966x_pcs_to_port(pcs);
index 035d2f1bea0d0e9d3c392629909097700fb2ba67..cfb4b2e17ace020c7ef597dc3bae02766fe8fcfc 100644 (file)
@@ -89,7 +89,7 @@ static struct sparx5_port *sparx5_pcs_to_port(struct phylink_pcs *pcs)
        return container_of(pcs, struct sparx5_port, phylink_pcs);
 }
 
-static void sparx5_pcs_get_state(struct phylink_pcs *pcs,
+static void sparx5_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
                                 struct phylink_link_state *state)
 {
        struct sparx5_port *port = sparx5_pcs_to_port(pcs);
index 0f4b02fe6f85681bca9d45b08e37718effef1d22..f9e695d7cc4a283dd0596829ce0a0ac4f84812a1 100644 (file)
@@ -2331,6 +2331,7 @@ static struct axienet_local *pcs_to_axienet_local(struct phylink_pcs *pcs)
 }
 
 static void axienet_pcs_get_state(struct phylink_pcs *pcs,
+                                 unsigned int neg_mode,
                                  struct phylink_link_state *state)
 {
        struct mdio_device *pcs_phy = pcs_to_axienet_local(pcs)->pcs_phy;
index 6457190ec6e710e3d4cd76196535ef3987798ad4..f359f62f69add304a58c44f7d5fa2220f337583b 100644 (file)
@@ -100,7 +100,7 @@ static void lynx_pcs_get_state_2500basex(struct mdio_device *pcs,
        state->duplex = DUPLEX_FULL;
 }
 
-static void lynx_pcs_get_state(struct phylink_pcs *pcs,
+static void lynx_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
                               struct phylink_link_state *state)
 {
        struct lynx_pcs *lynx = phylink_pcs_to_lynx(pcs);
index 4fe0fb6d12a400102066edc3a0723d18da0bea7e..e1b6f332c3c2e28a7106130119b9fe94273aae0f 100644 (file)
@@ -105,6 +105,7 @@ static unsigned int mtk_pcs_lynxi_inband_caps(struct phylink_pcs *pcs,
 }
 
 static void mtk_pcs_lynxi_get_state(struct phylink_pcs *pcs,
+                                   unsigned int neg_mode,
                                    struct phylink_link_state *state)
 {
        struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs);
index c06b66f40022f3ef8847e211047b43ee2ebe6781..4cd0c4fe64963c3a55bf04011e3a54862a1c3fe9 100644 (file)
@@ -1086,7 +1086,7 @@ static int xpcs_get_state_2500basex(struct dw_xpcs *xpcs,
        return 0;
 }
 
-static void xpcs_get_state(struct phylink_pcs *pcs,
+static void xpcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
                           struct phylink_link_state *state)
 {
        struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs);
index 31f2d8a8ff19d9027e80e369db276dbeca461329..a8d443ee18be02664a90eaa3590217ab98322611 100644 (file)
@@ -1520,7 +1520,7 @@ static void phylink_mac_pcs_get_state(struct phylink *pl,
        }
 
        if (pcs)
-               pcs->ops->pcs_get_state(pcs, state);
+               pcs->ops->pcs_get_state(pcs, pl->pcs_neg_mode, state);
        else
                state->link = 0;
 }
index 4b7a20620b496f0de5618b671af9e4deae93142f..0bbcb4898e9315fac2bda104dc7b9fe8e085381d 100644 (file)
@@ -446,7 +446,7 @@ struct phylink_pcs_ops {
                               phy_interface_t interface);
        int (*pcs_post_config)(struct phylink_pcs *pcs,
                               phy_interface_t interface);
-       void (*pcs_get_state)(struct phylink_pcs *pcs,
+       void (*pcs_get_state)(struct phylink_pcs *pcs, unsigned int neg_mode,
                              struct phylink_link_state *state);
        int (*pcs_config)(struct phylink_pcs *pcs, unsigned int neg_mode,
                          phy_interface_t interface,
@@ -505,6 +505,7 @@ void pcs_disable(struct phylink_pcs *pcs);
 /**
  * pcs_get_state() - Read the current inband link state from the hardware
  * @pcs: a pointer to a &struct phylink_pcs.
+ * @neg_mode: link negotiation mode (PHYLINK_PCS_NEG_xxx)
  * @state: a pointer to a &struct phylink_link_state.
  *
  * Read the current inband link state from the MAC PCS, reporting the
@@ -513,8 +514,11 @@ void pcs_disable(struct phylink_pcs *pcs);
  * negotiation completion state in @state->an_complete, and link up state
  * in @state->link. If possible, @state->lp_advertising should also be
  * populated.
+ *
+ * Note that the @neg_mode parameter is always the PHYLINK_PCS_NEG_xxx
+ * state, not MLO_AN_xxx.
  */
-void pcs_get_state(struct phylink_pcs *pcs,
+void pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
                   struct phylink_link_state *state);
 
 /**