summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2021-11-21 13:02:03 +0000
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2022-06-21 10:57:31 +0100
commit07d127da177af0729ce15fb7307ed49a741e82bf (patch)
tree29859ce433a32aa229c48e971dd4f886950dfd32 /include/linux
parent444d244901e1868dd2d0c3e231678bcc31832a3a (diff)
net: phylink: add phylink_pcs_inband()
Add phylink_pcs_inband() to indicate whether the PCS should be using inband signalling. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/phylink.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/phylink.h b/include/linux/phylink.h
index 51605b1468a3..4e367de691d4 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -51,6 +51,25 @@ static inline bool phylink_autoneg_inband(unsigned int mode)
}
/**
+ * phylink_pcs_inband() - helper to indicate whether to enable inband signalling
+ * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
+ * @interface: interface mode to be used
+ * @advertising: adertisement ethtool link mode mask
+ *
+ * Returns true if the mode/interface/advertising mask indicates that we
+ * should be using inband signalling at the PCS block, false otherwise.
+ */
+static inline bool phylink_pcs_inband(unsigned int mode,
+ phy_interface_t interface,
+ const unsigned long *advertising)
+{
+ return phylink_autoneg_inband(mode) &&
+ (interface == PHY_INTERFACE_MODE_SGMII ||
+ interface == PHY_INTERFACE_MODE_QSGMII ||
+ linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, advertising));
+}
+
+/**
* struct phylink_link_state - link state structure
* @advertising: ethtool bitmask containing advertised link modes
* @lp_advertising: ethtool bitmask containing link partner advertised link