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/bonding/bond_sysfs.c7
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c50
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c15
-rw-r--r--drivers/net/ethernet/cadence/Kconfig1
-rw-r--r--drivers/net/ethernet/lantiq_etop.c2
-rw-r--r--drivers/net/ethernet/marvell/sky2.c106
-rw-r--r--drivers/net/ethernet/marvell/sky2.h1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_rx.c6
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4_en.h1
-rw-r--r--drivers/net/ethernet/nvidia/forcedeth.c36
-rw-r--r--drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c2
-rw-r--r--drivers/net/ethernet/rdc/r6040.c2
-rw-r--r--drivers/net/ethernet/realtek/r8169.c2
-rw-r--r--drivers/net/ethernet/smsc/smsc911x.c12
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c3
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c3
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac.h2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c6
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c117
-rw-r--r--drivers/net/ethernet/sun/sunhme.c2
-rw-r--r--drivers/net/ethernet/xilinx/ll_temac_main.c7
-rw-r--r--drivers/net/hippi/Kconfig2
-rw-r--r--drivers/net/usb/asix.c68
-rw-r--r--drivers/net/usb/cdc_ether.c2
-rw-r--r--drivers/net/usb/lg-vl600.c25
-rw-r--r--drivers/net/usb/smsc75xx.c7
-rw-r--r--drivers/net/wireless/ath/regd.c2
-rw-r--r--drivers/net/wireless/b43/xmit.c15
-rw-r--r--drivers/net/wireless/b43/xmit.h16
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/dma.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie.c33
-rw-r--r--drivers/net/wireless/libertas/cfg.c2
-rw-r--r--drivers/net/wireless/libertas/if_spi.c1
-rw-r--r--drivers/net/wireless/mwifiex/scan.c9
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c22
-rw-r--r--drivers/net/wireless/wl12xx/scan.c2
39 files changed, 408 insertions, 190 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 583f66cd5bbd..654a5e94e0e7 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -245,6 +245,8 @@ source "drivers/net/ethernet/Kconfig"
245 245
246source "drivers/net/fddi/Kconfig" 246source "drivers/net/fddi/Kconfig"
247 247
248source "drivers/net/hippi/Kconfig"
249
248config NET_SB1000 250config NET_SB1000
249 tristate "General Instruments Surfboard 1000" 251 tristate "General Instruments Surfboard 1000"
250 depends on PNP 252 depends on PNP
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 5a20804fdece..4ef7e2fd9fe6 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -319,6 +319,13 @@ static ssize_t bonding_store_mode(struct device *d,
319 goto out; 319 goto out;
320 } 320 }
321 321
322 if (bond->slave_cnt > 0) {
323 pr_err("unable to update mode of %s because it has slaves.\n",
324 bond->dev->name);
325 ret = -EPERM;
326 goto out;
327 }
328
322 new_value = bond_parse_parm(buf, bond_mode_tbl); 329 new_value = bond_parse_parm(buf, bond_mode_tbl);
323 if (new_value < 0) { 330 if (new_value < 0) {
324 pr_err("%s: Ignoring invalid mode value %.*s.\n", 331 pr_err("%s: Ignoring invalid mode value %.*s.\n",
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 6486ab8c8fc8..2f6361e949f0 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -10548,33 +10548,38 @@ do { \
10548 10548
10549int bnx2x_init_firmware(struct bnx2x *bp) 10549int bnx2x_init_firmware(struct bnx2x *bp)
10550{ 10550{
10551 const char *fw_file_name;
10552 struct bnx2x_fw_file_hdr *fw_hdr; 10551 struct bnx2x_fw_file_hdr *fw_hdr;
10553 int rc; 10552 int rc;
10554 10553
10555 if (CHIP_IS_E1(bp))
10556 fw_file_name = FW_FILE_NAME_E1;
10557 else if (CHIP_IS_E1H(bp))
10558 fw_file_name = FW_FILE_NAME_E1H;
10559 else if (!CHIP_IS_E1x(bp))
10560 fw_file_name = FW_FILE_NAME_E2;
10561 else {
10562 BNX2X_ERR("Unsupported chip revision\n");
10563 return -EINVAL;
10564 }
10565 10554
10566 BNX2X_DEV_INFO("Loading %s\n", fw_file_name); 10555 if (!bp->firmware) {
10556 const char *fw_file_name;
10567 10557
10568 rc = request_firmware(&bp->firmware, fw_file_name, &bp->pdev->dev); 10558 if (CHIP_IS_E1(bp))
10569 if (rc) { 10559 fw_file_name = FW_FILE_NAME_E1;
10570 BNX2X_ERR("Can't load firmware file %s\n", fw_file_name); 10560 else if (CHIP_IS_E1H(bp))
10571 goto request_firmware_exit; 10561 fw_file_name = FW_FILE_NAME_E1H;
10572 } 10562 else if (!CHIP_IS_E1x(bp))
10563 fw_file_name = FW_FILE_NAME_E2;
10564 else {
10565 BNX2X_ERR("Unsupported chip revision\n");
10566 return -EINVAL;
10567 }
10568 BNX2X_DEV_INFO("Loading %s\n", fw_file_name);
10573 10569
10574 rc = bnx2x_check_firmware(bp); 10570 rc = request_firmware(&bp->firmware, fw_file_name,
10575 if (rc) { 10571 &bp->pdev->dev);
10576 BNX2X_ERR("Corrupt firmware file %s\n", fw_file_name); 10572 if (rc) {
10577 goto request_firmware_exit; 10573 BNX2X_ERR("Can't load firmware file %s\n",
10574 fw_file_name);
10575 goto request_firmware_exit;
10576 }
10577
10578 rc = bnx2x_check_firmware(bp);
10579 if (rc) {
10580 BNX2X_ERR("Corrupt firmware file %s\n", fw_file_name);
10581 goto request_firmware_exit;
10582 }
10578 } 10583 }
10579 10584
10580 fw_hdr = (struct bnx2x_fw_file_hdr *)bp->firmware->data; 10585 fw_hdr = (struct bnx2x_fw_file_hdr *)bp->firmware->data;
@@ -10630,6 +10635,7 @@ static void bnx2x_release_firmware(struct bnx2x *bp)
10630 kfree(bp->init_ops); 10635 kfree(bp->init_ops);
10631 kfree(bp->init_data); 10636 kfree(bp->init_data);
10632 release_firmware(bp->firmware); 10637 release_firmware(bp->firmware);
10638 bp->firmware = NULL;
10633} 10639}
10634 10640
10635 10641
@@ -10925,6 +10931,8 @@ static void __devexit bnx2x_remove_one(struct pci_dev *pdev)
10925 if (bp->doorbells) 10931 if (bp->doorbells)
10926 iounmap(bp->doorbells); 10932 iounmap(bp->doorbells);
10927 10933
10934 bnx2x_release_firmware(bp);
10935
10928 bnx2x_free_mem_bp(bp); 10936 bnx2x_free_mem_bp(bp);
10929 10937
10930 free_netdev(dev); 10938 free_netdev(dev);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
index 0440425c83d6..14517691f8db 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
@@ -5380,7 +5380,7 @@ static int bnx2x_func_hw_init(struct bnx2x *bp,
5380 rc = drv->init_fw(bp); 5380 rc = drv->init_fw(bp);
5381 if (rc) { 5381 if (rc) {
5382 BNX2X_ERR("Error loading firmware\n"); 5382 BNX2X_ERR("Error loading firmware\n");
5383 goto fw_init_err; 5383 goto init_err;
5384 } 5384 }
5385 5385
5386 /* Handle the beginning of COMMON_XXX pases separatelly... */ 5386 /* Handle the beginning of COMMON_XXX pases separatelly... */
@@ -5388,25 +5388,25 @@ static int bnx2x_func_hw_init(struct bnx2x *bp,
5388 case FW_MSG_CODE_DRV_LOAD_COMMON_CHIP: 5388 case FW_MSG_CODE_DRV_LOAD_COMMON_CHIP:
5389 rc = bnx2x_func_init_cmn_chip(bp, drv); 5389 rc = bnx2x_func_init_cmn_chip(bp, drv);
5390 if (rc) 5390 if (rc)
5391 goto init_hw_err; 5391 goto init_err;
5392 5392
5393 break; 5393 break;
5394 case FW_MSG_CODE_DRV_LOAD_COMMON: 5394 case FW_MSG_CODE_DRV_LOAD_COMMON:
5395 rc = bnx2x_func_init_cmn(bp, drv); 5395 rc = bnx2x_func_init_cmn(bp, drv);
5396 if (rc) 5396 if (rc)
5397 goto init_hw_err; 5397 goto init_err;
5398 5398
5399 break; 5399 break;
5400 case FW_MSG_CODE_DRV_LOAD_PORT: 5400 case FW_MSG_CODE_DRV_LOAD_PORT:
5401 rc = bnx2x_func_init_port(bp, drv); 5401 rc = bnx2x_func_init_port(bp, drv);
5402 if (rc) 5402 if (rc)
5403 goto init_hw_err; 5403 goto init_err;
5404 5404
5405 break; 5405 break;
5406 case FW_MSG_CODE_DRV_LOAD_FUNCTION: 5406 case FW_MSG_CODE_DRV_LOAD_FUNCTION:
5407 rc = bnx2x_func_init_func(bp, drv); 5407 rc = bnx2x_func_init_func(bp, drv);
5408 if (rc) 5408 if (rc)
5409 goto init_hw_err; 5409 goto init_err;
5410 5410
5411 break; 5411 break;
5412 default: 5412 default:
@@ -5414,10 +5414,7 @@ static int bnx2x_func_hw_init(struct bnx2x *bp,
5414 rc = -EINVAL; 5414 rc = -EINVAL;
5415 } 5415 }
5416 5416
5417init_hw_err: 5417init_err:
5418 drv->release_fw(bp);
5419
5420fw_init_err:
5421 drv->gunzip_end(bp); 5418 drv->gunzip_end(bp);
5422 5419
5423 /* In case of success, complete the comand immediatelly: no ramrods 5420 /* In case of success, complete the comand immediatelly: no ramrods
diff --git a/drivers/net/ethernet/cadence/Kconfig b/drivers/net/ethernet/cadence/Kconfig
index 98849a1fc749..b48378a41e49 100644
--- a/drivers/net/ethernet/cadence/Kconfig
+++ b/drivers/net/ethernet/cadence/Kconfig
@@ -7,6 +7,7 @@ config HAVE_NET_MACB
7 7
8config NET_ATMEL 8config NET_ATMEL
9 bool "Atmel devices" 9 bool "Atmel devices"
10 default y
10 depends on HAVE_NET_MACB || (ARM && ARCH_AT91RM9200) 11 depends on HAVE_NET_MACB || (ARM && ARCH_AT91RM9200)
11 ---help--- 12 ---help---
12 If you have a network (Ethernet) card belonging to this class, say Y. 13 If you have a network (Ethernet) card belonging to this class, say Y.
diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index 6bb2b9506cad..0b3567ab8121 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -34,6 +34,8 @@
34#include <linux/init.h> 34#include <linux/init.h>
35#include <linux/delay.h> 35#include <linux/delay.h>
36#include <linux/io.h> 36#include <linux/io.h>
37#include <linux/dma-mapping.h>
38#include <linux/module.h>
37 39
38#include <asm/checksum.h> 40#include <asm/checksum.h>
39 41
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index fdc6c394c683..7803efa46eb2 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -50,7 +50,7 @@
50#include "sky2.h" 50#include "sky2.h"
51 51
52#define DRV_NAME "sky2" 52#define DRV_NAME "sky2"
53#define DRV_VERSION "1.29" 53#define DRV_VERSION "1.30"
54 54
55/* 55/*
56 * The Yukon II chipset takes 64 bit command blocks (called list elements) 56 * The Yukon II chipset takes 64 bit command blocks (called list elements)
@@ -68,7 +68,7 @@
68#define MAX_SKB_TX_LE (2 + (sizeof(dma_addr_t)/sizeof(u32))*(MAX_SKB_FRAGS+1)) 68#define MAX_SKB_TX_LE (2 + (sizeof(dma_addr_t)/sizeof(u32))*(MAX_SKB_FRAGS+1))
69#define TX_MIN_PENDING (MAX_SKB_TX_LE+1) 69#define TX_MIN_PENDING (MAX_SKB_TX_LE+1)
70#define TX_MAX_PENDING 1024 70#define TX_MAX_PENDING 1024
71#define TX_DEF_PENDING 127 71#define TX_DEF_PENDING 63
72 72
73#define TX_WATCHDOG (5 * HZ) 73#define TX_WATCHDOG (5 * HZ)
74#define NAPI_WEIGHT 64 74#define NAPI_WEIGHT 64
@@ -869,6 +869,7 @@ static void sky2_wol_init(struct sky2_port *sky2)
869 869
870 /* block receiver */ 870 /* block receiver */
871 sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); 871 sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET);
872 sky2_read32(hw, B0_CTST);
872} 873}
873 874
874static void sky2_set_tx_stfwd(struct sky2_hw *hw, unsigned port) 875static void sky2_set_tx_stfwd(struct sky2_hw *hw, unsigned port)
@@ -1274,6 +1275,14 @@ static void rx_set_checksum(struct sky2_port *sky2)
1274 ? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM); 1275 ? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM);
1275} 1276}
1276 1277
1278/*
1279 * Fixed initial key as seed to RSS.
1280 */
1281static const uint32_t rss_init_key[10] = {
1282 0x7c3351da, 0x51c5cf4e, 0x44adbdd1, 0xe8d38d18, 0x48897c43,
1283 0xb1d60e7e, 0x6a3dd760, 0x01a2e453, 0x16f46f13, 0x1a0e7b30
1284};
1285
1277/* Enable/disable receive hash calculation (RSS) */ 1286/* Enable/disable receive hash calculation (RSS) */
1278static void rx_set_rss(struct net_device *dev, u32 features) 1287static void rx_set_rss(struct net_device *dev, u32 features)
1279{ 1288{
@@ -1289,12 +1298,9 @@ static void rx_set_rss(struct net_device *dev, u32 features)
1289 1298
1290 /* Program RSS initial values */ 1299 /* Program RSS initial values */
1291 if (features & NETIF_F_RXHASH) { 1300 if (features & NETIF_F_RXHASH) {
1292 u32 key[nkeys];
1293
1294 get_random_bytes(key, nkeys * sizeof(u32));
1295 for (i = 0; i < nkeys; i++) 1301 for (i = 0; i < nkeys; i++)
1296 sky2_write32(hw, SK_REG(sky2->port, RSS_KEY + i * 4), 1302 sky2_write32(hw, SK_REG(sky2->port, RSS_KEY + i * 4),
1297 key[i]); 1303 rss_init_key[i]);
1298 1304
1299 /* Need to turn on (undocumented) flag to make hashing work */ 1305 /* Need to turn on (undocumented) flag to make hashing work */
1300 sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), 1306 sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T),
@@ -1717,6 +1723,8 @@ static int sky2_setup_irq(struct sky2_hw *hw, const char *name)
1717 if (err) 1723 if (err)
1718 dev_err(&pdev->dev, "cannot assign irq %d\n", pdev->irq); 1724 dev_err(&pdev->dev, "cannot assign irq %d\n", pdev->irq);
1719 else { 1725 else {
1726 hw->flags |= SKY2_HW_IRQ_SETUP;
1727
1720 napi_enable(&hw->napi); 1728 napi_enable(&hw->napi);
1721 sky2_write32(hw, B0_IMSK, Y2_IS_BASE); 1729 sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
1722 sky2_read32(hw, B0_IMSK); 1730 sky2_read32(hw, B0_IMSK);
@@ -1727,7 +1735,7 @@ static int sky2_setup_irq(struct sky2_hw *hw, const char *name)
1727 1735
1728 1736
1729/* Bring up network interface. */ 1737/* Bring up network interface. */
1730static int sky2_up(struct net_device *dev) 1738static int sky2_open(struct net_device *dev)
1731{ 1739{
1732 struct sky2_port *sky2 = netdev_priv(dev); 1740 struct sky2_port *sky2 = netdev_priv(dev);
1733 struct sky2_hw *hw = sky2->hw; 1741 struct sky2_hw *hw = sky2->hw;
@@ -1747,6 +1755,11 @@ static int sky2_up(struct net_device *dev)
1747 1755
1748 sky2_hw_up(sky2); 1756 sky2_hw_up(sky2);
1749 1757
1758 if (hw->chip_id == CHIP_ID_YUKON_OPT ||
1759 hw->chip_id == CHIP_ID_YUKON_PRM ||
1760 hw->chip_id == CHIP_ID_YUKON_OP_2)
1761 imask |= Y2_IS_PHY_QLNK; /* enable PHY Quick Link */
1762
1750 /* Enable interrupts from phy/mac for port */ 1763 /* Enable interrupts from phy/mac for port */
1751 imask = sky2_read32(hw, B0_IMSK); 1764 imask = sky2_read32(hw, B0_IMSK);
1752 imask |= portirq_msk[port]; 1765 imask |= portirq_msk[port];
@@ -2040,6 +2053,8 @@ static void sky2_tx_reset(struct sky2_hw *hw, unsigned port)
2040 2053
2041 sky2_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), RB_RST_SET); 2054 sky2_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), RB_RST_SET);
2042 sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET); 2055 sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET);
2056
2057 sky2_read32(hw, B0_CTST);
2043} 2058}
2044 2059
2045static void sky2_hw_down(struct sky2_port *sky2) 2060static void sky2_hw_down(struct sky2_port *sky2)
@@ -2090,7 +2105,7 @@ static void sky2_hw_down(struct sky2_port *sky2)
2090} 2105}
2091 2106
2092/* Network shutdown */ 2107/* Network shutdown */
2093static int sky2_down(struct net_device *dev) 2108static int sky2_close(struct net_device *dev)
2094{ 2109{
2095 struct sky2_port *sky2 = netdev_priv(dev); 2110 struct sky2_port *sky2 = netdev_priv(dev);
2096 struct sky2_hw *hw = sky2->hw; 2111 struct sky2_hw *hw = sky2->hw;
@@ -2101,15 +2116,22 @@ static int sky2_down(struct net_device *dev)
2101 2116
2102 netif_info(sky2, ifdown, dev, "disabling interface\n"); 2117 netif_info(sky2, ifdown, dev, "disabling interface\n");
2103 2118
2104 /* Disable port IRQ */
2105 sky2_write32(hw, B0_IMSK,
2106 sky2_read32(hw, B0_IMSK) & ~portirq_msk[sky2->port]);
2107 sky2_read32(hw, B0_IMSK);
2108
2109 if (hw->ports == 1) { 2119 if (hw->ports == 1) {
2120 sky2_write32(hw, B0_IMSK, 0);
2121 sky2_read32(hw, B0_IMSK);
2122
2110 napi_disable(&hw->napi); 2123 napi_disable(&hw->napi);
2111 free_irq(hw->pdev->irq, hw); 2124 free_irq(hw->pdev->irq, hw);
2125 hw->flags &= ~SKY2_HW_IRQ_SETUP;
2112 } else { 2126 } else {
2127 u32 imask;
2128
2129 /* Disable port IRQ */
2130 imask = sky2_read32(hw, B0_IMSK);
2131 imask &= ~portirq_msk[sky2->port];
2132 sky2_write32(hw, B0_IMSK, imask);
2133 sky2_read32(hw, B0_IMSK);
2134
2113 synchronize_irq(hw->pdev->irq); 2135 synchronize_irq(hw->pdev->irq);
2114 napi_synchronize(&hw->napi); 2136 napi_synchronize(&hw->napi);
2115 } 2137 }
@@ -2587,7 +2609,7 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last)
2587 if (netif_running(dev)) { 2609 if (netif_running(dev)) {
2588 sky2_tx_complete(sky2, last); 2610 sky2_tx_complete(sky2, last);
2589 2611
2590 /* Wake unless it's detached, and called e.g. from sky2_down() */ 2612 /* Wake unless it's detached, and called e.g. from sky2_close() */
2591 if (tx_avail(sky2) > MAX_SKB_TX_LE + 4) 2613 if (tx_avail(sky2) > MAX_SKB_TX_LE + 4)
2592 netif_wake_queue(dev); 2614 netif_wake_queue(dev);
2593 } 2615 }
@@ -3258,7 +3280,6 @@ static void sky2_reset(struct sky2_hw *hw)
3258 hw->chip_id == CHIP_ID_YUKON_PRM || 3280 hw->chip_id == CHIP_ID_YUKON_PRM ||
3259 hw->chip_id == CHIP_ID_YUKON_OP_2) { 3281 hw->chip_id == CHIP_ID_YUKON_OP_2) {
3260 u16 reg; 3282 u16 reg;
3261 u32 msk;
3262 3283
3263 if (hw->chip_id == CHIP_ID_YUKON_OPT && hw->chip_rev == 0) { 3284 if (hw->chip_id == CHIP_ID_YUKON_OPT && hw->chip_rev == 0) {
3264 /* disable PCI-E PHY power down (set PHY reg 0x80, bit 7 */ 3285 /* disable PCI-E PHY power down (set PHY reg 0x80, bit 7 */
@@ -3281,11 +3302,6 @@ static void sky2_reset(struct sky2_hw *hw)
3281 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); 3302 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
3282 sky2_pci_write16(hw, PSM_CONFIG_REG4, reg); 3303 sky2_pci_write16(hw, PSM_CONFIG_REG4, reg);
3283 3304
3284 /* enable PHY Quick Link */
3285 msk = sky2_read32(hw, B0_IMSK);
3286 msk |= Y2_IS_PHY_QLNK;
3287 sky2_write32(hw, B0_IMSK, msk);
3288
3289 /* check if PSMv2 was running before */ 3305 /* check if PSMv2 was running before */
3290 reg = sky2_pci_read16(hw, PSM_CONFIG_REG3); 3306 reg = sky2_pci_read16(hw, PSM_CONFIG_REG3);
3291 if (reg & PCI_EXP_LNKCTL_ASPMC) 3307 if (reg & PCI_EXP_LNKCTL_ASPMC)
@@ -3383,7 +3399,7 @@ static void sky2_detach(struct net_device *dev)
3383 netif_tx_lock(dev); 3399 netif_tx_lock(dev);
3384 netif_device_detach(dev); /* stop txq */ 3400 netif_device_detach(dev); /* stop txq */
3385 netif_tx_unlock(dev); 3401 netif_tx_unlock(dev);
3386 sky2_down(dev); 3402 sky2_close(dev);
3387 } 3403 }
3388} 3404}
3389 3405
@@ -3393,7 +3409,7 @@ static int sky2_reattach(struct net_device *dev)
3393 int err = 0; 3409 int err = 0;
3394 3410
3395 if (netif_running(dev)) { 3411 if (netif_running(dev)) {
3396 err = sky2_up(dev); 3412 err = sky2_open(dev);
3397 if (err) { 3413 if (err) {
3398 netdev_info(dev, "could not restart %d\n", err); 3414 netdev_info(dev, "could not restart %d\n", err);
3399 dev_close(dev); 3415 dev_close(dev);
@@ -3410,10 +3426,13 @@ static void sky2_all_down(struct sky2_hw *hw)
3410{ 3426{
3411 int i; 3427 int i;
3412 3428
3413 sky2_read32(hw, B0_IMSK); 3429 if (hw->flags & SKY2_HW_IRQ_SETUP) {
3414 sky2_write32(hw, B0_IMSK, 0); 3430 sky2_read32(hw, B0_IMSK);
3415 synchronize_irq(hw->pdev->irq); 3431 sky2_write32(hw, B0_IMSK, 0);
3416 napi_disable(&hw->napi); 3432
3433 synchronize_irq(hw->pdev->irq);
3434 napi_disable(&hw->napi);
3435 }
3417 3436
3418 for (i = 0; i < hw->ports; i++) { 3437 for (i = 0; i < hw->ports; i++) {
3419 struct net_device *dev = hw->dev[i]; 3438 struct net_device *dev = hw->dev[i];
@@ -3446,11 +3465,12 @@ static void sky2_all_up(struct sky2_hw *hw)
3446 netif_wake_queue(dev); 3465 netif_wake_queue(dev);
3447 } 3466 }
3448 3467
3449 sky2_write32(hw, B0_IMSK, imask); 3468 if (hw->flags & SKY2_HW_IRQ_SETUP) {
3450 sky2_read32(hw, B0_IMSK); 3469 sky2_write32(hw, B0_IMSK, imask);
3451 3470 sky2_read32(hw, B0_IMSK);
3452 sky2_read32(hw, B0_Y2_SP_LISR); 3471 sky2_read32(hw, B0_Y2_SP_LISR);
3453 napi_enable(&hw->napi); 3472 napi_enable(&hw->napi);
3473 }
3454} 3474}
3455 3475
3456static void sky2_restart(struct work_struct *work) 3476static void sky2_restart(struct work_struct *work)
@@ -4071,6 +4091,16 @@ static int sky2_set_coalesce(struct net_device *dev,
4071 return 0; 4091 return 0;
4072} 4092}
4073 4093
4094/*
4095 * Hardware is limited to min of 128 and max of 2048 for ring size
4096 * and rounded up to next power of two
4097 * to avoid division in modulus calclation
4098 */
4099static unsigned long roundup_ring_size(unsigned long pending)
4100{
4101 return max(128ul, roundup_pow_of_two(pending+1));
4102}
4103
4074static void sky2_get_ringparam(struct net_device *dev, 4104static void sky2_get_ringparam(struct net_device *dev,
4075 struct ethtool_ringparam *ering) 4105 struct ethtool_ringparam *ering)
4076{ 4106{
@@ -4098,7 +4128,7 @@ static int sky2_set_ringparam(struct net_device *dev,
4098 4128
4099 sky2->rx_pending = ering->rx_pending; 4129 sky2->rx_pending = ering->rx_pending;
4100 sky2->tx_pending = ering->tx_pending; 4130 sky2->tx_pending = ering->tx_pending;
4101 sky2->tx_ring_size = roundup_pow_of_two(sky2->tx_pending+1); 4131 sky2->tx_ring_size = roundup_ring_size(sky2->tx_pending);
4102 4132
4103 return sky2_reattach(dev); 4133 return sky2_reattach(dev);
4104} 4134}
@@ -4556,7 +4586,7 @@ static int sky2_device_event(struct notifier_block *unused,
4556 struct net_device *dev = ptr; 4586 struct net_device *dev = ptr;
4557 struct sky2_port *sky2 = netdev_priv(dev); 4587 struct sky2_port *sky2 = netdev_priv(dev);
4558 4588
4559 if (dev->netdev_ops->ndo_open != sky2_up || !sky2_debug) 4589 if (dev->netdev_ops->ndo_open != sky2_open || !sky2_debug)
4560 return NOTIFY_DONE; 4590 return NOTIFY_DONE;
4561 4591
4562 switch (event) { 4592 switch (event) {
@@ -4621,8 +4651,8 @@ static __exit void sky2_debug_cleanup(void)
4621 not allowing netpoll on second port */ 4651 not allowing netpoll on second port */
4622static const struct net_device_ops sky2_netdev_ops[2] = { 4652static const struct net_device_ops sky2_netdev_ops[2] = {
4623 { 4653 {
4624 .ndo_open = sky2_up, 4654 .ndo_open = sky2_open,
4625 .ndo_stop = sky2_down, 4655 .ndo_stop = sky2_close,
4626 .ndo_start_xmit = sky2_xmit_frame, 4656 .ndo_start_xmit = sky2_xmit_frame,
4627 .ndo_do_ioctl = sky2_ioctl, 4657 .ndo_do_ioctl = sky2_ioctl,
4628 .ndo_validate_addr = eth_validate_addr, 4658 .ndo_validate_addr = eth_validate_addr,
@@ -4638,8 +4668,8 @@ static const struct net_device_ops sky2_netdev_ops[2] = {
4638#endif 4668#endif
4639 }, 4669 },
4640 { 4670 {
4641 .ndo_open = sky2_up, 4671 .ndo_open = sky2_open,
4642 .ndo_stop = sky2_down, 4672 .ndo_stop = sky2_close,
4643 .ndo_start_xmit = sky2_xmit_frame, 4673 .ndo_start_xmit = sky2_xmit_frame,
4644 .ndo_do_ioctl = sky2_ioctl, 4674 .ndo_do_ioctl = sky2_ioctl,
4645 .ndo_validate_addr = eth_validate_addr, 4675 .ndo_validate_addr = eth_validate_addr,
@@ -4692,7 +4722,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
4692 spin_lock_init(&sky2->phy_lock); 4722 spin_lock_init(&sky2->phy_lock);
4693 4723
4694 sky2->tx_pending = TX_DEF_PENDING; 4724 sky2->tx_pending = TX_DEF_PENDING;
4695 sky2->tx_ring_size = roundup_pow_of_two(TX_DEF_PENDING+1); 4725 sky2->tx_ring_size = roundup_ring_size(TX_DEF_PENDING);
4696 sky2->rx_pending = RX_DEF_PENDING; 4726 sky2->rx_pending = RX_DEF_PENDING;
4697 4727
4698 hw->dev[port] = dev; 4728 hw->dev[port] = dev;
diff --git a/drivers/net/ethernet/marvell/sky2.h b/drivers/net/ethernet/marvell/sky2.h
index 0af31b8b5f10..ff6f58bf822a 100644
--- a/drivers/net/ethernet/marvell/sky2.h
+++ b/drivers/net/ethernet/marvell/sky2.h
@@ -2287,6 +2287,7 @@ struct sky2_hw {
2287#define SKY2_HW_RSS_BROKEN 0x00000100 2287#define SKY2_HW_RSS_BROKEN 0x00000100
2288#define SKY2_HW_VLAN_BROKEN 0x00000200 2288#define SKY2_HW_VLAN_BROKEN 0x00000200
2289#define SKY2_HW_RSS_CHKSUM 0x00000400 /* RSS requires chksum */ 2289#define SKY2_HW_RSS_CHKSUM 0x00000400 /* RSS requires chksum */
2290#define SKY2_HW_IRQ_SETUP 0x00000800
2290 2291
2291 u8 chip_id; 2292 u8 chip_id;
2292 u8 chip_rev; 2293 u8 chip_rev;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index b89c36dbf5b3..c2df6c358603 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -581,6 +581,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
581 * Packet is OK - process it. 581 * Packet is OK - process it.
582 */ 582 */
583 length = be32_to_cpu(cqe->byte_cnt); 583 length = be32_to_cpu(cqe->byte_cnt);
584 length -= ring->fcs_del;
584 ring->bytes += length; 585 ring->bytes += length;
585 ring->packets++; 586 ring->packets++;
586 587
@@ -813,8 +814,11 @@ static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, int qpn,
813 context->db_rec_addr = cpu_to_be64(ring->wqres.db.dma); 814 context->db_rec_addr = cpu_to_be64(ring->wqres.db.dma);
814 815
815 /* Cancel FCS removal if FW allows */ 816 /* Cancel FCS removal if FW allows */
816 if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_FCS_KEEP) 817 if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_FCS_KEEP) {
817 context->param3 |= cpu_to_be32(1 << 29); 818 context->param3 |= cpu_to_be32(1 << 29);
819 ring->fcs_del = ETH_FCS_LEN;
820 } else
821 ring->fcs_del = 0;
818 822
819 err = mlx4_qp_to_ready(mdev->dev, &ring->wqres.mtt, context, qp, state); 823 err = mlx4_qp_to_ready(mdev->dev, &ring->wqres.mtt, context, qp, state);
820 if (err) { 824 if (err) {
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index 8fda331c65df..207b5add3ca8 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -272,6 +272,7 @@ struct mlx4_en_rx_ring {
272 u32 prod; 272 u32 prod;
273 u32 cons; 273 u32 cons;
274 u32 buf_size; 274 u32 buf_size;
275 u8 fcs_del;
275 void *buf; 276 void *buf;
276 void *rx_info; 277 void *rx_info;
277 unsigned long bytes; 278 unsigned long bytes;
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
index 1dca57013cb2..1c61d36e6570 100644
--- a/drivers/net/ethernet/nvidia/forcedeth.c
+++ b/drivers/net/ethernet/nvidia/forcedeth.c
@@ -609,7 +609,7 @@ struct nv_ethtool_str {
609}; 609};
610 610
611static const struct nv_ethtool_str nv_estats_str[] = { 611static const struct nv_ethtool_str nv_estats_str[] = {
612 { "tx_bytes" }, 612 { "tx_bytes" }, /* includes Ethernet FCS CRC */
613 { "tx_zero_rexmt" }, 613 { "tx_zero_rexmt" },
614 { "tx_one_rexmt" }, 614 { "tx_one_rexmt" },
615 { "tx_many_rexmt" }, 615 { "tx_many_rexmt" },
@@ -637,7 +637,7 @@ static const struct nv_ethtool_str nv_estats_str[] = {
637 /* version 2 stats */ 637 /* version 2 stats */
638 { "tx_deferral" }, 638 { "tx_deferral" },
639 { "tx_packets" }, 639 { "tx_packets" },
640 { "rx_bytes" }, 640 { "rx_bytes" }, /* includes Ethernet FCS CRC */
641 { "tx_pause" }, 641 { "tx_pause" },
642 { "rx_pause" }, 642 { "rx_pause" },
643 { "rx_drop_frame" }, 643 { "rx_drop_frame" },
@@ -649,7 +649,7 @@ static const struct nv_ethtool_str nv_estats_str[] = {
649}; 649};
650 650
651struct nv_ethtool_stats { 651struct nv_ethtool_stats {
652 u64 tx_bytes; 652 u64 tx_bytes; /* should be ifconfig->tx_bytes + 4*tx_packets */
653 u64 tx_zero_rexmt; 653 u64 tx_zero_rexmt;
654 u64 tx_one_rexmt; 654 u64 tx_one_rexmt;
655 u64 tx_many_rexmt; 655 u64 tx_many_rexmt;
@@ -670,14 +670,14 @@ struct nv_ethtool_stats {
670 u64 rx_unicast; 670 u64 rx_unicast;
671 u64 rx_multicast; 671 u64 rx_multicast;
672 u64 rx_broadcast; 672 u64 rx_broadcast;
673 u64 rx_packets; 673 u64 rx_packets; /* should be ifconfig->rx_packets */
674 u64 rx_errors_total; 674 u64 rx_errors_total;
675 u64 tx_errors_total; 675 u64 tx_errors_total;
676 676
677 /* version 2 stats */ 677 /* version 2 stats */
678 u64 tx_deferral; 678 u64 tx_deferral;
679 u64 tx_packets; 679 u64 tx_packets; /* should be ifconfig->tx_packets */
680 u64 rx_bytes; 680 u64 rx_bytes; /* should be ifconfig->rx_bytes + 4*rx_packets */
681 u64 tx_pause; 681 u64 tx_pause;
682 u64 rx_pause; 682 u64 rx_pause;
683 u64 rx_drop_frame; 683 u64 rx_drop_frame;
@@ -1706,10 +1706,17 @@ static struct net_device_stats *nv_get_stats(struct net_device *dev)
1706 if (np->driver_data & (DEV_HAS_STATISTICS_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_STATISTICS_V3)) { 1706 if (np->driver_data & (DEV_HAS_STATISTICS_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_STATISTICS_V3)) {
1707 nv_get_hw_stats(dev); 1707 nv_get_hw_stats(dev);
1708 1708
1709 /*
1710 * Note: because HW stats are not always available and
1711 * for consistency reasons, the following ifconfig
1712 * stats are managed by software: rx_bytes, tx_bytes,
1713 * rx_packets and tx_packets. The related hardware
1714 * stats reported by ethtool should be equivalent to
1715 * these ifconfig stats, with 4 additional bytes per
1716 * packet (Ethernet FCS CRC).
1717 */
1718
1709 /* copy to net_device stats */ 1719 /* copy to net_device stats */
1710 dev->stats.tx_packets = np->estats.tx_packets;
1711 dev->stats.rx_bytes = np->estats.rx_bytes;
1712 dev->stats.tx_bytes = np->estats.tx_bytes;
1713 dev->stats.tx_fifo_errors = np->estats.tx_fifo_errors; 1720 dev->stats.tx_fifo_errors = np->estats.tx_fifo_errors;
1714 dev->stats.tx_carrier_errors = np->estats.tx_carrier_errors; 1721 dev->stats.tx_carrier_errors = np->estats.tx_carrier_errors;
1715 dev->stats.rx_crc_errors = np->estats.rx_crc_errors; 1722 dev->stats.rx_crc_errors = np->estats.rx_crc_errors;
@@ -2380,6 +2387,9 @@ static int nv_tx_done(struct net_device *dev, int limit)
2380 if (flags & NV_TX_ERROR) { 2387 if (flags & NV_TX_ERROR) {
2381 if ((flags & NV_TX_RETRYERROR) && !(flags & NV_TX_RETRYCOUNT_MASK)) 2388 if ((flags & NV_TX_RETRYERROR) && !(flags & NV_TX_RETRYCOUNT_MASK))
2382 nv_legacybackoff_reseed(dev); 2389 nv_legacybackoff_reseed(dev);
2390 } else {
2391 dev->stats.tx_packets++;
2392 dev->stats.tx_bytes += np->get_tx_ctx->skb->len;
2383 } 2393 }
2384 dev_kfree_skb_any(np->get_tx_ctx->skb); 2394 dev_kfree_skb_any(np->get_tx_ctx->skb);
2385 np->get_tx_ctx->skb = NULL; 2395 np->get_tx_ctx->skb = NULL;
@@ -2390,6 +2400,9 @@ static int nv_tx_done(struct net_device *dev, int limit)
2390 if (flags & NV_TX2_ERROR) { 2400 if (flags & NV_TX2_ERROR) {
2391 if ((flags & NV_TX2_RETRYERROR) && !(flags & NV_TX2_RETRYCOUNT_MASK)) 2401 if ((flags & NV_TX2_RETRYERROR) && !(flags & NV_TX2_RETRYCOUNT_MASK))
2392 nv_legacybackoff_reseed(dev); 2402 nv_legacybackoff_reseed(dev);
2403 } else {
2404 dev->stats.tx_packets++;
2405 dev->stats.tx_bytes += np->get_tx_ctx->skb->len;
2393 } 2406 }
2394 dev_kfree_skb_any(np->get_tx_ctx->skb); 2407 dev_kfree_skb_any(np->get_tx_ctx->skb);
2395 np->get_tx_ctx->skb = NULL; 2408 np->get_tx_ctx->skb = NULL;
@@ -2429,6 +2442,9 @@ static int nv_tx_done_optimized(struct net_device *dev, int limit)
2429 else 2442 else
2430 nv_legacybackoff_reseed(dev); 2443 nv_legacybackoff_reseed(dev);
2431 } 2444 }
2445 } else {
2446 dev->stats.tx_packets++;
2447 dev->stats.tx_bytes += np->get_tx_ctx->skb->len;
2432 } 2448 }
2433 2449
2434 dev_kfree_skb_any(np->get_tx_ctx->skb); 2450 dev_kfree_skb_any(np->get_tx_ctx->skb);
@@ -2678,6 +2694,7 @@ static int nv_rx_process(struct net_device *dev, int limit)
2678 skb->protocol = eth_type_trans(skb, dev); 2694 skb->protocol = eth_type_trans(skb, dev);
2679 napi_gro_receive(&np->napi, skb); 2695 napi_gro_receive(&np->napi, skb);
2680 dev->stats.rx_packets++; 2696 dev->stats.rx_packets++;
2697 dev->stats.rx_bytes += len;
2681next_pkt: 2698next_pkt:
2682 if (unlikely(np->get_rx.orig++ == np->last_rx.orig)) 2699 if (unlikely(np->get_rx.orig++ == np->last_rx.orig))
2683 np->get_rx.orig = np->first_rx.orig; 2700 np->get_rx.orig = np->first_rx.orig;
@@ -2761,6 +2778,7 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
2761 } 2778 }
2762 napi_gro_receive(&np->napi, skb); 2779 napi_gro_receive(&np->napi, skb);
2763 dev->stats.rx_packets++; 2780 dev->stats.rx_packets++;
2781 dev->stats.rx_bytes += len;
2764 } else { 2782 } else {
2765 dev_kfree_skb(skb); 2783 dev_kfree_skb(skb);
2766 } 2784 }
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c
index 9c075ea2682e..9cb5f912e489 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c
@@ -18,8 +18,8 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
19 */ 19 */
20 20
21#include <linux/module.h> /* for __MODULE_STRING */
22#include "pch_gbe.h" 21#include "pch_gbe.h"
22#include <linux/module.h> /* for __MODULE_STRING */
23 23
24#define OPTION_UNSET -1 24#define OPTION_UNSET -1
25#define OPTION_DISABLED 0 25#define OPTION_DISABLED 0
diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c
index 1fc01ca72b46..4bf68cfef390 100644
--- a/drivers/net/ethernet/rdc/r6040.c
+++ b/drivers/net/ethernet/rdc/r6040.c
@@ -940,7 +940,7 @@ static void r6040_multicast_list(struct net_device *dev)
940 iowrite16(lp->mcr0, ioaddr + MCR0); 940 iowrite16(lp->mcr0, ioaddr + MCR0);
941 941
942 /* Fill the MAC hash tables with their values */ 942 /* Fill the MAC hash tables with their values */
943 if (lp->mcr0 && MCR0_HASH_EN) { 943 if (lp->mcr0 & MCR0_HASH_EN) {
944 iowrite16(hash_table[0], ioaddr + MAR0); 944 iowrite16(hash_table[0], ioaddr + MAR0);
945 iowrite16(hash_table[1], ioaddr + MAR1); 945 iowrite16(hash_table[1], ioaddr + MAR1);
946 iowrite16(hash_table[2], ioaddr + MAR2); 946 iowrite16(hash_table[2], ioaddr + MAR2);
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 92b45f08858f..6f06aa10f0d7 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -1292,7 +1292,7 @@ static void __rtl8169_check_link_status(struct net_device *dev,
1292 netif_carrier_off(dev); 1292 netif_carrier_off(dev);
1293 netif_info(tp, ifdown, dev, "link down\n"); 1293 netif_info(tp, ifdown, dev, "link down\n");
1294 if (pm) 1294 if (pm)
1295 pm_schedule_suspend(&tp->pci_dev->dev, 100); 1295 pm_schedule_suspend(&tp->pci_dev->dev, 5000);
1296 } 1296 }
1297 spin_unlock_irqrestore(&tp->lock, flags); 1297 spin_unlock_irqrestore(&tp->lock, flags);
1298} 1298}
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index d2be42aafbef..8843071fe987 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -1937,6 +1937,7 @@ static int __devinit smsc911x_init(struct net_device *dev)
1937{ 1937{
1938 struct smsc911x_data *pdata = netdev_priv(dev); 1938 struct smsc911x_data *pdata = netdev_priv(dev);
1939 unsigned int byte_test; 1939 unsigned int byte_test;
1940 unsigned int to = 100;
1940 1941
1941 SMSC_TRACE(pdata, probe, "Driver Parameters:"); 1942 SMSC_TRACE(pdata, probe, "Driver Parameters:");
1942 SMSC_TRACE(pdata, probe, "LAN base: 0x%08lX", 1943 SMSC_TRACE(pdata, probe, "LAN base: 0x%08lX",
@@ -1952,6 +1953,17 @@ static int __devinit smsc911x_init(struct net_device *dev)
1952 return -ENODEV; 1953 return -ENODEV;
1953 } 1954 }
1954 1955
1956 /*
1957 * poll the READY bit in PMT_CTRL. Any other access to the device is
1958 * forbidden while this bit isn't set. Try for 100ms
1959 */
1960 while (!(smsc911x_reg_read(pdata, PMT_CTRL) & PMT_CTRL_READY_) && --to)
1961 udelay(1000);
1962 if (to == 0) {
1963 pr_err("Device not READY in 100ms aborting\n");
1964 return -ENODEV;
1965 }
1966
1955 /* Check byte ordering */ 1967 /* Check byte ordering */
1956 byte_test = smsc911x_reg_read(pdata, BYTE_TEST); 1968 byte_test = smsc911x_reg_read(pdata, BYTE_TEST);
1957 SMSC_TRACE(pdata, probe, "BYTE_TEST: 0x%08X", byte_test); 1969 SMSC_TRACE(pdata, probe, "BYTE_TEST: 0x%08X", byte_test);
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
index da66ac511c4c..4d5402a1d262 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
@@ -39,10 +39,11 @@ static int dwmac1000_dma_init(void __iomem *ioaddr, int pbl, u32 dma_tx,
39 /* DMA SW reset */ 39 /* DMA SW reset */
40 value |= DMA_BUS_MODE_SFT_RESET; 40 value |= DMA_BUS_MODE_SFT_RESET;
41 writel(value, ioaddr + DMA_BUS_MODE); 41 writel(value, ioaddr + DMA_BUS_MODE);
42 limit = 15000; 42 limit = 10;
43 while (limit--) { 43 while (limit--) {
44 if (!(readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET)) 44 if (!(readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET))
45 break; 45 break;
46 mdelay(10);
46 } 47 }
47 if (limit < 0) 48 if (limit < 0)
48 return -EBUSY; 49 return -EBUSY;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
index 627f656b0f3c..bc17fd08b55d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
@@ -41,10 +41,11 @@ static int dwmac100_dma_init(void __iomem *ioaddr, int pbl, u32 dma_tx,
41 /* DMA SW reset */ 41 /* DMA SW reset */
42 value |= DMA_BUS_MODE_SFT_RESET; 42 value |= DMA_BUS_MODE_SFT_RESET;
43 writel(value, ioaddr + DMA_BUS_MODE); 43 writel(value, ioaddr + DMA_BUS_MODE);
44 limit = 15000; 44 limit = 10;
45 while (limit--) { 45 while (limit--) {
46 if (!(readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET)) 46 if (!(readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET))
47 break; 47 break;
48 mdelay(10);
48 } 49 }
49 if (limit < 0) 50 if (limit < 0)
50 return -EBUSY; 51 return -EBUSY;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 9bafa6cf9e8b..a140a8fbf051 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -72,7 +72,6 @@ struct stmmac_priv {
72 spinlock_t lock; 72 spinlock_t lock;
73 spinlock_t tx_lock; 73 spinlock_t tx_lock;
74 int wolopts; 74 int wolopts;
75 int wolenabled;
76 int wol_irq; 75 int wol_irq;
77#ifdef CONFIG_STMMAC_TIMER 76#ifdef CONFIG_STMMAC_TIMER
78 struct stmmac_timer *tm; 77 struct stmmac_timer *tm;
@@ -80,6 +79,7 @@ struct stmmac_priv {
80 struct plat_stmmacenet_data *plat; 79 struct plat_stmmacenet_data *plat;
81 struct stmmac_counters mmc; 80 struct stmmac_counters mmc;
82 struct dma_features dma_cap; 81 struct dma_features dma_cap;
82 int hw_cap_support;
83}; 83};
84 84
85extern int stmmac_mdio_unregister(struct net_device *ndev); 85extern int stmmac_mdio_unregister(struct net_device *ndev);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index e8eff09bbbd7..0395f9eba801 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -430,6 +430,12 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
430 struct stmmac_priv *priv = netdev_priv(dev); 430 struct stmmac_priv *priv = netdev_priv(dev);
431 u32 support = WAKE_MAGIC | WAKE_UCAST; 431 u32 support = WAKE_MAGIC | WAKE_UCAST;
432 432
433 /* By default almost all GMAC devices support the WoL via
434 * magic frame but we can disable it if the HW capability
435 * register shows no support for pmt_magic_frame. */
436 if ((priv->hw_cap_support) && (!priv->dma_cap.pmt_magic_frame))
437 wol->wolopts &= ~WAKE_MAGIC;
438
433 if (!device_can_wakeup(priv->device)) 439 if (!device_can_wakeup(priv->device))
434 return -EINVAL; 440 return -EINVAL;
435 441
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 20546bbbb8db..8ea770a89f25 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -321,12 +321,10 @@ static int stmmac_init_phy(struct net_device *dev)
321 } 321 }
322 322
323 /* Stop Advertising 1000BASE Capability if interface is not GMII */ 323 /* Stop Advertising 1000BASE Capability if interface is not GMII */
324 if ((interface) && ((interface == PHY_INTERFACE_MODE_MII) || 324 if ((interface == PHY_INTERFACE_MODE_MII) ||
325 (interface == PHY_INTERFACE_MODE_RMII))) { 325 (interface == PHY_INTERFACE_MODE_RMII))
326 phydev->supported &= (PHY_BASIC_FEATURES | SUPPORTED_Pause | 326 phydev->advertising &= ~(SUPPORTED_1000baseT_Half |
327 SUPPORTED_Asym_Pause); 327 SUPPORTED_1000baseT_Full);
328 phydev->advertising = phydev->supported;
329 }
330 328
331 /* 329 /*
332 * Broken HW is sometimes missing the pull-up resistor on the 330 * Broken HW is sometimes missing the pull-up resistor on the
@@ -807,8 +805,29 @@ static u32 stmmac_get_synopsys_id(struct stmmac_priv *priv)
807 return 0; 805 return 0;
808} 806}
809 807
810/* New GMAC chips support a new register to indicate the 808/**
811 * presence of the optional feature/functions. 809 * stmmac_selec_desc_mode
810 * @dev : device pointer
811 * Description: select the Enhanced/Alternate or Normal descriptors */
812static void stmmac_selec_desc_mode(struct stmmac_priv *priv)
813{
814 if (priv->plat->enh_desc) {
815 pr_info(" Enhanced/Alternate descriptors\n");
816 priv->hw->desc = &enh_desc_ops;
817 } else {
818 pr_info(" Normal descriptors\n");
819 priv->hw->desc = &ndesc_ops;
820 }
821}
822
823/**
824 * stmmac_get_hw_features
825 * @priv : private device pointer
826 * Description:
827 * new GMAC chip generations have a new register to indicate the
828 * presence of the optional feature/functions.
829 * This can be also used to override the value passed through the
830 * platform and necessary for old MAC10/100 and GMAC chips.
812 */ 831 */
813static int stmmac_get_hw_features(struct stmmac_priv *priv) 832static int stmmac_get_hw_features(struct stmmac_priv *priv)
814{ 833{
@@ -829,7 +848,7 @@ static int stmmac_get_hw_features(struct stmmac_priv *priv)
829 (hw_cap & DMA_HW_FEAT_RWKSEL) >> 9; 848 (hw_cap & DMA_HW_FEAT_RWKSEL) >> 9;
830 priv->dma_cap.pmt_magic_frame = 849 priv->dma_cap.pmt_magic_frame =
831 (hw_cap & DMA_HW_FEAT_MGKSEL) >> 10; 850 (hw_cap & DMA_HW_FEAT_MGKSEL) >> 10;
832 /*MMC*/ 851 /* MMC */
833 priv->dma_cap.rmon = (hw_cap & DMA_HW_FEAT_MMCSEL) >> 11; 852 priv->dma_cap.rmon = (hw_cap & DMA_HW_FEAT_MMCSEL) >> 11;
834 /* IEEE 1588-2002*/ 853 /* IEEE 1588-2002*/
835 priv->dma_cap.time_stamp = 854 priv->dma_cap.time_stamp =
@@ -857,8 +876,7 @@ static int stmmac_get_hw_features(struct stmmac_priv *priv)
857 priv->dma_cap.enh_desc = 876 priv->dma_cap.enh_desc =
858 (hw_cap & DMA_HW_FEAT_ENHDESSEL) >> 24; 877 (hw_cap & DMA_HW_FEAT_ENHDESSEL) >> 24;
859 878
860 } else 879 }
861 pr_debug("\tNo HW DMA feature register supported");
862 880
863 return hw_cap; 881 return hw_cap;
864} 882}
@@ -913,6 +931,44 @@ static int stmmac_open(struct net_device *dev)
913 goto open_error; 931 goto open_error;
914 } 932 }
915 933
934 stmmac_get_synopsys_id(priv);
935
936 priv->hw_cap_support = stmmac_get_hw_features(priv);
937
938 if (priv->hw_cap_support) {
939 pr_info(" Support DMA HW capability register");
940
941 /* We can override some gmac/dma configuration fields: e.g.
942 * enh_desc, tx_coe (e.g. that are passed through the
943 * platform) with the values from the HW capability
944 * register (if supported).
945 */
946 priv->plat->enh_desc = priv->dma_cap.enh_desc;
947 priv->plat->tx_coe = priv->dma_cap.tx_coe;
948 priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up;
949
950 /* By default disable wol on magic frame if not supported */
951 if (!priv->dma_cap.pmt_magic_frame)
952 priv->wolopts &= ~WAKE_MAGIC;
953
954 } else
955 pr_info(" No HW DMA feature register supported");
956
957 /* Select the enhnaced/normal descriptor structures */
958 stmmac_selec_desc_mode(priv);
959
960 /* PMT module is not integrated in all the MAC devices. */
961 if (priv->plat->pmt) {
962 pr_info(" Remote wake-up capable\n");
963 device_set_wakeup_capable(priv->device, 1);
964 }
965
966 priv->rx_coe = priv->hw->mac->rx_coe(priv->ioaddr);
967 if (priv->rx_coe)
968 pr_info(" Checksum Offload Engine supported\n");
969 if (priv->plat->tx_coe)
970 pr_info(" Checksum insertion supported\n");
971
916 /* Create and initialize the TX/RX descriptors chains. */ 972 /* Create and initialize the TX/RX descriptors chains. */
917 priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); 973 priv->dma_tx_size = STMMAC_ALIGN(dma_txsize);
918 priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); 974 priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize);
@@ -935,15 +991,6 @@ static int stmmac_open(struct net_device *dev)
935 /* Initialize the MAC Core */ 991 /* Initialize the MAC Core */
936 priv->hw->mac->core_init(priv->ioaddr); 992 priv->hw->mac->core_init(priv->ioaddr);
937 993
938 stmmac_get_synopsys_id(priv);
939
940 stmmac_get_hw_features(priv);
941
942 priv->rx_coe = priv->hw->mac->rx_coe(priv->ioaddr);
943 if (priv->rx_coe)
944 pr_info("stmmac: Rx Checksum Offload Engine supported\n");
945 if (priv->plat->tx_coe)
946 pr_info("\tTX Checksum insertion supported\n");
947 netdev_update_features(dev); 994 netdev_update_features(dev);
948 995
949 /* Request the IRQ lines */ 996 /* Request the IRQ lines */
@@ -1489,9 +1536,7 @@ static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1489 if (!priv->phydev) 1536 if (!priv->phydev)
1490 return -EINVAL; 1537 return -EINVAL;
1491 1538
1492 spin_lock(&priv->lock);
1493 ret = phy_mii_ioctl(priv->phydev, rq, cmd); 1539 ret = phy_mii_ioctl(priv->phydev, rq, cmd);
1494 spin_unlock(&priv->lock);
1495 1540
1496 return ret; 1541 return ret;
1497} 1542}
@@ -1558,7 +1603,7 @@ static int stmmac_sysfs_dma_cap_read(struct seq_file *seq, void *v)
1558 struct net_device *dev = seq->private; 1603 struct net_device *dev = seq->private;
1559 struct stmmac_priv *priv = netdev_priv(dev); 1604 struct stmmac_priv *priv = netdev_priv(dev);
1560 1605
1561 if (!stmmac_get_hw_features(priv)) { 1606 if (!priv->hw_cap_support) {
1562 seq_printf(seq, "DMA HW features not supported\n"); 1607 seq_printf(seq, "DMA HW features not supported\n");
1563 return 0; 1608 return 0;
1564 } 1609 }
@@ -1766,12 +1811,6 @@ static int stmmac_mac_device_setup(struct net_device *dev)
1766 if (!device) 1811 if (!device)
1767 return -ENOMEM; 1812 return -ENOMEM;
1768 1813
1769 if (priv->plat->enh_desc) {
1770 device->desc = &enh_desc_ops;
1771 pr_info("\tEnhanced descriptor structure\n");
1772 } else
1773 device->desc = &ndesc_ops;
1774
1775 priv->hw = device; 1814 priv->hw = device;
1776 priv->hw->ring = &ring_mode_ops; 1815 priv->hw->ring = &ring_mode_ops;
1777 1816
@@ -1845,11 +1884,6 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
1845 1884
1846 priv->ioaddr = addr; 1885 priv->ioaddr = addr;
1847 1886
1848 /* PMT module is not integrated in all the MAC devices. */
1849 if (plat_dat->pmt) {
1850 pr_info("\tPMT module supported\n");
1851 device_set_wakeup_capable(&pdev->dev, 1);
1852 }
1853 /* 1887 /*
1854 * On some platforms e.g. SPEAr the wake up irq differs from the mac irq 1888 * On some platforms e.g. SPEAr the wake up irq differs from the mac irq
1855 * The external wake up irq can be passed through the platform code 1889 * The external wake up irq can be passed through the platform code
@@ -1862,7 +1896,6 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
1862 if (priv->wol_irq == -ENXIO) 1896 if (priv->wol_irq == -ENXIO)
1863 priv->wol_irq = ndev->irq; 1897 priv->wol_irq = ndev->irq;
1864 1898
1865
1866 platform_set_drvdata(pdev, ndev); 1899 platform_set_drvdata(pdev, ndev);
1867 1900
1868 /* Set the I/O base addr */ 1901 /* Set the I/O base addr */
@@ -1875,7 +1908,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
1875 goto out_free_ndev; 1908 goto out_free_ndev;
1876 } 1909 }
1877 1910
1878 /* MAC HW revice detection */ 1911 /* MAC HW device detection */
1879 ret = stmmac_mac_device_setup(ndev); 1912 ret = stmmac_mac_device_setup(ndev);
1880 if (ret < 0) 1913 if (ret < 0)
1881 goto out_plat_exit; 1914 goto out_plat_exit;
@@ -1978,12 +2011,13 @@ static int stmmac_suspend(struct device *dev)
1978 if (!ndev || !netif_running(ndev)) 2011 if (!ndev || !netif_running(ndev))
1979 return 0; 2012 return 0;
1980 2013
2014 if (priv->phydev)
2015 phy_stop(priv->phydev);
2016
1981 spin_lock(&priv->lock); 2017 spin_lock(&priv->lock);
1982 2018
1983 netif_device_detach(ndev); 2019 netif_device_detach(ndev);
1984 netif_stop_queue(ndev); 2020 netif_stop_queue(ndev);
1985 if (priv->phydev)
1986 phy_stop(priv->phydev);
1987 2021
1988#ifdef CONFIG_STMMAC_TIMER 2022#ifdef CONFIG_STMMAC_TIMER
1989 priv->tm->timer_stop(); 2023 priv->tm->timer_stop();
@@ -2041,12 +2075,13 @@ static int stmmac_resume(struct device *dev)
2041#endif 2075#endif
2042 napi_enable(&priv->napi); 2076 napi_enable(&priv->napi);
2043 2077
2044 if (priv->phydev)
2045 phy_start(priv->phydev);
2046
2047 netif_start_queue(ndev); 2078 netif_start_queue(ndev);
2048 2079
2049 spin_unlock(&priv->lock); 2080 spin_unlock(&priv->lock);
2081
2082 if (priv->phydev)
2083 phy_start(priv->phydev);
2084
2050 return 0; 2085 return 0;
2051} 2086}
2052 2087
diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
index c517dac02ae1..cf14ab9db576 100644
--- a/drivers/net/ethernet/sun/sunhme.c
+++ b/drivers/net/ethernet/sun/sunhme.c
@@ -2637,7 +2637,7 @@ static int __devinit happy_meal_sbus_probe_one(struct platform_device *op, int i
2637 sbus_dp = op->dev.parent->of_node; 2637 sbus_dp = op->dev.parent->of_node;
2638 2638
2639 /* We can match PCI devices too, do not accept those here. */ 2639 /* We can match PCI devices too, do not accept those here. */
2640 if (strcmp(sbus_dp->name, "sbus")) 2640 if (strcmp(sbus_dp->name, "sbus") && strcmp(sbus_dp->name, "sbi"))
2641 return err; 2641 return err;
2642 2642
2643 if (is_qfe) { 2643 if (is_qfe) {
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index caf3659e173c..2681b53820ee 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -114,6 +114,7 @@ void temac_indirect_out32(struct temac_local *lp, int reg, u32 value)
114 return; 114 return;
115 temac_iow(lp, XTE_LSW0_OFFSET, value); 115 temac_iow(lp, XTE_LSW0_OFFSET, value);
116 temac_iow(lp, XTE_CTL0_OFFSET, CNTLREG_WRITE_ENABLE_MASK | reg); 116 temac_iow(lp, XTE_CTL0_OFFSET, CNTLREG_WRITE_ENABLE_MASK | reg);
117 temac_indirect_busywait(lp);
117} 118}
118 119
119/** 120/**
@@ -203,6 +204,9 @@ static void temac_dma_bd_release(struct net_device *ndev)
203 struct temac_local *lp = netdev_priv(ndev); 204 struct temac_local *lp = netdev_priv(ndev);
204 int i; 205 int i;
205 206
207 /* Reset Local Link (DMA) */
208 lp->dma_out(lp, DMA_CONTROL_REG, DMA_CONTROL_RST);
209
206 for (i = 0; i < RX_BD_NUM; i++) { 210 for (i = 0; i < RX_BD_NUM; i++) {
207 if (!lp->rx_skb[i]) 211 if (!lp->rx_skb[i])
208 break; 212 break;
@@ -860,6 +864,8 @@ static int temac_open(struct net_device *ndev)
860 phy_start(lp->phy_dev); 864 phy_start(lp->phy_dev);
861 } 865 }
862 866
867 temac_device_reset(ndev);
868
863 rc = request_irq(lp->tx_irq, ll_temac_tx_irq, 0, ndev->name, ndev); 869 rc = request_irq(lp->tx_irq, ll_temac_tx_irq, 0, ndev->name, ndev);
864 if (rc) 870 if (rc)
865 goto err_tx_irq; 871 goto err_tx_irq;
@@ -867,7 +873,6 @@ static int temac_open(struct net_device *ndev)
867 if (rc) 873 if (rc)
868 goto err_rx_irq; 874 goto err_rx_irq;
869 875
870 temac_device_reset(ndev);
871 return 0; 876 return 0;
872 877
873 err_rx_irq: 878 err_rx_irq:
diff --git a/drivers/net/hippi/Kconfig b/drivers/net/hippi/Kconfig
index 7393eb732ee6..95eb34fdbba7 100644
--- a/drivers/net/hippi/Kconfig
+++ b/drivers/net/hippi/Kconfig
@@ -36,4 +36,4 @@ config ROADRUNNER_LARGE_RINGS
36 kernel code or by user space programs. Say Y here only if you have 36 kernel code or by user space programs. Say Y here only if you have
37 the memory. 37 the memory.
38 38
39endif /* HIPPI */ 39endif # HIPPI
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index e81e22e3d1d2..e6fed4d4cb77 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -36,7 +36,7 @@
36#include <linux/usb/usbnet.h> 36#include <linux/usb/usbnet.h>
37#include <linux/slab.h> 37#include <linux/slab.h>
38 38
39#define DRIVER_VERSION "26-Sep-2011" 39#define DRIVER_VERSION "08-Nov-2011"
40#define DRIVER_NAME "asix" 40#define DRIVER_NAME "asix"
41 41
42/* ASIX AX8817X based USB 2.0 Ethernet Devices */ 42/* ASIX AX8817X based USB 2.0 Ethernet Devices */
@@ -163,7 +163,7 @@
163#define MARVELL_CTRL_TXDELAY 0x0002 163#define MARVELL_CTRL_TXDELAY 0x0002
164#define MARVELL_CTRL_RXDELAY 0x0080 164#define MARVELL_CTRL_RXDELAY 0x0080
165 165
166#define PHY_MODE_RTL8211CL 0x0004 166#define PHY_MODE_RTL8211CL 0x000C
167 167
168/* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */ 168/* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */
169struct asix_data { 169struct asix_data {
@@ -652,9 +652,17 @@ static u32 asix_get_phyid(struct usbnet *dev)
652{ 652{
653 int phy_reg; 653 int phy_reg;
654 u32 phy_id; 654 u32 phy_id;
655 int i;
655 656
656 phy_reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_PHYSID1); 657 /* Poll for the rare case the FW or phy isn't ready yet. */
657 if (phy_reg < 0) 658 for (i = 0; i < 100; i++) {
659 phy_reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_PHYSID1);
660 if (phy_reg != 0 && phy_reg != 0xFFFF)
661 break;
662 mdelay(1);
663 }
664
665 if (phy_reg <= 0 || phy_reg == 0xFFFF)
658 return 0; 666 return 0;
659 667
660 phy_id = (phy_reg & 0xffff) << 16; 668 phy_id = (phy_reg & 0xffff) << 16;
@@ -1075,7 +1083,7 @@ static const struct net_device_ops ax88772_netdev_ops = {
1075 1083
1076static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) 1084static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
1077{ 1085{
1078 int ret; 1086 int ret, embd_phy;
1079 struct asix_data *data = (struct asix_data *)&dev->data; 1087 struct asix_data *data = (struct asix_data *)&dev->data;
1080 u8 buf[ETH_ALEN]; 1088 u8 buf[ETH_ALEN];
1081 u32 phyid; 1089 u32 phyid;
@@ -1100,16 +1108,36 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
1100 dev->mii.reg_num_mask = 0x1f; 1108 dev->mii.reg_num_mask = 0x1f;
1101 dev->mii.phy_id = asix_get_phy_addr(dev); 1109 dev->mii.phy_id = asix_get_phy_addr(dev);
1102 1110
1103 phyid = asix_get_phyid(dev);
1104 dbg("PHYID=0x%08x", phyid);
1105
1106 dev->net->netdev_ops = &ax88772_netdev_ops; 1111 dev->net->netdev_ops = &ax88772_netdev_ops;
1107 dev->net->ethtool_ops = &ax88772_ethtool_ops; 1112 dev->net->ethtool_ops = &ax88772_ethtool_ops;
1108 1113
1109 ret = ax88772_reset(dev); 1114 embd_phy = ((dev->mii.phy_id & 0x1f) == 0x10 ? 1 : 0);
1115
1116 /* Reset the PHY to normal operation mode */
1117 ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, embd_phy, 0, 0, NULL);
1118 if (ret < 0) {
1119 dbg("Select PHY #1 failed: %d", ret);
1120 return ret;
1121 }
1122
1123 ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL);
1124 if (ret < 0)
1125 return ret;
1126
1127 msleep(150);
1128
1129 ret = asix_sw_reset(dev, AX_SWRESET_CLEAR);
1110 if (ret < 0) 1130 if (ret < 0)
1111 return ret; 1131 return ret;
1112 1132
1133 msleep(150);
1134
1135 ret = asix_sw_reset(dev, embd_phy ? AX_SWRESET_IPRL : AX_SWRESET_PRTE);
1136
1137 /* Read PHYID register *AFTER* the PHY was reset properly */
1138 phyid = asix_get_phyid(dev);
1139 dbg("PHYID=0x%08x", phyid);
1140
1113 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ 1141 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
1114 if (dev->driver_info->flags & FLAG_FRAMING_AX) { 1142 if (dev->driver_info->flags & FLAG_FRAMING_AX) {
1115 /* hard_mtu is still the default - the device does not support 1143 /* hard_mtu is still the default - the device does not support
@@ -1220,6 +1248,7 @@ static int ax88178_reset(struct usbnet *dev)
1220 __le16 eeprom; 1248 __le16 eeprom;
1221 u8 status; 1249 u8 status;
1222 int gpio0 = 0; 1250 int gpio0 = 0;
1251 u32 phyid;
1223 1252
1224 asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status); 1253 asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status);
1225 dbg("GPIO Status: 0x%04x", status); 1254 dbg("GPIO Status: 0x%04x", status);
@@ -1235,12 +1264,13 @@ static int ax88178_reset(struct usbnet *dev)
1235 data->ledmode = 0; 1264 data->ledmode = 0;
1236 gpio0 = 1; 1265 gpio0 = 1;
1237 } else { 1266 } else {
1238 data->phymode = le16_to_cpu(eeprom) & 7; 1267 data->phymode = le16_to_cpu(eeprom) & 0x7F;
1239 data->ledmode = le16_to_cpu(eeprom) >> 8; 1268 data->ledmode = le16_to_cpu(eeprom) >> 8;
1240 gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1; 1269 gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1;
1241 } 1270 }
1242 dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode); 1271 dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode);
1243 1272
1273 /* Power up external GigaPHY through AX88178 GPIO pin */
1244 asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40); 1274 asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40);
1245 if ((le16_to_cpu(eeprom) >> 8) != 1) { 1275 if ((le16_to_cpu(eeprom) >> 8) != 1) {
1246 asix_write_gpio(dev, 0x003c, 30); 1276 asix_write_gpio(dev, 0x003c, 30);
@@ -1252,6 +1282,13 @@ static int ax88178_reset(struct usbnet *dev)
1252 asix_write_gpio(dev, AX_GPIO_GPO1EN | AX_GPIO_GPO_1, 30); 1282 asix_write_gpio(dev, AX_GPIO_GPO1EN | AX_GPIO_GPO_1, 30);
1253 } 1283 }
1254 1284
1285 /* Read PHYID register *AFTER* powering up PHY */
1286 phyid = asix_get_phyid(dev);
1287 dbg("PHYID=0x%08x", phyid);
1288
1289 /* Set AX88178 to enable MII/GMII/RGMII interface for external PHY */
1290 asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, 0, 0, 0, NULL);
1291
1255 asix_sw_reset(dev, 0); 1292 asix_sw_reset(dev, 0);
1256 msleep(150); 1293 msleep(150);
1257 1294
@@ -1396,7 +1433,6 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
1396{ 1433{
1397 int ret; 1434 int ret;
1398 u8 buf[ETH_ALEN]; 1435 u8 buf[ETH_ALEN];
1399 u32 phyid;
1400 struct asix_data *data = (struct asix_data *)&dev->data; 1436 struct asix_data *data = (struct asix_data *)&dev->data;
1401 1437
1402 data->eeprom_len = AX88772_EEPROM_LEN; 1438 data->eeprom_len = AX88772_EEPROM_LEN;
@@ -1423,12 +1459,12 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
1423 dev->net->netdev_ops = &ax88178_netdev_ops; 1459 dev->net->netdev_ops = &ax88178_netdev_ops;
1424 dev->net->ethtool_ops = &ax88178_ethtool_ops; 1460 dev->net->ethtool_ops = &ax88178_ethtool_ops;
1425 1461
1426 phyid = asix_get_phyid(dev); 1462 /* Blink LEDS so users know driver saw dongle */
1427 dbg("PHYID=0x%08x", phyid); 1463 asix_sw_reset(dev, 0);
1464 msleep(150);
1428 1465
1429 ret = ax88178_reset(dev); 1466 asix_sw_reset(dev, AX_SWRESET_PRL | AX_SWRESET_IPPD);
1430 if (ret < 0) 1467 msleep(150);
1431 return ret;
1432 1468
1433 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ 1469 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
1434 if (dev->driver_info->flags & FLAG_FRAMING_AX) { 1470 if (dev->driver_info->flags & FLAG_FRAMING_AX) {
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index c924ea2bce07..99ed6eb4dfaf 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -567,7 +567,7 @@ static const struct usb_device_id products [] = {
567{ 567{
568 USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM, 568 USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM,
569 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), 569 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
570 .driver_info = (unsigned long)&wwan_info, 570 .driver_info = 0,
571}, 571},
572 572
573/* 573/*
diff --git a/drivers/net/usb/lg-vl600.c b/drivers/net/usb/lg-vl600.c
index d43db32f9478..9c26c6390d69 100644
--- a/drivers/net/usb/lg-vl600.c
+++ b/drivers/net/usb/lg-vl600.c
@@ -144,10 +144,11 @@ static int vl600_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
144 } 144 }
145 145
146 frame = (struct vl600_frame_hdr *) buf->data; 146 frame = (struct vl600_frame_hdr *) buf->data;
147 /* NOTE: Should check that frame->magic == 0x53544448? 147 /* Yes, check that frame->magic == 0x53544448 (or 0x44544d48),
148 * Otherwise if we receive garbage at the beginning of the frame 148 * otherwise we may run out of memory w/a bad packet */
149 * we may end up allocating a huge buffer and saving all the 149 if (ntohl(frame->magic) != 0x53544448 &&
150 * future incoming data into it. */ 150 ntohl(frame->magic) != 0x44544d48)
151 goto error;
151 152
152 if (buf->len < sizeof(*frame) || 153 if (buf->len < sizeof(*frame) ||
153 buf->len != le32_to_cpup(&frame->len)) { 154 buf->len != le32_to_cpup(&frame->len)) {
@@ -296,6 +297,11 @@ encapsulate:
296 * overwrite the remaining fields. 297 * overwrite the remaining fields.
297 */ 298 */
298 packet = (struct vl600_pkt_hdr *) skb->data; 299 packet = (struct vl600_pkt_hdr *) skb->data;
300 /* The VL600 wants IPv6 packets to have an IPv4 ethertype
301 * Since this modem only supports IPv4 and IPv6, just set all
302 * frames to 0x0800 (ETH_P_IP)
303 */
304 packet->h_proto = htons(ETH_P_IP);
299 memset(&packet->dummy, 0, sizeof(packet->dummy)); 305 memset(&packet->dummy, 0, sizeof(packet->dummy));
300 packet->len = cpu_to_le32(orig_len); 306 packet->len = cpu_to_le32(orig_len);
301 307
@@ -308,21 +314,12 @@ encapsulate:
308 if (skb->len < full_len) /* Pad */ 314 if (skb->len < full_len) /* Pad */
309 skb_put(skb, full_len - skb->len); 315 skb_put(skb, full_len - skb->len);
310 316
311 /* The VL600 wants IPv6 packets to have an IPv4 ethertype
312 * Check if this is an IPv6 packet, and set the ethertype
313 * to 0x800
314 */
315 if ((skb->data[sizeof(struct vl600_pkt_hdr *) + 0x22] & 0xf0) == 0x60) {
316 skb->data[sizeof(struct vl600_pkt_hdr *) + 0x20] = 0x08;
317 skb->data[sizeof(struct vl600_pkt_hdr *) + 0x21] = 0;
318 }
319
320 return skb; 317 return skb;
321} 318}
322 319
323static const struct driver_info vl600_info = { 320static const struct driver_info vl600_info = {
324 .description = "LG VL600 modem", 321 .description = "LG VL600 modem",
325 .flags = FLAG_ETHER | FLAG_RX_ASSEMBLE, 322 .flags = FLAG_RX_ASSEMBLE | FLAG_WWAN,
326 .bind = vl600_bind, 323 .bind = vl600_bind,
327 .unbind = vl600_unbind, 324 .unbind = vl600_unbind,
328 .status = usbnet_cdc_status, 325 .status = usbnet_cdc_status,
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 22a7cf951e72..a5b9b12ef268 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -51,6 +51,7 @@
51#define USB_VENDOR_ID_SMSC (0x0424) 51#define USB_VENDOR_ID_SMSC (0x0424)
52#define USB_PRODUCT_ID_LAN7500 (0x7500) 52#define USB_PRODUCT_ID_LAN7500 (0x7500)
53#define USB_PRODUCT_ID_LAN7505 (0x7505) 53#define USB_PRODUCT_ID_LAN7505 (0x7505)
54#define RXW_PADDING 2
54 55
55#define check_warn(ret, fmt, args...) \ 56#define check_warn(ret, fmt, args...) \
56 ({ if (ret < 0) netdev_warn(dev->net, fmt, ##args); }) 57 ({ if (ret < 0) netdev_warn(dev->net, fmt, ##args); })
@@ -1088,13 +1089,13 @@ static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
1088 1089
1089 memcpy(&rx_cmd_b, skb->data, sizeof(rx_cmd_b)); 1090 memcpy(&rx_cmd_b, skb->data, sizeof(rx_cmd_b));
1090 le32_to_cpus(&rx_cmd_b); 1091 le32_to_cpus(&rx_cmd_b);
1091 skb_pull(skb, 4 + NET_IP_ALIGN); 1092 skb_pull(skb, 4 + RXW_PADDING);
1092 1093
1093 packet = skb->data; 1094 packet = skb->data;
1094 1095
1095 /* get the packet length */ 1096 /* get the packet length */
1096 size = (rx_cmd_a & RX_CMD_A_LEN) - NET_IP_ALIGN; 1097 size = (rx_cmd_a & RX_CMD_A_LEN) - RXW_PADDING;
1097 align_count = (4 - ((size + NET_IP_ALIGN) % 4)) % 4; 1098 align_count = (4 - ((size + RXW_PADDING) % 4)) % 4;
1098 1099
1099 if (unlikely(rx_cmd_a & RX_CMD_A_RED)) { 1100 if (unlikely(rx_cmd_a & RX_CMD_A_RED)) {
1100 netif_dbg(dev, rx_err, dev->net, 1101 netif_dbg(dev, rx_err, dev->net,
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index 85fa9cc73502..65ecb5bab25a 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -254,6 +254,8 @@ ath_reg_apply_active_scan_flags(struct wiphy *wiphy,
254 int r; 254 int r;
255 255
256 sband = wiphy->bands[IEEE80211_BAND_2GHZ]; 256 sband = wiphy->bands[IEEE80211_BAND_2GHZ];
257 if (!sband)
258 return;
257 259
258 /* 260 /*
259 * If no country IE has been received always enable active scan 261 * If no country IE has been received always enable active scan
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 58ea0e5fabfd..5f77cbe0b6aa 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -175,6 +175,7 @@ void b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp,
175 } 175 }
176} 176}
177 177
178/* TODO: verify if needed for SSLPN or LCN */
178static u16 b43_generate_tx_phy_ctl1(struct b43_wldev *dev, u8 bitrate) 179static u16 b43_generate_tx_phy_ctl1(struct b43_wldev *dev, u8 bitrate)
179{ 180{
180 const struct b43_phy *phy = &dev->phy; 181 const struct b43_phy *phy = &dev->phy;
@@ -256,6 +257,9 @@ int b43_generate_txhdr(struct b43_wldev *dev,
256 unsigned int plcp_fragment_len; 257 unsigned int plcp_fragment_len;
257 u32 mac_ctl = 0; 258 u32 mac_ctl = 0;
258 u16 phy_ctl = 0; 259 u16 phy_ctl = 0;
260 bool fill_phy_ctl1 = (phy->type == B43_PHYTYPE_LP ||
261 phy->type == B43_PHYTYPE_N ||
262 phy->type == B43_PHYTYPE_HT);
259 u8 extra_ft = 0; 263 u8 extra_ft = 0;
260 struct ieee80211_rate *txrate; 264 struct ieee80211_rate *txrate;
261 struct ieee80211_tx_rate *rates; 265 struct ieee80211_tx_rate *rates;
@@ -531,7 +535,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
531 extra_ft |= B43_TXH_EFT_RTSFB_CCK; 535 extra_ft |= B43_TXH_EFT_RTSFB_CCK;
532 536
533 if (rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS && 537 if (rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS &&
534 phy->type == B43_PHYTYPE_N) { 538 fill_phy_ctl1) {
535 txhdr->phy_ctl1_rts = cpu_to_le16( 539 txhdr->phy_ctl1_rts = cpu_to_le16(
536 b43_generate_tx_phy_ctl1(dev, rts_rate)); 540 b43_generate_tx_phy_ctl1(dev, rts_rate));
537 txhdr->phy_ctl1_rts_fb = cpu_to_le16( 541 txhdr->phy_ctl1_rts_fb = cpu_to_le16(
@@ -552,7 +556,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
552 break; 556 break;
553 } 557 }
554 558
555 if (phy->type == B43_PHYTYPE_N) { 559 if (fill_phy_ctl1) {
556 txhdr->phy_ctl1 = 560 txhdr->phy_ctl1 =
557 cpu_to_le16(b43_generate_tx_phy_ctl1(dev, rate)); 561 cpu_to_le16(b43_generate_tx_phy_ctl1(dev, rate));
558 txhdr->phy_ctl1_fb = 562 txhdr->phy_ctl1_fb =
@@ -736,7 +740,14 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
736 740
737 /* Link quality statistics */ 741 /* Link quality statistics */
738 switch (chanstat & B43_RX_CHAN_PHYTYPE) { 742 switch (chanstat & B43_RX_CHAN_PHYTYPE) {
743 case B43_PHYTYPE_HT:
744 /* TODO: is max the right choice? */
745 status.signal = max_t(__s8,
746 max(rxhdr->phy_ht_power0, rxhdr->phy_ht_power1),
747 rxhdr->phy_ht_power2);
748 break;
739 case B43_PHYTYPE_N: 749 case B43_PHYTYPE_N:
750 /* Broadcom has code for min and avg, but always uses max */
740 if (rxhdr->power0 == 16 || rxhdr->power0 == 32) 751 if (rxhdr->power0 == 16 || rxhdr->power0 == 32)
741 status.signal = max(rxhdr->power1, rxhdr->power2); 752 status.signal = max(rxhdr->power1, rxhdr->power2);
742 else 753 else
diff --git a/drivers/net/wireless/b43/xmit.h b/drivers/net/wireless/b43/xmit.h
index 16c514d54afa..98d90747836a 100644
--- a/drivers/net/wireless/b43/xmit.h
+++ b/drivers/net/wireless/b43/xmit.h
@@ -249,6 +249,12 @@ struct b43_rxhdr_fw4 {
249 } __packed; 249 } __packed;
250 } __packed; 250 } __packed;
251 union { 251 union {
252 /* HT-PHY */
253 struct {
254 PAD_BYTES(1);
255 __s8 phy_ht_power0;
256 } __packed;
257
252 /* RSSI for N-PHYs */ 258 /* RSSI for N-PHYs */
253 struct { 259 struct {
254 __s8 power2; 260 __s8 power2;
@@ -257,7 +263,15 @@ struct b43_rxhdr_fw4 {
257 263
258 __le16 phy_status2; /* PHY RX Status 2 */ 264 __le16 phy_status2; /* PHY RX Status 2 */
259 } __packed; 265 } __packed;
260 __le16 phy_status3; /* PHY RX Status 3 */ 266 union {
267 /* HT-PHY */
268 struct {
269 __s8 phy_ht_power1;
270 __s8 phy_ht_power2;
271 } __packed;
272
273 __le16 phy_status3; /* PHY RX Status 3 */
274 } __packed;
261 union { 275 union {
262 /* Tested with 598.314, 644.1001 and 666.2 */ 276 /* Tested with 598.314, 644.1001 and 666.2 */
263 struct { 277 struct {
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
index b56a30297c26..6ebec8f42846 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
@@ -358,13 +358,14 @@ static uint nrxdactive(struct dma_info *di, uint h, uint t)
358 358
359static uint _dma_ctrlflags(struct dma_info *di, uint mask, uint flags) 359static uint _dma_ctrlflags(struct dma_info *di, uint mask, uint flags)
360{ 360{
361 uint dmactrlflags = di->dma.dmactrlflags; 361 uint dmactrlflags;
362 362
363 if (di == NULL) { 363 if (di == NULL) {
364 DMA_ERROR(("%s: _dma_ctrlflags: NULL dma handle\n", di->name)); 364 DMA_ERROR(("_dma_ctrlflags: NULL dma handle\n"));
365 return 0; 365 return 0;
366 } 366 }
367 367
368 dmactrlflags = di->dma.dmactrlflags;
368 dmactrlflags &= ~mask; 369 dmactrlflags &= ~mask;
369 dmactrlflags |= flags; 370 dmactrlflags |= flags;
370 371
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index da3411057afc..ce918980e977 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -990,29 +990,16 @@ static int iwl_trans_tx_stop(struct iwl_trans *trans)
990 return 0; 990 return 0;
991} 991}
992 992
993static void iwl_trans_pcie_disable_sync_irq(struct iwl_trans *trans) 993static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
994{ 994{
995 unsigned long flags; 995 unsigned long flags;
996 struct iwl_trans_pcie *trans_pcie = 996 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
997 IWL_TRANS_GET_PCIE_TRANS(trans);
998 997
998 /* tell the device to stop sending interrupts */
999 spin_lock_irqsave(&trans->shrd->lock, flags); 999 spin_lock_irqsave(&trans->shrd->lock, flags);
1000 iwl_disable_interrupts(trans); 1000 iwl_disable_interrupts(trans);
1001 spin_unlock_irqrestore(&trans->shrd->lock, flags); 1001 spin_unlock_irqrestore(&trans->shrd->lock, flags);
1002 1002
1003 /* wait to make sure we flush pending tasklet*/
1004 synchronize_irq(bus(trans)->irq);
1005 tasklet_kill(&trans_pcie->irq_tasklet);
1006}
1007
1008static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
1009{
1010 /* stop and reset the on-board processor */
1011 iwl_write32(bus(trans), CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
1012
1013 /* tell the device to stop sending interrupts */
1014 iwl_trans_pcie_disable_sync_irq(trans);
1015
1016 /* device going down, Stop using ICT table */ 1003 /* device going down, Stop using ICT table */
1017 iwl_disable_ict(trans); 1004 iwl_disable_ict(trans);
1018 1005
@@ -1039,6 +1026,20 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
1039 1026
1040 /* Stop the device, and put it in low power state */ 1027 /* Stop the device, and put it in low power state */
1041 iwl_apm_stop(priv(trans)); 1028 iwl_apm_stop(priv(trans));
1029
1030 /* Upon stop, the APM issues an interrupt if HW RF kill is set.
1031 * Clean again the interrupt here
1032 */
1033 spin_lock_irqsave(&trans->shrd->lock, flags);
1034 iwl_disable_interrupts(trans);
1035 spin_unlock_irqrestore(&trans->shrd->lock, flags);
1036
1037 /* wait to make sure we flush pending tasklet*/
1038 synchronize_irq(bus(trans)->irq);
1039 tasklet_kill(&trans_pcie->irq_tasklet);
1040
1041 /* stop and reset the on-board processor */
1042 iwl_write32(bus(trans), CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
1042} 1043}
1043 1044
1044static int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, 1045static int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index 4fcd653bddc4..a7f1ab28940d 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -634,7 +634,7 @@ static int lbs_ret_scan(struct lbs_private *priv, unsigned long dummy,
634 if (channel && 634 if (channel &&
635 !(channel->flags & IEEE80211_CHAN_DISABLED)) 635 !(channel->flags & IEEE80211_CHAN_DISABLED))
636 cfg80211_inform_bss(wiphy, channel, 636 cfg80211_inform_bss(wiphy, channel,
637 bssid, le64_to_cpu(*(__le64 *)tsfdesc), 637 bssid, get_unaligned_le64(tsfdesc),
638 capa, intvl, ie, ielen, 638 capa, intvl, ie, ielen,
639 LBS_SCAN_RSSI_TO_MBM(rssi), 639 LBS_SCAN_RSSI_TO_MBM(rssi),
640 GFP_KERNEL); 640 GFP_KERNEL);
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index 11b69b300dc0..728baa445259 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -995,6 +995,7 @@ static int if_spi_host_to_card(struct lbs_private *priv,
995 spin_unlock_irqrestore(&card->buffer_lock, flags); 995 spin_unlock_irqrestore(&card->buffer_lock, flags);
996 break; 996 break;
997 default: 997 default:
998 kfree(packet);
998 netdev_err(priv->dev, "can't transfer buffer of type %d\n", 999 netdev_err(priv->dev, "can't transfer buffer of type %d\n",
999 type); 1000 type);
1000 err = -EINVAL; 1001 err = -EINVAL;
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index dae8dbb24a03..8d3ab378662b 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -819,8 +819,10 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv,
819 wildcard_ssid_tlv->header.len = cpu_to_le16( 819 wildcard_ssid_tlv->header.len = cpu_to_le16(
820 (u16) (ssid_len + sizeof(wildcard_ssid_tlv-> 820 (u16) (ssid_len + sizeof(wildcard_ssid_tlv->
821 max_ssid_length))); 821 max_ssid_length)));
822 wildcard_ssid_tlv->max_ssid_length = 822
823 user_scan_in->ssid_list[ssid_idx].max_len; 823 /* max_ssid_length = 0 tells firmware to perform
824 specific scan for the SSID filled */
825 wildcard_ssid_tlv->max_ssid_length = 0;
824 826
825 memcpy(wildcard_ssid_tlv->ssid, 827 memcpy(wildcard_ssid_tlv->ssid,
826 user_scan_in->ssid_list[ssid_idx].ssid, 828 user_scan_in->ssid_list[ssid_idx].ssid,
@@ -1469,7 +1471,7 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv, u8 *bssid,
1469 s32 rssi, const u8 *ie_buf, size_t ie_len, 1471 s32 rssi, const u8 *ie_buf, size_t ie_len,
1470 u16 beacon_period, u16 cap_info_bitmap, u8 band) 1472 u16 beacon_period, u16 cap_info_bitmap, u8 band)
1471{ 1473{
1472 struct mwifiex_bssdescriptor *bss_desc = NULL; 1474 struct mwifiex_bssdescriptor *bss_desc;
1473 int ret; 1475 int ret;
1474 unsigned long flags; 1476 unsigned long flags;
1475 u8 *beacon_ie; 1477 u8 *beacon_ie;
@@ -1484,6 +1486,7 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv, u8 *bssid,
1484 1486
1485 beacon_ie = kmemdup(ie_buf, ie_len, GFP_KERNEL); 1487 beacon_ie = kmemdup(ie_buf, ie_len, GFP_KERNEL);
1486 if (!beacon_ie) { 1488 if (!beacon_ie) {
1489 kfree(bss_desc);
1487 dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n"); 1490 dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n");
1488 return -ENOMEM; 1491 return -ENOMEM;
1489 } 1492 }
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index f1565792f270..377876315b8d 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -919,6 +919,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
919 { USB_DEVICE(0x050d, 0x935b) }, 919 { USB_DEVICE(0x050d, 0x935b) },
920 /* Buffalo */ 920 /* Buffalo */
921 { USB_DEVICE(0x0411, 0x00e8) }, 921 { USB_DEVICE(0x0411, 0x00e8) },
922 { USB_DEVICE(0x0411, 0x0158) },
922 { USB_DEVICE(0x0411, 0x016f) }, 923 { USB_DEVICE(0x0411, 0x016f) },
923 { USB_DEVICE(0x0411, 0x01a2) }, 924 { USB_DEVICE(0x0411, 0x01a2) },
924 /* Corega */ 925 /* Corega */
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 2ec5c00235e6..99ff12d0c29d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -943,6 +943,7 @@ struct rt2x00_dev {
943 * Powersaving work 943 * Powersaving work
944 */ 944 */
945 struct delayed_work autowakeup_work; 945 struct delayed_work autowakeup_work;
946 struct work_struct sleep_work;
946 947
947 /* 948 /*
948 * Data queue arrays for RX, TX, Beacon and ATIM. 949 * Data queue arrays for RX, TX, Beacon and ATIM.
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index e1fb2a8569be..edd317fa7c0a 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -465,6 +465,23 @@ static u8 *rt2x00lib_find_ie(u8 *data, unsigned int len, u8 ie)
465 return NULL; 465 return NULL;
466} 466}
467 467
468static void rt2x00lib_sleep(struct work_struct *work)
469{
470 struct rt2x00_dev *rt2x00dev =
471 container_of(work, struct rt2x00_dev, sleep_work);
472
473 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
474 return;
475
476 /*
477 * Check again is powersaving is enabled, to prevent races from delayed
478 * work execution.
479 */
480 if (!test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags))
481 rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf,
482 IEEE80211_CONF_CHANGE_PS);
483}
484
468static void rt2x00lib_rxdone_check_ps(struct rt2x00_dev *rt2x00dev, 485static void rt2x00lib_rxdone_check_ps(struct rt2x00_dev *rt2x00dev,
469 struct sk_buff *skb, 486 struct sk_buff *skb,
470 struct rxdone_entry_desc *rxdesc) 487 struct rxdone_entry_desc *rxdesc)
@@ -512,8 +529,7 @@ static void rt2x00lib_rxdone_check_ps(struct rt2x00_dev *rt2x00dev,
512 cam |= (tim_ie->bitmap_ctrl & 0x01); 529 cam |= (tim_ie->bitmap_ctrl & 0x01);
513 530
514 if (!cam && !test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags)) 531 if (!cam && !test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags))
515 rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf, 532 queue_work(rt2x00dev->workqueue, &rt2x00dev->sleep_work);
516 IEEE80211_CONF_CHANGE_PS);
517} 533}
518 534
519static int rt2x00lib_rxdone_read_signal(struct rt2x00_dev *rt2x00dev, 535static int rt2x00lib_rxdone_read_signal(struct rt2x00_dev *rt2x00dev,
@@ -1141,6 +1157,7 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
1141 1157
1142 INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled); 1158 INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled);
1143 INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup); 1159 INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
1160 INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
1144 1161
1145 /* 1162 /*
1146 * Let the driver probe the device to detect the capabilities. 1163 * Let the driver probe the device to detect the capabilities.
@@ -1197,6 +1214,7 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
1197 */ 1214 */
1198 cancel_work_sync(&rt2x00dev->intf_work); 1215 cancel_work_sync(&rt2x00dev->intf_work);
1199 cancel_delayed_work_sync(&rt2x00dev->autowakeup_work); 1216 cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
1217 cancel_work_sync(&rt2x00dev->sleep_work);
1200 if (rt2x00_is_usb(rt2x00dev)) { 1218 if (rt2x00_is_usb(rt2x00dev)) {
1201 del_timer_sync(&rt2x00dev->txstatus_timer); 1219 del_timer_sync(&rt2x00dev->txstatus_timer);
1202 cancel_work_sync(&rt2x00dev->rxdone_work); 1220 cancel_work_sync(&rt2x00dev->rxdone_work);
diff --git a/drivers/net/wireless/wl12xx/scan.c b/drivers/net/wireless/wl12xx/scan.c
index 128ccb79318c..fc29c671cf3b 100644
--- a/drivers/net/wireless/wl12xx/scan.c
+++ b/drivers/net/wireless/wl12xx/scan.c
@@ -559,7 +559,7 @@ wl12xx_scan_sched_scan_ssid_list(struct wl1271 *wl,
559 break; 559 break;
560 } 560 }
561 /* Fail if SSID isn't present in the filters */ 561 /* Fail if SSID isn't present in the filters */
562 if (j == req->n_ssids) { 562 if (j == cmd->n_ssids) {
563 ret = -EINVAL; 563 ret = -EINVAL;
564 goto out_free; 564 goto out_free;
565 } 565 }