Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Russell King (Oracle) and committed by
David S. Miller
5e5401d6 3b73a7b8

+66 -66
+66
drivers/net/phy/phylink.c
··· 1074 1074 pl->pcs->ops->pcs_an_restart(pl->pcs); 1075 1075 } 1076 1076 1077 + /** 1078 + * phylink_pcs_neg_mode() - helper to determine PCS inband mode 1079 + * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND. 1080 + * @interface: interface mode to be used 1081 + * @advertising: adertisement ethtool link mode mask 1082 + * 1083 + * Determines the negotiation mode to be used by the PCS, and returns 1084 + * one of: 1085 + * 1086 + * - %PHYLINK_PCS_NEG_NONE: interface mode does not support inband 1087 + * - %PHYLINK_PCS_NEG_OUTBAND: an out of band mode (e.g. reading the PHY) 1088 + * will be used. 1089 + * - %PHYLINK_PCS_NEG_INBAND_DISABLED: inband mode selected but autoneg 1090 + * disabled 1091 + * - %PHYLINK_PCS_NEG_INBAND_ENABLED: inband mode selected and autoneg enabled 1092 + * 1093 + * Note: this is for cases where the PCS itself is involved in negotiation 1094 + * (e.g. Clause 37, SGMII and similar) not Clause 73. 1095 + */ 1096 + static unsigned int phylink_pcs_neg_mode(unsigned int mode, 1097 + phy_interface_t interface, 1098 + const unsigned long *advertising) 1099 + { 1100 + unsigned int neg_mode; 1101 + 1102 + switch (interface) { 1103 + case PHY_INTERFACE_MODE_SGMII: 1104 + case PHY_INTERFACE_MODE_QSGMII: 1105 + case PHY_INTERFACE_MODE_QUSGMII: 1106 + case PHY_INTERFACE_MODE_USXGMII: 1107 + /* These protocols are designed for use with a PHY which 1108 + * communicates its negotiation result back to the MAC via 1109 + * inband communication. Note: there exist PHYs that run 1110 + * with SGMII but do not send the inband data. 1111 + */ 1112 + if (!phylink_autoneg_inband(mode)) 1113 + neg_mode = PHYLINK_PCS_NEG_OUTBAND; 1114 + else 1115 + neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED; 1116 + break; 1117 + 1118 + case PHY_INTERFACE_MODE_1000BASEX: 1119 + case PHY_INTERFACE_MODE_2500BASEX: 1120 + /* 1000base-X is designed for use media-side for Fibre 1121 + * connections, and thus the Autoneg bit needs to be 1122 + * taken into account. We also do this for 2500base-X 1123 + * as well, but drivers may not support this, so may 1124 + * need to override this. 1125 + */ 1126 + if (!phylink_autoneg_inband(mode)) 1127 + neg_mode = PHYLINK_PCS_NEG_OUTBAND; 1128 + else if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, 1129 + advertising)) 1130 + neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED; 1131 + else 1132 + neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED; 1133 + break; 1134 + 1135 + default: 1136 + neg_mode = PHYLINK_PCS_NEG_NONE; 1137 + break; 1138 + } 1139 + 1140 + return neg_mode; 1141 + } 1142 + 1077 1143 static void phylink_major_config(struct phylink *pl, bool restart, 1078 1144 const struct phylink_link_state *state) 1079 1145 {
-66
include/linux/phylink.h
··· 99 99 } 100 100 101 101 /** 102 - * phylink_pcs_neg_mode() - helper to determine PCS inband mode 103 - * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND. 104 - * @interface: interface mode to be used 105 - * @advertising: adertisement ethtool link mode mask 106 - * 107 - * Determines the negotiation mode to be used by the PCS, and returns 108 - * one of: 109 - * 110 - * - %PHYLINK_PCS_NEG_NONE: interface mode does not support inband 111 - * - %PHYLINK_PCS_NEG_OUTBAND: an out of band mode (e.g. reading the PHY) 112 - * will be used. 113 - * - %PHYLINK_PCS_NEG_INBAND_DISABLED: inband mode selected but autoneg 114 - * disabled 115 - * - %PHYLINK_PCS_NEG_INBAND_ENABLED: inband mode selected and autoneg enabled 116 - * 117 - * Note: this is for cases where the PCS itself is involved in negotiation 118 - * (e.g. Clause 37, SGMII and similar) not Clause 73. 119 - */ 120 - static inline unsigned int phylink_pcs_neg_mode(unsigned int mode, 121 - phy_interface_t interface, 122 - const unsigned long *advertising) 123 - { 124 - unsigned int neg_mode; 125 - 126 - switch (interface) { 127 - case PHY_INTERFACE_MODE_SGMII: 128 - case PHY_INTERFACE_MODE_QSGMII: 129 - case PHY_INTERFACE_MODE_QUSGMII: 130 - case PHY_INTERFACE_MODE_USXGMII: 131 - /* These protocols are designed for use with a PHY which 132 - * communicates its negotiation result back to the MAC via 133 - * inband communication. Note: there exist PHYs that run 134 - * with SGMII but do not send the inband data. 135 - */ 136 - if (!phylink_autoneg_inband(mode)) 137 - neg_mode = PHYLINK_PCS_NEG_OUTBAND; 138 - else 139 - neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED; 140 - break; 141 - 142 - case PHY_INTERFACE_MODE_1000BASEX: 143 - case PHY_INTERFACE_MODE_2500BASEX: 144 - /* 1000base-X is designed for use media-side for Fibre 145 - * connections, and thus the Autoneg bit needs to be 146 - * taken into account. We also do this for 2500base-X 147 - * as well, but drivers may not support this, so may 148 - * need to override this. 149 - */ 150 - if (!phylink_autoneg_inband(mode)) 151 - neg_mode = PHYLINK_PCS_NEG_OUTBAND; 152 - else if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, 153 - advertising)) 154 - neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED; 155 - else 156 - neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED; 157 - break; 158 - 159 - default: 160 - neg_mode = PHYLINK_PCS_NEG_NONE; 161 - break; 162 - } 163 - 164 - return neg_mode; 165 - } 166 - 167 - /** 168 102 * struct phylink_link_state - link state structure 169 103 * @advertising: ethtool bitmask containing advertised link modes 170 104 * @lp_advertising: ethtool bitmask containing link partner advertised link