aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/efx.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2008-09-01 07:49:02 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-09-03 09:53:48 -0400
commit8c8661e4cefdd1ddbfe7d5120f046694555d9e5c (patch)
tree0618e0392140bccadf012381e64a795dfe2e41a4 /drivers/net/sfc/efx.c
parenta515089c963b045f65c495cee1d344d8cb75e1d1 (diff)
sfc: Extend self-tests
Include PMA/PMD in loopback self-tests as intended. Add NVRAM checksum validation and include it in self-tests. Add register self-tests. Run PHY self-tests where available. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/sfc/efx.c')
-rw-r--r--drivers/net/sfc/efx.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index f34dbf2c5b69..e1e2f8060563 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -508,6 +508,11 @@ static void efx_link_status_changed(struct efx_nic *efx)
508 if (!netif_running(efx->net_dev)) 508 if (!netif_running(efx->net_dev))
509 return; 509 return;
510 510
511 if (efx->port_inhibited) {
512 netif_carrier_off(efx->net_dev);
513 return;
514 }
515
511 if (efx->link_up != netif_carrier_ok(efx->net_dev)) { 516 if (efx->link_up != netif_carrier_ok(efx->net_dev)) {
512 efx->n_link_state_changes++; 517 efx->n_link_state_changes++;
513 518
@@ -549,7 +554,7 @@ static void efx_link_status_changed(struct efx_nic *efx)
549 554
550/* This call reinitialises the MAC to pick up new PHY settings. The 555/* This call reinitialises the MAC to pick up new PHY settings. The
551 * caller must hold the mac_lock */ 556 * caller must hold the mac_lock */
552static void __efx_reconfigure_port(struct efx_nic *efx) 557void __efx_reconfigure_port(struct efx_nic *efx)
553{ 558{
554 WARN_ON(!mutex_is_locked(&efx->mac_lock)); 559 WARN_ON(!mutex_is_locked(&efx->mac_lock));
555 560
@@ -634,6 +639,7 @@ static int efx_init_port(struct efx_nic *efx)
634 return rc; 639 return rc;
635 640
636 efx->port_initialized = true; 641 efx->port_initialized = true;
642 efx->stats_enabled = true;
637 643
638 /* Reconfigure port to program MAC registers */ 644 /* Reconfigure port to program MAC registers */
639 falcon_reconfigure_xmac(efx); 645 falcon_reconfigure_xmac(efx);
@@ -1311,7 +1317,7 @@ static struct net_device_stats *efx_net_stats(struct net_device *net_dev)
1311 */ 1317 */
1312 if (!spin_trylock(&efx->stats_lock)) 1318 if (!spin_trylock(&efx->stats_lock))
1313 return stats; 1319 return stats;
1314 if (efx->state == STATE_RUNNING) { 1320 if (efx->stats_enabled) {
1315 falcon_update_stats_xmac(efx); 1321 falcon_update_stats_xmac(efx);
1316 falcon_update_nic_stats(efx); 1322 falcon_update_nic_stats(efx);
1317 } 1323 }
@@ -1529,7 +1535,7 @@ static void efx_unregister_netdev(struct efx_nic *efx)
1529 1535
1530/* Tears down the entire software state and most of the hardware state 1536/* Tears down the entire software state and most of the hardware state
1531 * before reset. */ 1537 * before reset. */
1532static void efx_reset_down(struct efx_nic *efx, struct ethtool_cmd *ecmd) 1538void efx_reset_down(struct efx_nic *efx, struct ethtool_cmd *ecmd)
1533{ 1539{
1534 int rc; 1540 int rc;
1535 1541
@@ -1538,6 +1544,7 @@ static void efx_reset_down(struct efx_nic *efx, struct ethtool_cmd *ecmd)
1538 /* The net_dev->get_stats handler is quite slow, and will fail 1544 /* The net_dev->get_stats handler is quite slow, and will fail
1539 * if a fetch is pending over reset. Serialise against it. */ 1545 * if a fetch is pending over reset. Serialise against it. */
1540 spin_lock(&efx->stats_lock); 1546 spin_lock(&efx->stats_lock);
1547 efx->stats_enabled = false;
1541 spin_unlock(&efx->stats_lock); 1548 spin_unlock(&efx->stats_lock);
1542 1549
1543 efx_stop_all(efx); 1550 efx_stop_all(efx);
@@ -1555,8 +1562,7 @@ static void efx_reset_down(struct efx_nic *efx, struct ethtool_cmd *ecmd)
1555 * that we were unable to reinitialise the hardware, and the 1562 * that we were unable to reinitialise the hardware, and the
1556 * driver should be disabled. If ok is false, then the rx and tx 1563 * driver should be disabled. If ok is false, then the rx and tx
1557 * engines are not restarted, pending a RESET_DISABLE. */ 1564 * engines are not restarted, pending a RESET_DISABLE. */
1558static int efx_reset_up(struct efx_nic *efx, struct ethtool_cmd *ecmd, 1565int efx_reset_up(struct efx_nic *efx, struct ethtool_cmd *ecmd, bool ok)
1559 bool ok)
1560{ 1566{
1561 int rc; 1567 int rc;
1562 1568
@@ -1577,8 +1583,10 @@ static int efx_reset_up(struct efx_nic *efx, struct ethtool_cmd *ecmd,
1577 1583
1578 mutex_unlock(&efx->mac_lock); 1584 mutex_unlock(&efx->mac_lock);
1579 1585
1580 if (ok) 1586 if (ok) {
1581 efx_start_all(efx); 1587 efx_start_all(efx);
1588 efx->stats_enabled = true;
1589 }
1582 return rc; 1590 return rc;
1583} 1591}
1584 1592