diff options
author | Yaniv Rosner <yaniv.rosner@broadcom.com> | 2010-09-07 07:41:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-07 16:15:42 -0400 |
commit | a22f078867ef362e35c54055878168e6613ff743 (patch) | |
tree | 2cf683f3057b7ed5dcaaaad16192f3a267dcf0f8 /drivers/net/bnx2x/bnx2x_ethtool.c | |
parent | de6eae1f42eae736548f293570fd867bd37c3bdd (diff) |
bnx2x: Add dual-media changes
Add required changes in order to support dual-media boards.
Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x/bnx2x_ethtool.c')
-rw-r--r-- | drivers/net/bnx2x/bnx2x_ethtool.c | 176 |
1 files changed, 121 insertions, 55 deletions
diff --git a/drivers/net/bnx2x/bnx2x_ethtool.c b/drivers/net/bnx2x/bnx2x_ethtool.c index dbcfa7a5618f..d058f9716785 100644 --- a/drivers/net/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/bnx2x/bnx2x_ethtool.c | |||
@@ -29,9 +29,12 @@ | |||
29 | static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 29 | static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
30 | { | 30 | { |
31 | struct bnx2x *bp = netdev_priv(dev); | 31 | struct bnx2x *bp = netdev_priv(dev); |
32 | 32 | int cfg_idx = bnx2x_get_link_cfg_idx(bp); | |
33 | cmd->supported = bp->port.supported; | 33 | /* Dual Media boards present all available port types */ |
34 | cmd->advertising = bp->port.advertising; | 34 | cmd->supported = bp->port.supported[cfg_idx] | |
35 | (bp->port.supported[cfg_idx ^ 1] & | ||
36 | (SUPPORTED_TP | SUPPORTED_FIBRE)); | ||
37 | cmd->advertising = bp->port.advertising[cfg_idx]; | ||
35 | 38 | ||
36 | if ((bp->state == BNX2X_STATE_OPEN) && | 39 | if ((bp->state == BNX2X_STATE_OPEN) && |
37 | !(bp->flags & MF_FUNC_DIS) && | 40 | !(bp->flags & MF_FUNC_DIS) && |
@@ -48,22 +51,21 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
48 | cmd->speed = vn_max_rate; | 51 | cmd->speed = vn_max_rate; |
49 | } | 52 | } |
50 | } else { | 53 | } else { |
51 | cmd->speed = -1; | 54 | cmd->speed = bp->link_params.req_line_speed[cfg_idx]; |
52 | cmd->duplex = -1; | 55 | cmd->duplex = bp->link_params.req_duplex[cfg_idx]; |
53 | } | 56 | } |
54 | 57 | ||
55 | if (bp->link_params.num_phys > 0) { | 58 | if (bp->port.supported[cfg_idx] & SUPPORTED_TP) |
56 | if (bp->link_params.phy[bp->link_params.num_phys - 1]. | 59 | cmd->port = PORT_TP; |
57 | supported & SUPPORTED_FIBRE) | 60 | else if (bp->port.supported[cfg_idx] & SUPPORTED_FIBRE) |
58 | cmd->port = PORT_FIBRE; | 61 | cmd->port = PORT_FIBRE; |
59 | else | 62 | else |
60 | cmd->port = PORT_TP; | 63 | BNX2X_ERR("XGXS PHY Failure detected\n"); |
61 | } else | 64 | |
62 | DP(NETIF_MSG_LINK, "No media found\n"); | ||
63 | cmd->phy_address = bp->mdio.prtad; | 65 | cmd->phy_address = bp->mdio.prtad; |
64 | cmd->transceiver = XCVR_INTERNAL; | 66 | cmd->transceiver = XCVR_INTERNAL; |
65 | 67 | ||
66 | if (bp->link_params.req_line_speed == SPEED_AUTO_NEG) | 68 | if (bp->link_params.req_line_speed[cfg_idx] == SPEED_AUTO_NEG) |
67 | cmd->autoneg = AUTONEG_ENABLE; | 69 | cmd->autoneg = AUTONEG_ENABLE; |
68 | else | 70 | else |
69 | cmd->autoneg = AUTONEG_DISABLE; | 71 | cmd->autoneg = AUTONEG_DISABLE; |
@@ -85,7 +87,7 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
85 | static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 87 | static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
86 | { | 88 | { |
87 | struct bnx2x *bp = netdev_priv(dev); | 89 | struct bnx2x *bp = netdev_priv(dev); |
88 | u32 advertising; | 90 | u32 advertising, cfg_idx, old_multi_phy_config, new_multi_phy_config; |
89 | 91 | ||
90 | if (IS_E1HMF(bp)) | 92 | if (IS_E1HMF(bp)) |
91 | return 0; | 93 | return 0; |
@@ -98,26 +100,81 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
98 | cmd->duplex, cmd->port, cmd->phy_address, cmd->transceiver, | 100 | cmd->duplex, cmd->port, cmd->phy_address, cmd->transceiver, |
99 | cmd->autoneg, cmd->maxtxpkt, cmd->maxrxpkt); | 101 | cmd->autoneg, cmd->maxtxpkt, cmd->maxrxpkt); |
100 | 102 | ||
103 | cfg_idx = bnx2x_get_link_cfg_idx(bp); | ||
104 | old_multi_phy_config = bp->link_params.multi_phy_config; | ||
105 | switch (cmd->port) { | ||
106 | case PORT_TP: | ||
107 | if (bp->port.supported[cfg_idx] & SUPPORTED_TP) | ||
108 | break; /* no port change */ | ||
109 | |||
110 | if (!(bp->port.supported[0] & SUPPORTED_TP || | ||
111 | bp->port.supported[1] & SUPPORTED_TP)) { | ||
112 | DP(NETIF_MSG_LINK, "Unsupported port type\n"); | ||
113 | return -EINVAL; | ||
114 | } | ||
115 | bp->link_params.multi_phy_config &= | ||
116 | ~PORT_HW_CFG_PHY_SELECTION_MASK; | ||
117 | if (bp->link_params.multi_phy_config & | ||
118 | PORT_HW_CFG_PHY_SWAPPED_ENABLED) | ||
119 | bp->link_params.multi_phy_config |= | ||
120 | PORT_HW_CFG_PHY_SELECTION_SECOND_PHY; | ||
121 | else | ||
122 | bp->link_params.multi_phy_config |= | ||
123 | PORT_HW_CFG_PHY_SELECTION_FIRST_PHY; | ||
124 | break; | ||
125 | case PORT_FIBRE: | ||
126 | if (bp->port.supported[cfg_idx] & SUPPORTED_FIBRE) | ||
127 | break; /* no port change */ | ||
128 | |||
129 | if (!(bp->port.supported[0] & SUPPORTED_FIBRE || | ||
130 | bp->port.supported[1] & SUPPORTED_FIBRE)) { | ||
131 | DP(NETIF_MSG_LINK, "Unsupported port type\n"); | ||
132 | return -EINVAL; | ||
133 | } | ||
134 | bp->link_params.multi_phy_config &= | ||
135 | ~PORT_HW_CFG_PHY_SELECTION_MASK; | ||
136 | if (bp->link_params.multi_phy_config & | ||
137 | PORT_HW_CFG_PHY_SWAPPED_ENABLED) | ||
138 | bp->link_params.multi_phy_config |= | ||
139 | PORT_HW_CFG_PHY_SELECTION_FIRST_PHY; | ||
140 | else | ||
141 | bp->link_params.multi_phy_config |= | ||
142 | PORT_HW_CFG_PHY_SELECTION_SECOND_PHY; | ||
143 | break; | ||
144 | default: | ||
145 | DP(NETIF_MSG_LINK, "Unsupported port type\n"); | ||
146 | return -EINVAL; | ||
147 | } | ||
148 | /* Save new config in case command complete successuly */ | ||
149 | new_multi_phy_config = bp->link_params.multi_phy_config; | ||
150 | /* Get the new cfg_idx */ | ||
151 | cfg_idx = bnx2x_get_link_cfg_idx(bp); | ||
152 | /* Restore old config in case command failed */ | ||
153 | bp->link_params.multi_phy_config = old_multi_phy_config; | ||
154 | DP(NETIF_MSG_LINK, "cfg_idx = %x\n", cfg_idx); | ||
155 | |||
101 | if (cmd->autoneg == AUTONEG_ENABLE) { | 156 | if (cmd->autoneg == AUTONEG_ENABLE) { |
102 | if (!(bp->port.supported & SUPPORTED_Autoneg)) { | 157 | if (!(bp->port.supported[cfg_idx] & SUPPORTED_Autoneg)) { |
103 | DP(NETIF_MSG_LINK, "Autoneg not supported\n"); | 158 | DP(NETIF_MSG_LINK, "Autoneg not supported\n"); |
104 | return -EINVAL; | 159 | return -EINVAL; |
105 | } | 160 | } |
106 | 161 | ||
107 | /* advertise the requested speed and duplex if supported */ | 162 | /* advertise the requested speed and duplex if supported */ |
108 | cmd->advertising &= bp->port.supported; | 163 | cmd->advertising &= bp->port.supported[cfg_idx]; |
109 | 164 | ||
110 | bp->link_params.req_line_speed = SPEED_AUTO_NEG; | 165 | bp->link_params.req_line_speed[cfg_idx] = SPEED_AUTO_NEG; |
111 | bp->link_params.req_duplex = DUPLEX_FULL; | 166 | bp->link_params.req_duplex[cfg_idx] = DUPLEX_FULL; |
112 | bp->port.advertising |= (ADVERTISED_Autoneg | | 167 | bp->port.advertising[cfg_idx] |= (ADVERTISED_Autoneg | |
113 | cmd->advertising); | 168 | cmd->advertising); |
114 | 169 | ||
115 | } else { /* forced speed */ | 170 | } else { /* forced speed */ |
116 | /* advertise the requested speed and duplex if supported */ | 171 | /* advertise the requested speed and duplex if supported */ |
117 | switch (cmd->speed) { | 172 | u32 speed = cmd->speed; |
173 | speed |= (cmd->speed_hi << 16); | ||
174 | switch (speed) { | ||
118 | case SPEED_10: | 175 | case SPEED_10: |
119 | if (cmd->duplex == DUPLEX_FULL) { | 176 | if (cmd->duplex == DUPLEX_FULL) { |
120 | if (!(bp->port.supported & | 177 | if (!(bp->port.supported[cfg_idx] & |
121 | SUPPORTED_10baseT_Full)) { | 178 | SUPPORTED_10baseT_Full)) { |
122 | DP(NETIF_MSG_LINK, | 179 | DP(NETIF_MSG_LINK, |
123 | "10M full not supported\n"); | 180 | "10M full not supported\n"); |
@@ -127,7 +184,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
127 | advertising = (ADVERTISED_10baseT_Full | | 184 | advertising = (ADVERTISED_10baseT_Full | |
128 | ADVERTISED_TP); | 185 | ADVERTISED_TP); |
129 | } else { | 186 | } else { |
130 | if (!(bp->port.supported & | 187 | if (!(bp->port.supported[cfg_idx] & |
131 | SUPPORTED_10baseT_Half)) { | 188 | SUPPORTED_10baseT_Half)) { |
132 | DP(NETIF_MSG_LINK, | 189 | DP(NETIF_MSG_LINK, |
133 | "10M half not supported\n"); | 190 | "10M half not supported\n"); |
@@ -141,7 +198,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
141 | 198 | ||
142 | case SPEED_100: | 199 | case SPEED_100: |
143 | if (cmd->duplex == DUPLEX_FULL) { | 200 | if (cmd->duplex == DUPLEX_FULL) { |
144 | if (!(bp->port.supported & | 201 | if (!(bp->port.supported[cfg_idx] & |
145 | SUPPORTED_100baseT_Full)) { | 202 | SUPPORTED_100baseT_Full)) { |
146 | DP(NETIF_MSG_LINK, | 203 | DP(NETIF_MSG_LINK, |
147 | "100M full not supported\n"); | 204 | "100M full not supported\n"); |
@@ -151,7 +208,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
151 | advertising = (ADVERTISED_100baseT_Full | | 208 | advertising = (ADVERTISED_100baseT_Full | |
152 | ADVERTISED_TP); | 209 | ADVERTISED_TP); |
153 | } else { | 210 | } else { |
154 | if (!(bp->port.supported & | 211 | if (!(bp->port.supported[cfg_idx] & |
155 | SUPPORTED_100baseT_Half)) { | 212 | SUPPORTED_100baseT_Half)) { |
156 | DP(NETIF_MSG_LINK, | 213 | DP(NETIF_MSG_LINK, |
157 | "100M half not supported\n"); | 214 | "100M half not supported\n"); |
@@ -169,7 +226,8 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
169 | return -EINVAL; | 226 | return -EINVAL; |
170 | } | 227 | } |
171 | 228 | ||
172 | if (!(bp->port.supported & SUPPORTED_1000baseT_Full)) { | 229 | if (!(bp->port.supported[cfg_idx] & |
230 | SUPPORTED_1000baseT_Full)) { | ||
173 | DP(NETIF_MSG_LINK, "1G full not supported\n"); | 231 | DP(NETIF_MSG_LINK, "1G full not supported\n"); |
174 | return -EINVAL; | 232 | return -EINVAL; |
175 | } | 233 | } |
@@ -185,7 +243,8 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
185 | return -EINVAL; | 243 | return -EINVAL; |
186 | } | 244 | } |
187 | 245 | ||
188 | if (!(bp->port.supported & SUPPORTED_2500baseX_Full)) { | 246 | if (!(bp->port.supported[cfg_idx] |
247 | & SUPPORTED_2500baseX_Full)) { | ||
189 | DP(NETIF_MSG_LINK, | 248 | DP(NETIF_MSG_LINK, |
190 | "2.5G full not supported\n"); | 249 | "2.5G full not supported\n"); |
191 | return -EINVAL; | 250 | return -EINVAL; |
@@ -201,7 +260,8 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
201 | return -EINVAL; | 260 | return -EINVAL; |
202 | } | 261 | } |
203 | 262 | ||
204 | if (!(bp->port.supported & SUPPORTED_10000baseT_Full)) { | 263 | if (!(bp->port.supported[cfg_idx] |
264 | & SUPPORTED_10000baseT_Full)) { | ||
205 | DP(NETIF_MSG_LINK, "10G full not supported\n"); | 265 | DP(NETIF_MSG_LINK, "10G full not supported\n"); |
206 | return -EINVAL; | 266 | return -EINVAL; |
207 | } | 267 | } |
@@ -211,20 +271,23 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
211 | break; | 271 | break; |
212 | 272 | ||
213 | default: | 273 | default: |
214 | DP(NETIF_MSG_LINK, "Unsupported speed\n"); | 274 | DP(NETIF_MSG_LINK, "Unsupported speed %d\n", speed); |
215 | return -EINVAL; | 275 | return -EINVAL; |
216 | } | 276 | } |
217 | 277 | ||
218 | bp->link_params.req_line_speed = cmd->speed; | 278 | bp->link_params.req_line_speed[cfg_idx] = speed; |
219 | bp->link_params.req_duplex = cmd->duplex; | 279 | bp->link_params.req_duplex[cfg_idx] = cmd->duplex; |
220 | bp->port.advertising = advertising; | 280 | bp->port.advertising[cfg_idx] = advertising; |
221 | } | 281 | } |
222 | 282 | ||
223 | DP(NETIF_MSG_LINK, "req_line_speed %d\n" | 283 | DP(NETIF_MSG_LINK, "req_line_speed %d\n" |
224 | DP_LEVEL " req_duplex %d advertising 0x%x\n", | 284 | DP_LEVEL " req_duplex %d advertising 0x%x\n", |
225 | bp->link_params.req_line_speed, bp->link_params.req_duplex, | 285 | bp->link_params.req_line_speed[cfg_idx], |
226 | bp->port.advertising); | 286 | bp->link_params.req_duplex[cfg_idx], |
287 | bp->port.advertising[cfg_idx]); | ||
227 | 288 | ||
289 | /* Set new config */ | ||
290 | bp->link_params.multi_phy_config = new_multi_phy_config; | ||
228 | if (netif_running(dev)) { | 291 | if (netif_running(dev)) { |
229 | bnx2x_stats_handle(bp, STATS_EVENT_STOP); | 292 | bnx2x_stats_handle(bp, STATS_EVENT_STOP); |
230 | bnx2x_link_set(bp); | 293 | bnx2x_link_set(bp); |
@@ -937,10 +1000,9 @@ static void bnx2x_get_pauseparam(struct net_device *dev, | |||
937 | struct ethtool_pauseparam *epause) | 1000 | struct ethtool_pauseparam *epause) |
938 | { | 1001 | { |
939 | struct bnx2x *bp = netdev_priv(dev); | 1002 | struct bnx2x *bp = netdev_priv(dev); |
940 | 1003 | int cfg_idx = bnx2x_get_link_cfg_idx(bp); | |
941 | epause->autoneg = (bp->link_params.req_flow_ctrl == | 1004 | epause->autoneg = (bp->link_params.req_flow_ctrl[cfg_idx] == |
942 | BNX2X_FLOW_CTRL_AUTO) && | 1005 | BNX2X_FLOW_CTRL_AUTO); |
943 | (bp->link_params.req_line_speed == SPEED_AUTO_NEG); | ||
944 | 1006 | ||
945 | epause->rx_pause = ((bp->link_vars.flow_ctrl & BNX2X_FLOW_CTRL_RX) == | 1007 | epause->rx_pause = ((bp->link_vars.flow_ctrl & BNX2X_FLOW_CTRL_RX) == |
946 | BNX2X_FLOW_CTRL_RX); | 1008 | BNX2X_FLOW_CTRL_RX); |
@@ -956,7 +1018,7 @@ static int bnx2x_set_pauseparam(struct net_device *dev, | |||
956 | struct ethtool_pauseparam *epause) | 1018 | struct ethtool_pauseparam *epause) |
957 | { | 1019 | { |
958 | struct bnx2x *bp = netdev_priv(dev); | 1020 | struct bnx2x *bp = netdev_priv(dev); |
959 | 1021 | u32 cfg_idx = bnx2x_get_link_cfg_idx(bp); | |
960 | if (IS_E1HMF(bp)) | 1022 | if (IS_E1HMF(bp)) |
961 | return 0; | 1023 | return 0; |
962 | 1024 | ||
@@ -964,29 +1026,31 @@ static int bnx2x_set_pauseparam(struct net_device *dev, | |||
964 | DP_LEVEL " autoneg %d rx_pause %d tx_pause %d\n", | 1026 | DP_LEVEL " autoneg %d rx_pause %d tx_pause %d\n", |
965 | epause->cmd, epause->autoneg, epause->rx_pause, epause->tx_pause); | 1027 | epause->cmd, epause->autoneg, epause->rx_pause, epause->tx_pause); |
966 | 1028 | ||
967 | bp->link_params.req_flow_ctrl = BNX2X_FLOW_CTRL_AUTO; | 1029 | bp->link_params.req_flow_ctrl[cfg_idx] = BNX2X_FLOW_CTRL_AUTO; |
968 | 1030 | ||
969 | if (epause->rx_pause) | 1031 | if (epause->rx_pause) |
970 | bp->link_params.req_flow_ctrl |= BNX2X_FLOW_CTRL_RX; | 1032 | bp->link_params.req_flow_ctrl[cfg_idx] |= BNX2X_FLOW_CTRL_RX; |
971 | 1033 | ||
972 | if (epause->tx_pause) | 1034 | if (epause->tx_pause) |
973 | bp->link_params.req_flow_ctrl |= BNX2X_FLOW_CTRL_TX; | 1035 | bp->link_params.req_flow_ctrl[cfg_idx] |= BNX2X_FLOW_CTRL_TX; |
974 | 1036 | ||
975 | if (bp->link_params.req_flow_ctrl == BNX2X_FLOW_CTRL_AUTO) | 1037 | if (bp->link_params.req_flow_ctrl[cfg_idx] == BNX2X_FLOW_CTRL_AUTO) |
976 | bp->link_params.req_flow_ctrl = BNX2X_FLOW_CTRL_NONE; | 1038 | bp->link_params.req_flow_ctrl[cfg_idx] = BNX2X_FLOW_CTRL_NONE; |
977 | 1039 | ||
978 | if (epause->autoneg) { | 1040 | if (epause->autoneg) { |
979 | if (!(bp->port.supported & SUPPORTED_Autoneg)) { | 1041 | if (!(bp->port.supported[cfg_idx] & SUPPORTED_Autoneg)) { |
980 | DP(NETIF_MSG_LINK, "autoneg not supported\n"); | 1042 | DP(NETIF_MSG_LINK, "autoneg not supported\n"); |
981 | return -EINVAL; | 1043 | return -EINVAL; |
982 | } | 1044 | } |
983 | 1045 | ||
984 | if (bp->link_params.req_line_speed == SPEED_AUTO_NEG) | 1046 | if (bp->link_params.req_line_speed[cfg_idx] == SPEED_AUTO_NEG) { |
985 | bp->link_params.req_flow_ctrl = BNX2X_FLOW_CTRL_AUTO; | 1047 | bp->link_params.req_flow_ctrl[cfg_idx] = |
1048 | BNX2X_FLOW_CTRL_AUTO; | ||
1049 | } | ||
986 | } | 1050 | } |
987 | 1051 | ||
988 | DP(NETIF_MSG_LINK, | 1052 | DP(NETIF_MSG_LINK, |
989 | "req_flow_ctrl 0x%x\n", bp->link_params.req_flow_ctrl); | 1053 | "req_flow_ctrl 0x%x\n", bp->link_params.req_flow_ctrl[cfg_idx]); |
990 | 1054 | ||
991 | if (netif_running(dev)) { | 1055 | if (netif_running(dev)) { |
992 | bnx2x_stats_handle(bp, STATS_EVENT_STOP); | 1056 | bnx2x_stats_handle(bp, STATS_EVENT_STOP); |
@@ -1250,12 +1314,12 @@ test_mem_exit: | |||
1250 | return rc; | 1314 | return rc; |
1251 | } | 1315 | } |
1252 | 1316 | ||
1253 | static void bnx2x_wait_for_link(struct bnx2x *bp, u8 link_up) | 1317 | static void bnx2x_wait_for_link(struct bnx2x *bp, u8 link_up, u8 is_serdes) |
1254 | { | 1318 | { |
1255 | int cnt = 1000; | 1319 | int cnt = 1000; |
1256 | 1320 | ||
1257 | if (link_up) | 1321 | if (link_up) |
1258 | while (bnx2x_link_test(bp) && cnt--) | 1322 | while (bnx2x_link_test(bp, is_serdes) && cnt--) |
1259 | msleep(10); | 1323 | msleep(10); |
1260 | } | 1324 | } |
1261 | 1325 | ||
@@ -1527,7 +1591,7 @@ static void bnx2x_self_test(struct net_device *dev, | |||
1527 | struct ethtool_test *etest, u64 *buf) | 1591 | struct ethtool_test *etest, u64 *buf) |
1528 | { | 1592 | { |
1529 | struct bnx2x *bp = netdev_priv(dev); | 1593 | struct bnx2x *bp = netdev_priv(dev); |
1530 | 1594 | u8 is_serdes; | |
1531 | if (bp->recovery_state != BNX2X_RECOVERY_DONE) { | 1595 | if (bp->recovery_state != BNX2X_RECOVERY_DONE) { |
1532 | printk(KERN_ERR "Handling parity error recovery. Try again later\n"); | 1596 | printk(KERN_ERR "Handling parity error recovery. Try again later\n"); |
1533 | etest->flags |= ETH_TEST_FL_FAILED; | 1597 | etest->flags |= ETH_TEST_FL_FAILED; |
@@ -1542,6 +1606,7 @@ static void bnx2x_self_test(struct net_device *dev, | |||
1542 | /* offline tests are not supported in MF mode */ | 1606 | /* offline tests are not supported in MF mode */ |
1543 | if (IS_E1HMF(bp)) | 1607 | if (IS_E1HMF(bp)) |
1544 | etest->flags &= ~ETH_TEST_FL_OFFLINE; | 1608 | etest->flags &= ~ETH_TEST_FL_OFFLINE; |
1609 | is_serdes = (bp->link_vars.link_status & LINK_STATUS_SERDES_LINK) > 0; | ||
1545 | 1610 | ||
1546 | if (etest->flags & ETH_TEST_FL_OFFLINE) { | 1611 | if (etest->flags & ETH_TEST_FL_OFFLINE) { |
1547 | int port = BP_PORT(bp); | 1612 | int port = BP_PORT(bp); |
@@ -1553,11 +1618,12 @@ static void bnx2x_self_test(struct net_device *dev, | |||
1553 | /* disable input for TX port IF */ | 1618 | /* disable input for TX port IF */ |
1554 | REG_WR(bp, NIG_REG_EGRESS_UMP0_IN_EN + port*4, 0); | 1619 | REG_WR(bp, NIG_REG_EGRESS_UMP0_IN_EN + port*4, 0); |
1555 | 1620 | ||
1556 | link_up = (bnx2x_link_test(bp) == 0); | 1621 | link_up = bp->link_vars.link_up; |
1622 | |||
1557 | bnx2x_nic_unload(bp, UNLOAD_NORMAL); | 1623 | bnx2x_nic_unload(bp, UNLOAD_NORMAL); |
1558 | bnx2x_nic_load(bp, LOAD_DIAG); | 1624 | bnx2x_nic_load(bp, LOAD_DIAG); |
1559 | /* wait until link state is restored */ | 1625 | /* wait until link state is restored */ |
1560 | bnx2x_wait_for_link(bp, link_up); | 1626 | bnx2x_wait_for_link(bp, link_up, is_serdes); |
1561 | 1627 | ||
1562 | if (bnx2x_test_registers(bp) != 0) { | 1628 | if (bnx2x_test_registers(bp) != 0) { |
1563 | buf[0] = 1; | 1629 | buf[0] = 1; |
@@ -1578,7 +1644,7 @@ static void bnx2x_self_test(struct net_device *dev, | |||
1578 | 1644 | ||
1579 | bnx2x_nic_load(bp, LOAD_NORMAL); | 1645 | bnx2x_nic_load(bp, LOAD_NORMAL); |
1580 | /* wait until link state is restored */ | 1646 | /* wait until link state is restored */ |
1581 | bnx2x_wait_for_link(bp, link_up); | 1647 | bnx2x_wait_for_link(bp, link_up, is_serdes); |
1582 | } | 1648 | } |
1583 | if (bnx2x_test_nvram(bp) != 0) { | 1649 | if (bnx2x_test_nvram(bp) != 0) { |
1584 | buf[3] = 1; | 1650 | buf[3] = 1; |
@@ -1589,7 +1655,7 @@ static void bnx2x_self_test(struct net_device *dev, | |||
1589 | etest->flags |= ETH_TEST_FL_FAILED; | 1655 | etest->flags |= ETH_TEST_FL_FAILED; |
1590 | } | 1656 | } |
1591 | if (bp->port.pmf) | 1657 | if (bp->port.pmf) |
1592 | if (bnx2x_link_test(bp) != 0) { | 1658 | if (bnx2x_link_test(bp, is_serdes) != 0) { |
1593 | buf[5] = 1; | 1659 | buf[5] = 1; |
1594 | etest->flags |= ETH_TEST_FL_FAILED; | 1660 | etest->flags |= ETH_TEST_FL_FAILED; |
1595 | } | 1661 | } |