@@ -117,8 +117,7 @@ static const char *phylink_an_mode_str(unsigned int mode)
117
117
static const char * modestr [] = {
118
118
[MLO_AN_PHY ] = "phy" ,
119
119
[MLO_AN_FIXED ] = "fixed" ,
120
- [MLO_AN_SGMII ] = "SGMII" ,
121
- [MLO_AN_8023Z ] = "802.3z" ,
120
+ [MLO_AN_INBAND ] = "inband" ,
122
121
};
123
122
124
123
return mode < ARRAY_SIZE (modestr ) ? modestr [mode ] : "unknown" ;
@@ -244,6 +243,7 @@ static int phylink_parse_mode(struct phylink *pl, struct device_node *np)
244
243
phylink_set (pl -> supported , Asym_Pause );
245
244
phylink_set (pl -> supported , Pause );
246
245
pl -> link_config .an_enabled = true;
246
+ pl -> link_an_mode = MLO_AN_INBAND ;
247
247
248
248
switch (pl -> link_config .interface ) {
249
249
case PHY_INTERFACE_MODE_SGMII :
@@ -253,17 +253,14 @@ static int phylink_parse_mode(struct phylink *pl, struct device_node *np)
253
253
phylink_set (pl -> supported , 100b aseT_Full );
254
254
phylink_set (pl -> supported , 1000b aseT_Half );
255
255
phylink_set (pl -> supported , 1000b aseT_Full );
256
- pl -> link_an_mode = MLO_AN_SGMII ;
257
256
break ;
258
257
259
258
case PHY_INTERFACE_MODE_1000BASEX :
260
259
phylink_set (pl -> supported , 1000b aseX_Full );
261
- pl -> link_an_mode = MLO_AN_8023Z ;
262
260
break ;
263
261
264
262
case PHY_INTERFACE_MODE_2500BASEX :
265
263
phylink_set (pl -> supported , 2500b aseX_Full );
266
- pl -> link_an_mode = MLO_AN_8023Z ;
267
264
break ;
268
265
269
266
case PHY_INTERFACE_MODE_10GKR :
@@ -280,7 +277,6 @@ static int phylink_parse_mode(struct phylink *pl, struct device_node *np)
280
277
phylink_set (pl -> supported , 10000b aseLR_Full );
281
278
phylink_set (pl -> supported , 10000b aseLRM_Full );
282
279
phylink_set (pl -> supported , 10000b aseER_Full );
283
- pl -> link_an_mode = MLO_AN_SGMII ;
284
280
break ;
285
281
286
282
default :
@@ -422,8 +418,7 @@ static void phylink_resolve(struct work_struct *w)
422
418
phylink_mac_config (pl , & link_state );
423
419
break ;
424
420
425
- case MLO_AN_SGMII :
426
- case MLO_AN_8023Z :
421
+ case MLO_AN_INBAND :
427
422
phylink_get_mac_state (pl , & link_state );
428
423
if (pl -> phydev ) {
429
424
bool changed = false;
@@ -654,7 +649,8 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
654
649
int ret ;
655
650
656
651
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 ))))
658
654
return - EINVAL ;
659
655
660
656
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)
677
673
678
674
/* Fixed links and 802.3z are handled without needing a PHY */
679
675
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 )))
681
678
return 0 ;
682
679
683
680
phy_node = of_parse_phandle (dn , "phy-handle" , 0 );
@@ -851,8 +848,7 @@ int phylink_ethtool_ksettings_get(struct phylink *pl,
851
848
phylink_get_ksettings (& link_state , kset );
852
849
break ;
853
850
854
- case MLO_AN_SGMII :
855
- case MLO_AN_8023Z :
851
+ case MLO_AN_INBAND :
856
852
/* If there is a phy attached, then use the reported
857
853
* settings from the phy with no modification.
858
854
*/
@@ -1029,8 +1025,7 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl,
1029
1025
phylink_mac_config (pl , config );
1030
1026
break ;
1031
1027
1032
- case MLO_AN_SGMII :
1033
- case MLO_AN_8023Z :
1028
+ case MLO_AN_INBAND :
1034
1029
phylink_mac_config (pl , config );
1035
1030
phylink_mac_an_restart (pl );
1036
1031
break ;
@@ -1247,9 +1242,7 @@ static int phylink_mii_read(struct phylink *pl, unsigned int phy_id,
1247
1242
case MLO_AN_PHY :
1248
1243
return - EOPNOTSUPP ;
1249
1244
1250
- case MLO_AN_SGMII :
1251
- /* No phy, fall through to 8023z method */
1252
- case MLO_AN_8023Z :
1245
+ case MLO_AN_INBAND :
1253
1246
if (phy_id == 0 ) {
1254
1247
val = phylink_get_mac_state (pl , & state );
1255
1248
if (val < 0 )
@@ -1274,9 +1267,7 @@ static int phylink_mii_write(struct phylink *pl, unsigned int phy_id,
1274
1267
case MLO_AN_PHY :
1275
1268
return - EOPNOTSUPP ;
1276
1269
1277
- case MLO_AN_SGMII :
1278
- /* No phy, fall through to 8023z method */
1279
- case MLO_AN_8023Z :
1270
+ case MLO_AN_INBAND :
1280
1271
break ;
1281
1272
}
1282
1273
@@ -1291,7 +1282,7 @@ int phylink_mii_ioctl(struct phylink *pl, struct ifreq *ifr, int cmd)
1291
1282
WARN_ON (!lockdep_rtnl_is_held ());
1292
1283
1293
1284
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 */
1295
1286
switch (cmd ) {
1296
1287
case SIOCGMIIPHY :
1297
1288
mii -> phy_id = pl -> phydev -> mdio .addr ;
@@ -1360,10 +1351,8 @@ static int phylink_sfp_module_insert(void *upstream,
1360
1351
1361
1352
switch (iface ) {
1362
1353
case PHY_INTERFACE_MODE_SGMII :
1363
- mode = MLO_AN_SGMII ;
1364
- break ;
1365
1354
case PHY_INTERFACE_MODE_1000BASEX :
1366
- mode = MLO_AN_8023Z ;
1355
+ mode = MLO_AN_INBAND ;
1367
1356
break ;
1368
1357
default :
1369
1358
return - EINVAL ;
@@ -1390,7 +1379,7 @@ static int phylink_sfp_module_insert(void *upstream,
1390
1379
phylink_an_mode_str (mode ), phy_modes (config .interface ),
1391
1380
__ETHTOOL_LINK_MODE_MASK_NBITS , support );
1392
1381
1393
- if (mode == MLO_AN_8023Z && pl -> phydev )
1382
+ if (phy_interface_mode_is_8023z ( iface ) && pl -> phydev )
1394
1383
return - EINVAL ;
1395
1384
1396
1385
changed = !bitmap_equal (pl -> supported , support ,
0 commit comments