aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ieee802154/fakehard.c5
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/arm/ep93xx_eth.c12
-rw-r--r--drivers/net/au1000_eth.c15
-rw-r--r--drivers/net/b44.c3
-rw-r--r--drivers/net/davinci_emac.c26
-rw-r--r--drivers/net/e100.c17
-rw-r--r--drivers/net/e1000e/e1000.h2
-rw-r--r--drivers/net/e1000e/ethtool.c12
-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_init.c2
-rw-r--r--drivers/net/netxen/netxen_nic_main.c4
-rw-r--r--drivers/net/r8169.c7
-rw-r--r--drivers/net/smc91x.c2
-rw-r--r--drivers/net/smsc9420.c14
-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
-rw-r--r--drivers/net/wan/cosa.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c2
-rw-r--r--include/net/sctp/structs.h1
-rw-r--r--net/core/pktgen.c32
-rw-r--r--net/ipv4/ip_fragment.c2
-rw-r--r--net/mac80211/agg-tx.c18
-rw-r--r--net/mac80211/ieee80211_i.h8
-rw-r--r--net/mac80211/util.c19
-rw-r--r--net/netfilter/nf_log.c18
-rw-r--r--net/netfilter/xt_limit.c2
-rw-r--r--net/netfilter/xt_osf.c2
-rw-r--r--net/rfkill/core.c1
-rw-r--r--net/sctp/outqueue.c10
-rw-r--r--net/sctp/sm_sideeffect.c1
-rw-r--r--net/sctp/transport.c5
43 files changed, 359 insertions, 299 deletions
diff --git a/drivers/ieee802154/fakehard.c b/drivers/ieee802154/fakehard.c
index 96a2959ce877..7c544f7c74c4 100644
--- a/drivers/ieee802154/fakehard.c
+++ b/drivers/ieee802154/fakehard.c
@@ -260,15 +260,12 @@ static int ieee802154_fake_close(struct net_device *dev)
260static netdev_tx_t ieee802154_fake_xmit(struct sk_buff *skb, 260static netdev_tx_t ieee802154_fake_xmit(struct sk_buff *skb,
261 struct net_device *dev) 261 struct net_device *dev)
262{ 262{
263 skb->iif = dev->ifindex;
264 skb->dev = dev;
265 dev->stats.tx_packets++; 263 dev->stats.tx_packets++;
266 dev->stats.tx_bytes += skb->len; 264 dev->stats.tx_bytes += skb->len;
267 265
268 dev->trans_start = jiffies;
269
270 /* FIXME: do hardware work here ... */ 266 /* FIXME: do hardware work here ... */
271 267
268 dev_kfree_skb(skb);
272 return NETDEV_TX_OK; 269 return NETDEV_TX_OK;
273} 270}
274 271
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index e19ca4bb7510..b2f71f79baaf 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/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c
index 2be49c817995..b25467ac895c 100644
--- a/drivers/net/arm/ep93xx_eth.c
+++ b/drivers/net/arm/ep93xx_eth.c
@@ -628,15 +628,6 @@ static int ep93xx_open(struct net_device *dev)
628 if (ep93xx_alloc_buffers(ep)) 628 if (ep93xx_alloc_buffers(ep))
629 return -ENOMEM; 629 return -ENOMEM;
630 630
631 if (is_zero_ether_addr(dev->dev_addr)) {
632 random_ether_addr(dev->dev_addr);
633 printk(KERN_INFO "%s: generated random MAC address "
634 "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x.\n", dev->name,
635 dev->dev_addr[0], dev->dev_addr[1],
636 dev->dev_addr[2], dev->dev_addr[3],
637 dev->dev_addr[4], dev->dev_addr[5]);
638 }
639
640 napi_enable(&ep->napi); 631 napi_enable(&ep->napi);
641 632
642 if (ep93xx_start_hw(dev)) { 633 if (ep93xx_start_hw(dev)) {
@@ -877,6 +868,9 @@ static int ep93xx_eth_probe(struct platform_device *pdev)
877 ep->mii.mdio_write = ep93xx_mdio_write; 868 ep->mii.mdio_write = ep93xx_mdio_write;
878 ep->mdc_divisor = 40; /* Max HCLK 100 MHz, min MDIO clk 2.5 MHz. */ 869 ep->mdc_divisor = 40; /* Max HCLK 100 MHz, min MDIO clk 2.5 MHz. */
879 870
871 if (is_zero_ether_addr(dev->dev_addr))
872 random_ether_addr(dev->dev_addr);
873
880 err = register_netdev(dev); 874 err = register_netdev(dev);
881 if (err) { 875 if (err) {
882 dev_err(&pdev->dev, "Failed to register netdev\n"); 876 dev_err(&pdev->dev, "Failed to register netdev\n");
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index ce6f1ac25df8..3f4b4300f533 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/b44.c b/drivers/net/b44.c
index e046943ef29d..2a9132343b66 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -912,9 +912,6 @@ static irqreturn_t b44_interrupt(int irq, void *dev_id)
912 bp->istat = istat; 912 bp->istat = istat;
913 __b44_disable_ints(bp); 913 __b44_disable_ints(bp);
914 __napi_schedule(&bp->napi); 914 __napi_schedule(&bp->napi);
915 } else {
916 printk(KERN_ERR PFX "%s: Error, poll already scheduled\n",
917 dev->name);
918 } 915 }
919 916
920irq_ack: 917irq_ack:
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index db6380379478..e3478314c002 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -164,16 +164,14 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1";
164# define EMAC_MBP_MCASTCHAN(ch) ((ch) & 0x7) 164# define EMAC_MBP_MCASTCHAN(ch) ((ch) & 0x7)
165 165
166/* EMAC mac_control register */ 166/* EMAC mac_control register */
167#define EMAC_MACCONTROL_TXPTYPE (0x200) 167#define EMAC_MACCONTROL_TXPTYPE BIT(9)
168#define EMAC_MACCONTROL_TXPACEEN (0x40) 168#define EMAC_MACCONTROL_TXPACEEN BIT(6)
169#define EMAC_MACCONTROL_MIIEN (0x20) 169#define EMAC_MACCONTROL_GMIIEN BIT(5)
170#define EMAC_MACCONTROL_GIGABITEN (0x80) 170#define EMAC_MACCONTROL_GIGABITEN BIT(7)
171#define EMAC_MACCONTROL_GIGABITEN_SHIFT (7) 171#define EMAC_MACCONTROL_FULLDUPLEXEN BIT(0)
172#define EMAC_MACCONTROL_FULLDUPLEXEN (0x1)
173#define EMAC_MACCONTROL_RMIISPEED_MASK BIT(15) 172#define EMAC_MACCONTROL_RMIISPEED_MASK BIT(15)
174 173
175/* GIGABIT MODE related bits */ 174/* GIGABIT MODE related bits */
176#define EMAC_DM646X_MACCONTORL_GMIIEN BIT(5)
177#define EMAC_DM646X_MACCONTORL_GIG BIT(7) 175#define EMAC_DM646X_MACCONTORL_GIG BIT(7)
178#define EMAC_DM646X_MACCONTORL_GIGFORCE BIT(17) 176#define EMAC_DM646X_MACCONTORL_GIGFORCE BIT(17)
179 177
@@ -192,10 +190,10 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1";
192#define EMAC_RX_BUFFER_OFFSET_MASK (0xFFFF) 190#define EMAC_RX_BUFFER_OFFSET_MASK (0xFFFF)
193 191
194/* MAC_IN_VECTOR (0x180) register bit fields */ 192/* MAC_IN_VECTOR (0x180) register bit fields */
195#define EMAC_DM644X_MAC_IN_VECTOR_HOST_INT (0x20000) 193#define EMAC_DM644X_MAC_IN_VECTOR_HOST_INT BIT(17)
196#define EMAC_DM644X_MAC_IN_VECTOR_STATPEND_INT (0x10000) 194#define EMAC_DM644X_MAC_IN_VECTOR_STATPEND_INT BIT(16)
197#define EMAC_DM644X_MAC_IN_VECTOR_RX_INT_VEC (0x0100) 195#define EMAC_DM644X_MAC_IN_VECTOR_RX_INT_VEC BIT(8)
198#define EMAC_DM644X_MAC_IN_VECTOR_TX_INT_VEC (0x01) 196#define EMAC_DM644X_MAC_IN_VECTOR_TX_INT_VEC BIT(0)
199 197
200/** NOTE:: For DM646x the IN_VECTOR has changed */ 198/** NOTE:: For DM646x the IN_VECTOR has changed */
201#define EMAC_DM646X_MAC_IN_VECTOR_RX_INT_VEC BIT(EMAC_DEF_RX_CH) 199#define EMAC_DM646X_MAC_IN_VECTOR_RX_INT_VEC BIT(EMAC_DEF_RX_CH)
@@ -203,7 +201,6 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1";
203#define EMAC_DM646X_MAC_IN_VECTOR_HOST_INT BIT(26) 201#define EMAC_DM646X_MAC_IN_VECTOR_HOST_INT BIT(26)
204#define EMAC_DM646X_MAC_IN_VECTOR_STATPEND_INT BIT(27) 202#define EMAC_DM646X_MAC_IN_VECTOR_STATPEND_INT BIT(27)
205 203
206
207/* CPPI bit positions */ 204/* CPPI bit positions */
208#define EMAC_CPPI_SOP_BIT BIT(31) 205#define EMAC_CPPI_SOP_BIT BIT(31)
209#define EMAC_CPPI_EOP_BIT BIT(30) 206#define EMAC_CPPI_EOP_BIT BIT(30)
@@ -750,8 +747,7 @@ static void emac_update_phystatus(struct emac_priv *priv)
750 747
751 if (priv->speed == SPEED_1000 && (priv->version == EMAC_VERSION_2)) { 748 if (priv->speed == SPEED_1000 && (priv->version == EMAC_VERSION_2)) {
752 mac_control = emac_read(EMAC_MACCONTROL); 749 mac_control = emac_read(EMAC_MACCONTROL);
753 mac_control |= (EMAC_DM646X_MACCONTORL_GMIIEN | 750 mac_control |= (EMAC_DM646X_MACCONTORL_GIG |
754 EMAC_DM646X_MACCONTORL_GIG |
755 EMAC_DM646X_MACCONTORL_GIGFORCE); 751 EMAC_DM646X_MACCONTORL_GIGFORCE);
756 } else { 752 } else {
757 /* Clear the GIG bit and GIGFORCE bit */ 753 /* Clear the GIG bit and GIGFORCE bit */
@@ -2108,7 +2104,7 @@ static int emac_hw_enable(struct emac_priv *priv)
2108 2104
2109 /* Enable MII */ 2105 /* Enable MII */
2110 val = emac_read(EMAC_MACCONTROL); 2106 val = emac_read(EMAC_MACCONTROL);
2111 val |= (EMAC_MACCONTROL_MIIEN); 2107 val |= (EMAC_MACCONTROL_GMIIEN);
2112 emac_write(EMAC_MACCONTROL, val); 2108 emac_write(EMAC_MACCONTROL, val);
2113 2109
2114 /* Enable NAPI and interrupts */ 2110 /* Enable NAPI and interrupts */
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 3c29a20b751e..d269a68ce354 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -157,6 +157,7 @@
157#include <linux/init.h> 157#include <linux/init.h>
158#include <linux/pci.h> 158#include <linux/pci.h>
159#include <linux/dma-mapping.h> 159#include <linux/dma-mapping.h>
160#include <linux/dmapool.h>
160#include <linux/netdevice.h> 161#include <linux/netdevice.h>
161#include <linux/etherdevice.h> 162#include <linux/etherdevice.h>
162#include <linux/mii.h> 163#include <linux/mii.h>
@@ -602,6 +603,7 @@ struct nic {
602 struct mem *mem; 603 struct mem *mem;
603 dma_addr_t dma_addr; 604 dma_addr_t dma_addr;
604 605
606 struct pci_pool *cbs_pool;
605 dma_addr_t cbs_dma_addr; 607 dma_addr_t cbs_dma_addr;
606 u8 adaptive_ifs; 608 u8 adaptive_ifs;
607 u8 tx_threshold; 609 u8 tx_threshold;
@@ -1793,9 +1795,7 @@ static void e100_clean_cbs(struct nic *nic)
1793 nic->cb_to_clean = nic->cb_to_clean->next; 1795 nic->cb_to_clean = nic->cb_to_clean->next;
1794 nic->cbs_avail++; 1796 nic->cbs_avail++;
1795 } 1797 }
1796 pci_free_consistent(nic->pdev, 1798 pci_pool_free(nic->cbs_pool, nic->cbs, nic->cbs_dma_addr);
1797 sizeof(struct cb) * nic->params.cbs.count,
1798 nic->cbs, nic->cbs_dma_addr);
1799 nic->cbs = NULL; 1799 nic->cbs = NULL;
1800 nic->cbs_avail = 0; 1800 nic->cbs_avail = 0;
1801 } 1801 }
@@ -1813,8 +1813,8 @@ static int e100_alloc_cbs(struct nic *nic)
1813 nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = NULL; 1813 nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = NULL;
1814 nic->cbs_avail = 0; 1814 nic->cbs_avail = 0;
1815 1815
1816 nic->cbs = pci_alloc_consistent(nic->pdev, 1816 nic->cbs = pci_pool_alloc(nic->cbs_pool, GFP_KERNEL,
1817 sizeof(struct cb) * count, &nic->cbs_dma_addr); 1817 &nic->cbs_dma_addr);
1818 if (!nic->cbs) 1818 if (!nic->cbs)
1819 return -ENOMEM; 1819 return -ENOMEM;
1820 1820
@@ -2841,7 +2841,11 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2841 DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n"); 2841 DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n");
2842 goto err_out_free; 2842 goto err_out_free;
2843 } 2843 }
2844 2844 nic->cbs_pool = pci_pool_create(netdev->name,
2845 nic->pdev,
2846 nic->params.cbs.count * sizeof(struct cb),
2847 sizeof(u32),
2848 0);
2845 DPRINTK(PROBE, INFO, "addr 0x%llx, irq %d, MAC addr %pM\n", 2849 DPRINTK(PROBE, INFO, "addr 0x%llx, irq %d, MAC addr %pM\n",
2846 (unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0), 2850 (unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0),
2847 pdev->irq, netdev->dev_addr); 2851 pdev->irq, netdev->dev_addr);
@@ -2871,6 +2875,7 @@ static void __devexit e100_remove(struct pci_dev *pdev)
2871 unregister_netdev(netdev); 2875 unregister_netdev(netdev);
2872 e100_free(nic); 2876 e100_free(nic);
2873 pci_iounmap(pdev, nic->csr); 2877 pci_iounmap(pdev, nic->csr);
2878 pci_pool_destroy(nic->cbs_pool);
2874 free_netdev(netdev); 2879 free_netdev(netdev);
2875 pci_release_regions(pdev); 2880 pci_release_regions(pdev);
2876 pci_disable_device(pdev); 2881 pci_disable_device(pdev);
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index 189dfa2d6c76..3e187b0e4203 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -141,6 +141,8 @@ struct e1000_info;
141#define HV_TNCRS_UPPER PHY_REG(778, 29) /* Transmit with no CRS */ 141#define HV_TNCRS_UPPER PHY_REG(778, 29) /* Transmit with no CRS */
142#define HV_TNCRS_LOWER PHY_REG(778, 30) 142#define HV_TNCRS_LOWER PHY_REG(778, 30)
143 143
144#define E1000_FCRTV_PCH 0x05F40 /* PCH Flow Control Refresh Timer Value */
145
144/* BM PHY Copper Specific Status */ 146/* BM PHY Copper Specific Status */
145#define BM_CS_STATUS 17 147#define BM_CS_STATUS 17
146#define BM_CS_STATUS_LINK_UP 0x0400 148#define BM_CS_STATUS_LINK_UP 0x0400
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 1bf4d2a5d34f..e82638ecae88 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -327,10 +327,18 @@ static int e1000_set_pauseparam(struct net_device *netdev,
327 327
328 hw->fc.current_mode = hw->fc.requested_mode; 328 hw->fc.current_mode = hw->fc.requested_mode;
329 329
330 retval = ((hw->phy.media_type == e1000_media_type_fiber) ? 330 if (hw->phy.media_type == e1000_media_type_fiber) {
331 hw->mac.ops.setup_link(hw) : e1000e_force_mac_fc(hw)); 331 retval = hw->mac.ops.setup_link(hw);
332 /* implicit goto out */
333 } else {
334 retval = e1000e_force_mac_fc(hw);
335 if (retval)
336 goto out;
337 e1000e_set_fc_watermarks(hw);
338 }
332 } 339 }
333 340
341out:
334 clear_bit(__E1000_RESETTING, &adapter->state); 342 clear_bit(__E1000_RESETTING, &adapter->state);
335 return retval; 343 return retval;
336} 344}
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index 51ddb04ab195..eff3f4783655 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -1118,7 +1118,8 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state)
1118 oem_reg |= HV_OEM_BITS_LPLU; 1118 oem_reg |= HV_OEM_BITS_LPLU;
1119 } 1119 }
1120 /* Restart auto-neg to activate the bits */ 1120 /* Restart auto-neg to activate the bits */
1121 oem_reg |= HV_OEM_BITS_RESTART_AN; 1121 if (!e1000_check_reset_block(hw))
1122 oem_reg |= HV_OEM_BITS_RESTART_AN;
1122 ret_val = hw->phy.ops.write_phy_reg_locked(hw, HV_OEM_BITS, oem_reg); 1123 ret_val = hw->phy.ops.write_phy_reg_locked(hw, HV_OEM_BITS, oem_reg);
1123 1124
1124out: 1125out:
@@ -3558,6 +3559,7 @@ struct e1000_info e1000_pch_info = {
3558 | FLAG_HAS_AMT 3559 | FLAG_HAS_AMT
3559 | FLAG_HAS_FLASH 3560 | FLAG_HAS_FLASH
3560 | FLAG_HAS_JUMBO_FRAMES 3561 | FLAG_HAS_JUMBO_FRAMES
3562 | FLAG_DISABLE_FC_PAUSE_TIME /* errata */
3561 | FLAG_APME_IN_WUC, 3563 | FLAG_APME_IN_WUC,
3562 .pba = 26, 3564 .pba = 26,
3563 .max_hw_frame_size = 4096, 3565 .max_hw_frame_size = 4096,
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 0687c6aa4e46..fad8f9ea0043 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -2769,25 +2769,38 @@ void e1000e_reset(struct e1000_adapter *adapter)
2769 /* 2769 /*
2770 * flow control settings 2770 * flow control settings
2771 * 2771 *
2772 * The high water mark must be low enough to fit two full frame 2772 * The high water mark must be low enough to fit one full frame
2773 * (or the size used for early receive) above it in the Rx FIFO. 2773 * (or the size used for early receive) above it in the Rx FIFO.
2774 * Set it to the lower of: 2774 * Set it to the lower of:
2775 * - 90% of the Rx FIFO size, and 2775 * - 90% of the Rx FIFO size, and
2776 * - the full Rx FIFO size minus the early receive size (for parts 2776 * - the full Rx FIFO size minus the early receive size (for parts
2777 * with ERT support assuming ERT set to E1000_ERT_2048), or 2777 * with ERT support assuming ERT set to E1000_ERT_2048), or
2778 * - the full Rx FIFO size minus two full frames 2778 * - the full Rx FIFO size minus one full frame
2779 */ 2779 */
2780 if ((adapter->flags & FLAG_HAS_ERT) && 2780 if (hw->mac.type == e1000_pchlan) {
2781 (adapter->netdev->mtu > ETH_DATA_LEN)) 2781 /*
2782 hwm = min(((pba << 10) * 9 / 10), 2782 * Workaround PCH LOM adapter hangs with certain network
2783 ((pba << 10) - (E1000_ERT_2048 << 3))); 2783 * loads. If hangs persist, try disabling Tx flow control.
2784 else 2784 */
2785 hwm = min(((pba << 10) * 9 / 10), 2785 if (adapter->netdev->mtu > ETH_DATA_LEN) {
2786 ((pba << 10) - (2 * adapter->max_frame_size))); 2786 fc->high_water = 0x3500;
2787 fc->low_water = 0x1500;
2788 } else {
2789 fc->high_water = 0x5000;
2790 fc->low_water = 0x3000;
2791 }
2792 } else {
2793 if ((adapter->flags & FLAG_HAS_ERT) &&
2794 (adapter->netdev->mtu > ETH_DATA_LEN))
2795 hwm = min(((pba << 10) * 9 / 10),
2796 ((pba << 10) - (E1000_ERT_2048 << 3)));
2797 else
2798 hwm = min(((pba << 10) * 9 / 10),
2799 ((pba << 10) - adapter->max_frame_size));
2787 2800
2788 fc->high_water = hwm & E1000_FCRTH_RTH; /* 8-byte granularity */ 2801 fc->high_water = hwm & E1000_FCRTH_RTH; /* 8-byte granularity */
2789 fc->low_water = (fc->high_water - (2 * adapter->max_frame_size)); 2802 fc->low_water = fc->high_water - 8;
2790 fc->low_water &= E1000_FCRTL_RTL; /* 8-byte granularity */ 2803 }
2791 2804
2792 if (adapter->flags & FLAG_DISABLE_FC_PAUSE_TIME) 2805 if (adapter->flags & FLAG_DISABLE_FC_PAUSE_TIME)
2793 fc->pause_time = 0xFFFF; 2806 fc->pause_time = 0xFFFF;
@@ -2813,6 +2826,10 @@ void e1000e_reset(struct e1000_adapter *adapter)
2813 if (mac->ops.init_hw(hw)) 2826 if (mac->ops.init_hw(hw))
2814 e_err("Hardware Error\n"); 2827 e_err("Hardware Error\n");
2815 2828
2829 /* additional part of the flow-control workaround above */
2830 if (hw->mac.type == e1000_pchlan)
2831 ew32(FCRTV_PCH, 0x1000);
2832
2816 e1000_update_mng_vlan(adapter); 2833 e1000_update_mng_vlan(adapter);
2817 2834
2818 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ 2835 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
@@ -3610,7 +3627,7 @@ static void e1000_watchdog_task(struct work_struct *work)
3610 case SPEED_100: 3627 case SPEED_100:
3611 txb2b = 0; 3628 txb2b = 0;
3612 netdev->tx_queue_len = 100; 3629 netdev->tx_queue_len = 100;
3613 /* maybe add some timeout factor ? */ 3630 adapter->tx_timeout_factor = 10;
3614 break; 3631 break;
3615 } 3632 }
3616 3633
@@ -4288,8 +4305,10 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
4288 4305
4289 while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) 4306 while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
4290 msleep(1); 4307 msleep(1);
4291 /* e1000e_down has a dependency on max_frame_size */ 4308 /* e1000e_down -> e1000e_reset dependent on max_frame_size & mtu */
4292 adapter->max_frame_size = max_frame; 4309 adapter->max_frame_size = max_frame;
4310 e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu);
4311 netdev->mtu = new_mtu;
4293 if (netif_running(netdev)) 4312 if (netif_running(netdev))
4294 e1000e_down(adapter); 4313 e1000e_down(adapter);
4295 4314
@@ -4319,9 +4338,6 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
4319 adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN 4338 adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN
4320 + ETH_FCS_LEN; 4339 + ETH_FCS_LEN;
4321 4340
4322 e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu);
4323 netdev->mtu = new_mtu;
4324
4325 if (netif_running(netdev)) 4341 if (netif_running(netdev))
4326 e1000e_up(adapter); 4342 e1000e_up(adapter);
4327 else 4343 else
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index 03175b3a2c9e..85f955f70417 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_phy_reg(hw, I82577_CFG_REG, phy_data); 661 ret_val = phy->ops.write_phy_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_phy_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_phy_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_phy(hw); 2673 hw->phy.ops.release_phy(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_phy(hw); 2799 hw->phy.ops.release_phy(hw);
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index a5036f7c1923..a456578b8578 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -240,11 +240,11 @@ static void ixgbe_unmap_and_free_tx_resource(struct ixgbe_adapter *adapter,
240static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter, 240static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter,
241 struct ixgbe_ring *tx_ring) 241 struct ixgbe_ring *tx_ring)
242{ 242{
243 int tc;
244 u32 txoff = IXGBE_TFCS_TXOFF; 243 u32 txoff = IXGBE_TFCS_TXOFF;
245 244
246#ifdef CONFIG_IXGBE_DCB 245#ifdef CONFIG_IXGBE_DCB
247 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { 246 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
247 int tc;
248 int reg_idx = tx_ring->reg_idx; 248 int reg_idx = tx_ring->reg_idx;
249 int dcb_i = adapter->ring_feature[RING_F_DCB].indices; 249 int dcb_i = adapter->ring_feature[RING_F_DCB].indices;
250 250
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 3aabfd9dd212..2490aa39804c 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -360,6 +360,7 @@ static int macvlan_init(struct net_device *dev)
360 dev->state = (dev->state & ~MACVLAN_STATE_MASK) | 360 dev->state = (dev->state & ~MACVLAN_STATE_MASK) |
361 (lowerdev->state & MACVLAN_STATE_MASK); 361 (lowerdev->state & MACVLAN_STATE_MASK);
362 dev->features = lowerdev->features & MACVLAN_FEATURES; 362 dev->features = lowerdev->features & MACVLAN_FEATURES;
363 dev->gso_max_size = lowerdev->gso_max_size;
363 dev->iflink = lowerdev->ifindex; 364 dev->iflink = lowerdev->ifindex;
364 dev->hard_header_len = lowerdev->hard_header_len; 365 dev->hard_header_len = lowerdev->hard_header_len;
365 366
@@ -596,6 +597,7 @@ static int macvlan_device_event(struct notifier_block *unused,
596 case NETDEV_FEAT_CHANGE: 597 case NETDEV_FEAT_CHANGE:
597 list_for_each_entry(vlan, &port->vlans, list) { 598 list_for_each_entry(vlan, &port->vlans, list) {
598 vlan->dev->features = dev->features & MACVLAN_FEATURES; 599 vlan->dev->features = dev->features & MACVLAN_FEATURES;
600 vlan->dev->gso_max_size = dev->gso_max_size;
599 netdev_features_change(vlan->dev); 601 netdev_features_change(vlan->dev);
600 } 602 }
601 break; 603 break;
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 7384f59df615..e1237b802872 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -1163,6 +1163,8 @@ struct netxen_adapter {
1163 u32 int_vec_bit; 1163 u32 int_vec_bit;
1164 u32 heartbit; 1164 u32 heartbit;
1165 1165
1166 u8 mac_addr[ETH_ALEN];
1167
1166 struct netxen_adapter_stats stats; 1168 struct netxen_adapter_stats stats;
1167 1169
1168 struct netxen_recv_context recv_ctx; 1170 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 1c46da632125..17bb3818d84e 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 3185a98b0917..52a3798d8d94 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -383,24 +383,51 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter)
383 383
384int netxen_p2_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) 384int netxen_p2_nic_set_promisc(struct netxen_adapter *adapter, u32 mode)
385{ 385{
386 __u32 reg; 386 u32 mac_cfg;
387 u32 cnt = 0;
388 __u32 reg = 0x0200;
387 u32 port = adapter->physical_port; 389 u32 port = adapter->physical_port;
390 u16 board_type = adapter->ahw.board_type;
388 391
389 if (port > NETXEN_NIU_MAX_XG_PORTS) 392 if (port > NETXEN_NIU_MAX_XG_PORTS)
390 return -EINVAL; 393 return -EINVAL;
391 394
392 reg = NXRD32(adapter, NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port)); 395 mac_cfg = NXRD32(adapter, NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port));
393 if (mode == NETXEN_NIU_PROMISC_MODE) 396 mac_cfg &= ~0x4;
394 reg = (reg | 0x2000UL); 397 NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), mac_cfg);
395 else
396 reg = (reg & ~0x2000UL);
397 398
398 if (mode == NETXEN_NIU_ALLMULTI_MODE) 399 if ((board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) ||
399 reg = (reg | 0x1000UL); 400 (board_type == NETXEN_BRDTYPE_P2_SB31_10G_HMEZ))
400 else 401 reg = (0x20 << port);
401 reg = (reg & ~0x1000UL); 402
403 NXWR32(adapter, NETXEN_NIU_FRAME_COUNT_SELECT, reg);
404
405 mdelay(10);
406
407 while (NXRD32(adapter, NETXEN_NIU_FRAME_COUNT) && ++cnt < 20)
408 mdelay(10);
409
410 if (cnt < 20) {
411
412 reg = NXRD32(adapter,
413 NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port));
414
415 if (mode == NETXEN_NIU_PROMISC_MODE)
416 reg = (reg | 0x2000UL);
417 else
418 reg = (reg & ~0x2000UL);
419
420 if (mode == NETXEN_NIU_ALLMULTI_MODE)
421 reg = (reg | 0x1000UL);
422 else
423 reg = (reg & ~0x1000UL);
424
425 NXWR32(adapter,
426 NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port), reg);
427 }
402 428
403 NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port), reg); 429 mac_cfg |= 0x4;
430 NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), mac_cfg);
404 431
405 return 0; 432 return 0;
406} 433}
@@ -436,7 +463,7 @@ netxen_nic_enable_mcast_filter(struct netxen_adapter *adapter)
436{ 463{
437 u32 val = 0; 464 u32 val = 0;
438 u16 port = adapter->physical_port; 465 u16 port = adapter->physical_port;
439 u8 *addr = adapter->netdev->dev_addr; 466 u8 *addr = adapter->mac_addr;
440 467
441 if (adapter->mc_enabled) 468 if (adapter->mc_enabled)
442 return 0; 469 return 0;
@@ -465,7 +492,7 @@ netxen_nic_disable_mcast_filter(struct netxen_adapter *adapter)
465{ 492{
466 u32 val = 0; 493 u32 val = 0;
467 u16 port = adapter->physical_port; 494 u16 port = adapter->physical_port;
468 u8 *addr = adapter->netdev->dev_addr; 495 u8 *addr = adapter->mac_addr;
469 496
470 if (!adapter->mc_enabled) 497 if (!adapter->mc_enabled)
471 return 0; 498 return 0;
@@ -660,7 +687,7 @@ void netxen_p3_nic_set_multi(struct net_device *netdev)
660 687
661 list_splice_tail_init(&adapter->mac_list, &del_list); 688 list_splice_tail_init(&adapter->mac_list, &del_list);
662 689
663 nx_p3_nic_add_mac(adapter, netdev->dev_addr, &del_list); 690 nx_p3_nic_add_mac(adapter, adapter->mac_addr, &del_list);
664 nx_p3_nic_add_mac(adapter, bcast_addr, &del_list); 691 nx_p3_nic_add_mac(adapter, bcast_addr, &del_list);
665 692
666 if (netdev->flags & IFF_PROMISC) { 693 if (netdev->flags & IFF_PROMISC) {
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index e40b914d6faf..8a0904368e08 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -544,6 +544,8 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
544 continue; 544 continue;
545 if (off == (ROMUSB_GLB + 0x1c)) /* MS clock */ 545 if (off == (ROMUSB_GLB + 0x1c)) /* MS clock */
546 continue; 546 continue;
547 if ((off & 0x0ff00000) == NETXEN_CRB_DDR_NET)
548 continue;
547 if (off == (NETXEN_CRB_PEG_NET_1 + 0x18)) 549 if (off == (NETXEN_CRB_PEG_NET_1 + 0x18))
548 buf[i].data = 0x1020; 550 buf[i].data = 0x1020;
549 /* skip the function enable register */ 551 /* skip the function enable register */
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 0b4a56a8c8d5..3bf78dbfbf0f 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -437,6 +437,7 @@ netxen_read_mac_addr(struct netxen_adapter *adapter)
437 netdev->dev_addr[i] = *(p + 5 - i); 437 netdev->dev_addr[i] = *(p + 5 - i);
438 438
439 memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len); 439 memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len);
440 memcpy(adapter->mac_addr, netdev->dev_addr, netdev->addr_len);
440 441
441 /* set station address */ 442 /* set station address */
442 443
@@ -459,6 +460,7 @@ int netxen_nic_set_mac(struct net_device *netdev, void *p)
459 netxen_napi_disable(adapter); 460 netxen_napi_disable(adapter);
460 } 461 }
461 462
463 memcpy(adapter->mac_addr, addr->sa_data, netdev->addr_len);
462 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); 464 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
463 adapter->macaddr_set(adapter, addr->sa_data); 465 adapter->macaddr_set(adapter, addr->sa_data);
464 466
@@ -956,7 +958,7 @@ netxen_nic_up(struct netxen_adapter *adapter, struct net_device *netdev)
956 return err; 958 return err;
957 } 959 }
958 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) 960 if (NX_IS_REVISION_P2(adapter->ahw.revision_id))
959 adapter->macaddr_set(adapter, netdev->dev_addr); 961 adapter->macaddr_set(adapter, adapter->mac_addr);
960 962
961 adapter->set_multi(netdev); 963 adapter->set_multi(netdev);
962 adapter->set_mtu(adapter, netdev->mtu); 964 adapter->set_mtu(adapter, netdev->mtu);
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index b9221bdc7184..0fe2fc90f207 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -3235,6 +3235,10 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev)
3235 flush_scheduled_work(); 3235 flush_scheduled_work();
3236 3236
3237 unregister_netdev(dev); 3237 unregister_netdev(dev);
3238
3239 /* restore original MAC address */
3240 rtl_rar_set(tp, dev->perm_addr);
3241
3238 rtl_disable_msi(pdev, tp); 3242 rtl_disable_msi(pdev, tp);
3239 rtl8169_release_board(pdev, dev, tp->mmio_addr); 3243 rtl8169_release_board(pdev, dev, tp->mmio_addr);
3240 pci_set_drvdata(pdev, NULL); 3244 pci_set_drvdata(pdev, NULL);
@@ -4881,6 +4885,9 @@ static void rtl_shutdown(struct pci_dev *pdev)
4881 4885
4882 rtl8169_net_suspend(dev); 4886 rtl8169_net_suspend(dev);
4883 4887
4888 /* restore original MAC address */
4889 rtl_rar_set(tp, dev->perm_addr);
4890
4884 spin_lock_irq(&tp->lock); 4891 spin_lock_irq(&tp->lock);
4885 4892
4886 rtl8169_asic_down(ioaddr); 4893 rtl8169_asic_down(ioaddr);
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 05c91ee6921e..f12206bdbb75 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -2283,7 +2283,7 @@ static int __devinit smc_drv_probe(struct platform_device *pdev)
2283 2283
2284 ndev->irq = ires->start; 2284 ndev->irq = ires->start;
2285 2285
2286 if (ires->flags & IRQF_TRIGGER_MASK) 2286 if (irq_flags == -1 || ires->flags & IRQF_TRIGGER_MASK)
2287 irq_flags = ires->flags & IRQF_TRIGGER_MASK; 2287 irq_flags = ires->flags & IRQF_TRIGGER_MASK;
2288 2288
2289 ret = smc_request_attrib(pdev, ndev); 2289 ret = smc_request_attrib(pdev, ndev);
diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c
index b4909a2dec66..0f7909276237 100644
--- a/drivers/net/smsc9420.c
+++ b/drivers/net/smsc9420.c
@@ -252,6 +252,9 @@ static int smsc9420_ethtool_get_settings(struct net_device *dev,
252{ 252{
253 struct smsc9420_pdata *pd = netdev_priv(dev); 253 struct smsc9420_pdata *pd = netdev_priv(dev);
254 254
255 if (!pd->phy_dev)
256 return -ENODEV;
257
255 cmd->maxtxpkt = 1; 258 cmd->maxtxpkt = 1;
256 cmd->maxrxpkt = 1; 259 cmd->maxrxpkt = 1;
257 return phy_ethtool_gset(pd->phy_dev, cmd); 260 return phy_ethtool_gset(pd->phy_dev, cmd);
@@ -262,6 +265,9 @@ static int smsc9420_ethtool_set_settings(struct net_device *dev,
262{ 265{
263 struct smsc9420_pdata *pd = netdev_priv(dev); 266 struct smsc9420_pdata *pd = netdev_priv(dev);
264 267
268 if (!pd->phy_dev)
269 return -ENODEV;
270
265 return phy_ethtool_sset(pd->phy_dev, cmd); 271 return phy_ethtool_sset(pd->phy_dev, cmd);
266} 272}
267 273
@@ -290,6 +296,10 @@ static void smsc9420_ethtool_set_msglevel(struct net_device *netdev, u32 data)
290static int smsc9420_ethtool_nway_reset(struct net_device *netdev) 296static int smsc9420_ethtool_nway_reset(struct net_device *netdev)
291{ 297{
292 struct smsc9420_pdata *pd = netdev_priv(netdev); 298 struct smsc9420_pdata *pd = netdev_priv(netdev);
299
300 if (!pd->phy_dev)
301 return -ENODEV;
302
293 return phy_start_aneg(pd->phy_dev); 303 return phy_start_aneg(pd->phy_dev);
294} 304}
295 305
@@ -312,6 +322,10 @@ smsc9420_ethtool_getregs(struct net_device *dev, struct ethtool_regs *regs,
312 for (i = 0; i < 0x100; i += (sizeof(u32))) 322 for (i = 0; i < 0x100; i += (sizeof(u32)))
313 data[j++] = smsc9420_reg_read(pd, i); 323 data[j++] = smsc9420_reg_read(pd, i);
314 324
325 // cannot read phy registers if the net device is down
326 if (!phy_dev)
327 return;
328
315 for (i = 0; i <= 31; i++) 329 for (i = 0; i <= 31; i++)
316 data[j++] = smsc9420_mii_read(phy_dev->bus, phy_dev->addr, i); 330 data[j++] = smsc9420_mii_read(phy_dev->bus, phy_dev->addr, i);
317} 331}
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index c2f14dc9ba28..9542995ba667 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 ade5b344f75d..52af5017c46b 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -210,32 +210,29 @@ rx_drop:
210static struct net_device_stats *veth_get_stats(struct net_device *dev) 210static struct net_device_stats *veth_get_stats(struct net_device *dev)
211{ 211{
212 struct veth_priv *priv; 212 struct veth_priv *priv;
213 struct net_device_stats *dev_stats;
214 int cpu; 213 int cpu;
215 struct veth_net_stats *stats; 214 struct veth_net_stats *stats, total = {0};
216 215
217 priv = netdev_priv(dev); 216 priv = netdev_priv(dev);
218 dev_stats = &dev->stats;
219
220 dev_stats->rx_packets = 0;
221 dev_stats->tx_packets = 0;
222 dev_stats->rx_bytes = 0;
223 dev_stats->tx_bytes = 0;
224 dev_stats->tx_dropped = 0;
225 dev_stats->rx_dropped = 0;
226 217
227 for_each_online_cpu(cpu) { 218 for_each_possible_cpu(cpu) {
228 stats = per_cpu_ptr(priv->stats, cpu); 219 stats = per_cpu_ptr(priv->stats, cpu);
229 220
230 dev_stats->rx_packets += stats->rx_packets; 221 total.rx_packets += stats->rx_packets;
231 dev_stats->tx_packets += stats->tx_packets; 222 total.tx_packets += stats->tx_packets;
232 dev_stats->rx_bytes += stats->rx_bytes; 223 total.rx_bytes += stats->rx_bytes;
233 dev_stats->tx_bytes += stats->tx_bytes; 224 total.tx_bytes += stats->tx_bytes;
234 dev_stats->tx_dropped += stats->tx_dropped; 225 total.tx_dropped += stats->tx_dropped;
235 dev_stats->rx_dropped += stats->rx_dropped; 226 total.rx_dropped += stats->rx_dropped;
236 } 227 }
237 228 dev->stats.rx_packets = total.rx_packets;
238 return dev_stats; 229 dev->stats.tx_packets = total.tx_packets;
230 dev->stats.rx_bytes = total.rx_bytes;
231 dev->stats.tx_bytes = total.tx_bytes;
232 dev->stats.tx_dropped = total.tx_dropped;
233 dev->stats.rx_dropped = total.rx_dropped;
234
235 return &dev->stats;
239} 236}
240 237
241static int veth_open(struct net_device *dev) 238static int veth_open(struct net_device *dev)
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index e2c33c06190b..8e25ca7080c7 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -907,6 +907,7 @@ static ssize_t cosa_write(struct file *file,
907 current->state = TASK_RUNNING; 907 current->state = TASK_RUNNING;
908 chan->tx_status = 1; 908 chan->tx_status = 1;
909 spin_unlock_irqrestore(&cosa->lock, flags); 909 spin_unlock_irqrestore(&cosa->lock, flags);
910 up(&chan->wsem);
910 return -ERESTARTSYS; 911 return -ERESTARTSYS;
911 } 912 }
912 } 913 }
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 52bed89063d4..43d2be9867fc 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1555,6 +1555,8 @@ void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
1555 BIT(NL80211_IFTYPE_ADHOC) | 1555 BIT(NL80211_IFTYPE_ADHOC) |
1556 BIT(NL80211_IFTYPE_MESH_POINT); 1556 BIT(NL80211_IFTYPE_MESH_POINT);
1557 1557
1558 hw->wiphy->ps_default = false;
1559
1558 hw->queues = 4; 1560 hw->queues = 4;
1559 hw->max_rates = 4; 1561 hw->max_rates = 4;
1560 hw->channel_change_time = 5000; 1562 hw->channel_change_time = 5000;
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index cd2e18778f81..0a474568b003 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -893,7 +893,6 @@ struct sctp_transport {
893 */ 893 */
894 /* RTO : The current retransmission timeout value. */ 894 /* RTO : The current retransmission timeout value. */
895 unsigned long rto; 895 unsigned long rto;
896 unsigned long last_rto;
897 896
898 __u32 rtt; /* This is the most recent RTT. */ 897 __u32 rtt; /* This is the most recent RTT. */
899 898
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 6eb8d47cbf3a..6e79e96cb4f2 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -363,6 +363,7 @@ struct pktgen_dev {
363 * device name (not when the inject is 363 * device name (not when the inject is
364 * started as it used to do.) 364 * started as it used to do.)
365 */ 365 */
366 char odevname[32];
366 struct flow_state *flows; 367 struct flow_state *flows;
367 unsigned cflows; /* Concurrent flows (config) */ 368 unsigned cflows; /* Concurrent flows (config) */
368 unsigned lflow; /* Flow length (config) */ 369 unsigned lflow; /* Flow length (config) */
@@ -426,7 +427,7 @@ static const char version[] =
426static int pktgen_remove_device(struct pktgen_thread *t, struct pktgen_dev *i); 427static int pktgen_remove_device(struct pktgen_thread *t, struct pktgen_dev *i);
427static int pktgen_add_device(struct pktgen_thread *t, const char *ifname); 428static int pktgen_add_device(struct pktgen_thread *t, const char *ifname);
428static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t, 429static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t,
429 const char *ifname); 430 const char *ifname, bool exact);
430static int pktgen_device_event(struct notifier_block *, unsigned long, void *); 431static int pktgen_device_event(struct notifier_block *, unsigned long, void *);
431static void pktgen_run_all_threads(void); 432static void pktgen_run_all_threads(void);
432static void pktgen_reset_all_threads(void); 433static void pktgen_reset_all_threads(void);
@@ -528,7 +529,7 @@ static int pktgen_if_show(struct seq_file *seq, void *v)
528 seq_printf(seq, 529 seq_printf(seq,
529 " frags: %d delay: %llu clone_skb: %d ifname: %s\n", 530 " frags: %d delay: %llu clone_skb: %d ifname: %s\n",
530 pkt_dev->nfrags, (unsigned long long) pkt_dev->delay, 531 pkt_dev->nfrags, (unsigned long long) pkt_dev->delay,
531 pkt_dev->clone_skb, pkt_dev->odev->name); 532 pkt_dev->clone_skb, pkt_dev->odevname);
532 533
533 seq_printf(seq, " flows: %u flowlen: %u\n", pkt_dev->cflows, 534 seq_printf(seq, " flows: %u flowlen: %u\n", pkt_dev->cflows,
534 pkt_dev->lflow); 535 pkt_dev->lflow);
@@ -1688,13 +1689,13 @@ static int pktgen_thread_show(struct seq_file *seq, void *v)
1688 if_lock(t); 1689 if_lock(t);
1689 list_for_each_entry(pkt_dev, &t->if_list, list) 1690 list_for_each_entry(pkt_dev, &t->if_list, list)
1690 if (pkt_dev->running) 1691 if (pkt_dev->running)
1691 seq_printf(seq, "%s ", pkt_dev->odev->name); 1692 seq_printf(seq, "%s ", pkt_dev->odevname);
1692 1693
1693 seq_printf(seq, "\nStopped: "); 1694 seq_printf(seq, "\nStopped: ");
1694 1695
1695 list_for_each_entry(pkt_dev, &t->if_list, list) 1696 list_for_each_entry(pkt_dev, &t->if_list, list)
1696 if (!pkt_dev->running) 1697 if (!pkt_dev->running)
1697 seq_printf(seq, "%s ", pkt_dev->odev->name); 1698 seq_printf(seq, "%s ", pkt_dev->odevname);
1698 1699
1699 if (t->result[0]) 1700 if (t->result[0])
1700 seq_printf(seq, "\nResult: %s\n", t->result); 1701 seq_printf(seq, "\nResult: %s\n", t->result);
@@ -1817,9 +1818,10 @@ static struct pktgen_dev *__pktgen_NN_threads(const char *ifname, int remove)
1817{ 1818{
1818 struct pktgen_thread *t; 1819 struct pktgen_thread *t;
1819 struct pktgen_dev *pkt_dev = NULL; 1820 struct pktgen_dev *pkt_dev = NULL;
1821 bool exact = (remove == FIND);
1820 1822
1821 list_for_each_entry(t, &pktgen_threads, th_list) { 1823 list_for_each_entry(t, &pktgen_threads, th_list) {
1822 pkt_dev = pktgen_find_dev(t, ifname); 1824 pkt_dev = pktgen_find_dev(t, ifname, exact);
1823 if (pkt_dev) { 1825 if (pkt_dev) {
1824 if (remove) { 1826 if (remove) {
1825 if_lock(t); 1827 if_lock(t);
@@ -1994,7 +1996,7 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
1994 "queue_map_min (zero-based) (%d) exceeds valid range " 1996 "queue_map_min (zero-based) (%d) exceeds valid range "
1995 "[0 - %d] for (%d) queues on %s, resetting\n", 1997 "[0 - %d] for (%d) queues on %s, resetting\n",
1996 pkt_dev->queue_map_min, (ntxq ?: 1) - 1, ntxq, 1998 pkt_dev->queue_map_min, (ntxq ?: 1) - 1, ntxq,
1997 pkt_dev->odev->name); 1999 pkt_dev->odevname);
1998 pkt_dev->queue_map_min = ntxq - 1; 2000 pkt_dev->queue_map_min = ntxq - 1;
1999 } 2001 }
2000 if (pkt_dev->queue_map_max >= ntxq) { 2002 if (pkt_dev->queue_map_max >= ntxq) {
@@ -2002,7 +2004,7 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
2002 "queue_map_max (zero-based) (%d) exceeds valid range " 2004 "queue_map_max (zero-based) (%d) exceeds valid range "
2003 "[0 - %d] for (%d) queues on %s, resetting\n", 2005 "[0 - %d] for (%d) queues on %s, resetting\n",
2004 pkt_dev->queue_map_max, (ntxq ?: 1) - 1, ntxq, 2006 pkt_dev->queue_map_max, (ntxq ?: 1) - 1, ntxq,
2005 pkt_dev->odev->name); 2007 pkt_dev->odevname);
2006 pkt_dev->queue_map_max = ntxq - 1; 2008 pkt_dev->queue_map_max = ntxq - 1;
2007 } 2009 }
2008 2010
@@ -3262,7 +3264,7 @@ static int pktgen_stop_device(struct pktgen_dev *pkt_dev)
3262 3264
3263 if (!pkt_dev->running) { 3265 if (!pkt_dev->running) {
3264 printk(KERN_WARNING "pktgen: interface: %s is already " 3266 printk(KERN_WARNING "pktgen: interface: %s is already "
3265 "stopped\n", pkt_dev->odev->name); 3267 "stopped\n", pkt_dev->odevname);
3266 return -EINVAL; 3268 return -EINVAL;
3267 } 3269 }
3268 3270
@@ -3464,7 +3466,7 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
3464 default: /* Drivers are not supposed to return other values! */ 3466 default: /* Drivers are not supposed to return other values! */
3465 if (net_ratelimit()) 3467 if (net_ratelimit())
3466 pr_info("pktgen: %s xmit error: %d\n", 3468 pr_info("pktgen: %s xmit error: %d\n",
3467 odev->name, ret); 3469 pkt_dev->odevname, ret);
3468 pkt_dev->errors++; 3470 pkt_dev->errors++;
3469 /* fallthru */ 3471 /* fallthru */
3470 case NETDEV_TX_LOCKED: 3472 case NETDEV_TX_LOCKED:
@@ -3566,13 +3568,18 @@ static int pktgen_thread_worker(void *arg)
3566} 3568}
3567 3569
3568static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t, 3570static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t,
3569 const char *ifname) 3571 const char *ifname, bool exact)
3570{ 3572{
3571 struct pktgen_dev *p, *pkt_dev = NULL; 3573 struct pktgen_dev *p, *pkt_dev = NULL;
3572 if_lock(t); 3574 size_t len = strlen(ifname);
3573 3575
3576 if_lock(t);
3574 list_for_each_entry(p, &t->if_list, list) 3577 list_for_each_entry(p, &t->if_list, list)
3575 if (strncmp(p->odev->name, ifname, IFNAMSIZ) == 0) { 3578 if (strncmp(p->odevname, ifname, len) == 0) {
3579 if (p->odevname[len]) {
3580 if (exact || p->odevname[len] != '@')
3581 continue;
3582 }
3576 pkt_dev = p; 3583 pkt_dev = p;
3577 break; 3584 break;
3578 } 3585 }
@@ -3628,6 +3635,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
3628 if (!pkt_dev) 3635 if (!pkt_dev)
3629 return -ENOMEM; 3636 return -ENOMEM;
3630 3637
3638 strcpy(pkt_dev->odevname, ifname);
3631 pkt_dev->flows = vmalloc(MAX_CFLOWS * sizeof(struct flow_state)); 3639 pkt_dev->flows = vmalloc(MAX_CFLOWS * sizeof(struct flow_state));
3632 if (pkt_dev->flows == NULL) { 3640 if (pkt_dev->flows == NULL) {
3633 kfree(pkt_dev); 3641 kfree(pkt_dev);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 575f9bd51ccd..d3fe10be7219 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -563,7 +563,7 @@ out_oversize:
563 printk(KERN_INFO "Oversized IP packet from %pI4.\n", 563 printk(KERN_INFO "Oversized IP packet from %pI4.\n",
564 &qp->saddr); 564 &qp->saddr);
565out_fail: 565out_fail:
566 IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_REASMFAILS); 566 IP_INC_STATS_BH(net, IPSTATS_MIB_REASMFAILS);
567 return err; 567 return err;
568} 568}
569 569
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index b09948ceec4a..206fd82f0c76 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -173,12 +173,14 @@ static void sta_addba_resp_timer_expired(unsigned long data)
173 173
174 /* check if the TID waits for addBA response */ 174 /* check if the TID waits for addBA response */
175 spin_lock_bh(&sta->lock); 175 spin_lock_bh(&sta->lock);
176 if (!(*state & HT_ADDBA_REQUESTED_MSK)) { 176 if ((*state & (HT_ADDBA_REQUESTED_MSK | HT_ADDBA_RECEIVED_MSK)) !=
177 HT_ADDBA_REQUESTED_MSK) {
177 spin_unlock_bh(&sta->lock); 178 spin_unlock_bh(&sta->lock);
178 *state = HT_AGG_STATE_IDLE; 179 *state = HT_AGG_STATE_IDLE;
179#ifdef CONFIG_MAC80211_HT_DEBUG 180#ifdef CONFIG_MAC80211_HT_DEBUG
180 printk(KERN_DEBUG "timer expired on tid %d but we are not " 181 printk(KERN_DEBUG "timer expired on tid %d but we are not "
181 "expecting addBA response there", tid); 182 "(or no longer) expecting addBA response there",
183 tid);
182#endif 184#endif
183 return; 185 return;
184 } 186 }
@@ -666,21 +668,21 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
666 668
667 state = &sta->ampdu_mlme.tid_state_tx[tid]; 669 state = &sta->ampdu_mlme.tid_state_tx[tid];
668 670
669 del_timer_sync(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer);
670
671 spin_lock_bh(&sta->lock); 671 spin_lock_bh(&sta->lock);
672 672
673 if (!(*state & HT_ADDBA_REQUESTED_MSK)) 673 if (!(*state & HT_ADDBA_REQUESTED_MSK))
674 goto timer_still_needed; 674 goto out;
675 675
676 if (mgmt->u.action.u.addba_resp.dialog_token != 676 if (mgmt->u.action.u.addba_resp.dialog_token !=
677 sta->ampdu_mlme.tid_tx[tid]->dialog_token) { 677 sta->ampdu_mlme.tid_tx[tid]->dialog_token) {
678#ifdef CONFIG_MAC80211_HT_DEBUG 678#ifdef CONFIG_MAC80211_HT_DEBUG
679 printk(KERN_DEBUG "wrong addBA response token, tid %d\n", tid); 679 printk(KERN_DEBUG "wrong addBA response token, tid %d\n", tid);
680#endif /* CONFIG_MAC80211_HT_DEBUG */ 680#endif /* CONFIG_MAC80211_HT_DEBUG */
681 goto timer_still_needed; 681 goto out;
682 } 682 }
683 683
684 del_timer(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer);
685
684#ifdef CONFIG_MAC80211_HT_DEBUG 686#ifdef CONFIG_MAC80211_HT_DEBUG
685 printk(KERN_DEBUG "switched off addBA timer for tid %d \n", tid); 687 printk(KERN_DEBUG "switched off addBA timer for tid %d \n", tid);
686#endif /* CONFIG_MAC80211_HT_DEBUG */ 688#endif /* CONFIG_MAC80211_HT_DEBUG */
@@ -699,10 +701,6 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
699 ___ieee80211_stop_tx_ba_session(sta, tid, WLAN_BACK_INITIATOR); 701 ___ieee80211_stop_tx_ba_session(sta, tid, WLAN_BACK_INITIATOR);
700 } 702 }
701 703
702 goto out;
703
704 timer_still_needed:
705 add_timer(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer);
706 out: 704 out:
707 spin_unlock_bh(&sta->lock); 705 spin_unlock_bh(&sta->lock);
708} 706}
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 588005c84a6d..a910bf1f092f 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -662,6 +662,14 @@ struct ieee80211_local {
662 bool suspended; 662 bool suspended;
663 663
664 /* 664 /*
665 * Resuming is true while suspended, but when we're reprogramming the
666 * hardware -- at that time it's allowed to use ieee80211_queue_work()
667 * again even though some other parts of the stack are still suspended
668 * and we still drop received frames to avoid waking the stack.
669 */
670 bool resuming;
671
672 /*
665 * quiescing is true during the suspend process _only_ to 673 * quiescing is true during the suspend process _only_ to
666 * ease timer cancelling etc. 674 * ease timer cancelling etc.
667 */ 675 */
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index aeb65b3d2295..e6c08da8da26 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -520,9 +520,9 @@ EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces_atomic);
520 */ 520 */
521static bool ieee80211_can_queue_work(struct ieee80211_local *local) 521static bool ieee80211_can_queue_work(struct ieee80211_local *local)
522{ 522{
523 if (WARN(local->suspended, "queueing ieee80211 work while " 523 if (WARN(local->suspended && !local->resuming,
524 "going to suspend\n")) 524 "queueing ieee80211 work while going to suspend\n"))
525 return false; 525 return false;
526 526
527 return true; 527 return true;
528} 528}
@@ -1025,13 +1025,9 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1025 struct sta_info *sta; 1025 struct sta_info *sta;
1026 unsigned long flags; 1026 unsigned long flags;
1027 int res; 1027 int res;
1028 bool from_suspend = local->suspended;
1029 1028
1030 /* 1029 if (local->suspended)
1031 * We're going to start the hardware, at that point 1030 local->resuming = true;
1032 * we are no longer suspended and can RX frames.
1033 */
1034 local->suspended = false;
1035 1031
1036 /* restart hardware */ 1032 /* restart hardware */
1037 if (local->open_count) { 1033 if (local->open_count) {
@@ -1129,11 +1125,14 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1129 * If this is for hw restart things are still running. 1125 * If this is for hw restart things are still running.
1130 * We may want to change that later, however. 1126 * We may want to change that later, however.
1131 */ 1127 */
1132 if (!from_suspend) 1128 if (!local->suspended)
1133 return 0; 1129 return 0;
1134 1130
1135#ifdef CONFIG_PM 1131#ifdef CONFIG_PM
1132 /* first set suspended false, then resuming */
1136 local->suspended = false; 1133 local->suspended = false;
1134 mb();
1135 local->resuming = false;
1137 1136
1138 list_for_each_entry(sdata, &local->interfaces, list) { 1137 list_for_each_entry(sdata, &local->interfaces, list) {
1139 switch(sdata->vif.type) { 1138 switch(sdata->vif.type) {
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index c93494fef8ef..d65d3481919c 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -128,9 +128,8 @@ EXPORT_SYMBOL(nf_log_packet);
128 128
129#ifdef CONFIG_PROC_FS 129#ifdef CONFIG_PROC_FS
130static void *seq_start(struct seq_file *seq, loff_t *pos) 130static void *seq_start(struct seq_file *seq, loff_t *pos)
131 __acquires(RCU)
132{ 131{
133 rcu_read_lock(); 132 mutex_lock(&nf_log_mutex);
134 133
135 if (*pos >= ARRAY_SIZE(nf_loggers)) 134 if (*pos >= ARRAY_SIZE(nf_loggers))
136 return NULL; 135 return NULL;
@@ -149,9 +148,8 @@ static void *seq_next(struct seq_file *s, void *v, loff_t *pos)
149} 148}
150 149
151static void seq_stop(struct seq_file *s, void *v) 150static void seq_stop(struct seq_file *s, void *v)
152 __releases(RCU)
153{ 151{
154 rcu_read_unlock(); 152 mutex_unlock(&nf_log_mutex);
155} 153}
156 154
157static int seq_show(struct seq_file *s, void *v) 155static int seq_show(struct seq_file *s, void *v)
@@ -161,7 +159,7 @@ static int seq_show(struct seq_file *s, void *v)
161 struct nf_logger *t; 159 struct nf_logger *t;
162 int ret; 160 int ret;
163 161
164 logger = rcu_dereference(nf_loggers[*pos]); 162 logger = nf_loggers[*pos];
165 163
166 if (!logger) 164 if (!logger)
167 ret = seq_printf(s, "%2lld NONE (", *pos); 165 ret = seq_printf(s, "%2lld NONE (", *pos);
@@ -171,22 +169,16 @@ static int seq_show(struct seq_file *s, void *v)
171 if (ret < 0) 169 if (ret < 0)
172 return ret; 170 return ret;
173 171
174 mutex_lock(&nf_log_mutex);
175 list_for_each_entry(t, &nf_loggers_l[*pos], list[*pos]) { 172 list_for_each_entry(t, &nf_loggers_l[*pos], list[*pos]) {
176 ret = seq_printf(s, "%s", t->name); 173 ret = seq_printf(s, "%s", t->name);
177 if (ret < 0) { 174 if (ret < 0)
178 mutex_unlock(&nf_log_mutex);
179 return ret; 175 return ret;
180 }
181 if (&t->list[*pos] != nf_loggers_l[*pos].prev) { 176 if (&t->list[*pos] != nf_loggers_l[*pos].prev) {
182 ret = seq_printf(s, ","); 177 ret = seq_printf(s, ",");
183 if (ret < 0) { 178 if (ret < 0)
184 mutex_unlock(&nf_log_mutex);
185 return ret; 179 return ret;
186 }
187 } 180 }
188 } 181 }
189 mutex_unlock(&nf_log_mutex);
190 182
191 return seq_printf(s, ")\n"); 183 return seq_printf(s, ")\n");
192} 184}
diff --git a/net/netfilter/xt_limit.c b/net/netfilter/xt_limit.c
index 2e8089ecd0af..2773be6a71dd 100644
--- a/net/netfilter/xt_limit.c
+++ b/net/netfilter/xt_limit.c
@@ -112,7 +112,7 @@ static bool limit_mt_check(const struct xt_mtchk_param *par)
112 112
113 priv = kmalloc(sizeof(*priv), GFP_KERNEL); 113 priv = kmalloc(sizeof(*priv), GFP_KERNEL);
114 if (priv == NULL) 114 if (priv == NULL)
115 return -ENOMEM; 115 return false;
116 116
117 /* For SMP, we only want to use one set of state. */ 117 /* For SMP, we only want to use one set of state. */
118 r->master = priv; 118 r->master = priv;
diff --git a/net/netfilter/xt_osf.c b/net/netfilter/xt_osf.c
index 63e190504656..4d1a41bbd5d7 100644
--- a/net/netfilter/xt_osf.c
+++ b/net/netfilter/xt_osf.c
@@ -118,7 +118,7 @@ static int xt_osf_remove_callback(struct sock *ctnl, struct sk_buff *skb,
118{ 118{
119 struct xt_osf_user_finger *f; 119 struct xt_osf_user_finger *f;
120 struct xt_osf_finger *sf; 120 struct xt_osf_finger *sf;
121 int err = ENOENT; 121 int err = -ENOENT;
122 122
123 if (!osf_attrs[OSF_ATTR_FINGER]) 123 if (!osf_attrs[OSF_ATTR_FINGER])
124 return -EINVAL; 124 return -EINVAL;
diff --git a/net/rfkill/core.c b/net/rfkill/core.c
index ba2efb960c60..a001f7c1f711 100644
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
@@ -1189,6 +1189,7 @@ static long rfkill_fop_ioctl(struct file *file, unsigned int cmd,
1189#endif 1189#endif
1190 1190
1191static const struct file_operations rfkill_fops = { 1191static const struct file_operations rfkill_fops = {
1192 .owner = THIS_MODULE,
1192 .open = rfkill_fop_open, 1193 .open = rfkill_fop_open,
1193 .read = rfkill_fop_read, 1194 .read = rfkill_fop_read,
1194 .write = rfkill_fop_write, 1195 .write = rfkill_fop_write,
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index c9f20e28521b..23e5e97aa617 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -423,16 +423,6 @@ void sctp_retransmit_mark(struct sctp_outq *q,
423 if ((reason == SCTP_RTXR_FAST_RTX && 423 if ((reason == SCTP_RTXR_FAST_RTX &&
424 (chunk->fast_retransmit == SCTP_NEED_FRTX)) || 424 (chunk->fast_retransmit == SCTP_NEED_FRTX)) ||
425 (reason != SCTP_RTXR_FAST_RTX && !chunk->tsn_gap_acked)) { 425 (reason != SCTP_RTXR_FAST_RTX && !chunk->tsn_gap_acked)) {
426 /* If this chunk was sent less then 1 rto ago, do not
427 * retransmit this chunk, but give the peer time
428 * to acknowlege it. Do this only when
429 * retransmitting due to T3 timeout.
430 */
431 if (reason == SCTP_RTXR_T3_RTX &&
432 time_before(jiffies, chunk->sent_at +
433 transport->last_rto))
434 continue;
435
436 /* RFC 2960 6.2.1 Processing a Received SACK 426 /* RFC 2960 6.2.1 Processing a Received SACK
437 * 427 *
438 * C) Any time a DATA chunk is marked for 428 * C) Any time a DATA chunk is marked for
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 8674d4919556..efa516b47e81 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -480,7 +480,6 @@ static void sctp_do_8_2_transport_strike(struct sctp_association *asoc,
480 * that indicates that we have an outstanding HB. 480 * that indicates that we have an outstanding HB.
481 */ 481 */
482 if (!is_hb || transport->hb_sent) { 482 if (!is_hb || transport->hb_sent) {
483 transport->last_rto = transport->rto;
484 transport->rto = min((transport->rto * 2), transport->asoc->rto_max); 483 transport->rto = min((transport->rto * 2), transport->asoc->rto_max);
485 } 484 }
486} 485}
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index 3b141bb32faf..37a1184d789f 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -74,7 +74,7 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
74 * given destination transport address, set RTO to the protocol 74 * given destination transport address, set RTO to the protocol
75 * parameter 'RTO.Initial'. 75 * parameter 'RTO.Initial'.
76 */ 76 */
77 peer->last_rto = peer->rto = msecs_to_jiffies(sctp_rto_initial); 77 peer->rto = msecs_to_jiffies(sctp_rto_initial);
78 peer->rtt = 0; 78 peer->rtt = 0;
79 peer->rttvar = 0; 79 peer->rttvar = 0;
80 peer->srtt = 0; 80 peer->srtt = 0;
@@ -386,7 +386,6 @@ void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt)
386 tp->rto = tp->asoc->rto_max; 386 tp->rto = tp->asoc->rto_max;
387 387
388 tp->rtt = rtt; 388 tp->rtt = rtt;
389 tp->last_rto = tp->rto;
390 389
391 /* Reset rto_pending so that a new RTT measurement is started when a 390 /* Reset rto_pending so that a new RTT measurement is started when a
392 * new data chunk is sent. 391 * new data chunk is sent.
@@ -602,7 +601,7 @@ void sctp_transport_reset(struct sctp_transport *t)
602 */ 601 */
603 t->cwnd = min(4*asoc->pathmtu, max_t(__u32, 2*asoc->pathmtu, 4380)); 602 t->cwnd = min(4*asoc->pathmtu, max_t(__u32, 2*asoc->pathmtu, 4380));
604 t->ssthresh = asoc->peer.i.a_rwnd; 603 t->ssthresh = asoc->peer.i.a_rwnd;
605 t->last_rto = t->rto = asoc->rto_initial; 604 t->rto = asoc->rto_initial;
606 t->rtt = 0; 605 t->rtt = 0;
607 t->srtt = 0; 606 t->srtt = 0;
608 t->rttvar = 0; 607 t->rttvar = 0;