1 From 5e5401d6612ef599ad45785b941eebda7effc90f Mon Sep 17 00:00:00 2001
2 From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
3 Date: Thu, 4 Jan 2024 09:47:36 +0000
4 Subject: [PATCH] net: phylink: move phylink_pcs_neg_mode() into phylink.c
6 Move phylink_pcs_neg_mode() from the header file into the .c file since
7 nothing should be using it.
9 Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
10 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
11 Signed-off-by: David S. Miller <davem@davemloft.net>
13 drivers/net/phy/phylink.c | 66 +++++++++++++++++++++++++++++++++++++++
14 include/linux/phylink.h | 66 ---------------------------------------
15 2 files changed, 66 insertions(+), 66 deletions(-)
17 --- a/drivers/net/phy/phylink.c
18 +++ b/drivers/net/phy/phylink.c
19 @@ -1116,6 +1116,72 @@ static void phylink_pcs_an_restart(struc
20 pl->pcs->ops->pcs_an_restart(pl->pcs);
24 + * phylink_pcs_neg_mode() - helper to determine PCS inband mode
25 + * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
26 + * @interface: interface mode to be used
27 + * @advertising: adertisement ethtool link mode mask
29 + * Determines the negotiation mode to be used by the PCS, and returns
32 + * - %PHYLINK_PCS_NEG_NONE: interface mode does not support inband
33 + * - %PHYLINK_PCS_NEG_OUTBAND: an out of band mode (e.g. reading the PHY)
35 + * - %PHYLINK_PCS_NEG_INBAND_DISABLED: inband mode selected but autoneg
37 + * - %PHYLINK_PCS_NEG_INBAND_ENABLED: inband mode selected and autoneg enabled
39 + * Note: this is for cases where the PCS itself is involved in negotiation
40 + * (e.g. Clause 37, SGMII and similar) not Clause 73.
42 +static unsigned int phylink_pcs_neg_mode(unsigned int mode,
43 + phy_interface_t interface,
44 + const unsigned long *advertising)
46 + unsigned int neg_mode;
48 + switch (interface) {
49 + case PHY_INTERFACE_MODE_SGMII:
50 + case PHY_INTERFACE_MODE_QSGMII:
51 + case PHY_INTERFACE_MODE_QUSGMII:
52 + case PHY_INTERFACE_MODE_USXGMII:
53 + /* These protocols are designed for use with a PHY which
54 + * communicates its negotiation result back to the MAC via
55 + * inband communication. Note: there exist PHYs that run
56 + * with SGMII but do not send the inband data.
58 + if (!phylink_autoneg_inband(mode))
59 + neg_mode = PHYLINK_PCS_NEG_OUTBAND;
61 + neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
64 + case PHY_INTERFACE_MODE_1000BASEX:
65 + case PHY_INTERFACE_MODE_2500BASEX:
66 + /* 1000base-X is designed for use media-side for Fibre
67 + * connections, and thus the Autoneg bit needs to be
68 + * taken into account. We also do this for 2500base-X
69 + * as well, but drivers may not support this, so may
70 + * need to override this.
72 + if (!phylink_autoneg_inband(mode))
73 + neg_mode = PHYLINK_PCS_NEG_OUTBAND;
74 + else if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
76 + neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
78 + neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED;
82 + neg_mode = PHYLINK_PCS_NEG_NONE;
89 static void phylink_major_config(struct phylink *pl, bool restart,
90 const struct phylink_link_state *state)
92 --- a/include/linux/phylink.h
93 +++ b/include/linux/phylink.h
94 @@ -99,72 +99,6 @@ static inline bool phylink_autoneg_inban
98 - * phylink_pcs_neg_mode() - helper to determine PCS inband mode
99 - * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
100 - * @interface: interface mode to be used
101 - * @advertising: adertisement ethtool link mode mask
103 - * Determines the negotiation mode to be used by the PCS, and returns
106 - * - %PHYLINK_PCS_NEG_NONE: interface mode does not support inband
107 - * - %PHYLINK_PCS_NEG_OUTBAND: an out of band mode (e.g. reading the PHY)
109 - * - %PHYLINK_PCS_NEG_INBAND_DISABLED: inband mode selected but autoneg
111 - * - %PHYLINK_PCS_NEG_INBAND_ENABLED: inband mode selected and autoneg enabled
113 - * Note: this is for cases where the PCS itself is involved in negotiation
114 - * (e.g. Clause 37, SGMII and similar) not Clause 73.
116 -static inline unsigned int phylink_pcs_neg_mode(unsigned int mode,
117 - phy_interface_t interface,
118 - const unsigned long *advertising)
120 - unsigned int neg_mode;
122 - switch (interface) {
123 - case PHY_INTERFACE_MODE_SGMII:
124 - case PHY_INTERFACE_MODE_QSGMII:
125 - case PHY_INTERFACE_MODE_QUSGMII:
126 - case PHY_INTERFACE_MODE_USXGMII:
127 - /* These protocols are designed for use with a PHY which
128 - * communicates its negotiation result back to the MAC via
129 - * inband communication. Note: there exist PHYs that run
130 - * with SGMII but do not send the inband data.
132 - if (!phylink_autoneg_inband(mode))
133 - neg_mode = PHYLINK_PCS_NEG_OUTBAND;
135 - neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
138 - case PHY_INTERFACE_MODE_1000BASEX:
139 - case PHY_INTERFACE_MODE_2500BASEX:
140 - /* 1000base-X is designed for use media-side for Fibre
141 - * connections, and thus the Autoneg bit needs to be
142 - * taken into account. We also do this for 2500base-X
143 - * as well, but drivers may not support this, so may
144 - * need to override this.
146 - if (!phylink_autoneg_inband(mode))
147 - neg_mode = PHYLINK_PCS_NEG_OUTBAND;
148 - else if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
150 - neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
152 - neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED;
156 - neg_mode = PHYLINK_PCS_NEG_NONE;
164 * struct phylink_link_state - link state structure
165 * @advertising: ethtool bitmask containing advertised link modes
166 * @lp_advertising: ethtool bitmask containing link partner advertised link