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/arcnet/Kconfig2
-rw-r--r--drivers/net/bonding/bond_main.c70
-rw-r--r--drivers/net/bonding/bond_procfs.c13
-rw-r--r--drivers/net/bonding/bond_sysfs.c7
-rw-r--r--drivers/net/can/sja1000/peak_pci.c1
-rw-r--r--drivers/net/ethernet/Kconfig1
-rw-r--r--drivers/net/ethernet/Makefile1
-rw-r--r--drivers/net/ethernet/amd/au1000_eth.c48
-rw-r--r--drivers/net/ethernet/amd/au1000_eth.h2
-rw-r--r--drivers/net/ethernet/apple/Kconfig12
-rw-r--r--drivers/net/ethernet/apple/Makefile1
-rw-r--r--drivers/net/ethernet/broadcom/b44.c2
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c39
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c50
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h1
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c15
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c195
-rw-r--r--drivers/net/ethernet/broadcom/tg3.h21
-rw-r--r--drivers/net/ethernet/brocade/bna/bnad.c1
-rw-r--r--drivers/net/ethernet/cadence/Kconfig1
-rw-r--r--drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c1
-rw-r--r--drivers/net/ethernet/chelsio/cxgb3/l2t.c1
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/l2t.c7
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/sge.c1
-rw-r--r--drivers/net/ethernet/cirrus/Kconfig14
-rw-r--r--drivers/net/ethernet/cirrus/Makefile1
-rw-r--r--drivers/net/ethernet/cirrus/mac89x0.c (renamed from drivers/net/ethernet/apple/mac89x0.c)0
-rw-r--r--drivers/net/ethernet/davicom/dm9000.c2
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c12
-rw-r--r--drivers/net/ethernet/emulex/benet/be_hw.h2
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c67
-rw-r--r--drivers/net/ethernet/ethoc.c1
-rw-r--r--drivers/net/ethernet/freescale/Kconfig4
-rw-r--r--drivers/net/ethernet/freescale/ucc_geth.c1
-rw-r--r--drivers/net/ethernet/i825xx/3c505.c6
-rw-r--r--drivers/net/ethernet/ibm/ehea/ehea.h4
-rw-r--r--drivers/net/ethernet/ibm/ehea/ehea_main.c6
-rw-r--r--drivers/net/ethernet/ibm/iseries_veth.c2
-rw-r--r--drivers/net/ethernet/intel/Kconfig6
-rw-r--r--drivers/net/ethernet/intel/e100.c4
-rw-r--r--drivers/net/ethernet/intel/e1000e/ich8lan.c3
-rw-r--r--drivers/net/ethernet/intel/e1000e/param.c1
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_phy.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_common.c20
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c10
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c48
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h4
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c2
-rw-r--r--drivers/net/ethernet/jme.c113
-rw-r--r--drivers/net/ethernet/jme.h19
-rw-r--r--drivers/net/ethernet/lantiq_etop.c2
-rw-r--r--drivers/net/ethernet/marvell/sky2.c117
-rw-r--r--drivers/net/ethernet/marvell/sky2.h1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/alloc.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/catas.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/cmd.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/cq.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_rx.c6
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_tx.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/eq.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/fw.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/intf.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mcg.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4_en.h1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mr.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/pd.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/port.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/qp.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/srq.c1
-rw-r--r--drivers/net/ethernet/natsemi/Kconfig5
-rw-r--r--drivers/net/ethernet/neterion/vxge/vxge-main.c1
-rw-r--r--drivers/net/ethernet/nvidia/forcedeth.c104
-rw-r--r--drivers/net/ethernet/octeon/octeon_mgmt.c1
-rw-r--r--drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c1
-rw-r--r--drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c1
-rw-r--r--drivers/net/ethernet/qlogic/qlge/qlge.h8
-rw-r--r--drivers/net/ethernet/rdc/r6040.c2
-rw-r--r--drivers/net/ethernet/realtek/Kconfig12
-rw-r--r--drivers/net/ethernet/realtek/Makefile1
-rw-r--r--drivers/net/ethernet/realtek/r8169.c2
-rw-r--r--drivers/net/ethernet/sfc/rx.c1
-rw-r--r--drivers/net/ethernet/silan/Kconfig33
-rw-r--r--drivers/net/ethernet/silan/Makefile5
-rw-r--r--drivers/net/ethernet/silan/sc92031.c (renamed from drivers/net/ethernet/realtek/sc92031.c)0
-rw-r--r--drivers/net/ethernet/smsc/smsc911x.c12
-rw-r--r--drivers/net/ethernet/smsc/smsc9420.c1
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/Kconfig9
-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.c131
-rw-r--r--drivers/net/ethernet/sun/sunhme.c2
-rw-r--r--drivers/net/ethernet/toshiba/ps3_gelic_net.c3
-rw-r--r--drivers/net/ethernet/toshiba/ps3_gelic_net.h6
-rw-r--r--drivers/net/ethernet/xilinx/ll_temac_main.c11
-rw-r--r--drivers/net/ethernet/xscale/ixp4xx_eth.c1
-rw-r--r--drivers/net/hippi/Kconfig2
-rw-r--r--drivers/net/irda/Kconfig2
-rw-r--r--drivers/net/macvlan.c7
-rw-r--r--drivers/net/phy/Kconfig2
-rw-r--r--drivers/net/phy/realtek.c1
-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.c26
-rw-r--r--drivers/net/usb/smsc75xx.c7
-rw-r--r--drivers/net/usb/usbnet.c3
-rw-r--r--drivers/net/veth.c1
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c1
-rw-r--r--drivers/net/wimax/i2400m/control.c2
-rw-r--r--drivers/net/wimax/i2400m/debugfs.c1
-rw-r--r--drivers/net/wimax/i2400m/fw.c1
-rw-r--r--drivers/net/wimax/i2400m/netdev.c1
-rw-r--r--drivers/net/wimax/i2400m/rx.c2
-rw-r--r--drivers/net/wimax/i2400m/sdio.c1
-rw-r--r--drivers/net/wimax/i2400m/tx.c1
-rw-r--r--drivers/net/wimax/i2400m/usb.c1
-rw-r--r--drivers/net/wireless/adm8211.c1
-rw-r--r--drivers/net/wireless/ath/ath5k/debug.c3
-rw-r--r--drivers/net/wireless/ath/ath5k/pci.c1
-rw-r--r--drivers/net/wireless/ath/ath6kl/cfg80211.c2
-rw-r--r--drivers/net/wireless/ath/ath6kl/debug.c1
-rw-r--r--drivers/net/wireless/ath/ath6kl/sdio.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/ahb.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/ani.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_calib.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_hw.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_mac.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_calib.c11
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_mac.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_paprd.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_phy.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_phy.h34
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9485_initvals.h10
-rw-r--r--drivers/net/wireless/ath/ath9k/btcoex.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/calib.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c7
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/mac.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/pci.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c1
-rw-r--r--drivers/net/wireless/ath/carl9170/fw.c1
-rw-r--r--drivers/net/wireless/ath/carl9170/tx.c11
-rw-r--r--drivers/net/wireless/ath/debug.c1
-rw-r--r--drivers/net/wireless/ath/hw.c1
-rw-r--r--drivers/net/wireless/ath/key.c1
-rw-r--r--drivers/net/wireless/ath/regd.c3
-rw-r--r--drivers/net/wireless/b43/main.c2
-rw-r--r--drivers/net/wireless/b43/pcmcia.c1
-rw-r--r--drivers/net/wireless/b43/xmit.c16
-rw-r--r--drivers/net/wireless/b43/xmit.h16
-rw-r--r--drivers/net/wireless/b43legacy/main.c2
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c1
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/dma.c5
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c1
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_rx.c1
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_tx.c1
-rw-r--r--drivers/net/wireless/hostap/hostap_ap.c2
-rw-r--r--drivers/net/wireless/hostap/hostap_info.c1
-rw-r--r--drivers/net/wireless/hostap/hostap_ioctl.c1
-rw-r--r--drivers/net/wireless/hostap/hostap_proc.c1
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-debugfs.c1
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-rx.c1
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-scan.c1
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-sta.c1
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-tx.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-pci.c9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie.c45
-rw-r--r--drivers/net/wireless/iwmc3200wifi/commands.c1
-rw-r--r--drivers/net/wireless/iwmc3200wifi/debugfs.c1
-rw-r--r--drivers/net/wireless/iwmc3200wifi/main.c1
-rw-r--r--drivers/net/wireless/iwmc3200wifi/sdio.c1
-rw-r--r--drivers/net/wireless/libertas/cfg.c27
-rw-r--r--drivers/net/wireless/libertas/cfg.h1
-rw-r--r--drivers/net/wireless/libertas/cmd.c1
-rw-r--r--drivers/net/wireless/libertas/debugfs.c1
-rw-r--r--drivers/net/wireless/libertas/if_sdio.c2
-rw-r--r--drivers/net/wireless/libertas/if_spi.c3
-rw-r--r--drivers/net/wireless/libertas/if_usb.c2
-rw-r--r--drivers/net/wireless/libertas/main.c8
-rw-r--r--drivers/net/wireless/libertas/rx.c1
-rw-r--r--drivers/net/wireless/libertas/tx.c1
-rw-r--r--drivers/net/wireless/libertas_tf/cmd.c1
-rw-r--r--drivers/net/wireless/libertas_tf/if_usb.c2
-rw-r--r--drivers/net/wireless/libertas_tf/main.c1
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c1
-rw-r--r--drivers/net/wireless/mwifiex/scan.c9
-rw-r--r--drivers/net/wireless/orinoco/fw.c1
-rw-r--r--drivers/net/wireless/p54/eeprom.c1
-rw-r--r--drivers/net/wireless/p54/fwio.c1
-rw-r--r--drivers/net/wireless/p54/main.c1
-rw-r--r--drivers/net/wireless/p54/p54pci.c1
-rw-r--r--drivers/net/wireless/p54/p54spi.c5
-rw-r--r--drivers/net/wireless/p54/p54usb.c1
-rw-r--r--drivers/net/wireless/p54/txrx.c1
-rw-r--r--drivers/net/wireless/prism54/isl_ioctl.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c2
-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/rtl818x/rtl8180/dev.c1
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187/dev.c1
-rw-r--r--drivers/net/wireless/rtlwifi/base.c1
-rw-r--r--drivers/net/wireless/rtlwifi/cam.c1
-rw-r--r--drivers/net/wireless/rtlwifi/efuse.c1
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c1
-rw-r--r--drivers/net/wireless/rtlwifi/ps.c18
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/main.c1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/sw.c1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/sw.c1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/sw.c1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/sw.c1
-rw-r--r--drivers/net/wireless/rtlwifi/usb.c1
-rw-r--r--drivers/net/wireless/wl12xx/boot.c1
-rw-r--r--drivers/net/wireless/wl12xx/scan.c2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c1
-rw-r--r--drivers/net/xen-netback/common.h11
-rw-r--r--drivers/net/xen-netback/netback.c82
225 files changed, 1243 insertions, 710 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 583f66cd5bb..654a5e94e0e 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/arcnet/Kconfig b/drivers/net/arcnet/Kconfig
index a73d9dc80ff..84fb6349a59 100644
--- a/drivers/net/arcnet/Kconfig
+++ b/drivers/net/arcnet/Kconfig
@@ -4,7 +4,7 @@
4 4
5menuconfig ARCNET 5menuconfig ARCNET
6 depends on NETDEVICES && (ISA || PCI || PCMCIA) 6 depends on NETDEVICES && (ISA || PCI || PCMCIA)
7 bool "ARCnet support" 7 tristate "ARCnet support"
8 ---help--- 8 ---help---
9 If you have a network card of this type, say Y and check out the 9 If you have a network card of this type, say Y and check out the
10 (arguably) beautiful poetry in 10 (arguably) beautiful poetry in
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index c34cc1e7c6f..7f8756825b8 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -550,7 +550,7 @@ down:
550/* 550/*
551 * Get link speed and duplex from the slave's base driver 551 * Get link speed and duplex from the slave's base driver
552 * using ethtool. If for some reason the call fails or the 552 * using ethtool. If for some reason the call fails or the
553 * values are invalid, fake speed and duplex to 100/Full 553 * values are invalid, set speed and duplex to -1,
554 * and return error. 554 * and return error.
555 */ 555 */
556static int bond_update_speed_duplex(struct slave *slave) 556static int bond_update_speed_duplex(struct slave *slave)
@@ -560,9 +560,8 @@ static int bond_update_speed_duplex(struct slave *slave)
560 u32 slave_speed; 560 u32 slave_speed;
561 int res; 561 int res;
562 562
563 /* Fake speed and duplex */ 563 slave->speed = SPEED_UNKNOWN;
564 slave->speed = SPEED_100; 564 slave->duplex = DUPLEX_UNKNOWN;
565 slave->duplex = DUPLEX_FULL;
566 565
567 res = __ethtool_get_settings(slave_dev, &ecmd); 566 res = __ethtool_get_settings(slave_dev, &ecmd);
568 if (res < 0) 567 if (res < 0)
@@ -1751,16 +1750,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1751 new_slave->link = BOND_LINK_DOWN; 1750 new_slave->link = BOND_LINK_DOWN;
1752 } 1751 }
1753 1752
1754 if (bond_update_speed_duplex(new_slave) && 1753 bond_update_speed_duplex(new_slave);
1755 (new_slave->link != BOND_LINK_DOWN)) {
1756 pr_warning("%s: Warning: failed to get speed and duplex from %s, assumed to be 100Mb/sec and Full.\n",
1757 bond_dev->name, new_slave->dev->name);
1758
1759 if (bond->params.mode == BOND_MODE_8023AD) {
1760 pr_warning("%s: Warning: Operation of 802.3ad mode requires ETHTOOL support in base driver for proper aggregator selection.\n",
1761 bond_dev->name);
1762 }
1763 }
1764 1754
1765 if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { 1755 if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) {
1766 /* if there is a primary slave, remember it */ 1756 /* if there is a primary slave, remember it */
@@ -2563,30 +2553,6 @@ re_arm:
2563 } 2553 }
2564} 2554}
2565 2555
2566static __be32 bond_glean_dev_ip(struct net_device *dev)
2567{
2568 struct in_device *idev;
2569 struct in_ifaddr *ifa;
2570 __be32 addr = 0;
2571
2572 if (!dev)
2573 return 0;
2574
2575 rcu_read_lock();
2576 idev = __in_dev_get_rcu(dev);
2577 if (!idev)
2578 goto out;
2579
2580 ifa = idev->ifa_list;
2581 if (!ifa)
2582 goto out;
2583
2584 addr = ifa->ifa_local;
2585out:
2586 rcu_read_unlock();
2587 return addr;
2588}
2589
2590static int bond_has_this_ip(struct bonding *bond, __be32 ip) 2556static int bond_has_this_ip(struct bonding *bond, __be32 ip)
2591{ 2557{
2592 struct vlan_entry *vlan; 2558 struct vlan_entry *vlan;
@@ -3220,6 +3186,7 @@ static int bond_slave_netdev_event(unsigned long event,
3220{ 3186{
3221 struct net_device *bond_dev = slave_dev->master; 3187 struct net_device *bond_dev = slave_dev->master;
3222 struct bonding *bond = netdev_priv(bond_dev); 3188 struct bonding *bond = netdev_priv(bond_dev);
3189 struct slave *slave = NULL;
3223 3190
3224 switch (event) { 3191 switch (event) {
3225 case NETDEV_UNREGISTER: 3192 case NETDEV_UNREGISTER:
@@ -3230,20 +3197,16 @@ static int bond_slave_netdev_event(unsigned long event,
3230 bond_release(bond_dev, slave_dev); 3197 bond_release(bond_dev, slave_dev);
3231 } 3198 }
3232 break; 3199 break;
3200 case NETDEV_UP:
3233 case NETDEV_CHANGE: 3201 case NETDEV_CHANGE:
3234 if (bond->params.mode == BOND_MODE_8023AD || bond_is_lb(bond)) { 3202 slave = bond_get_slave_by_dev(bond, slave_dev);
3235 struct slave *slave; 3203 if (slave) {
3204 u32 old_speed = slave->speed;
3205 u8 old_duplex = slave->duplex;
3236 3206
3237 slave = bond_get_slave_by_dev(bond, slave_dev); 3207 bond_update_speed_duplex(slave);
3238 if (slave) {
3239 u32 old_speed = slave->speed;
3240 u8 old_duplex = slave->duplex;
3241
3242 bond_update_speed_duplex(slave);
3243
3244 if (bond_is_lb(bond))
3245 break;
3246 3208
3209 if (bond->params.mode == BOND_MODE_8023AD) {
3247 if (old_speed != slave->speed) 3210 if (old_speed != slave->speed)
3248 bond_3ad_adapter_speed_changed(slave); 3211 bond_3ad_adapter_speed_changed(slave);
3249 if (old_duplex != slave->duplex) 3212 if (old_duplex != slave->duplex)
@@ -3335,6 +3298,10 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
3335 struct bonding *bond; 3298 struct bonding *bond;
3336 struct vlan_entry *vlan; 3299 struct vlan_entry *vlan;
3337 3300
3301 /* we only care about primary address */
3302 if(ifa->ifa_flags & IFA_F_SECONDARY)
3303 return NOTIFY_DONE;
3304
3338 list_for_each_entry(bond, &bn->dev_list, bond_list) { 3305 list_for_each_entry(bond, &bn->dev_list, bond_list) {
3339 if (bond->dev == event_dev) { 3306 if (bond->dev == event_dev) {
3340 switch (event) { 3307 switch (event) {
@@ -3342,7 +3309,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
3342 bond->master_ip = ifa->ifa_local; 3309 bond->master_ip = ifa->ifa_local;
3343 return NOTIFY_OK; 3310 return NOTIFY_OK;
3344 case NETDEV_DOWN: 3311 case NETDEV_DOWN:
3345 bond->master_ip = bond_glean_dev_ip(bond->dev); 3312 bond->master_ip = 0;
3346 return NOTIFY_OK; 3313 return NOTIFY_OK;
3347 default: 3314 default:
3348 return NOTIFY_DONE; 3315 return NOTIFY_DONE;
@@ -3358,8 +3325,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
3358 vlan->vlan_ip = ifa->ifa_local; 3325 vlan->vlan_ip = ifa->ifa_local;
3359 return NOTIFY_OK; 3326 return NOTIFY_OK;
3360 case NETDEV_DOWN: 3327 case NETDEV_DOWN:
3361 vlan->vlan_ip = 3328 vlan->vlan_ip = 0;
3362 bond_glean_dev_ip(vlan_dev);
3363 return NOTIFY_OK; 3329 return NOTIFY_OK;
3364 default: 3330 default:
3365 return NOTIFY_DONE; 3331 return NOTIFY_DONE;
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
index 95de93b9038..ad284baafe8 100644
--- a/drivers/net/bonding/bond_procfs.c
+++ b/drivers/net/bonding/bond_procfs.c
@@ -1,4 +1,5 @@
1#include <linux/proc_fs.h> 1#include <linux/proc_fs.h>
2#include <linux/export.h>
2#include <net/net_namespace.h> 3#include <net/net_namespace.h>
3#include <net/netns/generic.h> 4#include <net/netns/generic.h>
4#include "bonding.h" 5#include "bonding.h"
@@ -157,8 +158,16 @@ static void bond_info_show_slave(struct seq_file *seq,
157 seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name); 158 seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name);
158 seq_printf(seq, "MII Status: %s\n", 159 seq_printf(seq, "MII Status: %s\n",
159 (slave->link == BOND_LINK_UP) ? "up" : "down"); 160 (slave->link == BOND_LINK_UP) ? "up" : "down");
160 seq_printf(seq, "Speed: %d Mbps\n", slave->speed); 161 if (slave->speed == SPEED_UNKNOWN)
161 seq_printf(seq, "Duplex: %s\n", slave->duplex ? "full" : "half"); 162 seq_printf(seq, "Speed: %s\n", "Unknown");
163 else
164 seq_printf(seq, "Speed: %d Mbps\n", slave->speed);
165
166 if (slave->duplex == DUPLEX_UNKNOWN)
167 seq_printf(seq, "Duplex: %s\n", "Unknown");
168 else
169 seq_printf(seq, "Duplex: %s\n", slave->duplex ? "full" : "half");
170
162 seq_printf(seq, "Link Failure Count: %u\n", 171 seq_printf(seq, "Link Failure Count: %u\n",
163 slave->link_failure_count); 172 slave->link_failure_count);
164 173
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 5a20804fdec..4ef7e2fd9fe 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/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c
index 905bce0b3a4..2c7f5036f57 100644
--- a/drivers/net/can/sja1000/peak_pci.c
+++ b/drivers/net/can/sja1000/peak_pci.c
@@ -20,7 +20,6 @@
20 */ 20 */
21 21
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/version.h>
24#include <linux/module.h> 23#include <linux/module.h>
25#include <linux/interrupt.h> 24#include <linux/interrupt.h>
26#include <linux/netdevice.h> 25#include <linux/netdevice.h>
diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig
index 6dff5a0e733..597f4d45c63 100644
--- a/drivers/net/ethernet/Kconfig
+++ b/drivers/net/ethernet/Kconfig
@@ -159,6 +159,7 @@ config S6GMAC
159 will be called s6gmac. 159 will be called s6gmac.
160 160
161source "drivers/net/ethernet/seeq/Kconfig" 161source "drivers/net/ethernet/seeq/Kconfig"
162source "drivers/net/ethernet/silan/Kconfig"
162source "drivers/net/ethernet/sis/Kconfig" 163source "drivers/net/ethernet/sis/Kconfig"
163source "drivers/net/ethernet/sfc/Kconfig" 164source "drivers/net/ethernet/sfc/Kconfig"
164source "drivers/net/ethernet/sgi/Kconfig" 165source "drivers/net/ethernet/sgi/Kconfig"
diff --git a/drivers/net/ethernet/Makefile b/drivers/net/ethernet/Makefile
index c53ad3afc99..be5dde04026 100644
--- a/drivers/net/ethernet/Makefile
+++ b/drivers/net/ethernet/Makefile
@@ -58,6 +58,7 @@ obj-$(CONFIG_SH_ETH) += renesas/
58obj-$(CONFIG_NET_VENDOR_RDC) += rdc/ 58obj-$(CONFIG_NET_VENDOR_RDC) += rdc/
59obj-$(CONFIG_S6GMAC) += s6gmac.o 59obj-$(CONFIG_S6GMAC) += s6gmac.o
60obj-$(CONFIG_NET_VENDOR_SEEQ) += seeq/ 60obj-$(CONFIG_NET_VENDOR_SEEQ) += seeq/
61obj-$(CONFIG_NET_VENDOR_SILAN) += silan/
61obj-$(CONFIG_NET_VENDOR_SIS) += sis/ 62obj-$(CONFIG_NET_VENDOR_SIS) += sis/
62obj-$(CONFIG_SFC) += sfc/ 63obj-$(CONFIG_SFC) += sfc/
63obj-$(CONFIG_NET_VENDOR_SGI) += sgi/ 64obj-$(CONFIG_NET_VENDOR_SGI) += sgi/
diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c
index 82386677bb8..4865ff14beb 100644
--- a/drivers/net/ethernet/amd/au1000_eth.c
+++ b/drivers/net/ethernet/amd/au1000_eth.c
@@ -541,19 +541,17 @@ static void au1000_reset_mac(struct net_device *dev)
541 * these are not descriptors sitting in memory. 541 * these are not descriptors sitting in memory.
542 */ 542 */
543static void 543static void
544au1000_setup_hw_rings(struct au1000_private *aup, u32 rx_base, u32 tx_base) 544au1000_setup_hw_rings(struct au1000_private *aup, void __iomem *tx_base)
545{ 545{
546 int i; 546 int i;
547 547
548 for (i = 0; i < NUM_RX_DMA; i++) { 548 for (i = 0; i < NUM_RX_DMA; i++) {
549 aup->rx_dma_ring[i] = 549 aup->rx_dma_ring[i] = (struct rx_dma *)
550 (struct rx_dma *) 550 (tx_base + 0x100 + sizeof(struct rx_dma) * i);
551 (rx_base + sizeof(struct rx_dma)*i);
552 } 551 }
553 for (i = 0; i < NUM_TX_DMA; i++) { 552 for (i = 0; i < NUM_TX_DMA; i++) {
554 aup->tx_dma_ring[i] = 553 aup->tx_dma_ring[i] = (struct tx_dma *)
555 (struct tx_dma *) 554 (tx_base + sizeof(struct tx_dma) * i);
556 (tx_base + sizeof(struct tx_dma)*i);
557 } 555 }
558} 556}
559 557
@@ -1026,7 +1024,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1026 struct net_device *dev = NULL; 1024 struct net_device *dev = NULL;
1027 struct db_dest *pDB, *pDBfree; 1025 struct db_dest *pDB, *pDBfree;
1028 int irq, i, err = 0; 1026 int irq, i, err = 0;
1029 struct resource *base, *macen; 1027 struct resource *base, *macen, *macdma;
1030 1028
1031 base = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1029 base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1032 if (!base) { 1030 if (!base) {
@@ -1049,6 +1047,13 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1049 goto out; 1047 goto out;
1050 } 1048 }
1051 1049
1050 macdma = platform_get_resource(pdev, IORESOURCE_MEM, 2);
1051 if (!macdma) {
1052 dev_err(&pdev->dev, "failed to retrieve MACDMA registers\n");
1053 err = -ENODEV;
1054 goto out;
1055 }
1056
1052 if (!request_mem_region(base->start, resource_size(base), 1057 if (!request_mem_region(base->start, resource_size(base),
1053 pdev->name)) { 1058 pdev->name)) {
1054 dev_err(&pdev->dev, "failed to request memory region for base registers\n"); 1059 dev_err(&pdev->dev, "failed to request memory region for base registers\n");
@@ -1063,6 +1068,13 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1063 goto err_request; 1068 goto err_request;
1064 } 1069 }
1065 1070
1071 if (!request_mem_region(macdma->start, resource_size(macdma),
1072 pdev->name)) {
1073 dev_err(&pdev->dev, "failed to request MACDMA memory region\n");
1074 err = -ENXIO;
1075 goto err_macdma;
1076 }
1077
1066 dev = alloc_etherdev(sizeof(struct au1000_private)); 1078 dev = alloc_etherdev(sizeof(struct au1000_private));
1067 if (!dev) { 1079 if (!dev) {
1068 dev_err(&pdev->dev, "alloc_etherdev failed\n"); 1080 dev_err(&pdev->dev, "alloc_etherdev failed\n");
@@ -1109,10 +1121,14 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1109 } 1121 }
1110 aup->mac_id = pdev->id; 1122 aup->mac_id = pdev->id;
1111 1123
1112 if (pdev->id == 0) 1124 aup->macdma = ioremap_nocache(macdma->start, resource_size(macdma));
1113 au1000_setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR); 1125 if (!aup->macdma) {
1114 else if (pdev->id == 1) 1126 dev_err(&pdev->dev, "failed to ioremap MACDMA registers\n");
1115 au1000_setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR); 1127 err = -ENXIO;
1128 goto err_remap3;
1129 }
1130
1131 au1000_setup_hw_rings(aup, aup->macdma);
1116 1132
1117 /* set a random MAC now in case platform_data doesn't provide one */ 1133 /* set a random MAC now in case platform_data doesn't provide one */
1118 random_ether_addr(dev->dev_addr); 1134 random_ether_addr(dev->dev_addr);
@@ -1252,6 +1268,8 @@ err_out:
1252err_mdiobus_reg: 1268err_mdiobus_reg:
1253 mdiobus_free(aup->mii_bus); 1269 mdiobus_free(aup->mii_bus);
1254err_mdiobus_alloc: 1270err_mdiobus_alloc:
1271 iounmap(aup->macdma);
1272err_remap3:
1255 iounmap(aup->enable); 1273 iounmap(aup->enable);
1256err_remap2: 1274err_remap2:
1257 iounmap(aup->mac); 1275 iounmap(aup->mac);
@@ -1261,6 +1279,8 @@ err_remap1:
1261err_vaddr: 1279err_vaddr:
1262 free_netdev(dev); 1280 free_netdev(dev);
1263err_alloc: 1281err_alloc:
1282 release_mem_region(macdma->start, resource_size(macdma));
1283err_macdma:
1264 release_mem_region(macen->start, resource_size(macen)); 1284 release_mem_region(macen->start, resource_size(macen));
1265err_request: 1285err_request:
1266 release_mem_region(base->start, resource_size(base)); 1286 release_mem_region(base->start, resource_size(base));
@@ -1293,9 +1313,13 @@ static int __devexit au1000_remove(struct platform_device *pdev)
1293 (NUM_TX_BUFFS + NUM_RX_BUFFS), 1313 (NUM_TX_BUFFS + NUM_RX_BUFFS),
1294 (void *)aup->vaddr, aup->dma_addr); 1314 (void *)aup->vaddr, aup->dma_addr);
1295 1315
1316 iounmap(aup->macdma);
1296 iounmap(aup->mac); 1317 iounmap(aup->mac);
1297 iounmap(aup->enable); 1318 iounmap(aup->enable);
1298 1319
1320 base = platform_get_resource(pdev, IORESOURCE_MEM, 2);
1321 release_mem_region(base->start, resource_size(base));
1322
1299 base = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1323 base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1300 release_mem_region(base->start, resource_size(base)); 1324 release_mem_region(base->start, resource_size(base));
1301 1325
diff --git a/drivers/net/ethernet/amd/au1000_eth.h b/drivers/net/ethernet/amd/au1000_eth.h
index 6229c774552..4b7f7ad62bb 100644
--- a/drivers/net/ethernet/amd/au1000_eth.h
+++ b/drivers/net/ethernet/amd/au1000_eth.h
@@ -124,7 +124,7 @@ struct au1000_private {
124 */ 124 */
125 struct mac_reg *mac; /* mac registers */ 125 struct mac_reg *mac; /* mac registers */
126 u32 *enable; /* address of MAC Enable Register */ 126 u32 *enable; /* address of MAC Enable Register */
127 127 void __iomem *macdma; /* base of MAC DMA port */
128 u32 vaddr; /* virtual address of rx/tx buffers */ 128 u32 vaddr; /* virtual address of rx/tx buffers */
129 dma_addr_t dma_addr; /* dma address of rx/tx buffers */ 129 dma_addr_t dma_addr; /* dma address of rx/tx buffers */
130 130
diff --git a/drivers/net/ethernet/apple/Kconfig b/drivers/net/ethernet/apple/Kconfig
index a759d5483ab..1375e2dc946 100644
--- a/drivers/net/ethernet/apple/Kconfig
+++ b/drivers/net/ethernet/apple/Kconfig
@@ -52,18 +52,6 @@ config BMAC
52 To compile this driver as a module, choose M here: the module 52 To compile this driver as a module, choose M here: the module
53 will be called bmac. 53 will be called bmac.
54 54
55config MAC89x0
56 tristate "Macintosh CS89x0 based ethernet cards"
57 depends on MAC
58 ---help---
59 Support for CS89x0 chipset based Ethernet cards. If you have a
60 Nubus or LC-PDS network (Ethernet) card of this type, say Y and
61 read the Ethernet-HOWTO, available from
62 <http://www.tldp.org/docs.html#howto>.
63
64 To compile this driver as a module, choose M here. This module will
65 be called mac89x0.
66
67config MACMACE 55config MACMACE
68 bool "Macintosh (AV) onboard MACE ethernet" 56 bool "Macintosh (AV) onboard MACE ethernet"
69 depends on MAC 57 depends on MAC
diff --git a/drivers/net/ethernet/apple/Makefile b/drivers/net/ethernet/apple/Makefile
index 0d3a5919c95..86eaa17af0f 100644
--- a/drivers/net/ethernet/apple/Makefile
+++ b/drivers/net/ethernet/apple/Makefile
@@ -4,5 +4,4 @@
4 4
5obj-$(CONFIG_MACE) += mace.o 5obj-$(CONFIG_MACE) += mace.o
6obj-$(CONFIG_BMAC) += bmac.o 6obj-$(CONFIG_BMAC) += bmac.o
7obj-$(CONFIG_MAC89x0) += mac89x0.o
8obj-$(CONFIG_MACMACE) += macmace.o 7obj-$(CONFIG_MACMACE) += macmace.o
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index 4cf835dbc12..3fb66d09ece 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -608,7 +608,7 @@ static void b44_tx(struct b44 *bp)
608 skb->len, 608 skb->len,
609 DMA_TO_DEVICE); 609 DMA_TO_DEVICE);
610 rp->skb = NULL; 610 rp->skb = NULL;
611 dev_kfree_skb(skb); 611 dev_kfree_skb_irq(skb);
612 } 612 }
613 613
614 bp->tx_cons = cons; 614 bp->tx_cons = cons;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index bce203fa4b9..882f48f0a03 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -10327,6 +10327,43 @@ static int bnx2x_54618se_config_init(struct bnx2x_phy *phy,
10327 return 0; 10327 return 0;
10328} 10328}
10329 10329
10330
10331static void bnx2x_5461x_set_link_led(struct bnx2x_phy *phy,
10332 struct link_params *params, u8 mode)
10333{
10334 struct bnx2x *bp = params->bp;
10335 u16 temp;
10336
10337 bnx2x_cl22_write(bp, phy,
10338 MDIO_REG_GPHY_SHADOW,
10339 MDIO_REG_GPHY_SHADOW_LED_SEL1);
10340 bnx2x_cl22_read(bp, phy,
10341 MDIO_REG_GPHY_SHADOW,
10342 &temp);
10343 temp &= 0xff00;
10344
10345 DP(NETIF_MSG_LINK, "54618x set link led (mode=%x)\n", mode);
10346 switch (mode) {
10347 case LED_MODE_FRONT_PANEL_OFF:
10348 case LED_MODE_OFF:
10349 temp |= 0x00ee;
10350 break;
10351 case LED_MODE_OPER:
10352 temp |= 0x0001;
10353 break;
10354 case LED_MODE_ON:
10355 temp |= 0x00ff;
10356 break;
10357 default:
10358 break;
10359 }
10360 bnx2x_cl22_write(bp, phy,
10361 MDIO_REG_GPHY_SHADOW,
10362 MDIO_REG_GPHY_SHADOW_WR_ENA | temp);
10363 return;
10364}
10365
10366
10330static void bnx2x_54618se_link_reset(struct bnx2x_phy *phy, 10367static void bnx2x_54618se_link_reset(struct bnx2x_phy *phy,
10331 struct link_params *params) 10368 struct link_params *params)
10332{ 10369{
@@ -11103,7 +11140,7 @@ static struct bnx2x_phy phy_54618se = {
11103 .config_loopback = (config_loopback_t)bnx2x_54618se_config_loopback, 11140 .config_loopback = (config_loopback_t)bnx2x_54618se_config_loopback,
11104 .format_fw_ver = (format_fw_ver_t)NULL, 11141 .format_fw_ver = (format_fw_ver_t)NULL,
11105 .hw_reset = (hw_reset_t)NULL, 11142 .hw_reset = (hw_reset_t)NULL,
11106 .set_link_led = (set_link_led_t)NULL, 11143 .set_link_led = (set_link_led_t)bnx2x_5461x_set_link_led,
11107 .phy_specific_func = (phy_specific_func_t)NULL 11144 .phy_specific_func = (phy_specific_func_t)NULL
11108}; 11145};
11109/*****************************************************************/ 11146/*****************************************************************/
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 6486ab8c8fc..2f6361e949f 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_reg.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
index fc7bd0f23c0..e58073ef33b 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
@@ -6990,6 +6990,7 @@ Theotherbitsarereservedandshouldbezero*/
6990#define MDIO_REG_INTR_MASK 0x1b 6990#define MDIO_REG_INTR_MASK 0x1b
6991#define MDIO_REG_INTR_MASK_LINK_STATUS (0x1 << 1) 6991#define MDIO_REG_INTR_MASK_LINK_STATUS (0x1 << 1)
6992#define MDIO_REG_GPHY_SHADOW 0x1c 6992#define MDIO_REG_GPHY_SHADOW 0x1c
6993#define MDIO_REG_GPHY_SHADOW_LED_SEL1 (0x0d << 10)
6993#define MDIO_REG_GPHY_SHADOW_LED_SEL2 (0x0e << 10) 6994#define MDIO_REG_GPHY_SHADOW_LED_SEL2 (0x0e << 10)
6994#define MDIO_REG_GPHY_SHADOW_WR_ENA (0x1 << 15) 6995#define MDIO_REG_GPHY_SHADOW_WR_ENA (0x1 << 15)
6995#define MDIO_REG_GPHY_SHADOW_AUTO_DET_MED (0x1e << 10) 6996#define MDIO_REG_GPHY_SHADOW_AUTO_DET_MED (0x1e << 10)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
index 0440425c83d..14517691f8d 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/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 161cbbb4814..bf4074167d6 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -89,10 +89,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits)
89 89
90#define DRV_MODULE_NAME "tg3" 90#define DRV_MODULE_NAME "tg3"
91#define TG3_MAJ_NUM 3 91#define TG3_MAJ_NUM 3
92#define TG3_MIN_NUM 120 92#define TG3_MIN_NUM 121
93#define DRV_MODULE_VERSION \ 93#define DRV_MODULE_VERSION \
94 __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) 94 __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM)
95#define DRV_MODULE_RELDATE "August 18, 2011" 95#define DRV_MODULE_RELDATE "November 2, 2011"
96 96
97#define RESET_KIND_SHUTDOWN 0 97#define RESET_KIND_SHUTDOWN 0
98#define RESET_KIND_INIT 1 98#define RESET_KIND_INIT 1
@@ -628,19 +628,23 @@ static void tg3_ape_lock_init(struct tg3 *tp)
628 regbase = TG3_APE_PER_LOCK_GRANT; 628 regbase = TG3_APE_PER_LOCK_GRANT;
629 629
630 /* Make sure the driver hasn't any stale locks. */ 630 /* Make sure the driver hasn't any stale locks. */
631 for (i = 0; i < 8; i++) { 631 for (i = TG3_APE_LOCK_PHY0; i <= TG3_APE_LOCK_GPIO; i++) {
632 if (i == TG3_APE_LOCK_GPIO) 632 switch (i) {
633 continue; 633 case TG3_APE_LOCK_PHY0:
634 tg3_ape_write32(tp, regbase + 4 * i, APE_LOCK_GRANT_DRIVER); 634 case TG3_APE_LOCK_PHY1:
635 case TG3_APE_LOCK_PHY2:
636 case TG3_APE_LOCK_PHY3:
637 bit = APE_LOCK_GRANT_DRIVER;
638 break;
639 default:
640 if (!tp->pci_fn)
641 bit = APE_LOCK_GRANT_DRIVER;
642 else
643 bit = 1 << tp->pci_fn;
644 }
645 tg3_ape_write32(tp, regbase + 4 * i, bit);
635 } 646 }
636 647
637 /* Clear the correct bit of the GPIO lock too. */
638 if (!tp->pci_fn)
639 bit = APE_LOCK_GRANT_DRIVER;
640 else
641 bit = 1 << tp->pci_fn;
642
643 tg3_ape_write32(tp, regbase + 4 * TG3_APE_LOCK_GPIO, bit);
644} 648}
645 649
646static int tg3_ape_lock(struct tg3 *tp, int locknum) 650static int tg3_ape_lock(struct tg3 *tp, int locknum)
@@ -658,6 +662,10 @@ static int tg3_ape_lock(struct tg3 *tp, int locknum)
658 return 0; 662 return 0;
659 case TG3_APE_LOCK_GRC: 663 case TG3_APE_LOCK_GRC:
660 case TG3_APE_LOCK_MEM: 664 case TG3_APE_LOCK_MEM:
665 if (!tp->pci_fn)
666 bit = APE_LOCK_REQ_DRIVER;
667 else
668 bit = 1 << tp->pci_fn;
661 break; 669 break;
662 default: 670 default:
663 return -EINVAL; 671 return -EINVAL;
@@ -673,11 +681,6 @@ static int tg3_ape_lock(struct tg3 *tp, int locknum)
673 681
674 off = 4 * locknum; 682 off = 4 * locknum;
675 683
676 if (locknum != TG3_APE_LOCK_GPIO || !tp->pci_fn)
677 bit = APE_LOCK_REQ_DRIVER;
678 else
679 bit = 1 << tp->pci_fn;
680
681 tg3_ape_write32(tp, req + off, bit); 684 tg3_ape_write32(tp, req + off, bit);
682 685
683 /* Wait for up to 1 millisecond to acquire lock. */ 686 /* Wait for up to 1 millisecond to acquire lock. */
@@ -710,6 +713,10 @@ static void tg3_ape_unlock(struct tg3 *tp, int locknum)
710 return; 713 return;
711 case TG3_APE_LOCK_GRC: 714 case TG3_APE_LOCK_GRC:
712 case TG3_APE_LOCK_MEM: 715 case TG3_APE_LOCK_MEM:
716 if (!tp->pci_fn)
717 bit = APE_LOCK_GRANT_DRIVER;
718 else
719 bit = 1 << tp->pci_fn;
713 break; 720 break;
714 default: 721 default:
715 return; 722 return;
@@ -720,11 +727,6 @@ static void tg3_ape_unlock(struct tg3 *tp, int locknum)
720 else 727 else
721 gnt = TG3_APE_PER_LOCK_GRANT; 728 gnt = TG3_APE_PER_LOCK_GRANT;
722 729
723 if (locknum != TG3_APE_LOCK_GPIO || !tp->pci_fn)
724 bit = APE_LOCK_GRANT_DRIVER;
725 else
726 bit = 1 << tp->pci_fn;
727
728 tg3_ape_write32(tp, gnt + 4 * locknum, bit); 730 tg3_ape_write32(tp, gnt + 4 * locknum, bit);
729} 731}
730 732
@@ -5927,6 +5929,18 @@ static int tg3_poll_work(struct tg3_napi *tnapi, int work_done, int budget)
5927 return work_done; 5929 return work_done;
5928} 5930}
5929 5931
5932static inline void tg3_reset_task_schedule(struct tg3 *tp)
5933{
5934 if (!test_and_set_bit(TG3_FLAG_RESET_TASK_PENDING, tp->tg3_flags))
5935 schedule_work(&tp->reset_task);
5936}
5937
5938static inline void tg3_reset_task_cancel(struct tg3 *tp)
5939{
5940 cancel_work_sync(&tp->reset_task);
5941 tg3_flag_clear(tp, RESET_TASK_PENDING);
5942}
5943
5930static int tg3_poll_msix(struct napi_struct *napi, int budget) 5944static int tg3_poll_msix(struct napi_struct *napi, int budget)
5931{ 5945{
5932 struct tg3_napi *tnapi = container_of(napi, struct tg3_napi, napi); 5946 struct tg3_napi *tnapi = container_of(napi, struct tg3_napi, napi);
@@ -5967,7 +5981,7 @@ static int tg3_poll_msix(struct napi_struct *napi, int budget)
5967tx_recovery: 5981tx_recovery:
5968 /* work_done is guaranteed to be less than budget. */ 5982 /* work_done is guaranteed to be less than budget. */
5969 napi_complete(napi); 5983 napi_complete(napi);
5970 schedule_work(&tp->reset_task); 5984 tg3_reset_task_schedule(tp);
5971 return work_done; 5985 return work_done;
5972} 5986}
5973 5987
@@ -6002,7 +6016,7 @@ static void tg3_process_error(struct tg3 *tp)
6002 tg3_dump_state(tp); 6016 tg3_dump_state(tp);
6003 6017
6004 tg3_flag_set(tp, ERROR_PROCESSED); 6018 tg3_flag_set(tp, ERROR_PROCESSED);
6005 schedule_work(&tp->reset_task); 6019 tg3_reset_task_schedule(tp);
6006} 6020}
6007 6021
6008static int tg3_poll(struct napi_struct *napi, int budget) 6022static int tg3_poll(struct napi_struct *napi, int budget)
@@ -6049,7 +6063,7 @@ static int tg3_poll(struct napi_struct *napi, int budget)
6049tx_recovery: 6063tx_recovery:
6050 /* work_done is guaranteed to be less than budget. */ 6064 /* work_done is guaranteed to be less than budget. */
6051 napi_complete(napi); 6065 napi_complete(napi);
6052 schedule_work(&tp->reset_task); 6066 tg3_reset_task_schedule(tp);
6053 return work_done; 6067 return work_done;
6054} 6068}
6055 6069
@@ -6338,11 +6352,11 @@ static void tg3_reset_task(struct work_struct *work)
6338{ 6352{
6339 struct tg3 *tp = container_of(work, struct tg3, reset_task); 6353 struct tg3 *tp = container_of(work, struct tg3, reset_task);
6340 int err; 6354 int err;
6341 unsigned int restart_timer;
6342 6355
6343 tg3_full_lock(tp, 0); 6356 tg3_full_lock(tp, 0);
6344 6357
6345 if (!netif_running(tp->dev)) { 6358 if (!netif_running(tp->dev)) {
6359 tg3_flag_clear(tp, RESET_TASK_PENDING);
6346 tg3_full_unlock(tp); 6360 tg3_full_unlock(tp);
6347 return; 6361 return;
6348 } 6362 }
@@ -6355,9 +6369,6 @@ static void tg3_reset_task(struct work_struct *work)
6355 6369
6356 tg3_full_lock(tp, 1); 6370 tg3_full_lock(tp, 1);
6357 6371
6358 restart_timer = tg3_flag(tp, RESTART_TIMER);
6359 tg3_flag_clear(tp, RESTART_TIMER);
6360
6361 if (tg3_flag(tp, TX_RECOVERY_PENDING)) { 6372 if (tg3_flag(tp, TX_RECOVERY_PENDING)) {
6362 tp->write32_tx_mbox = tg3_write32_tx_mbox; 6373 tp->write32_tx_mbox = tg3_write32_tx_mbox;
6363 tp->write32_rx_mbox = tg3_write_flush_reg32; 6374 tp->write32_rx_mbox = tg3_write_flush_reg32;
@@ -6372,14 +6383,13 @@ static void tg3_reset_task(struct work_struct *work)
6372 6383
6373 tg3_netif_start(tp); 6384 tg3_netif_start(tp);
6374 6385
6375 if (restart_timer)
6376 mod_timer(&tp->timer, jiffies + 1);
6377
6378out: 6386out:
6379 tg3_full_unlock(tp); 6387 tg3_full_unlock(tp);
6380 6388
6381 if (!err) 6389 if (!err)
6382 tg3_phy_start(tp); 6390 tg3_phy_start(tp);
6391
6392 tg3_flag_clear(tp, RESET_TASK_PENDING);
6383} 6393}
6384 6394
6385static void tg3_tx_timeout(struct net_device *dev) 6395static void tg3_tx_timeout(struct net_device *dev)
@@ -6391,7 +6401,7 @@ static void tg3_tx_timeout(struct net_device *dev)
6391 tg3_dump_state(tp); 6401 tg3_dump_state(tp);
6392 } 6402 }
6393 6403
6394 schedule_work(&tp->reset_task); 6404 tg3_reset_task_schedule(tp);
6395} 6405}
6396 6406
6397/* Test for DMA buffers crossing any 4GB boundaries: 4G, 8G, etc */ 6407/* Test for DMA buffers crossing any 4GB boundaries: 4G, 8G, etc */
@@ -6442,31 +6452,26 @@ static bool tg3_tx_frag_set(struct tg3_napi *tnapi, u32 *entry, u32 *budget,
6442 hwbug = 1; 6452 hwbug = 1;
6443 6453
6444 if (tg3_flag(tp, 4K_FIFO_LIMIT)) { 6454 if (tg3_flag(tp, 4K_FIFO_LIMIT)) {
6455 u32 prvidx = *entry;
6445 u32 tmp_flag = flags & ~TXD_FLAG_END; 6456 u32 tmp_flag = flags & ~TXD_FLAG_END;
6446 while (len > TG3_TX_BD_DMA_MAX) { 6457 while (len > TG3_TX_BD_DMA_MAX && *budget) {
6447 u32 frag_len = TG3_TX_BD_DMA_MAX; 6458 u32 frag_len = TG3_TX_BD_DMA_MAX;
6448 len -= TG3_TX_BD_DMA_MAX; 6459 len -= TG3_TX_BD_DMA_MAX;
6449 6460
6450 if (len) { 6461 /* Avoid the 8byte DMA problem */
6451 tnapi->tx_buffers[*entry].fragmented = true; 6462 if (len <= 8) {
6452 /* Avoid the 8byte DMA problem */ 6463 len += TG3_TX_BD_DMA_MAX / 2;
6453 if (len <= 8) { 6464 frag_len = TG3_TX_BD_DMA_MAX / 2;
6454 len += TG3_TX_BD_DMA_MAX / 2;
6455 frag_len = TG3_TX_BD_DMA_MAX / 2;
6456 }
6457 } else
6458 tmp_flag = flags;
6459
6460 if (*budget) {
6461 tg3_tx_set_bd(&tnapi->tx_ring[*entry], map,
6462 frag_len, tmp_flag, mss, vlan);
6463 (*budget)--;
6464 *entry = NEXT_TX(*entry);
6465 } else {
6466 hwbug = 1;
6467 break;
6468 } 6465 }
6469 6466
6467 tnapi->tx_buffers[*entry].fragmented = true;
6468
6469 tg3_tx_set_bd(&tnapi->tx_ring[*entry], map,
6470 frag_len, tmp_flag, mss, vlan);
6471 *budget -= 1;
6472 prvidx = *entry;
6473 *entry = NEXT_TX(*entry);
6474
6470 map += frag_len; 6475 map += frag_len;
6471 } 6476 }
6472 6477
@@ -6474,10 +6479,11 @@ static bool tg3_tx_frag_set(struct tg3_napi *tnapi, u32 *entry, u32 *budget,
6474 if (*budget) { 6479 if (*budget) {
6475 tg3_tx_set_bd(&tnapi->tx_ring[*entry], map, 6480 tg3_tx_set_bd(&tnapi->tx_ring[*entry], map,
6476 len, flags, mss, vlan); 6481 len, flags, mss, vlan);
6477 (*budget)--; 6482 *budget -= 1;
6478 *entry = NEXT_TX(*entry); 6483 *entry = NEXT_TX(*entry);
6479 } else { 6484 } else {
6480 hwbug = 1; 6485 hwbug = 1;
6486 tnapi->tx_buffers[prvidx].fragmented = false;
6481 } 6487 }
6482 } 6488 }
6483 } else { 6489 } else {
@@ -6509,7 +6515,7 @@ static void tg3_tx_skb_unmap(struct tg3_napi *tnapi, u32 entry, int last)
6509 txb = &tnapi->tx_buffers[entry]; 6515 txb = &tnapi->tx_buffers[entry];
6510 } 6516 }
6511 6517
6512 for (i = 0; i < last; i++) { 6518 for (i = 0; i <= last; i++) {
6513 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; 6519 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
6514 6520
6515 entry = NEXT_TX(entry); 6521 entry = NEXT_TX(entry);
@@ -6559,6 +6565,8 @@ static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi,
6559 dev_kfree_skb(new_skb); 6565 dev_kfree_skb(new_skb);
6560 ret = -1; 6566 ret = -1;
6561 } else { 6567 } else {
6568 u32 save_entry = *entry;
6569
6562 base_flags |= TXD_FLAG_END; 6570 base_flags |= TXD_FLAG_END;
6563 6571
6564 tnapi->tx_buffers[*entry].skb = new_skb; 6572 tnapi->tx_buffers[*entry].skb = new_skb;
@@ -6568,7 +6576,7 @@ static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi,
6568 if (tg3_tx_frag_set(tnapi, entry, budget, new_addr, 6576 if (tg3_tx_frag_set(tnapi, entry, budget, new_addr,
6569 new_skb->len, base_flags, 6577 new_skb->len, base_flags,
6570 mss, vlan)) { 6578 mss, vlan)) {
6571 tg3_tx_skb_unmap(tnapi, *entry, 0); 6579 tg3_tx_skb_unmap(tnapi, save_entry, -1);
6572 dev_kfree_skb(new_skb); 6580 dev_kfree_skb(new_skb);
6573 ret = -1; 6581 ret = -1;
6574 } 6582 }
@@ -6758,11 +6766,10 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
6758 6766
6759 if (tg3_tx_frag_set(tnapi, &entry, &budget, mapping, len, base_flags | 6767 if (tg3_tx_frag_set(tnapi, &entry, &budget, mapping, len, base_flags |
6760 ((skb_shinfo(skb)->nr_frags == 0) ? TXD_FLAG_END : 0), 6768 ((skb_shinfo(skb)->nr_frags == 0) ? TXD_FLAG_END : 0),
6761 mss, vlan)) 6769 mss, vlan)) {
6762 would_hit_hwbug = 1; 6770 would_hit_hwbug = 1;
6763
6764 /* Now loop through additional data fragments, and queue them. */ 6771 /* Now loop through additional data fragments, and queue them. */
6765 if (skb_shinfo(skb)->nr_frags > 0) { 6772 } else if (skb_shinfo(skb)->nr_frags > 0) {
6766 u32 tmp_mss = mss; 6773 u32 tmp_mss = mss;
6767 6774
6768 if (!tg3_flag(tp, HW_TSO_1) && 6775 if (!tg3_flag(tp, HW_TSO_1) &&
@@ -6784,11 +6791,14 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
6784 if (dma_mapping_error(&tp->pdev->dev, mapping)) 6791 if (dma_mapping_error(&tp->pdev->dev, mapping))
6785 goto dma_error; 6792 goto dma_error;
6786 6793
6787 if (tg3_tx_frag_set(tnapi, &entry, &budget, mapping, 6794 if (!budget ||
6795 tg3_tx_frag_set(tnapi, &entry, &budget, mapping,
6788 len, base_flags | 6796 len, base_flags |
6789 ((i == last) ? TXD_FLAG_END : 0), 6797 ((i == last) ? TXD_FLAG_END : 0),
6790 tmp_mss, vlan)) 6798 tmp_mss, vlan)) {
6791 would_hit_hwbug = 1; 6799 would_hit_hwbug = 1;
6800 break;
6801 }
6792 } 6802 }
6793 } 6803 }
6794 6804
@@ -6828,7 +6838,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
6828 return NETDEV_TX_OK; 6838 return NETDEV_TX_OK;
6829 6839
6830dma_error: 6840dma_error:
6831 tg3_tx_skb_unmap(tnapi, tnapi->tx_prod, i); 6841 tg3_tx_skb_unmap(tnapi, tnapi->tx_prod, --i);
6832 tnapi->tx_buffers[tnapi->tx_prod].skb = NULL; 6842 tnapi->tx_buffers[tnapi->tx_prod].skb = NULL;
6833drop: 6843drop:
6834 dev_kfree_skb(skb); 6844 dev_kfree_skb(skb);
@@ -7281,7 +7291,8 @@ static void tg3_free_rings(struct tg3 *tp)
7281 if (!skb) 7291 if (!skb)
7282 continue; 7292 continue;
7283 7293
7284 tg3_tx_skb_unmap(tnapi, i, skb_shinfo(skb)->nr_frags); 7294 tg3_tx_skb_unmap(tnapi, i,
7295 skb_shinfo(skb)->nr_frags - 1);
7285 7296
7286 dev_kfree_skb_any(skb); 7297 dev_kfree_skb_any(skb);
7287 } 7298 }
@@ -9200,7 +9211,7 @@ static void tg3_timer(unsigned long __opaque)
9200{ 9211{
9201 struct tg3 *tp = (struct tg3 *) __opaque; 9212 struct tg3 *tp = (struct tg3 *) __opaque;
9202 9213
9203 if (tp->irq_sync) 9214 if (tp->irq_sync || tg3_flag(tp, RESET_TASK_PENDING))
9204 goto restart_timer; 9215 goto restart_timer;
9205 9216
9206 spin_lock(&tp->lock); 9217 spin_lock(&tp->lock);
@@ -9223,10 +9234,9 @@ static void tg3_timer(unsigned long __opaque)
9223 } 9234 }
9224 9235
9225 if (!(tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { 9236 if (!(tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) {
9226 tg3_flag_set(tp, RESTART_TIMER);
9227 spin_unlock(&tp->lock); 9237 spin_unlock(&tp->lock);
9228 schedule_work(&tp->reset_task); 9238 tg3_reset_task_schedule(tp);
9229 return; 9239 goto restart_timer;
9230 } 9240 }
9231 } 9241 }
9232 9242
@@ -9674,15 +9684,14 @@ static int tg3_open(struct net_device *dev)
9674 struct tg3_napi *tnapi = &tp->napi[i]; 9684 struct tg3_napi *tnapi = &tp->napi[i];
9675 err = tg3_request_irq(tp, i); 9685 err = tg3_request_irq(tp, i);
9676 if (err) { 9686 if (err) {
9677 for (i--; i >= 0; i--) 9687 for (i--; i >= 0; i--) {
9688 tnapi = &tp->napi[i];
9678 free_irq(tnapi->irq_vec, tnapi); 9689 free_irq(tnapi->irq_vec, tnapi);
9679 break; 9690 }
9691 goto err_out2;
9680 } 9692 }
9681 } 9693 }
9682 9694
9683 if (err)
9684 goto err_out2;
9685
9686 tg3_full_lock(tp, 0); 9695 tg3_full_lock(tp, 0);
9687 9696
9688 err = tg3_init_hw(tp, 1); 9697 err = tg3_init_hw(tp, 1);
@@ -9783,7 +9792,7 @@ static int tg3_close(struct net_device *dev)
9783 struct tg3 *tp = netdev_priv(dev); 9792 struct tg3 *tp = netdev_priv(dev);
9784 9793
9785 tg3_napi_disable(tp); 9794 tg3_napi_disable(tp);
9786 cancel_work_sync(&tp->reset_task); 9795 tg3_reset_task_cancel(tp);
9787 9796
9788 netif_tx_stop_all_queues(dev); 9797 netif_tx_stop_all_queues(dev);
9789 9798
@@ -11520,7 +11529,7 @@ static int tg3_run_loopback(struct tg3 *tp, u32 pktsz, bool tso_loopback)
11520 break; 11529 break;
11521 } 11530 }
11522 11531
11523 tg3_tx_skb_unmap(tnapi, tnapi->tx_prod - 1, 0); 11532 tg3_tx_skb_unmap(tnapi, tnapi->tx_prod - 1, -1);
11524 dev_kfree_skb(skb); 11533 dev_kfree_skb(skb);
11525 11534
11526 if (tx_idx != tnapi->tx_prod) 11535 if (tx_idx != tnapi->tx_prod)
@@ -14228,12 +14237,30 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
14228 val = tr32(MEMARB_MODE); 14237 val = tr32(MEMARB_MODE);
14229 tw32(MEMARB_MODE, val | MEMARB_MODE_ENABLE); 14238 tw32(MEMARB_MODE, val | MEMARB_MODE_ENABLE);
14230 14239
14231 if (tg3_flag(tp, PCIX_MODE)) { 14240 tp->pci_fn = PCI_FUNC(tp->pdev->devfn) & 3;
14232 pci_read_config_dword(tp->pdev, 14241 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 ||
14233 tp->pcix_cap + PCI_X_STATUS, &val); 14242 tg3_flag(tp, 5780_CLASS)) {
14234 tp->pci_fn = val & 0x7; 14243 if (tg3_flag(tp, PCIX_MODE)) {
14235 } else { 14244 pci_read_config_dword(tp->pdev,
14236 tp->pci_fn = PCI_FUNC(tp->pdev->devfn) & 3; 14245 tp->pcix_cap + PCI_X_STATUS,
14246 &val);
14247 tp->pci_fn = val & 0x7;
14248 }
14249 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) {
14250 tg3_read_mem(tp, NIC_SRAM_CPMU_STATUS, &val);
14251 if ((val & NIC_SRAM_CPMUSTAT_SIG_MSK) ==
14252 NIC_SRAM_CPMUSTAT_SIG) {
14253 tp->pci_fn = val & TG3_CPMU_STATUS_FMSK_5717;
14254 tp->pci_fn = tp->pci_fn ? 1 : 0;
14255 }
14256 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
14257 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) {
14258 tg3_read_mem(tp, NIC_SRAM_CPMU_STATUS, &val);
14259 if ((val & NIC_SRAM_CPMUSTAT_SIG_MSK) ==
14260 NIC_SRAM_CPMUSTAT_SIG) {
14261 tp->pci_fn = (val & TG3_CPMU_STATUS_FMSK_5719) >>
14262 TG3_CPMU_STATUS_FSHFT_5719;
14263 }
14237 } 14264 }
14238 14265
14239 /* Get eeprom hw config before calling tg3_set_power_state(). 14266 /* Get eeprom hw config before calling tg3_set_power_state().
@@ -15665,7 +15692,7 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev)
15665 if (tp->fw) 15692 if (tp->fw)
15666 release_firmware(tp->fw); 15693 release_firmware(tp->fw);
15667 15694
15668 cancel_work_sync(&tp->reset_task); 15695 tg3_reset_task_cancel(tp);
15669 15696
15670 if (tg3_flag(tp, USE_PHYLIB)) { 15697 if (tg3_flag(tp, USE_PHYLIB)) {
15671 tg3_phy_fini(tp); 15698 tg3_phy_fini(tp);
@@ -15699,7 +15726,7 @@ static int tg3_suspend(struct device *device)
15699 if (!netif_running(dev)) 15726 if (!netif_running(dev))
15700 return 0; 15727 return 0;
15701 15728
15702 flush_work_sync(&tp->reset_task); 15729 tg3_reset_task_cancel(tp);
15703 tg3_phy_stop(tp); 15730 tg3_phy_stop(tp);
15704 tg3_netif_stop(tp); 15731 tg3_netif_stop(tp);
15705 15732
@@ -15812,12 +15839,10 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev,
15812 tg3_netif_stop(tp); 15839 tg3_netif_stop(tp);
15813 15840
15814 del_timer_sync(&tp->timer); 15841 del_timer_sync(&tp->timer);
15815 tg3_flag_clear(tp, RESTART_TIMER);
15816 15842
15817 /* Want to make sure that the reset task doesn't run */ 15843 /* Want to make sure that the reset task doesn't run */
15818 cancel_work_sync(&tp->reset_task); 15844 tg3_reset_task_cancel(tp);
15819 tg3_flag_clear(tp, TX_RECOVERY_PENDING); 15845 tg3_flag_clear(tp, TX_RECOVERY_PENDING);
15820 tg3_flag_clear(tp, RESTART_TIMER);
15821 15846
15822 netif_device_detach(netdev); 15847 netif_device_detach(netdev);
15823 15848
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h
index f32f288134c..94b4bd049a3 100644
--- a/drivers/net/ethernet/broadcom/tg3.h
+++ b/drivers/net/ethernet/broadcom/tg3.h
@@ -1095,6 +1095,11 @@
1095#define TG3_CPMU_CLCK_ORIDE 0x00003624 1095#define TG3_CPMU_CLCK_ORIDE 0x00003624
1096#define CPMU_CLCK_ORIDE_MAC_ORIDE_EN 0x80000000 1096#define CPMU_CLCK_ORIDE_MAC_ORIDE_EN 0x80000000
1097 1097
1098#define TG3_CPMU_STATUS 0x0000362c
1099#define TG3_CPMU_STATUS_FMSK_5717 0x20000000
1100#define TG3_CPMU_STATUS_FMSK_5719 0xc0000000
1101#define TG3_CPMU_STATUS_FSHFT_5719 30
1102
1098#define TG3_CPMU_CLCK_STAT 0x00003630 1103#define TG3_CPMU_CLCK_STAT 0x00003630
1099#define CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001f0000 1104#define CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001f0000
1100#define CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000 1105#define CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000
@@ -2128,6 +2133,10 @@
2128#define NIC_SRAM_RGMII_EXT_IBND_RX_EN 0x00000008 2133#define NIC_SRAM_RGMII_EXT_IBND_RX_EN 0x00000008
2129#define NIC_SRAM_RGMII_EXT_IBND_TX_EN 0x00000010 2134#define NIC_SRAM_RGMII_EXT_IBND_TX_EN 0x00000010
2130 2135
2136#define NIC_SRAM_CPMU_STATUS 0x00000e00
2137#define NIC_SRAM_CPMUSTAT_SIG 0x0000362c
2138#define NIC_SRAM_CPMUSTAT_SIG_MSK 0x0000ffff
2139
2131#define NIC_SRAM_RX_MINI_BUFFER_DESC 0x00001000 2140#define NIC_SRAM_RX_MINI_BUFFER_DESC 0x00001000
2132 2141
2133#define NIC_SRAM_DMA_DESC_POOL_BASE 0x00002000 2142#define NIC_SRAM_DMA_DESC_POOL_BASE 0x00002000
@@ -2344,9 +2353,13 @@
2344#define APE_PER_LOCK_GRANT_DRIVER 0x00001000 2353#define APE_PER_LOCK_GRANT_DRIVER 0x00001000
2345 2354
2346/* APE convenience enumerations. */ 2355/* APE convenience enumerations. */
2347#define TG3_APE_LOCK_GRC 1 2356#define TG3_APE_LOCK_PHY0 0
2348#define TG3_APE_LOCK_MEM 4 2357#define TG3_APE_LOCK_GRC 1
2349#define TG3_APE_LOCK_GPIO 7 2358#define TG3_APE_LOCK_PHY1 2
2359#define TG3_APE_LOCK_PHY2 3
2360#define TG3_APE_LOCK_MEM 4
2361#define TG3_APE_LOCK_PHY3 5
2362#define TG3_APE_LOCK_GPIO 7
2350 2363
2351#define TG3_EEPROM_SB_F1R2_MBA_OFF 0x10 2364#define TG3_EEPROM_SB_F1R2_MBA_OFF 0x10
2352 2365
@@ -2866,7 +2879,6 @@ enum TG3_FLAGS {
2866 TG3_FLAG_JUMBO_CAPABLE, 2879 TG3_FLAG_JUMBO_CAPABLE,
2867 TG3_FLAG_CHIP_RESETTING, 2880 TG3_FLAG_CHIP_RESETTING,
2868 TG3_FLAG_INIT_COMPLETE, 2881 TG3_FLAG_INIT_COMPLETE,
2869 TG3_FLAG_RESTART_TIMER,
2870 TG3_FLAG_TSO_BUG, 2882 TG3_FLAG_TSO_BUG,
2871 TG3_FLAG_IS_5788, 2883 TG3_FLAG_IS_5788,
2872 TG3_FLAG_MAX_RXPEND_64, 2884 TG3_FLAG_MAX_RXPEND_64,
@@ -2909,6 +2921,7 @@ enum TG3_FLAGS {
2909 TG3_FLAG_APE_HAS_NCSI, 2921 TG3_FLAG_APE_HAS_NCSI,
2910 TG3_FLAG_5717_PLUS, 2922 TG3_FLAG_5717_PLUS,
2911 TG3_FLAG_4K_FIFO_LIMIT, 2923 TG3_FLAG_4K_FIFO_LIMIT,
2924 TG3_FLAG_RESET_TASK_PENDING,
2912 2925
2913 /* Add new flags before this comment and TG3_FLAG_NUMBER_OF_FLAGS */ 2926 /* Add new flags before this comment and TG3_FLAG_NUMBER_OF_FLAGS */
2914 TG3_FLAG_NUMBER_OF_FLAGS, /* Last entry in enum TG3_FLAGS */ 2927 TG3_FLAG_NUMBER_OF_FLAGS, /* Last entry in enum TG3_FLAGS */
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c
index 5d7872ecff5..7f3091e7eb4 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -25,6 +25,7 @@
25#include <linux/if_ether.h> 25#include <linux/if_ether.h>
26#include <linux/ip.h> 26#include <linux/ip.h>
27#include <linux/prefetch.h> 27#include <linux/prefetch.h>
28#include <linux/module.h>
28 29
29#include "bnad.h" 30#include "bnad.h"
30#include "bna.h" 31#include "bna.h"
diff --git a/drivers/net/ethernet/cadence/Kconfig b/drivers/net/ethernet/cadence/Kconfig
index 98849a1fc74..b48378a41e4 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/chelsio/cxgb3/cxgb3_offload.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
index da5a5d9b8af..90ff1318cc0 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
@@ -40,6 +40,7 @@
40#include <net/netevent.h> 40#include <net/netevent.h>
41#include <linux/highmem.h> 41#include <linux/highmem.h>
42#include <linux/vmalloc.h> 42#include <linux/vmalloc.h>
43#include <linux/export.h>
43 44
44#include "common.h" 45#include "common.h"
45#include "regs.h" 46#include "regs.h"
diff --git a/drivers/net/ethernet/chelsio/cxgb3/l2t.c b/drivers/net/ethernet/chelsio/cxgb3/l2t.c
index 41540978a17..70fec8b1140 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/l2t.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/l2t.c
@@ -35,6 +35,7 @@
35#include <linux/if_vlan.h> 35#include <linux/if_vlan.h>
36#include <linux/jhash.h> 36#include <linux/jhash.h>
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/export.h>
38#include <net/neighbour.h> 39#include <net/neighbour.h>
39#include "common.h" 40#include "common.h"
40#include "t3cdev.h" 41#include "t3cdev.h"
diff --git a/drivers/net/ethernet/chelsio/cxgb4/l2t.c b/drivers/net/ethernet/chelsio/cxgb4/l2t.c
index a2d323c473f..6ac77a62f36 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/l2t.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/l2t.c
@@ -37,6 +37,9 @@
37#include <linux/if.h> 37#include <linux/if.h>
38#include <linux/if_vlan.h> 38#include <linux/if_vlan.h>
39#include <linux/jhash.h> 39#include <linux/jhash.h>
40#include <linux/module.h>
41#include <linux/debugfs.h>
42#include <linux/seq_file.h>
40#include <net/neighbour.h> 43#include <net/neighbour.h>
41#include "cxgb4.h" 44#include "cxgb4.h"
42#include "l2t.h" 45#include "l2t.h"
@@ -503,10 +506,6 @@ struct l2t_data *t4_init_l2t(void)
503 return d; 506 return d;
504} 507}
505 508
506#include <linux/module.h>
507#include <linux/debugfs.h>
508#include <linux/seq_file.h>
509
510static inline void *l2t_get_idx(struct seq_file *seq, loff_t pos) 509static inline void *l2t_get_idx(struct seq_file *seq, loff_t pos)
511{ 510{
512 struct l2t_entry *l2tab = seq->private; 511 struct l2t_entry *l2tab = seq->private;
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index ddc16985d0f..140254c7cba 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -40,6 +40,7 @@
40#include <linux/dma-mapping.h> 40#include <linux/dma-mapping.h>
41#include <linux/jiffies.h> 41#include <linux/jiffies.h>
42#include <linux/prefetch.h> 42#include <linux/prefetch.h>
43#include <linux/export.h>
43#include <net/ipv6.h> 44#include <net/ipv6.h>
44#include <net/tcp.h> 45#include <net/tcp.h>
45#include "cxgb4.h" 46#include "cxgb4.h"
diff --git a/drivers/net/ethernet/cirrus/Kconfig b/drivers/net/ethernet/cirrus/Kconfig
index 6cbb81ccc02..1f8648f099c 100644
--- a/drivers/net/ethernet/cirrus/Kconfig
+++ b/drivers/net/ethernet/cirrus/Kconfig
@@ -6,7 +6,7 @@ config NET_VENDOR_CIRRUS
6 bool "Cirrus devices" 6 bool "Cirrus devices"
7 default y 7 default y
8 depends on ISA || EISA || MACH_IXDP2351 || ARCH_IXDP2X01 \ 8 depends on ISA || EISA || MACH_IXDP2351 || ARCH_IXDP2X01 \
9 || MACH_MX31ADS || MACH_QQ2440 || (ARM && ARCH_EP93XX) 9 || MACH_MX31ADS || MACH_QQ2440 || (ARM && ARCH_EP93XX) || MAC
10 ---help--- 10 ---help---
11 If you have a network (Ethernet) card belonging to this class, say Y 11 If you have a network (Ethernet) card belonging to this class, say Y
12 and read the Ethernet-HOWTO, available from 12 and read the Ethernet-HOWTO, available from
@@ -47,4 +47,16 @@ config EP93XX_ETH
47 This is a driver for the ethernet hardware included in EP93xx CPUs. 47 This is a driver for the ethernet hardware included in EP93xx CPUs.
48 Say Y if you are building a kernel for EP93xx based devices. 48 Say Y if you are building a kernel for EP93xx based devices.
49 49
50config MAC89x0
51 tristate "Macintosh CS89x0 based ethernet cards"
52 depends on MAC
53 ---help---
54 Support for CS89x0 chipset based Ethernet cards. If you have a
55 Nubus or LC-PDS network (Ethernet) card of this type, say Y and
56 read the Ethernet-HOWTO, available from
57 <http://www.tldp.org/docs.html#howto>.
58
59 To compile this driver as a module, choose M here. This module will
60 be called mac89x0.
61
50endif # NET_VENDOR_CIRRUS 62endif # NET_VENDOR_CIRRUS
diff --git a/drivers/net/ethernet/cirrus/Makefile b/drivers/net/ethernet/cirrus/Makefile
index 14bd77e0cb5..ca245e2b5d9 100644
--- a/drivers/net/ethernet/cirrus/Makefile
+++ b/drivers/net/ethernet/cirrus/Makefile
@@ -4,3 +4,4 @@
4 4
5obj-$(CONFIG_CS89x0) += cs89x0.o 5obj-$(CONFIG_CS89x0) += cs89x0.o
6obj-$(CONFIG_EP93XX_ETH) += ep93xx_eth.o 6obj-$(CONFIG_EP93XX_ETH) += ep93xx_eth.o
7obj-$(CONFIG_MAC89x0) += mac89x0.o
diff --git a/drivers/net/ethernet/apple/mac89x0.c b/drivers/net/ethernet/cirrus/mac89x0.c
index 83781f316d1..83781f316d1 100644
--- a/drivers/net/ethernet/apple/mac89x0.c
+++ b/drivers/net/ethernet/cirrus/mac89x0.c
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
index 438f4580bf6..2a22f525635 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -613,7 +613,7 @@ static int dm9000_set_wol(struct net_device *dev, struct ethtool_wolinfo *w)
613 613
614 if (!dm->wake_state) 614 if (!dm->wake_state)
615 irq_set_irq_wake(dm->irq_wake, 1); 615 irq_set_irq_wake(dm->irq_wake, 1);
616 else if (dm->wake_state & !opts) 616 else if (dm->wake_state && !opts)
617 irq_set_irq_wake(dm->irq_wake, 0); 617 irq_set_irq_wake(dm->irq_wake, 0);
618 } 618 }
619 619
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 824b8e6021f..2c7b36673df 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -318,8 +318,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
318 318
319 if (msecs > 4000) { 319 if (msecs > 4000) {
320 dev_err(&adapter->pdev->dev, "mbox poll timed out\n"); 320 dev_err(&adapter->pdev->dev, "mbox poll timed out\n");
321 if (!lancer_chip(adapter)) 321 be_detect_dump_ue(adapter);
322 be_detect_dump_ue(adapter);
323 return -1; 322 return -1;
324 } 323 }
325 324
@@ -1540,7 +1539,14 @@ int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value)
1540 1539
1541 req->if_flags_mask = req->if_flags = 1540 req->if_flags_mask = req->if_flags =
1542 cpu_to_le32(BE_IF_FLAGS_MULTICAST); 1541 cpu_to_le32(BE_IF_FLAGS_MULTICAST);
1543 req->mcast_num = cpu_to_le16(netdev_mc_count(adapter->netdev)); 1542
1543 /* Reset mcast promisc mode if already set by setting mask
1544 * and not setting flags field
1545 */
1546 req->if_flags_mask |=
1547 cpu_to_le32(BE_IF_FLAGS_MCAST_PROMISCUOUS);
1548
1549 req->mcast_num = cpu_to_le32(netdev_mc_count(adapter->netdev));
1544 netdev_for_each_mc_addr(ha, adapter->netdev) 1550 netdev_for_each_mc_addr(ha, adapter->netdev)
1545 memcpy(req->mcast_mac[i++].byte, ha->addr, ETH_ALEN); 1551 memcpy(req->mcast_mac[i++].byte, ha->addr, ETH_ALEN);
1546 } 1552 }
diff --git a/drivers/net/ethernet/emulex/benet/be_hw.h b/drivers/net/ethernet/emulex/benet/be_hw.h
index fbc8a915519..f2c89e3ccab 100644
--- a/drivers/net/ethernet/emulex/benet/be_hw.h
+++ b/drivers/net/ethernet/emulex/benet/be_hw.h
@@ -48,6 +48,8 @@
48/* Lancer SLIPORT_CONTROL SLIPORT_STATUS registers */ 48/* Lancer SLIPORT_CONTROL SLIPORT_STATUS registers */
49#define SLIPORT_STATUS_OFFSET 0x404 49#define SLIPORT_STATUS_OFFSET 0x404
50#define SLIPORT_CONTROL_OFFSET 0x408 50#define SLIPORT_CONTROL_OFFSET 0x408
51#define SLIPORT_ERROR1_OFFSET 0x40C
52#define SLIPORT_ERROR2_OFFSET 0x410
51 53
52#define SLIPORT_STATUS_ERR_MASK 0x80000000 54#define SLIPORT_STATUS_ERR_MASK 0x80000000
53#define SLIPORT_STATUS_RN_MASK 0x01000000 55#define SLIPORT_STATUS_RN_MASK 0x01000000
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 21804972fa2..bf266a00c77 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -16,6 +16,7 @@
16 */ 16 */
17 17
18#include <linux/prefetch.h> 18#include <linux/prefetch.h>
19#include <linux/module.h>
19#include "be.h" 20#include "be.h"
20#include "be_cmds.h" 21#include "be_cmds.h"
21#include <asm/div64.h> 22#include <asm/div64.h>
@@ -1905,6 +1906,8 @@ loop_continue:
1905 be_rx_stats_update(rxo, rxcp); 1906 be_rx_stats_update(rxo, rxcp);
1906 } 1907 }
1907 1908
1909 be_cq_notify(adapter, rx_cq->id, false, work_done);
1910
1908 /* Refill the queue */ 1911 /* Refill the queue */
1909 if (work_done && atomic_read(&rxo->q.used) < RX_FRAGS_REFILL_WM) 1912 if (work_done && atomic_read(&rxo->q.used) < RX_FRAGS_REFILL_WM)
1910 be_post_rx_frags(rxo, GFP_ATOMIC); 1913 be_post_rx_frags(rxo, GFP_ATOMIC);
@@ -1912,10 +1915,8 @@ loop_continue:
1912 /* All consumed */ 1915 /* All consumed */
1913 if (work_done < budget) { 1916 if (work_done < budget) {
1914 napi_complete(napi); 1917 napi_complete(napi);
1915 be_cq_notify(adapter, rx_cq->id, true, work_done); 1918 /* Arm CQ */
1916 } else { 1919 be_cq_notify(adapter, rx_cq->id, true, 0);
1917 /* More to be consumed; continue with interrupts disabled */
1918 be_cq_notify(adapter, rx_cq->id, false, work_done);
1919 } 1920 }
1920 return work_done; 1921 return work_done;
1921} 1922}
@@ -1977,42 +1978,62 @@ static int be_poll_tx_mcc(struct napi_struct *napi, int budget)
1977 1978
1978void be_detect_dump_ue(struct be_adapter *adapter) 1979void be_detect_dump_ue(struct be_adapter *adapter)
1979{ 1980{
1980 u32 ue_status_lo, ue_status_hi, ue_status_lo_mask, ue_status_hi_mask; 1981 u32 ue_lo = 0, ue_hi = 0, ue_lo_mask = 0, ue_hi_mask = 0;
1982 u32 sliport_status = 0, sliport_err1 = 0, sliport_err2 = 0;
1981 u32 i; 1983 u32 i;
1982 1984
1983 pci_read_config_dword(adapter->pdev, 1985 if (lancer_chip(adapter)) {
1984 PCICFG_UE_STATUS_LOW, &ue_status_lo); 1986 sliport_status = ioread32(adapter->db + SLIPORT_STATUS_OFFSET);
1985 pci_read_config_dword(adapter->pdev, 1987 if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
1986 PCICFG_UE_STATUS_HIGH, &ue_status_hi); 1988 sliport_err1 = ioread32(adapter->db +
1987 pci_read_config_dword(adapter->pdev, 1989 SLIPORT_ERROR1_OFFSET);
1988 PCICFG_UE_STATUS_LOW_MASK, &ue_status_lo_mask); 1990 sliport_err2 = ioread32(adapter->db +
1989 pci_read_config_dword(adapter->pdev, 1991 SLIPORT_ERROR2_OFFSET);
1990 PCICFG_UE_STATUS_HI_MASK, &ue_status_hi_mask); 1992 }
1993 } else {
1994 pci_read_config_dword(adapter->pdev,
1995 PCICFG_UE_STATUS_LOW, &ue_lo);
1996 pci_read_config_dword(adapter->pdev,
1997 PCICFG_UE_STATUS_HIGH, &ue_hi);
1998 pci_read_config_dword(adapter->pdev,
1999 PCICFG_UE_STATUS_LOW_MASK, &ue_lo_mask);
2000 pci_read_config_dword(adapter->pdev,
2001 PCICFG_UE_STATUS_HI_MASK, &ue_hi_mask);
1991 2002
1992 ue_status_lo = (ue_status_lo & (~ue_status_lo_mask)); 2003 ue_lo = (ue_lo & (~ue_lo_mask));
1993 ue_status_hi = (ue_status_hi & (~ue_status_hi_mask)); 2004 ue_hi = (ue_hi & (~ue_hi_mask));
2005 }
1994 2006
1995 if (ue_status_lo || ue_status_hi) { 2007 if (ue_lo || ue_hi ||
2008 sliport_status & SLIPORT_STATUS_ERR_MASK) {
1996 adapter->ue_detected = true; 2009 adapter->ue_detected = true;
1997 adapter->eeh_err = true; 2010 adapter->eeh_err = true;
1998 dev_err(&adapter->pdev->dev, "UE Detected!!\n"); 2011 dev_err(&adapter->pdev->dev, "UE Detected!!\n");
1999 } 2012 }
2000 2013
2001 if (ue_status_lo) { 2014 if (ue_lo) {
2002 for (i = 0; ue_status_lo; ue_status_lo >>= 1, i++) { 2015 for (i = 0; ue_lo; ue_lo >>= 1, i++) {
2003 if (ue_status_lo & 1) 2016 if (ue_lo & 1)
2004 dev_err(&adapter->pdev->dev, 2017 dev_err(&adapter->pdev->dev,
2005 "UE: %s bit set\n", ue_status_low_desc[i]); 2018 "UE: %s bit set\n", ue_status_low_desc[i]);
2006 } 2019 }
2007 } 2020 }
2008 if (ue_status_hi) { 2021 if (ue_hi) {
2009 for (i = 0; ue_status_hi; ue_status_hi >>= 1, i++) { 2022 for (i = 0; ue_hi; ue_hi >>= 1, i++) {
2010 if (ue_status_hi & 1) 2023 if (ue_hi & 1)
2011 dev_err(&adapter->pdev->dev, 2024 dev_err(&adapter->pdev->dev,
2012 "UE: %s bit set\n", ue_status_hi_desc[i]); 2025 "UE: %s bit set\n", ue_status_hi_desc[i]);
2013 } 2026 }
2014 } 2027 }
2015 2028
2029 if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
2030 dev_err(&adapter->pdev->dev,
2031 "sliport status 0x%x\n", sliport_status);
2032 dev_err(&adapter->pdev->dev,
2033 "sliport error1 0x%x\n", sliport_err1);
2034 dev_err(&adapter->pdev->dev,
2035 "sliport error2 0x%x\n", sliport_err2);
2036 }
2016} 2037}
2017 2038
2018static void be_worker(struct work_struct *work) 2039static void be_worker(struct work_struct *work)
@@ -2022,7 +2043,7 @@ static void be_worker(struct work_struct *work)
2022 struct be_rx_obj *rxo; 2043 struct be_rx_obj *rxo;
2023 int i; 2044 int i;
2024 2045
2025 if (!adapter->ue_detected && !lancer_chip(adapter)) 2046 if (!adapter->ue_detected)
2026 be_detect_dump_ue(adapter); 2047 be_detect_dump_ue(adapter);
2027 2048
2028 /* when interrupts are not yet enabled, just reap any pending 2049 /* when interrupts are not yet enabled, just reap any pending
diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index bdb348a5ccf..251b635fe75 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -22,6 +22,7 @@
22#include <linux/sched.h> 22#include <linux/sched.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/of.h> 24#include <linux/of.h>
25#include <linux/module.h>
25#include <net/ethoc.h> 26#include <net/ethoc.h>
26 27
27static int buffer_size = 0x8000; /* 32 KBytes */ 28static int buffer_size = 0x8000; /* 32 KBytes */
diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig
index 1cf671643d1..5272f9d4dda 100644
--- a/drivers/net/ethernet/freescale/Kconfig
+++ b/drivers/net/ethernet/freescale/Kconfig
@@ -7,8 +7,7 @@ config NET_VENDOR_FREESCALE
7 default y 7 default y
8 depends on FSL_SOC || QUICC_ENGINE || CPM1 || CPM2 || PPC_MPC512x || \ 8 depends on FSL_SOC || QUICC_ENGINE || CPM1 || CPM2 || PPC_MPC512x || \
9 M523x || M527x || M5272 || M528x || M520x || M532x || \ 9 M523x || M527x || M5272 || M528x || M520x || M532x || \
10 ARCH_MXC || ARCH_MXS || \ 10 ARCH_MXC || ARCH_MXS || (PPC_MPC52xx && PPC_BESTCOMM)
11 (PPC_MPC52xx && PPC_BESTCOMM)
12 ---help--- 11 ---help---
13 If you have a network (Ethernet) card belonging to this class, say Y 12 If you have a network (Ethernet) card belonging to this class, say Y
14 and read the Ethernet-HOWTO, available from 13 and read the Ethernet-HOWTO, available from
@@ -25,6 +24,7 @@ config FEC
25 bool "FEC ethernet controller (of ColdFire and some i.MX CPUs)" 24 bool "FEC ethernet controller (of ColdFire and some i.MX CPUs)"
26 depends on (M523x || M527x || M5272 || M528x || M520x || M532x || \ 25 depends on (M523x || M527x || M5272 || M528x || M520x || M532x || \
27 ARCH_MXC || ARCH_MXS) 26 ARCH_MXC || ARCH_MXS)
27 default ARCH_MXC || ARCH_MXS if ARM
28 select PHYLIB 28 select PHYLIB
29 ---help--- 29 ---help---
30 Say Y here if you want to use the built-in 10/100 Fast ethernet 30 Say Y here if you want to use the built-in 10/100 Fast ethernet
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index 46d690a92c0..b5dc0273a1d 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -17,6 +17,7 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/stddef.h> 19#include <linux/stddef.h>
20#include <linux/module.h>
20#include <linux/interrupt.h> 21#include <linux/interrupt.h>
21#include <linux/netdevice.h> 22#include <linux/netdevice.h>
22#include <linux/etherdevice.h> 23#include <linux/etherdevice.h>
diff --git a/drivers/net/ethernet/i825xx/3c505.c b/drivers/net/ethernet/i825xx/3c505.c
index 40e1a175fce..ba82a266051 100644
--- a/drivers/net/ethernet/i825xx/3c505.c
+++ b/drivers/net/ethernet/i825xx/3c505.c
@@ -126,15 +126,13 @@
126 * 126 *
127 *********************************************************/ 127 *********************************************************/
128 128
129#define filename __FILE__
130
131#define timeout_msg "*** timeout at %s:%s (line %d) ***\n" 129#define timeout_msg "*** timeout at %s:%s (line %d) ***\n"
132#define TIMEOUT_MSG(lineno) \ 130#define TIMEOUT_MSG(lineno) \
133 pr_notice(timeout_msg, filename, __func__, (lineno)) 131 pr_notice(timeout_msg, __FILE__, __func__, (lineno))
134 132
135#define invalid_pcb_msg "*** invalid pcb length %d at %s:%s (line %d) ***\n" 133#define invalid_pcb_msg "*** invalid pcb length %d at %s:%s (line %d) ***\n"
136#define INVALID_PCB_MSG(len) \ 134#define INVALID_PCB_MSG(len) \
137 pr_notice(invalid_pcb_msg, (len), filename, __func__, __LINE__) 135 pr_notice(invalid_pcb_msg, (len), __FILE__, __func__, __LINE__)
138 136
139#define search_msg "%s: Looking for 3c505 adapter at address %#x..." 137#define search_msg "%s: Looking for 3c505 adapter at address %#x..."
140 138
diff --git a/drivers/net/ethernet/ibm/ehea/ehea.h b/drivers/net/ethernet/ibm/ehea/ehea.h
index 410d6a1984e..6650068c996 100644
--- a/drivers/net/ethernet/ibm/ehea/ehea.h
+++ b/drivers/net/ethernet/ibm/ehea/ehea.h
@@ -61,9 +61,9 @@
61#ifdef EHEA_SMALL_QUEUES 61#ifdef EHEA_SMALL_QUEUES
62#define EHEA_MAX_CQE_COUNT 1023 62#define EHEA_MAX_CQE_COUNT 1023
63#define EHEA_DEF_ENTRIES_SQ 1023 63#define EHEA_DEF_ENTRIES_SQ 1023
64#define EHEA_DEF_ENTRIES_RQ1 4095 64#define EHEA_DEF_ENTRIES_RQ1 1023
65#define EHEA_DEF_ENTRIES_RQ2 1023 65#define EHEA_DEF_ENTRIES_RQ2 1023
66#define EHEA_DEF_ENTRIES_RQ3 1023 66#define EHEA_DEF_ENTRIES_RQ3 511
67#else 67#else
68#define EHEA_MAX_CQE_COUNT 4080 68#define EHEA_MAX_CQE_COUNT 4080
69#define EHEA_DEF_ENTRIES_SQ 4080 69#define EHEA_DEF_ENTRIES_SQ 4080
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
index 37b70f7052b..bfeccbfde23 100644
--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
+++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
@@ -371,7 +371,8 @@ static void ehea_update_stats(struct work_struct *work)
371out_herr: 371out_herr:
372 free_page((unsigned long)cb2); 372 free_page((unsigned long)cb2);
373resched: 373resched:
374 schedule_delayed_work(&port->stats_work, msecs_to_jiffies(1000)); 374 schedule_delayed_work(&port->stats_work,
375 round_jiffies_relative(msecs_to_jiffies(1000)));
375} 376}
376 377
377static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes) 378static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes)
@@ -2434,7 +2435,8 @@ static int ehea_open(struct net_device *dev)
2434 } 2435 }
2435 2436
2436 mutex_unlock(&port->port_lock); 2437 mutex_unlock(&port->port_lock);
2437 schedule_delayed_work(&port->stats_work, msecs_to_jiffies(1000)); 2438 schedule_delayed_work(&port->stats_work,
2439 round_jiffies_relative(msecs_to_jiffies(1000)));
2438 2440
2439 return ret; 2441 return ret;
2440} 2442}
diff --git a/drivers/net/ethernet/ibm/iseries_veth.c b/drivers/net/ethernet/ibm/iseries_veth.c
index 4326681df38..acc31af6594 100644
--- a/drivers/net/ethernet/ibm/iseries_veth.c
+++ b/drivers/net/ethernet/ibm/iseries_veth.c
@@ -1421,7 +1421,7 @@ static void veth_receive(struct veth_lpar_connection *cnx,
1421 1421
1422 /* FIXME: do we need this? */ 1422 /* FIXME: do we need this? */
1423 memset(local_list, 0, sizeof(local_list)); 1423 memset(local_list, 0, sizeof(local_list));
1424 memset(remote_list, 0, sizeof(VETH_MAX_FRAMES_PER_MSG)); 1424 memset(remote_list, 0, sizeof(remote_list));
1425 1425
1426 /* a 0 address marks the end of the valid entries */ 1426 /* a 0 address marks the end of the valid entries */
1427 if (senddata->addr[startchunk] == 0) 1427 if (senddata->addr[startchunk] == 0)
diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig
index 61029dc7fa6..76213162fbe 100644
--- a/drivers/net/ethernet/intel/Kconfig
+++ b/drivers/net/ethernet/intel/Kconfig
@@ -5,7 +5,11 @@
5config NET_VENDOR_INTEL 5config NET_VENDOR_INTEL
6 bool "Intel devices" 6 bool "Intel devices"
7 default y 7 default y
8 depends on PCI || PCI_MSI 8 depends on PCI || PCI_MSI || ISA || ISA_DMA_API || ARM || \
9 ARCH_ACORN || MCA || MCA_LEGACY || SNI_RM || SUN3 || \
10 GSC || BVME6000 || MVME16x || ARCH_ENP2611 || \
11 (ARM && ARCH_IXP4XX && IXP4XX_NPE && IXP4XX_QMGR) || \
12 EXPERIMENTAL
9 ---help--- 13 ---help---
10 If you have a network (Ethernet) card belonging to this class, say Y 14 If you have a network (Ethernet) card belonging to this class, say Y
11 and read the Ethernet-HOWTO, available from 15 and read the Ethernet-HOWTO, available from
diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
index ae17cd1a907..5a2fdf7a00c 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -2810,6 +2810,10 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2810 2810
2811 e100_get_defaults(nic); 2811 e100_get_defaults(nic);
2812 2812
2813 /* D100 MAC doesn't allow rx of vlan packets with normal MTU */
2814 if (nic->mac < mac_82558_D101_A4)
2815 netdev->features |= NETIF_F_VLAN_CHALLENGED;
2816
2813 /* locks must be initialized before calling hw_reset */ 2817 /* locks must be initialized before calling hw_reset */
2814 spin_lock_init(&nic->cb_lock); 2818 spin_lock_init(&nic->cb_lock);
2815 spin_lock_init(&nic->cmd_lock); 2819 spin_lock_init(&nic->cmd_lock);
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
index 6a17c62cb86..e2a80a283fd 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
@@ -866,8 +866,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
866 866
867 if (test_and_set_bit(__E1000_ACCESS_SHARED_RESOURCE, 867 if (test_and_set_bit(__E1000_ACCESS_SHARED_RESOURCE,
868 &hw->adapter->state)) { 868 &hw->adapter->state)) {
869 WARN(1, "e1000e: %s: contention for Phy access\n", 869 e_dbg("contention for Phy access\n");
870 hw->adapter->netdev->name);
871 return -E1000_ERR_PHY; 870 return -E1000_ERR_PHY;
872 } 871 }
873 872
diff --git a/drivers/net/ethernet/intel/e1000e/param.c b/drivers/net/ethernet/intel/e1000e/param.c
index 4dd9b63273f..20e93b08e7f 100644
--- a/drivers/net/ethernet/intel/e1000e/param.c
+++ b/drivers/net/ethernet/intel/e1000e/param.c
@@ -27,6 +27,7 @@
27*******************************************************************************/ 27*******************************************************************************/
28 28
29#include <linux/netdevice.h> 29#include <linux/netdevice.h>
30#include <linux/module.h>
30#include <linux/pci.h> 31#include <linux/pci.h>
31 32
32#include "e1000.h" 33#include "e1000.h"
diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c
index 7edf31efe75..b17d7c20f81 100644
--- a/drivers/net/ethernet/intel/igb/e1000_phy.c
+++ b/drivers/net/ethernet/intel/igb/e1000_phy.c
@@ -1687,7 +1687,7 @@ s32 igb_get_cable_length_m88_gen2(struct e1000_hw *hw)
1687 if (ret_val) 1687 if (ret_val)
1688 goto out; 1688 goto out;
1689 1689
1690 is_cm = !(phy_data & I347AT4_PCDC_CABLE_LENGTH_UNIT); 1690 is_cm = !(phy_data2 & I347AT4_PCDC_CABLE_LENGTH_UNIT);
1691 1691
1692 /* Populate the phy structure with cable length in meters */ 1692 /* Populate the phy structure with cable length in meters */
1693 phy->min_cable_length = phy_data / (is_cm ? 100 : 1); 1693 phy->min_cable_length = phy_data / (is_cm ? 100 : 1);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
index 834f044be4c..f1365fef4ed 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
@@ -3344,7 +3344,7 @@ static u8 ixgbe_calculate_checksum(u8 *buffer, u32 length)
3344static s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer, 3344static s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
3345 u32 length) 3345 u32 length)
3346{ 3346{
3347 u32 hicr, i; 3347 u32 hicr, i, bi;
3348 u32 hdr_size = sizeof(struct ixgbe_hic_hdr); 3348 u32 hdr_size = sizeof(struct ixgbe_hic_hdr);
3349 u8 buf_len, dword_len; 3349 u8 buf_len, dword_len;
3350 3350
@@ -3398,9 +3398,9 @@ static s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
3398 dword_len = hdr_size >> 2; 3398 dword_len = hdr_size >> 2;
3399 3399
3400 /* first pull in the header so we know the buffer length */ 3400 /* first pull in the header so we know the buffer length */
3401 for (i = 0; i < dword_len; i++) { 3401 for (bi = 0; bi < dword_len; bi++) {
3402 buffer[i] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, i); 3402 buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi);
3403 le32_to_cpus(&buffer[i]); 3403 le32_to_cpus(&buffer[bi]);
3404 } 3404 }
3405 3405
3406 /* If there is any thing in data position pull it in */ 3406 /* If there is any thing in data position pull it in */
@@ -3414,12 +3414,14 @@ static s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
3414 goto out; 3414 goto out;
3415 } 3415 }
3416 3416
3417 /* Calculate length in DWORDs, add one for odd lengths */ 3417 /* Calculate length in DWORDs, add 3 for odd lengths */
3418 dword_len = (buf_len + 1) >> 2; 3418 dword_len = (buf_len + 3) >> 2;
3419 3419
3420 /* Pull in the rest of the buffer (i is where we left off)*/ 3420 /* Pull in the rest of the buffer (bi is where we left off)*/
3421 for (; i < buf_len; i++) 3421 for (; bi <= dword_len; bi++) {
3422 buffer[i] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, i); 3422 buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi);
3423 le32_to_cpus(&buffer[bi]);
3424 }
3423 3425
3424out: 3426out:
3425 return ret_val; 3427 return ret_val;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
index 3631d639d86..33b93ffb87c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
@@ -561,11 +561,12 @@ static int ixgbe_dcbnl_ieee_getets(struct net_device *dev,
561 struct ixgbe_adapter *adapter = netdev_priv(dev); 561 struct ixgbe_adapter *adapter = netdev_priv(dev);
562 struct ieee_ets *my_ets = adapter->ixgbe_ieee_ets; 562 struct ieee_ets *my_ets = adapter->ixgbe_ieee_ets;
563 563
564 ets->ets_cap = adapter->dcb_cfg.num_tcs.pg_tcs;
565
564 /* No IEEE PFC settings available */ 566 /* No IEEE PFC settings available */
565 if (!my_ets) 567 if (!my_ets)
566 return -EINVAL; 568 return 0;
567 569
568 ets->ets_cap = adapter->dcb_cfg.num_tcs.pg_tcs;
569 ets->cbs = my_ets->cbs; 570 ets->cbs = my_ets->cbs;
570 memcpy(ets->tc_tx_bw, my_ets->tc_tx_bw, sizeof(ets->tc_tx_bw)); 571 memcpy(ets->tc_tx_bw, my_ets->tc_tx_bw, sizeof(ets->tc_tx_bw));
571 memcpy(ets->tc_rx_bw, my_ets->tc_rx_bw, sizeof(ets->tc_rx_bw)); 572 memcpy(ets->tc_rx_bw, my_ets->tc_rx_bw, sizeof(ets->tc_rx_bw));
@@ -621,11 +622,12 @@ static int ixgbe_dcbnl_ieee_getpfc(struct net_device *dev,
621 struct ieee_pfc *my_pfc = adapter->ixgbe_ieee_pfc; 622 struct ieee_pfc *my_pfc = adapter->ixgbe_ieee_pfc;
622 int i; 623 int i;
623 624
625 pfc->pfc_cap = adapter->dcb_cfg.num_tcs.pfc_tcs;
626
624 /* No IEEE PFC settings available */ 627 /* No IEEE PFC settings available */
625 if (!my_pfc) 628 if (!my_pfc)
626 return -EINVAL; 629 return 0;
627 630
628 pfc->pfc_cap = adapter->dcb_cfg.num_tcs.pfc_tcs;
629 pfc->pfc_en = my_pfc->pfc_en; 631 pfc->pfc_en = my_pfc->pfc_en;
630 pfc->mbc = my_pfc->mbc; 632 pfc->mbc = my_pfc->mbc;
631 pfc->delay = my_pfc->delay; 633 pfc->delay = my_pfc->delay;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 09b8e88b299..8ef92d1a6aa 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -3345,34 +3345,25 @@ static void ixgbe_configure_dcb(struct ixgbe_adapter *adapter)
3345 3345
3346 hw->mac.ops.set_vfta(&adapter->hw, 0, 0, true); 3346 hw->mac.ops.set_vfta(&adapter->hw, 0, 0, true);
3347 3347
3348 /* reconfigure the hardware */
3349 if (adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE) {
3350#ifdef IXGBE_FCOE 3348#ifdef IXGBE_FCOE
3351 if (adapter->netdev->features & NETIF_F_FCOE_MTU) 3349 if (adapter->netdev->features & NETIF_F_FCOE_MTU)
3352 max_frame = max(max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE); 3350 max_frame = max(max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE);
3353#endif 3351#endif
3352
3353 /* reconfigure the hardware */
3354 if (adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE) {
3354 ixgbe_dcb_calculate_tc_credits(hw, &adapter->dcb_cfg, max_frame, 3355 ixgbe_dcb_calculate_tc_credits(hw, &adapter->dcb_cfg, max_frame,
3355 DCB_TX_CONFIG); 3356 DCB_TX_CONFIG);
3356 ixgbe_dcb_calculate_tc_credits(hw, &adapter->dcb_cfg, max_frame, 3357 ixgbe_dcb_calculate_tc_credits(hw, &adapter->dcb_cfg, max_frame,
3357 DCB_RX_CONFIG); 3358 DCB_RX_CONFIG);
3358 ixgbe_dcb_hw_config(hw, &adapter->dcb_cfg); 3359 ixgbe_dcb_hw_config(hw, &adapter->dcb_cfg);
3359 } else { 3360 } else if (adapter->ixgbe_ieee_ets && adapter->ixgbe_ieee_pfc) {
3360 struct net_device *dev = adapter->netdev; 3361 ixgbe_dcb_hw_ets(&adapter->hw,
3361 3362 adapter->ixgbe_ieee_ets,
3362 if (adapter->ixgbe_ieee_ets) { 3363 max_frame);
3363 struct ieee_ets *ets = adapter->ixgbe_ieee_ets; 3364 ixgbe_dcb_hw_pfc_config(&adapter->hw,
3364 int max_frame = dev->mtu + ETH_HLEN + ETH_FCS_LEN; 3365 adapter->ixgbe_ieee_pfc->pfc_en,
3365 3366 adapter->ixgbe_ieee_ets->prio_tc);
3366 ixgbe_dcb_hw_ets(&adapter->hw, ets, max_frame);
3367 }
3368
3369 if (adapter->ixgbe_ieee_pfc) {
3370 struct ieee_pfc *pfc = adapter->ixgbe_ieee_pfc;
3371 u8 *prio_tc = adapter->ixgbe_ieee_ets->prio_tc;
3372
3373 ixgbe_dcb_hw_pfc_config(&adapter->hw, pfc->pfc_en,
3374 prio_tc);
3375 }
3376 } 3367 }
3377 3368
3378 /* Enable RSS Hash per TC */ 3369 /* Enable RSS Hash per TC */
@@ -6125,7 +6116,6 @@ static void ixgbe_sfp_link_config_subtask(struct ixgbe_adapter *adapter)
6125 autoneg = hw->phy.autoneg_advertised; 6116 autoneg = hw->phy.autoneg_advertised;
6126 if ((!autoneg) && (hw->mac.ops.get_link_capabilities)) 6117 if ((!autoneg) && (hw->mac.ops.get_link_capabilities))
6127 hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiation); 6118 hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiation);
6128 hw->mac.autotry_restart = false;
6129 if (hw->mac.ops.setup_link) 6119 if (hw->mac.ops.setup_link)
6130 hw->mac.ops.setup_link(hw, autoneg, negotiation, true); 6120 hw->mac.ops.setup_link(hw, autoneg, negotiation, true);
6131 6121
@@ -7589,13 +7579,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
7589 goto err_eeprom; 7579 goto err_eeprom;
7590 } 7580 }
7591 7581
7592 /* power down the optics for multispeed fiber and 82599 SFP+ fiber */
7593 if (hw->mac.ops.disable_tx_laser &&
7594 ((hw->phy.multispeed_fiber) ||
7595 ((hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber) &&
7596 (hw->mac.type == ixgbe_mac_82599EB))))
7597 hw->mac.ops.disable_tx_laser(hw);
7598
7599 setup_timer(&adapter->service_timer, &ixgbe_service_timer, 7582 setup_timer(&adapter->service_timer, &ixgbe_service_timer,
7600 (unsigned long) adapter); 7583 (unsigned long) adapter);
7601 7584
@@ -7693,6 +7676,13 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
7693 if (err) 7676 if (err)
7694 goto err_register; 7677 goto err_register;
7695 7678
7679 /* power down the optics for multispeed fiber and 82599 SFP+ fiber */
7680 if (hw->mac.ops.disable_tx_laser &&
7681 ((hw->phy.multispeed_fiber) ||
7682 ((hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber) &&
7683 (hw->mac.type == ixgbe_mac_82599EB))))
7684 hw->mac.ops.disable_tx_laser(hw);
7685
7696 /* carrier off reporting is important to ethtool even BEFORE open */ 7686 /* carrier off reporting is important to ethtool even BEFORE open */
7697 netif_carrier_off(netdev); 7687 netif_carrier_off(netdev);
7698 7688
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index db95731863d..00fcd39ad66 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -442,12 +442,14 @@ static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter,
442 442
443int ixgbe_check_vf_assignment(struct ixgbe_adapter *adapter) 443int ixgbe_check_vf_assignment(struct ixgbe_adapter *adapter)
444{ 444{
445#ifdef CONFIG_PCI_IOV
445 int i; 446 int i;
446 for (i = 0; i < adapter->num_vfs; i++) { 447 for (i = 0; i < adapter->num_vfs; i++) {
447 if (adapter->vfinfo[i].vfdev->dev_flags & 448 if (adapter->vfinfo[i].vfdev->dev_flags &
448 PCI_DEV_FLAGS_ASSIGNED) 449 PCI_DEV_FLAGS_ASSIGNED)
449 return true; 450 return true;
450 } 451 }
452#endif
451 return false; 453 return false;
452} 454}
453 455
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h
index 5a7e1eb3359..df04f1a3857 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h
@@ -43,9 +43,11 @@ int ixgbe_ndo_get_vf_config(struct net_device *netdev,
43 int vf, struct ifla_vf_info *ivi); 43 int vf, struct ifla_vf_info *ivi);
44void ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter); 44void ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter);
45void ixgbe_disable_sriov(struct ixgbe_adapter *adapter); 45void ixgbe_disable_sriov(struct ixgbe_adapter *adapter);
46int ixgbe_check_vf_assignment(struct ixgbe_adapter *adapter);
47#ifdef CONFIG_PCI_IOV
46void ixgbe_enable_sriov(struct ixgbe_adapter *adapter, 48void ixgbe_enable_sriov(struct ixgbe_adapter *adapter,
47 const struct ixgbe_info *ii); 49 const struct ixgbe_info *ii);
48int ixgbe_check_vf_assignment(struct ixgbe_adapter *adapter); 50#endif
49 51
50 52
51#endif /* _IXGBE_SRIOV_H_ */ 53#endif /* _IXGBE_SRIOV_H_ */
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 5e92cc2079b..4c8e19951d5 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -54,7 +54,7 @@ char ixgbevf_driver_name[] = "ixgbevf";
54static const char ixgbevf_driver_string[] = 54static const char ixgbevf_driver_string[] =
55 "Intel(R) 10 Gigabit PCI Express Virtual Function Network Driver"; 55 "Intel(R) 10 Gigabit PCI Express Virtual Function Network Driver";
56 56
57#define DRV_VERSION "2.1.0-k" 57#define DRV_VERSION "2.2.0-k"
58const char ixgbevf_driver_version[] = DRV_VERSION; 58const char ixgbevf_driver_version[] = DRV_VERSION;
59static char ixgbevf_copyright[] = 59static char ixgbevf_copyright[] =
60 "Copyright (c) 2009 - 2010 Intel Corporation."; 60 "Copyright (c) 2009 - 2010 Intel Corporation.";
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c
index 7becff1f387..76b84573566 100644
--- a/drivers/net/ethernet/jme.c
+++ b/drivers/net/ethernet/jme.c
@@ -1745,6 +1745,112 @@ jme_phy_off(struct jme_adapter *jme)
1745} 1745}
1746 1746
1747static int 1747static int
1748jme_phy_specreg_read(struct jme_adapter *jme, u32 specreg)
1749{
1750 u32 phy_addr;
1751
1752 phy_addr = JM_PHY_SPEC_REG_READ | specreg;
1753 jme_mdio_write(jme->dev, jme->mii_if.phy_id, JM_PHY_SPEC_ADDR_REG,
1754 phy_addr);
1755 return jme_mdio_read(jme->dev, jme->mii_if.phy_id,
1756 JM_PHY_SPEC_DATA_REG);
1757}
1758
1759static void
1760jme_phy_specreg_write(struct jme_adapter *jme, u32 ext_reg, u32 phy_data)
1761{
1762 u32 phy_addr;
1763
1764 phy_addr = JM_PHY_SPEC_REG_WRITE | ext_reg;
1765 jme_mdio_write(jme->dev, jme->mii_if.phy_id, JM_PHY_SPEC_DATA_REG,
1766 phy_data);
1767 jme_mdio_write(jme->dev, jme->mii_if.phy_id, JM_PHY_SPEC_ADDR_REG,
1768 phy_addr);
1769}
1770
1771static int
1772jme_phy_calibration(struct jme_adapter *jme)
1773{
1774 u32 ctrl1000, phy_data;
1775
1776 jme_phy_off(jme);
1777 jme_phy_on(jme);
1778 /* Enabel PHY test mode 1 */
1779 ctrl1000 = jme_mdio_read(jme->dev, jme->mii_if.phy_id, MII_CTRL1000);
1780 ctrl1000 &= ~PHY_GAD_TEST_MODE_MSK;
1781 ctrl1000 |= PHY_GAD_TEST_MODE_1;
1782 jme_mdio_write(jme->dev, jme->mii_if.phy_id, MII_CTRL1000, ctrl1000);
1783
1784 phy_data = jme_phy_specreg_read(jme, JM_PHY_EXT_COMM_2_REG);
1785 phy_data &= ~JM_PHY_EXT_COMM_2_CALI_MODE_0;
1786 phy_data |= JM_PHY_EXT_COMM_2_CALI_LATCH |
1787 JM_PHY_EXT_COMM_2_CALI_ENABLE;
1788 jme_phy_specreg_write(jme, JM_PHY_EXT_COMM_2_REG, phy_data);
1789 msleep(20);
1790 phy_data = jme_phy_specreg_read(jme, JM_PHY_EXT_COMM_2_REG);
1791 phy_data &= ~(JM_PHY_EXT_COMM_2_CALI_ENABLE |
1792 JM_PHY_EXT_COMM_2_CALI_MODE_0 |
1793 JM_PHY_EXT_COMM_2_CALI_LATCH);
1794 jme_phy_specreg_write(jme, JM_PHY_EXT_COMM_2_REG, phy_data);
1795
1796 /* Disable PHY test mode */
1797 ctrl1000 = jme_mdio_read(jme->dev, jme->mii_if.phy_id, MII_CTRL1000);
1798 ctrl1000 &= ~PHY_GAD_TEST_MODE_MSK;
1799 jme_mdio_write(jme->dev, jme->mii_if.phy_id, MII_CTRL1000, ctrl1000);
1800 return 0;
1801}
1802
1803static int
1804jme_phy_setEA(struct jme_adapter *jme)
1805{
1806 u32 phy_comm0 = 0, phy_comm1 = 0;
1807 u8 nic_ctrl;
1808
1809 pci_read_config_byte(jme->pdev, PCI_PRIV_SHARE_NICCTRL, &nic_ctrl);
1810 if ((nic_ctrl & 0x3) == JME_FLAG_PHYEA_ENABLE)
1811 return 0;
1812
1813 switch (jme->pdev->device) {
1814 case PCI_DEVICE_ID_JMICRON_JMC250:
1815 if (((jme->chip_main_rev == 5) &&
1816 ((jme->chip_sub_rev == 0) || (jme->chip_sub_rev == 1) ||
1817 (jme->chip_sub_rev == 3))) ||
1818 (jme->chip_main_rev >= 6)) {
1819 phy_comm0 = 0x008A;
1820 phy_comm1 = 0x4109;
1821 }
1822 if ((jme->chip_main_rev == 3) &&
1823 ((jme->chip_sub_rev == 1) || (jme->chip_sub_rev == 2)))
1824 phy_comm0 = 0xE088;
1825 break;
1826 case PCI_DEVICE_ID_JMICRON_JMC260:
1827 if (((jme->chip_main_rev == 5) &&
1828 ((jme->chip_sub_rev == 0) || (jme->chip_sub_rev == 1) ||
1829 (jme->chip_sub_rev == 3))) ||
1830 (jme->chip_main_rev >= 6)) {
1831 phy_comm0 = 0x008A;
1832 phy_comm1 = 0x4109;
1833 }
1834 if ((jme->chip_main_rev == 3) &&
1835 ((jme->chip_sub_rev == 1) || (jme->chip_sub_rev == 2)))
1836 phy_comm0 = 0xE088;
1837 if ((jme->chip_main_rev == 2) && (jme->chip_sub_rev == 0))
1838 phy_comm0 = 0x608A;
1839 if ((jme->chip_main_rev == 2) && (jme->chip_sub_rev == 2))
1840 phy_comm0 = 0x408A;
1841 break;
1842 default:
1843 return -ENODEV;
1844 }
1845 if (phy_comm0)
1846 jme_phy_specreg_write(jme, JM_PHY_EXT_COMM_0_REG, phy_comm0);
1847 if (phy_comm1)
1848 jme_phy_specreg_write(jme, JM_PHY_EXT_COMM_1_REG, phy_comm1);
1849
1850 return 0;
1851}
1852
1853static int
1748jme_open(struct net_device *netdev) 1854jme_open(struct net_device *netdev)
1749{ 1855{
1750 struct jme_adapter *jme = netdev_priv(netdev); 1856 struct jme_adapter *jme = netdev_priv(netdev);
@@ -1769,7 +1875,8 @@ jme_open(struct net_device *netdev)
1769 jme_set_settings(netdev, &jme->old_ecmd); 1875 jme_set_settings(netdev, &jme->old_ecmd);
1770 else 1876 else
1771 jme_reset_phy_processor(jme); 1877 jme_reset_phy_processor(jme);
1772 1878 jme_phy_calibration(jme);
1879 jme_phy_setEA(jme);
1773 jme_reset_link(jme); 1880 jme_reset_link(jme);
1774 1881
1775 return 0; 1882 return 0;
@@ -3184,7 +3291,8 @@ jme_resume(struct device *dev)
3184 jme_set_settings(netdev, &jme->old_ecmd); 3291 jme_set_settings(netdev, &jme->old_ecmd);
3185 else 3292 else
3186 jme_reset_phy_processor(jme); 3293 jme_reset_phy_processor(jme);
3187 3294 jme_phy_calibration(jme);
3295 jme_phy_setEA(jme);
3188 jme_start_irq(jme); 3296 jme_start_irq(jme);
3189 netif_device_attach(netdev); 3297 netif_device_attach(netdev);
3190 3298
@@ -3239,4 +3347,3 @@ MODULE_DESCRIPTION("JMicron JMC2x0 PCI Express Ethernet driver");
3239MODULE_LICENSE("GPL"); 3347MODULE_LICENSE("GPL");
3240MODULE_VERSION(DRV_VERSION); 3348MODULE_VERSION(DRV_VERSION);
3241MODULE_DEVICE_TABLE(pci, jme_pci_tbl); 3349MODULE_DEVICE_TABLE(pci, jme_pci_tbl);
3242
diff --git a/drivers/net/ethernet/jme.h b/drivers/net/ethernet/jme.h
index 02ea27c1dcb..4304072bd3c 100644
--- a/drivers/net/ethernet/jme.h
+++ b/drivers/net/ethernet/jme.h
@@ -760,6 +760,25 @@ enum jme_rxmcs_bits {
760 RXMCS_CHECKSUM, 760 RXMCS_CHECKSUM,
761}; 761};
762 762
763/* Extern PHY common register 2 */
764
765#define PHY_GAD_TEST_MODE_1 0x00002000
766#define PHY_GAD_TEST_MODE_MSK 0x0000E000
767#define JM_PHY_SPEC_REG_READ 0x00004000
768#define JM_PHY_SPEC_REG_WRITE 0x00008000
769#define PHY_CALIBRATION_DELAY 20
770#define JM_PHY_SPEC_ADDR_REG 0x1E
771#define JM_PHY_SPEC_DATA_REG 0x1F
772
773#define JM_PHY_EXT_COMM_0_REG 0x30
774#define JM_PHY_EXT_COMM_1_REG 0x31
775#define JM_PHY_EXT_COMM_2_REG 0x32
776#define JM_PHY_EXT_COMM_2_CALI_ENABLE 0x01
777#define JM_PHY_EXT_COMM_2_CALI_MODE_0 0x02
778#define JM_PHY_EXT_COMM_2_CALI_LATCH 0x10
779#define PCI_PRIV_SHARE_NICCTRL 0xF5
780#define JME_FLAG_PHYEA_ENABLE 0x2
781
763/* 782/*
764 * Wakeup Frame setup interface registers 783 * Wakeup Frame setup interface registers
765 */ 784 */
diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index 6bb2b9506ca..0b3567ab812 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 cbd026f3bc5..7803efa46eb 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
@@ -366,17 +366,6 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
366 gm_phy_write(hw, port, PHY_MARV_FE_SPEC_2, spec); 366 gm_phy_write(hw, port, PHY_MARV_FE_SPEC_2, spec);
367 } 367 }
368 } else { 368 } else {
369 if (hw->chip_id >= CHIP_ID_YUKON_OPT) {
370 u16 ctrl2 = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL_2);
371
372 /* enable PHY Reverse Auto-Negotiation */
373 ctrl2 |= 1u << 13;
374
375 /* Write PHY changes (SW-reset must follow) */
376 gm_phy_write(hw, port, PHY_MARV_EXT_CTRL_2, ctrl2);
377 }
378
379
380 /* disable energy detect */ 369 /* disable energy detect */
381 ctrl &= ~PHY_M_PC_EN_DET_MSK; 370 ctrl &= ~PHY_M_PC_EN_DET_MSK;
382 371
@@ -880,6 +869,7 @@ static void sky2_wol_init(struct sky2_port *sky2)
880 869
881 /* block receiver */ 870 /* block receiver */
882 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);
883} 873}
884 874
885static void sky2_set_tx_stfwd(struct sky2_hw *hw, unsigned port) 875static void sky2_set_tx_stfwd(struct sky2_hw *hw, unsigned port)
@@ -1285,6 +1275,14 @@ static void rx_set_checksum(struct sky2_port *sky2)
1285 ? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM); 1275 ? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM);
1286} 1276}
1287 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
1288/* Enable/disable receive hash calculation (RSS) */ 1286/* Enable/disable receive hash calculation (RSS) */
1289static void rx_set_rss(struct net_device *dev, u32 features) 1287static void rx_set_rss(struct net_device *dev, u32 features)
1290{ 1288{
@@ -1300,12 +1298,9 @@ static void rx_set_rss(struct net_device *dev, u32 features)
1300 1298
1301 /* Program RSS initial values */ 1299 /* Program RSS initial values */
1302 if (features & NETIF_F_RXHASH) { 1300 if (features & NETIF_F_RXHASH) {
1303 u32 key[nkeys];
1304
1305 get_random_bytes(key, nkeys * sizeof(u32));
1306 for (i = 0; i < nkeys; i++) 1301 for (i = 0; i < nkeys; i++)
1307 sky2_write32(hw, SK_REG(sky2->port, RSS_KEY + i * 4), 1302 sky2_write32(hw, SK_REG(sky2->port, RSS_KEY + i * 4),
1308 key[i]); 1303 rss_init_key[i]);
1309 1304
1310 /* Need to turn on (undocumented) flag to make hashing work */ 1305 /* Need to turn on (undocumented) flag to make hashing work */
1311 sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), 1306 sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T),
@@ -1728,6 +1723,8 @@ static int sky2_setup_irq(struct sky2_hw *hw, const char *name)
1728 if (err) 1723 if (err)
1729 dev_err(&pdev->dev, "cannot assign irq %d\n", pdev->irq); 1724 dev_err(&pdev->dev, "cannot assign irq %d\n", pdev->irq);
1730 else { 1725 else {
1726 hw->flags |= SKY2_HW_IRQ_SETUP;
1727
1731 napi_enable(&hw->napi); 1728 napi_enable(&hw->napi);
1732 sky2_write32(hw, B0_IMSK, Y2_IS_BASE); 1729 sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
1733 sky2_read32(hw, B0_IMSK); 1730 sky2_read32(hw, B0_IMSK);
@@ -1738,7 +1735,7 @@ static int sky2_setup_irq(struct sky2_hw *hw, const char *name)
1738 1735
1739 1736
1740/* Bring up network interface. */ 1737/* Bring up network interface. */
1741static int sky2_up(struct net_device *dev) 1738static int sky2_open(struct net_device *dev)
1742{ 1739{
1743 struct sky2_port *sky2 = netdev_priv(dev); 1740 struct sky2_port *sky2 = netdev_priv(dev);
1744 struct sky2_hw *hw = sky2->hw; 1741 struct sky2_hw *hw = sky2->hw;
@@ -1758,6 +1755,11 @@ static int sky2_up(struct net_device *dev)
1758 1755
1759 sky2_hw_up(sky2); 1756 sky2_hw_up(sky2);
1760 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
1761 /* Enable interrupts from phy/mac for port */ 1763 /* Enable interrupts from phy/mac for port */
1762 imask = sky2_read32(hw, B0_IMSK); 1764 imask = sky2_read32(hw, B0_IMSK);
1763 imask |= portirq_msk[port]; 1765 imask |= portirq_msk[port];
@@ -2051,6 +2053,8 @@ static void sky2_tx_reset(struct sky2_hw *hw, unsigned port)
2051 2053
2052 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);
2053 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);
2054} 2058}
2055 2059
2056static void sky2_hw_down(struct sky2_port *sky2) 2060static void sky2_hw_down(struct sky2_port *sky2)
@@ -2101,7 +2105,7 @@ static void sky2_hw_down(struct sky2_port *sky2)
2101} 2105}
2102 2106
2103/* Network shutdown */ 2107/* Network shutdown */
2104static int sky2_down(struct net_device *dev) 2108static int sky2_close(struct net_device *dev)
2105{ 2109{
2106 struct sky2_port *sky2 = netdev_priv(dev); 2110 struct sky2_port *sky2 = netdev_priv(dev);
2107 struct sky2_hw *hw = sky2->hw; 2111 struct sky2_hw *hw = sky2->hw;
@@ -2112,15 +2116,22 @@ static int sky2_down(struct net_device *dev)
2112 2116
2113 netif_info(sky2, ifdown, dev, "disabling interface\n"); 2117 netif_info(sky2, ifdown, dev, "disabling interface\n");
2114 2118
2115 /* Disable port IRQ */
2116 sky2_write32(hw, B0_IMSK,
2117 sky2_read32(hw, B0_IMSK) & ~portirq_msk[sky2->port]);
2118 sky2_read32(hw, B0_IMSK);
2119
2120 if (hw->ports == 1) { 2119 if (hw->ports == 1) {
2120 sky2_write32(hw, B0_IMSK, 0);
2121 sky2_read32(hw, B0_IMSK);
2122
2121 napi_disable(&hw->napi); 2123 napi_disable(&hw->napi);
2122 free_irq(hw->pdev->irq, hw); 2124 free_irq(hw->pdev->irq, hw);
2125 hw->flags &= ~SKY2_HW_IRQ_SETUP;
2123 } 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
2124 synchronize_irq(hw->pdev->irq); 2135 synchronize_irq(hw->pdev->irq);
2125 napi_synchronize(&hw->napi); 2136 napi_synchronize(&hw->napi);
2126 } 2137 }
@@ -2598,7 +2609,7 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last)
2598 if (netif_running(dev)) { 2609 if (netif_running(dev)) {
2599 sky2_tx_complete(sky2, last); 2610 sky2_tx_complete(sky2, last);
2600 2611
2601 /* 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() */
2602 if (tx_avail(sky2) > MAX_SKB_TX_LE + 4) 2613 if (tx_avail(sky2) > MAX_SKB_TX_LE + 4)
2603 netif_wake_queue(dev); 2614 netif_wake_queue(dev);
2604 } 2615 }
@@ -3269,7 +3280,6 @@ static void sky2_reset(struct sky2_hw *hw)
3269 hw->chip_id == CHIP_ID_YUKON_PRM || 3280 hw->chip_id == CHIP_ID_YUKON_PRM ||
3270 hw->chip_id == CHIP_ID_YUKON_OP_2) { 3281 hw->chip_id == CHIP_ID_YUKON_OP_2) {
3271 u16 reg; 3282 u16 reg;
3272 u32 msk;
3273 3283
3274 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) {
3275 /* 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 */
@@ -3292,11 +3302,6 @@ static void sky2_reset(struct sky2_hw *hw)
3292 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); 3302 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
3293 sky2_pci_write16(hw, PSM_CONFIG_REG4, reg); 3303 sky2_pci_write16(hw, PSM_CONFIG_REG4, reg);
3294 3304
3295 /* enable PHY Quick Link */
3296 msk = sky2_read32(hw, B0_IMSK);
3297 msk |= Y2_IS_PHY_QLNK;
3298 sky2_write32(hw, B0_IMSK, msk);
3299
3300 /* check if PSMv2 was running before */ 3305 /* check if PSMv2 was running before */
3301 reg = sky2_pci_read16(hw, PSM_CONFIG_REG3); 3306 reg = sky2_pci_read16(hw, PSM_CONFIG_REG3);
3302 if (reg & PCI_EXP_LNKCTL_ASPMC) 3307 if (reg & PCI_EXP_LNKCTL_ASPMC)
@@ -3394,7 +3399,7 @@ static void sky2_detach(struct net_device *dev)
3394 netif_tx_lock(dev); 3399 netif_tx_lock(dev);
3395 netif_device_detach(dev); /* stop txq */ 3400 netif_device_detach(dev); /* stop txq */
3396 netif_tx_unlock(dev); 3401 netif_tx_unlock(dev);
3397 sky2_down(dev); 3402 sky2_close(dev);
3398 } 3403 }
3399} 3404}
3400 3405
@@ -3404,7 +3409,7 @@ static int sky2_reattach(struct net_device *dev)
3404 int err = 0; 3409 int err = 0;
3405 3410
3406 if (netif_running(dev)) { 3411 if (netif_running(dev)) {
3407 err = sky2_up(dev); 3412 err = sky2_open(dev);
3408 if (err) { 3413 if (err) {
3409 netdev_info(dev, "could not restart %d\n", err); 3414 netdev_info(dev, "could not restart %d\n", err);
3410 dev_close(dev); 3415 dev_close(dev);
@@ -3421,10 +3426,13 @@ static void sky2_all_down(struct sky2_hw *hw)
3421{ 3426{
3422 int i; 3427 int i;
3423 3428
3424 sky2_read32(hw, B0_IMSK); 3429 if (hw->flags & SKY2_HW_IRQ_SETUP) {
3425 sky2_write32(hw, B0_IMSK, 0); 3430 sky2_read32(hw, B0_IMSK);
3426 synchronize_irq(hw->pdev->irq); 3431 sky2_write32(hw, B0_IMSK, 0);
3427 napi_disable(&hw->napi); 3432
3433 synchronize_irq(hw->pdev->irq);
3434 napi_disable(&hw->napi);
3435 }
3428 3436
3429 for (i = 0; i < hw->ports; i++) { 3437 for (i = 0; i < hw->ports; i++) {
3430 struct net_device *dev = hw->dev[i]; 3438 struct net_device *dev = hw->dev[i];
@@ -3457,11 +3465,12 @@ static void sky2_all_up(struct sky2_hw *hw)
3457 netif_wake_queue(dev); 3465 netif_wake_queue(dev);
3458 } 3466 }
3459 3467
3460 sky2_write32(hw, B0_IMSK, imask); 3468 if (hw->flags & SKY2_HW_IRQ_SETUP) {
3461 sky2_read32(hw, B0_IMSK); 3469 sky2_write32(hw, B0_IMSK, imask);
3462 3470 sky2_read32(hw, B0_IMSK);
3463 sky2_read32(hw, B0_Y2_SP_LISR); 3471 sky2_read32(hw, B0_Y2_SP_LISR);
3464 napi_enable(&hw->napi); 3472 napi_enable(&hw->napi);
3473 }
3465} 3474}
3466 3475
3467static void sky2_restart(struct work_struct *work) 3476static void sky2_restart(struct work_struct *work)
@@ -4082,6 +4091,16 @@ static int sky2_set_coalesce(struct net_device *dev,
4082 return 0; 4091 return 0;
4083} 4092}
4084 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
4085static void sky2_get_ringparam(struct net_device *dev, 4104static void sky2_get_ringparam(struct net_device *dev,
4086 struct ethtool_ringparam *ering) 4105 struct ethtool_ringparam *ering)
4087{ 4106{
@@ -4109,7 +4128,7 @@ static int sky2_set_ringparam(struct net_device *dev,
4109 4128
4110 sky2->rx_pending = ering->rx_pending; 4129 sky2->rx_pending = ering->rx_pending;
4111 sky2->tx_pending = ering->tx_pending; 4130 sky2->tx_pending = ering->tx_pending;
4112 sky2->tx_ring_size = roundup_pow_of_two(sky2->tx_pending+1); 4131 sky2->tx_ring_size = roundup_ring_size(sky2->tx_pending);
4113 4132
4114 return sky2_reattach(dev); 4133 return sky2_reattach(dev);
4115} 4134}
@@ -4567,7 +4586,7 @@ static int sky2_device_event(struct notifier_block *unused,
4567 struct net_device *dev = ptr; 4586 struct net_device *dev = ptr;
4568 struct sky2_port *sky2 = netdev_priv(dev); 4587 struct sky2_port *sky2 = netdev_priv(dev);
4569 4588
4570 if (dev->netdev_ops->ndo_open != sky2_up || !sky2_debug) 4589 if (dev->netdev_ops->ndo_open != sky2_open || !sky2_debug)
4571 return NOTIFY_DONE; 4590 return NOTIFY_DONE;
4572 4591
4573 switch (event) { 4592 switch (event) {
@@ -4632,8 +4651,8 @@ static __exit void sky2_debug_cleanup(void)
4632 not allowing netpoll on second port */ 4651 not allowing netpoll on second port */
4633static const struct net_device_ops sky2_netdev_ops[2] = { 4652static const struct net_device_ops sky2_netdev_ops[2] = {
4634 { 4653 {
4635 .ndo_open = sky2_up, 4654 .ndo_open = sky2_open,
4636 .ndo_stop = sky2_down, 4655 .ndo_stop = sky2_close,
4637 .ndo_start_xmit = sky2_xmit_frame, 4656 .ndo_start_xmit = sky2_xmit_frame,
4638 .ndo_do_ioctl = sky2_ioctl, 4657 .ndo_do_ioctl = sky2_ioctl,
4639 .ndo_validate_addr = eth_validate_addr, 4658 .ndo_validate_addr = eth_validate_addr,
@@ -4649,8 +4668,8 @@ static const struct net_device_ops sky2_netdev_ops[2] = {
4649#endif 4668#endif
4650 }, 4669 },
4651 { 4670 {
4652 .ndo_open = sky2_up, 4671 .ndo_open = sky2_open,
4653 .ndo_stop = sky2_down, 4672 .ndo_stop = sky2_close,
4654 .ndo_start_xmit = sky2_xmit_frame, 4673 .ndo_start_xmit = sky2_xmit_frame,
4655 .ndo_do_ioctl = sky2_ioctl, 4674 .ndo_do_ioctl = sky2_ioctl,
4656 .ndo_validate_addr = eth_validate_addr, 4675 .ndo_validate_addr = eth_validate_addr,
@@ -4703,7 +4722,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
4703 spin_lock_init(&sky2->phy_lock); 4722 spin_lock_init(&sky2->phy_lock);
4704 4723
4705 sky2->tx_pending = TX_DEF_PENDING; 4724 sky2->tx_pending = TX_DEF_PENDING;
4706 sky2->tx_ring_size = roundup_pow_of_two(TX_DEF_PENDING+1); 4725 sky2->tx_ring_size = roundup_ring_size(TX_DEF_PENDING);
4707 sky2->rx_pending = RX_DEF_PENDING; 4726 sky2->rx_pending = RX_DEF_PENDING;
4708 4727
4709 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 0af31b8b5f1..ff6f58bf822 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/alloc.c b/drivers/net/ethernet/mellanox/mlx4/alloc.c
index 116cae334da..8be20e7ea3d 100644
--- a/drivers/net/ethernet/mellanox/mlx4/alloc.c
+++ b/drivers/net/ethernet/mellanox/mlx4/alloc.c
@@ -34,6 +34,7 @@
34#include <linux/errno.h> 34#include <linux/errno.h>
35#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/mm.h> 36#include <linux/mm.h>
37#include <linux/export.h>
37#include <linux/bitmap.h> 38#include <linux/bitmap.h>
38#include <linux/dma-mapping.h> 39#include <linux/dma-mapping.h>
39#include <linux/vmalloc.h> 40#include <linux/vmalloc.h>
diff --git a/drivers/net/ethernet/mellanox/mlx4/catas.c b/drivers/net/ethernet/mellanox/mlx4/catas.c
index 32f947154c3..45aea9c3ae2 100644
--- a/drivers/net/ethernet/mellanox/mlx4/catas.c
+++ b/drivers/net/ethernet/mellanox/mlx4/catas.c
@@ -32,6 +32,7 @@
32 */ 32 */
33 33
34#include <linux/workqueue.h> 34#include <linux/workqueue.h>
35#include <linux/module.h>
35 36
36#include "mlx4.h" 37#include "mlx4.h"
37 38
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index 23cee7b6af9..78f5a1a0b8c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -34,6 +34,7 @@
34 34
35#include <linux/sched.h> 35#include <linux/sched.h>
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <linux/export.h>
37#include <linux/pci.h> 38#include <linux/pci.h>
38#include <linux/errno.h> 39#include <linux/errno.h>
39 40
diff --git a/drivers/net/ethernet/mellanox/mlx4/cq.c b/drivers/net/ethernet/mellanox/mlx4/cq.c
index bd8ef9f2fa7..499a5168892 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cq.c
@@ -35,6 +35,7 @@
35 */ 35 */
36 36
37#include <linux/hardirq.h> 37#include <linux/hardirq.h>
38#include <linux/export.h>
38#include <linux/gfp.h> 39#include <linux/gfp.h>
39 40
40#include <linux/mlx4/cmd.h> 41#include <linux/mlx4/cmd.h>
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index b89c36dbf5b..c2df6c35860 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/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 90f2cd24faa..d901b426753 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -39,6 +39,7 @@
39#include <linux/if_vlan.h> 39#include <linux/if_vlan.h>
40#include <linux/vmalloc.h> 40#include <linux/vmalloc.h>
41#include <linux/tcp.h> 41#include <linux/tcp.h>
42#include <linux/moduleparam.h>
42 43
43#include "mlx4_en.h" 44#include "mlx4_en.h"
44 45
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index 869a2c220a7..24ee9677599 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -33,6 +33,7 @@
33 33
34#include <linux/interrupt.h> 34#include <linux/interrupt.h>
35#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/export.h>
36#include <linux/mm.h> 37#include <linux/mm.h>
37#include <linux/dma-mapping.h> 38#include <linux/dma-mapping.h>
38 39
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
index abdfbacab4a..435ca6e4973 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.c
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
@@ -33,6 +33,7 @@
33 */ 33 */
34 34
35#include <linux/mlx4/cmd.h> 35#include <linux/mlx4/cmd.h>
36#include <linux/module.h>
36#include <linux/cache.h> 37#include <linux/cache.h>
37 38
38#include "fw.h" 39#include "fw.h"
diff --git a/drivers/net/ethernet/mellanox/mlx4/intf.c b/drivers/net/ethernet/mellanox/mlx4/intf.c
index 73c94fcdfdd..ca6feb55bd9 100644
--- a/drivers/net/ethernet/mellanox/mlx4/intf.c
+++ b/drivers/net/ethernet/mellanox/mlx4/intf.c
@@ -32,6 +32,7 @@
32 */ 32 */
33 33
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/export.h>
35 36
36#include "mlx4.h" 37#include "mlx4.h"
37 38
diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c
index cd1784593a3..978688c3104 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mcg.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c
@@ -35,6 +35,7 @@
35#include <linux/etherdevice.h> 35#include <linux/etherdevice.h>
36 36
37#include <linux/mlx4/cmd.h> 37#include <linux/mlx4/cmd.h>
38#include <linux/export.h>
38 39
39#include "mlx4.h" 40#include "mlx4.h"
40 41
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index 8fda331c65d..207b5add3ca 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/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c
index ab639cfef78..efa3e77355e 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mr.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mr.c
@@ -33,6 +33,7 @@
33 */ 33 */
34 34
35#include <linux/errno.h> 35#include <linux/errno.h>
36#include <linux/export.h>
36#include <linux/slab.h> 37#include <linux/slab.h>
37 38
38#include <linux/mlx4/cmd.h> 39#include <linux/mlx4/cmd.h>
diff --git a/drivers/net/ethernet/mellanox/mlx4/pd.c b/drivers/net/ethernet/mellanox/mlx4/pd.c
index 3736163e30e..260ed259ce9 100644
--- a/drivers/net/ethernet/mellanox/mlx4/pd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/pd.c
@@ -32,6 +32,7 @@
32 */ 32 */
33 33
34#include <linux/errno.h> 34#include <linux/errno.h>
35#include <linux/export.h>
35#include <linux/io-mapping.h> 36#include <linux/io-mapping.h>
36 37
37#include <asm/page.h> 38#include <asm/page.h>
diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c
index a44f080fdfe..d942aea4927 100644
--- a/drivers/net/ethernet/mellanox/mlx4/port.c
+++ b/drivers/net/ethernet/mellanox/mlx4/port.c
@@ -32,6 +32,7 @@
32 32
33#include <linux/errno.h> 33#include <linux/errno.h>
34#include <linux/if_ether.h> 34#include <linux/if_ether.h>
35#include <linux/export.h>
35 36
36#include <linux/mlx4/cmd.h> 37#include <linux/mlx4/cmd.h>
37 38
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
index 51c53898c35..15f870cb259 100644
--- a/drivers/net/ethernet/mellanox/mlx4/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
@@ -34,6 +34,7 @@
34 */ 34 */
35 35
36#include <linux/gfp.h> 36#include <linux/gfp.h>
37#include <linux/export.h>
37#include <linux/mlx4/cmd.h> 38#include <linux/mlx4/cmd.h>
38#include <linux/mlx4/qp.h> 39#include <linux/mlx4/qp.h>
39 40
diff --git a/drivers/net/ethernet/mellanox/mlx4/srq.c b/drivers/net/ethernet/mellanox/mlx4/srq.c
index a20b141dbb5..9cbf3fce014 100644
--- a/drivers/net/ethernet/mellanox/mlx4/srq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/srq.c
@@ -32,6 +32,7 @@
32 */ 32 */
33 33
34#include <linux/mlx4/cmd.h> 34#include <linux/mlx4/cmd.h>
35#include <linux/export.h>
35#include <linux/gfp.h> 36#include <linux/gfp.h>
36 37
37#include "mlx4.h" 38#include "mlx4.h"
diff --git a/drivers/net/ethernet/natsemi/Kconfig b/drivers/net/ethernet/natsemi/Kconfig
index 4a6b9fd073b..eb836f770f5 100644
--- a/drivers/net/ethernet/natsemi/Kconfig
+++ b/drivers/net/ethernet/natsemi/Kconfig
@@ -5,7 +5,10 @@
5config NET_VENDOR_NATSEMI 5config NET_VENDOR_NATSEMI
6 bool "National Semi-conductor devices" 6 bool "National Semi-conductor devices"
7 default y 7 default y
8 depends on MCA || MAC || MACH_JAZZ || PCI || XTENSA_PLATFORM_XT2000 8 depends on AMIGA_PCMCIA || ARM || EISA || EXPERIMENTAL || H8300 || \
9 ISA || M32R || MAC || MACH_JAZZ || MACH_TX49XX || MCA || \
10 MCA_LEGACY || MIPS || PCI || PCMCIA || SUPERH || \
11 XTENSA_PLATFORM_XT2000 || ZORRO
9 ---help--- 12 ---help---
10 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
11 and read the Ethernet-HOWTO, available from 14 and read the Ethernet-HOWTO, available from
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c
index 671e166b5af..a83197d757c 100644
--- a/drivers/net/ethernet/neterion/vxge/vxge-main.c
+++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c
@@ -55,6 +55,7 @@
55#include <linux/firmware.h> 55#include <linux/firmware.h>
56#include <linux/net_tstamp.h> 56#include <linux/net_tstamp.h>
57#include <linux/prefetch.h> 57#include <linux/prefetch.h>
58#include <linux/module.h>
58#include "vxge-main.h" 59#include "vxge-main.h"
59#include "vxge-reg.h" 60#include "vxge-reg.h"
60 61
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
index 1e37eb98c4e..1c61d36e657 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;
@@ -1682,6 +1682,7 @@ static void nv_get_hw_stats(struct net_device *dev)
1682 np->estats.tx_pause += readl(base + NvRegTxPause); 1682 np->estats.tx_pause += readl(base + NvRegTxPause);
1683 np->estats.rx_pause += readl(base + NvRegRxPause); 1683 np->estats.rx_pause += readl(base + NvRegRxPause);
1684 np->estats.rx_drop_frame += readl(base + NvRegRxDropFrame); 1684 np->estats.rx_drop_frame += readl(base + NvRegRxDropFrame);
1685 np->estats.rx_errors_total += np->estats.rx_drop_frame;
1685 } 1686 }
1686 1687
1687 if (np->driver_data & DEV_HAS_STATISTICS_V3) { 1688 if (np->driver_data & DEV_HAS_STATISTICS_V3) {
@@ -1705,12 +1706,22 @@ static struct net_device_stats *nv_get_stats(struct net_device *dev)
1705 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)) {
1706 nv_get_hw_stats(dev); 1707 nv_get_hw_stats(dev);
1707 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
1708 /* copy to net_device stats */ 1719 /* copy to net_device stats */
1709 dev->stats.tx_bytes = np->estats.tx_bytes;
1710 dev->stats.tx_fifo_errors = np->estats.tx_fifo_errors; 1720 dev->stats.tx_fifo_errors = np->estats.tx_fifo_errors;
1711 dev->stats.tx_carrier_errors = np->estats.tx_carrier_errors; 1721 dev->stats.tx_carrier_errors = np->estats.tx_carrier_errors;
1712 dev->stats.rx_crc_errors = np->estats.rx_crc_errors; 1722 dev->stats.rx_crc_errors = np->estats.rx_crc_errors;
1713 dev->stats.rx_over_errors = np->estats.rx_over_errors; 1723 dev->stats.rx_over_errors = np->estats.rx_over_errors;
1724 dev->stats.rx_fifo_errors = np->estats.rx_drop_frame;
1714 dev->stats.rx_errors = np->estats.rx_errors_total; 1725 dev->stats.rx_errors = np->estats.rx_errors_total;
1715 dev->stats.tx_errors = np->estats.tx_errors_total; 1726 dev->stats.tx_errors = np->estats.tx_errors_total;
1716 } 1727 }
@@ -2099,10 +2110,10 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
2099 2110
2100 /* add fragments to entries count */ 2111 /* add fragments to entries count */
2101 for (i = 0; i < fragments; i++) { 2112 for (i = 0; i < fragments; i++) {
2102 u32 size = skb_frag_size(&skb_shinfo(skb)->frags[i]); 2113 u32 frag_size = skb_frag_size(&skb_shinfo(skb)->frags[i]);
2103 2114
2104 entries += (size >> NV_TX2_TSO_MAX_SHIFT) + 2115 entries += (frag_size >> NV_TX2_TSO_MAX_SHIFT) +
2105 ((size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); 2116 ((frag_size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0);
2106 } 2117 }
2107 2118
2108 spin_lock_irqsave(&np->lock, flags); 2119 spin_lock_irqsave(&np->lock, flags);
@@ -2141,13 +2152,13 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
2141 /* setup the fragments */ 2152 /* setup the fragments */
2142 for (i = 0; i < fragments; i++) { 2153 for (i = 0; i < fragments; i++) {
2143 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; 2154 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
2144 u32 size = skb_frag_size(frag); 2155 u32 frag_size = skb_frag_size(frag);
2145 offset = 0; 2156 offset = 0;
2146 2157
2147 do { 2158 do {
2148 prev_tx = put_tx; 2159 prev_tx = put_tx;
2149 prev_tx_ctx = np->put_tx_ctx; 2160 prev_tx_ctx = np->put_tx_ctx;
2150 bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; 2161 bcnt = (frag_size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : frag_size;
2151 np->put_tx_ctx->dma = skb_frag_dma_map( 2162 np->put_tx_ctx->dma = skb_frag_dma_map(
2152 &np->pci_dev->dev, 2163 &np->pci_dev->dev,
2153 frag, offset, 2164 frag, offset,
@@ -2159,12 +2170,12 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
2159 put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags); 2170 put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags);
2160 2171
2161 offset += bcnt; 2172 offset += bcnt;
2162 size -= bcnt; 2173 frag_size -= bcnt;
2163 if (unlikely(put_tx++ == np->last_tx.orig)) 2174 if (unlikely(put_tx++ == np->last_tx.orig))
2164 put_tx = np->first_tx.orig; 2175 put_tx = np->first_tx.orig;
2165 if (unlikely(np->put_tx_ctx++ == np->last_tx_ctx)) 2176 if (unlikely(np->put_tx_ctx++ == np->last_tx_ctx))
2166 np->put_tx_ctx = np->first_tx_ctx; 2177 np->put_tx_ctx = np->first_tx_ctx;
2167 } while (size); 2178 } while (frag_size);
2168 } 2179 }
2169 2180
2170 /* set last fragment flag */ 2181 /* set last fragment flag */
@@ -2213,10 +2224,10 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb,
2213 2224
2214 /* add fragments to entries count */ 2225 /* add fragments to entries count */
2215 for (i = 0; i < fragments; i++) { 2226 for (i = 0; i < fragments; i++) {
2216 u32 size = skb_frag_size(&skb_shinfo(skb)->frags[i]); 2227 u32 frag_size = skb_frag_size(&skb_shinfo(skb)->frags[i]);
2217 2228
2218 entries += (size >> NV_TX2_TSO_MAX_SHIFT) + 2229 entries += (frag_size >> NV_TX2_TSO_MAX_SHIFT) +
2219 ((size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); 2230 ((frag_size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0);
2220 } 2231 }
2221 2232
2222 spin_lock_irqsave(&np->lock, flags); 2233 spin_lock_irqsave(&np->lock, flags);
@@ -2257,13 +2268,13 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb,
2257 /* setup the fragments */ 2268 /* setup the fragments */
2258 for (i = 0; i < fragments; i++) { 2269 for (i = 0; i < fragments; i++) {
2259 skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; 2270 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
2260 u32 size = skb_frag_size(frag); 2271 u32 frag_size = skb_frag_size(frag);
2261 offset = 0; 2272 offset = 0;
2262 2273
2263 do { 2274 do {
2264 prev_tx = put_tx; 2275 prev_tx = put_tx;
2265 prev_tx_ctx = np->put_tx_ctx; 2276 prev_tx_ctx = np->put_tx_ctx;
2266 bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; 2277 bcnt = (frag_size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : frag_size;
2267 np->put_tx_ctx->dma = skb_frag_dma_map( 2278 np->put_tx_ctx->dma = skb_frag_dma_map(
2268 &np->pci_dev->dev, 2279 &np->pci_dev->dev,
2269 frag, offset, 2280 frag, offset,
@@ -2276,12 +2287,12 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb,
2276 put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags); 2287 put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags);
2277 2288
2278 offset += bcnt; 2289 offset += bcnt;
2279 size -= bcnt; 2290 frag_size -= bcnt;
2280 if (unlikely(put_tx++ == np->last_tx.ex)) 2291 if (unlikely(put_tx++ == np->last_tx.ex))
2281 put_tx = np->first_tx.ex; 2292 put_tx = np->first_tx.ex;
2282 if (unlikely(np->put_tx_ctx++ == np->last_tx_ctx)) 2293 if (unlikely(np->put_tx_ctx++ == np->last_tx_ctx))
2283 np->put_tx_ctx = np->first_tx_ctx; 2294 np->put_tx_ctx = np->first_tx_ctx;
2284 } while (size); 2295 } while (frag_size);
2285 } 2296 }
2286 2297
2287 /* set last fragment flag */ 2298 /* set last fragment flag */
@@ -2374,13 +2385,8 @@ static int nv_tx_done(struct net_device *dev, int limit)
2374 if (np->desc_ver == DESC_VER_1) { 2385 if (np->desc_ver == DESC_VER_1) {
2375 if (flags & NV_TX_LASTPACKET) { 2386 if (flags & NV_TX_LASTPACKET) {
2376 if (flags & NV_TX_ERROR) { 2387 if (flags & NV_TX_ERROR) {
2377 if (flags & NV_TX_UNDERFLOW)
2378 dev->stats.tx_fifo_errors++;
2379 if (flags & NV_TX_CARRIERLOST)
2380 dev->stats.tx_carrier_errors++;
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);
2383 dev->stats.tx_errors++;
2384 } else { 2390 } else {
2385 dev->stats.tx_packets++; 2391 dev->stats.tx_packets++;
2386 dev->stats.tx_bytes += np->get_tx_ctx->skb->len; 2392 dev->stats.tx_bytes += np->get_tx_ctx->skb->len;
@@ -2392,13 +2398,8 @@ static int nv_tx_done(struct net_device *dev, int limit)
2392 } else { 2398 } else {
2393 if (flags & NV_TX2_LASTPACKET) { 2399 if (flags & NV_TX2_LASTPACKET) {
2394 if (flags & NV_TX2_ERROR) { 2400 if (flags & NV_TX2_ERROR) {
2395 if (flags & NV_TX2_UNDERFLOW)
2396 dev->stats.tx_fifo_errors++;
2397 if (flags & NV_TX2_CARRIERLOST)
2398 dev->stats.tx_carrier_errors++;
2399 if ((flags & NV_TX2_RETRYERROR) && !(flags & NV_TX2_RETRYCOUNT_MASK)) 2401 if ((flags & NV_TX2_RETRYERROR) && !(flags & NV_TX2_RETRYCOUNT_MASK))
2400 nv_legacybackoff_reseed(dev); 2402 nv_legacybackoff_reseed(dev);
2401 dev->stats.tx_errors++;
2402 } else { 2403 } else {
2403 dev->stats.tx_packets++; 2404 dev->stats.tx_packets++;
2404 dev->stats.tx_bytes += np->get_tx_ctx->skb->len; 2405 dev->stats.tx_bytes += np->get_tx_ctx->skb->len;
@@ -2434,15 +2435,16 @@ static int nv_tx_done_optimized(struct net_device *dev, int limit)
2434 nv_unmap_txskb(np, np->get_tx_ctx); 2435 nv_unmap_txskb(np, np->get_tx_ctx);
2435 2436
2436 if (flags & NV_TX2_LASTPACKET) { 2437 if (flags & NV_TX2_LASTPACKET) {
2437 if (!(flags & NV_TX2_ERROR)) 2438 if (flags & NV_TX2_ERROR) {
2438 dev->stats.tx_packets++;
2439 else {
2440 if ((flags & NV_TX2_RETRYERROR) && !(flags & NV_TX2_RETRYCOUNT_MASK)) { 2439 if ((flags & NV_TX2_RETRYERROR) && !(flags & NV_TX2_RETRYCOUNT_MASK)) {
2441 if (np->driver_data & DEV_HAS_GEAR_MODE) 2440 if (np->driver_data & DEV_HAS_GEAR_MODE)
2442 nv_gear_backoff_reseed(dev); 2441 nv_gear_backoff_reseed(dev);
2443 else 2442 else
2444 nv_legacybackoff_reseed(dev); 2443 nv_legacybackoff_reseed(dev);
2445 } 2444 }
2445 } else {
2446 dev->stats.tx_packets++;
2447 dev->stats.tx_bytes += np->get_tx_ctx->skb->len;
2446 } 2448 }
2447 2449
2448 dev_kfree_skb_any(np->get_tx_ctx->skb); 2450 dev_kfree_skb_any(np->get_tx_ctx->skb);
@@ -2636,7 +2638,6 @@ static int nv_rx_process(struct net_device *dev, int limit)
2636 if ((flags & NV_RX_ERROR_MASK) == NV_RX_ERROR4) { 2638 if ((flags & NV_RX_ERROR_MASK) == NV_RX_ERROR4) {
2637 len = nv_getlen(dev, skb->data, len); 2639 len = nv_getlen(dev, skb->data, len);
2638 if (len < 0) { 2640 if (len < 0) {
2639 dev->stats.rx_errors++;
2640 dev_kfree_skb(skb); 2641 dev_kfree_skb(skb);
2641 goto next_pkt; 2642 goto next_pkt;
2642 } 2643 }
@@ -2650,11 +2651,6 @@ static int nv_rx_process(struct net_device *dev, int limit)
2650 else { 2651 else {
2651 if (flags & NV_RX_MISSEDFRAME) 2652 if (flags & NV_RX_MISSEDFRAME)
2652 dev->stats.rx_missed_errors++; 2653 dev->stats.rx_missed_errors++;
2653 if (flags & NV_RX_CRCERR)
2654 dev->stats.rx_crc_errors++;
2655 if (flags & NV_RX_OVERFLOW)
2656 dev->stats.rx_over_errors++;
2657 dev->stats.rx_errors++;
2658 dev_kfree_skb(skb); 2654 dev_kfree_skb(skb);
2659 goto next_pkt; 2655 goto next_pkt;
2660 } 2656 }
@@ -2670,7 +2666,6 @@ static int nv_rx_process(struct net_device *dev, int limit)
2670 if ((flags & NV_RX2_ERROR_MASK) == NV_RX2_ERROR4) { 2666 if ((flags & NV_RX2_ERROR_MASK) == NV_RX2_ERROR4) {
2671 len = nv_getlen(dev, skb->data, len); 2667 len = nv_getlen(dev, skb->data, len);
2672 if (len < 0) { 2668 if (len < 0) {
2673 dev->stats.rx_errors++;
2674 dev_kfree_skb(skb); 2669 dev_kfree_skb(skb);
2675 goto next_pkt; 2670 goto next_pkt;
2676 } 2671 }
@@ -2682,11 +2677,6 @@ static int nv_rx_process(struct net_device *dev, int limit)
2682 } 2677 }
2683 /* the rest are hard errors */ 2678 /* the rest are hard errors */
2684 else { 2679 else {
2685 if (flags & NV_RX2_CRCERR)
2686 dev->stats.rx_crc_errors++;
2687 if (flags & NV_RX2_OVERFLOW)
2688 dev->stats.rx_over_errors++;
2689 dev->stats.rx_errors++;
2690 dev_kfree_skb(skb); 2680 dev_kfree_skb(skb);
2691 goto next_pkt; 2681 goto next_pkt;
2692 } 2682 }
@@ -2787,7 +2777,6 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
2787 __vlan_hwaccel_put_tag(skb, vid); 2777 __vlan_hwaccel_put_tag(skb, vid);
2788 } 2778 }
2789 napi_gro_receive(&np->napi, skb); 2779 napi_gro_receive(&np->napi, skb);
2790
2791 dev->stats.rx_packets++; 2780 dev->stats.rx_packets++;
2792 dev->stats.rx_bytes += len; 2781 dev->stats.rx_bytes += len;
2793 } else { 2782 } else {
@@ -2962,11 +2951,11 @@ static void nv_set_multicast(struct net_device *dev)
2962 struct netdev_hw_addr *ha; 2951 struct netdev_hw_addr *ha;
2963 2952
2964 netdev_for_each_mc_addr(ha, dev) { 2953 netdev_for_each_mc_addr(ha, dev) {
2965 unsigned char *addr = ha->addr; 2954 unsigned char *hw_addr = ha->addr;
2966 u32 a, b; 2955 u32 a, b;
2967 2956
2968 a = le32_to_cpu(*(__le32 *) addr); 2957 a = le32_to_cpu(*(__le32 *) hw_addr);
2969 b = le16_to_cpu(*(__le16 *) (&addr[4])); 2958 b = le16_to_cpu(*(__le16 *) (&hw_addr[4]));
2970 alwaysOn[0] &= a; 2959 alwaysOn[0] &= a;
2971 alwaysOff[0] &= ~a; 2960 alwaysOff[0] &= ~a;
2972 alwaysOn[1] &= b; 2961 alwaysOn[1] &= b;
@@ -3398,7 +3387,8 @@ static irqreturn_t nv_nic_irq_tx(int foo, void *data)
3398 3387
3399 for (i = 0;; i++) { 3388 for (i = 0;; i++) {
3400 events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_TX_ALL; 3389 events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_TX_ALL;
3401 writel(NVREG_IRQ_TX_ALL, base + NvRegMSIXIrqStatus); 3390 writel(events, base + NvRegMSIXIrqStatus);
3391 netdev_dbg(dev, "tx irq events: %08x\n", events);
3402 if (!(events & np->irqmask)) 3392 if (!(events & np->irqmask))
3403 break; 3393 break;
3404 3394
@@ -3509,7 +3499,8 @@ static irqreturn_t nv_nic_irq_rx(int foo, void *data)
3509 3499
3510 for (i = 0;; i++) { 3500 for (i = 0;; i++) {
3511 events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_RX_ALL; 3501 events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_RX_ALL;
3512 writel(NVREG_IRQ_RX_ALL, base + NvRegMSIXIrqStatus); 3502 writel(events, base + NvRegMSIXIrqStatus);
3503 netdev_dbg(dev, "rx irq events: %08x\n", events);
3513 if (!(events & np->irqmask)) 3504 if (!(events & np->irqmask))
3514 break; 3505 break;
3515 3506
@@ -3553,7 +3544,8 @@ static irqreturn_t nv_nic_irq_other(int foo, void *data)
3553 3544
3554 for (i = 0;; i++) { 3545 for (i = 0;; i++) {
3555 events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_OTHER; 3546 events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_OTHER;
3556 writel(NVREG_IRQ_OTHER, base + NvRegMSIXIrqStatus); 3547 writel(events, base + NvRegMSIXIrqStatus);
3548 netdev_dbg(dev, "irq events: %08x\n", events);
3557 if (!(events & np->irqmask)) 3549 if (!(events & np->irqmask))
3558 break; 3550 break;
3559 3551
@@ -3617,10 +3609,10 @@ static irqreturn_t nv_nic_irq_test(int foo, void *data)
3617 3609
3618 if (!(np->msi_flags & NV_MSI_X_ENABLED)) { 3610 if (!(np->msi_flags & NV_MSI_X_ENABLED)) {
3619 events = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK; 3611 events = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK;
3620 writel(NVREG_IRQ_TIMER, base + NvRegIrqStatus); 3612 writel(events & NVREG_IRQ_TIMER, base + NvRegIrqStatus);
3621 } else { 3613 } else {
3622 events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK; 3614 events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK;
3623 writel(NVREG_IRQ_TIMER, base + NvRegMSIXIrqStatus); 3615 writel(events & NVREG_IRQ_TIMER, base + NvRegMSIXIrqStatus);
3624 } 3616 }
3625 pci_push(base); 3617 pci_push(base);
3626 if (!(events & NVREG_IRQ_TIMER)) 3618 if (!(events & NVREG_IRQ_TIMER))
@@ -4566,7 +4558,7 @@ static void nv_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *e
4566 struct fe_priv *np = netdev_priv(dev); 4558 struct fe_priv *np = netdev_priv(dev);
4567 4559
4568 /* update stats */ 4560 /* update stats */
4569 nv_do_stats_poll((unsigned long)dev); 4561 nv_get_hw_stats(dev);
4570 4562
4571 memcpy(buffer, &np->estats, nv_get_sset_count(dev, ETH_SS_STATS)*sizeof(u64)); 4563 memcpy(buffer, &np->estats, nv_get_sset_count(dev, ETH_SS_STATS)*sizeof(u64));
4572} 4564}
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c
index bc1d946b797..212f43b308a 100644
--- a/drivers/net/ethernet/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/octeon/octeon_mgmt.c
@@ -9,6 +9,7 @@
9#include <linux/capability.h> 9#include <linux/capability.h>
10#include <linux/dma-mapping.h> 10#include <linux/dma-mapping.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/module.h>
12#include <linux/interrupt.h> 13#include <linux/interrupt.h>
13#include <linux/platform_device.h> 14#include <linux/platform_device.h>
14#include <linux/netdevice.h> 15#include <linux/netdevice.h>
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index b89f3a684ae..48406ca382f 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -20,6 +20,7 @@
20 20
21#include "pch_gbe.h" 21#include "pch_gbe.h"
22#include "pch_gbe_api.h" 22#include "pch_gbe_api.h"
23#include <linux/module.h>
23 24
24#define DRV_VERSION "1.00" 25#define DRV_VERSION "1.00"
25const char pch_driver_version[] = DRV_VERSION; 26const char pch_driver_version[] = DRV_VERSION;
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 5b5d90a47e2..9cb5f912e48 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
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include "pch_gbe.h" 21#include "pch_gbe.h"
22#include <linux/module.h> /* for __MODULE_STRING */
22 23
23#define OPTION_UNSET -1 24#define OPTION_UNSET -1
24#define OPTION_DISABLED 0 25#define OPTION_DISABLED 0
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge.h b/drivers/net/ethernet/qlogic/qlge/qlge.h
index 8731f79c9ef..b8478aab050 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge.h
+++ b/drivers/net/ethernet/qlogic/qlge/qlge.h
@@ -58,10 +58,8 @@
58 58
59 59
60#define TX_DESC_PER_IOCB 8 60#define TX_DESC_PER_IOCB 8
61/* The maximum number of frags we handle is based 61
62 * on PAGE_SIZE... 62#if ((MAX_SKB_FRAGS - TX_DESC_PER_IOCB) + 2) > 0
63 */
64#if (PAGE_SHIFT == 12) || (PAGE_SHIFT == 13) /* 4k & 8k pages */
65#define TX_DESC_PER_OAL ((MAX_SKB_FRAGS - TX_DESC_PER_IOCB) + 2) 63#define TX_DESC_PER_OAL ((MAX_SKB_FRAGS - TX_DESC_PER_IOCB) + 2)
66#else /* all other page sizes */ 64#else /* all other page sizes */
67#define TX_DESC_PER_OAL 0 65#define TX_DESC_PER_OAL 0
@@ -1353,7 +1351,7 @@ struct tx_ring_desc {
1353 struct ob_mac_iocb_req *queue_entry; 1351 struct ob_mac_iocb_req *queue_entry;
1354 u32 index; 1352 u32 index;
1355 struct oal oal; 1353 struct oal oal;
1356 struct map_list map[MAX_SKB_FRAGS + 1]; 1354 struct map_list map[MAX_SKB_FRAGS + 2];
1357 int map_cnt; 1355 int map_cnt;
1358 struct tx_ring_desc *next; 1356 struct tx_ring_desc *next;
1359}; 1357};
diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c
index 1fc01ca72b4..4bf68cfef39 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/Kconfig b/drivers/net/ethernet/realtek/Kconfig
index 84083ec6e61..0578859a3c7 100644
--- a/drivers/net/ethernet/realtek/Kconfig
+++ b/drivers/net/ethernet/realtek/Kconfig
@@ -115,16 +115,4 @@ config R8169
115 To compile this driver as a module, choose M here: the module 115 To compile this driver as a module, choose M here: the module
116 will be called r8169. This is recommended. 116 will be called r8169. This is recommended.
117 117
118config SC92031
119 tristate "Silan SC92031 PCI Fast Ethernet Adapter driver (EXPERIMENTAL)"
120 depends on PCI && EXPERIMENTAL
121 select CRC32
122 ---help---
123 This is a driver for the Fast Ethernet PCI network cards based on
124 the Silan SC92031 chip (sometimes also called Rsltek 8139D). If you
125 have one of these, say Y here.
126
127 To compile this driver as a module, choose M here: the module
128 will be called sc92031. This is recommended.
129
130endif # NET_VENDOR_REALTEK 118endif # NET_VENDOR_REALTEK
diff --git a/drivers/net/ethernet/realtek/Makefile b/drivers/net/ethernet/realtek/Makefile
index e48cfb6ac42..71b1da30ecb 100644
--- a/drivers/net/ethernet/realtek/Makefile
+++ b/drivers/net/ethernet/realtek/Makefile
@@ -6,4 +6,3 @@ obj-$(CONFIG_8139CP) += 8139cp.o
6obj-$(CONFIG_8139TOO) += 8139too.o 6obj-$(CONFIG_8139TOO) += 8139too.o
7obj-$(CONFIG_ATP) += atp.o 7obj-$(CONFIG_ATP) += atp.o
8obj-$(CONFIG_R8169) += r8169.o 8obj-$(CONFIG_R8169) += r8169.o
9obj-$(CONFIG_SC92031) += sc92031.o
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 92b45f08858..6f06aa10f0d 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/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
index adbda182f15..752d521c09b 100644
--- a/drivers/net/ethernet/sfc/rx.c
+++ b/drivers/net/ethernet/sfc/rx.c
@@ -15,6 +15,7 @@
15#include <linux/tcp.h> 15#include <linux/tcp.h>
16#include <linux/udp.h> 16#include <linux/udp.h>
17#include <linux/prefetch.h> 17#include <linux/prefetch.h>
18#include <linux/moduleparam.h>
18#include <net/ip.h> 19#include <net/ip.h>
19#include <net/checksum.h> 20#include <net/checksum.h>
20#include "net_driver.h" 21#include "net_driver.h"
diff --git a/drivers/net/ethernet/silan/Kconfig b/drivers/net/ethernet/silan/Kconfig
new file mode 100644
index 00000000000..ae1ce170864
--- /dev/null
+++ b/drivers/net/ethernet/silan/Kconfig
@@ -0,0 +1,33 @@
1#
2# Silan device configuration
3#
4
5config NET_VENDOR_SILAN
6 bool "Silan devices"
7 default y
8 depends on PCI && EXPERIMENTAL
9 ---help---
10 If you have a network (Ethernet) card belonging to this class, say Y
11 and read the Ethernet-HOWTO, available from
12 <http://www.tldp.org/docs.html#howto>.
13
14 Note that the answer to this question doesn't directly affect the
15 kernel: saying N will just cause the configurator to skip all
16 the questions about Silan devices. If you say Y, you will be asked for
17 your specific card in the following questions.
18
19if NET_VENDOR_SILAN
20
21config SC92031
22 tristate "Silan SC92031 PCI Fast Ethernet Adapter driver (EXPERIMENTAL)"
23 depends on PCI && EXPERIMENTAL
24 select CRC32
25 ---help---
26 This is a driver for the Fast Ethernet PCI network cards based on
27 the Silan SC92031 chip (sometimes also called Rsltek 8139D). If you
28 have one of these, say Y here.
29
30 To compile this driver as a module, choose M here: the module
31 will be called sc92031. This is recommended.
32
33endif # NET_VENDOR_SILAN
diff --git a/drivers/net/ethernet/silan/Makefile b/drivers/net/ethernet/silan/Makefile
new file mode 100644
index 00000000000..4ad3523dcb9
--- /dev/null
+++ b/drivers/net/ethernet/silan/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for the Silan network device drivers.
3#
4
5obj-$(CONFIG_SC92031) += sc92031.o
diff --git a/drivers/net/ethernet/realtek/sc92031.c b/drivers/net/ethernet/silan/sc92031.c
index a284d644053..a284d644053 100644
--- a/drivers/net/ethernet/realtek/sc92031.c
+++ b/drivers/net/ethernet/silan/sc92031.c
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index d2be42aafbe..8843071fe98 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/smsc/smsc9420.c b/drivers/net/ethernet/smsc/smsc9420.c
index 4f15680849f..edb24b0e337 100644
--- a/drivers/net/ethernet/smsc/smsc9420.c
+++ b/drivers/net/ethernet/smsc/smsc9420.c
@@ -28,6 +28,7 @@
28#include <linux/dma-mapping.h> 28#include <linux/dma-mapping.h>
29#include <linux/crc32.h> 29#include <linux/crc32.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/module.h>
31#include <asm/unaligned.h> 32#include <asm/unaligned.h>
32#include "smsc9420.h" 33#include "smsc9420.h"
33 34
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index ac6f190743d..22745d7bf53 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -29,15 +29,6 @@ config STMMAC_DA
29 By default, the DMA arbitration scheme is based on Round-robin 29 By default, the DMA arbitration scheme is based on Round-robin
30 (rx:tx priority is 1:1). 30 (rx:tx priority is 1:1).
31 31
32config STMMAC_DUAL_MAC
33 bool "STMMAC: dual mac support (EXPERIMENTAL)"
34 default n
35 depends on EXPERIMENTAL && STMMAC_ETH && !STMMAC_TIMER
36 ---help---
37 Some ST SoCs (for example the stx7141 and stx7200c2) have two
38 Ethernet Controllers. This option turns on the second Ethernet
39 device on this kind of platforms.
40
41config STMMAC_TIMER 32config STMMAC_TIMER
42 bool "STMMAC Timer optimisation" 33 bool "STMMAC Timer optimisation"
43 default n 34 default n
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
index da66ac511c4..4d5402a1d26 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 627f656b0f3..bc17fd08b55 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 9bafa6cf9e8..a140a8fbf05 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 e8eff09bbbd..0395f9eba80 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 20546bbbb8d..72cd190b9c1 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
@@ -783,10 +781,15 @@ static void stmmac_mmc_setup(struct stmmac_priv *priv)
783 unsigned int mode = MMC_CNTRL_RESET_ON_READ | MMC_CNTRL_COUNTER_RESET | 781 unsigned int mode = MMC_CNTRL_RESET_ON_READ | MMC_CNTRL_COUNTER_RESET |
784 MMC_CNTRL_PRESET | MMC_CNTRL_FULL_HALF_PRESET; 782 MMC_CNTRL_PRESET | MMC_CNTRL_FULL_HALF_PRESET;
785 783
786 /* Do not manage MMC IRQ (FIXME) */ 784 /* Mask MMC irq, counters are managed in SW and registers
785 * are cleared on each READ eventually. */
787 dwmac_mmc_intr_all_mask(priv->ioaddr); 786 dwmac_mmc_intr_all_mask(priv->ioaddr);
788 dwmac_mmc_ctrl(priv->ioaddr, mode); 787
789 memset(&priv->mmc, 0, sizeof(struct stmmac_counters)); 788 if (priv->dma_cap.rmon) {
789 dwmac_mmc_ctrl(priv->ioaddr, mode);
790 memset(&priv->mmc, 0, sizeof(struct stmmac_counters));
791 } else
792 pr_info(" No MAC Management Counters available");
790} 793}
791 794
792static u32 stmmac_get_synopsys_id(struct stmmac_priv *priv) 795static u32 stmmac_get_synopsys_id(struct stmmac_priv *priv)
@@ -807,8 +810,29 @@ static u32 stmmac_get_synopsys_id(struct stmmac_priv *priv)
807 return 0; 810 return 0;
808} 811}
809 812
810/* New GMAC chips support a new register to indicate the 813/**
811 * presence of the optional feature/functions. 814 * stmmac_selec_desc_mode
815 * @dev : device pointer
816 * Description: select the Enhanced/Alternate or Normal descriptors */
817static void stmmac_selec_desc_mode(struct stmmac_priv *priv)
818{
819 if (priv->plat->enh_desc) {
820 pr_info(" Enhanced/Alternate descriptors\n");
821 priv->hw->desc = &enh_desc_ops;
822 } else {
823 pr_info(" Normal descriptors\n");
824 priv->hw->desc = &ndesc_ops;
825 }
826}
827
828/**
829 * stmmac_get_hw_features
830 * @priv : private device pointer
831 * Description:
832 * new GMAC chip generations have a new register to indicate the
833 * presence of the optional feature/functions.
834 * This can be also used to override the value passed through the
835 * platform and necessary for old MAC10/100 and GMAC chips.
812 */ 836 */
813static int stmmac_get_hw_features(struct stmmac_priv *priv) 837static int stmmac_get_hw_features(struct stmmac_priv *priv)
814{ 838{
@@ -829,7 +853,7 @@ static int stmmac_get_hw_features(struct stmmac_priv *priv)
829 (hw_cap & DMA_HW_FEAT_RWKSEL) >> 9; 853 (hw_cap & DMA_HW_FEAT_RWKSEL) >> 9;
830 priv->dma_cap.pmt_magic_frame = 854 priv->dma_cap.pmt_magic_frame =
831 (hw_cap & DMA_HW_FEAT_MGKSEL) >> 10; 855 (hw_cap & DMA_HW_FEAT_MGKSEL) >> 10;
832 /*MMC*/ 856 /* MMC */
833 priv->dma_cap.rmon = (hw_cap & DMA_HW_FEAT_MMCSEL) >> 11; 857 priv->dma_cap.rmon = (hw_cap & DMA_HW_FEAT_MMCSEL) >> 11;
834 /* IEEE 1588-2002*/ 858 /* IEEE 1588-2002*/
835 priv->dma_cap.time_stamp = 859 priv->dma_cap.time_stamp =
@@ -857,8 +881,7 @@ static int stmmac_get_hw_features(struct stmmac_priv *priv)
857 priv->dma_cap.enh_desc = 881 priv->dma_cap.enh_desc =
858 (hw_cap & DMA_HW_FEAT_ENHDESSEL) >> 24; 882 (hw_cap & DMA_HW_FEAT_ENHDESSEL) >> 24;
859 883
860 } else 884 }
861 pr_debug("\tNo HW DMA feature register supported");
862 885
863 return hw_cap; 886 return hw_cap;
864} 887}
@@ -913,6 +936,44 @@ static int stmmac_open(struct net_device *dev)
913 goto open_error; 936 goto open_error;
914 } 937 }
915 938
939 stmmac_get_synopsys_id(priv);
940
941 priv->hw_cap_support = stmmac_get_hw_features(priv);
942
943 if (priv->hw_cap_support) {
944 pr_info(" Support DMA HW capability register");
945
946 /* We can override some gmac/dma configuration fields: e.g.
947 * enh_desc, tx_coe (e.g. that are passed through the
948 * platform) with the values from the HW capability
949 * register (if supported).
950 */
951 priv->plat->enh_desc = priv->dma_cap.enh_desc;
952 priv->plat->tx_coe = priv->dma_cap.tx_coe;
953 priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up;
954
955 /* By default disable wol on magic frame if not supported */
956 if (!priv->dma_cap.pmt_magic_frame)
957 priv->wolopts &= ~WAKE_MAGIC;
958
959 } else
960 pr_info(" No HW DMA feature register supported");
961
962 /* Select the enhnaced/normal descriptor structures */
963 stmmac_selec_desc_mode(priv);
964
965 /* PMT module is not integrated in all the MAC devices. */
966 if (priv->plat->pmt) {
967 pr_info(" Remote wake-up capable\n");
968 device_set_wakeup_capable(priv->device, 1);
969 }
970
971 priv->rx_coe = priv->hw->mac->rx_coe(priv->ioaddr);
972 if (priv->rx_coe)
973 pr_info(" Checksum Offload Engine supported\n");
974 if (priv->plat->tx_coe)
975 pr_info(" Checksum insertion supported\n");
976
916 /* Create and initialize the TX/RX descriptors chains. */ 977 /* Create and initialize the TX/RX descriptors chains. */
917 priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); 978 priv->dma_tx_size = STMMAC_ALIGN(dma_txsize);
918 priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); 979 priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize);
@@ -935,15 +996,6 @@ static int stmmac_open(struct net_device *dev)
935 /* Initialize the MAC Core */ 996 /* Initialize the MAC Core */
936 priv->hw->mac->core_init(priv->ioaddr); 997 priv->hw->mac->core_init(priv->ioaddr);
937 998
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); 999 netdev_update_features(dev);
948 1000
949 /* Request the IRQ lines */ 1001 /* Request the IRQ lines */
@@ -965,8 +1017,7 @@ static int stmmac_open(struct net_device *dev)
965 memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats)); 1017 memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats));
966 priv->xstats.threshold = tc; 1018 priv->xstats.threshold = tc;
967 1019
968 if (priv->dma_cap.rmon) 1020 stmmac_mmc_setup(priv);
969 stmmac_mmc_setup(priv);
970 1021
971 /* Start the ball rolling... */ 1022 /* Start the ball rolling... */
972 DBG(probe, DEBUG, "%s: DMA RX/TX processes started...\n", dev->name); 1023 DBG(probe, DEBUG, "%s: DMA RX/TX processes started...\n", dev->name);
@@ -1489,9 +1540,7 @@ static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1489 if (!priv->phydev) 1540 if (!priv->phydev)
1490 return -EINVAL; 1541 return -EINVAL;
1491 1542
1492 spin_lock(&priv->lock);
1493 ret = phy_mii_ioctl(priv->phydev, rq, cmd); 1543 ret = phy_mii_ioctl(priv->phydev, rq, cmd);
1494 spin_unlock(&priv->lock);
1495 1544
1496 return ret; 1545 return ret;
1497} 1546}
@@ -1558,7 +1607,7 @@ static int stmmac_sysfs_dma_cap_read(struct seq_file *seq, void *v)
1558 struct net_device *dev = seq->private; 1607 struct net_device *dev = seq->private;
1559 struct stmmac_priv *priv = netdev_priv(dev); 1608 struct stmmac_priv *priv = netdev_priv(dev);
1560 1609
1561 if (!stmmac_get_hw_features(priv)) { 1610 if (!priv->hw_cap_support) {
1562 seq_printf(seq, "DMA HW features not supported\n"); 1611 seq_printf(seq, "DMA HW features not supported\n");
1563 return 0; 1612 return 0;
1564 } 1613 }
@@ -1766,12 +1815,6 @@ static int stmmac_mac_device_setup(struct net_device *dev)
1766 if (!device) 1815 if (!device)
1767 return -ENOMEM; 1816 return -ENOMEM;
1768 1817
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; 1818 priv->hw = device;
1776 priv->hw->ring = &ring_mode_ops; 1819 priv->hw->ring = &ring_mode_ops;
1777 1820
@@ -1845,11 +1888,6 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
1845 1888
1846 priv->ioaddr = addr; 1889 priv->ioaddr = addr;
1847 1890
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 /* 1891 /*
1854 * On some platforms e.g. SPEAr the wake up irq differs from the mac irq 1892 * 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 1893 * The external wake up irq can be passed through the platform code
@@ -1862,7 +1900,6 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
1862 if (priv->wol_irq == -ENXIO) 1900 if (priv->wol_irq == -ENXIO)
1863 priv->wol_irq = ndev->irq; 1901 priv->wol_irq = ndev->irq;
1864 1902
1865
1866 platform_set_drvdata(pdev, ndev); 1903 platform_set_drvdata(pdev, ndev);
1867 1904
1868 /* Set the I/O base addr */ 1905 /* Set the I/O base addr */
@@ -1875,7 +1912,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
1875 goto out_free_ndev; 1912 goto out_free_ndev;
1876 } 1913 }
1877 1914
1878 /* MAC HW revice detection */ 1915 /* MAC HW device detection */
1879 ret = stmmac_mac_device_setup(ndev); 1916 ret = stmmac_mac_device_setup(ndev);
1880 if (ret < 0) 1917 if (ret < 0)
1881 goto out_plat_exit; 1918 goto out_plat_exit;
@@ -1978,12 +2015,13 @@ static int stmmac_suspend(struct device *dev)
1978 if (!ndev || !netif_running(ndev)) 2015 if (!ndev || !netif_running(ndev))
1979 return 0; 2016 return 0;
1980 2017
2018 if (priv->phydev)
2019 phy_stop(priv->phydev);
2020
1981 spin_lock(&priv->lock); 2021 spin_lock(&priv->lock);
1982 2022
1983 netif_device_detach(ndev); 2023 netif_device_detach(ndev);
1984 netif_stop_queue(ndev); 2024 netif_stop_queue(ndev);
1985 if (priv->phydev)
1986 phy_stop(priv->phydev);
1987 2025
1988#ifdef CONFIG_STMMAC_TIMER 2026#ifdef CONFIG_STMMAC_TIMER
1989 priv->tm->timer_stop(); 2027 priv->tm->timer_stop();
@@ -2041,12 +2079,13 @@ static int stmmac_resume(struct device *dev)
2041#endif 2079#endif
2042 napi_enable(&priv->napi); 2080 napi_enable(&priv->napi);
2043 2081
2044 if (priv->phydev)
2045 phy_start(priv->phydev);
2046
2047 netif_start_queue(ndev); 2082 netif_start_queue(ndev);
2048 2083
2049 spin_unlock(&priv->lock); 2084 spin_unlock(&priv->lock);
2085
2086 if (priv->phydev)
2087 phy_start(priv->phydev);
2088
2050 return 0; 2089 return 0;
2051} 2090}
2052 2091
diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
index c517dac02ae..cf14ab9db57 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/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
index ddb33cfd354..7bf1e201578 100644
--- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c
+++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
@@ -1674,6 +1674,9 @@ static int __devinit ps3_gelic_driver_probe(struct ps3_system_bus_device *dev)
1674 int result; 1674 int result;
1675 1675
1676 pr_debug("%s: called\n", __func__); 1676 pr_debug("%s: called\n", __func__);
1677
1678 udbg_shutdown_ps3gelic();
1679
1677 result = ps3_open_hv_device(dev); 1680 result = ps3_open_hv_device(dev);
1678 1681
1679 if (result) { 1682 if (result) {
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.h b/drivers/net/ethernet/toshiba/ps3_gelic_net.h
index d3fadfbc3bc..a93df6ac190 100644
--- a/drivers/net/ethernet/toshiba/ps3_gelic_net.h
+++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.h
@@ -359,6 +359,12 @@ static inline void *port_priv(struct gelic_port *port)
359 return port->priv; 359 return port->priv;
360} 360}
361 361
362#ifdef CONFIG_PPC_EARLY_DEBUG_PS3GELIC
363extern void udbg_shutdown_ps3gelic(void);
364#else
365static inline void udbg_shutdown_ps3gelic(void) {}
366#endif
367
362extern int gelic_card_set_irq_mask(struct gelic_card *card, u64 mask); 368extern int gelic_card_set_irq_mask(struct gelic_card *card, u64 mask);
363/* shared netdev ops */ 369/* shared netdev ops */
364extern void gelic_card_up(struct gelic_card *card); 370extern void gelic_card_up(struct gelic_card *card);
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 4d1658e78de..2681b53820e 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;
@@ -716,8 +720,8 @@ static int temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
716 cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; 720 cur_p = &lp->tx_bd_v[lp->tx_bd_tail];
717 cur_p->phys = dma_map_single(ndev->dev.parent, 721 cur_p->phys = dma_map_single(ndev->dev.parent,
718 skb_frag_address(frag), 722 skb_frag_address(frag),
719 frag_size(frag), DMA_TO_DEVICE); 723 skb_frag_size(frag), DMA_TO_DEVICE);
720 cur_p->len = frag_size(frag); 724 cur_p->len = skb_frag_size(frag);
721 cur_p->app0 = 0; 725 cur_p->app0 = 0;
722 frag++; 726 frag++;
723 } 727 }
@@ -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/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index ec96d910e9a..f45c85a8426 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -35,6 +35,7 @@
35#include <linux/platform_device.h> 35#include <linux/platform_device.h>
36#include <linux/ptp_classify.h> 36#include <linux/ptp_classify.h>
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/module.h>
38#include <mach/ixp46x_ts.h> 39#include <mach/ixp46x_ts.h>
39#include <mach/npe.h> 40#include <mach/npe.h>
40#include <mach/qmgr.h> 41#include <mach/qmgr.h>
diff --git a/drivers/net/hippi/Kconfig b/drivers/net/hippi/Kconfig
index 7393eb732ee..95eb34fdbba 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/irda/Kconfig b/drivers/net/irda/Kconfig
index a40fab44b9a..d423d18b4ad 100644
--- a/drivers/net/irda/Kconfig
+++ b/drivers/net/irda/Kconfig
@@ -314,7 +314,7 @@ config TOSHIBA_FIR
314 314
315config AU1000_FIR 315config AU1000_FIR
316 tristate "Alchemy Au1000 SIR/FIR" 316 tristate "Alchemy Au1000 SIR/FIR"
317 depends on SOC_AU1000 && IRDA 317 depends on IRDA && MIPS_ALCHEMY
318 318
319config SMC_IRCC_FIR 319config SMC_IRCC_FIR
320 tristate "SMSC IrCC (EXPERIMENTAL)" 320 tristate "SMSC IrCC (EXPERIMENTAL)"
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index a3ce3d4561e..74134970b70 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -192,6 +192,13 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
192 */ 192 */
193 macvlan_broadcast(skb, port, src->dev, 193 macvlan_broadcast(skb, port, src->dev,
194 MACVLAN_MODE_VEPA); 194 MACVLAN_MODE_VEPA);
195 else {
196 /* forward to original port. */
197 vlan = src;
198 ret = macvlan_broadcast_one(skb, vlan, eth, 0);
199 goto out;
200 }
201
195 return RX_HANDLER_PASS; 202 return RX_HANDLER_PASS;
196 } 203 }
197 204
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index bb88e12101c..a70244306c9 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -3,7 +3,7 @@
3# 3#
4 4
5menuconfig PHYLIB 5menuconfig PHYLIB
6 bool "PHY Device support and infrastructure" 6 tristate "PHY Device support and infrastructure"
7 depends on !S390 7 depends on !S390
8 depends on NETDEVICES 8 depends on NETDEVICES
9 help 9 help
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index a4eae750a41..f414ffb5b72 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -14,6 +14,7 @@
14 * 14 *
15 */ 15 */
16#include <linux/phy.h> 16#include <linux/phy.h>
17#include <linux/module.h>
17 18
18#define RTL821x_PHYSR 0x11 19#define RTL821x_PHYSR 0x11
19#define RTL821x_PHYSR_DUPLEX 0x2000 20#define RTL821x_PHYSR_DUPLEX 0x2000
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index e81e22e3d1d..e6fed4d4cb7 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 c924ea2bce0..99ed6eb4dfa 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 1e722195105..9c26c6390d6 100644
--- a/drivers/net/usb/lg-vl600.c
+++ b/drivers/net/usb/lg-vl600.c
@@ -27,6 +27,7 @@
27#include <linux/if_ether.h> 27#include <linux/if_ether.h>
28#include <linux/if_arp.h> 28#include <linux/if_arp.h>
29#include <linux/inetdevice.h> 29#include <linux/inetdevice.h>
30#include <linux/module.h>
30 31
31/* 32/*
32 * The device has a CDC ACM port for modem control (it claims to be 33 * The device has a CDC ACM port for modem control (it claims to be
@@ -143,10 +144,11 @@ static int vl600_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
143 } 144 }
144 145
145 frame = (struct vl600_frame_hdr *) buf->data; 146 frame = (struct vl600_frame_hdr *) buf->data;
146 /* NOTE: Should check that frame->magic == 0x53544448? 147 /* Yes, check that frame->magic == 0x53544448 (or 0x44544d48),
147 * Otherwise if we receive garbage at the beginning of the frame 148 * otherwise we may run out of memory w/a bad packet */
148 * we may end up allocating a huge buffer and saving all the 149 if (ntohl(frame->magic) != 0x53544448 &&
149 * future incoming data into it. */ 150 ntohl(frame->magic) != 0x44544d48)
151 goto error;
150 152
151 if (buf->len < sizeof(*frame) || 153 if (buf->len < sizeof(*frame) ||
152 buf->len != le32_to_cpup(&frame->len)) { 154 buf->len != le32_to_cpup(&frame->len)) {
@@ -295,6 +297,11 @@ encapsulate:
295 * overwrite the remaining fields. 297 * overwrite the remaining fields.
296 */ 298 */
297 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);
298 memset(&packet->dummy, 0, sizeof(packet->dummy)); 305 memset(&packet->dummy, 0, sizeof(packet->dummy));
299 packet->len = cpu_to_le32(orig_len); 306 packet->len = cpu_to_le32(orig_len);
300 307
@@ -307,21 +314,12 @@ encapsulate:
307 if (skb->len < full_len) /* Pad */ 314 if (skb->len < full_len) /* Pad */
308 skb_put(skb, full_len - skb->len); 315 skb_put(skb, full_len - skb->len);
309 316
310 /* The VL600 wants IPv6 packets to have an IPv4 ethertype
311 * Check if this is an IPv6 packet, and set the ethertype
312 * to 0x800
313 */
314 if ((skb->data[sizeof(struct vl600_pkt_hdr *) + 0x22] & 0xf0) == 0x60) {
315 skb->data[sizeof(struct vl600_pkt_hdr *) + 0x20] = 0x08;
316 skb->data[sizeof(struct vl600_pkt_hdr *) + 0x21] = 0;
317 }
318
319 return skb; 317 return skb;
320} 318}
321 319
322static const struct driver_info vl600_info = { 320static const struct driver_info vl600_info = {
323 .description = "LG VL600 modem", 321 .description = "LG VL600 modem",
324 .flags = FLAG_ETHER | FLAG_RX_ASSEMBLE, 322 .flags = FLAG_RX_ASSEMBLE | FLAG_WWAN,
325 .bind = vl600_bind, 323 .bind = vl600_bind,
326 .unbind = vl600_unbind, 324 .unbind = vl600_unbind,
327 .status = usbnet_cdc_status, 325 .status = usbnet_cdc_status,
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 22a7cf951e7..a5b9b12ef26 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/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 7d6082160bc..fae0fbd8bc8 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1057,7 +1057,8 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
1057 unsigned long flags; 1057 unsigned long flags;
1058 int retval; 1058 int retval;
1059 1059
1060 skb_tx_timestamp(skb); 1060 if (skb)
1061 skb_tx_timestamp(skb);
1061 1062
1062 // some devices want funky USB-level framing, for 1063 // some devices want funky USB-level framing, for
1063 // win32 driver (usually) and/or hardware quirks 1064 // win32 driver (usually) and/or hardware quirks
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 5b23767ea81..ef883e97cee 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -17,6 +17,7 @@
17#include <net/dst.h> 17#include <net/dst.h>
18#include <net/xfrm.h> 18#include <net/xfrm.h>
19#include <linux/veth.h> 19#include <linux/veth.h>
20#include <linux/module.h>
20 21
21#define DRV_NAME "veth" 22#define DRV_NAME "veth"
22#define DRV_VERSION "1.0" 23#define DRV_VERSION "1.0"
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index b771ebac0f0..d96bfb1ac20 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -24,6 +24,7 @@
24 * 24 *
25 */ 25 */
26 26
27#include <linux/module.h>
27#include <net/ip6_checksum.h> 28#include <net/ip6_checksum.h>
28 29
29#include "vmxnet3_int.h" 30#include "vmxnet3_int.h"
diff --git a/drivers/net/wimax/i2400m/control.c b/drivers/net/wimax/i2400m/control.c
index 727d728649b..2fea02b35b2 100644
--- a/drivers/net/wimax/i2400m/control.c
+++ b/drivers/net/wimax/i2400m/control.c
@@ -78,6 +78,8 @@
78#include <linux/kernel.h> 78#include <linux/kernel.h>
79#include <linux/slab.h> 79#include <linux/slab.h>
80#include <linux/wimax/i2400m.h> 80#include <linux/wimax/i2400m.h>
81#include <linux/export.h>
82#include <linux/moduleparam.h>
81 83
82 84
83#define D_SUBMODULE control 85#define D_SUBMODULE control
diff --git a/drivers/net/wimax/i2400m/debugfs.c b/drivers/net/wimax/i2400m/debugfs.c
index 9c70b5fa3f5..129ba36bd04 100644
--- a/drivers/net/wimax/i2400m/debugfs.c
+++ b/drivers/net/wimax/i2400m/debugfs.c
@@ -26,6 +26,7 @@
26#include <linux/etherdevice.h> 26#include <linux/etherdevice.h>
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <linux/device.h> 28#include <linux/device.h>
29#include <linux/export.h>
29#include "i2400m.h" 30#include "i2400m.h"
30 31
31 32
diff --git a/drivers/net/wimax/i2400m/fw.c b/drivers/net/wimax/i2400m/fw.c
index 85dadd5bf4b..7cbd7d231e1 100644
--- a/drivers/net/wimax/i2400m/fw.c
+++ b/drivers/net/wimax/i2400m/fw.c
@@ -158,6 +158,7 @@
158#include <linux/sched.h> 158#include <linux/sched.h>
159#include <linux/slab.h> 159#include <linux/slab.h>
160#include <linux/usb.h> 160#include <linux/usb.h>
161#include <linux/export.h>
161#include "i2400m.h" 162#include "i2400m.h"
162 163
163 164
diff --git a/drivers/net/wimax/i2400m/netdev.c b/drivers/net/wimax/i2400m/netdev.c
index 2edd8fe1c1f..64a110604ad 100644
--- a/drivers/net/wimax/i2400m/netdev.c
+++ b/drivers/net/wimax/i2400m/netdev.c
@@ -76,6 +76,7 @@
76#include <linux/slab.h> 76#include <linux/slab.h>
77#include <linux/netdevice.h> 77#include <linux/netdevice.h>
78#include <linux/ethtool.h> 78#include <linux/ethtool.h>
79#include <linux/export.h>
79#include "i2400m.h" 80#include "i2400m.h"
80 81
81 82
diff --git a/drivers/net/wimax/i2400m/rx.c b/drivers/net/wimax/i2400m/rx.c
index 2f94a872101..37becfcc98f 100644
--- a/drivers/net/wimax/i2400m/rx.c
+++ b/drivers/net/wimax/i2400m/rx.c
@@ -149,6 +149,8 @@
149#include <linux/if_arp.h> 149#include <linux/if_arp.h>
150#include <linux/netdevice.h> 150#include <linux/netdevice.h>
151#include <linux/workqueue.h> 151#include <linux/workqueue.h>
152#include <linux/export.h>
153#include <linux/moduleparam.h>
152#include "i2400m.h" 154#include "i2400m.h"
153 155
154 156
diff --git a/drivers/net/wimax/i2400m/sdio.c b/drivers/net/wimax/i2400m/sdio.c
index be428cae28d..21a9edd6e75 100644
--- a/drivers/net/wimax/i2400m/sdio.c
+++ b/drivers/net/wimax/i2400m/sdio.c
@@ -55,6 +55,7 @@
55#include <linux/mmc/sdio_func.h> 55#include <linux/mmc/sdio_func.h>
56#include "i2400m-sdio.h" 56#include "i2400m-sdio.h"
57#include <linux/wimax/i2400m.h> 57#include <linux/wimax/i2400m.h>
58#include <linux/module.h>
58 59
59#define D_SUBMODULE main 60#define D_SUBMODULE main
60#include "sdio-debug-levels.h" 61#include "sdio-debug-levels.h"
diff --git a/drivers/net/wimax/i2400m/tx.c b/drivers/net/wimax/i2400m/tx.c
index 4b30ed11d78..4b9ecb20dee 100644
--- a/drivers/net/wimax/i2400m/tx.c
+++ b/drivers/net/wimax/i2400m/tx.c
@@ -245,6 +245,7 @@
245 */ 245 */
246#include <linux/netdevice.h> 246#include <linux/netdevice.h>
247#include <linux/slab.h> 247#include <linux/slab.h>
248#include <linux/export.h>
248#include "i2400m.h" 249#include "i2400m.h"
249 250
250 251
diff --git a/drivers/net/wimax/i2400m/usb.c b/drivers/net/wimax/i2400m/usb.c
index 9a644d052f1..2c1b8b68764 100644
--- a/drivers/net/wimax/i2400m/usb.c
+++ b/drivers/net/wimax/i2400m/usb.c
@@ -67,6 +67,7 @@
67#include <linux/wimax/i2400m.h> 67#include <linux/wimax/i2400m.h>
68#include <linux/debugfs.h> 68#include <linux/debugfs.h>
69#include <linux/slab.h> 69#include <linux/slab.h>
70#include <linux/module.h>
70 71
71 72
72#define D_SUBMODULE usb 73#define D_SUBMODULE usb
diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c
index 3b752d9fb3c..f5ce5623da9 100644
--- a/drivers/net/wireless/adm8211.c
+++ b/drivers/net/wireless/adm8211.c
@@ -25,6 +25,7 @@
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/crc32.h> 26#include <linux/crc32.h>
27#include <linux/eeprom_93cx6.h> 27#include <linux/eeprom_93cx6.h>
28#include <linux/module.h>
28#include <net/mac80211.h> 29#include <net/mac80211.h>
29 30
30#include "adm8211.h" 31#include "adm8211.h"
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
index fce8c904eea..8c5ce8b0c73 100644
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -57,8 +57,9 @@
57 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 57 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
58 * THE POSSIBILITY OF SUCH DAMAGES. 58 * THE POSSIBILITY OF SUCH DAMAGES.
59 */ 59 */
60#include <linux/export.h>
61#include <linux/moduleparam.h>
60 62
61#include <linux/module.h>
62#include <linux/seq_file.h> 63#include <linux/seq_file.h>
63#include <linux/list.h> 64#include <linux/list.h>
64#include "debug.h" 65#include "debug.h"
diff --git a/drivers/net/wireless/ath/ath5k/pci.c b/drivers/net/wireless/ath/ath5k/pci.c
index c1dff2ced04..dfa48eb7d95 100644
--- a/drivers/net/wireless/ath/ath5k/pci.c
+++ b/drivers/net/wireless/ath/ath5k/pci.c
@@ -18,6 +18,7 @@
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/pci-aspm.h> 19#include <linux/pci-aspm.h>
20#include <linux/etherdevice.h> 20#include <linux/etherdevice.h>
21#include <linux/module.h>
21#include "../ath.h" 22#include "../ath.h"
22#include "ath5k.h" 23#include "ath5k.h"
23#include "debug.h" 24#include "debug.h"
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 3aff36bad5d..f517eb8f7b4 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -14,6 +14,8 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17#include <linux/moduleparam.h>
18
17#include "core.h" 19#include "core.h"
18#include "cfg80211.h" 20#include "cfg80211.h"
19#include "debug.h" 21#include "debug.h"
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
index ba3f23d7115..7879b531428 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -19,6 +19,7 @@
19#include <linux/circ_buf.h> 19#include <linux/circ_buf.h>
20#include <linux/fs.h> 20#include <linux/fs.h>
21#include <linux/vmalloc.h> 21#include <linux/vmalloc.h>
22#include <linux/export.h>
22 23
23#include "debug.h" 24#include "debug.h"
24#include "target.h" 25#include "target.h"
diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c
index f1dc311ee0c..066d4f88807 100644
--- a/drivers/net/wireless/ath/ath6kl/sdio.c
+++ b/drivers/net/wireless/ath/ath6kl/sdio.c
@@ -14,6 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17#include <linux/module.h>
17#include <linux/mmc/card.h> 18#include <linux/mmc/card.h>
18#include <linux/mmc/mmc.h> 19#include <linux/mmc/mmc.h>
19#include <linux/mmc/host.h> 20#include <linux/mmc/host.h>
diff --git a/drivers/net/wireless/ath/ath9k/ahb.c b/drivers/net/wireless/ath/ath9k/ahb.c
index 85a54cd2b08..5e47ca6d16a 100644
--- a/drivers/net/wireless/ath/ath9k/ahb.c
+++ b/drivers/net/wireless/ath/ath9k/ahb.c
@@ -19,6 +19,7 @@
19#include <linux/nl80211.h> 19#include <linux/nl80211.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/ath9k_platform.h> 21#include <linux/ath9k_platform.h>
22#include <linux/module.h>
22#include "ath9k.h" 23#include "ath9k.h"
23 24
24static const struct platform_device_id ath9k_platform_id_table[] = { 25static const struct platform_device_id ath9k_platform_id_table[] = {
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
index 2776c3c1f50..a639b94f764 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/export.h>
18#include "hw.h" 19#include "hw.h"
19#include "hw-ops.h" 20#include "hw-ops.h"
20 21
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_calib.c b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
index e0ab0657cc3..88279e325dc 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
@@ -868,10 +868,6 @@ static bool ar9002_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan)
868 /* Do PA Calibration */ 868 /* Do PA Calibration */
869 ar9002_hw_pa_cal(ah, true); 869 ar9002_hw_pa_cal(ah, true);
870 870
871 /* Do NF Calibration after DC offset and other calibrations */
872 ath9k_hw_loadnf(ah, chan);
873 ath9k_hw_start_nfcal(ah, true);
874
875 if (ah->caldata) 871 if (ah->caldata)
876 ah->caldata->nfcal_pending = true; 872 ah->caldata->nfcal_pending = true;
877 873
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
index 626d547d2f0..11f192a1ceb 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
@@ -14,6 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17#include <linux/moduleparam.h>
17#include "hw.h" 18#include "hw.h"
18#include "ar5008_initvals.h" 19#include "ar5008_initvals.h"
19#include "ar9001_initvals.h" 20#include "ar9001_initvals.h"
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_mac.c b/drivers/net/wireless/ath/ath9k/ar9002_mac.c
index f7d8e516a2a..b5920168606 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_mac.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_mac.c
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17#include "hw.h" 17#include "hw.h"
18#include <linux/export.h>
18 19
19#define AR_BufLen 0x00000fff 20#define AR_BufLen 0x00000fff
20 21
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index 16851cb109a..12a730dcb50 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -908,12 +908,15 @@ static bool ar9003_hw_rtt_restore(struct ath_hw *ah, struct ath9k_channel *chan)
908 int i; 908 int i;
909 bool restore; 909 bool restore;
910 910
911 if (!(ah->caps.hw_caps & ATH9K_HW_CAP_RTT) || !ah->caldata) 911 if (!ah->caldata)
912 return false; 912 return false;
913 913
914 hist = &ah->caldata->rtt_hist; 914 hist = &ah->caldata->rtt_hist;
915 if (!hist->num_readings)
916 return false;
917
915 ar9003_hw_rtt_enable(ah); 918 ar9003_hw_rtt_enable(ah);
916 ar9003_hw_rtt_set_mask(ah, 0x10); 919 ar9003_hw_rtt_set_mask(ah, 0x00);
917 for (i = 0; i < AR9300_MAX_CHAINS; i++) { 920 for (i = 0; i < AR9300_MAX_CHAINS; i++) {
918 if (!(ah->rxchainmask & (1 << i))) 921 if (!(ah->rxchainmask & (1 << i)))
919 continue; 922 continue;
@@ -1070,6 +1073,7 @@ skip_tx_iqcal:
1070 if (is_reusable && (hist->num_readings < RTT_HIST_MAX)) { 1073 if (is_reusable && (hist->num_readings < RTT_HIST_MAX)) {
1071 u32 *table; 1074 u32 *table;
1072 1075
1076 hist->num_readings++;
1073 for (i = 0; i < AR9300_MAX_CHAINS; i++) { 1077 for (i = 0; i < AR9300_MAX_CHAINS; i++) {
1074 if (!(ah->rxchainmask & (1 << i))) 1078 if (!(ah->rxchainmask & (1 << i)))
1075 continue; 1079 continue;
@@ -1081,9 +1085,6 @@ skip_tx_iqcal:
1081 ar9003_hw_rtt_disable(ah); 1085 ar9003_hw_rtt_disable(ah);
1082 } 1086 }
1083 1087
1084 ath9k_hw_loadnf(ah, chan);
1085 ath9k_hw_start_nfcal(ah, true);
1086
1087 /* Initialize list pointers */ 1088 /* Initialize list pointers */
1088 ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; 1089 ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
1089 ah->supp_cals = IQ_MISMATCH_CAL; 1090 ah->supp_cals = IQ_MISMATCH_CAL;
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
index b363cc06cfd..ccde784a842 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
@@ -13,6 +13,7 @@
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16#include <linux/export.h>
16#include "hw.h" 17#include "hw.h"
17#include "ar9003_mac.h" 18#include "ar9003_mac.h"
18 19
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
index 0c462c904cb..a4450cba065 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
@@ -14,6 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17#include <linux/export.h>
17#include "hw.h" 18#include "hw.h"
18#include "ar9003_phy.h" 19#include "ar9003_phy.h"
19 20
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index fe96997921d..2330e7ede19 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -14,6 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17#include <linux/export.h>
17#include "hw.h" 18#include "hw.h"
18#include "ar9003_phy.h" 19#include "ar9003_phy.h"
19 20
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.h b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
index 2f4023e6608..4114fe752c6 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
@@ -572,14 +572,14 @@
572 572
573#define AR_PHY_TXGAIN_TABLE (AR_SM_BASE + 0x300) 573#define AR_PHY_TXGAIN_TABLE (AR_SM_BASE + 0x300)
574 574
575#define AR_PHY_TX_IQCAL_CONTROL_0 (AR_SM_BASE + AR_SREV_9485(ah) ? \ 575#define AR_PHY_TX_IQCAL_CONTROL_0 (AR_SM_BASE + (AR_SREV_9485(ah) ? \
576 0x3c4 : 0x444) 576 0x3c4 : 0x444))
577#define AR_PHY_TX_IQCAL_CONTROL_1 (AR_SM_BASE + AR_SREV_9485(ah) ? \ 577#define AR_PHY_TX_IQCAL_CONTROL_1 (AR_SM_BASE + (AR_SREV_9485(ah) ? \
578 0x3c8 : 0x448) 578 0x3c8 : 0x448))
579#define AR_PHY_TX_IQCAL_START (AR_SM_BASE + AR_SREV_9485(ah) ? \ 579#define AR_PHY_TX_IQCAL_START (AR_SM_BASE + (AR_SREV_9485(ah) ? \
580 0x3c4 : 0x440) 580 0x3c4 : 0x440))
581#define AR_PHY_TX_IQCAL_STATUS_B0 (AR_SM_BASE + AR_SREV_9485(ah) ? \ 581#define AR_PHY_TX_IQCAL_STATUS_B0 (AR_SM_BASE + (AR_SREV_9485(ah) ? \
582 0x3f0 : 0x48c) 582 0x3f0 : 0x48c))
583#define AR_PHY_TX_IQCAL_CORR_COEFF_B0(_i) (AR_SM_BASE + \ 583#define AR_PHY_TX_IQCAL_CORR_COEFF_B0(_i) (AR_SM_BASE + \
584 (AR_SREV_9485(ah) ? \ 584 (AR_SREV_9485(ah) ? \
585 0x3d0 : 0x450) + ((_i) << 2)) 585 0x3d0 : 0x450) + ((_i) << 2))
@@ -651,7 +651,7 @@
651#define AR_SWITCH_TABLE_ALL_S (0) 651#define AR_SWITCH_TABLE_ALL_S (0)
652 652
653#define AR_PHY_65NM_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\ 653#define AR_PHY_65NM_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\
654 (AR_SREV_9485(ah) ? 0x1628c : 0x16294)) 654 (AR_SREV_9462(ah) ? 0x16294 : 0x1628c))
655 655
656#define AR_PHY_65NM_CH0_THERM_LOCAL 0x80000000 656#define AR_PHY_65NM_CH0_THERM_LOCAL 0x80000000
657#define AR_PHY_65NM_CH0_THERM_LOCAL_S 31 657#define AR_PHY_65NM_CH0_THERM_LOCAL_S 31
@@ -668,12 +668,12 @@
668#define AR_PHY_65NM_CH2_RXTX2 0x16904 668#define AR_PHY_65NM_CH2_RXTX2 0x16904
669 669
670#define AR_CH0_TOP2 (AR_SREV_9300(ah) ? 0x1628c : \ 670#define AR_CH0_TOP2 (AR_SREV_9300(ah) ? 0x1628c : \
671 (AR_SREV_9485(ah) ? 0x16284 : 0x16290)) 671 (AR_SREV_9462(ah) ? 0x16290 : 0x16284))
672#define AR_CH0_TOP2_XPABIASLVL 0xf000 672#define AR_CH0_TOP2_XPABIASLVL 0xf000
673#define AR_CH0_TOP2_XPABIASLVL_S 12 673#define AR_CH0_TOP2_XPABIASLVL_S 12
674 674
675#define AR_CH0_XTAL (AR_SREV_9300(ah) ? 0x16294 : \ 675#define AR_CH0_XTAL (AR_SREV_9300(ah) ? 0x16294 : \
676 (AR_SREV_9485(ah) ? 0x16290 : 0x16298)) 676 (AR_SREV_9462(ah) ? 0x16298 : 0x16290))
677#define AR_CH0_XTAL_CAPINDAC 0x7f000000 677#define AR_CH0_XTAL_CAPINDAC 0x7f000000
678#define AR_CH0_XTAL_CAPINDAC_S 24 678#define AR_CH0_XTAL_CAPINDAC_S 24
679#define AR_CH0_XTAL_CAPOUTDAC 0x00fe0000 679#define AR_CH0_XTAL_CAPOUTDAC 0x00fe0000
@@ -908,8 +908,8 @@
908#define AR_PHY_TPC_5_B1 (AR_SM1_BASE + 0x208) 908#define AR_PHY_TPC_5_B1 (AR_SM1_BASE + 0x208)
909#define AR_PHY_TPC_6_B1 (AR_SM1_BASE + 0x20c) 909#define AR_PHY_TPC_6_B1 (AR_SM1_BASE + 0x20c)
910#define AR_PHY_TPC_11_B1 (AR_SM1_BASE + 0x220) 910#define AR_PHY_TPC_11_B1 (AR_SM1_BASE + 0x220)
911#define AR_PHY_PDADC_TAB_1 (AR_SM1_BASE + (AR_SREV_AR9300(ah) ? \ 911#define AR_PHY_PDADC_TAB_1 (AR_SM1_BASE + (AR_SREV_AR9462(ah) ? \
912 0x240 : 0x280)) 912 0x280 : 0x240))
913#define AR_PHY_TPC_19_B1 (AR_SM1_BASE + 0x240) 913#define AR_PHY_TPC_19_B1 (AR_SM1_BASE + 0x240)
914#define AR_PHY_TPC_19_B1_ALPHA_THERM 0xff 914#define AR_PHY_TPC_19_B1_ALPHA_THERM 0xff
915#define AR_PHY_TPC_19_B1_ALPHA_THERM_S 0 915#define AR_PHY_TPC_19_B1_ALPHA_THERM_S 0
@@ -931,10 +931,10 @@
931#define AR_PHY_AIC_SRAM_ADDR_B1 (AR_SM1_BASE + 0x5f0) 931#define AR_PHY_AIC_SRAM_ADDR_B1 (AR_SM1_BASE + 0x5f0)
932#define AR_PHY_AIC_SRAM_DATA_B1 (AR_SM1_BASE + 0x5f4) 932#define AR_PHY_AIC_SRAM_DATA_B1 (AR_SM1_BASE + 0x5f4)
933 933
934#define AR_PHY_RTT_TABLE_SW_INTF_B(i) (0x384 + (i) ? \ 934#define AR_PHY_RTT_TABLE_SW_INTF_B(i) (0x384 + ((i) ? \
935 AR_SM1_BASE : AR_SM_BASE) 935 AR_SM1_BASE : AR_SM_BASE))
936#define AR_PHY_RTT_TABLE_SW_INTF_1_B(i) (0x388 + (i) ? \ 936#define AR_PHY_RTT_TABLE_SW_INTF_1_B(i) (0x388 + ((i) ? \
937 AR_SM1_BASE : AR_SM_BASE) 937 AR_SM1_BASE : AR_SM_BASE))
938/* 938/*
939 * Channel 2 Register Map 939 * Channel 2 Register Map
940 */ 940 */
diff --git a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h
index 611ea6ce850..d16d029f81a 100644
--- a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h
+++ b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h
@@ -521,7 +521,7 @@ static const u32 ar9485_1_1_radio_postamble[][2] = {
521 {0x000160ac, 0x24611800}, 521 {0x000160ac, 0x24611800},
522 {0x000160b0, 0x03284f3e}, 522 {0x000160b0, 0x03284f3e},
523 {0x0001610c, 0x00170000}, 523 {0x0001610c, 0x00170000},
524 {0x00016140, 0x10804008}, 524 {0x00016140, 0x50804008},
525}; 525};
526 526
527static const u32 ar9485_1_1_mac_postamble[][5] = { 527static const u32 ar9485_1_1_mac_postamble[][5] = {
@@ -603,7 +603,7 @@ static const u32 ar9485_1_1_radio_core[][2] = {
603 603
604static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_enable_L1[][2] = { 604static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_enable_L1[][2] = {
605 /* Addr allmodes */ 605 /* Addr allmodes */
606 {0x00018c00, 0x10052e5e}, 606 {0x00018c00, 0x18052e5e},
607 {0x00018c04, 0x000801d8}, 607 {0x00018c04, 0x000801d8},
608 {0x00018c08, 0x0000080c}, 608 {0x00018c08, 0x0000080c},
609}; 609};
@@ -776,7 +776,7 @@ static const u32 ar9485_modes_green_ob_db_tx_gain_1_1[][5] = {
776 776
777static const u32 ar9485_1_1_pcie_phy_clkreq_disable_L1[][2] = { 777static const u32 ar9485_1_1_pcie_phy_clkreq_disable_L1[][2] = {
778 /* Addr allmodes */ 778 /* Addr allmodes */
779 {0x00018c00, 0x10013e5e}, 779 {0x00018c00, 0x18013e5e},
780 {0x00018c04, 0x000801d8}, 780 {0x00018c04, 0x000801d8},
781 {0x00018c08, 0x0000080c}, 781 {0x00018c08, 0x0000080c},
782}; 782};
@@ -882,7 +882,7 @@ static const u32 ar9485_fast_clock_1_1_baseband_postamble[][3] = {
882 882
883static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_disable_L1[][2] = { 883static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_disable_L1[][2] = {
884 /* Addr allmodes */ 884 /* Addr allmodes */
885 {0x00018c00, 0x10012e5e}, 885 {0x00018c00, 0x18012e5e},
886 {0x00018c04, 0x000801d8}, 886 {0x00018c04, 0x000801d8},
887 {0x00018c08, 0x0000080c}, 887 {0x00018c08, 0x0000080c},
888}; 888};
@@ -1021,7 +1021,7 @@ static const u32 ar9485_common_rx_gain_1_1[][2] = {
1021 1021
1022static const u32 ar9485_1_1_pcie_phy_clkreq_enable_L1[][2] = { 1022static const u32 ar9485_1_1_pcie_phy_clkreq_enable_L1[][2] = {
1023 /* Addr allmodes */ 1023 /* Addr allmodes */
1024 {0x00018c00, 0x10053e5e}, 1024 {0x00018c00, 0x18053e5e},
1025 {0x00018c04, 0x000801d8}, 1025 {0x00018c04, 0x000801d8},
1026 {0x00018c08, 0x0000080c}, 1026 {0x00018c08, 0x0000080c},
1027}; 1027};
diff --git a/drivers/net/wireless/ath/ath9k/btcoex.c b/drivers/net/wireless/ath/ath9k/btcoex.c
index 6635c377dc0..012263968d6 100644
--- a/drivers/net/wireless/ath/ath9k/btcoex.c
+++ b/drivers/net/wireless/ath/ath9k/btcoex.c
@@ -14,6 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17#include <linux/export.h>
17#include "hw.h" 18#include "hw.h"
18 19
19enum ath_bt_mode { 20enum ath_bt_mode {
diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c
index ebaf304f464..99538810a31 100644
--- a/drivers/net/wireless/ath/ath9k/calib.c
+++ b/drivers/net/wireless/ath/ath9k/calib.c
@@ -16,6 +16,7 @@
16 16
17#include "hw.h" 17#include "hw.h"
18#include "hw-ops.h" 18#include "hw-ops.h"
19#include <linux/export.h>
19 20
20/* Common calibration code */ 21/* Common calibration code */
21 22
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 327aa28f603..2741203e803 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/vmalloc.h> 18#include <linux/vmalloc.h>
19#include <linux/export.h>
19#include <asm/unaligned.h> 20#include <asm/unaligned.h>
20 21
21#include "ath9k.h" 22#include "ath9k.h"
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index f16d2033081..8873c6e6fb9 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/module.h>
19#include <asm/unaligned.h> 20#include <asm/unaligned.h>
20 21
21#include "hw.h" 22#include "hw.h"
@@ -1724,6 +1725,9 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
1724 if (!ath9k_hw_init_cal(ah, chan)) 1725 if (!ath9k_hw_init_cal(ah, chan))
1725 return -EIO; 1726 return -EIO;
1726 1727
1728 ath9k_hw_loadnf(ah, chan);
1729 ath9k_hw_start_nfcal(ah, true);
1730
1727 ENABLE_REGWRITE_BUFFER(ah); 1731 ENABLE_REGWRITE_BUFFER(ah);
1728 1732
1729 ath9k_hw_restore_chainmask(ah); 1733 ath9k_hw_restore_chainmask(ah);
@@ -1823,7 +1827,8 @@ static void ath9k_set_power_sleep(struct ath_hw *ah, int setChip)
1823 } 1827 }
1824 1828
1825 /* Clear Bit 14 of AR_WA after putting chip into Full Sleep mode. */ 1829 /* Clear Bit 14 of AR_WA after putting chip into Full Sleep mode. */
1826 REG_WRITE(ah, AR_WA, ah->WARegVal & ~AR_WA_D3_L1_DISABLE); 1830 if (AR_SREV_9300_20_OR_LATER(ah))
1831 REG_WRITE(ah, AR_WA, ah->WARegVal & ~AR_WA_D3_L1_DISABLE);
1827} 1832}
1828 1833
1829/* 1834/*
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index af1b3254953..d4c909f8e47 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -17,6 +17,7 @@
17#include <linux/dma-mapping.h> 17#include <linux/dma-mapping.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/ath9k_platform.h> 19#include <linux/ath9k_platform.h>
20#include <linux/module.h>
20 21
21#include "ath9k.h" 22#include "ath9k.h"
22 23
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
index 6a8fdf33a52..ecdb6fd2907 100644
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -16,6 +16,7 @@
16 16
17#include "hw.h" 17#include "hw.h"
18#include "hw-ops.h" 18#include "hw-ops.h"
19#include <linux/export.h>
19 20
20static void ath9k_hw_set_txq_interrupts(struct ath_hw *ah, 21static void ath9k_hw_set_txq_interrupts(struct ath_hw *ah,
21 struct ath9k_tx_queue_info *qi) 22 struct ath9k_tx_queue_info *qi)
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index edb0b4b3da3..2dcdf63cb39 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -18,6 +18,7 @@
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/pci-aspm.h> 19#include <linux/pci-aspm.h>
20#include <linux/ath9k_platform.h> 20#include <linux/ath9k_platform.h>
21#include <linux/module.h>
21#include "ath9k.h" 22#include "ath9k.h"
22 23
23static DEFINE_PCI_DEVICE_TABLE(ath_pci_id_table) = { 24static DEFINE_PCI_DEVICE_TABLE(ath_pci_id_table) = {
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 8448281dd06..888abc2be3a 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -16,6 +16,7 @@
16 */ 16 */
17 17
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/export.h>
19 20
20#include "ath9k.h" 21#include "ath9k.h"
21 22
diff --git a/drivers/net/wireless/ath/carl9170/fw.c b/drivers/net/wireless/ath/carl9170/fw.c
index f4cae1cccbf..cba9d0435dc 100644
--- a/drivers/net/wireless/ath/carl9170/fw.c
+++ b/drivers/net/wireless/ath/carl9170/fw.c
@@ -23,6 +23,7 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/firmware.h> 24#include <linux/firmware.h>
25#include <linux/crc32.h> 25#include <linux/crc32.h>
26#include <linux/module.h>
26#include "carl9170.h" 27#include "carl9170.h"
27#include "fwcmd.h" 28#include "fwcmd.h"
28#include "version.h" 29#include "version.h"
diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c
index d20946939cd..59472e1605c 100644
--- a/drivers/net/wireless/ath/carl9170/tx.c
+++ b/drivers/net/wireless/ath/carl9170/tx.c
@@ -296,7 +296,8 @@ static void carl9170_tx_release(struct kref *ref)
296 super = (void *)skb->data; 296 super = (void *)skb->data;
297 txinfo->status.ampdu_len = super->s.rix; 297 txinfo->status.ampdu_len = super->s.rix;
298 txinfo->status.ampdu_ack_len = super->s.cnt; 298 txinfo->status.ampdu_ack_len = super->s.cnt;
299 } else if (txinfo->flags & IEEE80211_TX_STAT_ACK) { 299 } else if ((txinfo->flags & IEEE80211_TX_STAT_ACK) &&
300 !(txinfo->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) {
300 /* 301 /*
301 * drop redundant tx_status reports: 302 * drop redundant tx_status reports:
302 * 303 *
@@ -308,15 +309,17 @@ static void carl9170_tx_release(struct kref *ref)
308 * 309 *
309 * 3. minstrel_ht is picky, it only accepts 310 * 3. minstrel_ht is picky, it only accepts
310 * reports of frames with the TX_STATUS_AMPDU flag. 311 * reports of frames with the TX_STATUS_AMPDU flag.
312 *
313 * 4. mac80211 is not particularly interested in
314 * feedback either [CTL_REQ_TX_STATUS not set]
311 */ 315 */
312 316
313 dev_kfree_skb_any(skb); 317 dev_kfree_skb_any(skb);
314 return; 318 return;
315 } else { 319 } else {
316 /* 320 /*
317 * Frame has failed, but we want to keep it in 321 * Either the frame transmission has failed or
318 * case it was lost due to a power-state 322 * mac80211 requested tx status.
319 * transition.
320 */ 323 */
321 } 324 }
322 } 325 }
diff --git a/drivers/net/wireless/ath/debug.c b/drivers/net/wireless/ath/debug.c
index 5367b1086e0..508eccf5d98 100644
--- a/drivers/net/wireless/ath/debug.c
+++ b/drivers/net/wireless/ath/debug.c
@@ -14,6 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17#include <linux/export.h>
17#include "ath.h" 18#include "ath.h"
18 19
19const char *ath_opmode_to_string(enum nl80211_iftype opmode) 20const char *ath_opmode_to_string(enum nl80211_iftype opmode)
diff --git a/drivers/net/wireless/ath/hw.c b/drivers/net/wireless/ath/hw.c
index 3f508e59f14..19befb33107 100644
--- a/drivers/net/wireless/ath/hw.c
+++ b/drivers/net/wireless/ath/hw.c
@@ -14,6 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17#include <linux/export.h>
17#include <asm/unaligned.h> 18#include <asm/unaligned.h>
18 19
19#include "ath.h" 20#include "ath.h"
diff --git a/drivers/net/wireless/ath/key.c b/drivers/net/wireless/ath/key.c
index 17b0efd86f9..4cf7c5eb481 100644
--- a/drivers/net/wireless/ath/key.c
+++ b/drivers/net/wireless/ath/key.c
@@ -15,6 +15,7 @@
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 16 */
17 17
18#include <linux/export.h>
18#include <asm/unaligned.h> 19#include <asm/unaligned.h>
19#include <net/mac80211.h> 20#include <net/mac80211.h>
20 21
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index 028310f263c..65ecb5bab25 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/export.h>
18#include <net/cfg80211.h> 19#include <net/cfg80211.h>
19#include <net/mac80211.h> 20#include <net/mac80211.h>
20#include "regd.h" 21#include "regd.h"
@@ -253,6 +254,8 @@ ath_reg_apply_active_scan_flags(struct wiphy *wiphy,
253 int r; 254 int r;
254 255
255 sband = wiphy->bands[IEEE80211_BAND_2GHZ]; 256 sband = wiphy->bands[IEEE80211_BAND_2GHZ];
257 if (!sband)
258 return;
256 259
257 /* 260 /*
258 * 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/main.c b/drivers/net/wireless/b43/main.c
index 7cf4125a162..5634d9a9965 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -34,7 +34,7 @@
34 34
35#include <linux/delay.h> 35#include <linux/delay.h>
36#include <linux/init.h> 36#include <linux/init.h>
37#include <linux/moduleparam.h> 37#include <linux/module.h>
38#include <linux/if_arp.h> 38#include <linux/if_arp.h>
39#include <linux/etherdevice.h> 39#include <linux/etherdevice.h>
40#include <linux/firmware.h> 40#include <linux/firmware.h>
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c
index 12b6b4067a3..714cad649c4 100644
--- a/drivers/net/wireless/b43/pcmcia.c
+++ b/drivers/net/wireless/b43/pcmcia.c
@@ -25,6 +25,7 @@
25 25
26#include <linux/ssb/ssb.h> 26#include <linux/ssb/ssb.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/module.h>
28 29
29#include <pcmcia/cistpl.h> 30#include <pcmcia/cistpl.h>
30#include <pcmcia/ciscode.h> 31#include <pcmcia/ciscode.h>
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index c73e8600d21..5f77cbe0b6a 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
@@ -827,7 +838,6 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
827#endif 838#endif
828 return; 839 return;
829drop: 840drop:
830 b43dbg(dev->wl, "RX: Packet dropped\n");
831 dev_kfree_skb_any(skb); 841 dev_kfree_skb_any(skb);
832} 842}
833 843
diff --git a/drivers/net/wireless/b43/xmit.h b/drivers/net/wireless/b43/xmit.h
index 16c514d54af..98d90747836 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/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index a3b72cd72c6..20f02437af8 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -31,7 +31,7 @@
31 31
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/moduleparam.h> 34#include <linux/module.h>
35#include <linux/if_arp.h> 35#include <linux/if_arp.h>
36#include <linux/etherdevice.h> 36#include <linux/etherdevice.h>
37#include <linux/firmware.h> 37#include <linux/firmware.h>
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index bff9dcd6fad..89ff94da556 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -17,6 +17,7 @@
17 17
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/netdevice.h> 19#include <linux/netdevice.h>
20#include <linux/export.h>
20#include <linux/pci.h> 21#include <linux/pci.h>
21#include <linux/pci_ids.h> 22#include <linux/pci_ids.h>
22#include <linux/sched.h> 23#include <linux/sched.h>
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
index b56a30297c2..6ebec8f4284 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/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
index ac8d02bd34f..0d8a9cdf897 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
@@ -21,6 +21,7 @@
21#include <linux/sched.h> 21#include <linux/sched.h>
22#include <linux/firmware.h> 22#include <linux/firmware.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/module.h>
24#include <net/mac80211.h> 25#include <net/mac80211.h>
25#include <defs.h> 26#include <defs.h>
26#include "nicpci.h" 27#include "nicpci.h"
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
index e0b3e8d406b..df7050abe71 100644
--- a/drivers/net/wireless/hostap/hostap_80211_rx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -1,5 +1,6 @@
1#include <linux/etherdevice.h> 1#include <linux/etherdevice.h>
2#include <linux/slab.h> 2#include <linux/slab.h>
3#include <linux/export.h>
3#include <net/lib80211.h> 4#include <net/lib80211.h>
4#include <linux/if_arp.h> 5#include <linux/if_arp.h>
5 6
diff --git a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c
index c34a3b7f129..344a981a052 100644
--- a/drivers/net/wireless/hostap/hostap_80211_tx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_tx.c
@@ -1,4 +1,5 @@
1#include <linux/slab.h> 1#include <linux/slab.h>
2#include <linux/export.h>
2 3
3#include "hostap_80211.h" 4#include "hostap_80211.h"
4#include "hostap_common.h" 5#include "hostap_common.h"
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index 3d05dc15c6b..e1f41027724 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -21,6 +21,8 @@
21#include <linux/random.h> 21#include <linux/random.h>
22#include <linux/if_arp.h> 22#include <linux/if_arp.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/export.h>
25#include <linux/moduleparam.h>
24 26
25#include "hostap_wlan.h" 27#include "hostap_wlan.h"
26#include "hostap.h" 28#include "hostap.h"
diff --git a/drivers/net/wireless/hostap/hostap_info.c b/drivers/net/wireless/hostap/hostap_info.c
index d737091cf6a..47932b28aac 100644
--- a/drivers/net/wireless/hostap/hostap_info.c
+++ b/drivers/net/wireless/hostap/hostap_info.c
@@ -3,6 +3,7 @@
3#include <linux/if_arp.h> 3#include <linux/if_arp.h>
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/slab.h> 5#include <linux/slab.h>
6#include <linux/export.h>
6#include "hostap_wlan.h" 7#include "hostap_wlan.h"
7#include "hostap.h" 8#include "hostap.h"
8#include "hostap_ap.h" 9#include "hostap_ap.h"
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
index 12de46407c7..045a93645a3 100644
--- a/drivers/net/wireless/hostap/hostap_ioctl.c
+++ b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -5,6 +5,7 @@
5#include <linux/sched.h> 5#include <linux/sched.h>
6#include <linux/ethtool.h> 6#include <linux/ethtool.h>
7#include <linux/if_arp.h> 7#include <linux/if_arp.h>
8#include <linux/module.h>
8#include <net/lib80211.h> 9#include <net/lib80211.h>
9 10
10#include "hostap_wlan.h" 11#include "hostap_wlan.h"
diff --git a/drivers/net/wireless/hostap/hostap_proc.c b/drivers/net/wireless/hostap/hostap_proc.c
index 005ff25a405..75ef8f04aab 100644
--- a/drivers/net/wireless/hostap/hostap_proc.c
+++ b/drivers/net/wireless/hostap/hostap_proc.c
@@ -2,6 +2,7 @@
2 2
3#include <linux/types.h> 3#include <linux/types.h>
4#include <linux/proc_fs.h> 4#include <linux/proc_fs.h>
5#include <linux/export.h>
5#include <net/lib80211.h> 6#include <net/lib80211.h>
6 7
7#include "hostap_wlan.h" 8#include "hostap_wlan.h"
diff --git a/drivers/net/wireless/iwlegacy/iwl-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-debugfs.c
index 996996a7165..1407dca70de 100644
--- a/drivers/net/wireless/iwlegacy/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-debugfs.c
@@ -26,6 +26,7 @@
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *****************************************************************************/ 27 *****************************************************************************/
28#include <linux/ieee80211.h> 28#include <linux/ieee80211.h>
29#include <linux/export.h>
29#include <net/mac80211.h> 30#include <net/mac80211.h>
30 31
31 32
diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c
index 9b5d0abe8be..f4d21ec2249 100644
--- a/drivers/net/wireless/iwlegacy/iwl-rx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-rx.c
@@ -29,6 +29,7 @@
29 29
30#include <linux/etherdevice.h> 30#include <linux/etherdevice.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/export.h>
32#include <net/mac80211.h> 33#include <net/mac80211.h>
33#include <asm/unaligned.h> 34#include <asm/unaligned.h>
34#include "iwl-eeprom.h" 35#include "iwl-eeprom.h"
diff --git a/drivers/net/wireless/iwlegacy/iwl-scan.c b/drivers/net/wireless/iwlegacy/iwl-scan.c
index a6b5222fc59..521b73b527d 100644
--- a/drivers/net/wireless/iwlegacy/iwl-scan.c
+++ b/drivers/net/wireless/iwlegacy/iwl-scan.c
@@ -28,6 +28,7 @@
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/types.h> 29#include <linux/types.h>
30#include <linux/etherdevice.h> 30#include <linux/etherdevice.h>
31#include <linux/export.h>
31#include <net/mac80211.h> 32#include <net/mac80211.h>
32 33
33#include "iwl-eeprom.h" 34#include "iwl-eeprom.h"
diff --git a/drivers/net/wireless/iwlegacy/iwl-sta.c b/drivers/net/wireless/iwlegacy/iwl-sta.c
index 66f0fb2bbe0..f10df3e2813 100644
--- a/drivers/net/wireless/iwlegacy/iwl-sta.c
+++ b/drivers/net/wireless/iwlegacy/iwl-sta.c
@@ -31,6 +31,7 @@
31#include <linux/etherdevice.h> 31#include <linux/etherdevice.h>
32#include <linux/sched.h> 32#include <linux/sched.h>
33#include <linux/lockdep.h> 33#include <linux/lockdep.h>
34#include <linux/export.h>
34 35
35#include "iwl-dev.h" 36#include "iwl-dev.h"
36#include "iwl-core.h" 37#include "iwl-core.h"
diff --git a/drivers/net/wireless/iwlegacy/iwl-tx.c b/drivers/net/wireless/iwlegacy/iwl-tx.c
index ef9e268bf8a..c0dfb1a4e96 100644
--- a/drivers/net/wireless/iwlegacy/iwl-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-tx.c
@@ -30,6 +30,7 @@
30#include <linux/etherdevice.h> 30#include <linux/etherdevice.h>
31#include <linux/sched.h> 31#include <linux/sched.h>
32#include <linux/slab.h> 32#include <linux/slab.h>
33#include <linux/export.h>
33#include <net/mac80211.h> 34#include <net/mac80211.h>
34#include "iwl-eeprom.h" 35#include "iwl-eeprom.h"
35#include "iwl-dev.h" 36#include "iwl-dev.h"
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index b247a56d513..001fdf140ab 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1755,16 +1755,6 @@ static inline int iwl_check_stuck_queue(struct iwl_priv *priv, int txq)
1755{ 1755{
1756 if (iwl_trans_check_stuck_queue(trans(priv), txq)) { 1756 if (iwl_trans_check_stuck_queue(trans(priv), txq)) {
1757 int ret; 1757 int ret;
1758 if (txq == priv->shrd->cmd_queue) {
1759 /*
1760 * validate command queue still working
1761 * by sending "ECHO" command
1762 */
1763 if (!iwl_cmd_echo_test(priv))
1764 return 0;
1765 else
1766 IWL_DEBUG_HC(priv, "echo testing fail\n");
1767 }
1768 ret = iwl_force_reset(priv, IWL_FW_RESET, false); 1758 ret = iwl_force_reset(priv, IWL_FW_RESET, false);
1769 return (ret == -EAGAIN) ? 0 : 1; 1759 return (ret == -EAGAIN) ? 0 : 1;
1770 } 1760 }
diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c
index 3b6cc66365e..1800029911a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-pci.c
+++ b/drivers/net/wireless/iwlwifi/iwl-pci.c
@@ -60,6 +60,7 @@
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 * 61 *
62 *****************************************************************************/ 62 *****************************************************************************/
63#include <linux/module.h>
63#include <linux/pci.h> 64#include <linux/pci.h>
64#include <linux/pci-aspm.h> 65#include <linux/pci-aspm.h>
65 66
@@ -445,10 +446,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
445 pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); 446 pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00);
446 447
447 err = pci_enable_msi(pdev); 448 err = pci_enable_msi(pdev);
448 if (err) { 449 if (err)
449 dev_printk(KERN_ERR, &pdev->dev, "pci_enable_msi failed"); 450 dev_printk(KERN_ERR, &pdev->dev,
450 goto out_iounmap; 451 "pci_enable_msi failed(0X%x)", err);
451 }
452 452
453 /* TODO: Move this away, not needed if not MSI */ 453 /* TODO: Move this away, not needed if not MSI */
454 /* enable rfkill interrupt: hw bug w/a */ 454 /* enable rfkill interrupt: hw bug w/a */
@@ -469,7 +469,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
469 469
470out_disable_msi: 470out_disable_msi:
471 pci_disable_msi(pdev); 471 pci_disable_msi(pdev);
472out_iounmap:
473 pci_iounmap(pdev, pci_bus->hw_base); 472 pci_iounmap(pdev, pci_bus->hw_base);
474out_pci_release_regions: 473out_pci_release_regions:
475 pci_set_drvdata(pdev, NULL); 474 pci_set_drvdata(pdev, NULL);
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index 8e8c75c997e..ce918980e97 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -407,6 +407,7 @@ static void iwl_tx_queue_unmap(struct iwl_trans *trans, int txq_id)
407 struct iwl_queue *q = &txq->q; 407 struct iwl_queue *q = &txq->q;
408 enum dma_data_direction dma_dir; 408 enum dma_data_direction dma_dir;
409 unsigned long flags; 409 unsigned long flags;
410 spinlock_t *lock;
410 411
411 if (!q->n_bd) 412 if (!q->n_bd)
412 return; 413 return;
@@ -414,19 +415,22 @@ static void iwl_tx_queue_unmap(struct iwl_trans *trans, int txq_id)
414 /* In the command queue, all the TBs are mapped as BIDI 415 /* In the command queue, all the TBs are mapped as BIDI
415 * so unmap them as such. 416 * so unmap them as such.
416 */ 417 */
417 if (txq_id == trans->shrd->cmd_queue) 418 if (txq_id == trans->shrd->cmd_queue) {
418 dma_dir = DMA_BIDIRECTIONAL; 419 dma_dir = DMA_BIDIRECTIONAL;
419 else 420 lock = &trans->hcmd_lock;
421 } else {
420 dma_dir = DMA_TO_DEVICE; 422 dma_dir = DMA_TO_DEVICE;
423 lock = &trans->shrd->sta_lock;
424 }
421 425
422 spin_lock_irqsave(&trans->shrd->sta_lock, flags); 426 spin_lock_irqsave(lock, flags);
423 while (q->write_ptr != q->read_ptr) { 427 while (q->write_ptr != q->read_ptr) {
424 /* The read_ptr needs to bound by q->n_window */ 428 /* The read_ptr needs to bound by q->n_window */
425 iwlagn_txq_free_tfd(trans, txq, get_cmd_index(q, q->read_ptr), 429 iwlagn_txq_free_tfd(trans, txq, get_cmd_index(q, q->read_ptr),
426 dma_dir); 430 dma_dir);
427 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd); 431 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd);
428 } 432 }
429 spin_unlock_irqrestore(&trans->shrd->sta_lock, flags); 433 spin_unlock_irqrestore(lock, flags);
430} 434}
431 435
432/** 436/**
@@ -986,29 +990,16 @@ static int iwl_trans_tx_stop(struct iwl_trans *trans)
986 return 0; 990 return 0;
987} 991}
988 992
989static void iwl_trans_pcie_disable_sync_irq(struct iwl_trans *trans) 993static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
990{ 994{
991 unsigned long flags; 995 unsigned long flags;
992 struct iwl_trans_pcie *trans_pcie = 996 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
993 IWL_TRANS_GET_PCIE_TRANS(trans);
994 997
998 /* tell the device to stop sending interrupts */
995 spin_lock_irqsave(&trans->shrd->lock, flags); 999 spin_lock_irqsave(&trans->shrd->lock, flags);
996 iwl_disable_interrupts(trans); 1000 iwl_disable_interrupts(trans);
997 spin_unlock_irqrestore(&trans->shrd->lock, flags); 1001 spin_unlock_irqrestore(&trans->shrd->lock, flags);
998 1002
999 /* wait to make sure we flush pending tasklet*/
1000 synchronize_irq(bus(trans)->irq);
1001 tasklet_kill(&trans_pcie->irq_tasklet);
1002}
1003
1004static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
1005{
1006 /* stop and reset the on-board processor */
1007 iwl_write32(bus(trans), CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
1008
1009 /* tell the device to stop sending interrupts */
1010 iwl_trans_pcie_disable_sync_irq(trans);
1011
1012 /* device going down, Stop using ICT table */ 1003 /* device going down, Stop using ICT table */
1013 iwl_disable_ict(trans); 1004 iwl_disable_ict(trans);
1014 1005
@@ -1035,6 +1026,20 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
1035 1026
1036 /* Stop the device, and put it in low power state */ 1027 /* Stop the device, and put it in low power state */
1037 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);
1038} 1043}
1039 1044
1040static 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/iwmc3200wifi/commands.c b/drivers/net/wireless/iwmc3200wifi/commands.c
index 50dee6a0a5c..bd75078c454 100644
--- a/drivers/net/wireless/iwmc3200wifi/commands.c
+++ b/drivers/net/wireless/iwmc3200wifi/commands.c
@@ -42,6 +42,7 @@
42#include <linux/ieee80211.h> 42#include <linux/ieee80211.h>
43#include <linux/sched.h> 43#include <linux/sched.h>
44#include <linux/slab.h> 44#include <linux/slab.h>
45#include <linux/moduleparam.h>
45 46
46#include "iwm.h" 47#include "iwm.h"
47#include "bus.h" 48#include "bus.h"
diff --git a/drivers/net/wireless/iwmc3200wifi/debugfs.c b/drivers/net/wireless/iwmc3200wifi/debugfs.c
index 0a0cc9667cd..87eef5773a0 100644
--- a/drivers/net/wireless/iwmc3200wifi/debugfs.c
+++ b/drivers/net/wireless/iwmc3200wifi/debugfs.c
@@ -25,6 +25,7 @@
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/bitops.h> 26#include <linux/bitops.h>
27#include <linux/debugfs.h> 27#include <linux/debugfs.h>
28#include <linux/export.h>
28 29
29#include "iwm.h" 30#include "iwm.h"
30#include "bus.h" 31#include "bus.h"
diff --git a/drivers/net/wireless/iwmc3200wifi/main.c b/drivers/net/wireless/iwmc3200wifi/main.c
index 362002735b1..98a179f98ea 100644
--- a/drivers/net/wireless/iwmc3200wifi/main.c
+++ b/drivers/net/wireless/iwmc3200wifi/main.c
@@ -42,6 +42,7 @@
42#include <linux/ieee80211.h> 42#include <linux/ieee80211.h>
43#include <linux/wireless.h> 43#include <linux/wireless.h>
44#include <linux/slab.h> 44#include <linux/slab.h>
45#include <linux/moduleparam.h>
45 46
46#include "iwm.h" 47#include "iwm.h"
47#include "debug.h" 48#include "debug.h"
diff --git a/drivers/net/wireless/iwmc3200wifi/sdio.c b/drivers/net/wireless/iwmc3200wifi/sdio.c
index 56383e7be83..764b40dd24a 100644
--- a/drivers/net/wireless/iwmc3200wifi/sdio.c
+++ b/drivers/net/wireless/iwmc3200wifi/sdio.c
@@ -63,6 +63,7 @@
63 */ 63 */
64 64
65#include <linux/kernel.h> 65#include <linux/kernel.h>
66#include <linux/module.h>
66#include <linux/slab.h> 67#include <linux/slab.h>
67#include <linux/netdevice.h> 68#include <linux/netdevice.h>
68#include <linux/debugfs.h> 69#include <linux/debugfs.h>
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index ff6378276ff..a7f1ab28940 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);
@@ -728,15 +728,9 @@ static void lbs_scan_worker(struct work_struct *work)
728 le16_to_cpu(scan_cmd->hdr.size), 728 le16_to_cpu(scan_cmd->hdr.size),
729 lbs_ret_scan, 0); 729 lbs_ret_scan, 0);
730 730
731 if (priv->scan_channel >= priv->scan_req->n_channels) { 731 if (priv->scan_channel >= priv->scan_req->n_channels)
732 /* Mark scan done */ 732 /* Mark scan done */
733 if (priv->internal_scan) 733 lbs_scan_done(priv);
734 kfree(priv->scan_req);
735 else
736 cfg80211_scan_done(priv->scan_req, false);
737
738 priv->scan_req = NULL;
739 }
740 734
741 /* Restart network */ 735 /* Restart network */
742 if (carrier) 736 if (carrier)
@@ -774,6 +768,21 @@ static void _internal_start_scan(struct lbs_private *priv, bool internal,
774 lbs_deb_leave(LBS_DEB_CFG80211); 768 lbs_deb_leave(LBS_DEB_CFG80211);
775} 769}
776 770
771/*
772 * Clean up priv->scan_req. Should be used to handle the allocation details.
773 */
774void lbs_scan_done(struct lbs_private *priv)
775{
776 WARN_ON(!priv->scan_req);
777
778 if (priv->internal_scan)
779 kfree(priv->scan_req);
780 else
781 cfg80211_scan_done(priv->scan_req, false);
782
783 priv->scan_req = NULL;
784}
785
777static int lbs_cfg_scan(struct wiphy *wiphy, 786static int lbs_cfg_scan(struct wiphy *wiphy,
778 struct net_device *dev, 787 struct net_device *dev,
779 struct cfg80211_scan_request *request) 788 struct cfg80211_scan_request *request)
diff --git a/drivers/net/wireless/libertas/cfg.h b/drivers/net/wireless/libertas/cfg.h
index a02ee151710..558168ce634 100644
--- a/drivers/net/wireless/libertas/cfg.h
+++ b/drivers/net/wireless/libertas/cfg.h
@@ -16,6 +16,7 @@ int lbs_reg_notifier(struct wiphy *wiphy,
16void lbs_send_disconnect_notification(struct lbs_private *priv); 16void lbs_send_disconnect_notification(struct lbs_private *priv);
17void lbs_send_mic_failureevent(struct lbs_private *priv, u32 event); 17void lbs_send_mic_failureevent(struct lbs_private *priv, u32 event);
18 18
19void lbs_scan_done(struct lbs_private *priv);
19void lbs_scan_deinit(struct lbs_private *priv); 20void lbs_scan_deinit(struct lbs_private *priv);
20int lbs_disconnect(struct lbs_private *priv, u16 reason); 21int lbs_disconnect(struct lbs_private *priv, u16 reason);
21 22
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index e08ab1de3d9..d798bcc0d83 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -8,6 +8,7 @@
8#include <linux/sched.h> 8#include <linux/sched.h>
9#include <linux/slab.h> 9#include <linux/slab.h>
10#include <linux/if_arp.h> 10#include <linux/if_arp.h>
11#include <linux/export.h>
11 12
12#include "decl.h" 13#include "decl.h"
13#include "cfg.h" 14#include "cfg.h"
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index 1af18277884..d8d8f0d0899 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -5,6 +5,7 @@
5#include <linux/mm.h> 5#include <linux/mm.h>
6#include <linux/string.h> 6#include <linux/string.h>
7#include <linux/slab.h> 7#include <linux/slab.h>
8#include <linux/export.h>
8 9
9#include "decl.h" 10#include "decl.h"
10#include "cmd.h" 11#include "cmd.h"
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index c962e21762d..9804ebc892d 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -29,7 +29,7 @@
29#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 29#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
30 30
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/moduleparam.h> 32#include <linux/module.h>
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <linux/firmware.h> 34#include <linux/firmware.h>
35#include <linux/netdevice.h> 35#include <linux/netdevice.h>
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index 622ae6de0d8..728baa44525 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -21,7 +21,7 @@
21 21
22#include <linux/hardirq.h> 22#include <linux/hardirq.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/moduleparam.h> 24#include <linux/module.h>
25#include <linux/firmware.h> 25#include <linux/firmware.h>
26#include <linux/jiffies.h> 26#include <linux/jiffies.h>
27#include <linux/list.h> 27#include <linux/list.h>
@@ -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/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 8147f1e2a0b..db879c364eb 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -5,7 +5,7 @@
5#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 5#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
6 6
7#include <linux/delay.h> 7#include <linux/delay.h>
8#include <linux/moduleparam.h> 8#include <linux/module.h>
9#include <linux/firmware.h> 9#include <linux/firmware.h>
10#include <linux/netdevice.h> 10#include <linux/netdevice.h>
11#include <linux/slab.h> 11#include <linux/slab.h>
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index b03779bcd54..957681dede1 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -6,7 +6,7 @@
6 6
7#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 7#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
8 8
9#include <linux/moduleparam.h> 9#include <linux/module.h>
10#include <linux/delay.h> 10#include <linux/delay.h>
11#include <linux/etherdevice.h> 11#include <linux/etherdevice.h>
12#include <linux/hardirq.h> 12#include <linux/hardirq.h>
@@ -255,10 +255,8 @@ static int lbs_eth_stop(struct net_device *dev)
255 255
256 lbs_update_mcast(priv); 256 lbs_update_mcast(priv);
257 cancel_delayed_work_sync(&priv->scan_work); 257 cancel_delayed_work_sync(&priv->scan_work);
258 if (priv->scan_req) { 258 if (priv->scan_req)
259 cfg80211_scan_done(priv->scan_req, false); 259 lbs_scan_done(priv);
260 priv->scan_req = NULL;
261 }
262 260
263 netif_carrier_off(priv->dev); 261 netif_carrier_off(priv->dev);
264 262
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c
index 62e10eeadd7..c7366b07b56 100644
--- a/drivers/net/wireless/libertas/rx.c
+++ b/drivers/net/wireless/libertas/rx.c
@@ -8,6 +8,7 @@
8#include <linux/hardirq.h> 8#include <linux/hardirq.h>
9#include <linux/slab.h> 9#include <linux/slab.h>
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/export.h>
11#include <net/cfg80211.h> 12#include <net/cfg80211.h>
12 13
13#include "defs.h" 14#include "defs.h"
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c
index 8f127520d78..c025f9c1828 100644
--- a/drivers/net/wireless/libertas/tx.c
+++ b/drivers/net/wireless/libertas/tx.c
@@ -5,6 +5,7 @@
5#include <linux/netdevice.h> 5#include <linux/netdevice.h>
6#include <linux/etherdevice.h> 6#include <linux/etherdevice.h>
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/export.h>
8#include <net/cfg80211.h> 9#include <net/cfg80211.h>
9 10
10#include "host.h" 11#include "host.h"
diff --git a/drivers/net/wireless/libertas_tf/cmd.c b/drivers/net/wireless/libertas_tf/cmd.c
index 13557fe0bf9..909ac368501 100644
--- a/drivers/net/wireless/libertas_tf/cmd.c
+++ b/drivers/net/wireless/libertas_tf/cmd.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/hardirq.h> 12#include <linux/hardirq.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/export.h>
14 15
15#include "libertas_tf.h" 16#include "libertas_tf.h"
16 17
diff --git a/drivers/net/wireless/libertas_tf/if_usb.c b/drivers/net/wireless/libertas_tf/if_usb.c
index ba7d96584cb..68202e63873 100644
--- a/drivers/net/wireless/libertas_tf/if_usb.c
+++ b/drivers/net/wireless/libertas_tf/if_usb.c
@@ -15,7 +15,7 @@
15#include "if_usb.h" 15#include "if_usb.h"
16 16
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/moduleparam.h> 18#include <linux/module.h>
19#include <linux/firmware.h> 19#include <linux/firmware.h>
20#include <linux/netdevice.h> 20#include <linux/netdevice.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c
index acc461aa385..ceb51b6e670 100644
--- a/drivers/net/wireless/libertas_tf/main.c
+++ b/drivers/net/wireless/libertas_tf/main.c
@@ -13,6 +13,7 @@
13#include <linux/slab.h> 13#include <linux/slab.h>
14 14
15#include <linux/etherdevice.h> 15#include <linux/etherdevice.h>
16#include <linux/module.h>
16#include "libertas_tf.h" 17#include "libertas_tf.h"
17 18
18#define DRIVER_RELEASE_VERSION "004.p0" 19#define DRIVER_RELEASE_VERSION "004.p0"
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 68455a2307c..523ad55a288 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -26,6 +26,7 @@
26#include <linux/rtnetlink.h> 26#include <linux/rtnetlink.h>
27#include <linux/etherdevice.h> 27#include <linux/etherdevice.h>
28#include <linux/debugfs.h> 28#include <linux/debugfs.h>
29#include <linux/module.h>
29#include <net/genetlink.h> 30#include <net/genetlink.h>
30#include "mac80211_hwsim.h" 31#include "mac80211_hwsim.h"
31 32
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index dae8dbb24a0..8d3ab378662 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/orinoco/fw.c b/drivers/net/wireless/orinoco/fw.c
index 527cf5333db..4df8cf64b56 100644
--- a/drivers/net/wireless/orinoco/fw.c
+++ b/drivers/net/wireless/orinoco/fw.c
@@ -6,6 +6,7 @@
6#include <linux/slab.h> 6#include <linux/slab.h>
7#include <linux/firmware.h> 7#include <linux/firmware.h>
8#include <linux/device.h> 8#include <linux/device.h>
9#include <linux/module.h>
9 10
10#include "hermes.h" 11#include "hermes.h"
11#include "hermes_dld.h" 12#include "hermes_dld.h"
diff --git a/drivers/net/wireless/p54/eeprom.c b/drivers/net/wireless/p54/eeprom.c
index 8b6f363b3f7..fa8ce510478 100644
--- a/drivers/net/wireless/p54/eeprom.c
+++ b/drivers/net/wireless/p54/eeprom.c
@@ -24,6 +24,7 @@
24 24
25#include <net/mac80211.h> 25#include <net/mac80211.h>
26#include <linux/crc-ccitt.h> 26#include <linux/crc-ccitt.h>
27#include <linux/export.h>
27 28
28#include "p54.h" 29#include "p54.h"
29#include "eeprom.h" 30#include "eeprom.h"
diff --git a/drivers/net/wireless/p54/fwio.c b/drivers/net/wireless/p54/fwio.c
index 53a3408931b..18e82b31afa 100644
--- a/drivers/net/wireless/p54/fwio.c
+++ b/drivers/net/wireless/p54/fwio.c
@@ -20,6 +20,7 @@
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/firmware.h> 21#include <linux/firmware.h>
22#include <linux/etherdevice.h> 22#include <linux/etherdevice.h>
23#include <linux/export.h>
23 24
24#include <net/mac80211.h> 25#include <net/mac80211.h>
25 26
diff --git a/drivers/net/wireless/p54/main.c b/drivers/net/wireless/p54/main.c
index ad9ae04d07a..db4d9a02f26 100644
--- a/drivers/net/wireless/p54/main.c
+++ b/drivers/net/wireless/p54/main.c
@@ -20,6 +20,7 @@
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/firmware.h> 21#include <linux/firmware.h>
22#include <linux/etherdevice.h> 22#include <linux/etherdevice.h>
23#include <linux/module.h>
23 24
24#include <net/mac80211.h> 25#include <net/mac80211.h>
25 26
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c
index 1b753173680..b1f51a21579 100644
--- a/drivers/net/wireless/p54/p54pci.c
+++ b/drivers/net/wireless/p54/p54pci.c
@@ -20,6 +20,7 @@
20#include <linux/etherdevice.h> 20#include <linux/etherdevice.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/completion.h> 22#include <linux/completion.h>
23#include <linux/module.h>
23#include <net/mac80211.h> 24#include <net/mac80211.h>
24 25
25#include "p54.h" 26#include "p54.h"
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
index f18df82eeb9..78d0d698855 100644
--- a/drivers/net/wireless/p54/p54spi.c
+++ b/drivers/net/wireless/p54/p54spi.c
@@ -588,8 +588,6 @@ static void p54spi_op_stop(struct ieee80211_hw *dev)
588 588
589 WARN_ON(priv->fw_state != FW_STATE_READY); 589 WARN_ON(priv->fw_state != FW_STATE_READY);
590 590
591 cancel_work_sync(&priv->work);
592
593 p54spi_power_off(priv); 591 p54spi_power_off(priv);
594 spin_lock_irqsave(&priv->tx_lock, flags); 592 spin_lock_irqsave(&priv->tx_lock, flags);
595 INIT_LIST_HEAD(&priv->tx_pending); 593 INIT_LIST_HEAD(&priv->tx_pending);
@@ -597,6 +595,8 @@ static void p54spi_op_stop(struct ieee80211_hw *dev)
597 595
598 priv->fw_state = FW_STATE_OFF; 596 priv->fw_state = FW_STATE_OFF;
599 mutex_unlock(&priv->mutex); 597 mutex_unlock(&priv->mutex);
598
599 cancel_work_sync(&priv->work);
600} 600}
601 601
602static int __devinit p54spi_probe(struct spi_device *spi) 602static int __devinit p54spi_probe(struct spi_device *spi)
@@ -656,6 +656,7 @@ static int __devinit p54spi_probe(struct spi_device *spi)
656 init_completion(&priv->fw_comp); 656 init_completion(&priv->fw_comp);
657 INIT_LIST_HEAD(&priv->tx_pending); 657 INIT_LIST_HEAD(&priv->tx_pending);
658 mutex_init(&priv->mutex); 658 mutex_init(&priv->mutex);
659 spin_lock_init(&priv->tx_lock);
659 SET_IEEE80211_DEV(hw, &spi->dev); 660 SET_IEEE80211_DEV(hw, &spi->dev);
660 priv->common.open = p54spi_op_start; 661 priv->common.open = p54spi_op_start;
661 priv->common.stop = p54spi_op_stop; 662 priv->common.stop = p54spi_op_stop;
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index a8f3bc740df..9b609686642 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -20,6 +20,7 @@
20#include <linux/etherdevice.h> 20#include <linux/etherdevice.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/crc32.h> 22#include <linux/crc32.h>
23#include <linux/module.h>
23#include <net/mac80211.h> 24#include <net/mac80211.h>
24 25
25#include "p54.h" 26#include "p54.h"
diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c
index f485784a60a..6ed9c323e3c 100644
--- a/drivers/net/wireless/p54/txrx.c
+++ b/drivers/net/wireless/p54/txrx.c
@@ -16,6 +16,7 @@
16 * published by the Free Software Foundation. 16 * published by the Free Software Foundation.
17 */ 17 */
18 18
19#include <linux/export.h>
19#include <linux/init.h> 20#include <linux/init.h>
20#include <linux/firmware.h> 21#include <linux/firmware.h>
21#include <linux/etherdevice.h> 22#include <linux/etherdevice.h>
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c
index d97a2caf582..bc2ba80c47b 100644
--- a/drivers/net/wireless/prism54/isl_ioctl.c
+++ b/drivers/net/wireless/prism54/isl_ioctl.c
@@ -778,7 +778,7 @@ prism54_get_essid(struct net_device *ndev, struct iw_request_info *info,
778 dwrq->flags = 0; 778 dwrq->flags = 0;
779 dwrq->length = 0; 779 dwrq->length = 0;
780 } 780 }
781 essid->octets[essid->length] = '\0'; 781 essid->octets[dwrq->length] = '\0';
782 memcpy(extra, essid->octets, dwrq->length); 782 memcpy(extra, essid->octets, dwrq->length);
783 kfree(essid); 783 kfree(essid);
784 784
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 3f183a15186..1ba079dffb1 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -3771,7 +3771,7 @@ static void rt2800_efuse_read(struct rt2x00_dev *rt2x00dev, unsigned int i)
3771 /* Apparently the data is read from end to start */ 3771 /* Apparently the data is read from end to start */
3772 rt2800_register_read_lock(rt2x00dev, EFUSE_DATA3, &reg); 3772 rt2800_register_read_lock(rt2x00dev, EFUSE_DATA3, &reg);
3773 /* The returned value is in CPU order, but eeprom is le */ 3773 /* The returned value is in CPU order, but eeprom is le */
3774 rt2x00dev->eeprom[i] = cpu_to_le32(reg); 3774 *(u32 *)&rt2x00dev->eeprom[i] = cpu_to_le32(reg);
3775 rt2800_register_read_lock(rt2x00dev, EFUSE_DATA2, &reg); 3775 rt2800_register_read_lock(rt2x00dev, EFUSE_DATA2, &reg);
3776 *(u32 *)&rt2x00dev->eeprom[i + 2] = cpu_to_le32(reg); 3776 *(u32 *)&rt2x00dev->eeprom[i + 2] = cpu_to_le32(reg);
3777 rt2800_register_read_lock(rt2x00dev, EFUSE_DATA1, &reg); 3777 rt2800_register_read_lock(rt2x00dev, EFUSE_DATA1, &reg);
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index f1565792f27..377876315b8 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 2ec5c00235e..99ff12d0c29 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 e1fb2a8569b..edd317fa7c0 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/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c
index 0082015ff66..2f14a5fb0cb 100644
--- a/drivers/net/wireless/rtl818x/rtl8180/dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c
@@ -22,6 +22,7 @@
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/etherdevice.h> 23#include <linux/etherdevice.h>
24#include <linux/eeprom_93cx6.h> 24#include <linux/eeprom_93cx6.h>
25#include <linux/module.h>
25#include <net/mac80211.h> 26#include <net/mac80211.h>
26 27
27#include "rtl8180.h" 28#include "rtl8180.h"
diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c
index 24873b55b55..4a78f9e39df 100644
--- a/drivers/net/wireless/rtl818x/rtl8187/dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c
@@ -26,6 +26,7 @@
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/etherdevice.h> 27#include <linux/etherdevice.h>
28#include <linux/eeprom_93cx6.h> 28#include <linux/eeprom_93cx6.h>
29#include <linux/module.h>
29#include <net/mac80211.h> 30#include <net/mac80211.h>
30 31
31#include "rtl8187.h" 32#include "rtl8187.h"
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
index d4fdd2a5a73..b4ce93436d2 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -30,6 +30,7 @@
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31 31
32#include <linux/ip.h> 32#include <linux/ip.h>
33#include <linux/module.h>
33#include "wifi.h" 34#include "wifi.h"
34#include "rc.h" 35#include "rc.h"
35#include "base.h" 36#include "base.h"
diff --git a/drivers/net/wireless/rtlwifi/cam.c b/drivers/net/wireless/rtlwifi/cam.c
index 7babb6acd95..dc36d7461ca 100644
--- a/drivers/net/wireless/rtlwifi/cam.c
+++ b/drivers/net/wireless/rtlwifi/cam.c
@@ -29,6 +29,7 @@
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31 31
32#include <linux/export.h>
32#include "wifi.h" 33#include "wifi.h"
33#include "cam.h" 34#include "cam.h"
34 35
diff --git a/drivers/net/wireless/rtlwifi/efuse.c b/drivers/net/wireless/rtlwifi/efuse.c
index 3fc21f60bb0..ed1058b7158 100644
--- a/drivers/net/wireless/rtlwifi/efuse.c
+++ b/drivers/net/wireless/rtlwifi/efuse.c
@@ -27,6 +27,7 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#include <linux/export.h>
30#include "wifi.h" 31#include "wifi.h"
31#include "efuse.h" 32#include "efuse.h"
32 33
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index 177a8e66924..eb61061821e 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -27,6 +27,7 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#include <linux/export.h>
30#include "core.h" 31#include "core.h"
31#include "wifi.h" 32#include "wifi.h"
32#include "pci.h" 33#include "pci.h"
diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c
index a693feffbe7..55c8e50f45f 100644
--- a/drivers/net/wireless/rtlwifi/ps.c
+++ b/drivers/net/wireless/rtlwifi/ps.c
@@ -27,6 +27,7 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#include <linux/export.h>
30#include "wifi.h" 31#include "wifi.h"
31#include "base.h" 32#include "base.h"
32#include "ps.h" 33#include "ps.h"
@@ -394,7 +395,7 @@ void rtl_lps_enter(struct ieee80211_hw *hw)
394 if (mac->link_state != MAC80211_LINKED) 395 if (mac->link_state != MAC80211_LINKED)
395 return; 396 return;
396 397
397 spin_lock(&rtlpriv->locks.lps_lock); 398 spin_lock_irq(&rtlpriv->locks.lps_lock);
398 399
399 /* Idle for a while if we connect to AP a while ago. */ 400 /* Idle for a while if we connect to AP a while ago. */
400 if (mac->cnt_after_linked >= 2) { 401 if (mac->cnt_after_linked >= 2) {
@@ -406,7 +407,7 @@ void rtl_lps_enter(struct ieee80211_hw *hw)
406 } 407 }
407 } 408 }
408 409
409 spin_unlock(&rtlpriv->locks.lps_lock); 410 spin_unlock_irq(&rtlpriv->locks.lps_lock);
410} 411}
411 412
412/*Leave the leisure power save mode.*/ 413/*Leave the leisure power save mode.*/
@@ -415,8 +416,9 @@ void rtl_lps_leave(struct ieee80211_hw *hw)
415 struct rtl_priv *rtlpriv = rtl_priv(hw); 416 struct rtl_priv *rtlpriv = rtl_priv(hw);
416 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 417 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
417 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 418 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
419 unsigned long flags;
418 420
419 spin_lock(&rtlpriv->locks.lps_lock); 421 spin_lock_irqsave(&rtlpriv->locks.lps_lock, flags);
420 422
421 if (ppsc->fwctrl_lps) { 423 if (ppsc->fwctrl_lps) {
422 if (ppsc->dot11_psmode != EACTIVE) { 424 if (ppsc->dot11_psmode != EACTIVE) {
@@ -437,7 +439,7 @@ void rtl_lps_leave(struct ieee80211_hw *hw)
437 rtl_lps_set_psmode(hw, EACTIVE); 439 rtl_lps_set_psmode(hw, EACTIVE);
438 } 440 }
439 } 441 }
440 spin_unlock(&rtlpriv->locks.lps_lock); 442 spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flags);
441} 443}
442 444
443/* For sw LPS*/ 445/* For sw LPS*/
@@ -538,9 +540,9 @@ void rtl_swlps_rf_awake(struct ieee80211_hw *hw)
538 RT_CLEAR_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM); 540 RT_CLEAR_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM);
539 } 541 }
540 542
541 spin_lock(&rtlpriv->locks.lps_lock); 543 spin_lock_irq(&rtlpriv->locks.lps_lock);
542 rtl_ps_set_rf_state(hw, ERFON, RF_CHANGE_BY_PS); 544 rtl_ps_set_rf_state(hw, ERFON, RF_CHANGE_BY_PS);
543 spin_unlock(&rtlpriv->locks.lps_lock); 545 spin_unlock_irq(&rtlpriv->locks.lps_lock);
544} 546}
545 547
546void rtl_swlps_rfon_wq_callback(void *data) 548void rtl_swlps_rfon_wq_callback(void *data)
@@ -573,9 +575,9 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw)
573 if (rtlpriv->link_info.busytraffic) 575 if (rtlpriv->link_info.busytraffic)
574 return; 576 return;
575 577
576 spin_lock(&rtlpriv->locks.lps_lock); 578 spin_lock_irq(&rtlpriv->locks.lps_lock);
577 rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS); 579 rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS);
578 spin_unlock(&rtlpriv->locks.lps_lock); 580 spin_unlock_irq(&rtlpriv->locks.lps_lock);
579 581
580 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM && 582 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM &&
581 !RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) { 583 !RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) {
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
index a00774e7090..72a98cab6f6 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
@@ -27,6 +27,7 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#include <linux/export.h>
30#include "dm_common.h" 31#include "dm_common.h"
31#include "phy_common.h" 32#include "phy_common.h"
32#include "../pci.h" 33#include "../pci.h"
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
index 49a064bdbce..950c65a15b8 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
@@ -30,6 +30,7 @@
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31 31
32#include <linux/firmware.h> 32#include <linux/firmware.h>
33#include <linux/export.h>
33#include "../wifi.h" 34#include "../wifi.h"
34#include "../pci.h" 35#include "../pci.h"
35#include "../base.h" 36#include "../base.h"
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/main.c b/drivers/net/wireless/rtlwifi/rtl8192c/main.c
index 2f624fc2749..605ff191aeb 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/main.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/main.c
@@ -27,6 +27,7 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#include <linux/module.h>
30#include "../wifi.h" 31#include "../wifi.h"
31 32
32 33
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
index 3b11642d3f7..1f07558debf 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
@@ -27,6 +27,7 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#include <linux/export.h>
30#include "../wifi.h" 31#include "../wifi.h"
31#include "../rtl8192ce/reg.h" 32#include "../rtl8192ce/reg.h"
32#include "../rtl8192ce/def.h" 33#include "../rtl8192ce/def.h"
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
index a48404cc2b9..f2aa33dc4d7 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
@@ -28,6 +28,7 @@
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#include <linux/vmalloc.h> 30#include <linux/vmalloc.h>
31#include <linux/module.h>
31 32
32#include "../wifi.h" 33#include "../wifi.h"
33#include "../core.h" 34#include "../core.h"
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index feed1ed8d9b..c244f2f1b83 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -42,6 +42,7 @@
42#include "led.h" 42#include "led.h"
43#include "hw.h" 43#include "hw.h"
44#include <linux/vmalloc.h> 44#include <linux/vmalloc.h>
45#include <linux/module.h>
45 46
46MODULE_AUTHOR("Georgia <georgia@realtek.com>"); 47MODULE_AUTHOR("Georgia <georgia@realtek.com>");
47MODULE_AUTHOR("Ziv Huang <ziv_huang@realtek.com>"); 48MODULE_AUTHOR("Ziv Huang <ziv_huang@realtek.com>");
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
index 691f8009218..149493f4c25 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
@@ -30,6 +30,7 @@
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31 31
32#include <linux/vmalloc.h> 32#include <linux/vmalloc.h>
33#include <linux/module.h>
33 34
34#include "../wifi.h" 35#include "../wifi.h"
35#include "../core.h" 36#include "../core.h"
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
index 3ec9a0d41ba..92f49d522c5 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
@@ -30,6 +30,7 @@
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31 31
32#include <linux/vmalloc.h> 32#include <linux/vmalloc.h>
33#include <linux/module.h>
33 34
34#include "../wifi.h" 35#include "../wifi.h"
35#include "../core.h" 36#include "../core.h"
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
index b42c2e2b205..54cb8a60514 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -28,6 +28,7 @@
28#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 28#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
29 29
30#include <linux/usb.h> 30#include <linux/usb.h>
31#include <linux/export.h>
31#include "core.h" 32#include "core.h"
32#include "wifi.h" 33#include "wifi.h"
33#include "usb.h" 34#include "usb.h"
diff --git a/drivers/net/wireless/wl12xx/boot.c b/drivers/net/wireless/wl12xx/boot.c
index d4e628db76b..68133791497 100644
--- a/drivers/net/wireless/wl12xx/boot.c
+++ b/drivers/net/wireless/wl12xx/boot.c
@@ -23,6 +23,7 @@
23 23
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/wl12xx.h> 25#include <linux/wl12xx.h>
26#include <linux/export.h>
26 27
27#include "acx.h" 28#include "acx.h"
28#include "reg.h" 29#include "reg.h"
diff --git a/drivers/net/wireless/wl12xx/scan.c b/drivers/net/wireless/wl12xx/scan.c
index 128ccb79318..fc29c671cf3 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 }
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index cf0d69dd7be..785bdbe38f2 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -28,6 +28,7 @@
28#include <linux/skbuff.h> 28#include <linux/skbuff.h>
29#include <linux/usb.h> 29#include <linux/usb.h>
30#include <linux/workqueue.h> 30#include <linux/workqueue.h>
31#include <linux/module.h>
31#include <net/mac80211.h> 32#include <net/mac80211.h>
32#include <asm/unaligned.h> 33#include <asm/unaligned.h>
33 34
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
index 161f207786a..94b79c3338c 100644
--- a/drivers/net/xen-netback/common.h
+++ b/drivers/net/xen-netback/common.h
@@ -58,10 +58,6 @@ struct xenvif {
58 u8 fe_dev_addr[6]; 58 u8 fe_dev_addr[6];
59 59
60 /* Physical parameters of the comms window. */ 60 /* Physical parameters of the comms window. */
61 grant_handle_t tx_shmem_handle;
62 grant_ref_t tx_shmem_ref;
63 grant_handle_t rx_shmem_handle;
64 grant_ref_t rx_shmem_ref;
65 unsigned int irq; 61 unsigned int irq;
66 62
67 /* List of frontends to notify after a batch of frames sent. */ 63 /* List of frontends to notify after a batch of frames sent. */
@@ -70,8 +66,6 @@ struct xenvif {
70 /* The shared rings and indexes. */ 66 /* The shared rings and indexes. */
71 struct xen_netif_tx_back_ring tx; 67 struct xen_netif_tx_back_ring tx;
72 struct xen_netif_rx_back_ring rx; 68 struct xen_netif_rx_back_ring rx;
73 struct vm_struct *tx_comms_area;
74 struct vm_struct *rx_comms_area;
75 69
76 /* Frontend feature information. */ 70 /* Frontend feature information. */
77 u8 can_sg:1; 71 u8 can_sg:1;
@@ -106,6 +100,11 @@ struct xenvif {
106 wait_queue_head_t waiting_to_free; 100 wait_queue_head_t waiting_to_free;
107}; 101};
108 102
103static inline struct xenbus_device *xenvif_to_xenbus_device(struct xenvif *vif)
104{
105 return to_xenbus_device(vif->dev->dev.parent);
106}
107
109#define XEN_NETIF_TX_RING_SIZE __CONST_RING_SIZE(xen_netif_tx, PAGE_SIZE) 108#define XEN_NETIF_TX_RING_SIZE __CONST_RING_SIZE(xen_netif_tx, PAGE_SIZE)
110#define XEN_NETIF_RX_RING_SIZE __CONST_RING_SIZE(xen_netif_rx, PAGE_SIZE) 109#define XEN_NETIF_RX_RING_SIZE __CONST_RING_SIZE(xen_netif_rx, PAGE_SIZE)
111 110
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index d5508957200..1ae270eed51 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -1021,7 +1021,7 @@ static int xen_netbk_tx_check_gop(struct xen_netbk *netbk,
1021 pending_idx = *((u16 *)skb->data); 1021 pending_idx = *((u16 *)skb->data);
1022 xen_netbk_idx_release(netbk, pending_idx); 1022 xen_netbk_idx_release(netbk, pending_idx);
1023 for (j = start; j < i; j++) { 1023 for (j = start; j < i; j++) {
1024 pending_idx = frag_get_pending_idx(&shinfo->frags[i]); 1024 pending_idx = frag_get_pending_idx(&shinfo->frags[j]);
1025 xen_netbk_idx_release(netbk, pending_idx); 1025 xen_netbk_idx_release(netbk, pending_idx);
1026 } 1026 }
1027 1027
@@ -1589,88 +1589,42 @@ static int xen_netbk_kthread(void *data)
1589 1589
1590void xen_netbk_unmap_frontend_rings(struct xenvif *vif) 1590void xen_netbk_unmap_frontend_rings(struct xenvif *vif)
1591{ 1591{
1592 struct gnttab_unmap_grant_ref op; 1592 if (vif->tx.sring)
1593 1593 xenbus_unmap_ring_vfree(xenvif_to_xenbus_device(vif),
1594 if (vif->tx.sring) { 1594 vif->tx.sring);
1595 gnttab_set_unmap_op(&op, (unsigned long)vif->tx_comms_area->addr, 1595 if (vif->rx.sring)
1596 GNTMAP_host_map, vif->tx_shmem_handle); 1596 xenbus_unmap_ring_vfree(xenvif_to_xenbus_device(vif),
1597 1597 vif->rx.sring);
1598 if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1))
1599 BUG();
1600 }
1601
1602 if (vif->rx.sring) {
1603 gnttab_set_unmap_op(&op, (unsigned long)vif->rx_comms_area->addr,
1604 GNTMAP_host_map, vif->rx_shmem_handle);
1605
1606 if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1))
1607 BUG();
1608 }
1609 if (vif->rx_comms_area)
1610 free_vm_area(vif->rx_comms_area);
1611 if (vif->tx_comms_area)
1612 free_vm_area(vif->tx_comms_area);
1613} 1598}
1614 1599
1615int xen_netbk_map_frontend_rings(struct xenvif *vif, 1600int xen_netbk_map_frontend_rings(struct xenvif *vif,
1616 grant_ref_t tx_ring_ref, 1601 grant_ref_t tx_ring_ref,
1617 grant_ref_t rx_ring_ref) 1602 grant_ref_t rx_ring_ref)
1618{ 1603{
1619 struct gnttab_map_grant_ref op; 1604 void *addr;
1620 struct xen_netif_tx_sring *txs; 1605 struct xen_netif_tx_sring *txs;
1621 struct xen_netif_rx_sring *rxs; 1606 struct xen_netif_rx_sring *rxs;
1622 1607
1623 int err = -ENOMEM; 1608 int err = -ENOMEM;
1624 1609
1625 vif->tx_comms_area = alloc_vm_area(PAGE_SIZE); 1610 err = xenbus_map_ring_valloc(xenvif_to_xenbus_device(vif),
1626 if (vif->tx_comms_area == NULL) 1611 tx_ring_ref, &addr);
1612 if (err)
1627 goto err; 1613 goto err;
1628 1614
1629 vif->rx_comms_area = alloc_vm_area(PAGE_SIZE); 1615 txs = (struct xen_netif_tx_sring *)addr;
1630 if (vif->rx_comms_area == NULL)
1631 goto err;
1632
1633 gnttab_set_map_op(&op, (unsigned long)vif->tx_comms_area->addr,
1634 GNTMAP_host_map, tx_ring_ref, vif->domid);
1635
1636 if (HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &op, 1))
1637 BUG();
1638
1639 if (op.status) {
1640 netdev_warn(vif->dev,
1641 "failed to map tx ring. err=%d status=%d\n",
1642 err, op.status);
1643 err = op.status;
1644 goto err;
1645 }
1646
1647 vif->tx_shmem_ref = tx_ring_ref;
1648 vif->tx_shmem_handle = op.handle;
1649
1650 txs = (struct xen_netif_tx_sring *)vif->tx_comms_area->addr;
1651 BACK_RING_INIT(&vif->tx, txs, PAGE_SIZE); 1616 BACK_RING_INIT(&vif->tx, txs, PAGE_SIZE);
1652 1617
1653 gnttab_set_map_op(&op, (unsigned long)vif->rx_comms_area->addr, 1618 err = xenbus_map_ring_valloc(xenvif_to_xenbus_device(vif),
1654 GNTMAP_host_map, rx_ring_ref, vif->domid); 1619 rx_ring_ref, &addr);
1655 1620 if (err)
1656 if (HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &op, 1))
1657 BUG();
1658
1659 if (op.status) {
1660 netdev_warn(vif->dev,
1661 "failed to map rx ring. err=%d status=%d\n",
1662 err, op.status);
1663 err = op.status;
1664 goto err; 1621 goto err;
1665 }
1666
1667 vif->rx_shmem_ref = rx_ring_ref;
1668 vif->rx_shmem_handle = op.handle;
1669 vif->rx_req_cons_peek = 0;
1670 1622
1671 rxs = (struct xen_netif_rx_sring *)vif->rx_comms_area->addr; 1623 rxs = (struct xen_netif_rx_sring *)addr;
1672 BACK_RING_INIT(&vif->rx, rxs, PAGE_SIZE); 1624 BACK_RING_INIT(&vif->rx, rxs, PAGE_SIZE);
1673 1625
1626 vif->rx_req_cons_peek = 0;
1627
1674 return 0; 1628 return 0;
1675 1629
1676err: 1630err: