@@ -117,8 +117,7 @@ static const char *phylink_an_mode_str(unsigned int mode)
117117 static const char * modestr [] = {
118118 [MLO_AN_PHY ] = "phy" ,
119119 [MLO_AN_FIXED ] = "fixed" ,
120- [MLO_AN_SGMII ] = "SGMII" ,
121- [MLO_AN_8023Z ] = "802.3z" ,
120+ [MLO_AN_INBAND ] = "inband" ,
122121 };
123122
124123 return mode < ARRAY_SIZE (modestr ) ? modestr [mode ] : "unknown" ;
@@ -244,6 +243,7 @@ static int phylink_parse_mode(struct phylink *pl, struct device_node *np)
244243 phylink_set (pl -> supported , Asym_Pause );
245244 phylink_set (pl -> supported , Pause );
246245 pl -> link_config .an_enabled = true;
246+ pl -> link_an_mode = MLO_AN_INBAND ;
247247
248248 switch (pl -> link_config .interface ) {
249249 case PHY_INTERFACE_MODE_SGMII :
@@ -253,17 +253,14 @@ static int phylink_parse_mode(struct phylink *pl, struct device_node *np)
253253 phylink_set (pl -> supported , 100b aseT_Full );
254254 phylink_set (pl -> supported , 1000b aseT_Half );
255255 phylink_set (pl -> supported , 1000b aseT_Full );
256- pl -> link_an_mode = MLO_AN_SGMII ;
257256 break ;
258257
259258 case PHY_INTERFACE_MODE_1000BASEX :
260259 phylink_set (pl -> supported , 1000b aseX_Full );
261- pl -> link_an_mode = MLO_AN_8023Z ;
262260 break ;
263261
264262 case PHY_INTERFACE_MODE_2500BASEX :
265263 phylink_set (pl -> supported , 2500b aseX_Full );
266- pl -> link_an_mode = MLO_AN_8023Z ;
267264 break ;
268265
269266 case PHY_INTERFACE_MODE_10GKR :
@@ -280,7 +277,6 @@ static int phylink_parse_mode(struct phylink *pl, struct device_node *np)
280277 phylink_set (pl -> supported , 10000b aseLR_Full );
281278 phylink_set (pl -> supported , 10000b aseLRM_Full );
282279 phylink_set (pl -> supported , 10000b aseER_Full );
283- pl -> link_an_mode = MLO_AN_SGMII ;
284280 break ;
285281
286282 default :
@@ -422,8 +418,7 @@ static void phylink_resolve(struct work_struct *w)
422418 phylink_mac_config (pl , & link_state );
423419 break ;
424420
425- case MLO_AN_SGMII :
426- case MLO_AN_8023Z :
421+ case MLO_AN_INBAND :
427422 phylink_get_mac_state (pl , & link_state );
428423 if (pl -> phydev ) {
429424 bool changed = false;
@@ -654,7 +649,8 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
654649 int ret ;
655650
656651 if (WARN_ON (pl -> link_an_mode == MLO_AN_FIXED ||
657- pl -> link_an_mode == MLO_AN_8023Z ))
652+ (pl -> link_an_mode == MLO_AN_INBAND &&
653+ phy_interface_mode_is_8023z (pl -> link_interface ))))
658654 return - EINVAL ;
659655
660656 ret = phy_attach_direct (pl -> netdev , phy , 0 , pl -> link_interface );
@@ -677,7 +673,8 @@ int phylink_of_phy_connect(struct phylink *pl, struct device_node *dn)
677673
678674 /* Fixed links and 802.3z are handled without needing a PHY */
679675 if (pl -> link_an_mode == MLO_AN_FIXED ||
680- pl -> link_an_mode == MLO_AN_8023Z )
676+ (pl -> link_an_mode == MLO_AN_INBAND &&
677+ phy_interface_mode_is_8023z (pl -> link_interface )))
681678 return 0 ;
682679
683680 phy_node = of_parse_phandle (dn , "phy-handle" , 0 );
@@ -851,8 +848,7 @@ int phylink_ethtool_ksettings_get(struct phylink *pl,
851848 phylink_get_ksettings (& link_state , kset );
852849 break ;
853850
854- case MLO_AN_SGMII :
855- case MLO_AN_8023Z :
851+ case MLO_AN_INBAND :
856852 /* If there is a phy attached, then use the reported
857853 * settings from the phy with no modification.
858854 */
@@ -1029,8 +1025,7 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl,
10291025 phylink_mac_config (pl , config );
10301026 break ;
10311027
1032- case MLO_AN_SGMII :
1033- case MLO_AN_8023Z :
1028+ case MLO_AN_INBAND :
10341029 phylink_mac_config (pl , config );
10351030 phylink_mac_an_restart (pl );
10361031 break ;
@@ -1247,9 +1242,7 @@ static int phylink_mii_read(struct phylink *pl, unsigned int phy_id,
12471242 case MLO_AN_PHY :
12481243 return - EOPNOTSUPP ;
12491244
1250- case MLO_AN_SGMII :
1251- /* No phy, fall through to 8023z method */
1252- case MLO_AN_8023Z :
1245+ case MLO_AN_INBAND :
12531246 if (phy_id == 0 ) {
12541247 val = phylink_get_mac_state (pl , & state );
12551248 if (val < 0 )
@@ -1274,9 +1267,7 @@ static int phylink_mii_write(struct phylink *pl, unsigned int phy_id,
12741267 case MLO_AN_PHY :
12751268 return - EOPNOTSUPP ;
12761269
1277- case MLO_AN_SGMII :
1278- /* No phy, fall through to 8023z method */
1279- case MLO_AN_8023Z :
1270+ case MLO_AN_INBAND :
12801271 break ;
12811272 }
12821273
@@ -1291,7 +1282,7 @@ int phylink_mii_ioctl(struct phylink *pl, struct ifreq *ifr, int cmd)
12911282 WARN_ON (!lockdep_rtnl_is_held ());
12921283
12931284 if (pl -> phydev ) {
1294- /* PHYs only exist for MLO_AN_PHY and MLO_AN_SGMII */
1285+ /* PHYs only exist for MLO_AN_PHY and SGMII */
12951286 switch (cmd ) {
12961287 case SIOCGMIIPHY :
12971288 mii -> phy_id = pl -> phydev -> mdio .addr ;
@@ -1360,10 +1351,8 @@ static int phylink_sfp_module_insert(void *upstream,
13601351
13611352 switch (iface ) {
13621353 case PHY_INTERFACE_MODE_SGMII :
1363- mode = MLO_AN_SGMII ;
1364- break ;
13651354 case PHY_INTERFACE_MODE_1000BASEX :
1366- mode = MLO_AN_8023Z ;
1355+ mode = MLO_AN_INBAND ;
13671356 break ;
13681357 default :
13691358 return - EINVAL ;
@@ -1390,7 +1379,7 @@ static int phylink_sfp_module_insert(void *upstream,
13901379 phylink_an_mode_str (mode ), phy_modes (config .interface ),
13911380 __ETHTOOL_LINK_MODE_MASK_NBITS , support );
13921381
1393- if (mode == MLO_AN_8023Z && pl -> phydev )
1382+ if (phy_interface_mode_is_8023z ( iface ) && pl -> phydev )
13941383 return - EINVAL ;
13951384
13961385 changed = !bitmap_equal (pl -> supported , support ,
0 commit comments