aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2013-12-26 14:03:29 -0500
committerOlof Johansson <olof@lixom.net>2013-12-26 14:03:29 -0500
commit770039fef4887d22b12525b62cc4ade1ca724173 (patch)
tree7408ae2a4dbe6a3b36af36976a04a968d951d6af /drivers/net/ethernet
parent954e198eac14f6c34157bbf053149f3c2917cbbd (diff)
parent8a0a1af30cbf56b41220a02e34835022c4d72f41 (diff)
Merge branch 'tegra/dma-reset-rework' into next/dt
Bringing in the tegra dma/reset framework cleanup as a base for the DT changes. * tegra/dma-reset-rework: (320 commits) spi: tegra: checking for ERR_PTR instead of NULL ASoC: tegra: update module reset list for Tegra124 clk: tegra: remove bogus PCIE_XCLK clk: tegra: remove legacy reset APIs ARM: tegra: remove legacy DMA entries from DT ARM: tegra: remove legacy clock entries from DT USB: EHCI: tegra: use reset framework Input: tegra-kbc - use reset framework serial: tegra: convert to standard DMA DT bindings serial: tegra: use reset framework spi: tegra: convert to standard DMA DT bindings spi: tegra: use reset framework staging: nvec: use reset framework i2c: tegra: use reset framework ASoC: tegra: convert to standard DMA DT bindings ASoC: tegra: allocate AHUB FIFO during probe() not startup() ASoC: tegra: call pm_runtime APIs around register accesses ASoC: tegra: use reset framework dma: tegra: register as an OF DMA controller dma: tegra: use reset framework ... Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c25
-rw-r--r--drivers/net/ethernet/emulex/benet/be.h1
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c7
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c16
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000.h7
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_main.c60
-rw-r--r--drivers/net/ethernet/intel/igb/igb_ethtool.c7
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c9
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c3
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_selftest.c7
-rw-r--r--drivers/net/ethernet/realtek/8139cp.c5
-rw-r--r--drivers/net/ethernet/realtek/r8169.c5
-rw-r--r--drivers/net/ethernet/sfc/mcdi.h2
-rw-r--r--drivers/net/ethernet/sfc/mcdi_mon.c78
-rw-r--r--drivers/net/ethernet/smsc/smc91x.h22
-rw-r--r--drivers/net/ethernet/via/via-velocity.c11
17 files changed, 109 insertions, 157 deletions
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index a9e068423ba0..369b736dde05 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -10629,10 +10629,8 @@ static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir)
10629static ssize_t tg3_show_temp(struct device *dev, 10629static ssize_t tg3_show_temp(struct device *dev,
10630 struct device_attribute *devattr, char *buf) 10630 struct device_attribute *devattr, char *buf)
10631{ 10631{
10632 struct pci_dev *pdev = to_pci_dev(dev);
10633 struct net_device *netdev = pci_get_drvdata(pdev);
10634 struct tg3 *tp = netdev_priv(netdev);
10635 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 10632 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
10633 struct tg3 *tp = dev_get_drvdata(dev);
10636 u32 temperature; 10634 u32 temperature;
10637 10635
10638 spin_lock_bh(&tp->lock); 10636 spin_lock_bh(&tp->lock);
@@ -10650,29 +10648,25 @@ static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, tg3_show_temp, NULL,
10650static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, tg3_show_temp, NULL, 10648static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, tg3_show_temp, NULL,
10651 TG3_TEMP_MAX_OFFSET); 10649 TG3_TEMP_MAX_OFFSET);
10652 10650
10653static struct attribute *tg3_attributes[] = { 10651static struct attribute *tg3_attrs[] = {
10654 &sensor_dev_attr_temp1_input.dev_attr.attr, 10652 &sensor_dev_attr_temp1_input.dev_attr.attr,
10655 &sensor_dev_attr_temp1_crit.dev_attr.attr, 10653 &sensor_dev_attr_temp1_crit.dev_attr.attr,
10656 &sensor_dev_attr_temp1_max.dev_attr.attr, 10654 &sensor_dev_attr_temp1_max.dev_attr.attr,
10657 NULL 10655 NULL
10658}; 10656};
10659 10657ATTRIBUTE_GROUPS(tg3);
10660static const struct attribute_group tg3_group = {
10661 .attrs = tg3_attributes,
10662};
10663 10658
10664static void tg3_hwmon_close(struct tg3 *tp) 10659static void tg3_hwmon_close(struct tg3 *tp)
10665{ 10660{
10666 if (tp->hwmon_dev) { 10661 if (tp->hwmon_dev) {
10667 hwmon_device_unregister(tp->hwmon_dev); 10662 hwmon_device_unregister(tp->hwmon_dev);
10668 tp->hwmon_dev = NULL; 10663 tp->hwmon_dev = NULL;
10669 sysfs_remove_group(&tp->pdev->dev.kobj, &tg3_group);
10670 } 10664 }
10671} 10665}
10672 10666
10673static void tg3_hwmon_open(struct tg3 *tp) 10667static void tg3_hwmon_open(struct tg3 *tp)
10674{ 10668{
10675 int i, err; 10669 int i;
10676 u32 size = 0; 10670 u32 size = 0;
10677 struct pci_dev *pdev = tp->pdev; 10671 struct pci_dev *pdev = tp->pdev;
10678 struct tg3_ocir ocirs[TG3_SD_NUM_RECS]; 10672 struct tg3_ocir ocirs[TG3_SD_NUM_RECS];
@@ -10690,18 +10684,11 @@ static void tg3_hwmon_open(struct tg3 *tp)
10690 if (!size) 10684 if (!size)
10691 return; 10685 return;
10692 10686
10693 /* Register hwmon sysfs hooks */ 10687 tp->hwmon_dev = hwmon_device_register_with_groups(&pdev->dev, "tg3",
10694 err = sysfs_create_group(&pdev->dev.kobj, &tg3_group); 10688 tp, tg3_groups);
10695 if (err) {
10696 dev_err(&pdev->dev, "Cannot create sysfs group, aborting\n");
10697 return;
10698 }
10699
10700 tp->hwmon_dev = hwmon_device_register(&pdev->dev);
10701 if (IS_ERR(tp->hwmon_dev)) { 10689 if (IS_ERR(tp->hwmon_dev)) {
10702 tp->hwmon_dev = NULL; 10690 tp->hwmon_dev = NULL;
10703 dev_err(&pdev->dev, "Cannot register hwmon device, aborting\n"); 10691 dev_err(&pdev->dev, "Cannot register hwmon device, aborting\n");
10704 sysfs_remove_group(&pdev->dev.kobj, &tg3_group);
10705 } 10692 }
10706} 10693}
10707 10694
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index f4825db5d179..5878df619b53 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -503,6 +503,7 @@ struct be_adapter {
503}; 503};
504 504
505#define be_physfn(adapter) (!adapter->virtfn) 505#define be_physfn(adapter) (!adapter->virtfn)
506#define be_virtfn(adapter) (adapter->virtfn)
506#define sriov_enabled(adapter) (adapter->num_vfs > 0) 507#define sriov_enabled(adapter) (adapter->num_vfs > 0)
507#define sriov_want(adapter) (be_physfn(adapter) && \ 508#define sriov_want(adapter) (be_physfn(adapter) && \
508 (num_vfs || pci_num_vf(adapter->pdev))) 509 (num_vfs || pci_num_vf(adapter->pdev)))
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index dbcd5262c016..e0e8bc1ef14c 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -1032,6 +1032,13 @@ int be_cmd_cq_create(struct be_adapter *adapter, struct be_queue_info *cq,
1032 } else { 1032 } else {
1033 req->hdr.version = 2; 1033 req->hdr.version = 2;
1034 req->page_size = 1; /* 1 for 4K */ 1034 req->page_size = 1; /* 1 for 4K */
1035
1036 /* coalesce-wm field in this cmd is not relevant to Lancer.
1037 * Lancer uses COMMON_MODIFY_CQ to set this field
1038 */
1039 if (!lancer_chip(adapter))
1040 AMAP_SET_BITS(struct amap_cq_context_v2, coalescwm,
1041 ctxt, coalesce_wm);
1035 AMAP_SET_BITS(struct amap_cq_context_v2, nodelay, ctxt, 1042 AMAP_SET_BITS(struct amap_cq_context_v2, nodelay, ctxt,
1036 no_delay); 1043 no_delay);
1037 AMAP_SET_BITS(struct amap_cq_context_v2, count, ctxt, 1044 AMAP_SET_BITS(struct amap_cq_context_v2, count, ctxt,
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index abde97471636..fee64bf10446 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -2658,8 +2658,8 @@ static int be_close(struct net_device *netdev)
2658 2658
2659 be_roce_dev_close(adapter); 2659 be_roce_dev_close(adapter);
2660 2660
2661 for_all_evt_queues(adapter, eqo, i) { 2661 if (adapter->flags & BE_FLAGS_NAPI_ENABLED) {
2662 if (adapter->flags & BE_FLAGS_NAPI_ENABLED) { 2662 for_all_evt_queues(adapter, eqo, i) {
2663 napi_disable(&eqo->napi); 2663 napi_disable(&eqo->napi);
2664 be_disable_busy_poll(eqo); 2664 be_disable_busy_poll(eqo);
2665 } 2665 }
@@ -3253,12 +3253,10 @@ static int be_mac_setup(struct be_adapter *adapter)
3253 memcpy(mac, adapter->netdev->dev_addr, ETH_ALEN); 3253 memcpy(mac, adapter->netdev->dev_addr, ETH_ALEN);
3254 } 3254 }
3255 3255
3256 /* On BE3 VFs this cmd may fail due to lack of privilege. 3256 /* For BE3-R VFs, the PF programs the initial MAC address */
3257 * Ignore the failure as in this case pmac_id is fetched 3257 if (!(BEx_chip(adapter) && be_virtfn(adapter)))
3258 * in the IFACE_CREATE cmd. 3258 be_cmd_pmac_add(adapter, mac, adapter->if_handle,
3259 */ 3259 &adapter->pmac_id[0], 0);
3260 be_cmd_pmac_add(adapter, mac, adapter->if_handle,
3261 &adapter->pmac_id[0], 0);
3262 return 0; 3260 return 0;
3263} 3261}
3264 3262
@@ -4599,6 +4597,7 @@ static int be_suspend(struct pci_dev *pdev, pm_message_t state)
4599 if (adapter->wol) 4597 if (adapter->wol)
4600 be_setup_wol(adapter, true); 4598 be_setup_wol(adapter, true);
4601 4599
4600 be_intr_set(adapter, false);
4602 cancel_delayed_work_sync(&adapter->func_recovery_work); 4601 cancel_delayed_work_sync(&adapter->func_recovery_work);
4603 4602
4604 netif_device_detach(netdev); 4603 netif_device_detach(netdev);
@@ -4634,6 +4633,7 @@ static int be_resume(struct pci_dev *pdev)
4634 if (status) 4633 if (status)
4635 return status; 4634 return status;
4636 4635
4636 be_intr_set(adapter, true);
4637 /* tell fw we're ready to fire cmds */ 4637 /* tell fw we're ready to fire cmds */
4638 status = be_cmd_fw_init(adapter); 4638 status = be_cmd_fw_init(adapter);
4639 if (status) 4639 if (status)
diff --git a/drivers/net/ethernet/intel/e1000/e1000.h b/drivers/net/ethernet/intel/e1000/e1000.h
index 58c147271a36..f9313b36c887 100644
--- a/drivers/net/ethernet/intel/e1000/e1000.h
+++ b/drivers/net/ethernet/intel/e1000/e1000.h
@@ -83,6 +83,11 @@ struct e1000_adapter;
83 83
84#define E1000_MAX_INTR 10 84#define E1000_MAX_INTR 10
85 85
86/*
87 * Count for polling __E1000_RESET condition every 10-20msec.
88 */
89#define E1000_CHECK_RESET_COUNT 50
90
86/* TX/RX descriptor defines */ 91/* TX/RX descriptor defines */
87#define E1000_DEFAULT_TXD 256 92#define E1000_DEFAULT_TXD 256
88#define E1000_MAX_TXD 256 93#define E1000_MAX_TXD 256
@@ -312,8 +317,6 @@ struct e1000_adapter {
312 struct delayed_work watchdog_task; 317 struct delayed_work watchdog_task;
313 struct delayed_work fifo_stall_task; 318 struct delayed_work fifo_stall_task;
314 struct delayed_work phy_info_task; 319 struct delayed_work phy_info_task;
315
316 struct mutex mutex;
317}; 320};
318 321
319enum e1000_state_t { 322enum e1000_state_t {
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index e38622825fa7..46e6544ed1b7 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -494,13 +494,20 @@ static void e1000_down_and_stop(struct e1000_adapter *adapter)
494{ 494{
495 set_bit(__E1000_DOWN, &adapter->flags); 495 set_bit(__E1000_DOWN, &adapter->flags);
496 496
497 /* Only kill reset task if adapter is not resetting */
498 if (!test_bit(__E1000_RESETTING, &adapter->flags))
499 cancel_work_sync(&adapter->reset_task);
500
501 cancel_delayed_work_sync(&adapter->watchdog_task); 497 cancel_delayed_work_sync(&adapter->watchdog_task);
498
499 /*
500 * Since the watchdog task can reschedule other tasks, we should cancel
501 * it first, otherwise we can run into the situation when a work is
502 * still running after the adapter has been turned down.
503 */
504
502 cancel_delayed_work_sync(&adapter->phy_info_task); 505 cancel_delayed_work_sync(&adapter->phy_info_task);
503 cancel_delayed_work_sync(&adapter->fifo_stall_task); 506 cancel_delayed_work_sync(&adapter->fifo_stall_task);
507
508 /* Only kill reset task if adapter is not resetting */
509 if (!test_bit(__E1000_RESETTING, &adapter->flags))
510 cancel_work_sync(&adapter->reset_task);
504} 511}
505 512
506void e1000_down(struct e1000_adapter *adapter) 513void e1000_down(struct e1000_adapter *adapter)
@@ -544,21 +551,8 @@ void e1000_down(struct e1000_adapter *adapter)
544 e1000_clean_all_rx_rings(adapter); 551 e1000_clean_all_rx_rings(adapter);
545} 552}
546 553
547static void e1000_reinit_safe(struct e1000_adapter *adapter)
548{
549 while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
550 msleep(1);
551 mutex_lock(&adapter->mutex);
552 e1000_down(adapter);
553 e1000_up(adapter);
554 mutex_unlock(&adapter->mutex);
555 clear_bit(__E1000_RESETTING, &adapter->flags);
556}
557
558void e1000_reinit_locked(struct e1000_adapter *adapter) 554void e1000_reinit_locked(struct e1000_adapter *adapter)
559{ 555{
560 /* if rtnl_lock is not held the call path is bogus */
561 ASSERT_RTNL();
562 WARN_ON(in_interrupt()); 556 WARN_ON(in_interrupt());
563 while (test_and_set_bit(__E1000_RESETTING, &adapter->flags)) 557 while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
564 msleep(1); 558 msleep(1);
@@ -1316,7 +1310,6 @@ static int e1000_sw_init(struct e1000_adapter *adapter)
1316 e1000_irq_disable(adapter); 1310 e1000_irq_disable(adapter);
1317 1311
1318 spin_lock_init(&adapter->stats_lock); 1312 spin_lock_init(&adapter->stats_lock);
1319 mutex_init(&adapter->mutex);
1320 1313
1321 set_bit(__E1000_DOWN, &adapter->flags); 1314 set_bit(__E1000_DOWN, &adapter->flags);
1322 1315
@@ -1440,6 +1433,10 @@ static int e1000_close(struct net_device *netdev)
1440{ 1433{
1441 struct e1000_adapter *adapter = netdev_priv(netdev); 1434 struct e1000_adapter *adapter = netdev_priv(netdev);
1442 struct e1000_hw *hw = &adapter->hw; 1435 struct e1000_hw *hw = &adapter->hw;
1436 int count = E1000_CHECK_RESET_COUNT;
1437
1438 while (test_bit(__E1000_RESETTING, &adapter->flags) && count--)
1439 usleep_range(10000, 20000);
1443 1440
1444 WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags)); 1441 WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags));
1445 e1000_down(adapter); 1442 e1000_down(adapter);
@@ -2325,11 +2322,8 @@ static void e1000_update_phy_info_task(struct work_struct *work)
2325 struct e1000_adapter *adapter = container_of(work, 2322 struct e1000_adapter *adapter = container_of(work,
2326 struct e1000_adapter, 2323 struct e1000_adapter,
2327 phy_info_task.work); 2324 phy_info_task.work);
2328 if (test_bit(__E1000_DOWN, &adapter->flags)) 2325
2329 return;
2330 mutex_lock(&adapter->mutex);
2331 e1000_phy_get_info(&adapter->hw, &adapter->phy_info); 2326 e1000_phy_get_info(&adapter->hw, &adapter->phy_info);
2332 mutex_unlock(&adapter->mutex);
2333} 2327}
2334 2328
2335/** 2329/**
@@ -2345,9 +2339,6 @@ static void e1000_82547_tx_fifo_stall_task(struct work_struct *work)
2345 struct net_device *netdev = adapter->netdev; 2339 struct net_device *netdev = adapter->netdev;
2346 u32 tctl; 2340 u32 tctl;
2347 2341
2348 if (test_bit(__E1000_DOWN, &adapter->flags))
2349 return;
2350 mutex_lock(&adapter->mutex);
2351 if (atomic_read(&adapter->tx_fifo_stall)) { 2342 if (atomic_read(&adapter->tx_fifo_stall)) {
2352 if ((er32(TDT) == er32(TDH)) && 2343 if ((er32(TDT) == er32(TDH)) &&
2353 (er32(TDFT) == er32(TDFH)) && 2344 (er32(TDFT) == er32(TDFH)) &&
@@ -2368,7 +2359,6 @@ static void e1000_82547_tx_fifo_stall_task(struct work_struct *work)
2368 schedule_delayed_work(&adapter->fifo_stall_task, 1); 2359 schedule_delayed_work(&adapter->fifo_stall_task, 1);
2369 } 2360 }
2370 } 2361 }
2371 mutex_unlock(&adapter->mutex);
2372} 2362}
2373 2363
2374bool e1000_has_link(struct e1000_adapter *adapter) 2364bool e1000_has_link(struct e1000_adapter *adapter)
@@ -2422,10 +2412,6 @@ static void e1000_watchdog(struct work_struct *work)
2422 struct e1000_tx_ring *txdr = adapter->tx_ring; 2412 struct e1000_tx_ring *txdr = adapter->tx_ring;
2423 u32 link, tctl; 2413 u32 link, tctl;
2424 2414
2425 if (test_bit(__E1000_DOWN, &adapter->flags))
2426 return;
2427
2428 mutex_lock(&adapter->mutex);
2429 link = e1000_has_link(adapter); 2415 link = e1000_has_link(adapter);
2430 if ((netif_carrier_ok(netdev)) && link) 2416 if ((netif_carrier_ok(netdev)) && link)
2431 goto link_up; 2417 goto link_up;
@@ -2516,7 +2502,7 @@ link_up:
2516 adapter->tx_timeout_count++; 2502 adapter->tx_timeout_count++;
2517 schedule_work(&adapter->reset_task); 2503 schedule_work(&adapter->reset_task);
2518 /* exit immediately since reset is imminent */ 2504 /* exit immediately since reset is imminent */
2519 goto unlock; 2505 return;
2520 } 2506 }
2521 } 2507 }
2522 2508
@@ -2544,9 +2530,6 @@ link_up:
2544 /* Reschedule the task */ 2530 /* Reschedule the task */
2545 if (!test_bit(__E1000_DOWN, &adapter->flags)) 2531 if (!test_bit(__E1000_DOWN, &adapter->flags))
2546 schedule_delayed_work(&adapter->watchdog_task, 2 * HZ); 2532 schedule_delayed_work(&adapter->watchdog_task, 2 * HZ);
2547
2548unlock:
2549 mutex_unlock(&adapter->mutex);
2550} 2533}
2551 2534
2552enum latency_range { 2535enum latency_range {
@@ -3495,10 +3478,8 @@ static void e1000_reset_task(struct work_struct *work)
3495 struct e1000_adapter *adapter = 3478 struct e1000_adapter *adapter =
3496 container_of(work, struct e1000_adapter, reset_task); 3479 container_of(work, struct e1000_adapter, reset_task);
3497 3480
3498 if (test_bit(__E1000_DOWN, &adapter->flags))
3499 return;
3500 e_err(drv, "Reset adapter\n"); 3481 e_err(drv, "Reset adapter\n");
3501 e1000_reinit_safe(adapter); 3482 e1000_reinit_locked(adapter);
3502} 3483}
3503 3484
3504/** 3485/**
@@ -4963,6 +4944,11 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
4963 netif_device_detach(netdev); 4944 netif_device_detach(netdev);
4964 4945
4965 if (netif_running(netdev)) { 4946 if (netif_running(netdev)) {
4947 int count = E1000_CHECK_RESET_COUNT;
4948
4949 while (test_bit(__E1000_RESETTING, &adapter->flags) && count--)
4950 usleep_range(10000, 20000);
4951
4966 WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags)); 4952 WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags));
4967 e1000_down(adapter); 4953 e1000_down(adapter);
4968 } 4954 }
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index b0f3666b1d7f..c3143da497c8 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -2062,14 +2062,15 @@ static void igb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
2062{ 2062{
2063 struct igb_adapter *adapter = netdev_priv(netdev); 2063 struct igb_adapter *adapter = netdev_priv(netdev);
2064 2064
2065 wol->supported = WAKE_UCAST | WAKE_MCAST |
2066 WAKE_BCAST | WAKE_MAGIC |
2067 WAKE_PHY;
2068 wol->wolopts = 0; 2065 wol->wolopts = 0;
2069 2066
2070 if (!(adapter->flags & IGB_FLAG_WOL_SUPPORTED)) 2067 if (!(adapter->flags & IGB_FLAG_WOL_SUPPORTED))
2071 return; 2068 return;
2072 2069
2070 wol->supported = WAKE_UCAST | WAKE_MCAST |
2071 WAKE_BCAST | WAKE_MAGIC |
2072 WAKE_PHY;
2073
2073 /* apply any specific unsupported masks here */ 2074 /* apply any specific unsupported masks here */
2074 switch (adapter->hw.device_id) { 2075 switch (adapter->hw.device_id) {
2075 default: 2076 default:
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 0c55079ebee3..cc06854296a3 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -4251,8 +4251,8 @@ static void ixgbe_disable_fwd_ring(struct ixgbe_fwd_adapter *vadapter,
4251 rx_ring->l2_accel_priv = NULL; 4251 rx_ring->l2_accel_priv = NULL;
4252} 4252}
4253 4253
4254int ixgbe_fwd_ring_down(struct net_device *vdev, 4254static int ixgbe_fwd_ring_down(struct net_device *vdev,
4255 struct ixgbe_fwd_adapter *accel) 4255 struct ixgbe_fwd_adapter *accel)
4256{ 4256{
4257 struct ixgbe_adapter *adapter = accel->real_adapter; 4257 struct ixgbe_adapter *adapter = accel->real_adapter;
4258 unsigned int rxbase = accel->rx_base_queue; 4258 unsigned int rxbase = accel->rx_base_queue;
@@ -7986,10 +7986,9 @@ skip_sriov:
7986 NETIF_F_TSO | 7986 NETIF_F_TSO |
7987 NETIF_F_TSO6 | 7987 NETIF_F_TSO6 |
7988 NETIF_F_RXHASH | 7988 NETIF_F_RXHASH |
7989 NETIF_F_RXCSUM | 7989 NETIF_F_RXCSUM;
7990 NETIF_F_HW_L2FW_DOFFLOAD;
7991 7990
7992 netdev->hw_features = netdev->features; 7991 netdev->hw_features = netdev->features | NETIF_F_HW_L2FW_DOFFLOAD;
7993 7992
7994 switch (adapter->hw.mac.type) { 7993 switch (adapter->hw.mac.type) {
7995 case ixgbe_mac_82599EB: 7994 case ixgbe_mac_82599EB:
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
index e4c676006be9..39217e5ff7dc 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
@@ -46,6 +46,7 @@ static bool ixgbe_get_i2c_data(u32 *i2cctl);
46static void ixgbe_i2c_bus_clear(struct ixgbe_hw *hw); 46static void ixgbe_i2c_bus_clear(struct ixgbe_hw *hw);
47static enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id); 47static enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id);
48static s32 ixgbe_get_phy_id(struct ixgbe_hw *hw); 48static s32 ixgbe_get_phy_id(struct ixgbe_hw *hw);
49static s32 ixgbe_identify_qsfp_module_generic(struct ixgbe_hw *hw);
49 50
50/** 51/**
51 * ixgbe_identify_phy_generic - Get physical layer module 52 * ixgbe_identify_phy_generic - Get physical layer module
@@ -1164,7 +1165,7 @@ err_read_i2c_eeprom:
1164 * 1165 *
1165 * Searches for and identifies the QSFP module and assigns appropriate PHY type 1166 * Searches for and identifies the QSFP module and assigns appropriate PHY type
1166 **/ 1167 **/
1167s32 ixgbe_identify_qsfp_module_generic(struct ixgbe_hw *hw) 1168static s32 ixgbe_identify_qsfp_module_generic(struct ixgbe_hw *hw)
1168{ 1169{
1169 struct ixgbe_adapter *adapter = hw->back; 1170 struct ixgbe_adapter *adapter = hw->back;
1170 s32 status = IXGBE_ERR_PHY_ADDR_INVALID; 1171 s32 status = IXGBE_ERR_PHY_ADDR_INVALID;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h
index aae900a256da..fffcbdd2bf0e 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h
@@ -145,7 +145,6 @@ s32 ixgbe_get_phy_firmware_version_generic(struct ixgbe_hw *hw,
145s32 ixgbe_reset_phy_nl(struct ixgbe_hw *hw); 145s32 ixgbe_reset_phy_nl(struct ixgbe_hw *hw);
146s32 ixgbe_identify_module_generic(struct ixgbe_hw *hw); 146s32 ixgbe_identify_module_generic(struct ixgbe_hw *hw);
147s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw); 147s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw);
148s32 ixgbe_identify_qsfp_module_generic(struct ixgbe_hw *hw);
149s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw, 148s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw,
150 u16 *list_offset, 149 u16 *list_offset,
151 u16 *data_offset); 150 u16 *data_offset);
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c
index 40626690e8a8..c11d063473e5 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c
@@ -140,7 +140,6 @@ void mlx4_en_ex_selftest(struct net_device *dev, u32 *flags, u64 *buf)
140{ 140{
141 struct mlx4_en_priv *priv = netdev_priv(dev); 141 struct mlx4_en_priv *priv = netdev_priv(dev);
142 struct mlx4_en_dev *mdev = priv->mdev; 142 struct mlx4_en_dev *mdev = priv->mdev;
143 struct mlx4_en_tx_ring *tx_ring;
144 int i, carrier_ok; 143 int i, carrier_ok;
145 144
146 memset(buf, 0, sizeof(u64) * MLX4_EN_NUM_SELF_TEST); 145 memset(buf, 0, sizeof(u64) * MLX4_EN_NUM_SELF_TEST);
@@ -150,16 +149,10 @@ void mlx4_en_ex_selftest(struct net_device *dev, u32 *flags, u64 *buf)
150 carrier_ok = netif_carrier_ok(dev); 149 carrier_ok = netif_carrier_ok(dev);
151 150
152 netif_carrier_off(dev); 151 netif_carrier_off(dev);
153retry_tx:
154 /* Wait until all tx queues are empty. 152 /* Wait until all tx queues are empty.
155 * there should not be any additional incoming traffic 153 * there should not be any additional incoming traffic
156 * since we turned the carrier off */ 154 * since we turned the carrier off */
157 msleep(200); 155 msleep(200);
158 for (i = 0; i < priv->tx_ring_num && carrier_ok; i++) {
159 tx_ring = priv->tx_ring[i];
160 if (tx_ring->prod != (tx_ring->cons + tx_ring->last_nr_txbb))
161 goto retry_tx;
162 }
163 156
164 if (priv->mdev->dev->caps.flags & 157 if (priv->mdev->dev->caps.flags &
165 MLX4_DEV_CAP_FLAG_UC_LOOPBACK) { 158 MLX4_DEV_CAP_FLAG_UC_LOOPBACK) {
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c
index f2a2128165dd..737c1a881f78 100644
--- a/drivers/net/ethernet/realtek/8139cp.c
+++ b/drivers/net/ethernet/realtek/8139cp.c
@@ -678,9 +678,6 @@ static void cp_tx (struct cp_private *cp)
678 le32_to_cpu(txd->opts1) & 0xffff, 678 le32_to_cpu(txd->opts1) & 0xffff,
679 PCI_DMA_TODEVICE); 679 PCI_DMA_TODEVICE);
680 680
681 bytes_compl += skb->len;
682 pkts_compl++;
683
684 if (status & LastFrag) { 681 if (status & LastFrag) {
685 if (status & (TxError | TxFIFOUnder)) { 682 if (status & (TxError | TxFIFOUnder)) {
686 netif_dbg(cp, tx_err, cp->dev, 683 netif_dbg(cp, tx_err, cp->dev,
@@ -702,6 +699,8 @@ static void cp_tx (struct cp_private *cp)
702 netif_dbg(cp, tx_done, cp->dev, 699 netif_dbg(cp, tx_done, cp->dev,
703 "tx done, slot %d\n", tx_tail); 700 "tx done, slot %d\n", tx_tail);
704 } 701 }
702 bytes_compl += skb->len;
703 pkts_compl++;
705 dev_kfree_skb_irq(skb); 704 dev_kfree_skb_irq(skb);
706 } 705 }
707 706
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 799387570766..c737f0ea5de7 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -3465,6 +3465,11 @@ static void rtl8168g_1_hw_phy_config(struct rtl8169_private *tp)
3465 rtl_writephy(tp, 0x14, 0x9065); 3465 rtl_writephy(tp, 0x14, 0x9065);
3466 rtl_writephy(tp, 0x14, 0x1065); 3466 rtl_writephy(tp, 0x14, 0x1065);
3467 3467
3468 /* Check ALDPS bit, disable it if enabled */
3469 rtl_writephy(tp, 0x1f, 0x0a43);
3470 if (rtl_readphy(tp, 0x10) & 0x0004)
3471 rtl_w1w0_phy(tp, 0x10, 0x0000, 0x0004);
3472
3468 rtl_writephy(tp, 0x1f, 0x0000); 3473 rtl_writephy(tp, 0x1f, 0x0000);
3469} 3474}
3470 3475
diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h
index 656a3277c2b2..15816cacb548 100644
--- a/drivers/net/ethernet/sfc/mcdi.h
+++ b/drivers/net/ethernet/sfc/mcdi.h
@@ -75,6 +75,8 @@ struct efx_mcdi_mon {
75 unsigned long last_update; 75 unsigned long last_update;
76 struct device *device; 76 struct device *device;
77 struct efx_mcdi_mon_attribute *attrs; 77 struct efx_mcdi_mon_attribute *attrs;
78 struct attribute_group group;
79 const struct attribute_group *groups[2];
78 unsigned int n_attrs; 80 unsigned int n_attrs;
79}; 81};
80 82
diff --git a/drivers/net/ethernet/sfc/mcdi_mon.c b/drivers/net/ethernet/sfc/mcdi_mon.c
index 4cc5d95b2a5a..d72ad4fc3617 100644
--- a/drivers/net/ethernet/sfc/mcdi_mon.c
+++ b/drivers/net/ethernet/sfc/mcdi_mon.c
@@ -139,17 +139,10 @@ static int efx_mcdi_mon_update(struct efx_nic *efx)
139 return rc; 139 return rc;
140} 140}
141 141
142static ssize_t efx_mcdi_mon_show_name(struct device *dev,
143 struct device_attribute *attr,
144 char *buf)
145{
146 return sprintf(buf, "%s\n", KBUILD_MODNAME);
147}
148
149static int efx_mcdi_mon_get_entry(struct device *dev, unsigned int index, 142static int efx_mcdi_mon_get_entry(struct device *dev, unsigned int index,
150 efx_dword_t *entry) 143 efx_dword_t *entry)
151{ 144{
152 struct efx_nic *efx = dev_get_drvdata(dev); 145 struct efx_nic *efx = dev_get_drvdata(dev->parent);
153 struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); 146 struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx);
154 int rc; 147 int rc;
155 148
@@ -263,7 +256,7 @@ static ssize_t efx_mcdi_mon_show_label(struct device *dev,
263 efx_mcdi_sensor_type[mon_attr->type].label); 256 efx_mcdi_sensor_type[mon_attr->type].label);
264} 257}
265 258
266static int 259static void
267efx_mcdi_mon_add_attr(struct efx_nic *efx, const char *name, 260efx_mcdi_mon_add_attr(struct efx_nic *efx, const char *name,
268 ssize_t (*reader)(struct device *, 261 ssize_t (*reader)(struct device *,
269 struct device_attribute *, char *), 262 struct device_attribute *, char *),
@@ -272,7 +265,6 @@ efx_mcdi_mon_add_attr(struct efx_nic *efx, const char *name,
272{ 265{
273 struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); 266 struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx);
274 struct efx_mcdi_mon_attribute *attr = &hwmon->attrs[hwmon->n_attrs]; 267 struct efx_mcdi_mon_attribute *attr = &hwmon->attrs[hwmon->n_attrs];
275 int rc;
276 268
277 strlcpy(attr->name, name, sizeof(attr->name)); 269 strlcpy(attr->name, name, sizeof(attr->name));
278 attr->index = index; 270 attr->index = index;
@@ -286,10 +278,7 @@ efx_mcdi_mon_add_attr(struct efx_nic *efx, const char *name,
286 attr->dev_attr.attr.name = attr->name; 278 attr->dev_attr.attr.name = attr->name;
287 attr->dev_attr.attr.mode = S_IRUGO; 279 attr->dev_attr.attr.mode = S_IRUGO;
288 attr->dev_attr.show = reader; 280 attr->dev_attr.show = reader;
289 rc = device_create_file(&efx->pci_dev->dev, &attr->dev_attr); 281 hwmon->group.attrs[hwmon->n_attrs++] = &attr->dev_attr.attr;
290 if (rc == 0)
291 ++hwmon->n_attrs;
292 return rc;
293} 282}
294 283
295int efx_mcdi_mon_probe(struct efx_nic *efx) 284int efx_mcdi_mon_probe(struct efx_nic *efx)
@@ -338,26 +327,22 @@ int efx_mcdi_mon_probe(struct efx_nic *efx)
338 efx_mcdi_mon_update(efx); 327 efx_mcdi_mon_update(efx);
339 328
340 /* Allocate space for the maximum possible number of 329 /* Allocate space for the maximum possible number of
341 * attributes for this set of sensors: name of the driver plus 330 * attributes for this set of sensors:
342 * value, min, max, crit, alarm and label for each sensor. 331 * value, min, max, crit, alarm and label for each sensor.
343 */ 332 */
344 n_attrs = 1 + 6 * n_sensors; 333 n_attrs = 6 * n_sensors;
345 hwmon->attrs = kcalloc(n_attrs, sizeof(*hwmon->attrs), GFP_KERNEL); 334 hwmon->attrs = kcalloc(n_attrs, sizeof(*hwmon->attrs), GFP_KERNEL);
346 if (!hwmon->attrs) { 335 if (!hwmon->attrs) {
347 rc = -ENOMEM; 336 rc = -ENOMEM;
348 goto fail; 337 goto fail;
349 } 338 }
350 339 hwmon->group.attrs = kcalloc(n_attrs + 1, sizeof(struct attribute *),
351 hwmon->device = hwmon_device_register(&efx->pci_dev->dev); 340 GFP_KERNEL);
352 if (IS_ERR(hwmon->device)) { 341 if (!hwmon->group.attrs) {
353 rc = PTR_ERR(hwmon->device); 342 rc = -ENOMEM;
354 goto fail; 343 goto fail;
355 } 344 }
356 345
357 rc = efx_mcdi_mon_add_attr(efx, "name", efx_mcdi_mon_show_name, 0, 0, 0);
358 if (rc)
359 goto fail;
360
361 for (i = 0, j = -1, type = -1; ; i++) { 346 for (i = 0, j = -1, type = -1; ; i++) {
362 enum efx_hwmon_type hwmon_type; 347 enum efx_hwmon_type hwmon_type;
363 const char *hwmon_prefix; 348 const char *hwmon_prefix;
@@ -372,7 +357,7 @@ int efx_mcdi_mon_probe(struct efx_nic *efx)
372 page = type / 32; 357 page = type / 32;
373 j = -1; 358 j = -1;
374 if (page == n_pages) 359 if (page == n_pages)
375 return 0; 360 goto hwmon_register;
376 361
377 MCDI_SET_DWORD(inbuf, SENSOR_INFO_EXT_IN_PAGE, 362 MCDI_SET_DWORD(inbuf, SENSOR_INFO_EXT_IN_PAGE,
378 page); 363 page);
@@ -453,28 +438,22 @@ int efx_mcdi_mon_probe(struct efx_nic *efx)
453 if (min1 != max1) { 438 if (min1 != max1) {
454 snprintf(name, sizeof(name), "%s%u_input", 439 snprintf(name, sizeof(name), "%s%u_input",
455 hwmon_prefix, hwmon_index); 440 hwmon_prefix, hwmon_index);
456 rc = efx_mcdi_mon_add_attr( 441 efx_mcdi_mon_add_attr(
457 efx, name, efx_mcdi_mon_show_value, i, type, 0); 442 efx, name, efx_mcdi_mon_show_value, i, type, 0);
458 if (rc)
459 goto fail;
460 443
461 if (hwmon_type != EFX_HWMON_POWER) { 444 if (hwmon_type != EFX_HWMON_POWER) {
462 snprintf(name, sizeof(name), "%s%u_min", 445 snprintf(name, sizeof(name), "%s%u_min",
463 hwmon_prefix, hwmon_index); 446 hwmon_prefix, hwmon_index);
464 rc = efx_mcdi_mon_add_attr( 447 efx_mcdi_mon_add_attr(
465 efx, name, efx_mcdi_mon_show_limit, 448 efx, name, efx_mcdi_mon_show_limit,
466 i, type, min1); 449 i, type, min1);
467 if (rc)
468 goto fail;
469 } 450 }
470 451
471 snprintf(name, sizeof(name), "%s%u_max", 452 snprintf(name, sizeof(name), "%s%u_max",
472 hwmon_prefix, hwmon_index); 453 hwmon_prefix, hwmon_index);
473 rc = efx_mcdi_mon_add_attr( 454 efx_mcdi_mon_add_attr(
474 efx, name, efx_mcdi_mon_show_limit, 455 efx, name, efx_mcdi_mon_show_limit,
475 i, type, max1); 456 i, type, max1);
476 if (rc)
477 goto fail;
478 457
479 if (min2 != max2) { 458 if (min2 != max2) {
480 /* Assume max2 is critical value. 459 /* Assume max2 is critical value.
@@ -482,32 +461,38 @@ int efx_mcdi_mon_probe(struct efx_nic *efx)
482 */ 461 */
483 snprintf(name, sizeof(name), "%s%u_crit", 462 snprintf(name, sizeof(name), "%s%u_crit",
484 hwmon_prefix, hwmon_index); 463 hwmon_prefix, hwmon_index);
485 rc = efx_mcdi_mon_add_attr( 464 efx_mcdi_mon_add_attr(
486 efx, name, efx_mcdi_mon_show_limit, 465 efx, name, efx_mcdi_mon_show_limit,
487 i, type, max2); 466 i, type, max2);
488 if (rc)
489 goto fail;
490 } 467 }
491 } 468 }
492 469
493 snprintf(name, sizeof(name), "%s%u_alarm", 470 snprintf(name, sizeof(name), "%s%u_alarm",
494 hwmon_prefix, hwmon_index); 471 hwmon_prefix, hwmon_index);
495 rc = efx_mcdi_mon_add_attr( 472 efx_mcdi_mon_add_attr(
496 efx, name, efx_mcdi_mon_show_alarm, i, type, 0); 473 efx, name, efx_mcdi_mon_show_alarm, i, type, 0);
497 if (rc)
498 goto fail;
499 474
500 if (type < ARRAY_SIZE(efx_mcdi_sensor_type) && 475 if (type < ARRAY_SIZE(efx_mcdi_sensor_type) &&
501 efx_mcdi_sensor_type[type].label) { 476 efx_mcdi_sensor_type[type].label) {
502 snprintf(name, sizeof(name), "%s%u_label", 477 snprintf(name, sizeof(name), "%s%u_label",
503 hwmon_prefix, hwmon_index); 478 hwmon_prefix, hwmon_index);
504 rc = efx_mcdi_mon_add_attr( 479 efx_mcdi_mon_add_attr(
505 efx, name, efx_mcdi_mon_show_label, i, type, 0); 480 efx, name, efx_mcdi_mon_show_label, i, type, 0);
506 if (rc)
507 goto fail;
508 } 481 }
509 } 482 }
510 483
484hwmon_register:
485 hwmon->groups[0] = &hwmon->group;
486 hwmon->device = hwmon_device_register_with_groups(&efx->pci_dev->dev,
487 KBUILD_MODNAME, NULL,
488 hwmon->groups);
489 if (IS_ERR(hwmon->device)) {
490 rc = PTR_ERR(hwmon->device);
491 goto fail;
492 }
493
494 return 0;
495
511fail: 496fail:
512 efx_mcdi_mon_remove(efx); 497 efx_mcdi_mon_remove(efx);
513 return rc; 498 return rc;
@@ -516,14 +501,11 @@ fail:
516void efx_mcdi_mon_remove(struct efx_nic *efx) 501void efx_mcdi_mon_remove(struct efx_nic *efx)
517{ 502{
518 struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); 503 struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx);
519 unsigned int i;
520 504
521 for (i = 0; i < hwmon->n_attrs; i++)
522 device_remove_file(&efx->pci_dev->dev,
523 &hwmon->attrs[i].dev_attr);
524 kfree(hwmon->attrs);
525 if (hwmon->device) 505 if (hwmon->device)
526 hwmon_device_unregister(hwmon->device); 506 hwmon_device_unregister(hwmon->device);
507 kfree(hwmon->attrs);
508 kfree(hwmon->group.attrs);
527 efx_nic_free_buffer(efx, &hwmon->dma_buf); 509 efx_nic_free_buffer(efx, &hwmon->dma_buf);
528} 510}
529 511
diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h
index c9d4c872e81d..749654b976bc 100644
--- a/drivers/net/ethernet/smsc/smc91x.h
+++ b/drivers/net/ethernet/smsc/smc91x.h
@@ -46,7 +46,8 @@
46 defined(CONFIG_MACH_LITTLETON) ||\ 46 defined(CONFIG_MACH_LITTLETON) ||\
47 defined(CONFIG_MACH_ZYLONITE2) ||\ 47 defined(CONFIG_MACH_ZYLONITE2) ||\
48 defined(CONFIG_ARCH_VIPER) ||\ 48 defined(CONFIG_ARCH_VIPER) ||\
49 defined(CONFIG_MACH_STARGATE2) 49 defined(CONFIG_MACH_STARGATE2) ||\
50 defined(CONFIG_ARCH_VERSATILE)
50 51
51#include <asm/mach-types.h> 52#include <asm/mach-types.h>
52 53
@@ -154,6 +155,8 @@ static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg)
154#define SMC_outl(v, a, r) writel(v, (a) + (r)) 155#define SMC_outl(v, a, r) writel(v, (a) + (r))
155#define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) 156#define SMC_insl(a, r, p, l) readsl((a) + (r), p, l)
156#define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) 157#define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l)
158#define SMC_insw(a, r, p, l) readsw((a) + (r), p, l)
159#define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l)
157#define SMC_IRQ_FLAGS (-1) /* from resource */ 160#define SMC_IRQ_FLAGS (-1) /* from resource */
158 161
159/* We actually can't write halfwords properly if not word aligned */ 162/* We actually can't write halfwords properly if not word aligned */
@@ -206,23 +209,6 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)
206#define RPC_LSA_DEFAULT RPC_LED_TX_RX 209#define RPC_LSA_DEFAULT RPC_LED_TX_RX
207#define RPC_LSB_DEFAULT RPC_LED_100_10 210#define RPC_LSB_DEFAULT RPC_LED_100_10
208 211
209#elif defined(CONFIG_ARCH_VERSATILE)
210
211#define SMC_CAN_USE_8BIT 1
212#define SMC_CAN_USE_16BIT 1
213#define SMC_CAN_USE_32BIT 1
214#define SMC_NOWAIT 1
215
216#define SMC_inb(a, r) readb((a) + (r))
217#define SMC_inw(a, r) readw((a) + (r))
218#define SMC_inl(a, r) readl((a) + (r))
219#define SMC_outb(v, a, r) writeb(v, (a) + (r))
220#define SMC_outw(v, a, r) writew(v, (a) + (r))
221#define SMC_outl(v, a, r) writel(v, (a) + (r))
222#define SMC_insl(a, r, p, l) readsl((a) + (r), p, l)
223#define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l)
224#define SMC_IRQ_FLAGS (-1) /* from resource */
225
226#elif defined(CONFIG_MN10300) 212#elif defined(CONFIG_MN10300)
227 213
228/* 214/*
diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c
index d022bf936572..ad61d26a44f3 100644
--- a/drivers/net/ethernet/via/via-velocity.c
+++ b/drivers/net/ethernet/via/via-velocity.c
@@ -2172,16 +2172,13 @@ static int velocity_poll(struct napi_struct *napi, int budget)
2172 unsigned int rx_done; 2172 unsigned int rx_done;
2173 unsigned long flags; 2173 unsigned long flags;
2174 2174
2175 spin_lock_irqsave(&vptr->lock, flags);
2176 /* 2175 /*
2177 * Do rx and tx twice for performance (taken from the VIA 2176 * Do rx and tx twice for performance (taken from the VIA
2178 * out-of-tree driver). 2177 * out-of-tree driver).
2179 */ 2178 */
2180 rx_done = velocity_rx_srv(vptr, budget / 2); 2179 rx_done = velocity_rx_srv(vptr, budget);
2181 velocity_tx_srv(vptr); 2180 spin_lock_irqsave(&vptr->lock, flags);
2182 rx_done += velocity_rx_srv(vptr, budget - rx_done);
2183 velocity_tx_srv(vptr); 2181 velocity_tx_srv(vptr);
2184
2185 /* If budget not fully consumed, exit the polling mode */ 2182 /* If budget not fully consumed, exit the polling mode */
2186 if (rx_done < budget) { 2183 if (rx_done < budget) {
2187 napi_complete(napi); 2184 napi_complete(napi);
@@ -2342,6 +2339,8 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu)
2342 if (ret < 0) 2339 if (ret < 0)
2343 goto out_free_tmp_vptr_1; 2340 goto out_free_tmp_vptr_1;
2344 2341
2342 napi_disable(&vptr->napi);
2343
2345 spin_lock_irqsave(&vptr->lock, flags); 2344 spin_lock_irqsave(&vptr->lock, flags);
2346 2345
2347 netif_stop_queue(dev); 2346 netif_stop_queue(dev);
@@ -2362,6 +2361,8 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu)
2362 2361
2363 velocity_give_many_rx_descs(vptr); 2362 velocity_give_many_rx_descs(vptr);
2364 2363
2364 napi_enable(&vptr->napi);
2365
2365 mac_enable_int(vptr->mac_regs); 2366 mac_enable_int(vptr->mac_regs);
2366 netif_start_queue(dev); 2367 netif_start_queue(dev);
2367 2368