aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/au1000_eth.c15
-rw-r--r--drivers/net/e1000e/e1000.h2
-rw-r--r--drivers/net/e1000e/ich8lan.c4
-rw-r--r--drivers/net/e1000e/netdev.c50
-rw-r--r--drivers/net/e1000e/phy.c56
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c2
-rw-r--r--drivers/net/ks8851_mll.c142
-rw-r--r--drivers/net/macvlan.c2
-rw-r--r--drivers/net/netxen/netxen_nic.h2
-rw-r--r--drivers/net/netxen/netxen_nic_hdr.h2
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c55
-rw-r--r--drivers/net/netxen/netxen_nic_main.c4
-rw-r--r--drivers/net/stmmac/stmmac_main.c50
-rw-r--r--drivers/net/stmmac/stmmac_timer.c4
-rw-r--r--drivers/net/stmmac/stmmac_timer.h1
-rw-r--r--drivers/net/usb/hso.c8
-rw-r--r--drivers/net/veth.c35
18 files changed, 240 insertions, 196 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 6399abbdad6b..0bbd5ae49862 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -975,7 +975,7 @@ config ENC28J60_WRITEVERIFY
975 975
976config ETHOC 976config ETHOC
977 tristate "OpenCores 10/100 Mbps Ethernet MAC support" 977 tristate "OpenCores 10/100 Mbps Ethernet MAC support"
978 depends on NET_ETHERNET && HAS_IOMEM 978 depends on NET_ETHERNET && HAS_IOMEM && HAS_DMA
979 select MII 979 select MII
980 select PHYLIB 980 select PHYLIB
981 select CRC32 981 select CRC32
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index e67533cf78d8..6bac04603a88 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -1088,7 +1088,14 @@ static struct net_device * au1000_probe(int port_num)
1088 return NULL; 1088 return NULL;
1089 } 1089 }
1090 1090
1091 if ((err = register_netdev(dev)) != 0) { 1091 dev->base_addr = base;
1092 dev->irq = irq;
1093 dev->netdev_ops = &au1000_netdev_ops;
1094 SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops);
1095 dev->watchdog_timeo = ETH_TX_TIMEOUT;
1096
1097 err = register_netdev(dev);
1098 if (err != 0) {
1092 printk(KERN_ERR "%s: Cannot register net device, error %d\n", 1099 printk(KERN_ERR "%s: Cannot register net device, error %d\n",
1093 DRV_NAME, err); 1100 DRV_NAME, err);
1094 free_netdev(dev); 1101 free_netdev(dev);
@@ -1209,12 +1216,6 @@ static struct net_device * au1000_probe(int port_num)
1209 aup->tx_db_inuse[i] = pDB; 1216 aup->tx_db_inuse[i] = pDB;
1210 } 1217 }
1211 1218
1212 dev->base_addr = base;
1213 dev->irq = irq;
1214 dev->netdev_ops = &au1000_netdev_ops;
1215 SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops);
1216 dev->watchdog_timeo = ETH_TX_TIMEOUT;
1217
1218 /* 1219 /*
1219 * The boot code uses the ethernet controller, so reset it to start 1220 * The boot code uses the ethernet controller, so reset it to start
1220 * fresh. au1000_init() expects that the device is in reset state. 1221 * fresh. au1000_init() expects that the device is in reset state.
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index c9fcef7f8462..3102d738cfd1 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -142,6 +142,8 @@ struct e1000_info;
142#define HV_TNCRS_UPPER PHY_REG(778, 29) /* Transmit with no CRS */ 142#define HV_TNCRS_UPPER PHY_REG(778, 29) /* Transmit with no CRS */
143#define HV_TNCRS_LOWER PHY_REG(778, 30) 143#define HV_TNCRS_LOWER PHY_REG(778, 30)
144 144
145#define E1000_FCRTV_PCH 0x05F40 /* PCH Flow Control Refresh Timer Value */
146
145/* BM PHY Copper Specific Status */ 147/* BM PHY Copper Specific Status */
146#define BM_CS_STATUS 17 148#define BM_CS_STATUS 17
147#define BM_CS_STATUS_LINK_UP 0x0400 149#define BM_CS_STATUS_LINK_UP 0x0400
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index 568bb259c6fd..7530fc5d81c3 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -1110,7 +1110,8 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state)
1110 oem_reg |= HV_OEM_BITS_LPLU; 1110 oem_reg |= HV_OEM_BITS_LPLU;
1111 } 1111 }
1112 /* Restart auto-neg to activate the bits */ 1112 /* Restart auto-neg to activate the bits */
1113 oem_reg |= HV_OEM_BITS_RESTART_AN; 1113 if (!e1000_check_reset_block(hw))
1114 oem_reg |= HV_OEM_BITS_RESTART_AN;
1114 ret_val = hw->phy.ops.write_reg_locked(hw, HV_OEM_BITS, oem_reg); 1115 ret_val = hw->phy.ops.write_reg_locked(hw, HV_OEM_BITS, oem_reg);
1115 1116
1116out: 1117out:
@@ -3545,6 +3546,7 @@ struct e1000_info e1000_pch_info = {
3545 | FLAG_HAS_AMT 3546 | FLAG_HAS_AMT
3546 | FLAG_HAS_FLASH 3547 | FLAG_HAS_FLASH
3547 | FLAG_HAS_JUMBO_FRAMES 3548 | FLAG_HAS_JUMBO_FRAMES
3549 | FLAG_DISABLE_FC_PAUSE_TIME /* errata */
3548 | FLAG_APME_IN_WUC, 3550 | FLAG_APME_IN_WUC,
3549 .pba = 26, 3551 .pba = 26,
3550 .max_hw_frame_size = 4096, 3552 .max_hw_frame_size = 4096,
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 11a527484e18..e546b4ebf155 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -2760,25 +2760,38 @@ void e1000e_reset(struct e1000_adapter *adapter)
2760 /* 2760 /*
2761 * flow control settings 2761 * flow control settings
2762 * 2762 *
2763 * The high water mark must be low enough to fit two full frame 2763 * The high water mark must be low enough to fit one full frame
2764 * (or the size used for early receive) above it in the Rx FIFO. 2764 * (or the size used for early receive) above it in the Rx FIFO.
2765 * Set it to the lower of: 2765 * Set it to the lower of:
2766 * - 90% of the Rx FIFO size, and 2766 * - 90% of the Rx FIFO size, and
2767 * - the full Rx FIFO size minus the early receive size (for parts 2767 * - the full Rx FIFO size minus the early receive size (for parts
2768 * with ERT support assuming ERT set to E1000_ERT_2048), or 2768 * with ERT support assuming ERT set to E1000_ERT_2048), or
2769 * - the full Rx FIFO size minus two full frames 2769 * - the full Rx FIFO size minus one full frame
2770 */ 2770 */
2771 if ((adapter->flags & FLAG_HAS_ERT) && 2771 if (hw->mac.type == e1000_pchlan) {
2772 (adapter->netdev->mtu > ETH_DATA_LEN)) 2772 /*
2773 hwm = min(((pba << 10) * 9 / 10), 2773 * Workaround PCH LOM adapter hangs with certain network
2774 ((pba << 10) - (E1000_ERT_2048 << 3))); 2774 * loads. If hangs persist, try disabling Tx flow control.
2775 else 2775 */
2776 hwm = min(((pba << 10) * 9 / 10), 2776 if (adapter->netdev->mtu > ETH_DATA_LEN) {
2777 ((pba << 10) - (2 * adapter->max_frame_size))); 2777 fc->high_water = 0x3500;
2778 fc->low_water = 0x1500;
2779 } else {
2780 fc->high_water = 0x5000;
2781 fc->low_water = 0x3000;
2782 }
2783 } else {
2784 if ((adapter->flags & FLAG_HAS_ERT) &&
2785 (adapter->netdev->mtu > ETH_DATA_LEN))
2786 hwm = min(((pba << 10) * 9 / 10),
2787 ((pba << 10) - (E1000_ERT_2048 << 3)));
2788 else
2789 hwm = min(((pba << 10) * 9 / 10),
2790 ((pba << 10) - adapter->max_frame_size));
2778 2791
2779 fc->high_water = hwm & E1000_FCRTH_RTH; /* 8-byte granularity */ 2792 fc->high_water = hwm & E1000_FCRTH_RTH; /* 8-byte granularity */
2780 fc->low_water = (fc->high_water - (2 * adapter->max_frame_size)); 2793 fc->low_water = fc->high_water - 8;
2781 fc->low_water &= E1000_FCRTL_RTL; /* 8-byte granularity */ 2794 }
2782 2795
2783 if (adapter->flags & FLAG_DISABLE_FC_PAUSE_TIME) 2796 if (adapter->flags & FLAG_DISABLE_FC_PAUSE_TIME)
2784 fc->pause_time = 0xFFFF; 2797 fc->pause_time = 0xFFFF;
@@ -2804,6 +2817,10 @@ void e1000e_reset(struct e1000_adapter *adapter)
2804 if (mac->ops.init_hw(hw)) 2817 if (mac->ops.init_hw(hw))
2805 e_err("Hardware Error\n"); 2818 e_err("Hardware Error\n");
2806 2819
2820 /* additional part of the flow-control workaround above */
2821 if (hw->mac.type == e1000_pchlan)
2822 ew32(FCRTV_PCH, 0x1000);
2823
2807 e1000_update_mng_vlan(adapter); 2824 e1000_update_mng_vlan(adapter);
2808 2825
2809 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ 2826 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
@@ -3612,7 +3629,7 @@ static void e1000_watchdog_task(struct work_struct *work)
3612 case SPEED_100: 3629 case SPEED_100:
3613 txb2b = 0; 3630 txb2b = 0;
3614 netdev->tx_queue_len = 100; 3631 netdev->tx_queue_len = 100;
3615 /* maybe add some timeout factor ? */ 3632 adapter->tx_timeout_factor = 10;
3616 break; 3633 break;
3617 } 3634 }
3618 3635
@@ -4284,8 +4301,10 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
4284 4301
4285 while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) 4302 while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
4286 msleep(1); 4303 msleep(1);
4287 /* e1000e_down has a dependency on max_frame_size */ 4304 /* e1000e_down -> e1000e_reset dependent on max_frame_size & mtu */
4288 adapter->max_frame_size = max_frame; 4305 adapter->max_frame_size = max_frame;
4306 e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu);
4307 netdev->mtu = new_mtu;
4289 if (netif_running(netdev)) 4308 if (netif_running(netdev))
4290 e1000e_down(adapter); 4309 e1000e_down(adapter);
4291 4310
@@ -4315,9 +4334,6 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
4315 adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN 4334 adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN
4316 + ETH_FCS_LEN; 4335 + ETH_FCS_LEN;
4317 4336
4318 e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu);
4319 netdev->mtu = new_mtu;
4320
4321 if (netif_running(netdev)) 4337 if (netif_running(netdev))
4322 e1000e_up(adapter); 4338 e1000e_up(adapter);
4323 else 4339 else
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index 99d53fae4307..5cd01c691c53 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -71,7 +71,6 @@ static const u16 e1000_igp_2_cable_length_table[] =
71#define I82577_CFG_ASSERT_CRS_ON_TX (1 << 15) 71#define I82577_CFG_ASSERT_CRS_ON_TX (1 << 15)
72#define I82577_CFG_ENABLE_DOWNSHIFT (3 << 10) /* auto downshift 100/10 */ 72#define I82577_CFG_ENABLE_DOWNSHIFT (3 << 10) /* auto downshift 100/10 */
73#define I82577_CTRL_REG 23 73#define I82577_CTRL_REG 23
74#define I82577_CTRL_DOWNSHIFT_MASK (7 << 10)
75 74
76/* 82577 specific PHY registers */ 75/* 82577 specific PHY registers */
77#define I82577_PHY_CTRL_2 18 76#define I82577_PHY_CTRL_2 18
@@ -660,15 +659,6 @@ s32 e1000_copper_link_setup_82577(struct e1000_hw *hw)
660 phy_data |= I82577_CFG_ENABLE_DOWNSHIFT; 659 phy_data |= I82577_CFG_ENABLE_DOWNSHIFT;
661 660
662 ret_val = phy->ops.write_reg(hw, I82577_CFG_REG, phy_data); 661 ret_val = phy->ops.write_reg(hw, I82577_CFG_REG, phy_data);
663 if (ret_val)
664 goto out;
665
666 /* Set number of link attempts before downshift */
667 ret_val = phy->ops.read_reg(hw, I82577_CTRL_REG, &phy_data);
668 if (ret_val)
669 goto out;
670 phy_data &= ~I82577_CTRL_DOWNSHIFT_MASK;
671 ret_val = phy->ops.write_reg(hw, I82577_CTRL_REG, phy_data);
672 662
673out: 663out:
674 return ret_val; 664 return ret_val;
@@ -2658,19 +2648,18 @@ static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data,
2658 page = 0; 2648 page = 0;
2659 2649
2660 if (reg > MAX_PHY_MULTI_PAGE_REG) { 2650 if (reg > MAX_PHY_MULTI_PAGE_REG) {
2661 if ((hw->phy.type != e1000_phy_82578) || 2651 u32 phy_addr = hw->phy.addr;
2662 ((reg != I82578_ADDR_REG) &&
2663 (reg != I82578_ADDR_REG + 1))) {
2664 u32 phy_addr = hw->phy.addr;
2665 2652
2666 hw->phy.addr = 1; 2653 hw->phy.addr = 1;
2667 2654
2668 /* Page is shifted left, PHY expects (page x 32) */ 2655 /* Page is shifted left, PHY expects (page x 32) */
2669 ret_val = e1000e_write_phy_reg_mdic(hw, 2656 ret_val = e1000e_write_phy_reg_mdic(hw,
2670 IGP01E1000_PHY_PAGE_SELECT, 2657 IGP01E1000_PHY_PAGE_SELECT,
2671 (page << IGP_PAGE_SHIFT)); 2658 (page << IGP_PAGE_SHIFT));
2672 hw->phy.addr = phy_addr; 2659 hw->phy.addr = phy_addr;
2673 } 2660
2661 if (ret_val)
2662 goto out;
2674 } 2663 }
2675 2664
2676 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, 2665 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg,
@@ -2678,7 +2667,7 @@ static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data,
2678out: 2667out:
2679 /* Revert to MDIO fast mode, if applicable */ 2668 /* Revert to MDIO fast mode, if applicable */
2680 if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) 2669 if ((hw->phy.type == e1000_phy_82577) && in_slow_mode)
2681 ret_val = e1000_set_mdio_slow_mode_hv(hw, false); 2670 ret_val |= e1000_set_mdio_slow_mode_hv(hw, false);
2682 2671
2683 if (!locked) 2672 if (!locked)
2684 hw->phy.ops.release(hw); 2673 hw->phy.ops.release(hw);
@@ -2784,19 +2773,18 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data,
2784 } 2773 }
2785 2774
2786 if (reg > MAX_PHY_MULTI_PAGE_REG) { 2775 if (reg > MAX_PHY_MULTI_PAGE_REG) {
2787 if ((hw->phy.type != e1000_phy_82578) || 2776 u32 phy_addr = hw->phy.addr;
2788 ((reg != I82578_ADDR_REG) &&
2789 (reg != I82578_ADDR_REG + 1))) {
2790 u32 phy_addr = hw->phy.addr;
2791 2777
2792 hw->phy.addr = 1; 2778 hw->phy.addr = 1;
2793 2779
2794 /* Page is shifted left, PHY expects (page x 32) */ 2780 /* Page is shifted left, PHY expects (page x 32) */
2795 ret_val = e1000e_write_phy_reg_mdic(hw, 2781 ret_val = e1000e_write_phy_reg_mdic(hw,
2796 IGP01E1000_PHY_PAGE_SELECT, 2782 IGP01E1000_PHY_PAGE_SELECT,
2797 (page << IGP_PAGE_SHIFT)); 2783 (page << IGP_PAGE_SHIFT));
2798 hw->phy.addr = phy_addr; 2784 hw->phy.addr = phy_addr;
2799 } 2785
2786 if (ret_val)
2787 goto out;
2800 } 2788 }
2801 2789
2802 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, 2790 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg,
@@ -2805,7 +2793,7 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data,
2805out: 2793out:
2806 /* Revert to MDIO fast mode, if applicable */ 2794 /* Revert to MDIO fast mode, if applicable */
2807 if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) 2795 if ((hw->phy.type == e1000_phy_82577) && in_slow_mode)
2808 ret_val = e1000_set_mdio_slow_mode_hv(hw, false); 2796 ret_val |= e1000_set_mdio_slow_mode_hv(hw, false);
2809 2797
2810 if (!locked) 2798 if (!locked)
2811 hw->phy.ops.release(hw); 2799 hw->phy.ops.release(hw);
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 5182b2893431..5c56f2a741f3 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -242,11 +242,11 @@ static void ixgbe_unmap_and_free_tx_resource(struct ixgbe_adapter *adapter,
242static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter, 242static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter,
243 struct ixgbe_ring *tx_ring) 243 struct ixgbe_ring *tx_ring)
244{ 244{
245 int tc;
246 u32 txoff = IXGBE_TFCS_TXOFF; 245 u32 txoff = IXGBE_TFCS_TXOFF;
247 246
248#ifdef CONFIG_IXGBE_DCB 247#ifdef CONFIG_IXGBE_DCB
249 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { 248 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
249 int tc;
250 int reg_idx = tx_ring->reg_idx; 250 int reg_idx = tx_ring->reg_idx;
251 int dcb_i = adapter->ring_feature[RING_F_DCB].indices; 251 int dcb_i = adapter->ring_feature[RING_F_DCB].indices;
252 252
diff --git a/drivers/net/ks8851_mll.c b/drivers/net/ks8851_mll.c
index 0be14d702beb..c146304d8d6c 100644
--- a/drivers/net/ks8851_mll.c
+++ b/drivers/net/ks8851_mll.c
@@ -568,6 +568,16 @@ static inline void ks_outblk(struct ks_net *ks, u16 *wptr, u32 len)
568 iowrite16(*wptr++, ks->hw_addr); 568 iowrite16(*wptr++, ks->hw_addr);
569} 569}
570 570
571static void ks_disable_int(struct ks_net *ks)
572{
573 ks_wrreg16(ks, KS_IER, 0x0000);
574} /* ks_disable_int */
575
576static void ks_enable_int(struct ks_net *ks)
577{
578 ks_wrreg16(ks, KS_IER, ks->rc_ier);
579} /* ks_enable_int */
580
571/** 581/**
572 * ks_tx_fifo_space - return the available hardware buffer size. 582 * ks_tx_fifo_space - return the available hardware buffer size.
573 * @ks: The chip information 583 * @ks: The chip information
@@ -681,6 +691,47 @@ static void ks_soft_reset(struct ks_net *ks, unsigned op)
681} 691}
682 692
683 693
694void ks_enable_qmu(struct ks_net *ks)
695{
696 u16 w;
697
698 w = ks_rdreg16(ks, KS_TXCR);
699 /* Enables QMU Transmit (TXCR). */
700 ks_wrreg16(ks, KS_TXCR, w | TXCR_TXE);
701
702 /*
703 * RX Frame Count Threshold Enable and Auto-Dequeue RXQ Frame
704 * Enable
705 */
706
707 w = ks_rdreg16(ks, KS_RXQCR);
708 ks_wrreg16(ks, KS_RXQCR, w | RXQCR_RXFCTE);
709
710 /* Enables QMU Receive (RXCR1). */
711 w = ks_rdreg16(ks, KS_RXCR1);
712 ks_wrreg16(ks, KS_RXCR1, w | RXCR1_RXE);
713 ks->enabled = true;
714} /* ks_enable_qmu */
715
716static void ks_disable_qmu(struct ks_net *ks)
717{
718 u16 w;
719
720 w = ks_rdreg16(ks, KS_TXCR);
721
722 /* Disables QMU Transmit (TXCR). */
723 w &= ~TXCR_TXE;
724 ks_wrreg16(ks, KS_TXCR, w);
725
726 /* Disables QMU Receive (RXCR1). */
727 w = ks_rdreg16(ks, KS_RXCR1);
728 w &= ~RXCR1_RXE ;
729 ks_wrreg16(ks, KS_RXCR1, w);
730
731 ks->enabled = false;
732
733} /* ks_disable_qmu */
734
684/** 735/**
685 * ks_read_qmu - read 1 pkt data from the QMU. 736 * ks_read_qmu - read 1 pkt data from the QMU.
686 * @ks: The chip information 737 * @ks: The chip information
@@ -752,7 +803,7 @@ static void ks_rcv(struct ks_net *ks, struct net_device *netdev)
752 (frame_hdr->len < RX_BUF_SIZE) && frame_hdr->len)) { 803 (frame_hdr->len < RX_BUF_SIZE) && frame_hdr->len)) {
753 skb_reserve(skb, 2); 804 skb_reserve(skb, 2);
754 /* read data block including CRC 4 bytes */ 805 /* read data block including CRC 4 bytes */
755 ks_read_qmu(ks, (u16 *)skb->data, frame_hdr->len + 4); 806 ks_read_qmu(ks, (u16 *)skb->data, frame_hdr->len);
756 skb_put(skb, frame_hdr->len); 807 skb_put(skb, frame_hdr->len);
757 skb->dev = netdev; 808 skb->dev = netdev;
758 skb->protocol = eth_type_trans(skb, netdev); 809 skb->protocol = eth_type_trans(skb, netdev);
@@ -861,7 +912,7 @@ static int ks_net_open(struct net_device *netdev)
861 ks_dbg(ks, "%s - entry\n", __func__); 912 ks_dbg(ks, "%s - entry\n", __func__);
862 913
863 /* reset the HW */ 914 /* reset the HW */
864 err = request_irq(ks->irq, ks_irq, KS_INT_FLAGS, DRV_NAME, ks); 915 err = request_irq(ks->irq, ks_irq, KS_INT_FLAGS, DRV_NAME, netdev);
865 916
866 if (err) { 917 if (err) {
867 printk(KERN_ERR "Failed to request IRQ: %d: %d\n", 918 printk(KERN_ERR "Failed to request IRQ: %d: %d\n",
@@ -869,6 +920,15 @@ static int ks_net_open(struct net_device *netdev)
869 return err; 920 return err;
870 } 921 }
871 922
923 /* wake up powermode to normal mode */
924 ks_set_powermode(ks, PMECR_PM_NORMAL);
925 mdelay(1); /* wait for normal mode to take effect */
926
927 ks_wrreg16(ks, KS_ISR, 0xffff);
928 ks_enable_int(ks);
929 ks_enable_qmu(ks);
930 netif_start_queue(ks->netdev);
931
872 if (netif_msg_ifup(ks)) 932 if (netif_msg_ifup(ks))
873 ks_dbg(ks, "network device %s up\n", netdev->name); 933 ks_dbg(ks, "network device %s up\n", netdev->name);
874 934
@@ -892,19 +952,14 @@ static int ks_net_stop(struct net_device *netdev)
892 952
893 netif_stop_queue(netdev); 953 netif_stop_queue(netdev);
894 954
895 kfree(ks->frame_head_info);
896
897 mutex_lock(&ks->lock); 955 mutex_lock(&ks->lock);
898 956
899 /* turn off the IRQs and ack any outstanding */ 957 /* turn off the IRQs and ack any outstanding */
900 ks_wrreg16(ks, KS_IER, 0x0000); 958 ks_wrreg16(ks, KS_IER, 0x0000);
901 ks_wrreg16(ks, KS_ISR, 0xffff); 959 ks_wrreg16(ks, KS_ISR, 0xffff);
902 960
903 /* shutdown RX process */ 961 /* shutdown RX/TX QMU */
904 ks_wrreg16(ks, KS_RXCR1, 0x0000); 962 ks_disable_qmu(ks);
905
906 /* shutdown TX process */
907 ks_wrreg16(ks, KS_TXCR, 0x0000);
908 963
909 /* set powermode to soft power down to save power */ 964 /* set powermode to soft power down to save power */
910 ks_set_powermode(ks, PMECR_PM_SOFTDOWN); 965 ks_set_powermode(ks, PMECR_PM_SOFTDOWN);
@@ -929,17 +984,8 @@ static int ks_net_stop(struct net_device *netdev)
929 */ 984 */
930static void ks_write_qmu(struct ks_net *ks, u8 *pdata, u16 len) 985static void ks_write_qmu(struct ks_net *ks, u8 *pdata, u16 len)
931{ 986{
932 unsigned fid = ks->fid;
933
934 fid = ks->fid;
935 ks->fid = (ks->fid + 1) & TXFR_TXFID_MASK;
936
937 /* reduce the tx interrupt occurrances. */
938 if (!fid)
939 fid |= TXFR_TXIC; /* irq on completion */
940
941 /* start header at txb[0] to align txw entries */ 987 /* start header at txb[0] to align txw entries */
942 ks->txh.txw[0] = cpu_to_le16(fid); 988 ks->txh.txw[0] = 0;
943 ks->txh.txw[1] = cpu_to_le16(len); 989 ks->txh.txw[1] = cpu_to_le16(len);
944 990
945 /* 1. set sudo-DMA mode */ 991 /* 1. set sudo-DMA mode */
@@ -957,16 +1003,6 @@ static void ks_write_qmu(struct ks_net *ks, u8 *pdata, u16 len)
957 ; 1003 ;
958} 1004}
959 1005
960static void ks_disable_int(struct ks_net *ks)
961{
962 ks_wrreg16(ks, KS_IER, 0x0000);
963} /* ks_disable_int */
964
965static void ks_enable_int(struct ks_net *ks)
966{
967 ks_wrreg16(ks, KS_IER, ks->rc_ier);
968} /* ks_enable_int */
969
970/** 1006/**
971 * ks_start_xmit - transmit packet 1007 * ks_start_xmit - transmit packet
972 * @skb : The buffer to transmit 1008 * @skb : The buffer to transmit
@@ -1410,25 +1446,6 @@ static int ks_read_selftest(struct ks_net *ks)
1410 return ret; 1446 return ret;
1411} 1447}
1412 1448
1413static void ks_disable(struct ks_net *ks)
1414{
1415 u16 w;
1416
1417 w = ks_rdreg16(ks, KS_TXCR);
1418
1419 /* Disables QMU Transmit (TXCR). */
1420 w &= ~TXCR_TXE;
1421 ks_wrreg16(ks, KS_TXCR, w);
1422
1423 /* Disables QMU Receive (RXCR1). */
1424 w = ks_rdreg16(ks, KS_RXCR1);
1425 w &= ~RXCR1_RXE ;
1426 ks_wrreg16(ks, KS_RXCR1, w);
1427
1428 ks->enabled = false;
1429
1430} /* ks_disable */
1431
1432static void ks_setup(struct ks_net *ks) 1449static void ks_setup(struct ks_net *ks)
1433{ 1450{
1434 u16 w; 1451 u16 w;
@@ -1463,7 +1480,7 @@ static void ks_setup(struct ks_net *ks)
1463 w = TXCR_TXFCE | TXCR_TXPE | TXCR_TXCRC | TXCR_TCGIP; 1480 w = TXCR_TXFCE | TXCR_TXPE | TXCR_TXCRC | TXCR_TCGIP;
1464 ks_wrreg16(ks, KS_TXCR, w); 1481 ks_wrreg16(ks, KS_TXCR, w);
1465 1482
1466 w = RXCR1_RXFCE | RXCR1_RXBE | RXCR1_RXUE; 1483 w = RXCR1_RXFCE | RXCR1_RXBE | RXCR1_RXUE | RXCR1_RXME | RXCR1_RXIPFCC;
1467 1484
1468 if (ks->promiscuous) /* bPromiscuous */ 1485 if (ks->promiscuous) /* bPromiscuous */
1469 w |= (RXCR1_RXAE | RXCR1_RXINVF); 1486 w |= (RXCR1_RXAE | RXCR1_RXINVF);
@@ -1486,28 +1503,6 @@ static void ks_setup_int(struct ks_net *ks)
1486 ks->rc_ier = (IRQ_LCI | IRQ_TXI | IRQ_RXI); 1503 ks->rc_ier = (IRQ_LCI | IRQ_TXI | IRQ_RXI);
1487} /* ks_setup_int */ 1504} /* ks_setup_int */
1488 1505
1489void ks_enable(struct ks_net *ks)
1490{
1491 u16 w;
1492
1493 w = ks_rdreg16(ks, KS_TXCR);
1494 /* Enables QMU Transmit (TXCR). */
1495 ks_wrreg16(ks, KS_TXCR, w | TXCR_TXE);
1496
1497 /*
1498 * RX Frame Count Threshold Enable and Auto-Dequeue RXQ Frame
1499 * Enable
1500 */
1501
1502 w = ks_rdreg16(ks, KS_RXQCR);
1503 ks_wrreg16(ks, KS_RXQCR, w | RXQCR_RXFCTE);
1504
1505 /* Enables QMU Receive (RXCR1). */
1506 w = ks_rdreg16(ks, KS_RXCR1);
1507 ks_wrreg16(ks, KS_RXCR1, w | RXCR1_RXE);
1508 ks->enabled = true;
1509} /* ks_enable */
1510
1511static int ks_hw_init(struct ks_net *ks) 1506static int ks_hw_init(struct ks_net *ks)
1512{ 1507{
1513#define MHEADER_SIZE (sizeof(struct type_frame_head) * MAX_RECV_FRAMES) 1508#define MHEADER_SIZE (sizeof(struct type_frame_head) * MAX_RECV_FRAMES)
@@ -1612,11 +1607,9 @@ static int __devinit ks8851_probe(struct platform_device *pdev)
1612 1607
1613 ks_soft_reset(ks, GRR_GSR); 1608 ks_soft_reset(ks, GRR_GSR);
1614 ks_hw_init(ks); 1609 ks_hw_init(ks);
1615 ks_disable(ks); 1610 ks_disable_qmu(ks);
1616 ks_setup(ks); 1611 ks_setup(ks);
1617 ks_setup_int(ks); 1612 ks_setup_int(ks);
1618 ks_enable_int(ks);
1619 ks_enable(ks);
1620 memcpy(netdev->dev_addr, ks->mac_addr, 6); 1613 memcpy(netdev->dev_addr, ks->mac_addr, 6);
1621 1614
1622 data = ks_rdreg16(ks, KS_OBCR); 1615 data = ks_rdreg16(ks, KS_OBCR);
@@ -1658,6 +1651,7 @@ static int __devexit ks8851_remove(struct platform_device *pdev)
1658 struct ks_net *ks = netdev_priv(netdev); 1651 struct ks_net *ks = netdev_priv(netdev);
1659 struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1652 struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1660 1653
1654 kfree(ks->frame_head_info);
1661 unregister_netdev(netdev); 1655 unregister_netdev(netdev);
1662 iounmap(ks->hw_addr); 1656 iounmap(ks->hw_addr);
1663 free_netdev(netdev); 1657 free_netdev(netdev);
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 322112c7358a..93c3e6edf702 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -446,6 +446,7 @@ static int macvlan_init(struct net_device *dev)
446 dev->state = (dev->state & ~MACVLAN_STATE_MASK) | 446 dev->state = (dev->state & ~MACVLAN_STATE_MASK) |
447 (lowerdev->state & MACVLAN_STATE_MASK); 447 (lowerdev->state & MACVLAN_STATE_MASK);
448 dev->features = lowerdev->features & MACVLAN_FEATURES; 448 dev->features = lowerdev->features & MACVLAN_FEATURES;
449 dev->gso_max_size = lowerdev->gso_max_size;
449 dev->iflink = lowerdev->ifindex; 450 dev->iflink = lowerdev->ifindex;
450 dev->hard_header_len = lowerdev->hard_header_len; 451 dev->hard_header_len = lowerdev->hard_header_len;
451 452
@@ -772,6 +773,7 @@ static int macvlan_device_event(struct notifier_block *unused,
772 case NETDEV_FEAT_CHANGE: 773 case NETDEV_FEAT_CHANGE:
773 list_for_each_entry(vlan, &port->vlans, list) { 774 list_for_each_entry(vlan, &port->vlans, list) {
774 vlan->dev->features = dev->features & MACVLAN_FEATURES; 775 vlan->dev->features = dev->features & MACVLAN_FEATURES;
776 vlan->dev->gso_max_size = dev->gso_max_size;
775 netdev_features_change(vlan->dev); 777 netdev_features_change(vlan->dev);
776 } 778 }
777 break; 779 break;
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 645450d93f4e..76cd1f3e9fc8 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -1202,6 +1202,8 @@ struct netxen_adapter {
1202 u32 int_vec_bit; 1202 u32 int_vec_bit;
1203 u32 heartbit; 1203 u32 heartbit;
1204 1204
1205 u8 mac_addr[ETH_ALEN];
1206
1205 struct netxen_adapter_stats stats; 1207 struct netxen_adapter_stats stats;
1206 1208
1207 struct netxen_recv_context recv_ctx; 1209 struct netxen_recv_context recv_ctx;
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h
index a39155d61bad..d138fc22927a 100644
--- a/drivers/net/netxen/netxen_nic_hdr.h
+++ b/drivers/net/netxen/netxen_nic_hdr.h
@@ -545,6 +545,8 @@ enum {
545#define NETXEN_NIU_TEST_MUX_CTL (NETXEN_CRB_NIU + 0x00094) 545#define NETXEN_NIU_TEST_MUX_CTL (NETXEN_CRB_NIU + 0x00094)
546#define NETXEN_NIU_XG_PAUSE_CTL (NETXEN_CRB_NIU + 0x00098) 546#define NETXEN_NIU_XG_PAUSE_CTL (NETXEN_CRB_NIU + 0x00098)
547#define NETXEN_NIU_XG_PAUSE_LEVEL (NETXEN_CRB_NIU + 0x000dc) 547#define NETXEN_NIU_XG_PAUSE_LEVEL (NETXEN_CRB_NIU + 0x000dc)
548#define NETXEN_NIU_FRAME_COUNT_SELECT (NETXEN_CRB_NIU + 0x000ac)
549#define NETXEN_NIU_FRAME_COUNT (NETXEN_CRB_NIU + 0x000b0)
548#define NETXEN_NIU_XG_SEL (NETXEN_CRB_NIU + 0x00128) 550#define NETXEN_NIU_XG_SEL (NETXEN_CRB_NIU + 0x00128)
549#define NETXEN_NIU_GB_PAUSE_CTL (NETXEN_CRB_NIU + 0x0030c) 551#define NETXEN_NIU_GB_PAUSE_CTL (NETXEN_CRB_NIU + 0x0030c)
550 552
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index b3054c6cc608..e71ca30433ef 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -389,24 +389,51 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter)
389 389
390int netxen_p2_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) 390int netxen_p2_nic_set_promisc(struct netxen_adapter *adapter, u32 mode)
391{ 391{
392 __u32 reg; 392 u32 mac_cfg;
393 u32 cnt = 0;
394 __u32 reg = 0x0200;
393 u32 port = adapter->physical_port; 395 u32 port = adapter->physical_port;
396 u16 board_type = adapter->ahw.board_type;
394 397
395 if (port > NETXEN_NIU_MAX_XG_PORTS) 398 if (port > NETXEN_NIU_MAX_XG_PORTS)
396 return -EINVAL; 399 return -EINVAL;
397 400
398 reg = NXRD32(adapter, NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port)); 401 mac_cfg = NXRD32(adapter, NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port));
399 if (mode == NETXEN_NIU_PROMISC_MODE) 402 mac_cfg &= ~0x4;
400 reg = (reg | 0x2000UL); 403 NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), mac_cfg);
401 else
402 reg = (reg & ~0x2000UL);
403 404
404 if (mode == NETXEN_NIU_ALLMULTI_MODE) 405 if ((board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) ||
405 reg = (reg | 0x1000UL); 406 (board_type == NETXEN_BRDTYPE_P2_SB31_10G_HMEZ))
406 else 407 reg = (0x20 << port);
407 reg = (reg & ~0x1000UL); 408
409 NXWR32(adapter, NETXEN_NIU_FRAME_COUNT_SELECT, reg);
410
411 mdelay(10);
412
413 while (NXRD32(adapter, NETXEN_NIU_FRAME_COUNT) && ++cnt < 20)
414 mdelay(10);
415
416 if (cnt < 20) {
417
418 reg = NXRD32(adapter,
419 NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port));
420
421 if (mode == NETXEN_NIU_PROMISC_MODE)
422 reg = (reg | 0x2000UL);
423 else
424 reg = (reg & ~0x2000UL);
425
426 if (mode == NETXEN_NIU_ALLMULTI_MODE)
427 reg = (reg | 0x1000UL);
428 else
429 reg = (reg & ~0x1000UL);
430
431 NXWR32(adapter,
432 NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port), reg);
433 }
408 434
409 NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port), reg); 435 mac_cfg |= 0x4;
436 NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), mac_cfg);
410 437
411 return 0; 438 return 0;
412} 439}
@@ -442,7 +469,7 @@ netxen_nic_enable_mcast_filter(struct netxen_adapter *adapter)
442{ 469{
443 u32 val = 0; 470 u32 val = 0;
444 u16 port = adapter->physical_port; 471 u16 port = adapter->physical_port;
445 u8 *addr = adapter->netdev->dev_addr; 472 u8 *addr = adapter->mac_addr;
446 473
447 if (adapter->mc_enabled) 474 if (adapter->mc_enabled)
448 return 0; 475 return 0;
@@ -471,7 +498,7 @@ netxen_nic_disable_mcast_filter(struct netxen_adapter *adapter)
471{ 498{
472 u32 val = 0; 499 u32 val = 0;
473 u16 port = adapter->physical_port; 500 u16 port = adapter->physical_port;
474 u8 *addr = adapter->netdev->dev_addr; 501 u8 *addr = adapter->mac_addr;
475 502
476 if (!adapter->mc_enabled) 503 if (!adapter->mc_enabled)
477 return 0; 504 return 0;
@@ -666,7 +693,7 @@ void netxen_p3_nic_set_multi(struct net_device *netdev)
666 693
667 list_splice_tail_init(&adapter->mac_list, &del_list); 694 list_splice_tail_init(&adapter->mac_list, &del_list);
668 695
669 nx_p3_nic_add_mac(adapter, netdev->dev_addr, &del_list); 696 nx_p3_nic_add_mac(adapter, adapter->mac_addr, &del_list);
670 nx_p3_nic_add_mac(adapter, bcast_addr, &del_list); 697 nx_p3_nic_add_mac(adapter, bcast_addr, &del_list);
671 698
672 if (netdev->flags & IFF_PROMISC) { 699 if (netdev->flags & IFF_PROMISC) {
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index bfbf75c17cf8..838420dbc633 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -445,6 +445,7 @@ netxen_read_mac_addr(struct netxen_adapter *adapter)
445 netdev->dev_addr[i] = *(p + 5 - i); 445 netdev->dev_addr[i] = *(p + 5 - i);
446 446
447 memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len); 447 memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len);
448 memcpy(adapter->mac_addr, netdev->dev_addr, netdev->addr_len);
448 449
449 /* set station address */ 450 /* set station address */
450 451
@@ -467,6 +468,7 @@ int netxen_nic_set_mac(struct net_device *netdev, void *p)
467 netxen_napi_disable(adapter); 468 netxen_napi_disable(adapter);
468 } 469 }
469 470
471 memcpy(adapter->mac_addr, addr->sa_data, netdev->addr_len);
470 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); 472 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
471 adapter->macaddr_set(adapter, addr->sa_data); 473 adapter->macaddr_set(adapter, addr->sa_data);
472 474
@@ -960,7 +962,7 @@ netxen_nic_up(struct netxen_adapter *adapter, struct net_device *netdev)
960 return err; 962 return err;
961 } 963 }
962 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) 964 if (NX_IS_REVISION_P2(adapter->ahw.revision_id))
963 adapter->macaddr_set(adapter, netdev->dev_addr); 965 adapter->macaddr_set(adapter, adapter->mac_addr);
964 966
965 adapter->set_multi(netdev); 967 adapter->set_multi(netdev);
966 adapter->set_mtu(adapter, netdev->mtu); 968 adapter->set_mtu(adapter, netdev->mtu);
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index e961e7593c1f..40813f0b5339 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -416,13 +416,8 @@ static void init_dma_desc_rings(struct net_device *dev)
416 unsigned int txsize = priv->dma_tx_size; 416 unsigned int txsize = priv->dma_tx_size;
417 unsigned int rxsize = priv->dma_rx_size; 417 unsigned int rxsize = priv->dma_rx_size;
418 unsigned int bfsize = priv->dma_buf_sz; 418 unsigned int bfsize = priv->dma_buf_sz;
419 int buff2_needed = 0; 419 int buff2_needed = 0, dis_ic = 0;
420 int dis_ic = 0;
421 420
422#ifdef CONFIG_STMMAC_TIMER
423 /* Using Timers disable interrupts on completion for the reception */
424 dis_ic = 1;
425#endif
426 /* Set the Buffer size according to the MTU; 421 /* Set the Buffer size according to the MTU;
427 * indeed, in case of jumbo we need to bump-up the buffer sizes. 422 * indeed, in case of jumbo we need to bump-up the buffer sizes.
428 */ 423 */
@@ -437,6 +432,11 @@ static void init_dma_desc_rings(struct net_device *dev)
437 else 432 else
438 bfsize = DMA_BUFFER_SIZE; 433 bfsize = DMA_BUFFER_SIZE;
439 434
435#ifdef CONFIG_STMMAC_TIMER
436 /* Disable interrupts on completion for the reception if timer is on */
437 if (likely(priv->tm->enable))
438 dis_ic = 1;
439#endif
440 /* If the MTU exceeds 8k so use the second buffer in the chain */ 440 /* If the MTU exceeds 8k so use the second buffer in the chain */
441 if (bfsize >= BUF_SIZE_8KiB) 441 if (bfsize >= BUF_SIZE_8KiB)
442 buff2_needed = 1; 442 buff2_needed = 1;
@@ -809,20 +809,22 @@ static void stmmac_tx(struct stmmac_priv *priv)
809 809
810static inline void stmmac_enable_irq(struct stmmac_priv *priv) 810static inline void stmmac_enable_irq(struct stmmac_priv *priv)
811{ 811{
812#ifndef CONFIG_STMMAC_TIMER 812#ifdef CONFIG_STMMAC_TIMER
813 writel(DMA_INTR_DEFAULT_MASK, priv->dev->base_addr + DMA_INTR_ENA); 813 if (likely(priv->tm->enable))
814#else 814 priv->tm->timer_start(tmrate);
815 priv->tm->timer_start(tmrate); 815 else
816#endif 816#endif
817 writel(DMA_INTR_DEFAULT_MASK, priv->dev->base_addr + DMA_INTR_ENA);
817} 818}
818 819
819static inline void stmmac_disable_irq(struct stmmac_priv *priv) 820static inline void stmmac_disable_irq(struct stmmac_priv *priv)
820{ 821{
821#ifndef CONFIG_STMMAC_TIMER 822#ifdef CONFIG_STMMAC_TIMER
822 writel(0, priv->dev->base_addr + DMA_INTR_ENA); 823 if (likely(priv->tm->enable))
823#else 824 priv->tm->timer_stop();
824 priv->tm->timer_stop(); 825 else
825#endif 826#endif
827 writel(0, priv->dev->base_addr + DMA_INTR_ENA);
826} 828}
827 829
828static int stmmac_has_work(struct stmmac_priv *priv) 830static int stmmac_has_work(struct stmmac_priv *priv)
@@ -1031,22 +1033,23 @@ static int stmmac_open(struct net_device *dev)
1031 } 1033 }
1032 1034
1033#ifdef CONFIG_STMMAC_TIMER 1035#ifdef CONFIG_STMMAC_TIMER
1034 priv->tm = kmalloc(sizeof(struct stmmac_timer *), GFP_KERNEL); 1036 priv->tm = kzalloc(sizeof(struct stmmac_timer *), GFP_KERNEL);
1035 if (unlikely(priv->tm == NULL)) { 1037 if (unlikely(priv->tm == NULL)) {
1036 pr_err("%s: ERROR: timer memory alloc failed \n", __func__); 1038 pr_err("%s: ERROR: timer memory alloc failed \n", __func__);
1037 return -ENOMEM; 1039 return -ENOMEM;
1038 } 1040 }
1039 priv->tm->freq = tmrate; 1041 priv->tm->freq = tmrate;
1040 1042
1041 /* Test if the HW timer can be actually used. 1043 /* Test if the external timer can be actually used.
1042 * In case of failure continue with no timer. */ 1044 * In case of failure continue without timer. */
1043 if (unlikely((stmmac_open_ext_timer(dev, priv->tm)) < 0)) { 1045 if (unlikely((stmmac_open_ext_timer(dev, priv->tm)) < 0)) {
1044 pr_warning("stmmaceth: cannot attach the HW timer\n"); 1046 pr_warning("stmmaceth: cannot attach the external timer.\n");
1045 tmrate = 0; 1047 tmrate = 0;
1046 priv->tm->freq = 0; 1048 priv->tm->freq = 0;
1047 priv->tm->timer_start = stmmac_no_timer_started; 1049 priv->tm->timer_start = stmmac_no_timer_started;
1048 priv->tm->timer_stop = stmmac_no_timer_stopped; 1050 priv->tm->timer_stop = stmmac_no_timer_stopped;
1049 } 1051 } else
1052 priv->tm->enable = 1;
1050#endif 1053#endif
1051 1054
1052 /* Create and initialize the TX/RX descriptors chains. */ 1055 /* Create and initialize the TX/RX descriptors chains. */
@@ -1322,9 +1325,11 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
1322 1325
1323 /* Interrupt on completition only for the latest segment */ 1326 /* Interrupt on completition only for the latest segment */
1324 priv->mac_type->ops->close_tx_desc(desc); 1327 priv->mac_type->ops->close_tx_desc(desc);
1328
1325#ifdef CONFIG_STMMAC_TIMER 1329#ifdef CONFIG_STMMAC_TIMER
1326 /* Clean IC while using timers */ 1330 /* Clean IC while using timer */
1327 priv->mac_type->ops->clear_tx_ic(desc); 1331 if (likely(priv->tm->enable))
1332 priv->mac_type->ops->clear_tx_ic(desc);
1328#endif 1333#endif
1329 /* To avoid raise condition */ 1334 /* To avoid raise condition */
1330 priv->mac_type->ops->set_tx_owner(first); 1335 priv->mac_type->ops->set_tx_owner(first);
@@ -2028,7 +2033,8 @@ static int stmmac_suspend(struct platform_device *pdev, pm_message_t state)
2028 2033
2029#ifdef CONFIG_STMMAC_TIMER 2034#ifdef CONFIG_STMMAC_TIMER
2030 priv->tm->timer_stop(); 2035 priv->tm->timer_stop();
2031 dis_ic = 1; 2036 if (likely(priv->tm->enable))
2037 dis_ic = 1;
2032#endif 2038#endif
2033 napi_disable(&priv->napi); 2039 napi_disable(&priv->napi);
2034 2040
diff --git a/drivers/net/stmmac/stmmac_timer.c b/drivers/net/stmmac/stmmac_timer.c
index b838c6582077..679f61ffb1f8 100644
--- a/drivers/net/stmmac/stmmac_timer.c
+++ b/drivers/net/stmmac/stmmac_timer.c
@@ -63,7 +63,7 @@ int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm)
63 63
64 stmmac_rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); 64 stmmac_rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);
65 if (stmmac_rtc == NULL) { 65 if (stmmac_rtc == NULL) {
66 pr_error("open rtc device failed\n"); 66 pr_err("open rtc device failed\n");
67 return -ENODEV; 67 return -ENODEV;
68 } 68 }
69 69
@@ -71,7 +71,7 @@ int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm)
71 71
72 /* Periodic mode is not supported */ 72 /* Periodic mode is not supported */
73 if ((rtc_irq_set_freq(stmmac_rtc, &stmmac_task, tm->freq) < 0)) { 73 if ((rtc_irq_set_freq(stmmac_rtc, &stmmac_task, tm->freq) < 0)) {
74 pr_error("set periodic failed\n"); 74 pr_err("set periodic failed\n");
75 rtc_irq_unregister(stmmac_rtc, &stmmac_task); 75 rtc_irq_unregister(stmmac_rtc, &stmmac_task);
76 rtc_class_close(stmmac_rtc); 76 rtc_class_close(stmmac_rtc);
77 return -1; 77 return -1;
diff --git a/drivers/net/stmmac/stmmac_timer.h b/drivers/net/stmmac/stmmac_timer.h
index f795cae33725..6863590d184b 100644
--- a/drivers/net/stmmac/stmmac_timer.h
+++ b/drivers/net/stmmac/stmmac_timer.h
@@ -26,6 +26,7 @@ struct stmmac_timer {
26 void (*timer_start) (unsigned int new_freq); 26 void (*timer_start) (unsigned int new_freq);
27 void (*timer_stop) (void); 27 void (*timer_stop) (void);
28 unsigned int freq; 28 unsigned int freq;
29 unsigned int enable;
29}; 30};
30 31
31/* Open the HW timer device and return 0 in case of success */ 32/* Open the HW timer device and return 0 in case of success */
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index fa4e58196c21..43bc3fcc0d85 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -378,7 +378,7 @@ static void dbg_dump(int line_count, const char *func_name, unsigned char *buf,
378} 378}
379 379
380#define DUMP(buf_, len_) \ 380#define DUMP(buf_, len_) \
381 dbg_dump(__LINE__, __func__, buf_, len_) 381 dbg_dump(__LINE__, __func__, (unsigned char *)buf_, len_)
382 382
383#define DUMP1(buf_, len_) \ 383#define DUMP1(buf_, len_) \
384 do { \ 384 do { \
@@ -1363,7 +1363,7 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp)
1363 /* reset the rts and dtr */ 1363 /* reset the rts and dtr */
1364 /* do the actual close */ 1364 /* do the actual close */
1365 serial->open_count--; 1365 serial->open_count--;
1366 kref_put(&serial->parent->ref, hso_serial_ref_free); 1366
1367 if (serial->open_count <= 0) { 1367 if (serial->open_count <= 0) {
1368 serial->open_count = 0; 1368 serial->open_count = 0;
1369 spin_lock_irq(&serial->serial_lock); 1369 spin_lock_irq(&serial->serial_lock);
@@ -1383,6 +1383,8 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp)
1383 usb_autopm_put_interface(serial->parent->interface); 1383 usb_autopm_put_interface(serial->parent->interface);
1384 1384
1385 mutex_unlock(&serial->parent->mutex); 1385 mutex_unlock(&serial->parent->mutex);
1386
1387 kref_put(&serial->parent->ref, hso_serial_ref_free);
1386} 1388}
1387 1389
1388/* close the requested serial port */ 1390/* close the requested serial port */
@@ -1527,7 +1529,7 @@ static void tiocmget_intr_callback(struct urb *urb)
1527 dev_warn(&usb->dev, 1529 dev_warn(&usb->dev,
1528 "hso received invalid serial state notification\n"); 1530 "hso received invalid serial state notification\n");
1529 DUMP(serial_state_notification, 1531 DUMP(serial_state_notification,
1530 sizeof(hso_serial_state_notifation)) 1532 sizeof(struct hso_serial_state_notification));
1531 } else { 1533 } else {
1532 1534
1533 UART_state_bitmap = le16_to_cpu(serial_state_notification-> 1535 UART_state_bitmap = le16_to_cpu(serial_state_notification->
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 6c4b5a2d7877..63099c58a6dd 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -199,32 +199,29 @@ rx_drop:
199static struct net_device_stats *veth_get_stats(struct net_device *dev) 199static struct net_device_stats *veth_get_stats(struct net_device *dev)
200{ 200{
201 struct veth_priv *priv; 201 struct veth_priv *priv;
202 struct net_device_stats *dev_stats;
203 int cpu; 202 int cpu;
204 struct veth_net_stats *stats; 203 struct veth_net_stats *stats, total = {0};
205 204
206 priv = netdev_priv(dev); 205 priv = netdev_priv(dev);
207 dev_stats = &dev->stats;
208
209 dev_stats->rx_packets = 0;
210 dev_stats->tx_packets = 0;
211 dev_stats->rx_bytes = 0;
212 dev_stats->tx_bytes = 0;
213 dev_stats->tx_dropped = 0;
214 dev_stats->rx_dropped = 0;
215 206
216 for_each_online_cpu(cpu) { 207 for_each_possible_cpu(cpu) {
217 stats = per_cpu_ptr(priv->stats, cpu); 208 stats = per_cpu_ptr(priv->stats, cpu);
218 209
219 dev_stats->rx_packets += stats->rx_packets; 210 total.rx_packets += stats->rx_packets;
220 dev_stats->tx_packets += stats->tx_packets; 211 total.tx_packets += stats->tx_packets;
221 dev_stats->rx_bytes += stats->rx_bytes; 212 total.rx_bytes += stats->rx_bytes;
222 dev_stats->tx_bytes += stats->tx_bytes; 213 total.tx_bytes += stats->tx_bytes;
223 dev_stats->tx_dropped += stats->tx_dropped; 214 total.tx_dropped += stats->tx_dropped;
224 dev_stats->rx_dropped += stats->rx_dropped; 215 total.rx_dropped += stats->rx_dropped;
225 } 216 }
226 217 dev->stats.rx_packets = total.rx_packets;
227 return dev_stats; 218 dev->stats.tx_packets = total.tx_packets;
219 dev->stats.rx_bytes = total.rx_bytes;
220 dev->stats.tx_bytes = total.tx_bytes;
221 dev->stats.tx_dropped = total.tx_dropped;
222 dev->stats.rx_dropped = total.rx_dropped;
223
224 return &dev->stats;
228} 225}
229 226
230static int veth_open(struct net_device *dev) 227static int veth_open(struct net_device *dev)