]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: phylink: add debug for phylink_major_config()
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tue, 3 Dec 2024 15:30:57 +0000 (15:30 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 5 Dec 2024 03:19:06 +0000 (19:19 -0800)
Now that we have a more complexity in phylink_major_config(), augment
the debugging so we can see what's going on there.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1tIUrZ-006ITt-Fa@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/phylink.c

index 098021f1ab490f46d87dce8d97f7d7df49e28265..fda53dd58285e263424c7857e301c1b8258e9092 100644 (file)
@@ -175,6 +175,24 @@ static const char *phylink_an_mode_str(unsigned int mode)
        return mode < ARRAY_SIZE(modestr) ? modestr[mode] : "unknown";
 }
 
+static const char *phylink_pcs_mode_str(unsigned int mode)
+{
+       if (!mode)
+               return "none";
+
+       if (mode & PHYLINK_PCS_NEG_OUTBAND)
+               return "outband";
+
+       if (mode & PHYLINK_PCS_NEG_INBAND) {
+               if (mode & PHYLINK_PCS_NEG_ENABLED)
+                       return "inband,an-enabled";
+               else
+                       return "inband,an-disabled";
+       }
+
+       return "unknown";
+}
+
 static unsigned int phylink_interface_signal_rate(phy_interface_t interface)
 {
        switch (interface) {
@@ -1164,7 +1182,9 @@ static void phylink_major_config(struct phylink *pl, bool restart,
        unsigned int neg_mode;
        int err;
 
-       phylink_dbg(pl, "major config %s\n", phy_modes(state->interface));
+       phylink_dbg(pl, "major config, requested %s/%s\n",
+                   phylink_an_mode_str(pl->req_link_an_mode),
+                   phy_modes(state->interface));
 
        if (pl->mac_ops->mac_select_pcs) {
                pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface);
@@ -1180,6 +1200,11 @@ static void phylink_major_config(struct phylink *pl, bool restart,
 
        phylink_pcs_neg_mode(pl, pcs, state->interface, state->advertising);
 
+       phylink_dbg(pl, "major config, active %s/%s/%s\n",
+                   phylink_an_mode_str(pl->act_link_an_mode),
+                   phylink_pcs_mode_str(pl->pcs_neg_mode),
+                   phy_modes(state->interface));
+
        phylink_pcs_poll_stop(pl);
 
        if (pl->mac_ops->mac_prepare) {