| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- From 5e5401d6612ef599ad45785b941eebda7effc90f Mon Sep 17 00:00:00 2001
- From: "Russell King (Oracle)" <[email protected]>
- Date: Thu, 4 Jan 2024 09:47:36 +0000
- Subject: [PATCH] net: phylink: move phylink_pcs_neg_mode() into phylink.c
- Move phylink_pcs_neg_mode() from the header file into the .c file since
- nothing should be using it.
- Signed-off-by: Russell King (Oracle) <[email protected]>
- Reviewed-by: Andrew Lunn <[email protected]>
- Signed-off-by: David S. Miller <[email protected]>
- ---
- drivers/net/phy/phylink.c | 66 +++++++++++++++++++++++++++++++++++++++
- include/linux/phylink.h | 66 ---------------------------------------
- 2 files changed, 66 insertions(+), 66 deletions(-)
- --- a/drivers/net/phy/phylink.c
- +++ b/drivers/net/phy/phylink.c
- @@ -1150,6 +1150,72 @@ static void phylink_pcs_an_restart(struc
- pl->pcs->ops->pcs_an_restart(pl->pcs);
- }
-
- +/**
- + * phylink_pcs_neg_mode() - helper to determine PCS inband mode
- + * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
- + * @interface: interface mode to be used
- + * @advertising: adertisement ethtool link mode mask
- + *
- + * Determines the negotiation mode to be used by the PCS, and returns
- + * one of:
- + *
- + * - %PHYLINK_PCS_NEG_NONE: interface mode does not support inband
- + * - %PHYLINK_PCS_NEG_OUTBAND: an out of band mode (e.g. reading the PHY)
- + * will be used.
- + * - %PHYLINK_PCS_NEG_INBAND_DISABLED: inband mode selected but autoneg
- + * disabled
- + * - %PHYLINK_PCS_NEG_INBAND_ENABLED: inband mode selected and autoneg enabled
- + *
- + * Note: this is for cases where the PCS itself is involved in negotiation
- + * (e.g. Clause 37, SGMII and similar) not Clause 73.
- + */
- +static unsigned int phylink_pcs_neg_mode(unsigned int mode,
- + phy_interface_t interface,
- + const unsigned long *advertising)
- +{
- + unsigned int neg_mode;
- +
- + switch (interface) {
- + case PHY_INTERFACE_MODE_SGMII:
- + case PHY_INTERFACE_MODE_QSGMII:
- + case PHY_INTERFACE_MODE_QUSGMII:
- + case PHY_INTERFACE_MODE_USXGMII:
- + /* These protocols are designed for use with a PHY which
- + * communicates its negotiation result back to the MAC via
- + * inband communication. Note: there exist PHYs that run
- + * with SGMII but do not send the inband data.
- + */
- + if (!phylink_autoneg_inband(mode))
- + neg_mode = PHYLINK_PCS_NEG_OUTBAND;
- + else
- + neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
- + break;
- +
- + case PHY_INTERFACE_MODE_1000BASEX:
- + case PHY_INTERFACE_MODE_2500BASEX:
- + /* 1000base-X is designed for use media-side for Fibre
- + * connections, and thus the Autoneg bit needs to be
- + * taken into account. We also do this for 2500base-X
- + * as well, but drivers may not support this, so may
- + * need to override this.
- + */
- + if (!phylink_autoneg_inband(mode))
- + neg_mode = PHYLINK_PCS_NEG_OUTBAND;
- + else if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
- + advertising))
- + neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
- + else
- + neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED;
- + break;
- +
- + default:
- + neg_mode = PHYLINK_PCS_NEG_NONE;
- + break;
- + }
- +
- + return neg_mode;
- +}
- +
- static void phylink_major_config(struct phylink *pl, bool restart,
- const struct phylink_link_state *state)
- {
- --- a/include/linux/phylink.h
- +++ b/include/linux/phylink.h
- @@ -99,72 +99,6 @@ static inline bool phylink_autoneg_inban
- }
-
- /**
- - * phylink_pcs_neg_mode() - helper to determine PCS inband mode
- - * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
- - * @interface: interface mode to be used
- - * @advertising: adertisement ethtool link mode mask
- - *
- - * Determines the negotiation mode to be used by the PCS, and returns
- - * one of:
- - *
- - * - %PHYLINK_PCS_NEG_NONE: interface mode does not support inband
- - * - %PHYLINK_PCS_NEG_OUTBAND: an out of band mode (e.g. reading the PHY)
- - * will be used.
- - * - %PHYLINK_PCS_NEG_INBAND_DISABLED: inband mode selected but autoneg
- - * disabled
- - * - %PHYLINK_PCS_NEG_INBAND_ENABLED: inband mode selected and autoneg enabled
- - *
- - * Note: this is for cases where the PCS itself is involved in negotiation
- - * (e.g. Clause 37, SGMII and similar) not Clause 73.
- - */
- -static inline unsigned int phylink_pcs_neg_mode(unsigned int mode,
- - phy_interface_t interface,
- - const unsigned long *advertising)
- -{
- - unsigned int neg_mode;
- -
- - switch (interface) {
- - case PHY_INTERFACE_MODE_SGMII:
- - case PHY_INTERFACE_MODE_QSGMII:
- - case PHY_INTERFACE_MODE_QUSGMII:
- - case PHY_INTERFACE_MODE_USXGMII:
- - /* These protocols are designed for use with a PHY which
- - * communicates its negotiation result back to the MAC via
- - * inband communication. Note: there exist PHYs that run
- - * with SGMII but do not send the inband data.
- - */
- - if (!phylink_autoneg_inband(mode))
- - neg_mode = PHYLINK_PCS_NEG_OUTBAND;
- - else
- - neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
- - break;
- -
- - case PHY_INTERFACE_MODE_1000BASEX:
- - case PHY_INTERFACE_MODE_2500BASEX:
- - /* 1000base-X is designed for use media-side for Fibre
- - * connections, and thus the Autoneg bit needs to be
- - * taken into account. We also do this for 2500base-X
- - * as well, but drivers may not support this, so may
- - * need to override this.
- - */
- - if (!phylink_autoneg_inband(mode))
- - neg_mode = PHYLINK_PCS_NEG_OUTBAND;
- - else if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
- - advertising))
- - neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
- - else
- - neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED;
- - break;
- -
- - default:
- - neg_mode = PHYLINK_PCS_NEG_NONE;
- - break;
- - }
- -
- - return neg_mode;
- -}
- -
- -/**
- * struct phylink_link_state - link state structure
- * @advertising: ethtool bitmask containing advertised link modes
- * @lp_advertising: ethtool bitmask containing link partner advertised link
|