@@ -1016,6 +1016,42 @@ static void phylink_pcs_an_restart(struct phylink *pl)
1016
1016
pl -> pcs -> ops -> pcs_an_restart (pl -> pcs );
1017
1017
}
1018
1018
1019
+ enum inband_type {
1020
+ INBAND_NONE ,
1021
+ INBAND_CISCO_SGMII ,
1022
+ INBAND_BASEX ,
1023
+ };
1024
+
1025
+ static enum inband_type phylink_get_inband_type (phy_interface_t interface )
1026
+ {
1027
+ switch (interface ) {
1028
+ case PHY_INTERFACE_MODE_SGMII :
1029
+ case PHY_INTERFACE_MODE_QSGMII :
1030
+ case PHY_INTERFACE_MODE_QUSGMII :
1031
+ case PHY_INTERFACE_MODE_USXGMII :
1032
+ case PHY_INTERFACE_MODE_10G_QXGMII :
1033
+ /* These protocols are designed for use with a PHY which
1034
+ * communicates its negotiation result back to the MAC via
1035
+ * inband communication. Note: there exist PHYs that run
1036
+ * with SGMII but do not send the inband data.
1037
+ */
1038
+ return INBAND_CISCO_SGMII ;
1039
+
1040
+ case PHY_INTERFACE_MODE_1000BASEX :
1041
+ case PHY_INTERFACE_MODE_2500BASEX :
1042
+ /* 1000base-X is designed for use media-side for Fibre
1043
+ * connections, and thus the Autoneg bit needs to be
1044
+ * taken into account. We also do this for 2500base-X
1045
+ * as well, but drivers may not support this, so may
1046
+ * need to override this.
1047
+ */
1048
+ return INBAND_BASEX ;
1049
+
1050
+ default :
1051
+ return INBAND_NONE ;
1052
+ }
1053
+ }
1054
+
1019
1055
/**
1020
1056
* phylink_pcs_neg_mode() - helper to determine PCS inband mode
1021
1057
* @pl: a pointer to a &struct phylink returned from phylink_create()
@@ -1043,46 +1079,19 @@ static void phylink_pcs_neg_mode(struct phylink *pl, struct phylink_pcs *pcs,
1043
1079
unsigned int pcs_ib_caps = 0 ;
1044
1080
unsigned int phy_ib_caps = 0 ;
1045
1081
unsigned int neg_mode , mode ;
1046
- enum {
1047
- INBAND_CISCO_SGMII ,
1048
- INBAND_BASEX ,
1049
- } type ;
1050
-
1051
- mode = pl -> req_link_an_mode ;
1082
+ enum inband_type type ;
1052
1083
1053
- pl -> phy_ib_mode = 0 ;
1054
-
1055
- switch (interface ) {
1056
- case PHY_INTERFACE_MODE_SGMII :
1057
- case PHY_INTERFACE_MODE_QSGMII :
1058
- case PHY_INTERFACE_MODE_QUSGMII :
1059
- case PHY_INTERFACE_MODE_USXGMII :
1060
- case PHY_INTERFACE_MODE_10G_QXGMII :
1061
- /* These protocols are designed for use with a PHY which
1062
- * communicates its negotiation result back to the MAC via
1063
- * inband communication. Note: there exist PHYs that run
1064
- * with SGMII but do not send the inband data.
1065
- */
1066
- type = INBAND_CISCO_SGMII ;
1067
- break ;
1068
-
1069
- case PHY_INTERFACE_MODE_1000BASEX :
1070
- case PHY_INTERFACE_MODE_2500BASEX :
1071
- /* 1000base-X is designed for use media-side for Fibre
1072
- * connections, and thus the Autoneg bit needs to be
1073
- * taken into account. We also do this for 2500base-X
1074
- * as well, but drivers may not support this, so may
1075
- * need to override this.
1076
- */
1077
- type = INBAND_BASEX ;
1078
- break ;
1079
-
1080
- default :
1084
+ type = phylink_get_inband_type (interface );
1085
+ if (type == INBAND_NONE ) {
1081
1086
pl -> pcs_neg_mode = PHYLINK_PCS_NEG_NONE ;
1082
- pl -> act_link_an_mode = mode ;
1087
+ pl -> act_link_an_mode = pl -> req_link_an_mode ;
1083
1088
return ;
1084
1089
}
1085
1090
1091
+ mode = pl -> req_link_an_mode ;
1092
+
1093
+ pl -> phy_ib_mode = 0 ;
1094
+
1086
1095
if (pcs )
1087
1096
pcs_ib_caps = phylink_pcs_inband_caps (pcs , interface );
1088
1097
0 commit comments