aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/3c59x.c47
-rw-r--r--drivers/net/Kconfig14
-rw-r--r--drivers/net/Makefile1
-rw-r--r--drivers/net/atlx/atl1.c11
-rw-r--r--drivers/net/b44.c13
-rw-r--r--drivers/net/benet/be.h1
-rw-r--r--drivers/net/benet/be_cmds.c8
-rw-r--r--drivers/net/benet/be_cmds.h2
-rw-r--r--drivers/net/benet/be_ethtool.c1
-rw-r--r--drivers/net/benet/be_hw.h7
-rw-r--r--drivers/net/benet/be_main.c47
-rw-r--r--drivers/net/bnx2x/bnx2x.h4
-rw-r--r--drivers/net/bnx2x/bnx2x_main.c9
-rw-r--r--drivers/net/bonding/bond_3ad.c3
-rw-r--r--drivers/net/bonding/bond_alb.c3
-rw-r--r--drivers/net/bonding/bond_main.c65
-rw-r--r--drivers/net/caif/Kconfig2
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c2
-rw-r--r--drivers/net/e1000e/82571.c31
-rw-r--r--drivers/net/e1000e/defines.h4
-rw-r--r--drivers/net/e1000e/hw.h1
-rw-r--r--drivers/net/e1000e/ich8lan.c197
-rw-r--r--drivers/net/e1000e/lib.c10
-rw-r--r--drivers/net/e1000e/netdev.c29
-rw-r--r--drivers/net/ehea/ehea.h3
-rw-r--r--drivers/net/ehea/ehea_main.c69
-rw-r--r--drivers/net/ehea/ehea_qmr.h1
-rw-r--r--drivers/net/eql.c2
-rw-r--r--drivers/net/fec.c44
-rw-r--r--drivers/net/ibm_newemac/core.c4
-rw-r--r--drivers/net/ibm_newemac/debug.c2
-rw-r--r--drivers/net/ibmveth.c32
-rw-r--r--drivers/net/ks8851.c39
-rw-r--r--drivers/net/ll_temac_main.c5
-rw-r--r--drivers/net/ll_temac_mdio.c1
-rw-r--r--drivers/net/netxen/netxen_nic.h4
-rw-r--r--drivers/net/netxen/netxen_nic_init.c7
-rw-r--r--drivers/net/netxen/netxen_nic_main.c11
-rw-r--r--drivers/net/niu.c16
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c140
-rw-r--r--drivers/net/phy/mdio_bus.c4
-rw-r--r--drivers/net/phy/phy_device.c2
-rw-r--r--drivers/net/ppp_generic.c9
-rw-r--r--drivers/net/pxa168_eth.c1666
-rw-r--r--drivers/net/qlcnic/qlcnic_init.c7
-rw-r--r--drivers/net/qlcnic/qlcnic_main.c11
-rw-r--r--drivers/net/qlge/qlge_main.c4
-rw-r--r--drivers/net/r8169.c70
-rw-r--r--drivers/net/rionet.c2
-rw-r--r--drivers/net/sgiseeq.c2
-rw-r--r--drivers/net/sh_eth.c2
-rw-r--r--drivers/net/skge.c18
-rw-r--r--drivers/net/smsc911x.c1
-rw-r--r--drivers/net/stmmac/stmmac_main.c9
-rw-r--r--drivers/net/tg3.c6
-rw-r--r--drivers/net/tg3.h2
-rw-r--r--drivers/net/tulip/de2104x.c43
-rw-r--r--drivers/net/usb/hso.c2
-rw-r--r--drivers/net/usb/ipheth.c12
-rw-r--r--drivers/net/via-velocity.c2
-rw-r--r--drivers/net/wimax/i2400m/rx.c26
-rw-r--r--drivers/net/wireless/adm8211.c8
-rw-r--r--drivers/net/wireless/at76c50x-usb.c22
-rw-r--r--drivers/net/wireless/ath/ar9170/main.c4
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/ani.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_eeprom.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.h2
-rw-r--r--drivers/net/wireless/ath/regd.h1
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2100.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-1000.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c32
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c45
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c50
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c53
-rw-r--r--drivers/net/wireless/libertas/if_sdio.c2
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c2
-rw-r--r--drivers/net/wireless/mwl8k.c34
-rw-r--r--drivers/net/wireless/p54/eeprom.c6
-rw-r--r--drivers/net/wireless/p54/fwio.c2
-rw-r--r--drivers/net/wireless/p54/led.c4
-rw-r--r--drivers/net/wireless/p54/p54pci.c2
-rw-r--r--drivers/net/wireless/p54/txrx.c4
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180_dev.c6
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187_dev.c4
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187_rtl8225.c4
92 files changed, 2630 insertions, 497 deletions
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index c754d88e5ec9..179871d9e71f 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -633,7 +633,11 @@ struct vortex_private {
633 open:1, 633 open:1,
634 medialock:1, 634 medialock:1,
635 must_free_region:1, /* Flag: if zero, Cardbus owns the I/O region */ 635 must_free_region:1, /* Flag: if zero, Cardbus owns the I/O region */
636 large_frames:1; /* accept large frames */ 636 large_frames:1, /* accept large frames */
637 handling_irq:1; /* private in_irq indicator */
638 /* {get|set}_wol operations are already serialized by rtnl.
639 * no additional locking is required for the enable_wol and acpi_set_WOL()
640 */
637 int drv_flags; 641 int drv_flags;
638 u16 status_enable; 642 u16 status_enable;
639 u16 intr_enable; 643 u16 intr_enable;
@@ -646,7 +650,7 @@ struct vortex_private {
646 u16 io_size; /* Size of PCI region (for release_region) */ 650 u16 io_size; /* Size of PCI region (for release_region) */
647 651
648 /* Serialises access to hardware other than MII and variables below. 652 /* Serialises access to hardware other than MII and variables below.
649 * The lock hierarchy is rtnl_lock > lock > mii_lock > window_lock. */ 653 * The lock hierarchy is rtnl_lock > {lock, mii_lock} > window_lock. */
650 spinlock_t lock; 654 spinlock_t lock;
651 655
652 spinlock_t mii_lock; /* Serialises access to MII */ 656 spinlock_t mii_lock; /* Serialises access to MII */
@@ -1993,10 +1997,9 @@ vortex_error(struct net_device *dev, int status)
1993 } 1997 }
1994 } 1998 }
1995 1999
1996 if (status & RxEarly) { /* Rx early is unused. */ 2000 if (status & RxEarly) /* Rx early is unused. */
1997 vortex_rx(dev);
1998 iowrite16(AckIntr | RxEarly, ioaddr + EL3_CMD); 2001 iowrite16(AckIntr | RxEarly, ioaddr + EL3_CMD);
1999 } 2002
2000 if (status & StatsFull) { /* Empty statistics. */ 2003 if (status & StatsFull) { /* Empty statistics. */
2001 static int DoneDidThat; 2004 static int DoneDidThat;
2002 if (vortex_debug > 4) 2005 if (vortex_debug > 4)
@@ -2133,6 +2136,15 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)
2133 dev->name, vp->cur_tx); 2136 dev->name, vp->cur_tx);
2134 } 2137 }
2135 2138
2139 /*
2140 * We can't allow a recursion from our interrupt handler back into the
2141 * tx routine, as they take the same spin lock, and that causes
2142 * deadlock. Just return NETDEV_TX_BUSY and let the stack try again in
2143 * a bit
2144 */
2145 if (vp->handling_irq)
2146 return NETDEV_TX_BUSY;
2147
2136 if (vp->cur_tx - vp->dirty_tx >= TX_RING_SIZE) { 2148 if (vp->cur_tx - vp->dirty_tx >= TX_RING_SIZE) {
2137 if (vortex_debug > 0) 2149 if (vortex_debug > 0)
2138 pr_warning("%s: BUG! Tx Ring full, refusing to send buffer.\n", 2150 pr_warning("%s: BUG! Tx Ring full, refusing to send buffer.\n",
@@ -2288,7 +2300,12 @@ vortex_interrupt(int irq, void *dev_id)
2288 if (status & (HostError | RxEarly | StatsFull | TxComplete | IntReq)) { 2300 if (status & (HostError | RxEarly | StatsFull | TxComplete | IntReq)) {
2289 if (status == 0xffff) 2301 if (status == 0xffff)
2290 break; 2302 break;
2303 if (status & RxEarly)
2304 vortex_rx(dev);
2305 spin_unlock(&vp->window_lock);
2291 vortex_error(dev, status); 2306 vortex_error(dev, status);
2307 spin_lock(&vp->window_lock);
2308 window_set(vp, 7);
2292 } 2309 }
2293 2310
2294 if (--work_done < 0) { 2311 if (--work_done < 0) {
@@ -2335,11 +2352,13 @@ boomerang_interrupt(int irq, void *dev_id)
2335 2352
2336 ioaddr = vp->ioaddr; 2353 ioaddr = vp->ioaddr;
2337 2354
2355
2338 /* 2356 /*
2339 * It seems dopey to put the spinlock this early, but we could race against vortex_tx_timeout 2357 * It seems dopey to put the spinlock this early, but we could race against vortex_tx_timeout
2340 * and boomerang_start_xmit 2358 * and boomerang_start_xmit
2341 */ 2359 */
2342 spin_lock(&vp->lock); 2360 spin_lock(&vp->lock);
2361 vp->handling_irq = 1;
2343 2362
2344 status = ioread16(ioaddr + EL3_STATUS); 2363 status = ioread16(ioaddr + EL3_STATUS);
2345 2364
@@ -2447,6 +2466,7 @@ boomerang_interrupt(int irq, void *dev_id)
2447 pr_debug("%s: exiting interrupt, status %4.4x.\n", 2466 pr_debug("%s: exiting interrupt, status %4.4x.\n",
2448 dev->name, status); 2467 dev->name, status);
2449handler_exit: 2468handler_exit:
2469 vp->handling_irq = 0;
2450 spin_unlock(&vp->lock); 2470 spin_unlock(&vp->lock);
2451 return IRQ_HANDLED; 2471 return IRQ_HANDLED;
2452} 2472}
@@ -2922,28 +2942,31 @@ static void vortex_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
2922{ 2942{
2923 struct vortex_private *vp = netdev_priv(dev); 2943 struct vortex_private *vp = netdev_priv(dev);
2924 2944
2925 spin_lock_irq(&vp->lock); 2945 if (!VORTEX_PCI(vp))
2946 return;
2947
2926 wol->supported = WAKE_MAGIC; 2948 wol->supported = WAKE_MAGIC;
2927 2949
2928 wol->wolopts = 0; 2950 wol->wolopts = 0;
2929 if (vp->enable_wol) 2951 if (vp->enable_wol)
2930 wol->wolopts |= WAKE_MAGIC; 2952 wol->wolopts |= WAKE_MAGIC;
2931 spin_unlock_irq(&vp->lock);
2932} 2953}
2933 2954
2934static int vortex_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) 2955static int vortex_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
2935{ 2956{
2936 struct vortex_private *vp = netdev_priv(dev); 2957 struct vortex_private *vp = netdev_priv(dev);
2958
2959 if (!VORTEX_PCI(vp))
2960 return -EOPNOTSUPP;
2961
2937 if (wol->wolopts & ~WAKE_MAGIC) 2962 if (wol->wolopts & ~WAKE_MAGIC)
2938 return -EINVAL; 2963 return -EINVAL;
2939 2964
2940 spin_lock_irq(&vp->lock);
2941 if (wol->wolopts & WAKE_MAGIC) 2965 if (wol->wolopts & WAKE_MAGIC)
2942 vp->enable_wol = 1; 2966 vp->enable_wol = 1;
2943 else 2967 else
2944 vp->enable_wol = 0; 2968 vp->enable_wol = 0;
2945 acpi_set_WOL(dev); 2969 acpi_set_WOL(dev);
2946 spin_unlock_irq(&vp->lock);
2947 2970
2948 return 0; 2971 return 0;
2949} 2972}
@@ -2971,7 +2994,6 @@ static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2971{ 2994{
2972 int err; 2995 int err;
2973 struct vortex_private *vp = netdev_priv(dev); 2996 struct vortex_private *vp = netdev_priv(dev);
2974 unsigned long flags;
2975 pci_power_t state = 0; 2997 pci_power_t state = 0;
2976 2998
2977 if(VORTEX_PCI(vp)) 2999 if(VORTEX_PCI(vp))
@@ -2981,9 +3003,7 @@ static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2981 3003
2982 if(state != 0) 3004 if(state != 0)
2983 pci_set_power_state(VORTEX_PCI(vp), PCI_D0); 3005 pci_set_power_state(VORTEX_PCI(vp), PCI_D0);
2984 spin_lock_irqsave(&vp->lock, flags);
2985 err = generic_mii_ioctl(&vp->mii, if_mii(rq), cmd, NULL); 3006 err = generic_mii_ioctl(&vp->mii, if_mii(rq), cmd, NULL);
2986 spin_unlock_irqrestore(&vp->lock, flags);
2987 if(state != 0) 3007 if(state != 0)
2988 pci_set_power_state(VORTEX_PCI(vp), state); 3008 pci_set_power_state(VORTEX_PCI(vp), state);
2989 3009
@@ -3188,6 +3208,9 @@ static void acpi_set_WOL(struct net_device *dev)
3188 return; 3208 return;
3189 } 3209 }
3190 3210
3211 if (VORTEX_PCI(vp)->current_state < PCI_D3hot)
3212 return;
3213
3191 /* Change the power state to D3; RxEnable doesn't take effect. */ 3214 /* Change the power state to D3; RxEnable doesn't take effect. */
3192 pci_set_power_state(VORTEX_PCI(vp), PCI_D3hot); 3215 pci_set_power_state(VORTEX_PCI(vp), PCI_D3hot);
3193 } 3216 }
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 5a6895320b48..5db667c0b371 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -928,6 +928,16 @@ config SMC91X
928 The module will be called smc91x. If you want to compile it as a 928 The module will be called smc91x. If you want to compile it as a
929 module, say M here and read <file:Documentation/kbuild/modules.txt>. 929 module, say M here and read <file:Documentation/kbuild/modules.txt>.
930 930
931config PXA168_ETH
932 tristate "Marvell pxa168 ethernet support"
933 depends on CPU_PXA168
934 select PHYLIB
935 help
936 This driver supports the pxa168 Ethernet ports.
937
938 To compile this driver as a module, choose M here. The module
939 will be called pxa168_eth.
940
931config NET_NETX 941config NET_NETX
932 tristate "NetX Ethernet support" 942 tristate "NetX Ethernet support"
933 select MII 943 select MII
@@ -2418,7 +2428,7 @@ config UGETH_TX_ON_DEMAND
2418 2428
2419config MV643XX_ETH 2429config MV643XX_ETH
2420 tristate "Marvell Discovery (643XX) and Orion ethernet support" 2430 tristate "Marvell Discovery (643XX) and Orion ethernet support"
2421 depends on MV64X60 || PPC32 || PLAT_ORION 2431 depends on (MV64X60 || PPC32 || PLAT_ORION) && INET
2422 select INET_LRO 2432 select INET_LRO
2423 select PHYLIB 2433 select PHYLIB
2424 help 2434 help
@@ -2793,7 +2803,7 @@ config NIU
2793 2803
2794config PASEMI_MAC 2804config PASEMI_MAC
2795 tristate "PA Semi 1/10Gbit MAC" 2805 tristate "PA Semi 1/10Gbit MAC"
2796 depends on PPC_PASEMI && PCI 2806 depends on PPC_PASEMI && PCI && INET
2797 select PHYLIB 2807 select PHYLIB
2798 select INET_LRO 2808 select INET_LRO
2799 help 2809 help
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 56e8c27f77ce..3e8f150c4b14 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -244,6 +244,7 @@ obj-$(CONFIG_MYRI10GE) += myri10ge/
244obj-$(CONFIG_SMC91X) += smc91x.o 244obj-$(CONFIG_SMC91X) += smc91x.o
245obj-$(CONFIG_SMC911X) += smc911x.o 245obj-$(CONFIG_SMC911X) += smc911x.o
246obj-$(CONFIG_SMSC911X) += smsc911x.o 246obj-$(CONFIG_SMSC911X) += smsc911x.o
247obj-$(CONFIG_PXA168_ETH) += pxa168_eth.o
247obj-$(CONFIG_BFIN_MAC) += bfin_mac.o 248obj-$(CONFIG_BFIN_MAC) += bfin_mac.o
248obj-$(CONFIG_DM9000) += dm9000.o 249obj-$(CONFIG_DM9000) += dm9000.o
249obj-$(CONFIG_PASEMI_MAC) += pasemi_mac_driver.o 250obj-$(CONFIG_PASEMI_MAC) += pasemi_mac_driver.o
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 63b9ba0cc67e..c73be2848319 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -1251,6 +1251,12 @@ static void atl1_free_ring_resources(struct atl1_adapter *adapter)
1251 1251
1252 rrd_ring->desc = NULL; 1252 rrd_ring->desc = NULL;
1253 rrd_ring->dma = 0; 1253 rrd_ring->dma = 0;
1254
1255 adapter->cmb.dma = 0;
1256 adapter->cmb.cmb = NULL;
1257
1258 adapter->smb.dma = 0;
1259 adapter->smb.smb = NULL;
1254} 1260}
1255 1261
1256static void atl1_setup_mac_ctrl(struct atl1_adapter *adapter) 1262static void atl1_setup_mac_ctrl(struct atl1_adapter *adapter)
@@ -2847,10 +2853,11 @@ static int atl1_resume(struct pci_dev *pdev)
2847 pci_enable_wake(pdev, PCI_D3cold, 0); 2853 pci_enable_wake(pdev, PCI_D3cold, 0);
2848 2854
2849 atl1_reset_hw(&adapter->hw); 2855 atl1_reset_hw(&adapter->hw);
2850 adapter->cmb.cmb->int_stats = 0;
2851 2856
2852 if (netif_running(netdev)) 2857 if (netif_running(netdev)) {
2858 adapter->cmb.cmb->int_stats = 0;
2853 atl1_up(adapter); 2859 atl1_up(adapter);
2860 }
2854 netif_device_attach(netdev); 2861 netif_device_attach(netdev);
2855 2862
2856 return 0; 2863 return 0;
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 37617abc1647..efeffdf9e5fa 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -848,6 +848,15 @@ static int b44_poll(struct napi_struct *napi, int budget)
848 b44_tx(bp); 848 b44_tx(bp);
849 /* spin_unlock(&bp->tx_lock); */ 849 /* spin_unlock(&bp->tx_lock); */
850 } 850 }
851 if (bp->istat & ISTAT_RFO) { /* fast recovery, in ~20msec */
852 bp->istat &= ~ISTAT_RFO;
853 b44_disable_ints(bp);
854 ssb_device_enable(bp->sdev, 0); /* resets ISTAT_RFO */
855 b44_init_rings(bp);
856 b44_init_hw(bp, B44_FULL_RESET_SKIP_PHY);
857 netif_wake_queue(bp->dev);
858 }
859
851 spin_unlock_irqrestore(&bp->lock, flags); 860 spin_unlock_irqrestore(&bp->lock, flags);
852 861
853 work_done = 0; 862 work_done = 0;
@@ -2161,8 +2170,6 @@ static int __devinit b44_init_one(struct ssb_device *sdev,
2161 dev->irq = sdev->irq; 2170 dev->irq = sdev->irq;
2162 SET_ETHTOOL_OPS(dev, &b44_ethtool_ops); 2171 SET_ETHTOOL_OPS(dev, &b44_ethtool_ops);
2163 2172
2164 netif_carrier_off(dev);
2165
2166 err = ssb_bus_powerup(sdev->bus, 0); 2173 err = ssb_bus_powerup(sdev->bus, 0);
2167 if (err) { 2174 if (err) {
2168 dev_err(sdev->dev, 2175 dev_err(sdev->dev,
@@ -2204,6 +2211,8 @@ static int __devinit b44_init_one(struct ssb_device *sdev,
2204 goto err_out_powerdown; 2211 goto err_out_powerdown;
2205 } 2212 }
2206 2213
2214 netif_carrier_off(dev);
2215
2207 ssb_set_drvdata(sdev, dev); 2216 ssb_set_drvdata(sdev, dev);
2208 2217
2209 /* Chip reset provides power to the b44 MAC & PCI cores, which 2218 /* Chip reset provides power to the b44 MAC & PCI cores, which
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 99197bd54da5..53306bf3f401 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -181,6 +181,7 @@ struct be_drvr_stats {
181 u64 be_rx_bytes_prev; 181 u64 be_rx_bytes_prev;
182 u64 be_rx_pkts; 182 u64 be_rx_pkts;
183 u32 be_rx_rate; 183 u32 be_rx_rate;
184 u32 be_rx_mcast_pkt;
184 /* number of non ether type II frames dropped where 185 /* number of non ether type II frames dropped where
185 * frame len > length field of Mac Hdr */ 186 * frame len > length field of Mac Hdr */
186 u32 be_802_3_dropped_frames; 187 u32 be_802_3_dropped_frames;
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 3d305494a606..34abcc9403d6 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -140,10 +140,8 @@ int be_process_mcc(struct be_adapter *adapter, int *status)
140 while ((compl = be_mcc_compl_get(adapter))) { 140 while ((compl = be_mcc_compl_get(adapter))) {
141 if (compl->flags & CQE_FLAGS_ASYNC_MASK) { 141 if (compl->flags & CQE_FLAGS_ASYNC_MASK) {
142 /* Interpret flags as an async trailer */ 142 /* Interpret flags as an async trailer */
143 BUG_ON(!is_link_state_evt(compl->flags)); 143 if (is_link_state_evt(compl->flags))
144 144 be_async_link_state_process(adapter,
145 /* Interpret compl as a async link evt */
146 be_async_link_state_process(adapter,
147 (struct be_async_event_link_state *) compl); 145 (struct be_async_event_link_state *) compl);
148 } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) { 146 } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) {
149 *status = be_mcc_compl_process(adapter, compl); 147 *status = be_mcc_compl_process(adapter, compl);
@@ -207,7 +205,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
207 205
208 if (msecs > 4000) { 206 if (msecs > 4000) {
209 dev_err(&adapter->pdev->dev, "mbox poll timed out\n"); 207 dev_err(&adapter->pdev->dev, "mbox poll timed out\n");
210 be_dump_ue(adapter); 208 be_detect_dump_ue(adapter);
211 return -1; 209 return -1;
212 } 210 }
213 211
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index bdc10a28cfda..ad1e6fac60c5 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -992,5 +992,5 @@ extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
992extern int be_cmd_get_phy_info(struct be_adapter *adapter, 992extern int be_cmd_get_phy_info(struct be_adapter *adapter,
993 struct be_dma_mem *cmd); 993 struct be_dma_mem *cmd);
994extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain); 994extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain);
995extern void be_dump_ue(struct be_adapter *adapter); 995extern void be_detect_dump_ue(struct be_adapter *adapter);
996 996
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index cd16243c7c36..13f0abbc5205 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -60,6 +60,7 @@ static const struct be_ethtool_stat et_stats[] = {
60 {DRVSTAT_INFO(be_rx_events)}, 60 {DRVSTAT_INFO(be_rx_events)},
61 {DRVSTAT_INFO(be_tx_compl)}, 61 {DRVSTAT_INFO(be_tx_compl)},
62 {DRVSTAT_INFO(be_rx_compl)}, 62 {DRVSTAT_INFO(be_rx_compl)},
63 {DRVSTAT_INFO(be_rx_mcast_pkt)},
63 {DRVSTAT_INFO(be_ethrx_post_fail)}, 64 {DRVSTAT_INFO(be_ethrx_post_fail)},
64 {DRVSTAT_INFO(be_802_3_dropped_frames)}, 65 {DRVSTAT_INFO(be_802_3_dropped_frames)},
65 {DRVSTAT_INFO(be_802_3_malformed_frames)}, 66 {DRVSTAT_INFO(be_802_3_malformed_frames)},
diff --git a/drivers/net/benet/be_hw.h b/drivers/net/benet/be_hw.h
index 5d38046402b2..a2ec5df0d733 100644
--- a/drivers/net/benet/be_hw.h
+++ b/drivers/net/benet/be_hw.h
@@ -167,8 +167,11 @@
167#define FLASH_FCoE_BIOS_START_g3 (13631488) 167#define FLASH_FCoE_BIOS_START_g3 (13631488)
168#define FLASH_REDBOOT_START_g3 (262144) 168#define FLASH_REDBOOT_START_g3 (262144)
169 169
170 170/************* Rx Packet Type Encoding **************/
171 171#define BE_UNICAST_PACKET 0
172#define BE_MULTICAST_PACKET 1
173#define BE_BROADCAST_PACKET 2
174#define BE_RSVD_PACKET 3
172 175
173/* 176/*
174 * BE descriptors: host memory data structures whose formats 177 * BE descriptors: host memory data structures whose formats
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 74e146f470c6..6eda7a022256 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -247,6 +247,7 @@ void netdev_stats_update(struct be_adapter *adapter)
247 dev_stats->tx_packets = drvr_stats(adapter)->be_tx_pkts; 247 dev_stats->tx_packets = drvr_stats(adapter)->be_tx_pkts;
248 dev_stats->rx_bytes = drvr_stats(adapter)->be_rx_bytes; 248 dev_stats->rx_bytes = drvr_stats(adapter)->be_rx_bytes;
249 dev_stats->tx_bytes = drvr_stats(adapter)->be_tx_bytes; 249 dev_stats->tx_bytes = drvr_stats(adapter)->be_tx_bytes;
250 dev_stats->multicast = drvr_stats(adapter)->be_rx_mcast_pkt;
250 251
251 /* bad pkts received */ 252 /* bad pkts received */
252 dev_stats->rx_errors = port_stats->rx_crc_errors + 253 dev_stats->rx_errors = port_stats->rx_crc_errors +
@@ -294,7 +295,6 @@ void netdev_stats_update(struct be_adapter *adapter)
294 /* no space available in linux */ 295 /* no space available in linux */
295 dev_stats->tx_dropped = 0; 296 dev_stats->tx_dropped = 0;
296 297
297 dev_stats->multicast = port_stats->rx_multicast_frames;
298 dev_stats->collisions = 0; 298 dev_stats->collisions = 0;
299 299
300 /* detailed tx_errors */ 300 /* detailed tx_errors */
@@ -848,7 +848,7 @@ static void be_rx_rate_update(struct be_adapter *adapter)
848} 848}
849 849
850static void be_rx_stats_update(struct be_adapter *adapter, 850static void be_rx_stats_update(struct be_adapter *adapter,
851 u32 pktsize, u16 numfrags) 851 u32 pktsize, u16 numfrags, u8 pkt_type)
852{ 852{
853 struct be_drvr_stats *stats = drvr_stats(adapter); 853 struct be_drvr_stats *stats = drvr_stats(adapter);
854 854
@@ -856,6 +856,9 @@ static void be_rx_stats_update(struct be_adapter *adapter,
856 stats->be_rx_frags += numfrags; 856 stats->be_rx_frags += numfrags;
857 stats->be_rx_bytes += pktsize; 857 stats->be_rx_bytes += pktsize;
858 stats->be_rx_pkts++; 858 stats->be_rx_pkts++;
859
860 if (pkt_type == BE_MULTICAST_PACKET)
861 stats->be_rx_mcast_pkt++;
859} 862}
860 863
861static inline bool do_pkt_csum(struct be_eth_rx_compl *rxcp, bool cso) 864static inline bool do_pkt_csum(struct be_eth_rx_compl *rxcp, bool cso)
@@ -925,9 +928,11 @@ static void skb_fill_rx_data(struct be_adapter *adapter,
925 u16 rxq_idx, i, j; 928 u16 rxq_idx, i, j;
926 u32 pktsize, hdr_len, curr_frag_len, size; 929 u32 pktsize, hdr_len, curr_frag_len, size;
927 u8 *start; 930 u8 *start;
931 u8 pkt_type;
928 932
929 rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp); 933 rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp);
930 pktsize = AMAP_GET_BITS(struct amap_eth_rx_compl, pktsize, rxcp); 934 pktsize = AMAP_GET_BITS(struct amap_eth_rx_compl, pktsize, rxcp);
935 pkt_type = AMAP_GET_BITS(struct amap_eth_rx_compl, cast_enc, rxcp);
931 936
932 page_info = get_rx_page_info(adapter, rxq_idx); 937 page_info = get_rx_page_info(adapter, rxq_idx);
933 938
@@ -993,7 +998,7 @@ static void skb_fill_rx_data(struct be_adapter *adapter,
993 BUG_ON(j > MAX_SKB_FRAGS); 998 BUG_ON(j > MAX_SKB_FRAGS);
994 999
995done: 1000done:
996 be_rx_stats_update(adapter, pktsize, num_rcvd); 1001 be_rx_stats_update(adapter, pktsize, num_rcvd, pkt_type);
997} 1002}
998 1003
999/* Process the RX completion indicated by rxcp when GRO is disabled */ 1004/* Process the RX completion indicated by rxcp when GRO is disabled */
@@ -1060,6 +1065,7 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter,
1060 u32 num_rcvd, pkt_size, remaining, vlanf, curr_frag_len; 1065 u32 num_rcvd, pkt_size, remaining, vlanf, curr_frag_len;
1061 u16 i, rxq_idx = 0, vid, j; 1066 u16 i, rxq_idx = 0, vid, j;
1062 u8 vtm; 1067 u8 vtm;
1068 u8 pkt_type;
1063 1069
1064 num_rcvd = AMAP_GET_BITS(struct amap_eth_rx_compl, numfrags, rxcp); 1070 num_rcvd = AMAP_GET_BITS(struct amap_eth_rx_compl, numfrags, rxcp);
1065 /* Is it a flush compl that has no data */ 1071 /* Is it a flush compl that has no data */
@@ -1070,6 +1076,7 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter,
1070 vlanf = AMAP_GET_BITS(struct amap_eth_rx_compl, vtp, rxcp); 1076 vlanf = AMAP_GET_BITS(struct amap_eth_rx_compl, vtp, rxcp);
1071 rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp); 1077 rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp);
1072 vtm = AMAP_GET_BITS(struct amap_eth_rx_compl, vtm, rxcp); 1078 vtm = AMAP_GET_BITS(struct amap_eth_rx_compl, vtm, rxcp);
1079 pkt_type = AMAP_GET_BITS(struct amap_eth_rx_compl, cast_enc, rxcp);
1073 1080
1074 /* vlanf could be wrongly set in some cards. 1081 /* vlanf could be wrongly set in some cards.
1075 * ignore if vtm is not set */ 1082 * ignore if vtm is not set */
@@ -1125,7 +1132,7 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter,
1125 vlan_gro_frags(&eq_obj->napi, adapter->vlan_grp, vid); 1132 vlan_gro_frags(&eq_obj->napi, adapter->vlan_grp, vid);
1126 } 1133 }
1127 1134
1128 be_rx_stats_update(adapter, pkt_size, num_rcvd); 1135 be_rx_stats_update(adapter, pkt_size, num_rcvd, pkt_type);
1129} 1136}
1130 1137
1131static struct be_eth_rx_compl *be_rx_compl_get(struct be_adapter *adapter) 1138static struct be_eth_rx_compl *be_rx_compl_get(struct be_adapter *adapter)
@@ -1743,26 +1750,7 @@ static int be_poll_tx_mcc(struct napi_struct *napi, int budget)
1743 return 1; 1750 return 1;
1744} 1751}
1745 1752
1746static inline bool be_detect_ue(struct be_adapter *adapter) 1753void be_detect_dump_ue(struct be_adapter *adapter)
1747{
1748 u32 online0 = 0, online1 = 0;
1749
1750 pci_read_config_dword(adapter->pdev, PCICFG_ONLINE0, &online0);
1751
1752 pci_read_config_dword(adapter->pdev, PCICFG_ONLINE1, &online1);
1753
1754 if (!online0 || !online1) {
1755 adapter->ue_detected = true;
1756 dev_err(&adapter->pdev->dev,
1757 "UE Detected!! online0=%d online1=%d\n",
1758 online0, online1);
1759 return true;
1760 }
1761
1762 return false;
1763}
1764
1765void be_dump_ue(struct be_adapter *adapter)
1766{ 1754{
1767 u32 ue_status_lo, ue_status_hi, ue_status_lo_mask, ue_status_hi_mask; 1755 u32 ue_status_lo, ue_status_hi, ue_status_lo_mask, ue_status_hi_mask;
1768 u32 i; 1756 u32 i;
@@ -1779,6 +1767,11 @@ void be_dump_ue(struct be_adapter *adapter)
1779 ue_status_lo = (ue_status_lo & (~ue_status_lo_mask)); 1767 ue_status_lo = (ue_status_lo & (~ue_status_lo_mask));
1780 ue_status_hi = (ue_status_hi & (~ue_status_hi_mask)); 1768 ue_status_hi = (ue_status_hi & (~ue_status_hi_mask));
1781 1769
1770 if (ue_status_lo || ue_status_hi) {
1771 adapter->ue_detected = true;
1772 dev_err(&adapter->pdev->dev, "UE Detected!!\n");
1773 }
1774
1782 if (ue_status_lo) { 1775 if (ue_status_lo) {
1783 for (i = 0; ue_status_lo; ue_status_lo >>= 1, i++) { 1776 for (i = 0; ue_status_lo; ue_status_lo >>= 1, i++) {
1784 if (ue_status_lo & 1) 1777 if (ue_status_lo & 1)
@@ -1814,10 +1807,8 @@ static void be_worker(struct work_struct *work)
1814 adapter->rx_post_starved = false; 1807 adapter->rx_post_starved = false;
1815 be_post_rx_frags(adapter); 1808 be_post_rx_frags(adapter);
1816 } 1809 }
1817 if (!adapter->ue_detected) { 1810 if (!adapter->ue_detected)
1818 if (be_detect_ue(adapter)) 1811 be_detect_dump_ue(adapter);
1819 be_dump_ue(adapter);
1820 }
1821 1812
1822 schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000)); 1813 schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000));
1823} 1814}
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index 53af9c93e75c..0c2d96ed561c 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -20,8 +20,8 @@
20 * (you will need to reboot afterwards) */ 20 * (you will need to reboot afterwards) */
21/* #define BNX2X_STOP_ON_ERROR */ 21/* #define BNX2X_STOP_ON_ERROR */
22 22
23#define DRV_MODULE_VERSION "1.52.53-3" 23#define DRV_MODULE_VERSION "1.52.53-4"
24#define DRV_MODULE_RELDATE "2010/18/04" 24#define DRV_MODULE_RELDATE "2010/16/08"
25#define BNX2X_BC_VER 0x040200 25#define BNX2X_BC_VER 0x040200
26 26
27#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 27#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index b4ec2b02a465..f8c3f08e4ce7 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -4328,10 +4328,12 @@ static int bnx2x_init_port(struct bnx2x *bp)
4328 val |= aeu_gpio_mask; 4328 val |= aeu_gpio_mask;
4329 REG_WR(bp, offset, val); 4329 REG_WR(bp, offset, val);
4330 } 4330 }
4331 bp->port.need_hw_lock = 1;
4331 break; 4332 break;
4332 4333
4333 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101:
4334 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727: 4334 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727:
4335 bp->port.need_hw_lock = 1;
4336 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101:
4335 /* add SPIO 5 to group 0 */ 4337 /* add SPIO 5 to group 0 */
4336 { 4338 {
4337 u32 reg_addr = (port ? MISC_REG_AEU_ENABLE1_FUNC_1_OUT_0 : 4339 u32 reg_addr = (port ? MISC_REG_AEU_ENABLE1_FUNC_1_OUT_0 :
@@ -4341,7 +4343,10 @@ static int bnx2x_init_port(struct bnx2x *bp)
4341 REG_WR(bp, reg_addr, val); 4343 REG_WR(bp, reg_addr, val);
4342 } 4344 }
4343 break; 4345 break;
4344 4346 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072:
4347 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073:
4348 bp->port.need_hw_lock = 1;
4349 break;
4345 default: 4350 default:
4346 break; 4351 break;
4347 } 4352 }
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 822f586d72af..0ddf4c66afe2 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -2466,6 +2466,9 @@ int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct pac
2466 if (!(dev->flags & IFF_MASTER)) 2466 if (!(dev->flags & IFF_MASTER))
2467 goto out; 2467 goto out;
2468 2468
2469 if (!pskb_may_pull(skb, sizeof(struct lacpdu)))
2470 goto out;
2471
2469 read_lock(&bond->lock); 2472 read_lock(&bond->lock);
2470 slave = bond_get_slave_by_dev((struct bonding *)netdev_priv(dev), 2473 slave = bond_get_slave_by_dev((struct bonding *)netdev_priv(dev),
2471 orig_dev); 2474 orig_dev);
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index c746b331771d..26bb118c4533 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -362,6 +362,9 @@ static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct
362 goto out; 362 goto out;
363 } 363 }
364 364
365 if (!pskb_may_pull(skb, arp_hdr_len(bond_dev)))
366 goto out;
367
365 if (skb->len < sizeof(struct arp_pkt)) { 368 if (skb->len < sizeof(struct arp_pkt)) {
366 pr_debug("Packet is too small to be an ARP\n"); 369 pr_debug("Packet is too small to be an ARP\n");
367 goto out; 370 goto out;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 2cc4cfc31892..e953c6ad6e6d 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2797,9 +2797,15 @@ void bond_loadbalance_arp_mon(struct work_struct *work)
2797 * so it can wait 2797 * so it can wait
2798 */ 2798 */
2799 bond_for_each_slave(bond, slave, i) { 2799 bond_for_each_slave(bond, slave, i) {
2800 unsigned long trans_start = dev_trans_start(slave->dev);
2801
2800 if (slave->link != BOND_LINK_UP) { 2802 if (slave->link != BOND_LINK_UP) {
2801 if (time_before_eq(jiffies, dev_trans_start(slave->dev) + delta_in_ticks) && 2803 if (time_in_range(jiffies,
2802 time_before_eq(jiffies, slave->dev->last_rx + delta_in_ticks)) { 2804 trans_start - delta_in_ticks,
2805 trans_start + delta_in_ticks) &&
2806 time_in_range(jiffies,
2807 slave->dev->last_rx - delta_in_ticks,
2808 slave->dev->last_rx + delta_in_ticks)) {
2803 2809
2804 slave->link = BOND_LINK_UP; 2810 slave->link = BOND_LINK_UP;
2805 slave->state = BOND_STATE_ACTIVE; 2811 slave->state = BOND_STATE_ACTIVE;
@@ -2827,8 +2833,12 @@ void bond_loadbalance_arp_mon(struct work_struct *work)
2827 * when the source ip is 0, so don't take the link down 2833 * when the source ip is 0, so don't take the link down
2828 * if we don't know our ip yet 2834 * if we don't know our ip yet
2829 */ 2835 */
2830 if (time_after_eq(jiffies, dev_trans_start(slave->dev) + 2*delta_in_ticks) || 2836 if (!time_in_range(jiffies,
2831 (time_after_eq(jiffies, slave->dev->last_rx + 2*delta_in_ticks))) { 2837 trans_start - delta_in_ticks,
2838 trans_start + 2 * delta_in_ticks) ||
2839 !time_in_range(jiffies,
2840 slave->dev->last_rx - delta_in_ticks,
2841 slave->dev->last_rx + 2 * delta_in_ticks)) {
2832 2842
2833 slave->link = BOND_LINK_DOWN; 2843 slave->link = BOND_LINK_DOWN;
2834 slave->state = BOND_STATE_BACKUP; 2844 slave->state = BOND_STATE_BACKUP;
@@ -2883,13 +2893,16 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks)
2883{ 2893{
2884 struct slave *slave; 2894 struct slave *slave;
2885 int i, commit = 0; 2895 int i, commit = 0;
2896 unsigned long trans_start;
2886 2897
2887 bond_for_each_slave(bond, slave, i) { 2898 bond_for_each_slave(bond, slave, i) {
2888 slave->new_link = BOND_LINK_NOCHANGE; 2899 slave->new_link = BOND_LINK_NOCHANGE;
2889 2900
2890 if (slave->link != BOND_LINK_UP) { 2901 if (slave->link != BOND_LINK_UP) {
2891 if (time_before_eq(jiffies, slave_last_rx(bond, slave) + 2902 if (time_in_range(jiffies,
2892 delta_in_ticks)) { 2903 slave_last_rx(bond, slave) - delta_in_ticks,
2904 slave_last_rx(bond, slave) + delta_in_ticks)) {
2905
2893 slave->new_link = BOND_LINK_UP; 2906 slave->new_link = BOND_LINK_UP;
2894 commit++; 2907 commit++;
2895 } 2908 }
@@ -2902,8 +2915,9 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks)
2902 * active. This avoids bouncing, as the last receive 2915 * active. This avoids bouncing, as the last receive
2903 * times need a full ARP monitor cycle to be updated. 2916 * times need a full ARP monitor cycle to be updated.
2904 */ 2917 */
2905 if (!time_after_eq(jiffies, slave->jiffies + 2918 if (time_in_range(jiffies,
2906 2 * delta_in_ticks)) 2919 slave->jiffies - delta_in_ticks,
2920 slave->jiffies + 2 * delta_in_ticks))
2907 continue; 2921 continue;
2908 2922
2909 /* 2923 /*
@@ -2921,8 +2935,10 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks)
2921 */ 2935 */
2922 if (slave->state == BOND_STATE_BACKUP && 2936 if (slave->state == BOND_STATE_BACKUP &&
2923 !bond->current_arp_slave && 2937 !bond->current_arp_slave &&
2924 time_after(jiffies, slave_last_rx(bond, slave) + 2938 !time_in_range(jiffies,
2925 3 * delta_in_ticks)) { 2939 slave_last_rx(bond, slave) - delta_in_ticks,
2940 slave_last_rx(bond, slave) + 3 * delta_in_ticks)) {
2941
2926 slave->new_link = BOND_LINK_DOWN; 2942 slave->new_link = BOND_LINK_DOWN;
2927 commit++; 2943 commit++;
2928 } 2944 }
@@ -2933,11 +2949,15 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks)
2933 * - (more than 2*delta since receive AND 2949 * - (more than 2*delta since receive AND
2934 * the bond has an IP address) 2950 * the bond has an IP address)
2935 */ 2951 */
2952 trans_start = dev_trans_start(slave->dev);
2936 if ((slave->state == BOND_STATE_ACTIVE) && 2953 if ((slave->state == BOND_STATE_ACTIVE) &&
2937 (time_after_eq(jiffies, dev_trans_start(slave->dev) + 2954 (!time_in_range(jiffies,
2938 2 * delta_in_ticks) || 2955 trans_start - delta_in_ticks,
2939 (time_after_eq(jiffies, slave_last_rx(bond, slave) 2956 trans_start + 2 * delta_in_ticks) ||
2940 + 2 * delta_in_ticks)))) { 2957 !time_in_range(jiffies,
2958 slave_last_rx(bond, slave) - delta_in_ticks,
2959 slave_last_rx(bond, slave) + 2 * delta_in_ticks))) {
2960
2941 slave->new_link = BOND_LINK_DOWN; 2961 slave->new_link = BOND_LINK_DOWN;
2942 commit++; 2962 commit++;
2943 } 2963 }
@@ -2956,6 +2976,7 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks)
2956{ 2976{
2957 struct slave *slave; 2977 struct slave *slave;
2958 int i; 2978 int i;
2979 unsigned long trans_start;
2959 2980
2960 bond_for_each_slave(bond, slave, i) { 2981 bond_for_each_slave(bond, slave, i) {
2961 switch (slave->new_link) { 2982 switch (slave->new_link) {
@@ -2963,10 +2984,11 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks)
2963 continue; 2984 continue;
2964 2985
2965 case BOND_LINK_UP: 2986 case BOND_LINK_UP:
2987 trans_start = dev_trans_start(slave->dev);
2966 if ((!bond->curr_active_slave && 2988 if ((!bond->curr_active_slave &&
2967 time_before_eq(jiffies, 2989 time_in_range(jiffies,
2968 dev_trans_start(slave->dev) + 2990 trans_start - delta_in_ticks,
2969 delta_in_ticks)) || 2991 trans_start + delta_in_ticks)) ||
2970 bond->curr_active_slave != slave) { 2992 bond->curr_active_slave != slave) {
2971 slave->link = BOND_LINK_UP; 2993 slave->link = BOND_LINK_UP;
2972 bond->current_arp_slave = NULL; 2994 bond->current_arp_slave = NULL;
@@ -5142,6 +5164,15 @@ int bond_create(struct net *net, const char *name)
5142 res = dev_alloc_name(bond_dev, "bond%d"); 5164 res = dev_alloc_name(bond_dev, "bond%d");
5143 if (res < 0) 5165 if (res < 0)
5144 goto out; 5166 goto out;
5167 } else {
5168 /*
5169 * If we're given a name to register
5170 * we need to ensure that its not already
5171 * registered
5172 */
5173 res = -EEXIST;
5174 if (__dev_get_by_name(net, name) != NULL)
5175 goto out;
5145 } 5176 }
5146 5177
5147 res = register_netdevice(bond_dev); 5178 res = register_netdevice(bond_dev);
diff --git a/drivers/net/caif/Kconfig b/drivers/net/caif/Kconfig
index 631a6242b011..75bfc3a9d95f 100644
--- a/drivers/net/caif/Kconfig
+++ b/drivers/net/caif/Kconfig
@@ -15,7 +15,7 @@ config CAIF_TTY
15 15
16config CAIF_SPI_SLAVE 16config CAIF_SPI_SLAVE
17 tristate "CAIF SPI transport driver for slave interface" 17 tristate "CAIF SPI transport driver for slave interface"
18 depends on CAIF 18 depends on CAIF && HAS_DMA
19 default n 19 default n
20 ---help--- 20 ---help---
21 The CAIF Link layer SPI Protocol driver for Slave SPI interface. 21 The CAIF Link layer SPI Protocol driver for Slave SPI interface.
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index ad19585d960b..f208712c0b90 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -2296,6 +2296,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
2296 case CHELSIO_GET_QSET_NUM:{ 2296 case CHELSIO_GET_QSET_NUM:{
2297 struct ch_reg edata; 2297 struct ch_reg edata;
2298 2298
2299 memset(&edata, 0, sizeof(struct ch_reg));
2300
2299 edata.cmd = CHELSIO_GET_QSET_NUM; 2301 edata.cmd = CHELSIO_GET_QSET_NUM;
2300 edata.val = pi->nqsets; 2302 edata.val = pi->nqsets;
2301 if (copy_to_user(useraddr, &edata, sizeof(edata))) 2303 if (copy_to_user(useraddr, &edata, sizeof(edata)))
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
index a4a0d2b6eb1c..d3d4a57e2450 100644
--- a/drivers/net/e1000e/82571.c
+++ b/drivers/net/e1000e/82571.c
@@ -936,12 +936,14 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
936 ew32(IMC, 0xffffffff); 936 ew32(IMC, 0xffffffff);
937 icr = er32(ICR); 937 icr = er32(ICR);
938 938
939 /* Install any alternate MAC address into RAR0 */ 939 if (hw->mac.type == e1000_82571) {
940 ret_val = e1000_check_alt_mac_addr_generic(hw); 940 /* Install any alternate MAC address into RAR0 */
941 if (ret_val) 941 ret_val = e1000_check_alt_mac_addr_generic(hw);
942 return ret_val; 942 if (ret_val)
943 return ret_val;
943 944
944 e1000e_set_laa_state_82571(hw, true); 945 e1000e_set_laa_state_82571(hw, true);
946 }
945 947
946 /* Reinitialize the 82571 serdes link state machine */ 948 /* Reinitialize the 82571 serdes link state machine */
947 if (hw->phy.media_type == e1000_media_type_internal_serdes) 949 if (hw->phy.media_type == e1000_media_type_internal_serdes)
@@ -1618,14 +1620,16 @@ static s32 e1000_read_mac_addr_82571(struct e1000_hw *hw)
1618{ 1620{
1619 s32 ret_val = 0; 1621 s32 ret_val = 0;
1620 1622
1621 /* 1623 if (hw->mac.type == e1000_82571) {
1622 * If there's an alternate MAC address place it in RAR0 1624 /*
1623 * so that it will override the Si installed default perm 1625 * If there's an alternate MAC address place it in RAR0
1624 * address. 1626 * so that it will override the Si installed default perm
1625 */ 1627 * address.
1626 ret_val = e1000_check_alt_mac_addr_generic(hw); 1628 */
1627 if (ret_val) 1629 ret_val = e1000_check_alt_mac_addr_generic(hw);
1628 goto out; 1630 if (ret_val)
1631 goto out;
1632 }
1629 1633
1630 ret_val = e1000_read_mac_addr_generic(hw); 1634 ret_val = e1000_read_mac_addr_generic(hw);
1631 1635
@@ -1833,6 +1837,7 @@ struct e1000_info e1000_82573_info = {
1833 | FLAG_HAS_SMART_POWER_DOWN 1837 | FLAG_HAS_SMART_POWER_DOWN
1834 | FLAG_HAS_AMT 1838 | FLAG_HAS_AMT
1835 | FLAG_HAS_SWSM_ON_LOAD, 1839 | FLAG_HAS_SWSM_ON_LOAD,
1840 .flags2 = FLAG2_DISABLE_ASPM_L1,
1836 .pba = 20, 1841 .pba = 20,
1837 .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, 1842 .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN,
1838 .get_variants = e1000_get_variants_82571, 1843 .get_variants = e1000_get_variants_82571,
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h
index 307a72f483ee..93b3bedae8d2 100644
--- a/drivers/net/e1000e/defines.h
+++ b/drivers/net/e1000e/defines.h
@@ -621,6 +621,7 @@
621#define E1000_FLASH_UPDATES 2000 621#define E1000_FLASH_UPDATES 2000
622 622
623/* NVM Word Offsets */ 623/* NVM Word Offsets */
624#define NVM_COMPAT 0x0003
624#define NVM_ID_LED_SETTINGS 0x0004 625#define NVM_ID_LED_SETTINGS 0x0004
625#define NVM_INIT_CONTROL2_REG 0x000F 626#define NVM_INIT_CONTROL2_REG 0x000F
626#define NVM_INIT_CONTROL3_PORT_B 0x0014 627#define NVM_INIT_CONTROL3_PORT_B 0x0014
@@ -643,6 +644,9 @@
643/* Mask bits for fields in Word 0x1a of the NVM */ 644/* Mask bits for fields in Word 0x1a of the NVM */
644#define NVM_WORD1A_ASPM_MASK 0x000C 645#define NVM_WORD1A_ASPM_MASK 0x000C
645 646
647/* Mask bits for fields in Word 0x03 of the EEPROM */
648#define NVM_COMPAT_LOM 0x0800
649
646/* For checksumming, the sum of all words in the NVM should equal 0xBABA. */ 650/* For checksumming, the sum of all words in the NVM should equal 0xBABA. */
647#define NVM_SUM 0xBABA 651#define NVM_SUM 0xBABA
648 652
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h
index 66ed08f726fb..ba302a5c2c30 100644
--- a/drivers/net/e1000e/hw.h
+++ b/drivers/net/e1000e/hw.h
@@ -57,6 +57,7 @@ enum e1e_registers {
57 E1000_SCTL = 0x00024, /* SerDes Control - RW */ 57 E1000_SCTL = 0x00024, /* SerDes Control - RW */
58 E1000_FCAL = 0x00028, /* Flow Control Address Low - RW */ 58 E1000_FCAL = 0x00028, /* Flow Control Address Low - RW */
59 E1000_FCAH = 0x0002C, /* Flow Control Address High -RW */ 59 E1000_FCAH = 0x0002C, /* Flow Control Address High -RW */
60 E1000_FEXTNVM4 = 0x00024, /* Future Extended NVM 4 - RW */
60 E1000_FEXTNVM = 0x00028, /* Future Extended NVM - RW */ 61 E1000_FEXTNVM = 0x00028, /* Future Extended NVM - RW */
61 E1000_FCT = 0x00030, /* Flow Control Type - RW */ 62 E1000_FCT = 0x00030, /* Flow Control Type - RW */
62 E1000_VET = 0x00038, /* VLAN Ether Type - RW */ 63 E1000_VET = 0x00038, /* VLAN Ether Type - RW */
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index 63930d12711c..57b5435599ab 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -105,6 +105,10 @@
105#define E1000_FEXTNVM_SW_CONFIG 1 105#define E1000_FEXTNVM_SW_CONFIG 1
106#define E1000_FEXTNVM_SW_CONFIG_ICH8M (1 << 27) /* Bit redefined for ICH8M :/ */ 106#define E1000_FEXTNVM_SW_CONFIG_ICH8M (1 << 27) /* Bit redefined for ICH8M :/ */
107 107
108#define E1000_FEXTNVM4_BEACON_DURATION_MASK 0x7
109#define E1000_FEXTNVM4_BEACON_DURATION_8USEC 0x7
110#define E1000_FEXTNVM4_BEACON_DURATION_16USEC 0x3
111
108#define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL 112#define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL
109 113
110#define E1000_ICH_RAR_ENTRIES 7 114#define E1000_ICH_RAR_ENTRIES 7
@@ -125,6 +129,7 @@
125 129
126/* SMBus Address Phy Register */ 130/* SMBus Address Phy Register */
127#define HV_SMB_ADDR PHY_REG(768, 26) 131#define HV_SMB_ADDR PHY_REG(768, 26)
132#define HV_SMB_ADDR_MASK 0x007F
128#define HV_SMB_ADDR_PEC_EN 0x0200 133#define HV_SMB_ADDR_PEC_EN 0x0200
129#define HV_SMB_ADDR_VALID 0x0080 134#define HV_SMB_ADDR_VALID 0x0080
130 135
@@ -237,6 +242,8 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link);
237static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw); 242static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw);
238static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw); 243static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw);
239static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw); 244static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw);
245static s32 e1000_k1_workaround_lv(struct e1000_hw *hw);
246static void e1000_gate_hw_phy_config_ich8lan(struct e1000_hw *hw, bool gate);
240 247
241static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg) 248static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg)
242{ 249{
@@ -272,7 +279,7 @@ static inline void __ew32flash(struct e1000_hw *hw, unsigned long reg, u32 val)
272static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) 279static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
273{ 280{
274 struct e1000_phy_info *phy = &hw->phy; 281 struct e1000_phy_info *phy = &hw->phy;
275 u32 ctrl; 282 u32 ctrl, fwsm;
276 s32 ret_val = 0; 283 s32 ret_val = 0;
277 284
278 phy->addr = 1; 285 phy->addr = 1;
@@ -294,7 +301,8 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
294 * disabled, then toggle the LANPHYPC Value bit to force 301 * disabled, then toggle the LANPHYPC Value bit to force
295 * the interconnect to PCIe mode. 302 * the interconnect to PCIe mode.
296 */ 303 */
297 if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) { 304 fwsm = er32(FWSM);
305 if (!(fwsm & E1000_ICH_FWSM_FW_VALID)) {
298 ctrl = er32(CTRL); 306 ctrl = er32(CTRL);
299 ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE; 307 ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE;
300 ctrl &= ~E1000_CTRL_LANPHYPC_VALUE; 308 ctrl &= ~E1000_CTRL_LANPHYPC_VALUE;
@@ -303,6 +311,13 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
303 ctrl &= ~E1000_CTRL_LANPHYPC_OVERRIDE; 311 ctrl &= ~E1000_CTRL_LANPHYPC_OVERRIDE;
304 ew32(CTRL, ctrl); 312 ew32(CTRL, ctrl);
305 msleep(50); 313 msleep(50);
314
315 /*
316 * Gate automatic PHY configuration by hardware on
317 * non-managed 82579
318 */
319 if (hw->mac.type == e1000_pch2lan)
320 e1000_gate_hw_phy_config_ich8lan(hw, true);
306 } 321 }
307 322
308 /* 323 /*
@@ -315,6 +330,13 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
315 if (ret_val) 330 if (ret_val)
316 goto out; 331 goto out;
317 332
333 /* Ungate automatic PHY configuration on non-managed 82579 */
334 if ((hw->mac.type == e1000_pch2lan) &&
335 !(fwsm & E1000_ICH_FWSM_FW_VALID)) {
336 msleep(10);
337 e1000_gate_hw_phy_config_ich8lan(hw, false);
338 }
339
318 phy->id = e1000_phy_unknown; 340 phy->id = e1000_phy_unknown;
319 ret_val = e1000e_get_phy_id(hw); 341 ret_val = e1000e_get_phy_id(hw);
320 if (ret_val) 342 if (ret_val)
@@ -561,13 +583,10 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter)
561 if (mac->type == e1000_ich8lan) 583 if (mac->type == e1000_ich8lan)
562 e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, true); 584 e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, true);
563 585
564 /* Disable PHY configuration by hardware, config by software */ 586 /* Gate automatic PHY configuration by hardware on managed 82579 */
565 if (mac->type == e1000_pch2lan) { 587 if ((mac->type == e1000_pch2lan) &&
566 u32 extcnf_ctrl = er32(EXTCNF_CTRL); 588 (er32(FWSM) & E1000_ICH_FWSM_FW_VALID))
567 589 e1000_gate_hw_phy_config_ich8lan(hw, true);
568 extcnf_ctrl |= E1000_EXTCNF_CTRL_GATE_PHY_CFG;
569 ew32(EXTCNF_CTRL, extcnf_ctrl);
570 }
571 590
572 return 0; 591 return 0;
573} 592}
@@ -652,6 +671,12 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
652 goto out; 671 goto out;
653 } 672 }
654 673
674 if (hw->mac.type == e1000_pch2lan) {
675 ret_val = e1000_k1_workaround_lv(hw);
676 if (ret_val)
677 goto out;
678 }
679
655 /* 680 /*
656 * Check if there was DownShift, must be checked 681 * Check if there was DownShift, must be checked
657 * immediately after link-up 682 * immediately after link-up
@@ -895,6 +920,34 @@ static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw)
895} 920}
896 921
897/** 922/**
923 * e1000_write_smbus_addr - Write SMBus address to PHY needed during Sx states
924 * @hw: pointer to the HW structure
925 *
926 * Assumes semaphore already acquired.
927 *
928 **/
929static s32 e1000_write_smbus_addr(struct e1000_hw *hw)
930{
931 u16 phy_data;
932 u32 strap = er32(STRAP);
933 s32 ret_val = 0;
934
935 strap &= E1000_STRAP_SMBUS_ADDRESS_MASK;
936
937 ret_val = e1000_read_phy_reg_hv_locked(hw, HV_SMB_ADDR, &phy_data);
938 if (ret_val)
939 goto out;
940
941 phy_data &= ~HV_SMB_ADDR_MASK;
942 phy_data |= (strap >> E1000_STRAP_SMBUS_ADDRESS_SHIFT);
943 phy_data |= HV_SMB_ADDR_PEC_EN | HV_SMB_ADDR_VALID;
944 ret_val = e1000_write_phy_reg_hv_locked(hw, HV_SMB_ADDR, phy_data);
945
946out:
947 return ret_val;
948}
949
950/**
898 * e1000_sw_lcd_config_ich8lan - SW-based LCD Configuration 951 * e1000_sw_lcd_config_ich8lan - SW-based LCD Configuration
899 * @hw: pointer to the HW structure 952 * @hw: pointer to the HW structure
900 * 953 *
@@ -903,7 +956,6 @@ static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw)
903 **/ 956 **/
904static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) 957static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
905{ 958{
906 struct e1000_adapter *adapter = hw->adapter;
907 struct e1000_phy_info *phy = &hw->phy; 959 struct e1000_phy_info *phy = &hw->phy;
908 u32 i, data, cnf_size, cnf_base_addr, sw_cfg_mask; 960 u32 i, data, cnf_size, cnf_base_addr, sw_cfg_mask;
909 s32 ret_val = 0; 961 s32 ret_val = 0;
@@ -921,7 +973,8 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
921 if (phy->type != e1000_phy_igp_3) 973 if (phy->type != e1000_phy_igp_3)
922 return ret_val; 974 return ret_val;
923 975
924 if (adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_AMT) { 976 if ((hw->adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_AMT) ||
977 (hw->adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_C)) {
925 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG; 978 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG;
926 break; 979 break;
927 } 980 }
@@ -961,21 +1014,16 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
961 cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK; 1014 cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK;
962 cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT; 1015 cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT;
963 1016
964 if (!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) && 1017 if ((!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) &&
965 ((hw->mac.type == e1000_pchlan) || 1018 (hw->mac.type == e1000_pchlan)) ||
966 (hw->mac.type == e1000_pch2lan))) { 1019 (hw->mac.type == e1000_pch2lan)) {
967 /* 1020 /*
968 * HW configures the SMBus address and LEDs when the 1021 * HW configures the SMBus address and LEDs when the
969 * OEM and LCD Write Enable bits are set in the NVM. 1022 * OEM and LCD Write Enable bits are set in the NVM.
970 * When both NVM bits are cleared, SW will configure 1023 * When both NVM bits are cleared, SW will configure
971 * them instead. 1024 * them instead.
972 */ 1025 */
973 data = er32(STRAP); 1026 ret_val = e1000_write_smbus_addr(hw);
974 data &= E1000_STRAP_SMBUS_ADDRESS_MASK;
975 reg_data = data >> E1000_STRAP_SMBUS_ADDRESS_SHIFT;
976 reg_data |= HV_SMB_ADDR_PEC_EN | HV_SMB_ADDR_VALID;
977 ret_val = e1000_write_phy_reg_hv_locked(hw, HV_SMB_ADDR,
978 reg_data);
979 if (ret_val) 1027 if (ret_val)
980 goto out; 1028 goto out;
981 1029
@@ -1440,10 +1488,6 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable)
1440 goto out; 1488 goto out;
1441 1489
1442 /* Enable jumbo frame workaround in the PHY */ 1490 /* Enable jumbo frame workaround in the PHY */
1443 e1e_rphy(hw, PHY_REG(769, 20), &data);
1444 ret_val = e1e_wphy(hw, PHY_REG(769, 20), data & ~(1 << 14));
1445 if (ret_val)
1446 goto out;
1447 e1e_rphy(hw, PHY_REG(769, 23), &data); 1491 e1e_rphy(hw, PHY_REG(769, 23), &data);
1448 data &= ~(0x7F << 5); 1492 data &= ~(0x7F << 5);
1449 data |= (0x37 << 5); 1493 data |= (0x37 << 5);
@@ -1452,7 +1496,6 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable)
1452 goto out; 1496 goto out;
1453 e1e_rphy(hw, PHY_REG(769, 16), &data); 1497 e1e_rphy(hw, PHY_REG(769, 16), &data);
1454 data &= ~(1 << 13); 1498 data &= ~(1 << 13);
1455 data |= (1 << 12);
1456 ret_val = e1e_wphy(hw, PHY_REG(769, 16), data); 1499 ret_val = e1e_wphy(hw, PHY_REG(769, 16), data);
1457 if (ret_val) 1500 if (ret_val)
1458 goto out; 1501 goto out;
@@ -1477,7 +1520,7 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable)
1477 1520
1478 mac_reg = er32(RCTL); 1521 mac_reg = er32(RCTL);
1479 mac_reg &= ~E1000_RCTL_SECRC; 1522 mac_reg &= ~E1000_RCTL_SECRC;
1480 ew32(FFLT_DBG, mac_reg); 1523 ew32(RCTL, mac_reg);
1481 1524
1482 ret_val = e1000e_read_kmrn_reg(hw, 1525 ret_val = e1000e_read_kmrn_reg(hw,
1483 E1000_KMRNCTRLSTA_CTRL_OFFSET, 1526 E1000_KMRNCTRLSTA_CTRL_OFFSET,
@@ -1503,17 +1546,12 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable)
1503 goto out; 1546 goto out;
1504 1547
1505 /* Write PHY register values back to h/w defaults */ 1548 /* Write PHY register values back to h/w defaults */
1506 e1e_rphy(hw, PHY_REG(769, 20), &data);
1507 ret_val = e1e_wphy(hw, PHY_REG(769, 20), data & ~(1 << 14));
1508 if (ret_val)
1509 goto out;
1510 e1e_rphy(hw, PHY_REG(769, 23), &data); 1549 e1e_rphy(hw, PHY_REG(769, 23), &data);
1511 data &= ~(0x7F << 5); 1550 data &= ~(0x7F << 5);
1512 ret_val = e1e_wphy(hw, PHY_REG(769, 23), data); 1551 ret_val = e1e_wphy(hw, PHY_REG(769, 23), data);
1513 if (ret_val) 1552 if (ret_val)
1514 goto out; 1553 goto out;
1515 e1e_rphy(hw, PHY_REG(769, 16), &data); 1554 e1e_rphy(hw, PHY_REG(769, 16), &data);
1516 data &= ~(1 << 12);
1517 data |= (1 << 13); 1555 data |= (1 << 13);
1518 ret_val = e1e_wphy(hw, PHY_REG(769, 16), data); 1556 ret_val = e1e_wphy(hw, PHY_REG(769, 16), data);
1519 if (ret_val) 1557 if (ret_val)
@@ -1559,6 +1597,69 @@ out:
1559} 1597}
1560 1598
1561/** 1599/**
1600 * e1000_k1_gig_workaround_lv - K1 Si workaround
1601 * @hw: pointer to the HW structure
1602 *
1603 * Workaround to set the K1 beacon duration for 82579 parts
1604 **/
1605static s32 e1000_k1_workaround_lv(struct e1000_hw *hw)
1606{
1607 s32 ret_val = 0;
1608 u16 status_reg = 0;
1609 u32 mac_reg;
1610
1611 if (hw->mac.type != e1000_pch2lan)
1612 goto out;
1613
1614 /* Set K1 beacon duration based on 1Gbps speed or otherwise */
1615 ret_val = e1e_rphy(hw, HV_M_STATUS, &status_reg);
1616 if (ret_val)
1617 goto out;
1618
1619 if ((status_reg & (HV_M_STATUS_LINK_UP | HV_M_STATUS_AUTONEG_COMPLETE))
1620 == (HV_M_STATUS_LINK_UP | HV_M_STATUS_AUTONEG_COMPLETE)) {
1621 mac_reg = er32(FEXTNVM4);
1622 mac_reg &= ~E1000_FEXTNVM4_BEACON_DURATION_MASK;
1623
1624 if (status_reg & HV_M_STATUS_SPEED_1000)
1625 mac_reg |= E1000_FEXTNVM4_BEACON_DURATION_8USEC;
1626 else
1627 mac_reg |= E1000_FEXTNVM4_BEACON_DURATION_16USEC;
1628
1629 ew32(FEXTNVM4, mac_reg);
1630 }
1631
1632out:
1633 return ret_val;
1634}
1635
1636/**
1637 * e1000_gate_hw_phy_config_ich8lan - disable PHY config via hardware
1638 * @hw: pointer to the HW structure
1639 * @gate: boolean set to true to gate, false to ungate
1640 *
1641 * Gate/ungate the automatic PHY configuration via hardware; perform
1642 * the configuration via software instead.
1643 **/
1644static void e1000_gate_hw_phy_config_ich8lan(struct e1000_hw *hw, bool gate)
1645{
1646 u32 extcnf_ctrl;
1647
1648 if (hw->mac.type != e1000_pch2lan)
1649 return;
1650
1651 extcnf_ctrl = er32(EXTCNF_CTRL);
1652
1653 if (gate)
1654 extcnf_ctrl |= E1000_EXTCNF_CTRL_GATE_PHY_CFG;
1655 else
1656 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_GATE_PHY_CFG;
1657
1658 ew32(EXTCNF_CTRL, extcnf_ctrl);
1659 return;
1660}
1661
1662/**
1562 * e1000_lan_init_done_ich8lan - Check for PHY config completion 1663 * e1000_lan_init_done_ich8lan - Check for PHY config completion
1563 * @hw: pointer to the HW structure 1664 * @hw: pointer to the HW structure
1564 * 1665 *
@@ -1602,6 +1703,9 @@ static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw)
1602 if (e1000_check_reset_block(hw)) 1703 if (e1000_check_reset_block(hw))
1603 goto out; 1704 goto out;
1604 1705
1706 /* Allow time for h/w to get to quiescent state after reset */
1707 msleep(10);
1708
1605 /* Perform any necessary post-reset workarounds */ 1709 /* Perform any necessary post-reset workarounds */
1606 switch (hw->mac.type) { 1710 switch (hw->mac.type) {
1607 case e1000_pchlan: 1711 case e1000_pchlan:
@@ -1630,6 +1734,13 @@ static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw)
1630 /* Configure the LCD with the OEM bits in NVM */ 1734 /* Configure the LCD with the OEM bits in NVM */
1631 ret_val = e1000_oem_bits_config_ich8lan(hw, true); 1735 ret_val = e1000_oem_bits_config_ich8lan(hw, true);
1632 1736
1737 /* Ungate automatic PHY configuration on non-managed 82579 */
1738 if ((hw->mac.type == e1000_pch2lan) &&
1739 !(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) {
1740 msleep(10);
1741 e1000_gate_hw_phy_config_ich8lan(hw, false);
1742 }
1743
1633out: 1744out:
1634 return ret_val; 1745 return ret_val;
1635} 1746}
@@ -1646,6 +1757,11 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw)
1646{ 1757{
1647 s32 ret_val = 0; 1758 s32 ret_val = 0;
1648 1759
1760 /* Gate automatic PHY configuration by hardware on non-managed 82579 */
1761 if ((hw->mac.type == e1000_pch2lan) &&
1762 !(er32(FWSM) & E1000_ICH_FWSM_FW_VALID))
1763 e1000_gate_hw_phy_config_ich8lan(hw, true);
1764
1649 ret_val = e1000e_phy_hw_reset_generic(hw); 1765 ret_val = e1000e_phy_hw_reset_generic(hw);
1650 if (ret_val) 1766 if (ret_val)
1651 goto out; 1767 goto out;
@@ -2910,6 +3026,14 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
2910 * external PHY is reset. 3026 * external PHY is reset.
2911 */ 3027 */
2912 ctrl |= E1000_CTRL_PHY_RST; 3028 ctrl |= E1000_CTRL_PHY_RST;
3029
3030 /*
3031 * Gate automatic PHY configuration by hardware on
3032 * non-managed 82579
3033 */
3034 if ((hw->mac.type == e1000_pch2lan) &&
3035 !(er32(FWSM) & E1000_ICH_FWSM_FW_VALID))
3036 e1000_gate_hw_phy_config_ich8lan(hw, true);
2913 } 3037 }
2914 ret_val = e1000_acquire_swflag_ich8lan(hw); 3038 ret_val = e1000_acquire_swflag_ich8lan(hw);
2915 e_dbg("Issuing a global reset to ich8lan\n"); 3039 e_dbg("Issuing a global reset to ich8lan\n");
@@ -3460,13 +3584,20 @@ void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw)
3460void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw) 3584void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw)
3461{ 3585{
3462 u32 phy_ctrl; 3586 u32 phy_ctrl;
3587 s32 ret_val;
3463 3588
3464 phy_ctrl = er32(PHY_CTRL); 3589 phy_ctrl = er32(PHY_CTRL);
3465 phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU | E1000_PHY_CTRL_GBE_DISABLE; 3590 phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU | E1000_PHY_CTRL_GBE_DISABLE;
3466 ew32(PHY_CTRL, phy_ctrl); 3591 ew32(PHY_CTRL, phy_ctrl);
3467 3592
3468 if (hw->mac.type >= e1000_pchlan) 3593 if (hw->mac.type >= e1000_pchlan) {
3469 e1000_phy_hw_reset_ich8lan(hw); 3594 e1000_oem_bits_config_ich8lan(hw, true);
3595 ret_val = hw->phy.ops.acquire(hw);
3596 if (ret_val)
3597 return;
3598 e1000_write_smbus_addr(hw);
3599 hw->phy.ops.release(hw);
3600 }
3470} 3601}
3471 3602
3472/** 3603/**
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
index df4a27922931..0fd4eb5ac5fb 100644
--- a/drivers/net/e1000e/lib.c
+++ b/drivers/net/e1000e/lib.c
@@ -183,6 +183,16 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw)
183 u16 offset, nvm_alt_mac_addr_offset, nvm_data; 183 u16 offset, nvm_alt_mac_addr_offset, nvm_data;
184 u8 alt_mac_addr[ETH_ALEN]; 184 u8 alt_mac_addr[ETH_ALEN];
185 185
186 ret_val = e1000_read_nvm(hw, NVM_COMPAT, 1, &nvm_data);
187 if (ret_val)
188 goto out;
189
190 /* Check for LOM (vs. NIC) or one of two valid mezzanine cards */
191 if (!((nvm_data & NVM_COMPAT_LOM) ||
192 (hw->adapter->pdev->device == E1000_DEV_ID_82571EB_SERDES_DUAL) ||
193 (hw->adapter->pdev->device == E1000_DEV_ID_82571EB_SERDES_QUAD)))
194 goto out;
195
186 ret_val = e1000_read_nvm(hw, NVM_ALT_MAC_ADDR_PTR, 1, 196 ret_val = e1000_read_nvm(hw, NVM_ALT_MAC_ADDR_PTR, 1,
187 &nvm_alt_mac_addr_offset); 197 &nvm_alt_mac_addr_offset);
188 if (ret_val) { 198 if (ret_val) {
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 2b8ef44bd2b1..e561d15c3eb1 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -2704,6 +2704,16 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
2704 u32 psrctl = 0; 2704 u32 psrctl = 0;
2705 u32 pages = 0; 2705 u32 pages = 0;
2706 2706
2707 /* Workaround Si errata on 82579 - configure jumbo frame flow */
2708 if (hw->mac.type == e1000_pch2lan) {
2709 s32 ret_val;
2710
2711 if (adapter->netdev->mtu > ETH_DATA_LEN)
2712 ret_val = e1000_lv_jumbo_workaround_ich8lan(hw, true);
2713 else
2714 ret_val = e1000_lv_jumbo_workaround_ich8lan(hw, false);
2715 }
2716
2707 /* Program MC offset vector base */ 2717 /* Program MC offset vector base */
2708 rctl = er32(RCTL); 2718 rctl = er32(RCTL);
2709 rctl &= ~(3 << E1000_RCTL_MO_SHIFT); 2719 rctl &= ~(3 << E1000_RCTL_MO_SHIFT);
@@ -2744,16 +2754,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
2744 e1e_wphy(hw, 22, phy_data); 2754 e1e_wphy(hw, 22, phy_data);
2745 } 2755 }
2746 2756
2747 /* Workaround Si errata on 82579 - configure jumbo frame flow */
2748 if (hw->mac.type == e1000_pch2lan) {
2749 s32 ret_val;
2750
2751 if (rctl & E1000_RCTL_LPE)
2752 ret_val = e1000_lv_jumbo_workaround_ich8lan(hw, true);
2753 else
2754 ret_val = e1000_lv_jumbo_workaround_ich8lan(hw, false);
2755 }
2756
2757 /* Setup buffer sizes */ 2757 /* Setup buffer sizes */
2758 rctl &= ~E1000_RCTL_SZ_4096; 2758 rctl &= ~E1000_RCTL_SZ_4096;
2759 rctl |= E1000_RCTL_BSEX; 2759 rctl |= E1000_RCTL_BSEX;
@@ -4833,6 +4833,15 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
4833 return -EINVAL; 4833 return -EINVAL;
4834 } 4834 }
4835 4835
4836 /* Jumbo frame workaround on 82579 requires CRC be stripped */
4837 if ((adapter->hw.mac.type == e1000_pch2lan) &&
4838 !(adapter->flags2 & FLAG2_CRC_STRIPPING) &&
4839 (new_mtu > ETH_DATA_LEN)) {
4840 e_err("Jumbo Frames not supported on 82579 when CRC "
4841 "stripping is disabled.\n");
4842 return -EINVAL;
4843 }
4844
4836 /* 82573 Errata 17 */ 4845 /* 82573 Errata 17 */
4837 if (((adapter->hw.mac.type == e1000_82573) || 4846 if (((adapter->hw.mac.type == e1000_82573) ||
4838 (adapter->hw.mac.type == e1000_82574)) && 4847 (adapter->hw.mac.type == e1000_82574)) &&
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 99a929964e3c..1846623c6ae6 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -40,7 +40,7 @@
40#include <asm/io.h> 40#include <asm/io.h>
41 41
42#define DRV_NAME "ehea" 42#define DRV_NAME "ehea"
43#define DRV_VERSION "EHEA_0105" 43#define DRV_VERSION "EHEA_0106"
44 44
45/* eHEA capability flags */ 45/* eHEA capability flags */
46#define DLPAR_PORT_ADD_REM 1 46#define DLPAR_PORT_ADD_REM 1
@@ -400,6 +400,7 @@ struct ehea_port_res {
400 u32 poll_counter; 400 u32 poll_counter;
401 struct net_lro_mgr lro_mgr; 401 struct net_lro_mgr lro_mgr;
402 struct net_lro_desc lro_desc[MAX_LRO_DESCRIPTORS]; 402 struct net_lro_desc lro_desc[MAX_LRO_DESCRIPTORS];
403 int sq_restart_flag;
403}; 404};
404 405
405 406
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 897719b49f96..6372610ed240 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -533,8 +533,15 @@ static inline void ehea_fill_skb(struct net_device *dev,
533 int length = cqe->num_bytes_transfered - 4; /*remove CRC */ 533 int length = cqe->num_bytes_transfered - 4; /*remove CRC */
534 534
535 skb_put(skb, length); 535 skb_put(skb, length);
536 skb->ip_summed = CHECKSUM_UNNECESSARY;
537 skb->protocol = eth_type_trans(skb, dev); 536 skb->protocol = eth_type_trans(skb, dev);
537
538 /* The packet was not an IPV4 packet so a complemented checksum was
539 calculated. The value is found in the Internet Checksum field. */
540 if (cqe->status & EHEA_CQE_BLIND_CKSUM) {
541 skb->ip_summed = CHECKSUM_COMPLETE;
542 skb->csum = csum_unfold(~cqe->inet_checksum_value);
543 } else
544 skb->ip_summed = CHECKSUM_UNNECESSARY;
538} 545}
539 546
540static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array, 547static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array,
@@ -776,6 +783,53 @@ static int ehea_proc_rwqes(struct net_device *dev,
776 return processed; 783 return processed;
777} 784}
778 785
786#define SWQE_RESTART_CHECK 0xdeadbeaff00d0000ull
787
788static void reset_sq_restart_flag(struct ehea_port *port)
789{
790 int i;
791
792 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
793 struct ehea_port_res *pr = &port->port_res[i];
794 pr->sq_restart_flag = 0;
795 }
796}
797
798static void check_sqs(struct ehea_port *port)
799{
800 struct ehea_swqe *swqe;
801 int swqe_index;
802 int i, k;
803
804 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
805 struct ehea_port_res *pr = &port->port_res[i];
806 k = 0;
807 swqe = ehea_get_swqe(pr->qp, &swqe_index);
808 memset(swqe, 0, SWQE_HEADER_SIZE);
809 atomic_dec(&pr->swqe_avail);
810
811 swqe->tx_control |= EHEA_SWQE_PURGE;
812 swqe->wr_id = SWQE_RESTART_CHECK;
813 swqe->tx_control |= EHEA_SWQE_SIGNALLED_COMPLETION;
814 swqe->tx_control |= EHEA_SWQE_IMM_DATA_PRESENT;
815 swqe->immediate_data_length = 80;
816
817 ehea_post_swqe(pr->qp, swqe);
818
819 while (pr->sq_restart_flag == 0) {
820 msleep(5);
821 if (++k == 100) {
822 ehea_error("HW/SW queues out of sync");
823 ehea_schedule_port_reset(pr->port);
824 return;
825 }
826 }
827 }
828
829 return;
830}
831
832
779static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota) 833static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota)
780{ 834{
781 struct sk_buff *skb; 835 struct sk_buff *skb;
@@ -793,6 +847,13 @@ static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota)
793 847
794 cqe_counter++; 848 cqe_counter++;
795 rmb(); 849 rmb();
850
851 if (cqe->wr_id == SWQE_RESTART_CHECK) {
852 pr->sq_restart_flag = 1;
853 swqe_av++;
854 break;
855 }
856
796 if (cqe->status & EHEA_CQE_STAT_ERR_MASK) { 857 if (cqe->status & EHEA_CQE_STAT_ERR_MASK) {
797 ehea_error("Bad send completion status=0x%04X", 858 ehea_error("Bad send completion status=0x%04X",
798 cqe->status); 859 cqe->status);
@@ -2675,8 +2736,10 @@ static void ehea_flush_sq(struct ehea_port *port)
2675 int k = 0; 2736 int k = 0;
2676 while (atomic_read(&pr->swqe_avail) < swqe_max) { 2737 while (atomic_read(&pr->swqe_avail) < swqe_max) {
2677 msleep(5); 2738 msleep(5);
2678 if (++k == 20) 2739 if (++k == 20) {
2740 ehea_error("WARNING: sq not flushed completely");
2679 break; 2741 break;
2742 }
2680 } 2743 }
2681 } 2744 }
2682} 2745}
@@ -2917,6 +2980,7 @@ static void ehea_rereg_mrs(struct work_struct *work)
2917 port_napi_disable(port); 2980 port_napi_disable(port);
2918 mutex_unlock(&port->port_lock); 2981 mutex_unlock(&port->port_lock);
2919 } 2982 }
2983 reset_sq_restart_flag(port);
2920 } 2984 }
2921 2985
2922 /* Unregister old memory region */ 2986 /* Unregister old memory region */
@@ -2951,6 +3015,7 @@ static void ehea_rereg_mrs(struct work_struct *work)
2951 mutex_lock(&port->port_lock); 3015 mutex_lock(&port->port_lock);
2952 port_napi_enable(port); 3016 port_napi_enable(port);
2953 ret = ehea_restart_qps(dev); 3017 ret = ehea_restart_qps(dev);
3018 check_sqs(port);
2954 if (!ret) 3019 if (!ret)
2955 netif_wake_queue(dev); 3020 netif_wake_queue(dev);
2956 mutex_unlock(&port->port_lock); 3021 mutex_unlock(&port->port_lock);
diff --git a/drivers/net/ehea/ehea_qmr.h b/drivers/net/ehea/ehea_qmr.h
index f608a6c54af5..38104734a3be 100644
--- a/drivers/net/ehea/ehea_qmr.h
+++ b/drivers/net/ehea/ehea_qmr.h
@@ -150,6 +150,7 @@ struct ehea_rwqe {
150#define EHEA_CQE_TYPE_RQ 0x60 150#define EHEA_CQE_TYPE_RQ 0x60
151#define EHEA_CQE_STAT_ERR_MASK 0x700F 151#define EHEA_CQE_STAT_ERR_MASK 0x700F
152#define EHEA_CQE_STAT_FAT_ERR_MASK 0xF 152#define EHEA_CQE_STAT_FAT_ERR_MASK 0xF
153#define EHEA_CQE_BLIND_CKSUM 0x8000
153#define EHEA_CQE_STAT_ERR_TCP 0x4000 154#define EHEA_CQE_STAT_ERR_TCP 0x4000
154#define EHEA_CQE_STAT_ERR_IP 0x2000 155#define EHEA_CQE_STAT_ERR_IP 0x2000
155#define EHEA_CQE_STAT_ERR_CRC 0x1000 156#define EHEA_CQE_STAT_ERR_CRC 0x1000
diff --git a/drivers/net/eql.c b/drivers/net/eql.c
index dda2c7944da9..0cb1cf9cf4b0 100644
--- a/drivers/net/eql.c
+++ b/drivers/net/eql.c
@@ -555,6 +555,8 @@ static int eql_g_master_cfg(struct net_device *dev, master_config_t __user *mcp)
555 equalizer_t *eql; 555 equalizer_t *eql;
556 master_config_t mc; 556 master_config_t mc;
557 557
558 memset(&mc, 0, sizeof(master_config_t));
559
558 if (eql_is_master(dev)) { 560 if (eql_is_master(dev)) {
559 eql = netdev_priv(dev); 561 eql = netdev_priv(dev);
560 mc.max_slaves = eql->max_slaves; 562 mc.max_slaves = eql->max_slaves;
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 768b840aeb6b..cce32d43175f 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -678,24 +678,37 @@ static int fec_enet_mii_probe(struct net_device *dev)
678{ 678{
679 struct fec_enet_private *fep = netdev_priv(dev); 679 struct fec_enet_private *fep = netdev_priv(dev);
680 struct phy_device *phy_dev = NULL; 680 struct phy_device *phy_dev = NULL;
681 int ret; 681 char mdio_bus_id[MII_BUS_ID_SIZE];
682 char phy_name[MII_BUS_ID_SIZE + 3];
683 int phy_id;
682 684
683 fep->phy_dev = NULL; 685 fep->phy_dev = NULL;
684 686
685 /* find the first phy */ 687 /* check for attached phy */
686 phy_dev = phy_find_first(fep->mii_bus); 688 for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) {
687 if (!phy_dev) { 689 if ((fep->mii_bus->phy_mask & (1 << phy_id)))
688 printk(KERN_ERR "%s: no PHY found\n", dev->name); 690 continue;
689 return -ENODEV; 691 if (fep->mii_bus->phy_map[phy_id] == NULL)
692 continue;
693 if (fep->mii_bus->phy_map[phy_id]->phy_id == 0)
694 continue;
695 strncpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE);
696 break;
690 } 697 }
691 698
692 /* attach the mac to the phy */ 699 if (phy_id >= PHY_MAX_ADDR) {
693 ret = phy_connect_direct(dev, phy_dev, 700 printk(KERN_INFO "%s: no PHY, assuming direct connection "
694 &fec_enet_adjust_link, 0, 701 "to switch\n", dev->name);
695 PHY_INTERFACE_MODE_MII); 702 strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE);
696 if (ret) { 703 phy_id = 0;
697 printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); 704 }
698 return ret; 705
706 snprintf(phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id);
707 phy_dev = phy_connect(dev, phy_name, &fec_enet_adjust_link, 0,
708 PHY_INTERFACE_MODE_MII);
709 if (IS_ERR(phy_dev)) {
710 printk(KERN_ERR "%s: could not attach to PHY\n", dev->name);
711 return PTR_ERR(phy_dev);
699 } 712 }
700 713
701 /* mask with MAC supported features */ 714 /* mask with MAC supported features */
@@ -738,7 +751,7 @@ static int fec_enet_mii_init(struct platform_device *pdev)
738 fep->mii_bus->read = fec_enet_mdio_read; 751 fep->mii_bus->read = fec_enet_mdio_read;
739 fep->mii_bus->write = fec_enet_mdio_write; 752 fep->mii_bus->write = fec_enet_mdio_write;
740 fep->mii_bus->reset = fec_enet_mdio_reset; 753 fep->mii_bus->reset = fec_enet_mdio_reset;
741 snprintf(fep->mii_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id); 754 snprintf(fep->mii_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id + 1);
742 fep->mii_bus->priv = fep; 755 fep->mii_bus->priv = fep;
743 fep->mii_bus->parent = &pdev->dev; 756 fep->mii_bus->parent = &pdev->dev;
744 757
@@ -1311,6 +1324,9 @@ fec_probe(struct platform_device *pdev)
1311 if (ret) 1324 if (ret)
1312 goto failed_mii_init; 1325 goto failed_mii_init;
1313 1326
1327 /* Carrier starts down, phylib will bring it up */
1328 netif_carrier_off(ndev);
1329
1314 ret = register_netdev(ndev); 1330 ret = register_netdev(ndev);
1315 if (ret) 1331 if (ret)
1316 goto failed_register; 1332 goto failed_register;
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 3506fd6ad726..519e19e23955 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -2928,7 +2928,7 @@ static int __devinit emac_probe(struct platform_device *ofdev,
2928 if (dev->emac_irq != NO_IRQ) 2928 if (dev->emac_irq != NO_IRQ)
2929 irq_dispose_mapping(dev->emac_irq); 2929 irq_dispose_mapping(dev->emac_irq);
2930 err_free: 2930 err_free:
2931 kfree(ndev); 2931 free_netdev(ndev);
2932 err_gone: 2932 err_gone:
2933 /* if we were on the bootlist, remove us as we won't show up and 2933 /* if we were on the bootlist, remove us as we won't show up and
2934 * wake up all waiters to notify them in case they were waiting 2934 * wake up all waiters to notify them in case they were waiting
@@ -2971,7 +2971,7 @@ static int __devexit emac_remove(struct platform_device *ofdev)
2971 if (dev->emac_irq != NO_IRQ) 2971 if (dev->emac_irq != NO_IRQ)
2972 irq_dispose_mapping(dev->emac_irq); 2972 irq_dispose_mapping(dev->emac_irq);
2973 2973
2974 kfree(dev->ndev); 2974 free_netdev(dev->ndev);
2975 2975
2976 return 0; 2976 return 0;
2977} 2977}
diff --git a/drivers/net/ibm_newemac/debug.c b/drivers/net/ibm_newemac/debug.c
index 3995fafc1e08..8c6c1e2a8750 100644
--- a/drivers/net/ibm_newemac/debug.c
+++ b/drivers/net/ibm_newemac/debug.c
@@ -238,7 +238,7 @@ void emac_dbg_dump_all(void)
238} 238}
239 239
240#if defined(CONFIG_MAGIC_SYSRQ) 240#if defined(CONFIG_MAGIC_SYSRQ)
241static void emac_sysrq_handler(int key, struct tty_struct *tty) 241static void emac_sysrq_handler(int key)
242{ 242{
243 emac_dbg_dump_all(); 243 emac_dbg_dump_all();
244} 244}
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 2602852cc55a..4734c939ad03 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -1113,7 +1113,8 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu)
1113 struct ibmveth_adapter *adapter = netdev_priv(dev); 1113 struct ibmveth_adapter *adapter = netdev_priv(dev);
1114 struct vio_dev *viodev = adapter->vdev; 1114 struct vio_dev *viodev = adapter->vdev;
1115 int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH; 1115 int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH;
1116 int i; 1116 int i, rc;
1117 int need_restart = 0;
1117 1118
1118 if (new_mtu < IBMVETH_MAX_MTU) 1119 if (new_mtu < IBMVETH_MAX_MTU)
1119 return -EINVAL; 1120 return -EINVAL;
@@ -1127,35 +1128,32 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu)
1127 1128
1128 /* Deactivate all the buffer pools so that the next loop can activate 1129 /* Deactivate all the buffer pools so that the next loop can activate
1129 only the buffer pools necessary to hold the new MTU */ 1130 only the buffer pools necessary to hold the new MTU */
1130 for (i = 0; i < IbmVethNumBufferPools; i++) 1131 if (netif_running(adapter->netdev)) {
1131 if (adapter->rx_buff_pool[i].active) { 1132 need_restart = 1;
1132 ibmveth_free_buffer_pool(adapter, 1133 adapter->pool_config = 1;
1133 &adapter->rx_buff_pool[i]); 1134 ibmveth_close(adapter->netdev);
1134 adapter->rx_buff_pool[i].active = 0; 1135 adapter->pool_config = 0;
1135 } 1136 }
1136 1137
1137 /* Look for an active buffer pool that can hold the new MTU */ 1138 /* Look for an active buffer pool that can hold the new MTU */
1138 for(i = 0; i<IbmVethNumBufferPools; i++) { 1139 for(i = 0; i<IbmVethNumBufferPools; i++) {
1139 adapter->rx_buff_pool[i].active = 1; 1140 adapter->rx_buff_pool[i].active = 1;
1140 1141
1141 if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) { 1142 if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) {
1142 if (netif_running(adapter->netdev)) {
1143 adapter->pool_config = 1;
1144 ibmveth_close(adapter->netdev);
1145 adapter->pool_config = 0;
1146 dev->mtu = new_mtu;
1147 vio_cmo_set_dev_desired(viodev,
1148 ibmveth_get_desired_dma
1149 (viodev));
1150 return ibmveth_open(adapter->netdev);
1151 }
1152 dev->mtu = new_mtu; 1143 dev->mtu = new_mtu;
1153 vio_cmo_set_dev_desired(viodev, 1144 vio_cmo_set_dev_desired(viodev,
1154 ibmveth_get_desired_dma 1145 ibmveth_get_desired_dma
1155 (viodev)); 1146 (viodev));
1147 if (need_restart) {
1148 return ibmveth_open(adapter->netdev);
1149 }
1156 return 0; 1150 return 0;
1157 } 1151 }
1158 } 1152 }
1153
1154 if (need_restart && (rc = ibmveth_open(adapter->netdev)))
1155 return rc;
1156
1159 return -EINVAL; 1157 return -EINVAL;
1160} 1158}
1161 1159
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c
index b4fb07a6f13f..51919fcd50c2 100644
--- a/drivers/net/ks8851.c
+++ b/drivers/net/ks8851.c
@@ -503,30 +503,33 @@ static void ks8851_rx_pkts(struct ks8851_net *ks)
503 ks8851_wrreg16(ks, KS_RXQCR, 503 ks8851_wrreg16(ks, KS_RXQCR,
504 ks->rc_rxqcr | RXQCR_SDA | RXQCR_ADRFE); 504 ks->rc_rxqcr | RXQCR_SDA | RXQCR_ADRFE);
505 505
506 if (rxlen > 0) { 506 if (rxlen > 4) {
507 skb = netdev_alloc_skb(ks->netdev, rxlen + 2 + 8); 507 unsigned int rxalign;
508 if (!skb) { 508
509 /* todo - dump frame and move on */ 509 rxlen -= 4;
510 } 510 rxalign = ALIGN(rxlen, 4);
511 skb = netdev_alloc_skb_ip_align(ks->netdev, rxalign);
512 if (skb) {
511 513
512 /* two bytes to ensure ip is aligned, and four bytes 514 /* 4 bytes of status header + 4 bytes of
513 * for the status header and 4 bytes of garbage */ 515 * garbage: we put them before ethernet
514 skb_reserve(skb, 2 + 4 + 4); 516 * header, so that they are copied,
517 * but ignored.
518 */
515 519
516 rxpkt = skb_put(skb, rxlen - 4) - 8; 520 rxpkt = skb_put(skb, rxlen) - 8;
517 521
518 /* align the packet length to 4 bytes, and add 4 bytes 522 ks8851_rdfifo(ks, rxpkt, rxalign + 8);
519 * as we're getting the rx status header as well */
520 ks8851_rdfifo(ks, rxpkt, ALIGN(rxlen, 4) + 8);
521 523
522 if (netif_msg_pktdata(ks)) 524 if (netif_msg_pktdata(ks))
523 ks8851_dbg_dumpkkt(ks, rxpkt); 525 ks8851_dbg_dumpkkt(ks, rxpkt);
524 526
525 skb->protocol = eth_type_trans(skb, ks->netdev); 527 skb->protocol = eth_type_trans(skb, ks->netdev);
526 netif_rx(skb); 528 netif_rx(skb);
527 529
528 ks->netdev->stats.rx_packets++; 530 ks->netdev->stats.rx_packets++;
529 ks->netdev->stats.rx_bytes += rxlen - 4; 531 ks->netdev->stats.rx_bytes += rxlen;
532 }
530 } 533 }
531 534
532 ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr); 535 ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr);
diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c
index c7b624711f5e..87f0a93b165c 100644
--- a/drivers/net/ll_temac_main.c
+++ b/drivers/net/ll_temac_main.c
@@ -38,6 +38,7 @@
38#include <linux/of_device.h> 38#include <linux/of_device.h>
39#include <linux/of_mdio.h> 39#include <linux/of_mdio.h>
40#include <linux/of_platform.h> 40#include <linux/of_platform.h>
41#include <linux/of_address.h>
41#include <linux/skbuff.h> 42#include <linux/skbuff.h>
42#include <linux/spinlock.h> 43#include <linux/spinlock.h>
43#include <linux/tcp.h> /* needed for sizeof(tcphdr) */ 44#include <linux/tcp.h> /* needed for sizeof(tcphdr) */
@@ -902,8 +903,8 @@ temac_poll_controller(struct net_device *ndev)
902 disable_irq(lp->tx_irq); 903 disable_irq(lp->tx_irq);
903 disable_irq(lp->rx_irq); 904 disable_irq(lp->rx_irq);
904 905
905 ll_temac_rx_irq(lp->tx_irq, lp); 906 ll_temac_rx_irq(lp->tx_irq, ndev);
906 ll_temac_tx_irq(lp->rx_irq, lp); 907 ll_temac_tx_irq(lp->rx_irq, ndev);
907 908
908 enable_irq(lp->tx_irq); 909 enable_irq(lp->tx_irq);
909 enable_irq(lp->rx_irq); 910 enable_irq(lp->rx_irq);
diff --git a/drivers/net/ll_temac_mdio.c b/drivers/net/ll_temac_mdio.c
index 5ae28c975b38..8cf9d4f56bb2 100644
--- a/drivers/net/ll_temac_mdio.c
+++ b/drivers/net/ll_temac_mdio.c
@@ -10,6 +10,7 @@
10#include <linux/phy.h> 10#include <linux/phy.h>
11#include <linux/of.h> 11#include <linux/of.h>
12#include <linux/of_device.h> 12#include <linux/of_device.h>
13#include <linux/of_address.h>
13#include <linux/slab.h> 14#include <linux/slab.h>
14#include <linux/of_mdio.h> 15#include <linux/of_mdio.h>
15 16
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index ffa1b9ce1cc5..6dca3574e355 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -53,8 +53,8 @@
53 53
54#define _NETXEN_NIC_LINUX_MAJOR 4 54#define _NETXEN_NIC_LINUX_MAJOR 4
55#define _NETXEN_NIC_LINUX_MINOR 0 55#define _NETXEN_NIC_LINUX_MINOR 0
56#define _NETXEN_NIC_LINUX_SUBVERSION 73 56#define _NETXEN_NIC_LINUX_SUBVERSION 74
57#define NETXEN_NIC_LINUX_VERSIONID "4.0.73" 57#define NETXEN_NIC_LINUX_VERSIONID "4.0.74"
58 58
59#define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) 59#define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c))
60#define _major(v) (((v) >> 24) & 0xff) 60#define _major(v) (((v) >> 24) & 0xff)
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index c865dda2adf1..b075a35b85d4 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -1540,7 +1540,6 @@ netxen_process_rcv(struct netxen_adapter *adapter,
1540 if (pkt_offset) 1540 if (pkt_offset)
1541 skb_pull(skb, pkt_offset); 1541 skb_pull(skb, pkt_offset);
1542 1542
1543 skb->truesize = skb->len + sizeof(struct sk_buff);
1544 skb->protocol = eth_type_trans(skb, netdev); 1543 skb->protocol = eth_type_trans(skb, netdev);
1545 1544
1546 napi_gro_receive(&sds_ring->napi, skb); 1545 napi_gro_receive(&sds_ring->napi, skb);
@@ -1602,8 +1601,6 @@ netxen_process_lro(struct netxen_adapter *adapter,
1602 1601
1603 skb_put(skb, lro_length + data_offset); 1602 skb_put(skb, lro_length + data_offset);
1604 1603
1605 skb->truesize = skb->len + sizeof(struct sk_buff) + skb_headroom(skb);
1606
1607 skb_pull(skb, l2_hdr_offset); 1604 skb_pull(skb, l2_hdr_offset);
1608 skb->protocol = eth_type_trans(skb, netdev); 1605 skb->protocol = eth_type_trans(skb, netdev);
1609 1606
@@ -1805,8 +1802,6 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid,
1805 netxen_ctx_msg msg = 0; 1802 netxen_ctx_msg msg = 0;
1806 struct list_head *head; 1803 struct list_head *head;
1807 1804
1808 spin_lock(&rds_ring->lock);
1809
1810 producer = rds_ring->producer; 1805 producer = rds_ring->producer;
1811 1806
1812 head = &rds_ring->free_list; 1807 head = &rds_ring->free_list;
@@ -1853,8 +1848,6 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid,
1853 NETXEN_RCV_PRODUCER_OFFSET), msg); 1848 NETXEN_RCV_PRODUCER_OFFSET), msg);
1854 } 1849 }
1855 } 1850 }
1856
1857 spin_unlock(&rds_ring->lock);
1858} 1851}
1859 1852
1860static void 1853static void
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index fd86e18604e6..73d314592230 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -2032,8 +2032,6 @@ struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev)
2032 struct netxen_adapter *adapter = netdev_priv(netdev); 2032 struct netxen_adapter *adapter = netdev_priv(netdev);
2033 struct net_device_stats *stats = &netdev->stats; 2033 struct net_device_stats *stats = &netdev->stats;
2034 2034
2035 memset(stats, 0, sizeof(*stats));
2036
2037 stats->rx_packets = adapter->stats.rx_pkts + adapter->stats.lro_pkts; 2035 stats->rx_packets = adapter->stats.rx_pkts + adapter->stats.lro_pkts;
2038 stats->tx_packets = adapter->stats.xmitfinished; 2036 stats->tx_packets = adapter->stats.xmitfinished;
2039 stats->rx_bytes = adapter->stats.rxbytes; 2037 stats->rx_bytes = adapter->stats.rxbytes;
@@ -2133,9 +2131,16 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget)
2133#ifdef CONFIG_NET_POLL_CONTROLLER 2131#ifdef CONFIG_NET_POLL_CONTROLLER
2134static void netxen_nic_poll_controller(struct net_device *netdev) 2132static void netxen_nic_poll_controller(struct net_device *netdev)
2135{ 2133{
2134 int ring;
2135 struct nx_host_sds_ring *sds_ring;
2136 struct netxen_adapter *adapter = netdev_priv(netdev); 2136 struct netxen_adapter *adapter = netdev_priv(netdev);
2137 struct netxen_recv_context *recv_ctx = &adapter->recv_ctx;
2138
2137 disable_irq(adapter->irq); 2139 disable_irq(adapter->irq);
2138 netxen_intr(adapter->irq, adapter); 2140 for (ring = 0; ring < adapter->max_sds_rings; ring++) {
2141 sds_ring = &recv_ctx->sds_rings[ring];
2142 netxen_intr(adapter->irq, sds_ring);
2143 }
2139 enable_irq(adapter->irq); 2144 enable_irq(adapter->irq);
2140} 2145}
2141#endif 2146#endif
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index bc695d53cdcc..fe6983af6918 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -7269,32 +7269,28 @@ static int niu_get_ethtool_tcam_all(struct niu *np,
7269 struct niu_parent *parent = np->parent; 7269 struct niu_parent *parent = np->parent;
7270 struct niu_tcam_entry *tp; 7270 struct niu_tcam_entry *tp;
7271 int i, idx, cnt; 7271 int i, idx, cnt;
7272 u16 n_entries;
7273 unsigned long flags; 7272 unsigned long flags;
7274 7273 int ret = 0;
7275 7274
7276 /* put the tcam size here */ 7275 /* put the tcam size here */
7277 nfc->data = tcam_get_size(np); 7276 nfc->data = tcam_get_size(np);
7278 7277
7279 niu_lock_parent(np, flags); 7278 niu_lock_parent(np, flags);
7280 n_entries = nfc->rule_cnt;
7281 for (cnt = 0, i = 0; i < nfc->data; i++) { 7279 for (cnt = 0, i = 0; i < nfc->data; i++) {
7282 idx = tcam_get_index(np, i); 7280 idx = tcam_get_index(np, i);
7283 tp = &parent->tcam[idx]; 7281 tp = &parent->tcam[idx];
7284 if (!tp->valid) 7282 if (!tp->valid)
7285 continue; 7283 continue;
7284 if (cnt == nfc->rule_cnt) {
7285 ret = -EMSGSIZE;
7286 break;
7287 }
7286 rule_locs[cnt] = i; 7288 rule_locs[cnt] = i;
7287 cnt++; 7289 cnt++;
7288 } 7290 }
7289 niu_unlock_parent(np, flags); 7291 niu_unlock_parent(np, flags);
7290 7292
7291 if (n_entries != cnt) { 7293 return ret;
7292 /* print warning, this should not happen */
7293 netdev_info(np->dev, "niu%d: In %s(): n_entries[%d] != cnt[%d]!!!\n",
7294 np->parent->index, __func__, n_entries, cnt);
7295 }
7296
7297 return 0;
7298} 7294}
7299 7295
7300static int niu_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd, 7296static int niu_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index c3edfe4c2651..f9b509a6b09a 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -508,7 +508,8 @@ static int pcnet_confcheck(struct pcmcia_device *p_dev,
508 unsigned int vcc, 508 unsigned int vcc,
509 void *priv_data) 509 void *priv_data)
510{ 510{
511 int *has_shmem = priv_data; 511 int *priv = priv_data;
512 int try = (*priv & 0x1);
512 int i; 513 int i;
513 cistpl_io_t *io = &cfg->io; 514 cistpl_io_t *io = &cfg->io;
514 515
@@ -525,77 +526,103 @@ static int pcnet_confcheck(struct pcmcia_device *p_dev,
525 i = p_dev->resource[1]->end = 0; 526 i = p_dev->resource[1]->end = 0;
526 } 527 }
527 528
528 *has_shmem = ((cfg->mem.nwin == 1) && 529 *priv &= ((cfg->mem.nwin == 1) &&
529 (cfg->mem.win[0].len >= 0x4000)); 530 (cfg->mem.win[0].len >= 0x4000)) ? 0x10 : ~0x10;
531
530 p_dev->resource[0]->start = io->win[i].base; 532 p_dev->resource[0]->start = io->win[i].base;
531 p_dev->resource[0]->end = io->win[i].len; 533 p_dev->resource[0]->end = io->win[i].len;
532 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 534 if (!try)
535 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
536 else
537 p_dev->io_lines = 16;
533 if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32) 538 if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32)
534 return try_io_port(p_dev); 539 return try_io_port(p_dev);
535 540
536 return 0; 541 return -EINVAL;
542}
543
544static hw_info_t *pcnet_try_config(struct pcmcia_device *link,
545 int *has_shmem, int try)
546{
547 struct net_device *dev = link->priv;
548 hw_info_t *local_hw_info;
549 pcnet_dev_t *info = PRIV(dev);
550 int priv = try;
551 int ret;
552
553 ret = pcmcia_loop_config(link, pcnet_confcheck, &priv);
554 if (ret) {
555 dev_warn(&link->dev, "no useable port range found\n");
556 return NULL;
557 }
558 *has_shmem = (priv & 0x10);
559
560 if (!link->irq)
561 return NULL;
562
563 if (resource_size(link->resource[1]) == 8) {
564 link->conf.Attributes |= CONF_ENABLE_SPKR;
565 link->conf.Status = CCSR_AUDIO_ENA;
566 }
567 if ((link->manf_id == MANFID_IBM) &&
568 (link->card_id == PRODID_IBM_HOME_AND_AWAY))
569 link->conf.ConfigIndex |= 0x10;
570
571 ret = pcmcia_request_configuration(link, &link->conf);
572 if (ret)
573 return NULL;
574
575 dev->irq = link->irq;
576 dev->base_addr = link->resource[0]->start;
577
578 if (info->flags & HAS_MISC_REG) {
579 if ((if_port == 1) || (if_port == 2))
580 dev->if_port = if_port;
581 else
582 dev_notice(&link->dev, "invalid if_port requested\n");
583 } else
584 dev->if_port = 0;
585
586 if ((link->conf.ConfigBase == 0x03c0) &&
587 (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) {
588 dev_info(&link->dev,
589 "this is an AX88190 card - use axnet_cs instead.\n");
590 return NULL;
591 }
592
593 local_hw_info = get_hwinfo(link);
594 if (!local_hw_info)
595 local_hw_info = get_prom(link);
596 if (!local_hw_info)
597 local_hw_info = get_dl10019(link);
598 if (!local_hw_info)
599 local_hw_info = get_ax88190(link);
600 if (!local_hw_info)
601 local_hw_info = get_hwired(link);
602
603 return local_hw_info;
537} 604}
538 605
539static int pcnet_config(struct pcmcia_device *link) 606static int pcnet_config(struct pcmcia_device *link)
540{ 607{
541 struct net_device *dev = link->priv; 608 struct net_device *dev = link->priv;
542 pcnet_dev_t *info = PRIV(dev); 609 pcnet_dev_t *info = PRIV(dev);
543 int ret, start_pg, stop_pg, cm_offset; 610 int start_pg, stop_pg, cm_offset;
544 int has_shmem = 0; 611 int has_shmem = 0;
545 hw_info_t *local_hw_info; 612 hw_info_t *local_hw_info;
546 613
547 dev_dbg(&link->dev, "pcnet_config\n"); 614 dev_dbg(&link->dev, "pcnet_config\n");
548 615
549 ret = pcmcia_loop_config(link, pcnet_confcheck, &has_shmem); 616 local_hw_info = pcnet_try_config(link, &has_shmem, 0);
550 if (ret) 617 if (!local_hw_info) {
551 goto failed; 618 /* check whether forcing io_lines to 16 helps... */
552 619 pcmcia_disable_device(link);
553 if (!link->irq) 620 local_hw_info = pcnet_try_config(link, &has_shmem, 1);
554 goto failed; 621 if (local_hw_info == NULL) {
555 622 dev_notice(&link->dev, "unable to read hardware net"
556 if (resource_size(link->resource[1]) == 8) { 623 " address for io base %#3lx\n", dev->base_addr);
557 link->conf.Attributes |= CONF_ENABLE_SPKR; 624 goto failed;
558 link->conf.Status = CCSR_AUDIO_ENA; 625 }
559 }
560 if ((link->manf_id == MANFID_IBM) &&
561 (link->card_id == PRODID_IBM_HOME_AND_AWAY))
562 link->conf.ConfigIndex |= 0x10;
563
564 ret = pcmcia_request_configuration(link, &link->conf);
565 if (ret)
566 goto failed;
567 dev->irq = link->irq;
568 dev->base_addr = link->resource[0]->start;
569 if (info->flags & HAS_MISC_REG) {
570 if ((if_port == 1) || (if_port == 2))
571 dev->if_port = if_port;
572 else
573 printk(KERN_NOTICE "pcnet_cs: invalid if_port requested\n");
574 } else {
575 dev->if_port = 0;
576 }
577
578 if ((link->conf.ConfigBase == 0x03c0) &&
579 (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) {
580 printk(KERN_INFO "pcnet_cs: this is an AX88190 card!\n");
581 printk(KERN_INFO "pcnet_cs: use axnet_cs instead.\n");
582 goto failed;
583 }
584
585 local_hw_info = get_hwinfo(link);
586 if (local_hw_info == NULL)
587 local_hw_info = get_prom(link);
588 if (local_hw_info == NULL)
589 local_hw_info = get_dl10019(link);
590 if (local_hw_info == NULL)
591 local_hw_info = get_ax88190(link);
592 if (local_hw_info == NULL)
593 local_hw_info = get_hwired(link);
594
595 if (local_hw_info == NULL) {
596 printk(KERN_NOTICE "pcnet_cs: unable to read hardware net"
597 " address for io base %#3lx\n", dev->base_addr);
598 goto failed;
599 } 626 }
600 627
601 info->flags = local_hw_info->flags; 628 info->flags = local_hw_info->flags;
@@ -1637,6 +1664,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1637 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b), 1664 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b),
1638 PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0), 1665 PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0),
1639 PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956), 1666 PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956),
1667 PCMCIA_DEVICE_PROD_ID12("KENTRONICS", "KEP-230", 0xaf8144c9, 0x868f6616),
1640 PCMCIA_DEVICE_PROD_ID12("KCI", "PE520 PCMCIA Ethernet Adapter", 0xa89b87d3, 0x1eb88e64), 1668 PCMCIA_DEVICE_PROD_ID12("KCI", "PE520 PCMCIA Ethernet Adapter", 0xa89b87d3, 0x1eb88e64),
1641 PCMCIA_DEVICE_PROD_ID12("KINGMAX", "EN10T2T", 0x7bcb459a, 0xa5c81fa5), 1669 PCMCIA_DEVICE_PROD_ID12("KINGMAX", "EN10T2T", 0x7bcb459a, 0xa5c81fa5),
1642 PCMCIA_DEVICE_PROD_ID12("Kingston", "KNE-PC2", 0x1128e633, 0xce2a89b3), 1670 PCMCIA_DEVICE_PROD_ID12("Kingston", "KNE-PC2", 0x1128e633, 0xce2a89b3),
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 6a6b8199a0d6..6c58da2b882c 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -308,7 +308,7 @@ static int mdio_bus_suspend(struct device *dev)
308 * may call phy routines that try to grab the same lock, and that may 308 * may call phy routines that try to grab the same lock, and that may
309 * lead to a deadlock. 309 * lead to a deadlock.
310 */ 310 */
311 if (phydev->attached_dev) 311 if (phydev->attached_dev && phydev->adjust_link)
312 phy_stop_machine(phydev); 312 phy_stop_machine(phydev);
313 313
314 if (!mdio_bus_phy_may_suspend(phydev)) 314 if (!mdio_bus_phy_may_suspend(phydev))
@@ -331,7 +331,7 @@ static int mdio_bus_resume(struct device *dev)
331 return ret; 331 return ret;
332 332
333no_resume: 333no_resume:
334 if (phydev->attached_dev) 334 if (phydev->attached_dev && phydev->adjust_link)
335 phy_start_machine(phydev, NULL); 335 phy_start_machine(phydev, NULL);
336 336
337 return 0; 337 return 0;
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index c0761197c07e..16ddc77313cb 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -466,6 +466,8 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
466 466
467 phydev->interface = interface; 467 phydev->interface = interface;
468 468
469 phydev->state = PHY_READY;
470
469 /* Do initial configuration here, now that 471 /* Do initial configuration here, now that
470 * we have certain key parameters 472 * we have certain key parameters
471 * (dev_flags and interface) */ 473 * (dev_flags and interface) */
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 6695a51e09e9..736b91703b3e 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -1314,8 +1314,13 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
1314 hdrlen = (ppp->flags & SC_MP_XSHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN; 1314 hdrlen = (ppp->flags & SC_MP_XSHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN;
1315 i = 0; 1315 i = 0;
1316 list_for_each_entry(pch, &ppp->channels, clist) { 1316 list_for_each_entry(pch, &ppp->channels, clist) {
1317 navail += pch->avail = (pch->chan != NULL); 1317 if (pch->chan) {
1318 pch->speed = pch->chan->speed; 1318 pch->avail = 1;
1319 navail++;
1320 pch->speed = pch->chan->speed;
1321 } else {
1322 pch->avail = 0;
1323 }
1319 if (pch->avail) { 1324 if (pch->avail) {
1320 if (skb_queue_empty(&pch->file.xq) || 1325 if (skb_queue_empty(&pch->file.xq) ||
1321 !pch->had_frag) { 1326 !pch->had_frag) {
diff --git a/drivers/net/pxa168_eth.c b/drivers/net/pxa168_eth.c
new file mode 100644
index 000000000000..85eddda276bd
--- /dev/null
+++ b/drivers/net/pxa168_eth.c
@@ -0,0 +1,1666 @@
1/*
2 * PXA168 ethernet driver.
3 * Most of the code is derived from mv643xx ethernet driver.
4 *
5 * Copyright (C) 2010 Marvell International Ltd.
6 * Sachin Sanap <ssanap@marvell.com>
7 * Philip Rakity <prakity@marvell.com>
8 * Mark Brown <markb@marvell.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 */
24
25#include <linux/init.h>
26#include <linux/dma-mapping.h>
27#include <linux/in.h>
28#include <linux/ip.h>
29#include <linux/tcp.h>
30#include <linux/udp.h>
31#include <linux/etherdevice.h>
32#include <linux/bitops.h>
33#include <linux/delay.h>
34#include <linux/ethtool.h>
35#include <linux/platform_device.h>
36#include <linux/module.h>
37#include <linux/kernel.h>
38#include <linux/workqueue.h>
39#include <linux/clk.h>
40#include <linux/phy.h>
41#include <linux/io.h>
42#include <linux/types.h>
43#include <asm/pgtable.h>
44#include <asm/system.h>
45#include <linux/delay.h>
46#include <linux/dma-mapping.h>
47#include <asm/cacheflush.h>
48#include <linux/pxa168_eth.h>
49
50#define DRIVER_NAME "pxa168-eth"
51#define DRIVER_VERSION "0.3"
52
53/*
54 * Registers
55 */
56
57#define PHY_ADDRESS 0x0000
58#define SMI 0x0010
59#define PORT_CONFIG 0x0400
60#define PORT_CONFIG_EXT 0x0408
61#define PORT_COMMAND 0x0410
62#define PORT_STATUS 0x0418
63#define HTPR 0x0428
64#define SDMA_CONFIG 0x0440
65#define SDMA_CMD 0x0448
66#define INT_CAUSE 0x0450
67#define INT_W_CLEAR 0x0454
68#define INT_MASK 0x0458
69#define ETH_F_RX_DESC_0 0x0480
70#define ETH_C_RX_DESC_0 0x04A0
71#define ETH_C_TX_DESC_1 0x04E4
72
73/* smi register */
74#define SMI_BUSY (1 << 28) /* 0 - Write, 1 - Read */
75#define SMI_R_VALID (1 << 27) /* 0 - Write, 1 - Read */
76#define SMI_OP_W (0 << 26) /* Write operation */
77#define SMI_OP_R (1 << 26) /* Read operation */
78
79#define PHY_WAIT_ITERATIONS 10
80
81#define PXA168_ETH_PHY_ADDR_DEFAULT 0
82/* RX & TX descriptor command */
83#define BUF_OWNED_BY_DMA (1 << 31)
84
85/* RX descriptor status */
86#define RX_EN_INT (1 << 23)
87#define RX_FIRST_DESC (1 << 17)
88#define RX_LAST_DESC (1 << 16)
89#define RX_ERROR (1 << 15)
90
91/* TX descriptor command */
92#define TX_EN_INT (1 << 23)
93#define TX_GEN_CRC (1 << 22)
94#define TX_ZERO_PADDING (1 << 18)
95#define TX_FIRST_DESC (1 << 17)
96#define TX_LAST_DESC (1 << 16)
97#define TX_ERROR (1 << 15)
98
99/* SDMA_CMD */
100#define SDMA_CMD_AT (1 << 31)
101#define SDMA_CMD_TXDL (1 << 24)
102#define SDMA_CMD_TXDH (1 << 23)
103#define SDMA_CMD_AR (1 << 15)
104#define SDMA_CMD_ERD (1 << 7)
105
106/* Bit definitions of the Port Config Reg */
107#define PCR_HS (1 << 12)
108#define PCR_EN (1 << 7)
109#define PCR_PM (1 << 0)
110
111/* Bit definitions of the Port Config Extend Reg */
112#define PCXR_2BSM (1 << 28)
113#define PCXR_DSCP_EN (1 << 21)
114#define PCXR_MFL_1518 (0 << 14)
115#define PCXR_MFL_1536 (1 << 14)
116#define PCXR_MFL_2048 (2 << 14)
117#define PCXR_MFL_64K (3 << 14)
118#define PCXR_FLP (1 << 11)
119#define PCXR_PRIO_TX_OFF 3
120#define PCXR_TX_HIGH_PRI (7 << PCXR_PRIO_TX_OFF)
121
122/* Bit definitions of the SDMA Config Reg */
123#define SDCR_BSZ_OFF 12
124#define SDCR_BSZ8 (3 << SDCR_BSZ_OFF)
125#define SDCR_BSZ4 (2 << SDCR_BSZ_OFF)
126#define SDCR_BSZ2 (1 << SDCR_BSZ_OFF)
127#define SDCR_BSZ1 (0 << SDCR_BSZ_OFF)
128#define SDCR_BLMR (1 << 6)
129#define SDCR_BLMT (1 << 7)
130#define SDCR_RIFB (1 << 9)
131#define SDCR_RC_OFF 2
132#define SDCR_RC_MAX_RETRANS (0xf << SDCR_RC_OFF)
133
134/*
135 * Bit definitions of the Interrupt Cause Reg
136 * and Interrupt MASK Reg is the same
137 */
138#define ICR_RXBUF (1 << 0)
139#define ICR_TXBUF_H (1 << 2)
140#define ICR_TXBUF_L (1 << 3)
141#define ICR_TXEND_H (1 << 6)
142#define ICR_TXEND_L (1 << 7)
143#define ICR_RXERR (1 << 8)
144#define ICR_TXERR_H (1 << 10)
145#define ICR_TXERR_L (1 << 11)
146#define ICR_TX_UDR (1 << 13)
147#define ICR_MII_CH (1 << 28)
148
149#define ALL_INTS (ICR_TXBUF_H | ICR_TXBUF_L | ICR_TX_UDR |\
150 ICR_TXERR_H | ICR_TXERR_L |\
151 ICR_TXEND_H | ICR_TXEND_L |\
152 ICR_RXBUF | ICR_RXERR | ICR_MII_CH)
153
154#define ETH_HW_IP_ALIGN 2 /* hw aligns IP header */
155
156#define NUM_RX_DESCS 64
157#define NUM_TX_DESCS 64
158
159#define HASH_ADD 0
160#define HASH_DELETE 1
161#define HASH_ADDR_TABLE_SIZE 0x4000 /* 16K (1/2K address - PCR_HS == 1) */
162#define HOP_NUMBER 12
163
164/* Bit definitions for Port status */
165#define PORT_SPEED_100 (1 << 0)
166#define FULL_DUPLEX (1 << 1)
167#define FLOW_CONTROL_ENABLED (1 << 2)
168#define LINK_UP (1 << 3)
169
170/* Bit definitions for work to be done */
171#define WORK_LINK (1 << 0)
172#define WORK_TX_DONE (1 << 1)
173
174/*
175 * Misc definitions.
176 */
177#define SKB_DMA_REALIGN ((PAGE_SIZE - NET_SKB_PAD) % SMP_CACHE_BYTES)
178
179struct rx_desc {
180 u32 cmd_sts; /* Descriptor command status */
181 u16 byte_cnt; /* Descriptor buffer byte count */
182 u16 buf_size; /* Buffer size */
183 u32 buf_ptr; /* Descriptor buffer pointer */
184 u32 next_desc_ptr; /* Next descriptor pointer */
185};
186
187struct tx_desc {
188 u32 cmd_sts; /* Command/status field */
189 u16 reserved;
190 u16 byte_cnt; /* buffer byte count */
191 u32 buf_ptr; /* pointer to buffer for this descriptor */
192 u32 next_desc_ptr; /* Pointer to next descriptor */
193};
194
195struct pxa168_eth_private {
196 int port_num; /* User Ethernet port number */
197
198 int rx_resource_err; /* Rx ring resource error flag */
199
200 /* Next available and first returning Rx resource */
201 int rx_curr_desc_q, rx_used_desc_q;
202
203 /* Next available and first returning Tx resource */
204 int tx_curr_desc_q, tx_used_desc_q;
205
206 struct rx_desc *p_rx_desc_area;
207 dma_addr_t rx_desc_dma;
208 int rx_desc_area_size;
209 struct sk_buff **rx_skb;
210
211 struct tx_desc *p_tx_desc_area;
212 dma_addr_t tx_desc_dma;
213 int tx_desc_area_size;
214 struct sk_buff **tx_skb;
215
216 struct work_struct tx_timeout_task;
217
218 struct net_device *dev;
219 struct napi_struct napi;
220 u8 work_todo;
221 int skb_size;
222
223 struct net_device_stats stats;
224 /* Size of Tx Ring per queue */
225 int tx_ring_size;
226 /* Number of tx descriptors in use */
227 int tx_desc_count;
228 /* Size of Rx Ring per queue */
229 int rx_ring_size;
230 /* Number of rx descriptors in use */
231 int rx_desc_count;
232
233 /*
234 * Used in case RX Ring is empty, which can occur when
235 * system does not have resources (skb's)
236 */
237 struct timer_list timeout;
238 struct mii_bus *smi_bus;
239 struct phy_device *phy;
240
241 /* clock */
242 struct clk *clk;
243 struct pxa168_eth_platform_data *pd;
244 /*
245 * Ethernet controller base address.
246 */
247 void __iomem *base;
248
249 /* Pointer to the hardware address filter table */
250 void *htpr;
251 dma_addr_t htpr_dma;
252};
253
254struct addr_table_entry {
255 __le32 lo;
256 __le32 hi;
257};
258
259/* Bit fields of a Hash Table Entry */
260enum hash_table_entry {
261 HASH_ENTRY_VALID = 1,
262 SKIP = 2,
263 HASH_ENTRY_RECEIVE_DISCARD = 4,
264 HASH_ENTRY_RECEIVE_DISCARD_BIT = 2
265};
266
267static int pxa168_get_settings(struct net_device *dev, struct ethtool_cmd *cmd);
268static int pxa168_set_settings(struct net_device *dev, struct ethtool_cmd *cmd);
269static int pxa168_init_hw(struct pxa168_eth_private *pep);
270static void eth_port_reset(struct net_device *dev);
271static void eth_port_start(struct net_device *dev);
272static int pxa168_eth_open(struct net_device *dev);
273static int pxa168_eth_stop(struct net_device *dev);
274static int ethernet_phy_setup(struct net_device *dev);
275
276static inline u32 rdl(struct pxa168_eth_private *pep, int offset)
277{
278 return readl(pep->base + offset);
279}
280
281static inline void wrl(struct pxa168_eth_private *pep, int offset, u32 data)
282{
283 writel(data, pep->base + offset);
284}
285
286static void abort_dma(struct pxa168_eth_private *pep)
287{
288 int delay;
289 int max_retries = 40;
290
291 do {
292 wrl(pep, SDMA_CMD, SDMA_CMD_AR | SDMA_CMD_AT);
293 udelay(100);
294
295 delay = 10;
296 while ((rdl(pep, SDMA_CMD) & (SDMA_CMD_AR | SDMA_CMD_AT))
297 && delay-- > 0) {
298 udelay(10);
299 }
300 } while (max_retries-- > 0 && delay <= 0);
301
302 if (max_retries <= 0)
303 printk(KERN_ERR "%s : DMA Stuck\n", __func__);
304}
305
306static int ethernet_phy_get(struct pxa168_eth_private *pep)
307{
308 unsigned int reg_data;
309
310 reg_data = rdl(pep, PHY_ADDRESS);
311
312 return (reg_data >> (5 * pep->port_num)) & 0x1f;
313}
314
315static void ethernet_phy_set_addr(struct pxa168_eth_private *pep, int phy_addr)
316{
317 u32 reg_data;
318 int addr_shift = 5 * pep->port_num;
319
320 reg_data = rdl(pep, PHY_ADDRESS);
321 reg_data &= ~(0x1f << addr_shift);
322 reg_data |= (phy_addr & 0x1f) << addr_shift;
323 wrl(pep, PHY_ADDRESS, reg_data);
324}
325
326static void ethernet_phy_reset(struct pxa168_eth_private *pep)
327{
328 int data;
329
330 data = phy_read(pep->phy, MII_BMCR);
331 if (data < 0)
332 return;
333
334 data |= BMCR_RESET;
335 if (phy_write(pep->phy, MII_BMCR, data) < 0)
336 return;
337
338 do {
339 data = phy_read(pep->phy, MII_BMCR);
340 } while (data >= 0 && data & BMCR_RESET);
341}
342
343static void rxq_refill(struct net_device *dev)
344{
345 struct pxa168_eth_private *pep = netdev_priv(dev);
346 struct sk_buff *skb;
347 struct rx_desc *p_used_rx_desc;
348 int used_rx_desc;
349
350 while (pep->rx_desc_count < pep->rx_ring_size) {
351 int size;
352
353 skb = dev_alloc_skb(pep->skb_size);
354 if (!skb)
355 break;
356 if (SKB_DMA_REALIGN)
357 skb_reserve(skb, SKB_DMA_REALIGN);
358 pep->rx_desc_count++;
359 /* Get 'used' Rx descriptor */
360 used_rx_desc = pep->rx_used_desc_q;
361 p_used_rx_desc = &pep->p_rx_desc_area[used_rx_desc];
362 size = skb->end - skb->data;
363 p_used_rx_desc->buf_ptr = dma_map_single(NULL,
364 skb->data,
365 size,
366 DMA_FROM_DEVICE);
367 p_used_rx_desc->buf_size = size;
368 pep->rx_skb[used_rx_desc] = skb;
369
370 /* Return the descriptor to DMA ownership */
371 wmb();
372 p_used_rx_desc->cmd_sts = BUF_OWNED_BY_DMA | RX_EN_INT;
373 wmb();
374
375 /* Move the used descriptor pointer to the next descriptor */
376 pep->rx_used_desc_q = (used_rx_desc + 1) % pep->rx_ring_size;
377
378 /* Any Rx return cancels the Rx resource error status */
379 pep->rx_resource_err = 0;
380
381 skb_reserve(skb, ETH_HW_IP_ALIGN);
382 }
383
384 /*
385 * If RX ring is empty of SKB, set a timer to try allocating
386 * again at a later time.
387 */
388 if (pep->rx_desc_count == 0) {
389 pep->timeout.expires = jiffies + (HZ / 10);
390 add_timer(&pep->timeout);
391 }
392}
393
394static inline void rxq_refill_timer_wrapper(unsigned long data)
395{
396 struct pxa168_eth_private *pep = (void *)data;
397 napi_schedule(&pep->napi);
398}
399
400static inline u8 flip_8_bits(u8 x)
401{
402 return (((x) & 0x01) << 3) | (((x) & 0x02) << 1)
403 | (((x) & 0x04) >> 1) | (((x) & 0x08) >> 3)
404 | (((x) & 0x10) << 3) | (((x) & 0x20) << 1)
405 | (((x) & 0x40) >> 1) | (((x) & 0x80) >> 3);
406}
407
408static void nibble_swap_every_byte(unsigned char *mac_addr)
409{
410 int i;
411 for (i = 0; i < ETH_ALEN; i++) {
412 mac_addr[i] = ((mac_addr[i] & 0x0f) << 4) |
413 ((mac_addr[i] & 0xf0) >> 4);
414 }
415}
416
417static void inverse_every_nibble(unsigned char *mac_addr)
418{
419 int i;
420 for (i = 0; i < ETH_ALEN; i++)
421 mac_addr[i] = flip_8_bits(mac_addr[i]);
422}
423
424/*
425 * ----------------------------------------------------------------------------
426 * This function will calculate the hash function of the address.
427 * Inputs
428 * mac_addr_orig - MAC address.
429 * Outputs
430 * return the calculated entry.
431 */
432static u32 hash_function(unsigned char *mac_addr_orig)
433{
434 u32 hash_result;
435 u32 addr0;
436 u32 addr1;
437 u32 addr2;
438 u32 addr3;
439 unsigned char mac_addr[ETH_ALEN];
440
441 /* Make a copy of MAC address since we are going to performe bit
442 * operations on it
443 */
444 memcpy(mac_addr, mac_addr_orig, ETH_ALEN);
445
446 nibble_swap_every_byte(mac_addr);
447 inverse_every_nibble(mac_addr);
448
449 addr0 = (mac_addr[5] >> 2) & 0x3f;
450 addr1 = (mac_addr[5] & 0x03) | (((mac_addr[4] & 0x7f)) << 2);
451 addr2 = ((mac_addr[4] & 0x80) >> 7) | mac_addr[3] << 1;
452 addr3 = (mac_addr[2] & 0xff) | ((mac_addr[1] & 1) << 8);
453
454 hash_result = (addr0 << 9) | (addr1 ^ addr2 ^ addr3);
455 hash_result = hash_result & 0x07ff;
456 return hash_result;
457}
458
459/*
460 * ----------------------------------------------------------------------------
461 * This function will add/del an entry to the address table.
462 * Inputs
463 * pep - ETHERNET .
464 * mac_addr - MAC address.
465 * skip - if 1, skip this address.Used in case of deleting an entry which is a
466 * part of chain in the hash table.We cant just delete the entry since
467 * that will break the chain.We need to defragment the tables time to
468 * time.
469 * rd - 0 Discard packet upon match.
470 * - 1 Receive packet upon match.
471 * Outputs
472 * address table entry is added/deleted.
473 * 0 if success.
474 * -ENOSPC if table full
475 */
476static int add_del_hash_entry(struct pxa168_eth_private *pep,
477 unsigned char *mac_addr,
478 u32 rd, u32 skip, int del)
479{
480 struct addr_table_entry *entry, *start;
481 u32 new_high;
482 u32 new_low;
483 u32 i;
484
485 new_low = (((mac_addr[1] >> 4) & 0xf) << 15)
486 | (((mac_addr[1] >> 0) & 0xf) << 11)
487 | (((mac_addr[0] >> 4) & 0xf) << 7)
488 | (((mac_addr[0] >> 0) & 0xf) << 3)
489 | (((mac_addr[3] >> 4) & 0x1) << 31)
490 | (((mac_addr[3] >> 0) & 0xf) << 27)
491 | (((mac_addr[2] >> 4) & 0xf) << 23)
492 | (((mac_addr[2] >> 0) & 0xf) << 19)
493 | (skip << SKIP) | (rd << HASH_ENTRY_RECEIVE_DISCARD_BIT)
494 | HASH_ENTRY_VALID;
495
496 new_high = (((mac_addr[5] >> 4) & 0xf) << 15)
497 | (((mac_addr[5] >> 0) & 0xf) << 11)
498 | (((mac_addr[4] >> 4) & 0xf) << 7)
499 | (((mac_addr[4] >> 0) & 0xf) << 3)
500 | (((mac_addr[3] >> 5) & 0x7) << 0);
501
502 /*
503 * Pick the appropriate table, start scanning for free/reusable
504 * entries at the index obtained by hashing the specified MAC address
505 */
506 start = (struct addr_table_entry *)(pep->htpr);
507 entry = start + hash_function(mac_addr);
508 for (i = 0; i < HOP_NUMBER; i++) {
509 if (!(le32_to_cpu(entry->lo) & HASH_ENTRY_VALID)) {
510 break;
511 } else {
512 /* if same address put in same position */
513 if (((le32_to_cpu(entry->lo) & 0xfffffff8) ==
514 (new_low & 0xfffffff8)) &&
515 (le32_to_cpu(entry->hi) == new_high)) {
516 break;
517 }
518 }
519 if (entry == start + 0x7ff)
520 entry = start;
521 else
522 entry++;
523 }
524
525 if (((le32_to_cpu(entry->lo) & 0xfffffff8) != (new_low & 0xfffffff8)) &&
526 (le32_to_cpu(entry->hi) != new_high) && del)
527 return 0;
528
529 if (i == HOP_NUMBER) {
530 if (!del) {
531 printk(KERN_INFO "%s: table section is full, need to "
532 "move to 16kB implementation?\n",
533 __FILE__);
534 return -ENOSPC;
535 } else
536 return 0;
537 }
538
539 /*
540 * Update the selected entry
541 */
542 if (del) {
543 entry->hi = 0;
544 entry->lo = 0;
545 } else {
546 entry->hi = cpu_to_le32(new_high);
547 entry->lo = cpu_to_le32(new_low);
548 }
549
550 return 0;
551}
552
553/*
554 * ----------------------------------------------------------------------------
555 * Create an addressTable entry from MAC address info
556 * found in the specifed net_device struct
557 *
558 * Input : pointer to ethernet interface network device structure
559 * Output : N/A
560 */
561static void update_hash_table_mac_address(struct pxa168_eth_private *pep,
562 unsigned char *oaddr,
563 unsigned char *addr)
564{
565 /* Delete old entry */
566 if (oaddr)
567 add_del_hash_entry(pep, oaddr, 1, 0, HASH_DELETE);
568 /* Add new entry */
569 add_del_hash_entry(pep, addr, 1, 0, HASH_ADD);
570}
571
572static int init_hash_table(struct pxa168_eth_private *pep)
573{
574 /*
575 * Hardware expects CPU to build a hash table based on a predefined
576 * hash function and populate it based on hardware address. The
577 * location of the hash table is identified by 32-bit pointer stored
578 * in HTPR internal register. Two possible sizes exists for the hash
579 * table 8kB (256kB of DRAM required (4 x 64 kB banks)) and 1/2kB
580 * (16kB of DRAM required (4 x 4 kB banks)).We currently only support
581 * 1/2kB.
582 */
583 /* TODO: Add support for 8kB hash table and alternative hash
584 * function.Driver can dynamically switch to them if the 1/2kB hash
585 * table is full.
586 */
587 if (pep->htpr == NULL) {
588 pep->htpr = dma_alloc_coherent(pep->dev->dev.parent,
589 HASH_ADDR_TABLE_SIZE,
590 &pep->htpr_dma, GFP_KERNEL);
591 if (pep->htpr == NULL)
592 return -ENOMEM;
593 }
594 memset(pep->htpr, 0, HASH_ADDR_TABLE_SIZE);
595 wrl(pep, HTPR, pep->htpr_dma);
596 return 0;
597}
598
599static void pxa168_eth_set_rx_mode(struct net_device *dev)
600{
601 struct pxa168_eth_private *pep = netdev_priv(dev);
602 struct netdev_hw_addr *ha;
603 u32 val;
604
605 val = rdl(pep, PORT_CONFIG);
606 if (dev->flags & IFF_PROMISC)
607 val |= PCR_PM;
608 else
609 val &= ~PCR_PM;
610 wrl(pep, PORT_CONFIG, val);
611
612 /*
613 * Remove the old list of MAC address and add dev->addr
614 * and multicast address.
615 */
616 memset(pep->htpr, 0, HASH_ADDR_TABLE_SIZE);
617 update_hash_table_mac_address(pep, NULL, dev->dev_addr);
618
619 netdev_for_each_mc_addr(ha, dev)
620 update_hash_table_mac_address(pep, NULL, ha->addr);
621}
622
623static int pxa168_eth_set_mac_address(struct net_device *dev, void *addr)
624{
625 struct sockaddr *sa = addr;
626 struct pxa168_eth_private *pep = netdev_priv(dev);
627 unsigned char oldMac[ETH_ALEN];
628
629 if (!is_valid_ether_addr(sa->sa_data))
630 return -EINVAL;
631 memcpy(oldMac, dev->dev_addr, ETH_ALEN);
632 memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN);
633 netif_addr_lock_bh(dev);
634 update_hash_table_mac_address(pep, oldMac, dev->dev_addr);
635 netif_addr_unlock_bh(dev);
636 return 0;
637}
638
639static void eth_port_start(struct net_device *dev)
640{
641 unsigned int val = 0;
642 struct pxa168_eth_private *pep = netdev_priv(dev);
643 int tx_curr_desc, rx_curr_desc;
644
645 /* Perform PHY reset, if there is a PHY. */
646 if (pep->phy != NULL) {
647 struct ethtool_cmd cmd;
648
649 pxa168_get_settings(pep->dev, &cmd);
650 ethernet_phy_reset(pep);
651 pxa168_set_settings(pep->dev, &cmd);
652 }
653
654 /* Assignment of Tx CTRP of given queue */
655 tx_curr_desc = pep->tx_curr_desc_q;
656 wrl(pep, ETH_C_TX_DESC_1,
657 (u32) (pep->tx_desc_dma + tx_curr_desc * sizeof(struct tx_desc)));
658
659 /* Assignment of Rx CRDP of given queue */
660 rx_curr_desc = pep->rx_curr_desc_q;
661 wrl(pep, ETH_C_RX_DESC_0,
662 (u32) (pep->rx_desc_dma + rx_curr_desc * sizeof(struct rx_desc)));
663
664 wrl(pep, ETH_F_RX_DESC_0,
665 (u32) (pep->rx_desc_dma + rx_curr_desc * sizeof(struct rx_desc)));
666
667 /* Clear all interrupts */
668 wrl(pep, INT_CAUSE, 0);
669
670 /* Enable all interrupts for receive, transmit and error. */
671 wrl(pep, INT_MASK, ALL_INTS);
672
673 val = rdl(pep, PORT_CONFIG);
674 val |= PCR_EN;
675 wrl(pep, PORT_CONFIG, val);
676
677 /* Start RX DMA engine */
678 val = rdl(pep, SDMA_CMD);
679 val |= SDMA_CMD_ERD;
680 wrl(pep, SDMA_CMD, val);
681}
682
683static void eth_port_reset(struct net_device *dev)
684{
685 struct pxa168_eth_private *pep = netdev_priv(dev);
686 unsigned int val = 0;
687
688 /* Stop all interrupts for receive, transmit and error. */
689 wrl(pep, INT_MASK, 0);
690
691 /* Clear all interrupts */
692 wrl(pep, INT_CAUSE, 0);
693
694 /* Stop RX DMA */
695 val = rdl(pep, SDMA_CMD);
696 val &= ~SDMA_CMD_ERD; /* abort dma command */
697
698 /* Abort any transmit and receive operations and put DMA
699 * in idle state.
700 */
701 abort_dma(pep);
702
703 /* Disable port */
704 val = rdl(pep, PORT_CONFIG);
705 val &= ~PCR_EN;
706 wrl(pep, PORT_CONFIG, val);
707}
708
709/*
710 * txq_reclaim - Free the tx desc data for completed descriptors
711 * If force is non-zero, frees uncompleted descriptors as well
712 */
713static int txq_reclaim(struct net_device *dev, int force)
714{
715 struct pxa168_eth_private *pep = netdev_priv(dev);
716 struct tx_desc *desc;
717 u32 cmd_sts;
718 struct sk_buff *skb;
719 int tx_index;
720 dma_addr_t addr;
721 int count;
722 int released = 0;
723
724 netif_tx_lock(dev);
725
726 pep->work_todo &= ~WORK_TX_DONE;
727 while (pep->tx_desc_count > 0) {
728 tx_index = pep->tx_used_desc_q;
729 desc = &pep->p_tx_desc_area[tx_index];
730 cmd_sts = desc->cmd_sts;
731 if (!force && (cmd_sts & BUF_OWNED_BY_DMA)) {
732 if (released > 0) {
733 goto txq_reclaim_end;
734 } else {
735 released = -1;
736 goto txq_reclaim_end;
737 }
738 }
739 pep->tx_used_desc_q = (tx_index + 1) % pep->tx_ring_size;
740 pep->tx_desc_count--;
741 addr = desc->buf_ptr;
742 count = desc->byte_cnt;
743 skb = pep->tx_skb[tx_index];
744 if (skb)
745 pep->tx_skb[tx_index] = NULL;
746
747 if (cmd_sts & TX_ERROR) {
748 if (net_ratelimit())
749 printk(KERN_ERR "%s: Error in TX\n", dev->name);
750 dev->stats.tx_errors++;
751 }
752 dma_unmap_single(NULL, addr, count, DMA_TO_DEVICE);
753 if (skb)
754 dev_kfree_skb_irq(skb);
755 released++;
756 }
757txq_reclaim_end:
758 netif_tx_unlock(dev);
759 return released;
760}
761
762static void pxa168_eth_tx_timeout(struct net_device *dev)
763{
764 struct pxa168_eth_private *pep = netdev_priv(dev);
765
766 printk(KERN_INFO "%s: TX timeout desc_count %d\n",
767 dev->name, pep->tx_desc_count);
768
769 schedule_work(&pep->tx_timeout_task);
770}
771
772static void pxa168_eth_tx_timeout_task(struct work_struct *work)
773{
774 struct pxa168_eth_private *pep = container_of(work,
775 struct pxa168_eth_private,
776 tx_timeout_task);
777 struct net_device *dev = pep->dev;
778 pxa168_eth_stop(dev);
779 pxa168_eth_open(dev);
780}
781
782static int rxq_process(struct net_device *dev, int budget)
783{
784 struct pxa168_eth_private *pep = netdev_priv(dev);
785 struct net_device_stats *stats = &dev->stats;
786 unsigned int received_packets = 0;
787 struct sk_buff *skb;
788
789 while (budget-- > 0) {
790 int rx_next_curr_desc, rx_curr_desc, rx_used_desc;
791 struct rx_desc *rx_desc;
792 unsigned int cmd_sts;
793
794 /* Do not process Rx ring in case of Rx ring resource error */
795 if (pep->rx_resource_err)
796 break;
797 rx_curr_desc = pep->rx_curr_desc_q;
798 rx_used_desc = pep->rx_used_desc_q;
799 rx_desc = &pep->p_rx_desc_area[rx_curr_desc];
800 cmd_sts = rx_desc->cmd_sts;
801 rmb();
802 if (cmd_sts & (BUF_OWNED_BY_DMA))
803 break;
804 skb = pep->rx_skb[rx_curr_desc];
805 pep->rx_skb[rx_curr_desc] = NULL;
806
807 rx_next_curr_desc = (rx_curr_desc + 1) % pep->rx_ring_size;
808 pep->rx_curr_desc_q = rx_next_curr_desc;
809
810 /* Rx descriptors exhausted. */
811 /* Set the Rx ring resource error flag */
812 if (rx_next_curr_desc == rx_used_desc)
813 pep->rx_resource_err = 1;
814 pep->rx_desc_count--;
815 dma_unmap_single(NULL, rx_desc->buf_ptr,
816 rx_desc->buf_size,
817 DMA_FROM_DEVICE);
818 received_packets++;
819 /*
820 * Update statistics.
821 * Note byte count includes 4 byte CRC count
822 */
823 stats->rx_packets++;
824 stats->rx_bytes += rx_desc->byte_cnt;
825 /*
826 * In case received a packet without first / last bits on OR
827 * the error summary bit is on, the packets needs to be droped.
828 */
829 if (((cmd_sts & (RX_FIRST_DESC | RX_LAST_DESC)) !=
830 (RX_FIRST_DESC | RX_LAST_DESC))
831 || (cmd_sts & RX_ERROR)) {
832
833 stats->rx_dropped++;
834 if ((cmd_sts & (RX_FIRST_DESC | RX_LAST_DESC)) !=
835 (RX_FIRST_DESC | RX_LAST_DESC)) {
836 if (net_ratelimit())
837 printk(KERN_ERR
838 "%s: Rx pkt on multiple desc\n",
839 dev->name);
840 }
841 if (cmd_sts & RX_ERROR)
842 stats->rx_errors++;
843 dev_kfree_skb_irq(skb);
844 } else {
845 /*
846 * The -4 is for the CRC in the trailer of the
847 * received packet
848 */
849 skb_put(skb, rx_desc->byte_cnt - 4);
850 skb->protocol = eth_type_trans(skb, dev);
851 netif_receive_skb(skb);
852 }
853 dev->last_rx = jiffies;
854 }
855 /* Fill RX ring with skb's */
856 rxq_refill(dev);
857 return received_packets;
858}
859
860static int pxa168_eth_collect_events(struct pxa168_eth_private *pep,
861 struct net_device *dev)
862{
863 u32 icr;
864 int ret = 0;
865
866 icr = rdl(pep, INT_CAUSE);
867 if (icr == 0)
868 return IRQ_NONE;
869
870 wrl(pep, INT_CAUSE, ~icr);
871 if (icr & (ICR_TXBUF_H | ICR_TXBUF_L)) {
872 pep->work_todo |= WORK_TX_DONE;
873 ret = 1;
874 }
875 if (icr & ICR_RXBUF)
876 ret = 1;
877 if (icr & ICR_MII_CH) {
878 pep->work_todo |= WORK_LINK;
879 ret = 1;
880 }
881 return ret;
882}
883
884static void handle_link_event(struct pxa168_eth_private *pep)
885{
886 struct net_device *dev = pep->dev;
887 u32 port_status;
888 int speed;
889 int duplex;
890 int fc;
891
892 port_status = rdl(pep, PORT_STATUS);
893 if (!(port_status & LINK_UP)) {
894 if (netif_carrier_ok(dev)) {
895 printk(KERN_INFO "%s: link down\n", dev->name);
896 netif_carrier_off(dev);
897 txq_reclaim(dev, 1);
898 }
899 return;
900 }
901 if (port_status & PORT_SPEED_100)
902 speed = 100;
903 else
904 speed = 10;
905
906 duplex = (port_status & FULL_DUPLEX) ? 1 : 0;
907 fc = (port_status & FLOW_CONTROL_ENABLED) ? 1 : 0;
908 printk(KERN_INFO "%s: link up, %d Mb/s, %s duplex, "
909 "flow control %sabled\n", dev->name,
910 speed, duplex ? "full" : "half", fc ? "en" : "dis");
911 if (!netif_carrier_ok(dev))
912 netif_carrier_on(dev);
913}
914
915static irqreturn_t pxa168_eth_int_handler(int irq, void *dev_id)
916{
917 struct net_device *dev = (struct net_device *)dev_id;
918 struct pxa168_eth_private *pep = netdev_priv(dev);
919
920 if (unlikely(!pxa168_eth_collect_events(pep, dev)))
921 return IRQ_NONE;
922 /* Disable interrupts */
923 wrl(pep, INT_MASK, 0);
924 napi_schedule(&pep->napi);
925 return IRQ_HANDLED;
926}
927
928static void pxa168_eth_recalc_skb_size(struct pxa168_eth_private *pep)
929{
930 int skb_size;
931
932 /*
933 * Reserve 2+14 bytes for an ethernet header (the hardware
934 * automatically prepends 2 bytes of dummy data to each
935 * received packet), 16 bytes for up to four VLAN tags, and
936 * 4 bytes for the trailing FCS -- 36 bytes total.
937 */
938 skb_size = pep->dev->mtu + 36;
939
940 /*
941 * Make sure that the skb size is a multiple of 8 bytes, as
942 * the lower three bits of the receive descriptor's buffer
943 * size field are ignored by the hardware.
944 */
945 pep->skb_size = (skb_size + 7) & ~7;
946
947 /*
948 * If NET_SKB_PAD is smaller than a cache line,
949 * netdev_alloc_skb() will cause skb->data to be misaligned
950 * to a cache line boundary. If this is the case, include
951 * some extra space to allow re-aligning the data area.
952 */
953 pep->skb_size += SKB_DMA_REALIGN;
954
955}
956
957static int set_port_config_ext(struct pxa168_eth_private *pep)
958{
959 int skb_size;
960
961 pxa168_eth_recalc_skb_size(pep);
962 if (pep->skb_size <= 1518)
963 skb_size = PCXR_MFL_1518;
964 else if (pep->skb_size <= 1536)
965 skb_size = PCXR_MFL_1536;
966 else if (pep->skb_size <= 2048)
967 skb_size = PCXR_MFL_2048;
968 else
969 skb_size = PCXR_MFL_64K;
970
971 /* Extended Port Configuration */
972 wrl(pep,
973 PORT_CONFIG_EXT, PCXR_2BSM | /* Two byte prefix aligns IP hdr */
974 PCXR_DSCP_EN | /* Enable DSCP in IP */
975 skb_size | PCXR_FLP | /* do not force link pass */
976 PCXR_TX_HIGH_PRI); /* Transmit - high priority queue */
977
978 return 0;
979}
980
981static int pxa168_init_hw(struct pxa168_eth_private *pep)
982{
983 int err = 0;
984
985 /* Disable interrupts */
986 wrl(pep, INT_MASK, 0);
987 wrl(pep, INT_CAUSE, 0);
988 /* Write to ICR to clear interrupts. */
989 wrl(pep, INT_W_CLEAR, 0);
990 /* Abort any transmit and receive operations and put DMA
991 * in idle state.
992 */
993 abort_dma(pep);
994 /* Initialize address hash table */
995 err = init_hash_table(pep);
996 if (err)
997 return err;
998 /* SDMA configuration */
999 wrl(pep, SDMA_CONFIG, SDCR_BSZ8 | /* Burst size = 32 bytes */
1000 SDCR_RIFB | /* Rx interrupt on frame */
1001 SDCR_BLMT | /* Little endian transmit */
1002 SDCR_BLMR | /* Little endian receive */
1003 SDCR_RC_MAX_RETRANS); /* Max retransmit count */
1004 /* Port Configuration */
1005 wrl(pep, PORT_CONFIG, PCR_HS); /* Hash size is 1/2kb */
1006 set_port_config_ext(pep);
1007
1008 return err;
1009}
1010
1011static int rxq_init(struct net_device *dev)
1012{
1013 struct pxa168_eth_private *pep = netdev_priv(dev);
1014 struct rx_desc *p_rx_desc;
1015 int size = 0, i = 0;
1016 int rx_desc_num = pep->rx_ring_size;
1017
1018 /* Allocate RX skb rings */
1019 pep->rx_skb = kmalloc(sizeof(*pep->rx_skb) * pep->rx_ring_size,
1020 GFP_KERNEL);
1021 if (!pep->rx_skb) {
1022 printk(KERN_ERR "%s: Cannot alloc RX skb ring\n", dev->name);
1023 return -ENOMEM;
1024 }
1025 /* Allocate RX ring */
1026 pep->rx_desc_count = 0;
1027 size = pep->rx_ring_size * sizeof(struct rx_desc);
1028 pep->rx_desc_area_size = size;
1029 pep->p_rx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size,
1030 &pep->rx_desc_dma, GFP_KERNEL);
1031 if (!pep->p_rx_desc_area) {
1032 printk(KERN_ERR "%s: Cannot alloc RX ring (size %d bytes)\n",
1033 dev->name, size);
1034 goto out;
1035 }
1036 memset((void *)pep->p_rx_desc_area, 0, size);
1037 /* initialize the next_desc_ptr links in the Rx descriptors ring */
1038 p_rx_desc = (struct rx_desc *)pep->p_rx_desc_area;
1039 for (i = 0; i < rx_desc_num; i++) {
1040 p_rx_desc[i].next_desc_ptr = pep->rx_desc_dma +
1041 ((i + 1) % rx_desc_num) * sizeof(struct rx_desc);
1042 }
1043 /* Save Rx desc pointer to driver struct. */
1044 pep->rx_curr_desc_q = 0;
1045 pep->rx_used_desc_q = 0;
1046 pep->rx_desc_area_size = rx_desc_num * sizeof(struct rx_desc);
1047 return 0;
1048out:
1049 kfree(pep->rx_skb);
1050 return -ENOMEM;
1051}
1052
1053static void rxq_deinit(struct net_device *dev)
1054{
1055 struct pxa168_eth_private *pep = netdev_priv(dev);
1056 int curr;
1057
1058 /* Free preallocated skb's on RX rings */
1059 for (curr = 0; pep->rx_desc_count && curr < pep->rx_ring_size; curr++) {
1060 if (pep->rx_skb[curr]) {
1061 dev_kfree_skb(pep->rx_skb[curr]);
1062 pep->rx_desc_count--;
1063 }
1064 }
1065 if (pep->rx_desc_count)
1066 printk(KERN_ERR
1067 "Error in freeing Rx Ring. %d skb's still\n",
1068 pep->rx_desc_count);
1069 /* Free RX ring */
1070 if (pep->p_rx_desc_area)
1071 dma_free_coherent(pep->dev->dev.parent, pep->rx_desc_area_size,
1072 pep->p_rx_desc_area, pep->rx_desc_dma);
1073 kfree(pep->rx_skb);
1074}
1075
1076static int txq_init(struct net_device *dev)
1077{
1078 struct pxa168_eth_private *pep = netdev_priv(dev);
1079 struct tx_desc *p_tx_desc;
1080 int size = 0, i = 0;
1081 int tx_desc_num = pep->tx_ring_size;
1082
1083 pep->tx_skb = kmalloc(sizeof(*pep->tx_skb) * pep->tx_ring_size,
1084 GFP_KERNEL);
1085 if (!pep->tx_skb) {
1086 printk(KERN_ERR "%s: Cannot alloc TX skb ring\n", dev->name);
1087 return -ENOMEM;
1088 }
1089 /* Allocate TX ring */
1090 pep->tx_desc_count = 0;
1091 size = pep->tx_ring_size * sizeof(struct tx_desc);
1092 pep->tx_desc_area_size = size;
1093 pep->p_tx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size,
1094 &pep->tx_desc_dma, GFP_KERNEL);
1095 if (!pep->p_tx_desc_area) {
1096 printk(KERN_ERR "%s: Cannot allocate Tx Ring (size %d bytes)\n",
1097 dev->name, size);
1098 goto out;
1099 }
1100 memset((void *)pep->p_tx_desc_area, 0, pep->tx_desc_area_size);
1101 /* Initialize the next_desc_ptr links in the Tx descriptors ring */
1102 p_tx_desc = (struct tx_desc *)pep->p_tx_desc_area;
1103 for (i = 0; i < tx_desc_num; i++) {
1104 p_tx_desc[i].next_desc_ptr = pep->tx_desc_dma +
1105 ((i + 1) % tx_desc_num) * sizeof(struct tx_desc);
1106 }
1107 pep->tx_curr_desc_q = 0;
1108 pep->tx_used_desc_q = 0;
1109 pep->tx_desc_area_size = tx_desc_num * sizeof(struct tx_desc);
1110 return 0;
1111out:
1112 kfree(pep->tx_skb);
1113 return -ENOMEM;
1114}
1115
1116static void txq_deinit(struct net_device *dev)
1117{
1118 struct pxa168_eth_private *pep = netdev_priv(dev);
1119
1120 /* Free outstanding skb's on TX ring */
1121 txq_reclaim(dev, 1);
1122 BUG_ON(pep->tx_used_desc_q != pep->tx_curr_desc_q);
1123 /* Free TX ring */
1124 if (pep->p_tx_desc_area)
1125 dma_free_coherent(pep->dev->dev.parent, pep->tx_desc_area_size,
1126 pep->p_tx_desc_area, pep->tx_desc_dma);
1127 kfree(pep->tx_skb);
1128}
1129
1130static int pxa168_eth_open(struct net_device *dev)
1131{
1132 struct pxa168_eth_private *pep = netdev_priv(dev);
1133 int err;
1134
1135 err = request_irq(dev->irq, pxa168_eth_int_handler,
1136 IRQF_DISABLED, dev->name, dev);
1137 if (err) {
1138 dev_printk(KERN_ERR, &dev->dev, "can't assign irq\n");
1139 return -EAGAIN;
1140 }
1141 pep->rx_resource_err = 0;
1142 err = rxq_init(dev);
1143 if (err != 0)
1144 goto out_free_irq;
1145 err = txq_init(dev);
1146 if (err != 0)
1147 goto out_free_rx_skb;
1148 pep->rx_used_desc_q = 0;
1149 pep->rx_curr_desc_q = 0;
1150
1151 /* Fill RX ring with skb's */
1152 rxq_refill(dev);
1153 pep->rx_used_desc_q = 0;
1154 pep->rx_curr_desc_q = 0;
1155 netif_carrier_off(dev);
1156 eth_port_start(dev);
1157 napi_enable(&pep->napi);
1158 return 0;
1159out_free_rx_skb:
1160 rxq_deinit(dev);
1161out_free_irq:
1162 free_irq(dev->irq, dev);
1163 return err;
1164}
1165
1166static int pxa168_eth_stop(struct net_device *dev)
1167{
1168 struct pxa168_eth_private *pep = netdev_priv(dev);
1169 eth_port_reset(dev);
1170
1171 /* Disable interrupts */
1172 wrl(pep, INT_MASK, 0);
1173 wrl(pep, INT_CAUSE, 0);
1174 /* Write to ICR to clear interrupts. */
1175 wrl(pep, INT_W_CLEAR, 0);
1176 napi_disable(&pep->napi);
1177 del_timer_sync(&pep->timeout);
1178 netif_carrier_off(dev);
1179 free_irq(dev->irq, dev);
1180 rxq_deinit(dev);
1181 txq_deinit(dev);
1182
1183 return 0;
1184}
1185
1186static int pxa168_eth_change_mtu(struct net_device *dev, int mtu)
1187{
1188 int retval;
1189 struct pxa168_eth_private *pep = netdev_priv(dev);
1190
1191 if ((mtu > 9500) || (mtu < 68))
1192 return -EINVAL;
1193
1194 dev->mtu = mtu;
1195 retval = set_port_config_ext(pep);
1196
1197 if (!netif_running(dev))
1198 return 0;
1199
1200 /*
1201 * Stop and then re-open the interface. This will allocate RX
1202 * skbs of the new MTU.
1203 * There is a possible danger that the open will not succeed,
1204 * due to memory being full.
1205 */
1206 pxa168_eth_stop(dev);
1207 if (pxa168_eth_open(dev)) {
1208 dev_printk(KERN_ERR, &dev->dev,
1209 "fatal error on re-opening device after "
1210 "MTU change\n");
1211 }
1212
1213 return 0;
1214}
1215
1216static int eth_alloc_tx_desc_index(struct pxa168_eth_private *pep)
1217{
1218 int tx_desc_curr;
1219
1220 tx_desc_curr = pep->tx_curr_desc_q;
1221 pep->tx_curr_desc_q = (tx_desc_curr + 1) % pep->tx_ring_size;
1222 BUG_ON(pep->tx_curr_desc_q == pep->tx_used_desc_q);
1223 pep->tx_desc_count++;
1224
1225 return tx_desc_curr;
1226}
1227
1228static int pxa168_rx_poll(struct napi_struct *napi, int budget)
1229{
1230 struct pxa168_eth_private *pep =
1231 container_of(napi, struct pxa168_eth_private, napi);
1232 struct net_device *dev = pep->dev;
1233 int work_done = 0;
1234
1235 if (unlikely(pep->work_todo & WORK_LINK)) {
1236 pep->work_todo &= ~(WORK_LINK);
1237 handle_link_event(pep);
1238 }
1239 /*
1240 * We call txq_reclaim every time since in NAPI interupts are disabled
1241 * and due to this we miss the TX_DONE interrupt,which is not updated in
1242 * interrupt status register.
1243 */
1244 txq_reclaim(dev, 0);
1245 if (netif_queue_stopped(dev)
1246 && pep->tx_ring_size - pep->tx_desc_count > 1) {
1247 netif_wake_queue(dev);
1248 }
1249 work_done = rxq_process(dev, budget);
1250 if (work_done < budget) {
1251 napi_complete(napi);
1252 wrl(pep, INT_MASK, ALL_INTS);
1253 }
1254
1255 return work_done;
1256}
1257
1258static int pxa168_eth_start_xmit(struct sk_buff *skb, struct net_device *dev)
1259{
1260 struct pxa168_eth_private *pep = netdev_priv(dev);
1261 struct net_device_stats *stats = &dev->stats;
1262 struct tx_desc *desc;
1263 int tx_index;
1264 int length;
1265
1266 tx_index = eth_alloc_tx_desc_index(pep);
1267 desc = &pep->p_tx_desc_area[tx_index];
1268 length = skb->len;
1269 pep->tx_skb[tx_index] = skb;
1270 desc->byte_cnt = length;
1271 desc->buf_ptr = dma_map_single(NULL, skb->data, length, DMA_TO_DEVICE);
1272 wmb();
1273 desc->cmd_sts = BUF_OWNED_BY_DMA | TX_GEN_CRC | TX_FIRST_DESC |
1274 TX_ZERO_PADDING | TX_LAST_DESC | TX_EN_INT;
1275 wmb();
1276 wrl(pep, SDMA_CMD, SDMA_CMD_TXDH | SDMA_CMD_ERD);
1277
1278 stats->tx_bytes += skb->len;
1279 stats->tx_packets++;
1280 dev->trans_start = jiffies;
1281 if (pep->tx_ring_size - pep->tx_desc_count <= 1) {
1282 /* We handled the current skb, but now we are out of space.*/
1283 netif_stop_queue(dev);
1284 }
1285
1286 return NETDEV_TX_OK;
1287}
1288
1289static int smi_wait_ready(struct pxa168_eth_private *pep)
1290{
1291 int i = 0;
1292
1293 /* wait for the SMI register to become available */
1294 for (i = 0; rdl(pep, SMI) & SMI_BUSY; i++) {
1295 if (i == PHY_WAIT_ITERATIONS)
1296 return -ETIMEDOUT;
1297 msleep(10);
1298 }
1299
1300 return 0;
1301}
1302
1303static int pxa168_smi_read(struct mii_bus *bus, int phy_addr, int regnum)
1304{
1305 struct pxa168_eth_private *pep = bus->priv;
1306 int i = 0;
1307 int val;
1308
1309 if (smi_wait_ready(pep)) {
1310 printk(KERN_WARNING "pxa168_eth: SMI bus busy timeout\n");
1311 return -ETIMEDOUT;
1312 }
1313 wrl(pep, SMI, (phy_addr << 16) | (regnum << 21) | SMI_OP_R);
1314 /* now wait for the data to be valid */
1315 for (i = 0; !((val = rdl(pep, SMI)) & SMI_R_VALID); i++) {
1316 if (i == PHY_WAIT_ITERATIONS) {
1317 printk(KERN_WARNING
1318 "pxa168_eth: SMI bus read not valid\n");
1319 return -ENODEV;
1320 }
1321 msleep(10);
1322 }
1323
1324 return val & 0xffff;
1325}
1326
1327static int pxa168_smi_write(struct mii_bus *bus, int phy_addr, int regnum,
1328 u16 value)
1329{
1330 struct pxa168_eth_private *pep = bus->priv;
1331
1332 if (smi_wait_ready(pep)) {
1333 printk(KERN_WARNING "pxa168_eth: SMI bus busy timeout\n");
1334 return -ETIMEDOUT;
1335 }
1336
1337 wrl(pep, SMI, (phy_addr << 16) | (regnum << 21) |
1338 SMI_OP_W | (value & 0xffff));
1339
1340 if (smi_wait_ready(pep)) {
1341 printk(KERN_ERR "pxa168_eth: SMI bus busy timeout\n");
1342 return -ETIMEDOUT;
1343 }
1344
1345 return 0;
1346}
1347
1348static int pxa168_eth_do_ioctl(struct net_device *dev, struct ifreq *ifr,
1349 int cmd)
1350{
1351 struct pxa168_eth_private *pep = netdev_priv(dev);
1352 if (pep->phy != NULL)
1353 return phy_mii_ioctl(pep->phy, ifr, cmd);
1354
1355 return -EOPNOTSUPP;
1356}
1357
1358static struct phy_device *phy_scan(struct pxa168_eth_private *pep, int phy_addr)
1359{
1360 struct mii_bus *bus = pep->smi_bus;
1361 struct phy_device *phydev;
1362 int start;
1363 int num;
1364 int i;
1365
1366 if (phy_addr == PXA168_ETH_PHY_ADDR_DEFAULT) {
1367 /* Scan entire range */
1368 start = ethernet_phy_get(pep);
1369 num = 32;
1370 } else {
1371 /* Use phy addr specific to platform */
1372 start = phy_addr & 0x1f;
1373 num = 1;
1374 }
1375 phydev = NULL;
1376 for (i = 0; i < num; i++) {
1377 int addr = (start + i) & 0x1f;
1378 if (bus->phy_map[addr] == NULL)
1379 mdiobus_scan(bus, addr);
1380
1381 if (phydev == NULL) {
1382 phydev = bus->phy_map[addr];
1383 if (phydev != NULL)
1384 ethernet_phy_set_addr(pep, addr);
1385 }
1386 }
1387
1388 return phydev;
1389}
1390
1391static void phy_init(struct pxa168_eth_private *pep, int speed, int duplex)
1392{
1393 struct phy_device *phy = pep->phy;
1394 ethernet_phy_reset(pep);
1395
1396 phy_attach(pep->dev, dev_name(&phy->dev), 0, PHY_INTERFACE_MODE_MII);
1397
1398 if (speed == 0) {
1399 phy->autoneg = AUTONEG_ENABLE;
1400 phy->speed = 0;
1401 phy->duplex = 0;
1402 phy->supported &= PHY_BASIC_FEATURES;
1403 phy->advertising = phy->supported | ADVERTISED_Autoneg;
1404 } else {
1405 phy->autoneg = AUTONEG_DISABLE;
1406 phy->advertising = 0;
1407 phy->speed = speed;
1408 phy->duplex = duplex;
1409 }
1410 phy_start_aneg(phy);
1411}
1412
1413static int ethernet_phy_setup(struct net_device *dev)
1414{
1415 struct pxa168_eth_private *pep = netdev_priv(dev);
1416
1417 if (pep->pd->init)
1418 pep->pd->init();
1419 pep->phy = phy_scan(pep, pep->pd->phy_addr & 0x1f);
1420 if (pep->phy != NULL)
1421 phy_init(pep, pep->pd->speed, pep->pd->duplex);
1422 update_hash_table_mac_address(pep, NULL, dev->dev_addr);
1423
1424 return 0;
1425}
1426
1427static int pxa168_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1428{
1429 struct pxa168_eth_private *pep = netdev_priv(dev);
1430 int err;
1431
1432 err = phy_read_status(pep->phy);
1433 if (err == 0)
1434 err = phy_ethtool_gset(pep->phy, cmd);
1435
1436 return err;
1437}
1438
1439static int pxa168_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1440{
1441 struct pxa168_eth_private *pep = netdev_priv(dev);
1442
1443 return phy_ethtool_sset(pep->phy, cmd);
1444}
1445
1446static void pxa168_get_drvinfo(struct net_device *dev,
1447 struct ethtool_drvinfo *info)
1448{
1449 strncpy(info->driver, DRIVER_NAME, 32);
1450 strncpy(info->version, DRIVER_VERSION, 32);
1451 strncpy(info->fw_version, "N/A", 32);
1452 strncpy(info->bus_info, "N/A", 32);
1453}
1454
1455static u32 pxa168_get_link(struct net_device *dev)
1456{
1457 return !!netif_carrier_ok(dev);
1458}
1459
1460static const struct ethtool_ops pxa168_ethtool_ops = {
1461 .get_settings = pxa168_get_settings,
1462 .set_settings = pxa168_set_settings,
1463 .get_drvinfo = pxa168_get_drvinfo,
1464 .get_link = pxa168_get_link,
1465};
1466
1467static const struct net_device_ops pxa168_eth_netdev_ops = {
1468 .ndo_open = pxa168_eth_open,
1469 .ndo_stop = pxa168_eth_stop,
1470 .ndo_start_xmit = pxa168_eth_start_xmit,
1471 .ndo_set_rx_mode = pxa168_eth_set_rx_mode,
1472 .ndo_set_mac_address = pxa168_eth_set_mac_address,
1473 .ndo_validate_addr = eth_validate_addr,
1474 .ndo_do_ioctl = pxa168_eth_do_ioctl,
1475 .ndo_change_mtu = pxa168_eth_change_mtu,
1476 .ndo_tx_timeout = pxa168_eth_tx_timeout,
1477};
1478
1479static int pxa168_eth_probe(struct platform_device *pdev)
1480{
1481 struct pxa168_eth_private *pep = NULL;
1482 struct net_device *dev = NULL;
1483 struct resource *res;
1484 struct clk *clk;
1485 int err;
1486
1487 printk(KERN_NOTICE "PXA168 10/100 Ethernet Driver\n");
1488
1489 clk = clk_get(&pdev->dev, "MFUCLK");
1490 if (IS_ERR(clk)) {
1491 printk(KERN_ERR "%s: Fast Ethernet failed to get clock\n",
1492 DRIVER_NAME);
1493 return -ENODEV;
1494 }
1495 clk_enable(clk);
1496
1497 dev = alloc_etherdev(sizeof(struct pxa168_eth_private));
1498 if (!dev) {
1499 err = -ENOMEM;
1500 goto err_clk;
1501 }
1502
1503 platform_set_drvdata(pdev, dev);
1504 pep = netdev_priv(dev);
1505 pep->dev = dev;
1506 pep->clk = clk;
1507 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1508 if (res == NULL) {
1509 err = -ENODEV;
1510 goto err_netdev;
1511 }
1512 pep->base = ioremap(res->start, res->end - res->start + 1);
1513 if (pep->base == NULL) {
1514 err = -ENOMEM;
1515 goto err_netdev;
1516 }
1517 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
1518 BUG_ON(!res);
1519 dev->irq = res->start;
1520 dev->netdev_ops = &pxa168_eth_netdev_ops;
1521 dev->watchdog_timeo = 2 * HZ;
1522 dev->base_addr = 0;
1523 SET_ETHTOOL_OPS(dev, &pxa168_ethtool_ops);
1524
1525 INIT_WORK(&pep->tx_timeout_task, pxa168_eth_tx_timeout_task);
1526
1527 printk(KERN_INFO "%s:Using random mac address\n", DRIVER_NAME);
1528 random_ether_addr(dev->dev_addr);
1529
1530 pep->pd = pdev->dev.platform_data;
1531 pep->rx_ring_size = NUM_RX_DESCS;
1532 if (pep->pd->rx_queue_size)
1533 pep->rx_ring_size = pep->pd->rx_queue_size;
1534
1535 pep->tx_ring_size = NUM_TX_DESCS;
1536 if (pep->pd->tx_queue_size)
1537 pep->tx_ring_size = pep->pd->tx_queue_size;
1538
1539 pep->port_num = pep->pd->port_number;
1540 /* Hardware supports only 3 ports */
1541 BUG_ON(pep->port_num > 2);
1542 netif_napi_add(dev, &pep->napi, pxa168_rx_poll, pep->rx_ring_size);
1543
1544 memset(&pep->timeout, 0, sizeof(struct timer_list));
1545 init_timer(&pep->timeout);
1546 pep->timeout.function = rxq_refill_timer_wrapper;
1547 pep->timeout.data = (unsigned long)pep;
1548
1549 pep->smi_bus = mdiobus_alloc();
1550 if (pep->smi_bus == NULL) {
1551 err = -ENOMEM;
1552 goto err_base;
1553 }
1554 pep->smi_bus->priv = pep;
1555 pep->smi_bus->name = "pxa168_eth smi";
1556 pep->smi_bus->read = pxa168_smi_read;
1557 pep->smi_bus->write = pxa168_smi_write;
1558 snprintf(pep->smi_bus->id, MII_BUS_ID_SIZE, "%d", pdev->id);
1559 pep->smi_bus->parent = &pdev->dev;
1560 pep->smi_bus->phy_mask = 0xffffffff;
1561 err = mdiobus_register(pep->smi_bus);
1562 if (err)
1563 goto err_free_mdio;
1564
1565 pxa168_init_hw(pep);
1566 err = ethernet_phy_setup(dev);
1567 if (err)
1568 goto err_mdiobus;
1569 SET_NETDEV_DEV(dev, &pdev->dev);
1570 err = register_netdev(dev);
1571 if (err)
1572 goto err_mdiobus;
1573 return 0;
1574
1575err_mdiobus:
1576 mdiobus_unregister(pep->smi_bus);
1577err_free_mdio:
1578 mdiobus_free(pep->smi_bus);
1579err_base:
1580 iounmap(pep->base);
1581err_netdev:
1582 free_netdev(dev);
1583err_clk:
1584 clk_disable(clk);
1585 clk_put(clk);
1586 return err;
1587}
1588
1589static int pxa168_eth_remove(struct platform_device *pdev)
1590{
1591 struct net_device *dev = platform_get_drvdata(pdev);
1592 struct pxa168_eth_private *pep = netdev_priv(dev);
1593
1594 if (pep->htpr) {
1595 dma_free_coherent(pep->dev->dev.parent, HASH_ADDR_TABLE_SIZE,
1596 pep->htpr, pep->htpr_dma);
1597 pep->htpr = NULL;
1598 }
1599 if (pep->clk) {
1600 clk_disable(pep->clk);
1601 clk_put(pep->clk);
1602 pep->clk = NULL;
1603 }
1604 if (pep->phy != NULL)
1605 phy_detach(pep->phy);
1606
1607 iounmap(pep->base);
1608 pep->base = NULL;
1609 mdiobus_unregister(pep->smi_bus);
1610 mdiobus_free(pep->smi_bus);
1611 unregister_netdev(dev);
1612 flush_scheduled_work();
1613 free_netdev(dev);
1614 platform_set_drvdata(pdev, NULL);
1615 return 0;
1616}
1617
1618static void pxa168_eth_shutdown(struct platform_device *pdev)
1619{
1620 struct net_device *dev = platform_get_drvdata(pdev);
1621 eth_port_reset(dev);
1622}
1623
1624#ifdef CONFIG_PM
1625static int pxa168_eth_resume(struct platform_device *pdev)
1626{
1627 return -ENOSYS;
1628}
1629
1630static int pxa168_eth_suspend(struct platform_device *pdev, pm_message_t state)
1631{
1632 return -ENOSYS;
1633}
1634
1635#else
1636#define pxa168_eth_resume NULL
1637#define pxa168_eth_suspend NULL
1638#endif
1639
1640static struct platform_driver pxa168_eth_driver = {
1641 .probe = pxa168_eth_probe,
1642 .remove = pxa168_eth_remove,
1643 .shutdown = pxa168_eth_shutdown,
1644 .resume = pxa168_eth_resume,
1645 .suspend = pxa168_eth_suspend,
1646 .driver = {
1647 .name = DRIVER_NAME,
1648 },
1649};
1650
1651static int __init pxa168_init_module(void)
1652{
1653 return platform_driver_register(&pxa168_eth_driver);
1654}
1655
1656static void __exit pxa168_cleanup_module(void)
1657{
1658 platform_driver_unregister(&pxa168_eth_driver);
1659}
1660
1661module_init(pxa168_init_module);
1662module_exit(pxa168_cleanup_module);
1663
1664MODULE_LICENSE("GPL");
1665MODULE_DESCRIPTION("Ethernet driver for Marvell PXA168");
1666MODULE_ALIAS("platform:pxa168_eth");
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c
index 75ba744b173c..2c7cf0b64811 100644
--- a/drivers/net/qlcnic/qlcnic_init.c
+++ b/drivers/net/qlcnic/qlcnic_init.c
@@ -1316,7 +1316,7 @@ qlcnic_alloc_rx_skb(struct qlcnic_adapter *adapter,
1316 return -ENOMEM; 1316 return -ENOMEM;
1317 } 1317 }
1318 1318
1319 skb_reserve(skb, 2); 1319 skb_reserve(skb, NET_IP_ALIGN);
1320 1320
1321 dma = pci_map_single(pdev, skb->data, 1321 dma = pci_map_single(pdev, skb->data,
1322 rds_ring->dma_size, PCI_DMA_FROMDEVICE); 1322 rds_ring->dma_size, PCI_DMA_FROMDEVICE);
@@ -1404,7 +1404,6 @@ qlcnic_process_rcv(struct qlcnic_adapter *adapter,
1404 if (pkt_offset) 1404 if (pkt_offset)
1405 skb_pull(skb, pkt_offset); 1405 skb_pull(skb, pkt_offset);
1406 1406
1407 skb->truesize = skb->len + sizeof(struct sk_buff);
1408 skb->protocol = eth_type_trans(skb, netdev); 1407 skb->protocol = eth_type_trans(skb, netdev);
1409 1408
1410 napi_gro_receive(&sds_ring->napi, skb); 1409 napi_gro_receive(&sds_ring->napi, skb);
@@ -1466,8 +1465,6 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter,
1466 1465
1467 skb_put(skb, lro_length + data_offset); 1466 skb_put(skb, lro_length + data_offset);
1468 1467
1469 skb->truesize = skb->len + sizeof(struct sk_buff) + skb_headroom(skb);
1470
1471 skb_pull(skb, l2_hdr_offset); 1468 skb_pull(skb, l2_hdr_offset);
1472 skb->protocol = eth_type_trans(skb, netdev); 1469 skb->protocol = eth_type_trans(skb, netdev);
1473 1470
@@ -1700,8 +1697,6 @@ qlcnic_process_rcv_diag(struct qlcnic_adapter *adapter,
1700 if (pkt_offset) 1697 if (pkt_offset)
1701 skb_pull(skb, pkt_offset); 1698 skb_pull(skb, pkt_offset);
1702 1699
1703 skb->truesize = skb->len + sizeof(struct sk_buff);
1704
1705 if (!qlcnic_check_loopback_buff(skb->data)) 1700 if (!qlcnic_check_loopback_buff(skb->data))
1706 adapter->diag_cnt++; 1701 adapter->diag_cnt++;
1707 1702
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index bf6d87adda4f..66eea5972020 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -1983,8 +1983,6 @@ static struct net_device_stats *qlcnic_get_stats(struct net_device *netdev)
1983 struct qlcnic_adapter *adapter = netdev_priv(netdev); 1983 struct qlcnic_adapter *adapter = netdev_priv(netdev);
1984 struct net_device_stats *stats = &netdev->stats; 1984 struct net_device_stats *stats = &netdev->stats;
1985 1985
1986 memset(stats, 0, sizeof(*stats));
1987
1988 stats->rx_packets = adapter->stats.rx_pkts + adapter->stats.lro_pkts; 1986 stats->rx_packets = adapter->stats.rx_pkts + adapter->stats.lro_pkts;
1989 stats->tx_packets = adapter->stats.xmitfinished; 1987 stats->tx_packets = adapter->stats.xmitfinished;
1990 stats->rx_bytes = adapter->stats.rxbytes + adapter->stats.lrobytes; 1988 stats->rx_bytes = adapter->stats.rxbytes + adapter->stats.lrobytes;
@@ -2190,9 +2188,16 @@ static int qlcnic_rx_poll(struct napi_struct *napi, int budget)
2190#ifdef CONFIG_NET_POLL_CONTROLLER 2188#ifdef CONFIG_NET_POLL_CONTROLLER
2191static void qlcnic_poll_controller(struct net_device *netdev) 2189static void qlcnic_poll_controller(struct net_device *netdev)
2192{ 2190{
2191 int ring;
2192 struct qlcnic_host_sds_ring *sds_ring;
2193 struct qlcnic_adapter *adapter = netdev_priv(netdev); 2193 struct qlcnic_adapter *adapter = netdev_priv(netdev);
2194 struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx;
2195
2194 disable_irq(adapter->irq); 2196 disable_irq(adapter->irq);
2195 qlcnic_intr(adapter->irq, adapter); 2197 for (ring = 0; ring < adapter->max_sds_rings; ring++) {
2198 sds_ring = &recv_ctx->sds_rings[ring];
2199 qlcnic_intr(adapter->irq, sds_ring);
2200 }
2196 enable_irq(adapter->irq); 2201 enable_irq(adapter->irq);
2197} 2202}
2198#endif 2203#endif
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index 8d63f69b27d9..5f89e83501f4 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -3919,12 +3919,12 @@ static int ql_adapter_down(struct ql_adapter *qdev)
3919 for (i = 0; i < qdev->rss_ring_count; i++) 3919 for (i = 0; i < qdev->rss_ring_count; i++)
3920 netif_napi_del(&qdev->rx_ring[i].napi); 3920 netif_napi_del(&qdev->rx_ring[i].napi);
3921 3921
3922 ql_free_rx_buffers(qdev);
3923
3924 status = ql_adapter_reset(qdev); 3922 status = ql_adapter_reset(qdev);
3925 if (status) 3923 if (status)
3926 netif_err(qdev, ifdown, qdev->ndev, "reset(func #%d) FAILED!\n", 3924 netif_err(qdev, ifdown, qdev->ndev, "reset(func #%d) FAILED!\n",
3927 qdev->func); 3925 qdev->func);
3926 ql_free_rx_buffers(qdev);
3927
3928 return status; 3928 return status;
3929} 3929}
3930 3930
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 078bbf4e6f19..992db2fa136e 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1212,7 +1212,8 @@ static void rtl8169_update_counters(struct net_device *dev)
1212 if ((RTL_R8(ChipCmd) & CmdRxEnb) == 0) 1212 if ((RTL_R8(ChipCmd) & CmdRxEnb) == 0)
1213 return; 1213 return;
1214 1214
1215 counters = pci_alloc_consistent(tp->pci_dev, sizeof(*counters), &paddr); 1215 counters = dma_alloc_coherent(&tp->pci_dev->dev, sizeof(*counters),
1216 &paddr, GFP_KERNEL);
1216 if (!counters) 1217 if (!counters)
1217 return; 1218 return;
1218 1219
@@ -1233,7 +1234,8 @@ static void rtl8169_update_counters(struct net_device *dev)
1233 RTL_W32(CounterAddrLow, 0); 1234 RTL_W32(CounterAddrLow, 0);
1234 RTL_W32(CounterAddrHigh, 0); 1235 RTL_W32(CounterAddrHigh, 0);
1235 1236
1236 pci_free_consistent(tp->pci_dev, sizeof(*counters), counters, paddr); 1237 dma_free_coherent(&tp->pci_dev->dev, sizeof(*counters), counters,
1238 paddr);
1237} 1239}
1238 1240
1239static void rtl8169_get_ethtool_stats(struct net_device *dev, 1241static void rtl8169_get_ethtool_stats(struct net_device *dev,
@@ -2934,7 +2936,7 @@ static const struct rtl_cfg_info {
2934 .hw_start = rtl_hw_start_8168, 2936 .hw_start = rtl_hw_start_8168,
2935 .region = 2, 2937 .region = 2,
2936 .align = 8, 2938 .align = 8,
2937 .intr_event = SYSErr | LinkChg | RxOverflow | 2939 .intr_event = SYSErr | RxFIFOOver | LinkChg | RxOverflow |
2938 TxErr | TxOK | RxOK | RxErr, 2940 TxErr | TxOK | RxOK | RxErr,
2939 .napi_event = TxErr | TxOK | RxOK | RxOverflow, 2941 .napi_event = TxErr | TxOK | RxOK | RxOverflow,
2940 .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI, 2942 .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI,
@@ -3292,15 +3294,15 @@ static int rtl8169_open(struct net_device *dev)
3292 3294
3293 /* 3295 /*
3294 * Rx and Tx desscriptors needs 256 bytes alignment. 3296 * Rx and Tx desscriptors needs 256 bytes alignment.
3295 * pci_alloc_consistent provides more. 3297 * dma_alloc_coherent provides more.
3296 */ 3298 */
3297 tp->TxDescArray = pci_alloc_consistent(pdev, R8169_TX_RING_BYTES, 3299 tp->TxDescArray = dma_alloc_coherent(&pdev->dev, R8169_TX_RING_BYTES,
3298 &tp->TxPhyAddr); 3300 &tp->TxPhyAddr, GFP_KERNEL);
3299 if (!tp->TxDescArray) 3301 if (!tp->TxDescArray)
3300 goto err_pm_runtime_put; 3302 goto err_pm_runtime_put;
3301 3303
3302 tp->RxDescArray = pci_alloc_consistent(pdev, R8169_RX_RING_BYTES, 3304 tp->RxDescArray = dma_alloc_coherent(&pdev->dev, R8169_RX_RING_BYTES,
3303 &tp->RxPhyAddr); 3305 &tp->RxPhyAddr, GFP_KERNEL);
3304 if (!tp->RxDescArray) 3306 if (!tp->RxDescArray)
3305 goto err_free_tx_0; 3307 goto err_free_tx_0;
3306 3308
@@ -3334,12 +3336,12 @@ out:
3334err_release_ring_2: 3336err_release_ring_2:
3335 rtl8169_rx_clear(tp); 3337 rtl8169_rx_clear(tp);
3336err_free_rx_1: 3338err_free_rx_1:
3337 pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, 3339 dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray,
3338 tp->RxPhyAddr); 3340 tp->RxPhyAddr);
3339 tp->RxDescArray = NULL; 3341 tp->RxDescArray = NULL;
3340err_free_tx_0: 3342err_free_tx_0:
3341 pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, 3343 dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray,
3342 tp->TxPhyAddr); 3344 tp->TxPhyAddr);
3343 tp->TxDescArray = NULL; 3345 tp->TxDescArray = NULL;
3344err_pm_runtime_put: 3346err_pm_runtime_put:
3345 pm_runtime_put_noidle(&pdev->dev); 3347 pm_runtime_put_noidle(&pdev->dev);
@@ -3975,7 +3977,7 @@ static void rtl8169_free_rx_skb(struct rtl8169_private *tp,
3975{ 3977{
3976 struct pci_dev *pdev = tp->pci_dev; 3978 struct pci_dev *pdev = tp->pci_dev;
3977 3979
3978 pci_unmap_single(pdev, le64_to_cpu(desc->addr), tp->rx_buf_sz, 3980 dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), tp->rx_buf_sz,
3979 PCI_DMA_FROMDEVICE); 3981 PCI_DMA_FROMDEVICE);
3980 dev_kfree_skb(*sk_buff); 3982 dev_kfree_skb(*sk_buff);
3981 *sk_buff = NULL; 3983 *sk_buff = NULL;
@@ -4000,7 +4002,7 @@ static inline void rtl8169_map_to_asic(struct RxDesc *desc, dma_addr_t mapping,
4000static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev, 4002static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev,
4001 struct net_device *dev, 4003 struct net_device *dev,
4002 struct RxDesc *desc, int rx_buf_sz, 4004 struct RxDesc *desc, int rx_buf_sz,
4003 unsigned int align) 4005 unsigned int align, gfp_t gfp)
4004{ 4006{
4005 struct sk_buff *skb; 4007 struct sk_buff *skb;
4006 dma_addr_t mapping; 4008 dma_addr_t mapping;
@@ -4008,13 +4010,13 @@ static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev,
4008 4010
4009 pad = align ? align : NET_IP_ALIGN; 4011 pad = align ? align : NET_IP_ALIGN;
4010 4012
4011 skb = netdev_alloc_skb(dev, rx_buf_sz + pad); 4013 skb = __netdev_alloc_skb(dev, rx_buf_sz + pad, gfp);
4012 if (!skb) 4014 if (!skb)
4013 goto err_out; 4015 goto err_out;
4014 4016
4015 skb_reserve(skb, align ? ((pad - 1) & (unsigned long)skb->data) : pad); 4017 skb_reserve(skb, align ? ((pad - 1) & (unsigned long)skb->data) : pad);
4016 4018
4017 mapping = pci_map_single(pdev, skb->data, rx_buf_sz, 4019 mapping = dma_map_single(&pdev->dev, skb->data, rx_buf_sz,
4018 PCI_DMA_FROMDEVICE); 4020 PCI_DMA_FROMDEVICE);
4019 4021
4020 rtl8169_map_to_asic(desc, mapping, rx_buf_sz); 4022 rtl8169_map_to_asic(desc, mapping, rx_buf_sz);
@@ -4039,7 +4041,7 @@ static void rtl8169_rx_clear(struct rtl8169_private *tp)
4039} 4041}
4040 4042
4041static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, 4043static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev,
4042 u32 start, u32 end) 4044 u32 start, u32 end, gfp_t gfp)
4043{ 4045{
4044 u32 cur; 4046 u32 cur;
4045 4047
@@ -4054,7 +4056,7 @@ static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev,
4054 4056
4055 skb = rtl8169_alloc_rx_skb(tp->pci_dev, dev, 4057 skb = rtl8169_alloc_rx_skb(tp->pci_dev, dev,
4056 tp->RxDescArray + i, 4058 tp->RxDescArray + i,
4057 tp->rx_buf_sz, tp->align); 4059 tp->rx_buf_sz, tp->align, gfp);
4058 if (!skb) 4060 if (!skb)
4059 break; 4061 break;
4060 4062
@@ -4082,7 +4084,7 @@ static int rtl8169_init_ring(struct net_device *dev)
4082 memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info)); 4084 memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info));
4083 memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *)); 4085 memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *));
4084 4086
4085 if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC) != NUM_RX_DESC) 4087 if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC, GFP_KERNEL) != NUM_RX_DESC)
4086 goto err_out; 4088 goto err_out;
4087 4089
4088 rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1); 4090 rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1);
@@ -4099,7 +4101,8 @@ static void rtl8169_unmap_tx_skb(struct pci_dev *pdev, struct ring_info *tx_skb,
4099{ 4101{
4100 unsigned int len = tx_skb->len; 4102 unsigned int len = tx_skb->len;
4101 4103
4102 pci_unmap_single(pdev, le64_to_cpu(desc->addr), len, PCI_DMA_TODEVICE); 4104 dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), len,
4105 PCI_DMA_TODEVICE);
4103 desc->opts1 = 0x00; 4106 desc->opts1 = 0x00;
4104 desc->opts2 = 0x00; 4107 desc->opts2 = 0x00;
4105 desc->addr = 0x00; 4108 desc->addr = 0x00;
@@ -4243,7 +4246,8 @@ static int rtl8169_xmit_frags(struct rtl8169_private *tp, struct sk_buff *skb,
4243 txd = tp->TxDescArray + entry; 4246 txd = tp->TxDescArray + entry;
4244 len = frag->size; 4247 len = frag->size;
4245 addr = ((void *) page_address(frag->page)) + frag->page_offset; 4248 addr = ((void *) page_address(frag->page)) + frag->page_offset;
4246 mapping = pci_map_single(tp->pci_dev, addr, len, PCI_DMA_TODEVICE); 4249 mapping = dma_map_single(&tp->pci_dev->dev, addr, len,
4250 PCI_DMA_TODEVICE);
4247 4251
4248 /* anti gcc 2.95.3 bugware (sic) */ 4252 /* anti gcc 2.95.3 bugware (sic) */
4249 status = opts1 | len | (RingEnd * !((entry + 1) % NUM_TX_DESC)); 4253 status = opts1 | len | (RingEnd * !((entry + 1) % NUM_TX_DESC));
@@ -4313,7 +4317,8 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
4313 tp->tx_skb[entry].skb = skb; 4317 tp->tx_skb[entry].skb = skb;
4314 } 4318 }
4315 4319
4316 mapping = pci_map_single(tp->pci_dev, skb->data, len, PCI_DMA_TODEVICE); 4320 mapping = dma_map_single(&tp->pci_dev->dev, skb->data, len,
4321 PCI_DMA_TODEVICE);
4317 4322
4318 tp->tx_skb[entry].len = len; 4323 tp->tx_skb[entry].len = len;
4319 txd->addr = cpu_to_le64(mapping); 4324 txd->addr = cpu_to_le64(mapping);
@@ -4477,8 +4482,8 @@ static inline bool rtl8169_try_rx_copy(struct sk_buff **sk_buff,
4477 if (!skb) 4482 if (!skb)
4478 goto out; 4483 goto out;
4479 4484
4480 pci_dma_sync_single_for_cpu(tp->pci_dev, addr, pkt_size, 4485 dma_sync_single_for_cpu(&tp->pci_dev->dev, addr, pkt_size,
4481 PCI_DMA_FROMDEVICE); 4486 PCI_DMA_FROMDEVICE);
4482 skb_copy_from_linear_data(*sk_buff, skb->data, pkt_size); 4487 skb_copy_from_linear_data(*sk_buff, skb->data, pkt_size);
4483 *sk_buff = skb; 4488 *sk_buff = skb;
4484 done = true; 4489 done = true;
@@ -4549,11 +4554,11 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
4549 rtl8169_rx_csum(skb, desc); 4554 rtl8169_rx_csum(skb, desc);
4550 4555
4551 if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) { 4556 if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) {
4552 pci_dma_sync_single_for_device(pdev, addr, 4557 dma_sync_single_for_device(&pdev->dev, addr,
4553 pkt_size, PCI_DMA_FROMDEVICE); 4558 pkt_size, PCI_DMA_FROMDEVICE);
4554 rtl8169_mark_to_asic(desc, tp->rx_buf_sz); 4559 rtl8169_mark_to_asic(desc, tp->rx_buf_sz);
4555 } else { 4560 } else {
4556 pci_unmap_single(pdev, addr, tp->rx_buf_sz, 4561 dma_unmap_single(&pdev->dev, addr, tp->rx_buf_sz,
4557 PCI_DMA_FROMDEVICE); 4562 PCI_DMA_FROMDEVICE);
4558 tp->Rx_skbuff[entry] = NULL; 4563 tp->Rx_skbuff[entry] = NULL;
4559 } 4564 }
@@ -4583,7 +4588,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
4583 count = cur_rx - tp->cur_rx; 4588 count = cur_rx - tp->cur_rx;
4584 tp->cur_rx = cur_rx; 4589 tp->cur_rx = cur_rx;
4585 4590
4586 delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx); 4591 delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx, GFP_ATOMIC);
4587 if (!delta && count) 4592 if (!delta && count)
4588 netif_info(tp, intr, dev, "no Rx buffer allocated\n"); 4593 netif_info(tp, intr, dev, "no Rx buffer allocated\n");
4589 tp->dirty_rx += delta; 4594 tp->dirty_rx += delta;
@@ -4625,8 +4630,7 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
4625 } 4630 }
4626 4631
4627 /* Work around for rx fifo overflow */ 4632 /* Work around for rx fifo overflow */
4628 if (unlikely(status & RxFIFOOver) && 4633 if (unlikely(status & RxFIFOOver)) {
4629 (tp->mac_version == RTL_GIGA_MAC_VER_11)) {
4630 netif_stop_queue(dev); 4634 netif_stop_queue(dev);
4631 rtl8169_tx_timeout(dev); 4635 rtl8169_tx_timeout(dev);
4632 break; 4636 break;
@@ -4770,10 +4774,10 @@ static int rtl8169_close(struct net_device *dev)
4770 4774
4771 free_irq(dev->irq, dev); 4775 free_irq(dev->irq, dev);
4772 4776
4773 pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, 4777 dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray,
4774 tp->RxPhyAddr); 4778 tp->RxPhyAddr);
4775 pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, 4779 dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray,
4776 tp->TxPhyAddr); 4780 tp->TxPhyAddr);
4777 tp->TxDescArray = NULL; 4781 tp->TxDescArray = NULL;
4778 tp->RxDescArray = NULL; 4782 tp->RxDescArray = NULL;
4779 4783
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c
index 07eb884ff982..44150f2f7bfd 100644
--- a/drivers/net/rionet.c
+++ b/drivers/net/rionet.c
@@ -384,7 +384,7 @@ static void rionet_remove(struct rio_dev *rdev)
384 free_pages((unsigned long)rionet_active, rdev->net->hport->sys_size ? 384 free_pages((unsigned long)rionet_active, rdev->net->hport->sys_size ?
385 __ilog2(sizeof(void *)) + 4 : 0); 385 __ilog2(sizeof(void *)) + 4 : 0);
386 unregister_netdev(ndev); 386 unregister_netdev(ndev);
387 kfree(ndev); 387 free_netdev(ndev);
388 388
389 list_for_each_entry_safe(peer, tmp, &rionet_peers, node) { 389 list_for_each_entry_safe(peer, tmp, &rionet_peers, node) {
390 list_del(&peer->node); 390 list_del(&peer->node);
diff --git a/drivers/net/sgiseeq.c b/drivers/net/sgiseeq.c
index cc4bd8c65f8b..9265315baa0b 100644
--- a/drivers/net/sgiseeq.c
+++ b/drivers/net/sgiseeq.c
@@ -804,7 +804,7 @@ static int __devinit sgiseeq_probe(struct platform_device *pdev)
804err_out_free_page: 804err_out_free_page:
805 free_page((unsigned long) sp->srings); 805 free_page((unsigned long) sp->srings);
806err_out_free_dev: 806err_out_free_dev:
807 kfree(dev); 807 free_netdev(dev);
808 808
809err_out: 809err_out:
810 return err; 810 return err;
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index f5a9eb1df593..79fd02bc69fd 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -1437,7 +1437,7 @@ static const struct net_device_ops sh_eth_netdev_ops = {
1437 1437
1438static int sh_eth_drv_probe(struct platform_device *pdev) 1438static int sh_eth_drv_probe(struct platform_device *pdev)
1439{ 1439{
1440 int ret, i, devno = 0; 1440 int ret, devno = 0;
1441 struct resource *res; 1441 struct resource *res;
1442 struct net_device *ndev = NULL; 1442 struct net_device *ndev = NULL;
1443 struct sh_eth_private *mdp; 1443 struct sh_eth_private *mdp;
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 40e5c46e7571..465ae7e84507 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -43,6 +43,7 @@
43#include <linux/seq_file.h> 43#include <linux/seq_file.h>
44#include <linux/mii.h> 44#include <linux/mii.h>
45#include <linux/slab.h> 45#include <linux/slab.h>
46#include <linux/dmi.h>
46#include <asm/irq.h> 47#include <asm/irq.h>
47 48
48#include "skge.h" 49#include "skge.h"
@@ -3868,6 +3869,8 @@ static void __devinit skge_show_addr(struct net_device *dev)
3868 netif_info(skge, probe, skge->netdev, "addr %pM\n", dev->dev_addr); 3869 netif_info(skge, probe, skge->netdev, "addr %pM\n", dev->dev_addr);
3869} 3870}
3870 3871
3872static int only_32bit_dma;
3873
3871static int __devinit skge_probe(struct pci_dev *pdev, 3874static int __devinit skge_probe(struct pci_dev *pdev,
3872 const struct pci_device_id *ent) 3875 const struct pci_device_id *ent)
3873{ 3876{
@@ -3889,7 +3892,7 @@ static int __devinit skge_probe(struct pci_dev *pdev,
3889 3892
3890 pci_set_master(pdev); 3893 pci_set_master(pdev);
3891 3894
3892 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { 3895 if (!only_32bit_dma && !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
3893 using_dac = 1; 3896 using_dac = 1;
3894 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); 3897 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
3895 } else if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { 3898 } else if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) {
@@ -4147,8 +4150,21 @@ static struct pci_driver skge_driver = {
4147 .shutdown = skge_shutdown, 4150 .shutdown = skge_shutdown,
4148}; 4151};
4149 4152
4153static struct dmi_system_id skge_32bit_dma_boards[] = {
4154 {
4155 .ident = "Gigabyte nForce boards",
4156 .matches = {
4157 DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co"),
4158 DMI_MATCH(DMI_BOARD_NAME, "nForce"),
4159 },
4160 },
4161 {}
4162};
4163
4150static int __init skge_init_module(void) 4164static int __init skge_init_module(void)
4151{ 4165{
4166 if (dmi_check_system(skge_32bit_dma_boards))
4167 only_32bit_dma = 1;
4152 skge_debug_init(); 4168 skge_debug_init();
4153 return pci_register_driver(&skge_driver); 4169 return pci_register_driver(&skge_driver);
4154} 4170}
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index 0909ae934ad0..8150ba154116 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -58,6 +58,7 @@
58 58
59MODULE_LICENSE("GPL"); 59MODULE_LICENSE("GPL");
60MODULE_VERSION(SMSC_DRV_VERSION); 60MODULE_VERSION(SMSC_DRV_VERSION);
61MODULE_ALIAS("platform:smsc911x");
61 62
62#if USE_DEBUG > 0 63#if USE_DEBUG > 0
63static int debug = 16; 64static int debug = 16;
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index bbb7951b9c4c..ea0461eb2dbe 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -1865,15 +1865,15 @@ static int stmmac_resume(struct platform_device *pdev)
1865 if (!netif_running(dev)) 1865 if (!netif_running(dev))
1866 return 0; 1866 return 0;
1867 1867
1868 spin_lock(&priv->lock);
1869
1870 if (priv->shutdown) { 1868 if (priv->shutdown) {
1871 /* Re-open the interface and re-init the MAC/DMA 1869 /* Re-open the interface and re-init the MAC/DMA
1872 and the rings. */ 1870 and the rings (i.e. on hibernation stage) */
1873 stmmac_open(dev); 1871 stmmac_open(dev);
1874 goto out_resume; 1872 return 0;
1875 } 1873 }
1876 1874
1875 spin_lock(&priv->lock);
1876
1877 /* Power Down bit, into the PM register, is cleared 1877 /* Power Down bit, into the PM register, is cleared
1878 * automatically as soon as a magic packet or a Wake-up frame 1878 * automatically as soon as a magic packet or a Wake-up frame
1879 * is received. Anyway, it's better to manually clear 1879 * is received. Anyway, it's better to manually clear
@@ -1901,7 +1901,6 @@ static int stmmac_resume(struct platform_device *pdev)
1901 1901
1902 netif_start_queue(dev); 1902 netif_start_queue(dev);
1903 1903
1904out_resume:
1905 spin_unlock(&priv->lock); 1904 spin_unlock(&priv->lock);
1906 return 0; 1905 return 0;
1907} 1906}
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index bc3af78a869f..1ec4b9e0239a 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -4666,7 +4666,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
4666 desc_idx, *post_ptr); 4666 desc_idx, *post_ptr);
4667 drop_it_no_recycle: 4667 drop_it_no_recycle:
4668 /* Other statistics kept track of by card. */ 4668 /* Other statistics kept track of by card. */
4669 tp->net_stats.rx_dropped++; 4669 tp->rx_dropped++;
4670 goto next_pkt; 4670 goto next_pkt;
4671 } 4671 }
4672 4672
@@ -4726,7 +4726,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
4726 if (len > (tp->dev->mtu + ETH_HLEN) && 4726 if (len > (tp->dev->mtu + ETH_HLEN) &&
4727 skb->protocol != htons(ETH_P_8021Q)) { 4727 skb->protocol != htons(ETH_P_8021Q)) {
4728 dev_kfree_skb(skb); 4728 dev_kfree_skb(skb);
4729 goto next_pkt; 4729 goto drop_it_no_recycle;
4730 } 4730 }
4731 4731
4732 if (desc->type_flags & RXD_FLAG_VLAN && 4732 if (desc->type_flags & RXD_FLAG_VLAN &&
@@ -9240,6 +9240,8 @@ static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev,
9240 stats->rx_missed_errors = old_stats->rx_missed_errors + 9240 stats->rx_missed_errors = old_stats->rx_missed_errors +
9241 get_stat64(&hw_stats->rx_discards); 9241 get_stat64(&hw_stats->rx_discards);
9242 9242
9243 stats->rx_dropped = tp->rx_dropped;
9244
9243 return stats; 9245 return stats;
9244} 9246}
9245 9247
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 4937bd190964..be7ff138a7f9 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2759,7 +2759,7 @@ struct tg3 {
2759 2759
2760 2760
2761 /* begin "everything else" cacheline(s) section */ 2761 /* begin "everything else" cacheline(s) section */
2762 struct rtnl_link_stats64 net_stats; 2762 unsigned long rx_dropped;
2763 struct rtnl_link_stats64 net_stats_prev; 2763 struct rtnl_link_stats64 net_stats_prev;
2764 struct tg3_ethtool_stats estats; 2764 struct tg3_ethtool_stats estats;
2765 struct tg3_ethtool_stats estats_prev; 2765 struct tg3_ethtool_stats estats_prev;
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index 5efa57757a2c..6888e3d41462 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -243,6 +243,7 @@ enum {
243 NWayState = (1 << 14) | (1 << 13) | (1 << 12), 243 NWayState = (1 << 14) | (1 << 13) | (1 << 12),
244 NWayRestart = (1 << 12), 244 NWayRestart = (1 << 12),
245 NonselPortActive = (1 << 9), 245 NonselPortActive = (1 << 9),
246 SelPortActive = (1 << 8),
246 LinkFailStatus = (1 << 2), 247 LinkFailStatus = (1 << 2),
247 NetCxnErr = (1 << 1), 248 NetCxnErr = (1 << 1),
248}; 249};
@@ -363,7 +364,9 @@ static u16 t21040_csr15[] = { 0, 0, 0x0006, 0x0000, 0x0000, };
363 364
364/* 21041 transceiver register settings: TP AUTO, BNC, AUI, TP, TP FD*/ 365/* 21041 transceiver register settings: TP AUTO, BNC, AUI, TP, TP FD*/
365static u16 t21041_csr13[] = { 0xEF01, 0xEF09, 0xEF09, 0xEF01, 0xEF09, }; 366static u16 t21041_csr13[] = { 0xEF01, 0xEF09, 0xEF09, 0xEF01, 0xEF09, };
366static u16 t21041_csr14[] = { 0xFFFF, 0xF7FD, 0xF7FD, 0x6F3F, 0x6F3D, }; 367static u16 t21041_csr14[] = { 0xFFFF, 0xF7FD, 0xF7FD, 0x7F3F, 0x7F3D, };
368/* If on-chip autonegotiation is broken, use half-duplex (FF3F) instead */
369static u16 t21041_csr14_brk[] = { 0xFF3F, 0xF7FD, 0xF7FD, 0x7F3F, 0x7F3D, };
367static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, }; 370static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, };
368 371
369 372
@@ -1064,6 +1067,9 @@ static void de21041_media_timer (unsigned long data)
1064 unsigned int carrier; 1067 unsigned int carrier;
1065 unsigned long flags; 1068 unsigned long flags;
1066 1069
1070 /* clear port active bits */
1071 dw32(SIAStatus, NonselPortActive | SelPortActive);
1072
1067 carrier = (status & NetCxnErr) ? 0 : 1; 1073 carrier = (status & NetCxnErr) ? 0 : 1;
1068 1074
1069 if (carrier) { 1075 if (carrier) {
@@ -1158,14 +1164,29 @@ no_link_yet:
1158static void de_media_interrupt (struct de_private *de, u32 status) 1164static void de_media_interrupt (struct de_private *de, u32 status)
1159{ 1165{
1160 if (status & LinkPass) { 1166 if (status & LinkPass) {
1167 /* Ignore if current media is AUI or BNC and we can't use TP */
1168 if ((de->media_type == DE_MEDIA_AUI ||
1169 de->media_type == DE_MEDIA_BNC) &&
1170 (de->media_lock ||
1171 !de_ok_to_advertise(de, DE_MEDIA_TP_AUTO)))
1172 return;
1173 /* If current media is not TP, change it to TP */
1174 if ((de->media_type == DE_MEDIA_AUI ||
1175 de->media_type == DE_MEDIA_BNC)) {
1176 de->media_type = DE_MEDIA_TP_AUTO;
1177 de_stop_rxtx(de);
1178 de_set_media(de);
1179 de_start_rxtx(de);
1180 }
1161 de_link_up(de); 1181 de_link_up(de);
1162 mod_timer(&de->media_timer, jiffies + DE_TIMER_LINK); 1182 mod_timer(&de->media_timer, jiffies + DE_TIMER_LINK);
1163 return; 1183 return;
1164 } 1184 }
1165 1185
1166 BUG_ON(!(status & LinkFail)); 1186 BUG_ON(!(status & LinkFail));
1167 1187 /* Mark the link as down only if current media is TP */
1168 if (netif_carrier_ok(de->dev)) { 1188 if (netif_carrier_ok(de->dev) && de->media_type != DE_MEDIA_AUI &&
1189 de->media_type != DE_MEDIA_BNC) {
1169 de_link_down(de); 1190 de_link_down(de);
1170 mod_timer(&de->media_timer, jiffies + DE_TIMER_NO_LINK); 1191 mod_timer(&de->media_timer, jiffies + DE_TIMER_NO_LINK);
1171 } 1192 }
@@ -1229,6 +1250,7 @@ static void de_adapter_sleep (struct de_private *de)
1229 if (de->de21040) 1250 if (de->de21040)
1230 return; 1251 return;
1231 1252
1253 dw32(CSR13, 0); /* Reset phy */
1232 pci_read_config_dword(de->pdev, PCIPM, &pmctl); 1254 pci_read_config_dword(de->pdev, PCIPM, &pmctl);
1233 pmctl |= PM_Sleep; 1255 pmctl |= PM_Sleep;
1234 pci_write_config_dword(de->pdev, PCIPM, pmctl); 1256 pci_write_config_dword(de->pdev, PCIPM, pmctl);
@@ -1574,12 +1596,15 @@ static int __de_set_settings(struct de_private *de, struct ethtool_cmd *ecmd)
1574 return 0; /* nothing to change */ 1596 return 0; /* nothing to change */
1575 1597
1576 de_link_down(de); 1598 de_link_down(de);
1599 mod_timer(&de->media_timer, jiffies + DE_TIMER_NO_LINK);
1577 de_stop_rxtx(de); 1600 de_stop_rxtx(de);
1578 1601
1579 de->media_type = new_media; 1602 de->media_type = new_media;
1580 de->media_lock = media_lock; 1603 de->media_lock = media_lock;
1581 de->media_advertise = ecmd->advertising; 1604 de->media_advertise = ecmd->advertising;
1582 de_set_media(de); 1605 de_set_media(de);
1606 if (netif_running(de->dev))
1607 de_start_rxtx(de);
1583 1608
1584 return 0; 1609 return 0;
1585} 1610}
@@ -1911,8 +1936,14 @@ fill_defaults:
1911 for (i = 0; i < DE_MAX_MEDIA; i++) { 1936 for (i = 0; i < DE_MAX_MEDIA; i++) {
1912 if (de->media[i].csr13 == 0xffff) 1937 if (de->media[i].csr13 == 0xffff)
1913 de->media[i].csr13 = t21041_csr13[i]; 1938 de->media[i].csr13 = t21041_csr13[i];
1914 if (de->media[i].csr14 == 0xffff) 1939 if (de->media[i].csr14 == 0xffff) {
1915 de->media[i].csr14 = t21041_csr14[i]; 1940 /* autonegotiation is broken at least on some chip
1941 revisions - rev. 0x21 works, 0x11 does not */
1942 if (de->pdev->revision < 0x20)
1943 de->media[i].csr14 = t21041_csr14_brk[i];
1944 else
1945 de->media[i].csr14 = t21041_csr14[i];
1946 }
1916 if (de->media[i].csr15 == 0xffff) 1947 if (de->media[i].csr15 == 0xffff)
1917 de->media[i].csr15 = t21041_csr15[i]; 1948 de->media[i].csr15 = t21041_csr15[i];
1918 } 1949 }
@@ -2158,6 +2189,8 @@ static int de_resume (struct pci_dev *pdev)
2158 dev_err(&dev->dev, "pci_enable_device failed in resume\n"); 2189 dev_err(&dev->dev, "pci_enable_device failed in resume\n");
2159 goto out; 2190 goto out;
2160 } 2191 }
2192 pci_set_master(pdev);
2193 de_init_rings(de);
2161 de_init_hw(de); 2194 de_init_hw(de);
2162out_attach: 2195out_attach:
2163 netif_device_attach(dev); 2196 netif_device_attach(dev);
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 6efca66b8766..1cd752f9a6e1 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1652,6 +1652,8 @@ static int hso_get_count(struct hso_serial *serial,
1652 struct uart_icount cnow; 1652 struct uart_icount cnow;
1653 struct hso_tiocmget *tiocmget = serial->tiocmget; 1653 struct hso_tiocmget *tiocmget = serial->tiocmget;
1654 1654
1655 memset(&icount, 0, sizeof(struct serial_icounter_struct));
1656
1655 if (!tiocmget) 1657 if (!tiocmget)
1656 return -ENOENT; 1658 return -ENOENT;
1657 spin_lock_irq(&serial->serial_lock); 1659 spin_lock_irq(&serial->serial_lock);
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index 08e7b6abacdd..b2bcf99e6f08 100644
--- a/drivers/net/usb/ipheth.c
+++ b/drivers/net/usb/ipheth.c
@@ -58,6 +58,7 @@
58#define USB_PRODUCT_IPHONE 0x1290 58#define USB_PRODUCT_IPHONE 0x1290
59#define USB_PRODUCT_IPHONE_3G 0x1292 59#define USB_PRODUCT_IPHONE_3G 0x1292
60#define USB_PRODUCT_IPHONE_3GS 0x1294 60#define USB_PRODUCT_IPHONE_3GS 0x1294
61#define USB_PRODUCT_IPHONE_4 0x1297
61 62
62#define IPHETH_USBINTF_CLASS 255 63#define IPHETH_USBINTF_CLASS 255
63#define IPHETH_USBINTF_SUBCLASS 253 64#define IPHETH_USBINTF_SUBCLASS 253
@@ -92,6 +93,10 @@ static struct usb_device_id ipheth_table[] = {
92 USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_3GS, 93 USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_3GS,
93 IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, 94 IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
94 IPHETH_USBINTF_PROTO) }, 95 IPHETH_USBINTF_PROTO) },
96 { USB_DEVICE_AND_INTERFACE_INFO(
97 USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4,
98 IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
99 IPHETH_USBINTF_PROTO) },
95 { } 100 { }
96}; 101};
97MODULE_DEVICE_TABLE(usb, ipheth_table); 102MODULE_DEVICE_TABLE(usb, ipheth_table);
@@ -424,10 +429,6 @@ static const struct net_device_ops ipheth_netdev_ops = {
424 .ndo_get_stats = &ipheth_stats, 429 .ndo_get_stats = &ipheth_stats,
425}; 430};
426 431
427static struct device_type ipheth_type = {
428 .name = "wwan",
429};
430
431static int ipheth_probe(struct usb_interface *intf, 432static int ipheth_probe(struct usb_interface *intf,
432 const struct usb_device_id *id) 433 const struct usb_device_id *id)
433{ 434{
@@ -445,7 +446,7 @@ static int ipheth_probe(struct usb_interface *intf,
445 446
446 netdev->netdev_ops = &ipheth_netdev_ops; 447 netdev->netdev_ops = &ipheth_netdev_ops;
447 netdev->watchdog_timeo = IPHETH_TX_TIMEOUT; 448 netdev->watchdog_timeo = IPHETH_TX_TIMEOUT;
448 strcpy(netdev->name, "wwan%d"); 449 strcpy(netdev->name, "eth%d");
449 450
450 dev = netdev_priv(netdev); 451 dev = netdev_priv(netdev);
451 dev->udev = udev; 452 dev->udev = udev;
@@ -495,7 +496,6 @@ static int ipheth_probe(struct usb_interface *intf,
495 496
496 SET_NETDEV_DEV(netdev, &intf->dev); 497 SET_NETDEV_DEV(netdev, &intf->dev);
497 SET_ETHTOOL_OPS(netdev, &ops); 498 SET_ETHTOOL_OPS(netdev, &ops);
498 SET_NETDEV_DEVTYPE(netdev, &ipheth_type);
499 499
500 retval = register_netdev(netdev); 500 retval = register_netdev(netdev);
501 if (retval) { 501 if (retval) {
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index fd69095ef6e3..f53412368ce1 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -2824,7 +2824,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
2824 netif_napi_add(dev, &vptr->napi, velocity_poll, VELOCITY_NAPI_WEIGHT); 2824 netif_napi_add(dev, &vptr->napi, velocity_poll, VELOCITY_NAPI_WEIGHT);
2825 2825
2826 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_FILTER | 2826 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_FILTER |
2827 NETIF_F_HW_VLAN_RX | NETIF_F_IP_CSUM | NETIF_F_SG; 2827 NETIF_F_HW_VLAN_RX | NETIF_F_IP_CSUM;
2828 2828
2829 ret = register_netdev(dev); 2829 ret = register_netdev(dev);
2830 if (ret < 0) 2830 if (ret < 0)
diff --git a/drivers/net/wimax/i2400m/rx.c b/drivers/net/wimax/i2400m/rx.c
index 8cc9e319f435..1737d1488b35 100644
--- a/drivers/net/wimax/i2400m/rx.c
+++ b/drivers/net/wimax/i2400m/rx.c
@@ -1244,16 +1244,16 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb)
1244 int i, result; 1244 int i, result;
1245 struct device *dev = i2400m_dev(i2400m); 1245 struct device *dev = i2400m_dev(i2400m);
1246 const struct i2400m_msg_hdr *msg_hdr; 1246 const struct i2400m_msg_hdr *msg_hdr;
1247 size_t pl_itr, pl_size, skb_len; 1247 size_t pl_itr, pl_size;
1248 unsigned long flags; 1248 unsigned long flags;
1249 unsigned num_pls, single_last; 1249 unsigned num_pls, single_last, skb_len;
1250 1250
1251 skb_len = skb->len; 1251 skb_len = skb->len;
1252 d_fnstart(4, dev, "(i2400m %p skb %p [size %zu])\n", 1252 d_fnstart(4, dev, "(i2400m %p skb %p [size %u])\n",
1253 i2400m, skb, skb_len); 1253 i2400m, skb, skb_len);
1254 result = -EIO; 1254 result = -EIO;
1255 msg_hdr = (void *) skb->data; 1255 msg_hdr = (void *) skb->data;
1256 result = i2400m_rx_msg_hdr_check(i2400m, msg_hdr, skb->len); 1256 result = i2400m_rx_msg_hdr_check(i2400m, msg_hdr, skb_len);
1257 if (result < 0) 1257 if (result < 0)
1258 goto error_msg_hdr_check; 1258 goto error_msg_hdr_check;
1259 result = -EIO; 1259 result = -EIO;
@@ -1261,10 +1261,10 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb)
1261 pl_itr = sizeof(*msg_hdr) + /* Check payload descriptor(s) */ 1261 pl_itr = sizeof(*msg_hdr) + /* Check payload descriptor(s) */
1262 num_pls * sizeof(msg_hdr->pld[0]); 1262 num_pls * sizeof(msg_hdr->pld[0]);
1263 pl_itr = ALIGN(pl_itr, I2400M_PL_ALIGN); 1263 pl_itr = ALIGN(pl_itr, I2400M_PL_ALIGN);
1264 if (pl_itr > skb->len) { /* got all the payload descriptors? */ 1264 if (pl_itr > skb_len) { /* got all the payload descriptors? */
1265 dev_err(dev, "RX: HW BUG? message too short (%u bytes) for " 1265 dev_err(dev, "RX: HW BUG? message too short (%u bytes) for "
1266 "%u payload descriptors (%zu each, total %zu)\n", 1266 "%u payload descriptors (%zu each, total %zu)\n",
1267 skb->len, num_pls, sizeof(msg_hdr->pld[0]), pl_itr); 1267 skb_len, num_pls, sizeof(msg_hdr->pld[0]), pl_itr);
1268 goto error_pl_descr_short; 1268 goto error_pl_descr_short;
1269 } 1269 }
1270 /* Walk each payload payload--check we really got it */ 1270 /* Walk each payload payload--check we really got it */
@@ -1272,7 +1272,7 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb)
1272 /* work around old gcc warnings */ 1272 /* work around old gcc warnings */
1273 pl_size = i2400m_pld_size(&msg_hdr->pld[i]); 1273 pl_size = i2400m_pld_size(&msg_hdr->pld[i]);
1274 result = i2400m_rx_pl_descr_check(i2400m, &msg_hdr->pld[i], 1274 result = i2400m_rx_pl_descr_check(i2400m, &msg_hdr->pld[i],
1275 pl_itr, skb->len); 1275 pl_itr, skb_len);
1276 if (result < 0) 1276 if (result < 0)
1277 goto error_pl_descr_check; 1277 goto error_pl_descr_check;
1278 single_last = num_pls == 1 || i == num_pls - 1; 1278 single_last = num_pls == 1 || i == num_pls - 1;
@@ -1290,16 +1290,16 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb)
1290 if (i < i2400m->rx_pl_min) 1290 if (i < i2400m->rx_pl_min)
1291 i2400m->rx_pl_min = i; 1291 i2400m->rx_pl_min = i;
1292 i2400m->rx_num++; 1292 i2400m->rx_num++;
1293 i2400m->rx_size_acc += skb->len; 1293 i2400m->rx_size_acc += skb_len;
1294 if (skb->len < i2400m->rx_size_min) 1294 if (skb_len < i2400m->rx_size_min)
1295 i2400m->rx_size_min = skb->len; 1295 i2400m->rx_size_min = skb_len;
1296 if (skb->len > i2400m->rx_size_max) 1296 if (skb_len > i2400m->rx_size_max)
1297 i2400m->rx_size_max = skb->len; 1297 i2400m->rx_size_max = skb_len;
1298 spin_unlock_irqrestore(&i2400m->rx_lock, flags); 1298 spin_unlock_irqrestore(&i2400m->rx_lock, flags);
1299error_pl_descr_check: 1299error_pl_descr_check:
1300error_pl_descr_short: 1300error_pl_descr_short:
1301error_msg_hdr_check: 1301error_msg_hdr_check:
1302 d_fnend(4, dev, "(i2400m %p skb %p [size %zu]) = %d\n", 1302 d_fnend(4, dev, "(i2400m %p skb %p [size %u]) = %d\n",
1303 i2400m, skb, skb_len, result); 1303 i2400m, skb, skb_len, result);
1304 return result; 1304 return result;
1305} 1305}
diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c
index a105087af963..f9aa1bc0a947 100644
--- a/drivers/net/wireless/adm8211.c
+++ b/drivers/net/wireless/adm8211.c
@@ -732,7 +732,7 @@ static int adm8211_rf_set_channel(struct ieee80211_hw *dev, unsigned int chan)
732 732
733 /* Nothing to do for ADMtek BBP */ 733 /* Nothing to do for ADMtek BBP */
734 } else if (priv->bbp_type != ADM8211_TYPE_ADMTEK) 734 } else if (priv->bbp_type != ADM8211_TYPE_ADMTEK)
735 wiphy_debug(dev->wiphy, "unsupported bbp type %d\n", 735 wiphy_debug(dev->wiphy, "unsupported BBP type %d\n",
736 priv->bbp_type); 736 priv->bbp_type);
737 737
738 ADM8211_RESTORE(); 738 ADM8211_RESTORE();
@@ -1032,7 +1032,7 @@ static int adm8211_hw_init_bbp(struct ieee80211_hw *dev)
1032 break; 1032 break;
1033 } 1033 }
1034 } else 1034 } else
1035 wiphy_debug(dev->wiphy, "unsupported bbp %d\n", priv->bbp_type); 1035 wiphy_debug(dev->wiphy, "unsupported BBP %d\n", priv->bbp_type);
1036 1036
1037 ADM8211_CSR_WRITE(SYNRF, 0); 1037 ADM8211_CSR_WRITE(SYNRF, 0);
1038 1038
@@ -1525,7 +1525,7 @@ static int adm8211_start(struct ieee80211_hw *dev)
1525 retval = request_irq(priv->pdev->irq, adm8211_interrupt, 1525 retval = request_irq(priv->pdev->irq, adm8211_interrupt,
1526 IRQF_SHARED, "adm8211", dev); 1526 IRQF_SHARED, "adm8211", dev);
1527 if (retval) { 1527 if (retval) {
1528 wiphy_err(dev->wiphy, "failed to register irq handler\n"); 1528 wiphy_err(dev->wiphy, "failed to register IRQ handler\n");
1529 goto fail; 1529 goto fail;
1530 } 1530 }
1531 1531
@@ -1902,7 +1902,7 @@ static int __devinit adm8211_probe(struct pci_dev *pdev,
1902 goto err_free_eeprom; 1902 goto err_free_eeprom;
1903 } 1903 }
1904 1904
1905 wiphy_info(dev->wiphy, "hwaddr %pm, rev 0x%02x\n", 1905 wiphy_info(dev->wiphy, "hwaddr %pM, Rev 0x%02x\n",
1906 dev->wiphy->perm_addr, pdev->revision); 1906 dev->wiphy->perm_addr, pdev->revision);
1907 1907
1908 return 0; 1908 return 0;
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
index d5140a87f073..1128fa8c9ed5 100644
--- a/drivers/net/wireless/at76c50x-usb.c
+++ b/drivers/net/wireless/at76c50x-usb.c
@@ -655,7 +655,7 @@ static int at76_get_hw_config(struct at76_priv *priv)
655exit: 655exit:
656 kfree(hwcfg); 656 kfree(hwcfg);
657 if (ret < 0) 657 if (ret < 0)
658 wiphy_err(priv->hw->wiphy, "cannot get hw config (error %d)\n", 658 wiphy_err(priv->hw->wiphy, "cannot get HW Config (error %d)\n",
659 ret); 659 ret);
660 660
661 return ret; 661 return ret;
@@ -960,7 +960,7 @@ static void at76_dump_mib_mac_addr(struct at76_priv *priv)
960 sizeof(struct mib_mac_addr)); 960 sizeof(struct mib_mac_addr));
961 if (ret < 0) { 961 if (ret < 0) {
962 wiphy_err(priv->hw->wiphy, 962 wiphy_err(priv->hw->wiphy,
963 "at76_get_mib (mac_addr) failed: %d\n", ret); 963 "at76_get_mib (MAC_ADDR) failed: %d\n", ret);
964 goto exit; 964 goto exit;
965 } 965 }
966 966
@@ -989,7 +989,7 @@ static void at76_dump_mib_mac_wep(struct at76_priv *priv)
989 sizeof(struct mib_mac_wep)); 989 sizeof(struct mib_mac_wep));
990 if (ret < 0) { 990 if (ret < 0) {
991 wiphy_err(priv->hw->wiphy, 991 wiphy_err(priv->hw->wiphy,
992 "at76_get_mib (mac_wep) failed: %d\n", ret); 992 "at76_get_mib (MAC_WEP) failed: %d\n", ret);
993 goto exit; 993 goto exit;
994 } 994 }
995 995
@@ -1026,7 +1026,7 @@ static void at76_dump_mib_mac_mgmt(struct at76_priv *priv)
1026 sizeof(struct mib_mac_mgmt)); 1026 sizeof(struct mib_mac_mgmt));
1027 if (ret < 0) { 1027 if (ret < 0) {
1028 wiphy_err(priv->hw->wiphy, 1028 wiphy_err(priv->hw->wiphy,
1029 "at76_get_mib (mac_mgmt) failed: %d\n", ret); 1029 "at76_get_mib (MAC_MGMT) failed: %d\n", ret);
1030 goto exit; 1030 goto exit;
1031 } 1031 }
1032 1032
@@ -1062,7 +1062,7 @@ static void at76_dump_mib_mac(struct at76_priv *priv)
1062 ret = at76_get_mib(priv->udev, MIB_MAC, m, sizeof(struct mib_mac)); 1062 ret = at76_get_mib(priv->udev, MIB_MAC, m, sizeof(struct mib_mac));
1063 if (ret < 0) { 1063 if (ret < 0) {
1064 wiphy_err(priv->hw->wiphy, 1064 wiphy_err(priv->hw->wiphy,
1065 "at76_get_mib (mac) failed: %d\n", ret); 1065 "at76_get_mib (MAC) failed: %d\n", ret);
1066 goto exit; 1066 goto exit;
1067 } 1067 }
1068 1068
@@ -1099,7 +1099,7 @@ static void at76_dump_mib_phy(struct at76_priv *priv)
1099 ret = at76_get_mib(priv->udev, MIB_PHY, m, sizeof(struct mib_phy)); 1099 ret = at76_get_mib(priv->udev, MIB_PHY, m, sizeof(struct mib_phy));
1100 if (ret < 0) { 1100 if (ret < 0) {
1101 wiphy_err(priv->hw->wiphy, 1101 wiphy_err(priv->hw->wiphy,
1102 "at76_get_mib (phy) failed: %d\n", ret); 1102 "at76_get_mib (PHY) failed: %d\n", ret);
1103 goto exit; 1103 goto exit;
1104 } 1104 }
1105 1105
@@ -1132,7 +1132,7 @@ static void at76_dump_mib_local(struct at76_priv *priv)
1132 ret = at76_get_mib(priv->udev, MIB_LOCAL, m, sizeof(struct mib_local)); 1132 ret = at76_get_mib(priv->udev, MIB_LOCAL, m, sizeof(struct mib_local));
1133 if (ret < 0) { 1133 if (ret < 0) {
1134 wiphy_err(priv->hw->wiphy, 1134 wiphy_err(priv->hw->wiphy,
1135 "at76_get_mib (local) failed: %d\n", ret); 1135 "at76_get_mib (LOCAL) failed: %d\n", ret);
1136 goto exit; 1136 goto exit;
1137 } 1137 }
1138 1138
@@ -1158,7 +1158,7 @@ static void at76_dump_mib_mdomain(struct at76_priv *priv)
1158 sizeof(struct mib_mdomain)); 1158 sizeof(struct mib_mdomain));
1159 if (ret < 0) { 1159 if (ret < 0) {
1160 wiphy_err(priv->hw->wiphy, 1160 wiphy_err(priv->hw->wiphy,
1161 "at76_get_mib (mdomain) failed: %d\n", ret); 1161 "at76_get_mib (MDOMAIN) failed: %d\n", ret);
1162 goto exit; 1162 goto exit;
1163 } 1163 }
1164 1164
@@ -1229,7 +1229,7 @@ static int at76_submit_rx_urb(struct at76_priv *priv)
1229 struct sk_buff *skb = priv->rx_skb; 1229 struct sk_buff *skb = priv->rx_skb;
1230 1230
1231 if (!priv->rx_urb) { 1231 if (!priv->rx_urb) {
1232 wiphy_err(priv->hw->wiphy, "%s: priv->rx_urb is null\n", 1232 wiphy_err(priv->hw->wiphy, "%s: priv->rx_urb is NULL\n",
1233 __func__); 1233 __func__);
1234 return -EFAULT; 1234 return -EFAULT;
1235 } 1235 }
@@ -1792,7 +1792,7 @@ static int at76_mac80211_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
1792 wiphy_err(priv->hw->wiphy, "error in tx submit urb: %d\n", ret); 1792 wiphy_err(priv->hw->wiphy, "error in tx submit urb: %d\n", ret);
1793 if (ret == -EINVAL) 1793 if (ret == -EINVAL)
1794 wiphy_err(priv->hw->wiphy, 1794 wiphy_err(priv->hw->wiphy,
1795 "-einval: tx urb %p hcpriv %p complete %p\n", 1795 "-EINVAL: tx urb %p hcpriv %p complete %p\n",
1796 priv->tx_urb, 1796 priv->tx_urb,
1797 priv->tx_urb->hcpriv, priv->tx_urb->complete); 1797 priv->tx_urb->hcpriv, priv->tx_urb->complete);
1798 } 1798 }
@@ -2310,7 +2310,7 @@ static int at76_init_new_device(struct at76_priv *priv,
2310 2310
2311 priv->mac80211_registered = 1; 2311 priv->mac80211_registered = 1;
2312 2312
2313 wiphy_info(priv->hw->wiphy, "usb %s, mac %pm, firmware %d.%d.%d-%d\n", 2313 wiphy_info(priv->hw->wiphy, "USB %s, MAC %pM, firmware %d.%d.%d-%d\n",
2314 dev_name(&interface->dev), priv->mac_addr, 2314 dev_name(&interface->dev), priv->mac_addr,
2315 priv->fw_version.major, priv->fw_version.minor, 2315 priv->fw_version.major, priv->fw_version.minor,
2316 priv->fw_version.patch, priv->fw_version.build); 2316 priv->fw_version.patch, priv->fw_version.build);
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c
index c67b05f3bcbd..debfb0fbc7c5 100644
--- a/drivers/net/wireless/ath/ar9170/main.c
+++ b/drivers/net/wireless/ath/ar9170/main.c
@@ -245,7 +245,7 @@ static void __ar9170_dump_txstats(struct ar9170 *ar)
245{ 245{
246 int i; 246 int i;
247 247
248 wiphy_debug(ar->hw->wiphy, "qos queue stats\n"); 248 wiphy_debug(ar->hw->wiphy, "QoS queue stats\n");
249 249
250 for (i = 0; i < __AR9170_NUM_TXQ; i++) 250 for (i = 0; i < __AR9170_NUM_TXQ; i++)
251 wiphy_debug(ar->hw->wiphy, 251 wiphy_debug(ar->hw->wiphy,
@@ -387,7 +387,7 @@ static struct sk_buff *ar9170_get_queued_skb(struct ar9170 *ar,
387 if (mac && compare_ether_addr(ieee80211_get_DA(hdr), mac)) { 387 if (mac && compare_ether_addr(ieee80211_get_DA(hdr), mac)) {
388#ifdef AR9170_QUEUE_DEBUG 388#ifdef AR9170_QUEUE_DEBUG
389 wiphy_debug(ar->hw->wiphy, 389 wiphy_debug(ar->hw->wiphy,
390 "skip frame => da %pm != %pm\n", 390 "skip frame => DA %pM != %pM\n",
391 mac, ieee80211_get_DA(hdr)); 391 mac, ieee80211_get_DA(hdr));
392 ar9170_print_txheader(ar, skb); 392 ar9170_print_txheader(ar, skb);
393#endif /* AR9170_QUEUE_DEBUG */ 393#endif /* AR9170_QUEUE_DEBUG */
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 373dcfec689c..d77ce9906b6c 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -1327,6 +1327,10 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
1327 PCI_DMA_TODEVICE); 1327 PCI_DMA_TODEVICE);
1328 1328
1329 rate = ieee80211_get_tx_rate(sc->hw, info); 1329 rate = ieee80211_get_tx_rate(sc->hw, info);
1330 if (!rate) {
1331 ret = -EINVAL;
1332 goto err_unmap;
1333 }
1330 1334
1331 if (info->flags & IEEE80211_TX_CTL_NO_ACK) 1335 if (info->flags & IEEE80211_TX_CTL_NO_ACK)
1332 flags |= AR5K_TXDESC_NOACK; 1336 flags |= AR5K_TXDESC_NOACK;
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
index cc648b6ae31c..a3d95cca8f0c 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -543,7 +543,7 @@ static u8 ath9k_hw_chan_2_clockrate_mhz(struct ath_hw *ah)
543 if (conf_is_ht40(conf)) 543 if (conf_is_ht40(conf))
544 return clockrate * 2; 544 return clockrate * 2;
545 545
546 return clockrate * 2; 546 return clockrate;
547} 547}
548 548
549static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah) 549static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah)
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index b883b174385b..057fb69ddf7f 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -797,7 +797,7 @@ static bool ar9300_uncompress_block(struct ath_hw *ah,
797 length = block[it+1]; 797 length = block[it+1];
798 length &= 0xff; 798 length &= 0xff;
799 799
800 if (length > 0 && spot >= 0 && spot+length < mdataSize) { 800 if (length > 0 && spot >= 0 && spot+length <= mdataSize) {
801 ath_print(common, ATH_DBG_EEPROM, 801 ath_print(common, ATH_DBG_EEPROM,
802 "Restore at %d: spot=%d " 802 "Restore at %d: spot=%d "
803 "offset=%d length=%d\n", 803 "offset=%d length=%d\n",
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h
index 7f48df1e2903..0b09db0f8e7d 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.h
+++ b/drivers/net/wireless/ath/ath9k/eeprom.h
@@ -62,7 +62,7 @@
62 62
63#define SD_NO_CTL 0xE0 63#define SD_NO_CTL 0xE0
64#define NO_CTL 0xff 64#define NO_CTL 0xff
65#define CTL_MODE_M 7 65#define CTL_MODE_M 0xf
66#define CTL_11A 0 66#define CTL_11A 0
67#define CTL_11B 1 67#define CTL_11B 1
68#define CTL_11G 2 68#define CTL_11G 2
diff --git a/drivers/net/wireless/ath/regd.h b/drivers/net/wireless/ath/regd.h
index a1c39526161a..345dd9721b41 100644
--- a/drivers/net/wireless/ath/regd.h
+++ b/drivers/net/wireless/ath/regd.h
@@ -31,7 +31,6 @@ enum ctl_group {
31#define NO_CTL 0xff 31#define NO_CTL 0xff
32#define SD_NO_CTL 0xE0 32#define SD_NO_CTL 0xE0
33#define NO_CTL 0xff 33#define NO_CTL 0xff
34#define CTL_MODE_M 7
35#define CTL_11A 0 34#define CTL_11A 0
36#define CTL_11B 1 35#define CTL_11B 1
37#define CTL_11G 2 36#define CTL_11G 2
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index 1189dbb6e2a6..996e9d7d7586 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -2723,14 +2723,6 @@ static void __ipw2100_rx_process(struct ipw2100_priv *priv)
2723 2723
2724 packet = &priv->rx_buffers[i]; 2724 packet = &priv->rx_buffers[i];
2725 2725
2726 /* Sync the DMA for the STATUS buffer so CPU is sure to get
2727 * the correct values */
2728 pci_dma_sync_single_for_cpu(priv->pci_dev,
2729 sq->nic +
2730 sizeof(struct ipw2100_status) * i,
2731 sizeof(struct ipw2100_status),
2732 PCI_DMA_FROMDEVICE);
2733
2734 /* Sync the DMA for the RX buffer so CPU is sure to get 2726 /* Sync the DMA for the RX buffer so CPU is sure to get
2735 * the correct values */ 2727 * the correct values */
2736 pci_dma_sync_single_for_cpu(priv->pci_dev, packet->dma_addr, 2728 pci_dma_sync_single_for_cpu(priv->pci_dev, packet->dma_addr,
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index fec026212326..0b779a41a142 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -265,7 +265,7 @@ struct iwl_cfg iwl1000_bgn_cfg = {
265 .support_ct_kill_exit = true, 265 .support_ct_kill_exit = true,
266 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF, 266 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF,
267 .chain_noise_scale = 1000, 267 .chain_noise_scale = 1000,
268 .monitor_recover_period = IWL_MONITORING_PERIOD, 268 .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
269 .max_event_log_size = 128, 269 .max_event_log_size = 128,
270 .ucode_tracing = true, 270 .ucode_tracing = true,
271 .sensitivity_calib_by_driver = true, 271 .sensitivity_calib_by_driver = true,
@@ -297,7 +297,7 @@ struct iwl_cfg iwl1000_bg_cfg = {
297 .support_ct_kill_exit = true, 297 .support_ct_kill_exit = true,
298 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF, 298 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF,
299 .chain_noise_scale = 1000, 299 .chain_noise_scale = 1000,
300 .monitor_recover_period = IWL_MONITORING_PERIOD, 300 .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
301 .max_event_log_size = 128, 301 .max_event_log_size = 128,
302 .ucode_tracing = true, 302 .ucode_tracing = true,
303 .sensitivity_calib_by_driver = true, 303 .sensitivity_calib_by_driver = true,
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 6950a783913b..8ccfcd08218d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -2731,7 +2731,7 @@ static struct iwl_cfg iwl3945_bg_cfg = {
2731 .led_compensation = 64, 2731 .led_compensation = 64,
2732 .broken_powersave = true, 2732 .broken_powersave = true,
2733 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 2733 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
2734 .monitor_recover_period = IWL_MONITORING_PERIOD, 2734 .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
2735 .max_event_log_size = 512, 2735 .max_event_log_size = 512,
2736 .tx_power_by_driver = true, 2736 .tx_power_by_driver = true,
2737}; 2737};
@@ -2752,7 +2752,7 @@ static struct iwl_cfg iwl3945_abg_cfg = {
2752 .led_compensation = 64, 2752 .led_compensation = 64,
2753 .broken_powersave = true, 2753 .broken_powersave = true,
2754 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 2754 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
2755 .monitor_recover_period = IWL_MONITORING_PERIOD, 2755 .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
2756 .max_event_log_size = 512, 2756 .max_event_log_size = 512,
2757 .tx_power_by_driver = true, 2757 .tx_power_by_driver = true,
2758}; 2758};
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index d6da356608fa..d92b72909233 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2322,7 +2322,7 @@ struct iwl_cfg iwl4965_agn_cfg = {
2322 .led_compensation = 61, 2322 .led_compensation = 61,
2323 .chain_noise_num_beacons = IWL4965_CAL_NUM_BEACONS, 2323 .chain_noise_num_beacons = IWL4965_CAL_NUM_BEACONS,
2324 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 2324 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
2325 .monitor_recover_period = IWL_MONITORING_PERIOD, 2325 .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
2326 .temperature_kelvin = true, 2326 .temperature_kelvin = true,
2327 .max_event_log_size = 512, 2327 .max_event_log_size = 512,
2328 .tx_power_by_driver = true, 2328 .tx_power_by_driver = true,
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index aacf3770f075..48bdcd8d2e94 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -510,7 +510,7 @@ struct iwl_cfg iwl5300_agn_cfg = {
510 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 510 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
511 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 511 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
512 .chain_noise_scale = 1000, 512 .chain_noise_scale = 1000,
513 .monitor_recover_period = IWL_MONITORING_PERIOD, 513 .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
514 .max_event_log_size = 512, 514 .max_event_log_size = 512,
515 .ucode_tracing = true, 515 .ucode_tracing = true,
516 .sensitivity_calib_by_driver = true, 516 .sensitivity_calib_by_driver = true,
@@ -541,7 +541,7 @@ struct iwl_cfg iwl5100_bgn_cfg = {
541 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 541 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
542 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 542 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
543 .chain_noise_scale = 1000, 543 .chain_noise_scale = 1000,
544 .monitor_recover_period = IWL_MONITORING_PERIOD, 544 .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
545 .max_event_log_size = 512, 545 .max_event_log_size = 512,
546 .ucode_tracing = true, 546 .ucode_tracing = true,
547 .sensitivity_calib_by_driver = true, 547 .sensitivity_calib_by_driver = true,
@@ -570,7 +570,7 @@ struct iwl_cfg iwl5100_abg_cfg = {
570 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 570 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
571 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 571 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
572 .chain_noise_scale = 1000, 572 .chain_noise_scale = 1000,
573 .monitor_recover_period = IWL_MONITORING_PERIOD, 573 .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
574 .max_event_log_size = 512, 574 .max_event_log_size = 512,
575 .ucode_tracing = true, 575 .ucode_tracing = true,
576 .sensitivity_calib_by_driver = true, 576 .sensitivity_calib_by_driver = true,
@@ -601,7 +601,7 @@ struct iwl_cfg iwl5100_agn_cfg = {
601 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 601 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
602 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 602 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
603 .chain_noise_scale = 1000, 603 .chain_noise_scale = 1000,
604 .monitor_recover_period = IWL_MONITORING_PERIOD, 604 .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
605 .max_event_log_size = 512, 605 .max_event_log_size = 512,
606 .ucode_tracing = true, 606 .ucode_tracing = true,
607 .sensitivity_calib_by_driver = true, 607 .sensitivity_calib_by_driver = true,
@@ -632,7 +632,7 @@ struct iwl_cfg iwl5350_agn_cfg = {
632 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 632 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
633 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 633 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
634 .chain_noise_scale = 1000, 634 .chain_noise_scale = 1000,
635 .monitor_recover_period = IWL_MONITORING_PERIOD, 635 .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
636 .max_event_log_size = 512, 636 .max_event_log_size = 512,
637 .ucode_tracing = true, 637 .ucode_tracing = true,
638 .sensitivity_calib_by_driver = true, 638 .sensitivity_calib_by_driver = true,
@@ -663,7 +663,7 @@ struct iwl_cfg iwl5150_agn_cfg = {
663 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 663 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
664 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 664 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
665 .chain_noise_scale = 1000, 665 .chain_noise_scale = 1000,
666 .monitor_recover_period = IWL_MONITORING_PERIOD, 666 .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
667 .max_event_log_size = 512, 667 .max_event_log_size = 512,
668 .ucode_tracing = true, 668 .ucode_tracing = true,
669 .sensitivity_calib_by_driver = true, 669 .sensitivity_calib_by_driver = true,
@@ -693,7 +693,7 @@ struct iwl_cfg iwl5150_abg_cfg = {
693 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 693 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
694 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 694 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
695 .chain_noise_scale = 1000, 695 .chain_noise_scale = 1000,
696 .monitor_recover_period = IWL_MONITORING_PERIOD, 696 .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
697 .max_event_log_size = 512, 697 .max_event_log_size = 512,
698 .ucode_tracing = true, 698 .ucode_tracing = true,
699 .sensitivity_calib_by_driver = true, 699 .sensitivity_calib_by_driver = true,
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index af4fd50f3405..cee06b968de8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -388,7 +388,7 @@ struct iwl_cfg iwl6000g2a_2agn_cfg = {
388 .support_ct_kill_exit = true, 388 .support_ct_kill_exit = true,
389 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 389 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
390 .chain_noise_scale = 1000, 390 .chain_noise_scale = 1000,
391 .monitor_recover_period = IWL_MONITORING_PERIOD, 391 .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
392 .max_event_log_size = 512, 392 .max_event_log_size = 512,
393 .ucode_tracing = true, 393 .ucode_tracing = true,
394 .sensitivity_calib_by_driver = true, 394 .sensitivity_calib_by_driver = true,
@@ -424,7 +424,7 @@ struct iwl_cfg iwl6000g2a_2abg_cfg = {
424 .support_ct_kill_exit = true, 424 .support_ct_kill_exit = true,
425 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 425 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
426 .chain_noise_scale = 1000, 426 .chain_noise_scale = 1000,
427 .monitor_recover_period = IWL_MONITORING_PERIOD, 427 .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
428 .max_event_log_size = 512, 428 .max_event_log_size = 512,
429 .sensitivity_calib_by_driver = true, 429 .sensitivity_calib_by_driver = true,
430 .chain_noise_calib_by_driver = true, 430 .chain_noise_calib_by_driver = true,
@@ -459,7 +459,7 @@ struct iwl_cfg iwl6000g2a_2bg_cfg = {
459 .support_ct_kill_exit = true, 459 .support_ct_kill_exit = true,
460 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 460 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
461 .chain_noise_scale = 1000, 461 .chain_noise_scale = 1000,
462 .monitor_recover_period = IWL_MONITORING_PERIOD, 462 .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
463 .max_event_log_size = 512, 463 .max_event_log_size = 512,
464 .sensitivity_calib_by_driver = true, 464 .sensitivity_calib_by_driver = true,
465 .chain_noise_calib_by_driver = true, 465 .chain_noise_calib_by_driver = true,
@@ -496,7 +496,7 @@ struct iwl_cfg iwl6000g2b_2agn_cfg = {
496 .support_ct_kill_exit = true, 496 .support_ct_kill_exit = true,
497 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 497 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
498 .chain_noise_scale = 1000, 498 .chain_noise_scale = 1000,
499 .monitor_recover_period = IWL_MONITORING_PERIOD, 499 .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
500 .max_event_log_size = 512, 500 .max_event_log_size = 512,
501 .sensitivity_calib_by_driver = true, 501 .sensitivity_calib_by_driver = true,
502 .chain_noise_calib_by_driver = true, 502 .chain_noise_calib_by_driver = true,
@@ -532,7 +532,7 @@ struct iwl_cfg iwl6000g2b_2abg_cfg = {
532 .support_ct_kill_exit = true, 532 .support_ct_kill_exit = true,
533 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 533 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
534 .chain_noise_scale = 1000, 534 .chain_noise_scale = 1000,
535 .monitor_recover_period = IWL_MONITORING_PERIOD, 535 .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
536 .max_event_log_size = 512, 536 .max_event_log_size = 512,
537 .sensitivity_calib_by_driver = true, 537 .sensitivity_calib_by_driver = true,
538 .chain_noise_calib_by_driver = true, 538 .chain_noise_calib_by_driver = true,
@@ -570,7 +570,7 @@ struct iwl_cfg iwl6000g2b_2bgn_cfg = {
570 .support_ct_kill_exit = true, 570 .support_ct_kill_exit = true,
571 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 571 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
572 .chain_noise_scale = 1000, 572 .chain_noise_scale = 1000,
573 .monitor_recover_period = IWL_MONITORING_PERIOD, 573 .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
574 .max_event_log_size = 512, 574 .max_event_log_size = 512,
575 .sensitivity_calib_by_driver = true, 575 .sensitivity_calib_by_driver = true,
576 .chain_noise_calib_by_driver = true, 576 .chain_noise_calib_by_driver = true,
@@ -606,7 +606,7 @@ struct iwl_cfg iwl6000g2b_2bg_cfg = {
606 .support_ct_kill_exit = true, 606 .support_ct_kill_exit = true,
607 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 607 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
608 .chain_noise_scale = 1000, 608 .chain_noise_scale = 1000,
609 .monitor_recover_period = IWL_MONITORING_PERIOD, 609 .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
610 .max_event_log_size = 512, 610 .max_event_log_size = 512,
611 .sensitivity_calib_by_driver = true, 611 .sensitivity_calib_by_driver = true,
612 .chain_noise_calib_by_driver = true, 612 .chain_noise_calib_by_driver = true,
@@ -644,7 +644,7 @@ struct iwl_cfg iwl6000g2b_bgn_cfg = {
644 .support_ct_kill_exit = true, 644 .support_ct_kill_exit = true,
645 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 645 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
646 .chain_noise_scale = 1000, 646 .chain_noise_scale = 1000,
647 .monitor_recover_period = IWL_MONITORING_PERIOD, 647 .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
648 .max_event_log_size = 512, 648 .max_event_log_size = 512,
649 .sensitivity_calib_by_driver = true, 649 .sensitivity_calib_by_driver = true,
650 .chain_noise_calib_by_driver = true, 650 .chain_noise_calib_by_driver = true,
@@ -680,7 +680,7 @@ struct iwl_cfg iwl6000g2b_bg_cfg = {
680 .support_ct_kill_exit = true, 680 .support_ct_kill_exit = true,
681 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 681 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
682 .chain_noise_scale = 1000, 682 .chain_noise_scale = 1000,
683 .monitor_recover_period = IWL_MONITORING_PERIOD, 683 .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
684 .max_event_log_size = 512, 684 .max_event_log_size = 512,
685 .sensitivity_calib_by_driver = true, 685 .sensitivity_calib_by_driver = true,
686 .chain_noise_calib_by_driver = true, 686 .chain_noise_calib_by_driver = true,
@@ -721,7 +721,7 @@ struct iwl_cfg iwl6000i_2agn_cfg = {
721 .support_ct_kill_exit = true, 721 .support_ct_kill_exit = true,
722 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 722 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
723 .chain_noise_scale = 1000, 723 .chain_noise_scale = 1000,
724 .monitor_recover_period = IWL_MONITORING_PERIOD, 724 .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
725 .max_event_log_size = 1024, 725 .max_event_log_size = 1024,
726 .ucode_tracing = true, 726 .ucode_tracing = true,
727 .sensitivity_calib_by_driver = true, 727 .sensitivity_calib_by_driver = true,
@@ -756,7 +756,7 @@ struct iwl_cfg iwl6000i_2abg_cfg = {
756 .support_ct_kill_exit = true, 756 .support_ct_kill_exit = true,
757 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 757 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
758 .chain_noise_scale = 1000, 758 .chain_noise_scale = 1000,
759 .monitor_recover_period = IWL_MONITORING_PERIOD, 759 .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
760 .max_event_log_size = 1024, 760 .max_event_log_size = 1024,
761 .ucode_tracing = true, 761 .ucode_tracing = true,
762 .sensitivity_calib_by_driver = true, 762 .sensitivity_calib_by_driver = true,
@@ -791,7 +791,7 @@ struct iwl_cfg iwl6000i_2bg_cfg = {
791 .support_ct_kill_exit = true, 791 .support_ct_kill_exit = true,
792 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 792 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
793 .chain_noise_scale = 1000, 793 .chain_noise_scale = 1000,
794 .monitor_recover_period = IWL_MONITORING_PERIOD, 794 .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
795 .max_event_log_size = 1024, 795 .max_event_log_size = 1024,
796 .ucode_tracing = true, 796 .ucode_tracing = true,
797 .sensitivity_calib_by_driver = true, 797 .sensitivity_calib_by_driver = true,
@@ -828,7 +828,7 @@ struct iwl_cfg iwl6050_2agn_cfg = {
828 .support_ct_kill_exit = true, 828 .support_ct_kill_exit = true,
829 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 829 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
830 .chain_noise_scale = 1500, 830 .chain_noise_scale = 1500,
831 .monitor_recover_period = IWL_MONITORING_PERIOD, 831 .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
832 .max_event_log_size = 1024, 832 .max_event_log_size = 1024,
833 .ucode_tracing = true, 833 .ucode_tracing = true,
834 .sensitivity_calib_by_driver = true, 834 .sensitivity_calib_by_driver = true,
@@ -866,7 +866,7 @@ struct iwl_cfg iwl6050g2_bgn_cfg = {
866 .support_ct_kill_exit = true, 866 .support_ct_kill_exit = true,
867 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 867 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
868 .chain_noise_scale = 1500, 868 .chain_noise_scale = 1500,
869 .monitor_recover_period = IWL_MONITORING_PERIOD, 869 .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
870 .max_event_log_size = 1024, 870 .max_event_log_size = 1024,
871 .ucode_tracing = true, 871 .ucode_tracing = true,
872 .sensitivity_calib_by_driver = true, 872 .sensitivity_calib_by_driver = true,
@@ -902,7 +902,7 @@ struct iwl_cfg iwl6050_2abg_cfg = {
902 .support_ct_kill_exit = true, 902 .support_ct_kill_exit = true,
903 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 903 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
904 .chain_noise_scale = 1500, 904 .chain_noise_scale = 1500,
905 .monitor_recover_period = IWL_MONITORING_PERIOD, 905 .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
906 .max_event_log_size = 1024, 906 .max_event_log_size = 1024,
907 .ucode_tracing = true, 907 .ucode_tracing = true,
908 .sensitivity_calib_by_driver = true, 908 .sensitivity_calib_by_driver = true,
@@ -940,7 +940,7 @@ struct iwl_cfg iwl6000_3agn_cfg = {
940 .support_ct_kill_exit = true, 940 .support_ct_kill_exit = true,
941 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 941 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
942 .chain_noise_scale = 1000, 942 .chain_noise_scale = 1000,
943 .monitor_recover_period = IWL_MONITORING_PERIOD, 943 .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
944 .max_event_log_size = 1024, 944 .max_event_log_size = 1024,
945 .ucode_tracing = true, 945 .ucode_tracing = true,
946 .sensitivity_calib_by_driver = true, 946 .sensitivity_calib_by_driver = true,
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index 9dd9e64c2b0b..8fd00a6e5120 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -1411,7 +1411,7 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
1411 clear_bit(STATUS_SCAN_HW, &priv->status); 1411 clear_bit(STATUS_SCAN_HW, &priv->status);
1412 clear_bit(STATUS_SCANNING, &priv->status); 1412 clear_bit(STATUS_SCANNING, &priv->status);
1413 /* inform mac80211 scan aborted */ 1413 /* inform mac80211 scan aborted */
1414 queue_work(priv->workqueue, &priv->scan_completed); 1414 queue_work(priv->workqueue, &priv->abort_scan);
1415} 1415}
1416 1416
1417int iwlagn_manage_ibss_station(struct iwl_priv *priv, 1417int iwlagn_manage_ibss_station(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index c1882fd8345d..10d7b9b7f064 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3667,6 +3667,49 @@ out_exit:
3667 IWL_DEBUG_MAC80211(priv, "leave\n"); 3667 IWL_DEBUG_MAC80211(priv, "leave\n");
3668} 3668}
3669 3669
3670static void iwlagn_configure_filter(struct ieee80211_hw *hw,
3671 unsigned int changed_flags,
3672 unsigned int *total_flags,
3673 u64 multicast)
3674{
3675 struct iwl_priv *priv = hw->priv;
3676 __le32 filter_or = 0, filter_nand = 0;
3677
3678#define CHK(test, flag) do { \
3679 if (*total_flags & (test)) \
3680 filter_or |= (flag); \
3681 else \
3682 filter_nand |= (flag); \
3683 } while (0)
3684
3685 IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n",
3686 changed_flags, *total_flags);
3687
3688 CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK);
3689 CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK);
3690 CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK);
3691
3692#undef CHK
3693
3694 mutex_lock(&priv->mutex);
3695
3696 priv->staging_rxon.filter_flags &= ~filter_nand;
3697 priv->staging_rxon.filter_flags |= filter_or;
3698
3699 iwlcore_commit_rxon(priv);
3700
3701 mutex_unlock(&priv->mutex);
3702
3703 /*
3704 * Receiving all multicast frames is always enabled by the
3705 * default flags setup in iwl_connection_init_rx_config()
3706 * since we currently do not support programming multicast
3707 * filters into the device.
3708 */
3709 *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS |
3710 FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL;
3711}
3712
3670static void iwl_mac_flush(struct ieee80211_hw *hw, bool drop) 3713static void iwl_mac_flush(struct ieee80211_hw *hw, bool drop)
3671{ 3714{
3672 struct iwl_priv *priv = hw->priv; 3715 struct iwl_priv *priv = hw->priv;
@@ -3867,7 +3910,7 @@ static struct ieee80211_ops iwl_hw_ops = {
3867 .add_interface = iwl_mac_add_interface, 3910 .add_interface = iwl_mac_add_interface,
3868 .remove_interface = iwl_mac_remove_interface, 3911 .remove_interface = iwl_mac_remove_interface,
3869 .config = iwl_mac_config, 3912 .config = iwl_mac_config,
3870 .configure_filter = iwl_configure_filter, 3913 .configure_filter = iwlagn_configure_filter,
3871 .set_key = iwl_mac_set_key, 3914 .set_key = iwl_mac_set_key,
3872 .update_tkip_key = iwl_mac_update_tkip_key, 3915 .update_tkip_key = iwl_mac_update_tkip_key,
3873 .conf_tx = iwl_mac_conf_tx, 3916 .conf_tx = iwl_mac_conf_tx,
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 2c03c6e20a72..e23c4060a0f0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1328,51 +1328,6 @@ out:
1328EXPORT_SYMBOL(iwl_apm_init); 1328EXPORT_SYMBOL(iwl_apm_init);
1329 1329
1330 1330
1331
1332void iwl_configure_filter(struct ieee80211_hw *hw,
1333 unsigned int changed_flags,
1334 unsigned int *total_flags,
1335 u64 multicast)
1336{
1337 struct iwl_priv *priv = hw->priv;
1338 __le32 filter_or = 0, filter_nand = 0;
1339
1340#define CHK(test, flag) do { \
1341 if (*total_flags & (test)) \
1342 filter_or |= (flag); \
1343 else \
1344 filter_nand |= (flag); \
1345 } while (0)
1346
1347 IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n",
1348 changed_flags, *total_flags);
1349
1350 CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK);
1351 CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK);
1352 CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK);
1353
1354#undef CHK
1355
1356 mutex_lock(&priv->mutex);
1357
1358 priv->staging_rxon.filter_flags &= ~filter_nand;
1359 priv->staging_rxon.filter_flags |= filter_or;
1360
1361 iwlcore_commit_rxon(priv);
1362
1363 mutex_unlock(&priv->mutex);
1364
1365 /*
1366 * Receiving all multicast frames is always enabled by the
1367 * default flags setup in iwl_connection_init_rx_config()
1368 * since we currently do not support programming multicast
1369 * filters into the device.
1370 */
1371 *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS |
1372 FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL;
1373}
1374EXPORT_SYMBOL(iwl_configure_filter);
1375
1376int iwl_set_hw_params(struct iwl_priv *priv) 1331int iwl_set_hw_params(struct iwl_priv *priv)
1377{ 1332{
1378 priv->hw_params.max_rxq_size = RX_QUEUE_SIZE; 1333 priv->hw_params.max_rxq_size = RX_QUEUE_SIZE;
@@ -2658,6 +2613,11 @@ int iwl_force_reset(struct iwl_priv *priv, int mode, bool external)
2658 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2613 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2659 return -EINVAL; 2614 return -EINVAL;
2660 2615
2616 if (test_bit(STATUS_SCANNING, &priv->status)) {
2617 IWL_DEBUG_INFO(priv, "scan in progress.\n");
2618 return -EINVAL;
2619 }
2620
2661 if (mode >= IWL_MAX_FORCE_RESET) { 2621 if (mode >= IWL_MAX_FORCE_RESET) {
2662 IWL_DEBUG_INFO(priv, "invalid reset request.\n"); 2622 IWL_DEBUG_INFO(priv, "invalid reset request.\n");
2663 return -EINVAL; 2623 return -EINVAL;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 4a71dfb10a15..5e6ee3da6bbf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -372,9 +372,6 @@ int iwl_set_decrypted_flag(struct iwl_priv *priv,
372 u32 decrypt_res, 372 u32 decrypt_res,
373 struct ieee80211_rx_status *stats); 373 struct ieee80211_rx_status *stats);
374void iwl_irq_handle_error(struct iwl_priv *priv); 374void iwl_irq_handle_error(struct iwl_priv *priv);
375void iwl_configure_filter(struct ieee80211_hw *hw,
376 unsigned int changed_flags,
377 unsigned int *total_flags, u64 multicast);
378int iwl_set_hw_params(struct iwl_priv *priv); 375int iwl_set_hw_params(struct iwl_priv *priv);
379void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif); 376void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif);
380void iwl_bss_info_changed(struct ieee80211_hw *hw, 377void iwl_bss_info_changed(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index f35bcad56e36..2e97cd2fa98a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1049,7 +1049,8 @@ struct iwl_event_log {
1049#define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5) 1049#define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5)
1050 1050
1051/* timer constants use to monitor and recover stuck tx queues in mSecs */ 1051/* timer constants use to monitor and recover stuck tx queues in mSecs */
1052#define IWL_MONITORING_PERIOD (1000) 1052#define IWL_DEF_MONITORING_PERIOD (1000)
1053#define IWL_LONG_MONITORING_PERIOD (5000)
1053#define IWL_ONE_HUNDRED_MSECS (100) 1054#define IWL_ONE_HUNDRED_MSECS (100)
1054#define IWL_SIXTY_SECS (60000) 1055#define IWL_SIXTY_SECS (60000)
1055 1056
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 70c4b8fba0ee..d31661c1ce77 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -3018,7 +3018,7 @@ void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
3018 clear_bit(STATUS_SCANNING, &priv->status); 3018 clear_bit(STATUS_SCANNING, &priv->status);
3019 3019
3020 /* inform mac80211 scan aborted */ 3020 /* inform mac80211 scan aborted */
3021 queue_work(priv->workqueue, &priv->scan_completed); 3021 queue_work(priv->workqueue, &priv->abort_scan);
3022} 3022}
3023 3023
3024static void iwl3945_bg_restart(struct work_struct *data) 3024static void iwl3945_bg_restart(struct work_struct *data)
@@ -3391,6 +3391,55 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw,
3391 3391
3392 return 0; 3392 return 0;
3393} 3393}
3394
3395static void iwl3945_configure_filter(struct ieee80211_hw *hw,
3396 unsigned int changed_flags,
3397 unsigned int *total_flags,
3398 u64 multicast)
3399{
3400 struct iwl_priv *priv = hw->priv;
3401 __le32 filter_or = 0, filter_nand = 0;
3402
3403#define CHK(test, flag) do { \
3404 if (*total_flags & (test)) \
3405 filter_or |= (flag); \
3406 else \
3407 filter_nand |= (flag); \
3408 } while (0)
3409
3410 IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n",
3411 changed_flags, *total_flags);
3412
3413 CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK);
3414 CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK);
3415 CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK);
3416
3417#undef CHK
3418
3419 mutex_lock(&priv->mutex);
3420
3421 priv->staging_rxon.filter_flags &= ~filter_nand;
3422 priv->staging_rxon.filter_flags |= filter_or;
3423
3424 /*
3425 * Committing directly here breaks for some reason,
3426 * but we'll eventually commit the filter flags
3427 * change anyway.
3428 */
3429
3430 mutex_unlock(&priv->mutex);
3431
3432 /*
3433 * Receiving all multicast frames is always enabled by the
3434 * default flags setup in iwl_connection_init_rx_config()
3435 * since we currently do not support programming multicast
3436 * filters into the device.
3437 */
3438 *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS |
3439 FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL;
3440}
3441
3442
3394/***************************************************************************** 3443/*****************************************************************************
3395 * 3444 *
3396 * sysfs attributes 3445 * sysfs attributes
@@ -3796,7 +3845,7 @@ static struct ieee80211_ops iwl3945_hw_ops = {
3796 .add_interface = iwl_mac_add_interface, 3845 .add_interface = iwl_mac_add_interface,
3797 .remove_interface = iwl_mac_remove_interface, 3846 .remove_interface = iwl_mac_remove_interface,
3798 .config = iwl_mac_config, 3847 .config = iwl_mac_config,
3799 .configure_filter = iwl_configure_filter, 3848 .configure_filter = iwl3945_configure_filter,
3800 .set_key = iwl3945_mac_set_key, 3849 .set_key = iwl3945_mac_set_key,
3801 .conf_tx = iwl_mac_conf_tx, 3850 .conf_tx = iwl_mac_conf_tx,
3802 .reset_tsf = iwl_mac_reset_tsf, 3851 .reset_tsf = iwl_mac_reset_tsf,
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index ba854c70ab94..87b634978b35 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -128,7 +128,7 @@ struct if_sdio_card {
128 bool helper_allocated; 128 bool helper_allocated;
129 bool firmware_allocated; 129 bool firmware_allocated;
130 130
131 u8 buffer[65536]; 131 u8 buffer[65536] __attribute__((aligned(4)));
132 132
133 spinlock_t lock; 133 spinlock_t lock;
134 struct if_sdio_packet *packets; 134 struct if_sdio_packet *packets;
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 01ad7f77383a..86fa8abdd66f 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -486,7 +486,7 @@ static bool mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,
486 struct ieee80211_rx_status rx_status; 486 struct ieee80211_rx_status rx_status;
487 487
488 if (data->idle) { 488 if (data->idle) {
489 wiphy_debug(hw->wiphy, "trying to tx when idle - reject\n"); 489 wiphy_debug(hw->wiphy, "Trying to TX when idle - reject\n");
490 return false; 490 return false;
491 } 491 }
492 492
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index d761ed2d8af4..f152a25be59f 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -910,14 +910,14 @@ static int mwl8k_rxq_init(struct ieee80211_hw *hw, int index)
910 910
911 rxq->rxd = pci_alloc_consistent(priv->pdev, size, &rxq->rxd_dma); 911 rxq->rxd = pci_alloc_consistent(priv->pdev, size, &rxq->rxd_dma);
912 if (rxq->rxd == NULL) { 912 if (rxq->rxd == NULL) {
913 wiphy_err(hw->wiphy, "failed to alloc rx descriptors\n"); 913 wiphy_err(hw->wiphy, "failed to alloc RX descriptors\n");
914 return -ENOMEM; 914 return -ENOMEM;
915 } 915 }
916 memset(rxq->rxd, 0, size); 916 memset(rxq->rxd, 0, size);
917 917
918 rxq->buf = kmalloc(MWL8K_RX_DESCS * sizeof(*rxq->buf), GFP_KERNEL); 918 rxq->buf = kmalloc(MWL8K_RX_DESCS * sizeof(*rxq->buf), GFP_KERNEL);
919 if (rxq->buf == NULL) { 919 if (rxq->buf == NULL) {
920 wiphy_err(hw->wiphy, "failed to alloc rx skbuff list\n"); 920 wiphy_err(hw->wiphy, "failed to alloc RX skbuff list\n");
921 pci_free_consistent(priv->pdev, size, rxq->rxd, rxq->rxd_dma); 921 pci_free_consistent(priv->pdev, size, rxq->rxd, rxq->rxd_dma);
922 return -ENOMEM; 922 return -ENOMEM;
923 } 923 }
@@ -1145,14 +1145,14 @@ static int mwl8k_txq_init(struct ieee80211_hw *hw, int index)
1145 1145
1146 txq->txd = pci_alloc_consistent(priv->pdev, size, &txq->txd_dma); 1146 txq->txd = pci_alloc_consistent(priv->pdev, size, &txq->txd_dma);
1147 if (txq->txd == NULL) { 1147 if (txq->txd == NULL) {
1148 wiphy_err(hw->wiphy, "failed to alloc tx descriptors\n"); 1148 wiphy_err(hw->wiphy, "failed to alloc TX descriptors\n");
1149 return -ENOMEM; 1149 return -ENOMEM;
1150 } 1150 }
1151 memset(txq->txd, 0, size); 1151 memset(txq->txd, 0, size);
1152 1152
1153 txq->skb = kmalloc(MWL8K_TX_DESCS * sizeof(*txq->skb), GFP_KERNEL); 1153 txq->skb = kmalloc(MWL8K_TX_DESCS * sizeof(*txq->skb), GFP_KERNEL);
1154 if (txq->skb == NULL) { 1154 if (txq->skb == NULL) {
1155 wiphy_err(hw->wiphy, "failed to alloc tx skbuff list\n"); 1155 wiphy_err(hw->wiphy, "failed to alloc TX skbuff list\n");
1156 pci_free_consistent(priv->pdev, size, txq->txd, txq->txd_dma); 1156 pci_free_consistent(priv->pdev, size, txq->txd, txq->txd_dma);
1157 return -ENOMEM; 1157 return -ENOMEM;
1158 } 1158 }
@@ -1573,7 +1573,7 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd)
1573 PCI_DMA_BIDIRECTIONAL); 1573 PCI_DMA_BIDIRECTIONAL);
1574 1574
1575 if (!timeout) { 1575 if (!timeout) {
1576 wiphy_err(hw->wiphy, "command %s timeout after %u ms\n", 1576 wiphy_err(hw->wiphy, "Command %s timeout after %u ms\n",
1577 mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), 1577 mwl8k_cmd_name(cmd->code, buf, sizeof(buf)),
1578 MWL8K_CMD_TIMEOUT_MS); 1578 MWL8K_CMD_TIMEOUT_MS);
1579 rc = -ETIMEDOUT; 1579 rc = -ETIMEDOUT;
@@ -1584,11 +1584,11 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd)
1584 1584
1585 rc = cmd->result ? -EINVAL : 0; 1585 rc = cmd->result ? -EINVAL : 0;
1586 if (rc) 1586 if (rc)
1587 wiphy_err(hw->wiphy, "command %s error 0x%x\n", 1587 wiphy_err(hw->wiphy, "Command %s error 0x%x\n",
1588 mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), 1588 mwl8k_cmd_name(cmd->code, buf, sizeof(buf)),
1589 le16_to_cpu(cmd->result)); 1589 le16_to_cpu(cmd->result));
1590 else if (ms > 2000) 1590 else if (ms > 2000)
1591 wiphy_notice(hw->wiphy, "command %s took %d ms\n", 1591 wiphy_notice(hw->wiphy, "Command %s took %d ms\n",
1592 mwl8k_cmd_name(cmd->code, 1592 mwl8k_cmd_name(cmd->code,
1593 buf, sizeof(buf)), 1593 buf, sizeof(buf)),
1594 ms); 1594 ms);
@@ -3210,7 +3210,7 @@ static int mwl8k_start(struct ieee80211_hw *hw)
3210 rc = request_irq(priv->pdev->irq, mwl8k_interrupt, 3210 rc = request_irq(priv->pdev->irq, mwl8k_interrupt,
3211 IRQF_SHARED, MWL8K_NAME, hw); 3211 IRQF_SHARED, MWL8K_NAME, hw);
3212 if (rc) { 3212 if (rc) {
3213 wiphy_err(hw->wiphy, "failed to register irq handler\n"); 3213 wiphy_err(hw->wiphy, "failed to register IRQ handler\n");
3214 return -EIO; 3214 return -EIO;
3215 } 3215 }
3216 3216
@@ -3926,7 +3926,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev,
3926 3926
3927 priv->sram = pci_iomap(pdev, 0, 0x10000); 3927 priv->sram = pci_iomap(pdev, 0, 0x10000);
3928 if (priv->sram == NULL) { 3928 if (priv->sram == NULL) {
3929 wiphy_err(hw->wiphy, "cannot map device sram\n"); 3929 wiphy_err(hw->wiphy, "Cannot map device SRAM\n");
3930 goto err_iounmap; 3930 goto err_iounmap;
3931 } 3931 }
3932 3932
@@ -3938,7 +3938,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev,
3938 if (priv->regs == NULL) { 3938 if (priv->regs == NULL) {
3939 priv->regs = pci_iomap(pdev, 2, 0x10000); 3939 priv->regs = pci_iomap(pdev, 2, 0x10000);
3940 if (priv->regs == NULL) { 3940 if (priv->regs == NULL) {
3941 wiphy_err(hw->wiphy, "cannot map device registers\n"); 3941 wiphy_err(hw->wiphy, "Cannot map device registers\n");
3942 goto err_iounmap; 3942 goto err_iounmap;
3943 } 3943 }
3944 } 3944 }
@@ -3950,14 +3950,14 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev,
3950 /* Ask userland hotplug daemon for the device firmware */ 3950 /* Ask userland hotplug daemon for the device firmware */
3951 rc = mwl8k_request_firmware(priv); 3951 rc = mwl8k_request_firmware(priv);
3952 if (rc) { 3952 if (rc) {
3953 wiphy_err(hw->wiphy, "firmware files not found\n"); 3953 wiphy_err(hw->wiphy, "Firmware files not found\n");
3954 goto err_stop_firmware; 3954 goto err_stop_firmware;
3955 } 3955 }
3956 3956
3957 /* Load firmware into hardware */ 3957 /* Load firmware into hardware */
3958 rc = mwl8k_load_firmware(hw); 3958 rc = mwl8k_load_firmware(hw);
3959 if (rc) { 3959 if (rc) {
3960 wiphy_err(hw->wiphy, "cannot start firmware\n"); 3960 wiphy_err(hw->wiphy, "Cannot start firmware\n");
3961 goto err_stop_firmware; 3961 goto err_stop_firmware;
3962 } 3962 }
3963 3963
@@ -4047,7 +4047,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev,
4047 rc = request_irq(priv->pdev->irq, mwl8k_interrupt, 4047 rc = request_irq(priv->pdev->irq, mwl8k_interrupt,
4048 IRQF_SHARED, MWL8K_NAME, hw); 4048 IRQF_SHARED, MWL8K_NAME, hw);
4049 if (rc) { 4049 if (rc) {
4050 wiphy_err(hw->wiphy, "failed to register irq handler\n"); 4050 wiphy_err(hw->wiphy, "failed to register IRQ handler\n");
4051 goto err_free_queues; 4051 goto err_free_queues;
4052 } 4052 }
4053 4053
@@ -4067,7 +4067,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev,
4067 rc = mwl8k_cmd_get_hw_spec_sta(hw); 4067 rc = mwl8k_cmd_get_hw_spec_sta(hw);
4068 } 4068 }
4069 if (rc) { 4069 if (rc) {
4070 wiphy_err(hw->wiphy, "cannot initialise firmware\n"); 4070 wiphy_err(hw->wiphy, "Cannot initialise firmware\n");
4071 goto err_free_irq; 4071 goto err_free_irq;
4072 } 4072 }
4073 4073
@@ -4081,14 +4081,14 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev,
4081 /* Turn radio off */ 4081 /* Turn radio off */
4082 rc = mwl8k_cmd_radio_disable(hw); 4082 rc = mwl8k_cmd_radio_disable(hw);
4083 if (rc) { 4083 if (rc) {
4084 wiphy_err(hw->wiphy, "cannot disable\n"); 4084 wiphy_err(hw->wiphy, "Cannot disable\n");
4085 goto err_free_irq; 4085 goto err_free_irq;
4086 } 4086 }
4087 4087
4088 /* Clear MAC address */ 4088 /* Clear MAC address */
4089 rc = mwl8k_cmd_set_mac_addr(hw, NULL, "\x00\x00\x00\x00\x00\x00"); 4089 rc = mwl8k_cmd_set_mac_addr(hw, NULL, "\x00\x00\x00\x00\x00\x00");
4090 if (rc) { 4090 if (rc) {
4091 wiphy_err(hw->wiphy, "cannot clear mac address\n"); 4091 wiphy_err(hw->wiphy, "Cannot clear MAC address\n");
4092 goto err_free_irq; 4092 goto err_free_irq;
4093 } 4093 }
4094 4094
@@ -4098,7 +4098,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev,
4098 4098
4099 rc = ieee80211_register_hw(hw); 4099 rc = ieee80211_register_hw(hw);
4100 if (rc) { 4100 if (rc) {
4101 wiphy_err(hw->wiphy, "cannot register device\n"); 4101 wiphy_err(hw->wiphy, "Cannot register device\n");
4102 goto err_free_queues; 4102 goto err_free_queues;
4103 } 4103 }
4104 4104
diff --git a/drivers/net/wireless/p54/eeprom.c b/drivers/net/wireless/p54/eeprom.c
index d687cb7f2a59..78347041ec40 100644
--- a/drivers/net/wireless/p54/eeprom.c
+++ b/drivers/net/wireless/p54/eeprom.c
@@ -167,7 +167,7 @@ static int p54_generate_band(struct ieee80211_hw *dev,
167 } 167 }
168 168
169 if (j == 0) { 169 if (j == 0) {
170 wiphy_err(dev->wiphy, "disabling totally damaged %d GHz band\n", 170 wiphy_err(dev->wiphy, "Disabling totally damaged %d GHz band\n",
171 (band == IEEE80211_BAND_2GHZ) ? 2 : 5); 171 (band == IEEE80211_BAND_2GHZ) ? 2 : 5);
172 172
173 ret = -ENODATA; 173 ret = -ENODATA;
@@ -695,12 +695,12 @@ int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
695 u8 perm_addr[ETH_ALEN]; 695 u8 perm_addr[ETH_ALEN];
696 696
697 wiphy_warn(dev->wiphy, 697 wiphy_warn(dev->wiphy,
698 "invalid hwaddr! using randomly generated mac addr\n"); 698 "Invalid hwaddr! Using randomly generated MAC addr\n");
699 random_ether_addr(perm_addr); 699 random_ether_addr(perm_addr);
700 SET_IEEE80211_PERM_ADDR(dev, perm_addr); 700 SET_IEEE80211_PERM_ADDR(dev, perm_addr);
701 } 701 }
702 702
703 wiphy_info(dev->wiphy, "hwaddr %pm, mac:isl38%02x rf:%s\n", 703 wiphy_info(dev->wiphy, "hwaddr %pM, MAC:isl38%02x RF:%s\n",
704 dev->wiphy->perm_addr, priv->version, 704 dev->wiphy->perm_addr, priv->version,
705 p54_rf_chips[priv->rxhw]); 705 p54_rf_chips[priv->rxhw]);
706 706
diff --git a/drivers/net/wireless/p54/fwio.c b/drivers/net/wireless/p54/fwio.c
index 47006bca4852..15b20c29a604 100644
--- a/drivers/net/wireless/p54/fwio.c
+++ b/drivers/net/wireless/p54/fwio.c
@@ -125,7 +125,7 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw)
125 125
126 if (fw_version) 126 if (fw_version)
127 wiphy_info(priv->hw->wiphy, 127 wiphy_info(priv->hw->wiphy,
128 "fw rev %s - softmac protocol %x.%x\n", 128 "FW rev %s - Softmac protocol %x.%x\n",
129 fw_version, priv->fw_var >> 8, priv->fw_var & 0xff); 129 fw_version, priv->fw_var >> 8, priv->fw_var & 0xff);
130 130
131 if (priv->fw_var < 0x500) 131 if (priv->fw_var < 0x500)
diff --git a/drivers/net/wireless/p54/led.c b/drivers/net/wireless/p54/led.c
index ea91f5cce6b3..3837e1eec5f4 100644
--- a/drivers/net/wireless/p54/led.c
+++ b/drivers/net/wireless/p54/led.c
@@ -58,7 +58,7 @@ static void p54_update_leds(struct work_struct *work)
58 err = p54_set_leds(priv); 58 err = p54_set_leds(priv);
59 if (err && net_ratelimit()) 59 if (err && net_ratelimit())
60 wiphy_err(priv->hw->wiphy, 60 wiphy_err(priv->hw->wiphy,
61 "failed to update leds (%d).\n", err); 61 "failed to update LEDs (%d).\n", err);
62 62
63 if (rerun) 63 if (rerun)
64 ieee80211_queue_delayed_work(priv->hw, &priv->led_work, 64 ieee80211_queue_delayed_work(priv->hw, &priv->led_work,
@@ -103,7 +103,7 @@ static int p54_register_led(struct p54_common *priv,
103 err = led_classdev_register(wiphy_dev(priv->hw->wiphy), &led->led_dev); 103 err = led_classdev_register(wiphy_dev(priv->hw->wiphy), &led->led_dev);
104 if (err) 104 if (err)
105 wiphy_err(priv->hw->wiphy, 105 wiphy_err(priv->hw->wiphy,
106 "failed to register %s led.\n", name); 106 "Failed to register %s LED.\n", name);
107 else 107 else
108 led->registered = 1; 108 led->registered = 1;
109 109
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c
index 822f8dc26e9c..1eacba4daa5b 100644
--- a/drivers/net/wireless/p54/p54pci.c
+++ b/drivers/net/wireless/p54/p54pci.c
@@ -466,7 +466,7 @@ static int p54p_open(struct ieee80211_hw *dev)
466 P54P_READ(dev_int); 466 P54P_READ(dev_int);
467 467
468 if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ)) { 468 if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ)) {
469 wiphy_err(dev->wiphy, "cannot boot firmware!\n"); 469 wiphy_err(dev->wiphy, "Cannot boot firmware!\n");
470 p54p_stop(dev); 470 p54p_stop(dev);
471 return -ETIMEDOUT; 471 return -ETIMEDOUT;
472 } 472 }
diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c
index 427b46f558ed..0e937dc0c9c4 100644
--- a/drivers/net/wireless/p54/txrx.c
+++ b/drivers/net/wireless/p54/txrx.c
@@ -446,7 +446,7 @@ static void p54_rx_frame_sent(struct p54_common *priv, struct sk_buff *skb)
446 } 446 }
447 447
448 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) && 448 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) &&
449 (!payload->status)) 449 !(payload->status & P54_TX_FAILED))
450 info->flags |= IEEE80211_TX_STAT_ACK; 450 info->flags |= IEEE80211_TX_STAT_ACK;
451 if (payload->status & P54_TX_PSM_CANCELLED) 451 if (payload->status & P54_TX_PSM_CANCELLED)
452 info->flags |= IEEE80211_TX_STAT_TX_FILTERED; 452 info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
@@ -540,7 +540,7 @@ static void p54_rx_trap(struct p54_common *priv, struct sk_buff *skb)
540 case P54_TRAP_BEACON_TX: 540 case P54_TRAP_BEACON_TX:
541 break; 541 break;
542 case P54_TRAP_RADAR: 542 case P54_TRAP_RADAR:
543 wiphy_info(priv->hw->wiphy, "radar (freq:%d mhz)\n", freq); 543 wiphy_info(priv->hw->wiphy, "radar (freq:%d MHz)\n", freq);
544 break; 544 break;
545 case P54_TRAP_NO_BEACON: 545 case P54_TRAP_NO_BEACON:
546 if (priv->vif) 546 if (priv->vif)
diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c
index b50c39aaec05..30107ce78dfb 100644
--- a/drivers/net/wireless/rtl818x/rtl8180_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c
@@ -445,7 +445,7 @@ static int rtl8180_init_rx_ring(struct ieee80211_hw *dev)
445 &priv->rx_ring_dma); 445 &priv->rx_ring_dma);
446 446
447 if (!priv->rx_ring || (unsigned long)priv->rx_ring & 0xFF) { 447 if (!priv->rx_ring || (unsigned long)priv->rx_ring & 0xFF) {
448 wiphy_err(dev->wiphy, "cannot allocate rx ring\n"); 448 wiphy_err(dev->wiphy, "Cannot allocate RX ring\n");
449 return -ENOMEM; 449 return -ENOMEM;
450 } 450 }
451 451
@@ -502,7 +502,7 @@ static int rtl8180_init_tx_ring(struct ieee80211_hw *dev,
502 502
503 ring = pci_alloc_consistent(priv->pdev, sizeof(*ring) * entries, &dma); 503 ring = pci_alloc_consistent(priv->pdev, sizeof(*ring) * entries, &dma);
504 if (!ring || (unsigned long)ring & 0xFF) { 504 if (!ring || (unsigned long)ring & 0xFF) {
505 wiphy_err(dev->wiphy, "cannot allocate tx ring (prio = %d)\n", 505 wiphy_err(dev->wiphy, "Cannot allocate TX ring (prio = %d)\n",
506 prio); 506 prio);
507 return -ENOMEM; 507 return -ENOMEM;
508 } 508 }
@@ -568,7 +568,7 @@ static int rtl8180_start(struct ieee80211_hw *dev)
568 ret = request_irq(priv->pdev->irq, rtl8180_interrupt, 568 ret = request_irq(priv->pdev->irq, rtl8180_interrupt,
569 IRQF_SHARED, KBUILD_MODNAME, dev); 569 IRQF_SHARED, KBUILD_MODNAME, dev);
570 if (ret) { 570 if (ret) {
571 wiphy_err(dev->wiphy, "failed to register irq handler\n"); 571 wiphy_err(dev->wiphy, "failed to register IRQ handler\n");
572 goto err_free_rings; 572 goto err_free_rings;
573 } 573 }
574 574
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
index 5738a55c1b06..98e0351c1dd6 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -573,7 +573,7 @@ static int rtl8187_cmd_reset(struct ieee80211_hw *dev)
573 } while (--i); 573 } while (--i);
574 574
575 if (!i) { 575 if (!i) {
576 wiphy_err(dev->wiphy, "reset timeout!\n"); 576 wiphy_err(dev->wiphy, "Reset timeout!\n");
577 return -ETIMEDOUT; 577 return -ETIMEDOUT;
578 } 578 }
579 579
@@ -1526,7 +1526,7 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
1526 mutex_init(&priv->conf_mutex); 1526 mutex_init(&priv->conf_mutex);
1527 skb_queue_head_init(&priv->b_tx_status.queue); 1527 skb_queue_head_init(&priv->b_tx_status.queue);
1528 1528
1529 wiphy_info(dev->wiphy, "hwaddr %pm, %s v%d + %s, rfkill mask %d\n", 1529 wiphy_info(dev->wiphy, "hwaddr %pM, %s V%d + %s, rfkill mask %d\n",
1530 mac_addr, chip_name, priv->asic_rev, priv->rf->name, 1530 mac_addr, chip_name, priv->asic_rev, priv->rf->name,
1531 priv->rfkill_mask); 1531 priv->rfkill_mask);
1532 1532
diff --git a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c b/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
index fd96f9112322..97eebdcf7eb9 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
@@ -366,7 +366,7 @@ static void rtl8225_rf_init(struct ieee80211_hw *dev)
366 rtl8225_write(dev, 0x02, 0x044d); 366 rtl8225_write(dev, 0x02, 0x044d);
367 msleep(100); 367 msleep(100);
368 if (!(rtl8225_read(dev, 6) & (1 << 7))) 368 if (!(rtl8225_read(dev, 6) & (1 << 7)))
369 wiphy_warn(dev->wiphy, "rf calibration failed! %x\n", 369 wiphy_warn(dev->wiphy, "RF Calibration Failed! %x\n",
370 rtl8225_read(dev, 6)); 370 rtl8225_read(dev, 6));
371 } 371 }
372 372
@@ -735,7 +735,7 @@ static void rtl8225z2_rf_init(struct ieee80211_hw *dev)
735 rtl8225_write(dev, 0x02, 0x044D); 735 rtl8225_write(dev, 0x02, 0x044D);
736 msleep(100); 736 msleep(100);
737 if (!(rtl8225_read(dev, 6) & (1 << 7))) 737 if (!(rtl8225_read(dev, 6) & (1 << 7)))
738 wiphy_warn(dev->wiphy, "rf calibration failed! %x\n", 738 wiphy_warn(dev->wiphy, "RF Calibration Failed! %x\n",
739 rtl8225_read(dev, 6)); 739 rtl8225_read(dev, 6));
740 } 740 }
741 741