aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/efx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sfc/efx.c')
-rw-r--r--drivers/net/sfc/efx.c47
1 files changed, 17 insertions, 30 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 06ea71c7e34e..ac7bdbf3fd4a 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -77,11 +77,6 @@ static int napi_weight = 64;
77 */ 77 */
78unsigned int efx_monitor_interval = 1 * HZ; 78unsigned int efx_monitor_interval = 1 * HZ;
79 79
80/* This controls whether or not the hardware monitor will trigger a
81 * reset when it detects an error condition.
82 */
83static unsigned int monitor_reset = true;
84
85/* This controls whether or not the driver will initialise devices 80/* This controls whether or not the driver will initialise devices
86 * with invalid MAC addresses stored in the EEPROM or flash. If true, 81 * with invalid MAC addresses stored in the EEPROM or flash. If true,
87 * such devices will be initialised with a random locally-generated 82 * such devices will be initialised with a random locally-generated
@@ -612,17 +607,15 @@ static int efx_probe_port(struct efx_nic *efx)
612 if (is_valid_ether_addr(efx->mac_address)) { 607 if (is_valid_ether_addr(efx->mac_address)) {
613 memcpy(efx->net_dev->dev_addr, efx->mac_address, ETH_ALEN); 608 memcpy(efx->net_dev->dev_addr, efx->mac_address, ETH_ALEN);
614 } else { 609 } else {
615 DECLARE_MAC_BUF(mac); 610 EFX_ERR(efx, "invalid MAC address %pM\n",
616 611 efx->mac_address);
617 EFX_ERR(efx, "invalid MAC address %s\n",
618 print_mac(mac, efx->mac_address));
619 if (!allow_bad_hwaddr) { 612 if (!allow_bad_hwaddr) {
620 rc = -EINVAL; 613 rc = -EINVAL;
621 goto err; 614 goto err;
622 } 615 }
623 random_ether_addr(efx->net_dev->dev_addr); 616 random_ether_addr(efx->net_dev->dev_addr);
624 EFX_INFO(efx, "using locally-generated MAC %s\n", 617 EFX_INFO(efx, "using locally-generated MAC %pM\n",
625 print_mac(mac, efx->net_dev->dev_addr)); 618 efx->net_dev->dev_addr);
626 } 619 }
627 620
628 return 0; 621 return 0;
@@ -1178,17 +1171,6 @@ static void efx_monitor(struct work_struct *data)
1178 rc = falcon_check_xmac(efx); 1171 rc = falcon_check_xmac(efx);
1179 mutex_unlock(&efx->mac_lock); 1172 mutex_unlock(&efx->mac_lock);
1180 1173
1181 if (rc) {
1182 if (monitor_reset) {
1183 EFX_ERR(efx, "hardware monitor detected a fault: "
1184 "triggering reset\n");
1185 efx_schedule_reset(efx, RESET_TYPE_MONITOR);
1186 } else {
1187 EFX_ERR(efx, "hardware monitor detected a fault, "
1188 "skipping reset\n");
1189 }
1190 }
1191
1192 queue_delayed_work(efx->workqueue, &efx->monitor_work, 1174 queue_delayed_work(efx->workqueue, &efx->monitor_work,
1193 efx_monitor_interval); 1175 efx_monitor_interval);
1194} 1176}
@@ -1360,12 +1342,11 @@ static void efx_watchdog(struct net_device *net_dev)
1360{ 1342{
1361 struct efx_nic *efx = netdev_priv(net_dev); 1343 struct efx_nic *efx = netdev_priv(net_dev);
1362 1344
1363 EFX_ERR(efx, "TX stuck with stop_count=%d port_enabled=%d: %s\n", 1345 EFX_ERR(efx, "TX stuck with stop_count=%d port_enabled=%d:"
1364 atomic_read(&efx->netif_stop_count), efx->port_enabled, 1346 " resetting channels\n",
1365 monitor_reset ? "resetting channels" : "skipping reset"); 1347 atomic_read(&efx->netif_stop_count), efx->port_enabled);
1366 1348
1367 if (monitor_reset) 1349 efx_schedule_reset(efx, RESET_TYPE_TX_WATCHDOG);
1368 efx_schedule_reset(efx, RESET_TYPE_MONITOR);
1369} 1350}
1370 1351
1371 1352
@@ -1401,9 +1382,8 @@ static int efx_set_mac_address(struct net_device *net_dev, void *data)
1401 EFX_ASSERT_RESET_SERIALISED(efx); 1382 EFX_ASSERT_RESET_SERIALISED(efx);
1402 1383
1403 if (!is_valid_ether_addr(new_addr)) { 1384 if (!is_valid_ether_addr(new_addr)) {
1404 DECLARE_MAC_BUF(mac); 1385 EFX_ERR(efx, "invalid ethernet MAC address requested: %pM\n",
1405 EFX_ERR(efx, "invalid ethernet MAC address requested: %s\n", 1386 new_addr);
1406 print_mac(mac, new_addr));
1407 return -EINVAL; 1387 return -EINVAL;
1408 } 1388 }
1409 1389
@@ -1462,6 +1442,7 @@ static int efx_netdev_event(struct notifier_block *this,
1462 struct efx_nic *efx = netdev_priv(net_dev); 1442 struct efx_nic *efx = netdev_priv(net_dev);
1463 1443
1464 strcpy(efx->name, net_dev->name); 1444 strcpy(efx->name, net_dev->name);
1445 efx_mtd_rename(efx);
1465 } 1446 }
1466 1447
1467 return NOTIFY_DONE; 1448 return NOTIFY_DONE;
@@ -1553,6 +1534,7 @@ void efx_reset_down(struct efx_nic *efx, struct ethtool_cmd *ecmd)
1553 1534
1554 efx_stop_all(efx); 1535 efx_stop_all(efx);
1555 mutex_lock(&efx->mac_lock); 1536 mutex_lock(&efx->mac_lock);
1537 mutex_lock(&efx->spi_lock);
1556 1538
1557 rc = falcon_xmac_get_settings(efx, ecmd); 1539 rc = falcon_xmac_get_settings(efx, ecmd);
1558 if (rc) 1540 if (rc)
@@ -1585,6 +1567,7 @@ int efx_reset_up(struct efx_nic *efx, struct ethtool_cmd *ecmd, bool ok)
1585 EFX_ERR(efx, "could not restore PHY settings\n"); 1567 EFX_ERR(efx, "could not restore PHY settings\n");
1586 } 1568 }
1587 1569
1570 mutex_unlock(&efx->spi_lock);
1588 mutex_unlock(&efx->mac_lock); 1571 mutex_unlock(&efx->mac_lock);
1589 1572
1590 if (ok) { 1573 if (ok) {
@@ -1780,6 +1763,7 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
1780 memset(efx, 0, sizeof(*efx)); 1763 memset(efx, 0, sizeof(*efx));
1781 spin_lock_init(&efx->biu_lock); 1764 spin_lock_init(&efx->biu_lock);
1782 spin_lock_init(&efx->phy_lock); 1765 spin_lock_init(&efx->phy_lock);
1766 mutex_init(&efx->spi_lock);
1783 INIT_WORK(&efx->reset_work, efx_reset_work); 1767 INIT_WORK(&efx->reset_work, efx_reset_work);
1784 INIT_DELAYED_WORK(&efx->monitor_work, efx_monitor); 1768 INIT_DELAYED_WORK(&efx->monitor_work, efx_monitor);
1785 efx->pci_dev = pci_dev; 1769 efx->pci_dev = pci_dev;
@@ -1914,6 +1898,8 @@ static void efx_pci_remove(struct pci_dev *pci_dev)
1914 if (!efx) 1898 if (!efx)
1915 return; 1899 return;
1916 1900
1901 efx_mtd_remove(efx);
1902
1917 /* Mark the NIC as fini, then stop the interface */ 1903 /* Mark the NIC as fini, then stop the interface */
1918 rtnl_lock(); 1904 rtnl_lock();
1919 efx->state = STATE_FINI; 1905 efx->state = STATE_FINI;
@@ -2080,6 +2066,7 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
2080 2066
2081 EFX_LOG(efx, "initialisation successful\n"); 2067 EFX_LOG(efx, "initialisation successful\n");
2082 2068
2069 efx_mtd_probe(efx); /* allowed to fail */
2083 return 0; 2070 return 0;
2084 2071
2085 fail5: 2072 fail5: