aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-05-07 05:17:13 -0400
committerIngo Molnar <mingo@elte.hu>2009-05-07 05:17:34 -0400
commit44347d947f628060b92449702071bfe1d31dfb75 (patch)
treec6ed74610d5b3295df4296659f80f5feb94b28cc /drivers/net
parentd94fc523f3c35bd8013f04827e94756cbc0212f4 (diff)
parent413f81eba35d6ede9289b0c8a920c013a84fac71 (diff)
Merge branch 'linus' into tracing/core
Merge reason: tracing/core was on a .30-rc1 base and was missing out on on a handful of tracing fixes present in .30-rc5-almost. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/8139too.c10
-rw-r--r--drivers/net/Kconfig4
-rw-r--r--drivers/net/a2065.c17
-rw-r--r--drivers/net/ariadne.c19
-rw-r--r--drivers/net/arm/am79c961a.c24
-rw-r--r--drivers/net/arm/at91_ether.c32
-rw-r--r--drivers/net/arm/ep93xx_eth.c21
-rw-r--r--drivers/net/arm/ether1.c19
-rw-r--r--drivers/net/arm/ether3.c19
-rw-r--r--drivers/net/atarilance.c18
-rw-r--r--drivers/net/atl1c/atl1c_main.c4
-rw-r--r--drivers/net/au1000_eth.c23
-rw-r--r--drivers/net/benet/be_ethtool.c4
-rw-r--r--drivers/net/benet/be_main.c4
-rw-r--r--drivers/net/bfin_mac.c24
-rw-r--r--drivers/net/bonding/bond_alb.c14
-rw-r--r--drivers/net/bonding/bond_main.c41
-rw-r--r--drivers/net/bonding/bond_sysfs.c14
-rw-r--r--drivers/net/cris/eth_v10.c30
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c44
-rw-r--r--drivers/net/cxgb3/t3_hw.c13
-rw-r--r--drivers/net/declance.c17
-rw-r--r--drivers/net/e100.c30
-rw-r--r--drivers/net/e1000/e1000_main.c54
-rw-r--r--drivers/net/e1000e/netdev.c67
-rw-r--r--drivers/net/ehea/ehea.h2
-rw-r--r--drivers/net/ehea/ehea_main.c35
-rw-r--r--drivers/net/forcedeth.c35
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c27
-rw-r--r--drivers/net/gianfar.c2
-rw-r--r--drivers/net/ibm_newemac/core.c41
-rw-r--r--drivers/net/igb/e1000_mac.c2
-rw-r--r--drivers/net/igb/e1000_mac.h1
-rw-r--r--drivers/net/igb/e1000_mbx.c17
-rw-r--r--drivers/net/igb/e1000_mbx.h2
-rw-r--r--drivers/net/igb/igb_main.c37
-rw-r--r--drivers/net/igbvf/igbvf.h3
-rw-r--r--drivers/net/igbvf/netdev.c9
-rw-r--r--drivers/net/igbvf/vf.c2
-rw-r--r--drivers/net/igbvf/vf.h1
-rw-r--r--drivers/net/ioc3-eth.c22
-rw-r--r--drivers/net/isa-skeleton.c20
-rw-r--r--drivers/net/ixgbe/ixgbe_82598.c59
-rw-r--r--drivers/net/ixgbe/ixgbe_82599.c40
-rw-r--r--drivers/net/ixgbe/ixgbe_common.c106
-rw-r--r--drivers/net/ixgbe/ixgbe_common.h3
-rw-r--r--drivers/net/ixgbe/ixgbe_dcb_82599.c28
-rw-r--r--drivers/net/ixgbe/ixgbe_ethtool.c24
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c121
-rw-r--r--drivers/net/jme.c8
-rw-r--r--drivers/net/mac89x0.c18
-rw-r--r--drivers/net/macb.c47
-rw-r--r--drivers/net/macsonic.c19
-rw-r--r--drivers/net/macvlan.c9
-rw-r--r--drivers/net/mlx4/en_main.c5
-rw-r--r--drivers/net/mlx4/en_netdev.c23
-rw-r--r--drivers/net/mlx4/en_port.c45
-rw-r--r--drivers/net/mlx4/en_resources.c6
-rw-r--r--drivers/net/mlx4/en_rx.c16
-rw-r--r--drivers/net/mlx4/en_tx.c1
-rw-r--r--drivers/net/mlx4/main.c2
-rw-r--r--drivers/net/mlx4/mlx4_en.h1
-rw-r--r--drivers/net/mv643xx_eth.c24
-rw-r--r--drivers/net/myri10ge/myri10ge.c1
-rw-r--r--drivers/net/ne2k-pci.c7
-rw-r--r--drivers/net/netconsole.c11
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c2
-rw-r--r--drivers/net/phy/fixed.c5
-rw-r--r--drivers/net/phy/marvell.c54
-rw-r--r--drivers/net/phy/phy.c14
-rw-r--r--drivers/net/ps3_gelic_wireless.c3
-rw-r--r--drivers/net/sfc/efx.c7
-rw-r--r--drivers/net/sfc/falcon.c4
-rw-r--r--drivers/net/sh_eth.c21
-rw-r--r--drivers/net/skge.c4
-rw-r--r--drivers/net/sun3_82586.c19
-rw-r--r--drivers/net/tc35815.c27
-rw-r--r--drivers/net/tg3.c17
-rw-r--r--drivers/net/tsi108_eth.c20
-rw-r--r--drivers/net/tun.c52
-rw-r--r--drivers/net/ucc_geth.c3
-rw-r--r--drivers/net/usb/Kconfig14
-rw-r--r--drivers/net/usb/Makefile1
-rw-r--r--drivers/net/usb/cdc_eem.c381
-rw-r--r--drivers/net/usb/pegasus.c1
-rw-r--r--drivers/net/usb/smsc95xx.c15
-rw-r--r--drivers/net/usb/smsc95xx.h3
-rw-r--r--drivers/net/veth.c41
-rw-r--r--drivers/net/via-velocity.c4
-rw-r--r--drivers/net/virtio_net.c24
-rw-r--r--drivers/net/wireless/airo.c2
-rw-r--r--drivers/net/wireless/ar9170/hw.h8
-rw-r--r--drivers/net/wireless/ar9170/usb.c114
-rw-r--r--drivers/net/wireless/at76c50x-usb.c2
-rw-r--r--drivers/net/wireless/ath5k/debug.c2
-rw-r--r--drivers/net/wireless/ath9k/pci.c4
-rw-r--r--drivers/net/wireless/ath9k/recv.c4
-rw-r--r--drivers/net/wireless/atmel.c1
-rw-r--r--drivers/net/wireless/b43/dma.c50
-rw-r--r--drivers/net/wireless/b43/main.c5
-rw-r--r--drivers/net/wireless/b43/phy_common.c16
-rw-r--r--drivers/net/wireless/b43/phy_common.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c11
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-csr.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c99
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c151
-rw-r--r--drivers/net/wireless/libertas/rx.c2
-rw-r--r--drivers/net/wireless/mwl8k.c7
-rw-r--r--drivers/net/wireless/orinoco/hw.c8
-rw-r--r--drivers/net/wireless/p54/p54.h12
-rw-r--r--drivers/net/wireless/p54/p54common.c2
-rw-r--r--drivers/net/wireless/p54/p54pci.c4
-rw-r--r--drivers/net/wireless/p54/p54spi.c25
-rw-r--r--drivers/net/wireless/p54/p54usb.c1
-rw-r--r--drivers/net/wireless/rndis_wlan.c14
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c18
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c18
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c2
-rw-r--r--drivers/net/xtsonic.c19
124 files changed, 1845 insertions, 961 deletions
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 29df398b7727..1fc45431a620 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -1383,6 +1383,11 @@ static void rtl8139_hw_start (struct net_device *dev)
1383 RTL_W32_F (MAC0 + 0, le32_to_cpu (*(__le32 *) (dev->dev_addr + 0))); 1383 RTL_W32_F (MAC0 + 0, le32_to_cpu (*(__le32 *) (dev->dev_addr + 0)));
1384 RTL_W32_F (MAC0 + 4, le16_to_cpu (*(__le16 *) (dev->dev_addr + 4))); 1384 RTL_W32_F (MAC0 + 4, le16_to_cpu (*(__le16 *) (dev->dev_addr + 4)));
1385 1385
1386 tp->cur_rx = 0;
1387
1388 /* init Rx ring buffer DMA address */
1389 RTL_W32_F (RxBuf, tp->rx_ring_dma);
1390
1386 /* Must enable Tx/Rx before setting transfer thresholds! */ 1391 /* Must enable Tx/Rx before setting transfer thresholds! */
1387 RTL_W8 (ChipCmd, CmdRxEnb | CmdTxEnb); 1392 RTL_W8 (ChipCmd, CmdRxEnb | CmdTxEnb);
1388 1393
@@ -1390,8 +1395,6 @@ static void rtl8139_hw_start (struct net_device *dev)
1390 RTL_W32 (RxConfig, tp->rx_config); 1395 RTL_W32 (RxConfig, tp->rx_config);
1391 RTL_W32 (TxConfig, rtl8139_tx_config); 1396 RTL_W32 (TxConfig, rtl8139_tx_config);
1392 1397
1393 tp->cur_rx = 0;
1394
1395 rtl_check_media (dev, 1); 1398 rtl_check_media (dev, 1);
1396 1399
1397 if (tp->chipset >= CH_8139B) { 1400 if (tp->chipset >= CH_8139B) {
@@ -1406,9 +1409,6 @@ static void rtl8139_hw_start (struct net_device *dev)
1406 /* Lock Config[01234] and BMCR register writes */ 1409 /* Lock Config[01234] and BMCR register writes */
1407 RTL_W8 (Cfg9346, Cfg9346_Lock); 1410 RTL_W8 (Cfg9346, Cfg9346_Lock);
1408 1411
1409 /* init Rx ring buffer DMA address */
1410 RTL_W32_F (RxBuf, tp->rx_ring_dma);
1411
1412 /* init Tx buffer DMA addresses */ 1412 /* init Tx buffer DMA addresses */
1413 for (i = 0; i < NUM_TX_DESC; i++) 1413 for (i = 0; i < NUM_TX_DESC; i++)
1414 RTL_W32_F (TxAddr0 + (i * 4), tp->tx_bufs_dma + (tp->tx_buf[i] - tp->tx_bufs)); 1414 RTL_W32_F (TxAddr0 + (i * 4), tp->tx_bufs_dma + (tp->tx_buf[i] - tp->tx_bufs));
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 9e921544ba20..214a92d1ef75 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -28,9 +28,9 @@ if NETDEVICES
28 28
29config COMPAT_NET_DEV_OPS 29config COMPAT_NET_DEV_OPS
30 default y 30 default y
31 bool "Enable older network device API compatiablity" 31 bool "Enable older network device API compatibility"
32 ---help--- 32 ---help---
33 This option enables kernel compatiability with older network devices 33 This option enables kernel compatibility with older network devices
34 that do not use net_device_ops interface. 34 that do not use net_device_ops interface.
35 35
36 If unsure, say Y. 36 If unsure, say Y.
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c
index d0d0c2fee054..02f64d578641 100644
--- a/drivers/net/a2065.c
+++ b/drivers/net/a2065.c
@@ -692,6 +692,17 @@ static struct zorro_driver a2065_driver = {
692 .remove = __devexit_p(a2065_remove_one), 692 .remove = __devexit_p(a2065_remove_one),
693}; 693};
694 694
695static const struct net_device_ops lance_netdev_ops = {
696 .ndo_open = lance_open,
697 .ndo_stop = lance_close,
698 .ndo_start_xmit = lance_start_xmit,
699 .ndo_tx_timeout = lance_tx_timeout,
700 .ndo_set_multicast_list = lance_set_multicast,
701 .ndo_validate_addr = eth_validate_addr,
702 .ndo_change_mtu = eth_change_mtu,
703 .ndo_set_mac_address = eth_mac_addr,
704};
705
695static int __devinit a2065_init_one(struct zorro_dev *z, 706static int __devinit a2065_init_one(struct zorro_dev *z,
696 const struct zorro_device_id *ent) 707 const struct zorro_device_id *ent)
697{ 708{
@@ -753,12 +764,8 @@ static int __devinit a2065_init_one(struct zorro_dev *z,
753 priv->rx_ring_mod_mask = RX_RING_MOD_MASK; 764 priv->rx_ring_mod_mask = RX_RING_MOD_MASK;
754 priv->tx_ring_mod_mask = TX_RING_MOD_MASK; 765 priv->tx_ring_mod_mask = TX_RING_MOD_MASK;
755 766
756 dev->open = &lance_open; 767 dev->netdev_ops = &lance_netdev_ops;
757 dev->stop = &lance_close;
758 dev->hard_start_xmit = &lance_start_xmit;
759 dev->tx_timeout = &lance_tx_timeout;
760 dev->watchdog_timeo = 5*HZ; 768 dev->watchdog_timeo = 5*HZ;
761 dev->set_multicast_list = &lance_set_multicast;
762 dev->dma = 0; 769 dev->dma = 0;
763 770
764 init_timer(&priv->multicast_timer); 771 init_timer(&priv->multicast_timer);
diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c
index e1d72e06f3e1..58e8d522e5bc 100644
--- a/drivers/net/ariadne.c
+++ b/drivers/net/ariadne.c
@@ -155,6 +155,18 @@ static struct zorro_driver ariadne_driver = {
155 .remove = __devexit_p(ariadne_remove_one), 155 .remove = __devexit_p(ariadne_remove_one),
156}; 156};
157 157
158static const struct net_device_ops ariadne_netdev_ops = {
159 .ndo_open = ariadne_open,
160 .ndo_stop = ariadne_close,
161 .ndo_start_xmit = ariadne_start_xmit,
162 .ndo_tx_timeout = ariadne_tx_timeout,
163 .ndo_get_stats = ariadne_get_stats,
164 .ndo_set_multicast_list = set_multicast_list,
165 .ndo_validate_addr = eth_validate_addr,
166 .ndo_change_mtu = eth_change_mtu,
167 .ndo_set_mac_address = eth_mac_addr,
168};
169
158static int __devinit ariadne_init_one(struct zorro_dev *z, 170static int __devinit ariadne_init_one(struct zorro_dev *z,
159 const struct zorro_device_id *ent) 171 const struct zorro_device_id *ent)
160{ 172{
@@ -197,13 +209,8 @@ static int __devinit ariadne_init_one(struct zorro_dev *z,
197 dev->mem_start = ZTWO_VADDR(mem_start); 209 dev->mem_start = ZTWO_VADDR(mem_start);
198 dev->mem_end = dev->mem_start+ARIADNE_RAM_SIZE; 210 dev->mem_end = dev->mem_start+ARIADNE_RAM_SIZE;
199 211
200 dev->open = &ariadne_open; 212 dev->netdev_ops = &ariadne_netdev_ops;
201 dev->stop = &ariadne_close;
202 dev->hard_start_xmit = &ariadne_start_xmit;
203 dev->tx_timeout = &ariadne_tx_timeout;
204 dev->watchdog_timeo = 5*HZ; 213 dev->watchdog_timeo = 5*HZ;
205 dev->get_stats = &ariadne_get_stats;
206 dev->set_multicast_list = &set_multicast_list;
207 214
208 err = register_netdev(dev); 215 err = register_netdev(dev);
209 if (err) { 216 if (err) {
diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c
index 4bc6901b3819..627bc75da17d 100644
--- a/drivers/net/arm/am79c961a.c
+++ b/drivers/net/arm/am79c961a.c
@@ -665,6 +665,20 @@ static void __init am79c961_banner(void)
665 if (net_debug && version_printed++ == 0) 665 if (net_debug && version_printed++ == 0)
666 printk(KERN_INFO "%s", version); 666 printk(KERN_INFO "%s", version);
667} 667}
668static const struct net_device_ops am79c961_netdev_ops = {
669 .ndo_open = am79c961_open,
670 .ndo_stop = am79c961_close,
671 .ndo_start_xmit = am79c961_sendpacket,
672 .ndo_get_stats = am79c961_getstats,
673 .ndo_set_multicast_list = am79c961_setmulticastlist,
674 .ndo_tx_timeout = am79c961_timeout,
675 .ndo_validate_addr = eth_validate_addr,
676 .ndo_change_mtu = eth_change_mtu,
677 .ndo_set_mac_address = eth_mac_addr,
678#ifdef CONFIG_NET_POLL_CONTROLLER
679 .ndo_poll_controller = am79c961_poll_controller,
680#endif
681};
668 682
669static int __init am79c961_probe(struct platform_device *pdev) 683static int __init am79c961_probe(struct platform_device *pdev)
670{ 684{
@@ -732,15 +746,7 @@ static int __init am79c961_probe(struct platform_device *pdev)
732 if (am79c961_hw_init(dev)) 746 if (am79c961_hw_init(dev))
733 goto release; 747 goto release;
734 748
735 dev->open = am79c961_open; 749 dev->netdev_ops = &am79c961_netdev_ops;
736 dev->stop = am79c961_close;
737 dev->hard_start_xmit = am79c961_sendpacket;
738 dev->get_stats = am79c961_getstats;
739 dev->set_multicast_list = am79c961_setmulticastlist;
740 dev->tx_timeout = am79c961_timeout;
741#ifdef CONFIG_NET_POLL_CONTROLLER
742 dev->poll_controller = am79c961_poll_controller;
743#endif
744 750
745 ret = register_netdev(dev); 751 ret = register_netdev(dev);
746 if (ret == 0) { 752 if (ret == 0) {
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c
index 442938d50380..7f4bc8ae5462 100644
--- a/drivers/net/arm/at91_ether.c
+++ b/drivers/net/arm/at91_ether.c
@@ -577,7 +577,7 @@ static void at91ether_sethashtable(struct net_device *dev)
577/* 577/*
578 * Enable/Disable promiscuous and multicast modes. 578 * Enable/Disable promiscuous and multicast modes.
579 */ 579 */
580static void at91ether_set_rx_mode(struct net_device *dev) 580static void at91ether_set_multicast_list(struct net_device *dev)
581{ 581{
582 unsigned long cfg; 582 unsigned long cfg;
583 583
@@ -808,7 +808,7 @@ static int at91ether_close(struct net_device *dev)
808/* 808/*
809 * Transmit packet. 809 * Transmit packet.
810 */ 810 */
811static int at91ether_tx(struct sk_buff *skb, struct net_device *dev) 811static int at91ether_start_xmit(struct sk_buff *skb, struct net_device *dev)
812{ 812{
813 struct at91_private *lp = netdev_priv(dev); 813 struct at91_private *lp = netdev_priv(dev);
814 814
@@ -828,7 +828,7 @@ static int at91ether_tx(struct sk_buff *skb, struct net_device *dev)
828 828
829 dev->trans_start = jiffies; 829 dev->trans_start = jiffies;
830 } else { 830 } else {
831 printk(KERN_ERR "at91_ether.c: at91ether_tx() called, but device is busy!\n"); 831 printk(KERN_ERR "at91_ether.c: at91ether_start_xmit() called, but device is busy!\n");
832 return 1; /* if we return anything but zero, dev.c:1055 calls kfree_skb(skb) 832 return 1; /* if we return anything but zero, dev.c:1055 calls kfree_skb(skb)
833 on this skb, he also reports -ENETDOWN and printk's, so either 833 on this skb, he also reports -ENETDOWN and printk's, so either
834 we free and return(0) or don't free and return 1 */ 834 we free and return(0) or don't free and return 1 */
@@ -965,6 +965,21 @@ static void at91ether_poll_controller(struct net_device *dev)
965} 965}
966#endif 966#endif
967 967
968static const struct net_device_ops at91ether_netdev_ops = {
969 .ndo_open = at91ether_open,
970 .ndo_stop = at91ether_close,
971 .ndo_start_xmit = at91ether_start_xmit,
972 .ndo_get_stats = at91ether_stats,
973 .ndo_set_multicast_list = at91ether_set_multicast_list,
974 .ndo_set_mac_address = set_mac_address,
975 .ndo_do_ioctl = at91ether_ioctl,
976 .ndo_validate_addr = eth_validate_addr,
977 .ndo_change_mtu = eth_change_mtu,
978#ifdef CONFIG_NET_POLL_CONTROLLER
979 .ndo_poll_controller = at91ether_poll_controller,
980#endif
981};
982
968/* 983/*
969 * Initialize the ethernet interface 984 * Initialize the ethernet interface
970 */ 985 */
@@ -1005,17 +1020,8 @@ static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_add
1005 spin_lock_init(&lp->lock); 1020 spin_lock_init(&lp->lock);
1006 1021
1007 ether_setup(dev); 1022 ether_setup(dev);
1008 dev->open = at91ether_open; 1023 dev->netdev_ops = &at91ether_netdev_ops;
1009 dev->stop = at91ether_close;
1010 dev->hard_start_xmit = at91ether_tx;
1011 dev->get_stats = at91ether_stats;
1012 dev->set_multicast_list = at91ether_set_rx_mode;
1013 dev->set_mac_address = set_mac_address;
1014 dev->ethtool_ops = &at91ether_ethtool_ops; 1024 dev->ethtool_ops = &at91ether_ethtool_ops;
1015 dev->do_ioctl = at91ether_ioctl;
1016#ifdef CONFIG_NET_POLL_CONTROLLER
1017 dev->poll_controller = at91ether_poll_controller;
1018#endif
1019 1025
1020 SET_NETDEV_DEV(dev, &pdev->dev); 1026 SET_NETDEV_DEV(dev, &pdev->dev);
1021 1027
diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c
index cc7708775da0..b72b3d639f6e 100644
--- a/drivers/net/arm/ep93xx_eth.c
+++ b/drivers/net/arm/ep93xx_eth.c
@@ -153,7 +153,7 @@ struct ep93xx_descs
153struct ep93xx_priv 153struct ep93xx_priv
154{ 154{
155 struct resource *res; 155 struct resource *res;
156 void *base_addr; 156 void __iomem *base_addr;
157 int irq; 157 int irq;
158 158
159 struct ep93xx_descs *descs; 159 struct ep93xx_descs *descs;
@@ -770,7 +770,18 @@ static struct ethtool_ops ep93xx_ethtool_ops = {
770 .get_link = ep93xx_get_link, 770 .get_link = ep93xx_get_link,
771}; 771};
772 772
773struct net_device *ep93xx_dev_alloc(struct ep93xx_eth_data *data) 773static const struct net_device_ops ep93xx_netdev_ops = {
774 .ndo_open = ep93xx_open,
775 .ndo_stop = ep93xx_close,
776 .ndo_start_xmit = ep93xx_xmit,
777 .ndo_get_stats = ep93xx_get_stats,
778 .ndo_do_ioctl = ep93xx_ioctl,
779 .ndo_validate_addr = eth_validate_addr,
780 .ndo_change_mtu = eth_change_mtu,
781 .ndo_set_mac_address = eth_mac_addr,
782};
783
784static struct net_device *ep93xx_dev_alloc(struct ep93xx_eth_data *data)
774{ 785{
775 struct net_device *dev; 786 struct net_device *dev;
776 787
@@ -780,12 +791,8 @@ struct net_device *ep93xx_dev_alloc(struct ep93xx_eth_data *data)
780 791
781 memcpy(dev->dev_addr, data->dev_addr, ETH_ALEN); 792 memcpy(dev->dev_addr, data->dev_addr, ETH_ALEN);
782 793
783 dev->get_stats = ep93xx_get_stats;
784 dev->ethtool_ops = &ep93xx_ethtool_ops; 794 dev->ethtool_ops = &ep93xx_ethtool_ops;
785 dev->hard_start_xmit = ep93xx_xmit; 795 dev->netdev_ops = &ep93xx_netdev_ops;
786 dev->open = ep93xx_open;
787 dev->stop = ep93xx_close;
788 dev->do_ioctl = ep93xx_ioctl;
789 796
790 dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM; 797 dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM;
791 798
diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c
index e380de454463..edf770f639fa 100644
--- a/drivers/net/arm/ether1.c
+++ b/drivers/net/arm/ether1.c
@@ -991,6 +991,18 @@ static void __devinit ether1_banner(void)
991 printk(KERN_INFO "%s", version); 991 printk(KERN_INFO "%s", version);
992} 992}
993 993
994static const struct net_device_ops ether1_netdev_ops = {
995 .ndo_open = ether1_open,
996 .ndo_stop = ether1_close,
997 .ndo_start_xmit = ether1_sendpacket,
998 .ndo_get_stats = ether1_getstats,
999 .ndo_set_multicast_list = ether1_setmulticastlist,
1000 .ndo_tx_timeout = ether1_timeout,
1001 .ndo_validate_addr = eth_validate_addr,
1002 .ndo_change_mtu = eth_change_mtu,
1003 .ndo_set_mac_address = eth_mac_addr,
1004};
1005
994static int __devinit 1006static int __devinit
995ether1_probe(struct expansion_card *ec, const struct ecard_id *id) 1007ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
996{ 1008{
@@ -1031,12 +1043,7 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
1031 goto free; 1043 goto free;
1032 } 1044 }
1033 1045
1034 dev->open = ether1_open; 1046 dev->netdev_ops = &ether1_netdev_ops;
1035 dev->stop = ether1_close;
1036 dev->hard_start_xmit = ether1_sendpacket;
1037 dev->get_stats = ether1_getstats;
1038 dev->set_multicast_list = ether1_setmulticastlist;
1039 dev->tx_timeout = ether1_timeout;
1040 dev->watchdog_timeo = 5 * HZ / 100; 1047 dev->watchdog_timeo = 5 * HZ / 100;
1041 1048
1042 ret = register_netdev(dev); 1049 ret = register_netdev(dev);
diff --git a/drivers/net/arm/ether3.c b/drivers/net/arm/ether3.c
index 21a7bef12d3b..ec8a1ae1e887 100644
--- a/drivers/net/arm/ether3.c
+++ b/drivers/net/arm/ether3.c
@@ -770,6 +770,18 @@ static void __devinit ether3_banner(void)
770 printk(KERN_INFO "%s", version); 770 printk(KERN_INFO "%s", version);
771} 771}
772 772
773static const struct net_device_ops ether3_netdev_ops = {
774 .ndo_open = ether3_open,
775 .ndo_stop = ether3_close,
776 .ndo_start_xmit = ether3_sendpacket,
777 .ndo_get_stats = ether3_getstats,
778 .ndo_set_multicast_list = ether3_setmulticastlist,
779 .ndo_tx_timeout = ether3_timeout,
780 .ndo_validate_addr = eth_validate_addr,
781 .ndo_change_mtu = eth_change_mtu,
782 .ndo_set_mac_address = eth_mac_addr,
783};
784
773static int __devinit 785static int __devinit
774ether3_probe(struct expansion_card *ec, const struct ecard_id *id) 786ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
775{ 787{
@@ -846,12 +858,7 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
846 goto free; 858 goto free;
847 } 859 }
848 860
849 dev->open = ether3_open; 861 dev->netdev_ops = &ether3_netdev_ops;
850 dev->stop = ether3_close;
851 dev->hard_start_xmit = ether3_sendpacket;
852 dev->get_stats = ether3_getstats;
853 dev->set_multicast_list = ether3_setmulticastlist;
854 dev->tx_timeout = ether3_timeout;
855 dev->watchdog_timeo = 5 * HZ / 100; 862 dev->watchdog_timeo = 5 * HZ / 100;
856 863
857 ret = register_netdev(dev); 864 ret = register_netdev(dev);
diff --git a/drivers/net/atarilance.c b/drivers/net/atarilance.c
index 2d81f6afcb58..5425ab0c38c0 100644
--- a/drivers/net/atarilance.c
+++ b/drivers/net/atarilance.c
@@ -453,6 +453,16 @@ static noinline int __init addr_accessible(volatile void *regp, int wordflag,
453 return( ret ); 453 return( ret );
454} 454}
455 455
456static const struct net_device_ops lance_netdev_ops = {
457 .ndo_open = lance_open,
458 .ndo_stop = lance_close,
459 .ndo_start_xmit = lance_start_xmit,
460 .ndo_set_multicast_list = set_multicast_list,
461 .ndo_set_mac_address = lance_set_mac_address,
462 .ndo_tx_timeout = lance_tx_timeout,
463 .ndo_validate_addr = eth_validate_addr,
464 .ndo_change_mtu = eth_change_mtu,
465};
456 466
457static unsigned long __init lance_probe1( struct net_device *dev, 467static unsigned long __init lance_probe1( struct net_device *dev,
458 struct lance_addr *init_rec ) 468 struct lance_addr *init_rec )
@@ -623,15 +633,9 @@ static unsigned long __init lance_probe1( struct net_device *dev,
623 if (did_version++ == 0) 633 if (did_version++ == 0)
624 DPRINTK( 1, ( version )); 634 DPRINTK( 1, ( version ));
625 635
626 /* The LANCE-specific entries in the device structure. */ 636 dev->netdev_ops = &lance_netdev_ops;
627 dev->open = &lance_open;
628 dev->hard_start_xmit = &lance_start_xmit;
629 dev->stop = &lance_close;
630 dev->set_multicast_list = &set_multicast_list;
631 dev->set_mac_address = &lance_set_mac_address;
632 637
633 /* XXX MSch */ 638 /* XXX MSch */
634 dev->tx_timeout = lance_tx_timeout;
635 dev->watchdog_timeo = TX_TIMEOUT; 639 dev->watchdog_timeo = TX_TIMEOUT;
636 640
637 return( 1 ); 641 return( 1 );
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c
index deb7b53167ee..83a12125b94e 100644
--- a/drivers/net/atl1c/atl1c_main.c
+++ b/drivers/net/atl1c/atl1c_main.c
@@ -2532,8 +2532,8 @@ static int __devinit atl1c_probe(struct pci_dev *pdev,
2532 * various kernel subsystems to support the mechanics required by a 2532 * various kernel subsystems to support the mechanics required by a
2533 * fixed-high-32-bit system. 2533 * fixed-high-32-bit system.
2534 */ 2534 */
2535 if ((pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0) || 2535 if ((pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) ||
2536 (pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK) != 0)) { 2536 (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)) != 0)) {
2537 dev_err(&pdev->dev, "No usable DMA configuration,aborting\n"); 2537 dev_err(&pdev->dev, "No usable DMA configuration,aborting\n");
2538 goto err_dma; 2538 goto err_dma;
2539 } 2539 }
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 4274e4ac963b..d58c105fc779 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -1004,12 +1004,12 @@ static void au1000_tx_timeout(struct net_device *dev)
1004 netif_wake_queue(dev); 1004 netif_wake_queue(dev);
1005} 1005}
1006 1006
1007static void set_rx_mode(struct net_device *dev) 1007static void au1000_multicast_list(struct net_device *dev)
1008{ 1008{
1009 struct au1000_private *aup = netdev_priv(dev); 1009 struct au1000_private *aup = netdev_priv(dev);
1010 1010
1011 if (au1000_debug > 4) 1011 if (au1000_debug > 4)
1012 printk("%s: set_rx_mode: flags=%x\n", dev->name, dev->flags); 1012 printk("%s: au1000_multicast_list: flags=%x\n", dev->name, dev->flags);
1013 1013
1014 if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ 1014 if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
1015 aup->mac->control |= MAC_PROMISCUOUS; 1015 aup->mac->control |= MAC_PROMISCUOUS;
@@ -1047,6 +1047,18 @@ static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1047 return phy_mii_ioctl(aup->phy_dev, if_mii(rq), cmd); 1047 return phy_mii_ioctl(aup->phy_dev, if_mii(rq), cmd);
1048} 1048}
1049 1049
1050static const struct net_device_ops au1000_netdev_ops = {
1051 .ndo_open = au1000_open,
1052 .ndo_stop = au1000_close,
1053 .ndo_start_xmit = au1000_tx,
1054 .ndo_set_multicast_list = au1000_multicast_list,
1055 .ndo_do_ioctl = au1000_ioctl,
1056 .ndo_tx_timeout = au1000_tx_timeout,
1057 .ndo_set_mac_address = eth_mac_addr,
1058 .ndo_validate_addr = eth_validate_addr,
1059 .ndo_change_mtu = eth_change_mtu,
1060};
1061
1050static struct net_device * au1000_probe(int port_num) 1062static struct net_device * au1000_probe(int port_num)
1051{ 1063{
1052 static unsigned version_printed = 0; 1064 static unsigned version_printed = 0;
@@ -1197,13 +1209,8 @@ static struct net_device * au1000_probe(int port_num)
1197 1209
1198 dev->base_addr = base; 1210 dev->base_addr = base;
1199 dev->irq = irq; 1211 dev->irq = irq;
1200 dev->open = au1000_open; 1212 dev->netdev_ops = &au1000_netdev_ops;
1201 dev->hard_start_xmit = au1000_tx;
1202 dev->stop = au1000_close;
1203 dev->set_multicast_list = &set_rx_mode;
1204 dev->do_ioctl = &au1000_ioctl;
1205 SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops); 1213 SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops);
1206 dev->tx_timeout = au1000_tx_timeout;
1207 dev->watchdog_timeo = ETH_TX_TIMEOUT; 1214 dev->watchdog_timeo = ETH_TX_TIMEOUT;
1208 1215
1209 /* 1216 /*
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index 04f4b73fa8d8..9592f22e4c8c 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -319,7 +319,7 @@ be_get_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
319 319
320 be_cmd_get_flow_control(&adapter->ctrl, &ecmd->tx_pause, 320 be_cmd_get_flow_control(&adapter->ctrl, &ecmd->tx_pause,
321 &ecmd->rx_pause); 321 &ecmd->rx_pause);
322 ecmd->autoneg = AUTONEG_ENABLE; 322 ecmd->autoneg = 0;
323} 323}
324 324
325static int 325static int
@@ -328,7 +328,7 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
328 struct be_adapter *adapter = netdev_priv(netdev); 328 struct be_adapter *adapter = netdev_priv(netdev);
329 int status; 329 int status;
330 330
331 if (ecmd->autoneg != AUTONEG_ENABLE) 331 if (ecmd->autoneg != 0)
332 return -EINVAL; 332 return -EINVAL;
333 333
334 status = be_cmd_set_flow_control(&adapter->ctrl, ecmd->tx_pause, 334 status = be_cmd_set_flow_control(&adapter->ctrl, ecmd->tx_pause,
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 9b75aa630062..30d0c81c989e 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1821,11 +1821,11 @@ static int __devinit be_probe(struct pci_dev *pdev,
1821 1821
1822 be_msix_enable(adapter); 1822 be_msix_enable(adapter);
1823 1823
1824 status = pci_set_dma_mask(pdev, DMA_64BIT_MASK); 1824 status = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
1825 if (!status) { 1825 if (!status) {
1826 netdev->features |= NETIF_F_HIGHDMA; 1826 netdev->features |= NETIF_F_HIGHDMA;
1827 } else { 1827 } else {
1828 status = pci_set_dma_mask(pdev, DMA_32BIT_MASK); 1828 status = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
1829 if (status) { 1829 if (status) {
1830 dev_err(&pdev->dev, "Could not set PCI DMA Mask\n"); 1830 dev_err(&pdev->dev, "Could not set PCI DMA Mask\n");
1831 goto free_netdev; 1831 goto free_netdev;
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 9afe8092dfc4..9f971ed6b58d 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -979,6 +979,20 @@ static int bfin_mac_open(struct net_device *dev)
979 return 0; 979 return 0;
980} 980}
981 981
982static const struct net_device_ops bfin_mac_netdev_ops = {
983 .ndo_open = bfin_mac_open,
984 .ndo_stop = bfin_mac_close,
985 .ndo_start_xmit = bfin_mac_hard_start_xmit,
986 .ndo_set_mac_address = bfin_mac_set_mac_address,
987 .ndo_tx_timeout = bfin_mac_timeout,
988 .ndo_set_multicast_list = bfin_mac_set_multicast_list,
989 .ndo_validate_addr = eth_validate_addr,
990 .ndo_change_mtu = eth_change_mtu,
991#ifdef CONFIG_NET_POLL_CONTROLLER
992 .ndo_poll_controller = bfin_mac_poll,
993#endif
994};
995
982/* 996/*
983 * 997 *
984 * this makes the board clean up everything that it can 998 * this makes the board clean up everything that it can
@@ -1086,15 +1100,7 @@ static int __devinit bfin_mac_probe(struct platform_device *pdev)
1086 /* Fill in the fields of the device structure with ethernet values. */ 1100 /* Fill in the fields of the device structure with ethernet values. */
1087 ether_setup(ndev); 1101 ether_setup(ndev);
1088 1102
1089 ndev->open = bfin_mac_open; 1103 ndev->netdev_ops = &bfin_mac_netdev_ops;
1090 ndev->stop = bfin_mac_close;
1091 ndev->hard_start_xmit = bfin_mac_hard_start_xmit;
1092 ndev->set_mac_address = bfin_mac_set_mac_address;
1093 ndev->tx_timeout = bfin_mac_timeout;
1094 ndev->set_multicast_list = bfin_mac_set_multicast_list;
1095#ifdef CONFIG_NET_POLL_CONTROLLER
1096 ndev->poll_controller = bfin_mac_poll;
1097#endif
1098 ndev->ethtool_ops = &bfin_mac_ethtool_ops; 1104 ndev->ethtool_ops = &bfin_mac_ethtool_ops;
1099 1105
1100 spin_lock_init(&lp->lock); 1106 spin_lock_init(&lp->lock);
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 8dc6fbb9a41e..46d312bedfb8 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -370,8 +370,6 @@ static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct
370 370
371 if (arp->op_code == htons(ARPOP_REPLY)) { 371 if (arp->op_code == htons(ARPOP_REPLY)) {
372 /* update rx hash table for this ARP */ 372 /* update rx hash table for this ARP */
373 printk("rar: update orig %s bond_dev %s\n", orig_dev->name,
374 bond_dev->name);
375 bond = netdev_priv(bond_dev); 373 bond = netdev_priv(bond_dev);
376 rlb_update_entry_from_arp(bond, arp); 374 rlb_update_entry_from_arp(bond, arp);
377 pr_debug("Server received an ARP Reply from client\n"); 375 pr_debug("Server received an ARP Reply from client\n");
@@ -1708,10 +1706,8 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
1708 * Called with RTNL 1706 * Called with RTNL
1709 */ 1707 */
1710int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr) 1708int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
1711 __releases(&bond->curr_slave_lock)
1712 __releases(&bond->lock)
1713 __acquires(&bond->lock) 1709 __acquires(&bond->lock)
1714 __acquires(&bond->curr_slave_lock) 1710 __releases(&bond->lock)
1715{ 1711{
1716 struct bonding *bond = netdev_priv(bond_dev); 1712 struct bonding *bond = netdev_priv(bond_dev);
1717 struct sockaddr *sa = addr; 1713 struct sockaddr *sa = addr;
@@ -1747,9 +1743,6 @@ int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
1747 } 1743 }
1748 } 1744 }
1749 1745
1750 write_unlock_bh(&bond->curr_slave_lock);
1751 read_unlock(&bond->lock);
1752
1753 if (swap_slave) { 1746 if (swap_slave) {
1754 alb_swap_mac_addr(bond, swap_slave, bond->curr_active_slave); 1747 alb_swap_mac_addr(bond, swap_slave, bond->curr_active_slave);
1755 alb_fasten_mac_swap(bond, swap_slave, bond->curr_active_slave); 1748 alb_fasten_mac_swap(bond, swap_slave, bond->curr_active_slave);
@@ -1757,16 +1750,15 @@ int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
1757 alb_set_slave_mac_addr(bond->curr_active_slave, bond_dev->dev_addr, 1750 alb_set_slave_mac_addr(bond->curr_active_slave, bond_dev->dev_addr,
1758 bond->alb_info.rlb_enabled); 1751 bond->alb_info.rlb_enabled);
1759 1752
1753 read_lock(&bond->lock);
1760 alb_send_learning_packets(bond->curr_active_slave, bond_dev->dev_addr); 1754 alb_send_learning_packets(bond->curr_active_slave, bond_dev->dev_addr);
1761 if (bond->alb_info.rlb_enabled) { 1755 if (bond->alb_info.rlb_enabled) {
1762 /* inform clients mac address has changed */ 1756 /* inform clients mac address has changed */
1763 rlb_req_update_slave_clients(bond, bond->curr_active_slave); 1757 rlb_req_update_slave_clients(bond, bond->curr_active_slave);
1764 } 1758 }
1759 read_unlock(&bond->lock);
1765 } 1760 }
1766 1761
1767 read_lock(&bond->lock);
1768 write_lock_bh(&bond->curr_slave_lock);
1769
1770 return 0; 1762 return 0;
1771} 1763}
1772 1764
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 99610f358c40..2188a96fc090 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2213,33 +2213,24 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in
2213{ 2213{
2214 struct bonding *bond = netdev_priv(bond_dev); 2214 struct bonding *bond = netdev_priv(bond_dev);
2215 struct slave *slave; 2215 struct slave *slave;
2216 int i, found = 0; 2216 int i, res = -ENODEV;
2217
2218 if (info->slave_id < 0) {
2219 return -ENODEV;
2220 }
2221 2217
2222 read_lock(&bond->lock); 2218 read_lock(&bond->lock);
2223 2219
2224 bond_for_each_slave(bond, slave, i) { 2220 bond_for_each_slave(bond, slave, i) {
2225 if (i == (int)info->slave_id) { 2221 if (i == (int)info->slave_id) {
2226 found = 1; 2222 res = 0;
2223 strcpy(info->slave_name, slave->dev->name);
2224 info->link = slave->link;
2225 info->state = slave->state;
2226 info->link_failure_count = slave->link_failure_count;
2227 break; 2227 break;
2228 } 2228 }
2229 } 2229 }
2230 2230
2231 read_unlock(&bond->lock); 2231 read_unlock(&bond->lock);
2232 2232
2233 if (found) { 2233 return res;
2234 strcpy(info->slave_name, slave->dev->name);
2235 info->link = slave->link;
2236 info->state = slave->state;
2237 info->link_failure_count = slave->link_failure_count;
2238 } else {
2239 return -ENODEV;
2240 }
2241
2242 return 0;
2243} 2234}
2244 2235
2245/*-------------------------------- Monitoring -------------------------------*/ 2236/*-------------------------------- Monitoring -------------------------------*/
@@ -2570,7 +2561,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
2570 2561
2571 for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) { 2562 for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) {
2572 if (!targets[i]) 2563 if (!targets[i])
2573 continue; 2564 break;
2574 pr_debug("basa: target %x\n", targets[i]); 2565 pr_debug("basa: target %x\n", targets[i]);
2575 if (list_empty(&bond->vlan_list)) { 2566 if (list_empty(&bond->vlan_list)) {
2576 pr_debug("basa: empty vlan: arp_send\n"); 2567 pr_debug("basa: empty vlan: arp_send\n");
@@ -2677,7 +2668,6 @@ static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32
2677 int i; 2668 int i;
2678 __be32 *targets = bond->params.arp_targets; 2669 __be32 *targets = bond->params.arp_targets;
2679 2670
2680 targets = bond->params.arp_targets;
2681 for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) { 2671 for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) {
2682 pr_debug("bva: sip %pI4 tip %pI4 t[%d] %pI4 bhti(tip) %d\n", 2672 pr_debug("bva: sip %pI4 tip %pI4 t[%d] %pI4 bhti(tip) %d\n",
2683 &sip, &tip, i, &targets[i], bond_has_this_ip(bond, tip)); 2673 &sip, &tip, i, &targets[i], bond_has_this_ip(bond, tip));
@@ -3303,7 +3293,7 @@ static void bond_info_show_master(struct seq_file *seq)
3303 3293
3304 for(i = 0; (i < BOND_MAX_ARP_TARGETS) ;i++) { 3294 for(i = 0; (i < BOND_MAX_ARP_TARGETS) ;i++) {
3305 if (!bond->params.arp_targets[i]) 3295 if (!bond->params.arp_targets[i])
3306 continue; 3296 break;
3307 if (printed) 3297 if (printed)
3308 seq_printf(seq, ","); 3298 seq_printf(seq, ",");
3309 seq_printf(seq, " %pI4", &bond->params.arp_targets[i]); 3299 seq_printf(seq, " %pI4", &bond->params.arp_targets[i]);
@@ -5168,16 +5158,15 @@ int bond_create(char *name, struct bond_params *params)
5168 up_write(&bonding_rwsem); 5158 up_write(&bonding_rwsem);
5169 rtnl_unlock(); /* allows sysfs registration of net device */ 5159 rtnl_unlock(); /* allows sysfs registration of net device */
5170 res = bond_create_sysfs_entry(netdev_priv(bond_dev)); 5160 res = bond_create_sysfs_entry(netdev_priv(bond_dev));
5171 if (res < 0) { 5161 if (res < 0)
5172 rtnl_lock(); 5162 goto out_unreg;
5173 down_write(&bonding_rwsem);
5174 bond_deinit(bond_dev);
5175 unregister_netdevice(bond_dev);
5176 goto out_rtnl;
5177 }
5178 5163
5179 return 0; 5164 return 0;
5180 5165
5166out_unreg:
5167 rtnl_lock();
5168 down_write(&bonding_rwsem);
5169 unregister_netdevice(bond_dev);
5181out_bond: 5170out_bond:
5182 bond_deinit(bond_dev); 5171 bond_deinit(bond_dev);
5183out_netdev: 5172out_netdev:
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 18cf4787874c..d28731535226 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -684,17 +684,15 @@ static ssize_t bonding_store_arp_targets(struct device *d,
684 goto out; 684 goto out;
685 } 685 }
686 /* look for an empty slot to put the target in, and check for dupes */ 686 /* look for an empty slot to put the target in, and check for dupes */
687 for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) { 687 for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) {
688 if (targets[i] == newtarget) { /* duplicate */ 688 if (targets[i] == newtarget) { /* duplicate */
689 printk(KERN_ERR DRV_NAME 689 printk(KERN_ERR DRV_NAME
690 ": %s: ARP target %pI4 is already present\n", 690 ": %s: ARP target %pI4 is already present\n",
691 bond->dev->name, &newtarget); 691 bond->dev->name, &newtarget);
692 if (done)
693 targets[i] = 0;
694 ret = -EINVAL; 692 ret = -EINVAL;
695 goto out; 693 goto out;
696 } 694 }
697 if (targets[i] == 0 && !done) { 695 if (targets[i] == 0) {
698 printk(KERN_INFO DRV_NAME 696 printk(KERN_INFO DRV_NAME
699 ": %s: adding ARP target %pI4.\n", 697 ": %s: adding ARP target %pI4.\n",
700 bond->dev->name, &newtarget); 698 bond->dev->name, &newtarget);
@@ -720,12 +718,16 @@ static ssize_t bonding_store_arp_targets(struct device *d,
720 goto out; 718 goto out;
721 } 719 }
722 720
723 for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) { 721 for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) {
724 if (targets[i] == newtarget) { 722 if (targets[i] == newtarget) {
723 int j;
725 printk(KERN_INFO DRV_NAME 724 printk(KERN_INFO DRV_NAME
726 ": %s: removing ARP target %pI4.\n", 725 ": %s: removing ARP target %pI4.\n",
727 bond->dev->name, &newtarget); 726 bond->dev->name, &newtarget);
728 targets[i] = 0; 727 for (j = i; (j < (BOND_MAX_ARP_TARGETS-1)) && targets[j+1]; j++)
728 targets[j] = targets[j+1];
729
730 targets[j] = 0;
729 done = 1; 731 done = 1;
730 } 732 }
731 } 733 }
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
index c9806c58b2fd..7a18dc7e5c7f 100644
--- a/drivers/net/cris/eth_v10.c
+++ b/drivers/net/cris/eth_v10.c
@@ -257,6 +257,23 @@ struct transceiver_ops transceivers[] =
257 257
258struct transceiver_ops* transceiver = &transceivers[0]; 258struct transceiver_ops* transceiver = &transceivers[0];
259 259
260static const struct net_device_ops e100_netdev_ops = {
261 .ndo_open = e100_open,
262 .ndo_stop = e100_close,
263 .ndo_start_xmit = e100_send_packet,
264 .ndo_tx_timeout = e100_tx_timeout,
265 .ndo_get_stats = e100_get_stats,
266 .ndo_set_multicast_list = set_multicast_list,
267 .ndo_do_ioctl = e100_ioctl,
268 .ndo_set_mac_address = e100_set_mac_address,
269 .ndo_validate_addr = eth_validate_addr,
270 .ndo_change_mtu = eth_change_mtu,
271 .ndo_set_config = e100_set_config,
272#ifdef CONFIG_NET_POLL_CONTROLLER
273 .ndo_poll_controller = e100_netpoll,
274#endif
275};
276
260#define tx_done(dev) (*R_DMA_CH0_CMD == 0) 277#define tx_done(dev) (*R_DMA_CH0_CMD == 0)
261 278
262/* 279/*
@@ -300,19 +317,8 @@ etrax_ethernet_init(void)
300 317
301 /* fill in our handlers so the network layer can talk to us in the future */ 318 /* fill in our handlers so the network layer can talk to us in the future */
302 319
303 dev->open = e100_open;
304 dev->hard_start_xmit = e100_send_packet;
305 dev->stop = e100_close;
306 dev->get_stats = e100_get_stats;
307 dev->set_multicast_list = set_multicast_list;
308 dev->set_mac_address = e100_set_mac_address;
309 dev->ethtool_ops = &e100_ethtool_ops; 320 dev->ethtool_ops = &e100_ethtool_ops;
310 dev->do_ioctl = e100_ioctl; 321 dev->netdev_ops = &e100_netdev_ops;
311 dev->set_config = e100_set_config;
312 dev->tx_timeout = e100_tx_timeout;
313#ifdef CONFIG_NET_POLL_CONTROLLER
314 dev->poll_controller = e100_netpoll;
315#endif
316 322
317 spin_lock_init(&np->lock); 323 spin_lock_init(&np->lock);
318 spin_lock_init(&np->led_lock); 324 spin_lock_init(&np->led_lock);
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index ab0e5febef83..7ea48414c6cb 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -1117,8 +1117,8 @@ static void cxgb_down(struct adapter *adapter)
1117 spin_unlock_irq(&adapter->work_lock); 1117 spin_unlock_irq(&adapter->work_lock);
1118 1118
1119 free_irq_resources(adapter); 1119 free_irq_resources(adapter);
1120 flush_workqueue(cxgb3_wq); /* wait for external IRQ handler */
1121 quiesce_rx(adapter); 1120 quiesce_rx(adapter);
1121 flush_workqueue(cxgb3_wq); /* wait for external IRQ handler */
1122} 1122}
1123 1123
1124static void schedule_chk_task(struct adapter *adap) 1124static void schedule_chk_task(struct adapter *adap)
@@ -1187,6 +1187,9 @@ static int offload_close(struct t3cdev *tdev)
1187 1187
1188 sysfs_remove_group(&tdev->lldev->dev.kobj, &offload_attr_group); 1188 sysfs_remove_group(&tdev->lldev->dev.kobj, &offload_attr_group);
1189 1189
1190 /* Flush work scheduled while releasing TIDs */
1191 flush_scheduled_work();
1192
1190 tdev->lldev = NULL; 1193 tdev->lldev = NULL;
1191 cxgb3_set_dummy_ops(tdev); 1194 cxgb3_set_dummy_ops(tdev);
1192 t3_tp_set_offload_mode(adapter, 0); 1195 t3_tp_set_offload_mode(adapter, 0);
@@ -1232,6 +1235,10 @@ static int cxgb_close(struct net_device *dev)
1232 struct port_info *pi = netdev_priv(dev); 1235 struct port_info *pi = netdev_priv(dev);
1233 struct adapter *adapter = pi->adapter; 1236 struct adapter *adapter = pi->adapter;
1234 1237
1238
1239 if (!adapter->open_device_map)
1240 return 0;
1241
1235 /* Stop link fault interrupts */ 1242 /* Stop link fault interrupts */
1236 t3_xgm_intr_disable(adapter, pi->port_id); 1243 t3_xgm_intr_disable(adapter, pi->port_id);
1237 t3_read_reg(adapter, A_XGM_INT_STATUS + pi->mac.offset); 1244 t3_read_reg(adapter, A_XGM_INT_STATUS + pi->mac.offset);
@@ -1247,8 +1254,7 @@ static int cxgb_close(struct net_device *dev)
1247 spin_unlock_irq(&adapter->work_lock); 1254 spin_unlock_irq(&adapter->work_lock);
1248 1255
1249 if (!(adapter->open_device_map & PORT_MASK)) 1256 if (!(adapter->open_device_map & PORT_MASK))
1250 cancel_rearming_delayed_workqueue(cxgb3_wq, 1257 cancel_delayed_work_sync(&adapter->adap_check_task);
1251 &adapter->adap_check_task);
1252 1258
1253 if (!adapter->open_device_map) 1259 if (!adapter->open_device_map)
1254 cxgb_down(adapter); 1260 cxgb_down(adapter);
@@ -2493,6 +2499,7 @@ static void check_link_status(struct adapter *adapter)
2493 2499
2494 spin_lock_irq(&adapter->work_lock); 2500 spin_lock_irq(&adapter->work_lock);
2495 if (p->link_fault) { 2501 if (p->link_fault) {
2502 t3_link_fault(adapter, i);
2496 spin_unlock_irq(&adapter->work_lock); 2503 spin_unlock_irq(&adapter->work_lock);
2497 continue; 2504 continue;
2498 } 2505 }
@@ -2554,9 +2561,7 @@ static void t3_adap_check_task(struct work_struct *work)
2554 2561
2555 adapter->check_task_cnt++; 2562 adapter->check_task_cnt++;
2556 2563
2557 /* Check link status for PHYs without interrupts */ 2564 check_link_status(adapter);
2558 if (p->linkpoll_period)
2559 check_link_status(adapter);
2560 2565
2561 /* Accumulate MAC stats if needed */ 2566 /* Accumulate MAC stats if needed */
2562 if (!p->linkpoll_period || 2567 if (!p->linkpoll_period ||
@@ -2680,21 +2685,6 @@ void t3_os_ext_intr_handler(struct adapter *adapter)
2680 spin_unlock(&adapter->work_lock); 2685 spin_unlock(&adapter->work_lock);
2681} 2686}
2682 2687
2683static void link_fault_task(struct work_struct *work)
2684{
2685 struct adapter *adapter = container_of(work, struct adapter,
2686 link_fault_handler_task);
2687 int i;
2688
2689 for_each_port(adapter, i) {
2690 struct net_device *netdev = adapter->port[i];
2691 struct port_info *pi = netdev_priv(netdev);
2692
2693 if (pi->link_fault)
2694 t3_link_fault(adapter, i);
2695 }
2696}
2697
2698void t3_os_link_fault_handler(struct adapter *adapter, int port_id) 2688void t3_os_link_fault_handler(struct adapter *adapter, int port_id)
2699{ 2689{
2700 struct net_device *netdev = adapter->port[port_id]; 2690 struct net_device *netdev = adapter->port[port_id];
@@ -2702,7 +2692,6 @@ void t3_os_link_fault_handler(struct adapter *adapter, int port_id)
2702 2692
2703 spin_lock(&adapter->work_lock); 2693 spin_lock(&adapter->work_lock);
2704 pi->link_fault = 1; 2694 pi->link_fault = 1;
2705 queue_work(cxgb3_wq, &adapter->link_fault_handler_task);
2706 spin_unlock(&adapter->work_lock); 2695 spin_unlock(&adapter->work_lock);
2707} 2696}
2708 2697
@@ -2838,6 +2827,9 @@ static pci_ers_result_t t3_io_error_detected(struct pci_dev *pdev,
2838 struct adapter *adapter = pci_get_drvdata(pdev); 2827 struct adapter *adapter = pci_get_drvdata(pdev);
2839 int ret; 2828 int ret;
2840 2829
2830 if (state == pci_channel_io_perm_failure)
2831 return PCI_ERS_RESULT_DISCONNECT;
2832
2841 ret = t3_adapter_error(adapter, 0); 2833 ret = t3_adapter_error(adapter, 0);
2842 2834
2843 /* Request a slot reset. */ 2835 /* Request a slot reset. */
@@ -2932,8 +2924,13 @@ static int __devinit cxgb_enable_msix(struct adapter *adap)
2932 while ((err = pci_enable_msix(adap->pdev, entries, vectors)) > 0) 2924 while ((err = pci_enable_msix(adap->pdev, entries, vectors)) > 0)
2933 vectors = err; 2925 vectors = err;
2934 2926
2935 if (!err && vectors < (adap->params.nports + 1)) 2927 if (err < 0)
2928 pci_disable_msix(adap->pdev);
2929
2930 if (!err && vectors < (adap->params.nports + 1)) {
2931 pci_disable_msix(adap->pdev);
2936 err = -1; 2932 err = -1;
2933 }
2937 2934
2938 if (!err) { 2935 if (!err) {
2939 for (i = 0; i < vectors; ++i) 2936 for (i = 0; i < vectors; ++i)
@@ -3082,7 +3079,6 @@ static int __devinit init_one(struct pci_dev *pdev,
3082 3079
3083 INIT_LIST_HEAD(&adapter->adapter_list); 3080 INIT_LIST_HEAD(&adapter->adapter_list);
3084 INIT_WORK(&adapter->ext_intr_handler_task, ext_intr_task); 3081 INIT_WORK(&adapter->ext_intr_handler_task, ext_intr_task);
3085 INIT_WORK(&adapter->link_fault_handler_task, link_fault_task);
3086 INIT_WORK(&adapter->fatal_error_handler_task, fatal_error_task); 3082 INIT_WORK(&adapter->fatal_error_handler_task, fatal_error_task);
3087 INIT_DELAYED_WORK(&adapter->adap_check_task, t3_adap_check_task); 3083 INIT_DELAYED_WORK(&adapter->adap_check_task, t3_adap_check_task);
3088 3084
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 31ed31a3428b..4f68aeb2679a 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -1202,7 +1202,6 @@ void t3_link_changed(struct adapter *adapter, int port_id)
1202 struct cphy *phy = &pi->phy; 1202 struct cphy *phy = &pi->phy;
1203 struct cmac *mac = &pi->mac; 1203 struct cmac *mac = &pi->mac;
1204 struct link_config *lc = &pi->link_config; 1204 struct link_config *lc = &pi->link_config;
1205 int force_link_down = 0;
1206 1205
1207 phy->ops->get_link_status(phy, &link_ok, &speed, &duplex, &fc); 1206 phy->ops->get_link_status(phy, &link_ok, &speed, &duplex, &fc);
1208 1207
@@ -1218,14 +1217,9 @@ void t3_link_changed(struct adapter *adapter, int port_id)
1218 status = t3_read_reg(adapter, A_XGM_INT_STATUS + mac->offset); 1217 status = t3_read_reg(adapter, A_XGM_INT_STATUS + mac->offset);
1219 if (status & F_LINKFAULTCHANGE) { 1218 if (status & F_LINKFAULTCHANGE) {
1220 mac->stats.link_faults++; 1219 mac->stats.link_faults++;
1221 force_link_down = 1; 1220 pi->link_fault = 1;
1222 } 1221 }
1223 t3_open_rx_traffic(mac, rx_cfg, rx_hash_high, rx_hash_low); 1222 t3_open_rx_traffic(mac, rx_cfg, rx_hash_high, rx_hash_low);
1224
1225 if (force_link_down) {
1226 t3_os_link_fault_handler(adapter, port_id);
1227 return;
1228 }
1229 } 1223 }
1230 1224
1231 if (lc->requested_fc & PAUSE_AUTONEG) 1225 if (lc->requested_fc & PAUSE_AUTONEG)
@@ -1292,9 +1286,6 @@ void t3_link_fault(struct adapter *adapter, int port_id)
1292 /* Account link faults only when the phy reports a link up */ 1286 /* Account link faults only when the phy reports a link up */
1293 if (link_ok) 1287 if (link_ok)
1294 mac->stats.link_faults++; 1288 mac->stats.link_faults++;
1295
1296 msleep(1000);
1297 t3_os_link_fault_handler(adapter, port_id);
1298 } else { 1289 } else {
1299 if (link_ok) 1290 if (link_ok)
1300 t3_write_reg(adapter, A_XGM_XAUI_ACT_CTRL + mac->offset, 1291 t3_write_reg(adapter, A_XGM_XAUI_ACT_CTRL + mac->offset,
@@ -3788,7 +3779,7 @@ int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai,
3788 3779
3789 adapter->params.info = ai; 3780 adapter->params.info = ai;
3790 adapter->params.nports = ai->nports0 + ai->nports1; 3781 adapter->params.nports = ai->nports0 + ai->nports1;
3791 adapter->params.chan_map = !!ai->nports0 | (!!ai->nports1 << 1); 3782 adapter->params.chan_map = (!!ai->nports0) | (!!ai->nports1 << 1);
3792 adapter->params.rev = t3_read_reg(adapter, A_PL_REV); 3783 adapter->params.rev = t3_read_reg(adapter, A_PL_REV);
3793 /* 3784 /*
3794 * We used to only run the "adapter check task" once a second if 3785 * We used to only run the "adapter check task" once a second if
diff --git a/drivers/net/declance.c b/drivers/net/declance.c
index 861c867fca87..b62405a69180 100644
--- a/drivers/net/declance.c
+++ b/drivers/net/declance.c
@@ -1010,6 +1010,17 @@ static void lance_set_multicast_retry(unsigned long _opaque)
1010 lance_set_multicast(dev); 1010 lance_set_multicast(dev);
1011} 1011}
1012 1012
1013static const struct net_device_ops lance_netdev_ops = {
1014 .ndo_open = lance_open,
1015 .ndo_stop = lance_close,
1016 .ndo_start_xmit = lance_start_xmit,
1017 .ndo_tx_timeout = lance_tx_timeout,
1018 .ndo_set_multicast_list = lance_set_multicast,
1019 .ndo_change_mtu = eth_change_mtu,
1020 .ndo_validate_addr = eth_validate_addr,
1021 .ndo_set_mac_address = eth_mac_addr,
1022};
1023
1013static int __init dec_lance_probe(struct device *bdev, const int type) 1024static int __init dec_lance_probe(struct device *bdev, const int type)
1014{ 1025{
1015 static unsigned version_printed; 1026 static unsigned version_printed;
@@ -1223,12 +1234,8 @@ static int __init dec_lance_probe(struct device *bdev, const int type)
1223 1234
1224 printk(", addr = %pM, irq = %d\n", dev->dev_addr, dev->irq); 1235 printk(", addr = %pM, irq = %d\n", dev->dev_addr, dev->irq);
1225 1236
1226 dev->open = &lance_open; 1237 dev->netdev_ops = &lance_netdev_ops;
1227 dev->stop = &lance_close;
1228 dev->hard_start_xmit = &lance_start_xmit;
1229 dev->tx_timeout = &lance_tx_timeout;
1230 dev->watchdog_timeo = 5*HZ; 1238 dev->watchdog_timeo = 5*HZ;
1231 dev->set_multicast_list = &lance_set_multicast;
1232 1239
1233 /* lp->ll is the location of the registers for lance card */ 1240 /* lp->ll is the location of the registers for lance card */
1234 lp->ll = ll; 1241 lp->ll = ll;
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 5c0b457c7868..0f9ee1348552 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2728,7 +2728,7 @@ static void __devexit e100_remove(struct pci_dev *pdev)
2728#define E100_82552_SMARTSPEED 0x14 /* SmartSpeed Ctrl register */ 2728#define E100_82552_SMARTSPEED 0x14 /* SmartSpeed Ctrl register */
2729#define E100_82552_REV_ANEG 0x0200 /* Reverse auto-negotiation */ 2729#define E100_82552_REV_ANEG 0x0200 /* Reverse auto-negotiation */
2730#define E100_82552_ANEG_NOW 0x0400 /* Auto-negotiate now */ 2730#define E100_82552_ANEG_NOW 0x0400 /* Auto-negotiate now */
2731static int e100_suspend(struct pci_dev *pdev, pm_message_t state) 2731static void __e100_shutdown(struct pci_dev *pdev, bool *enable_wake)
2732{ 2732{
2733 struct net_device *netdev = pci_get_drvdata(pdev); 2733 struct net_device *netdev = pci_get_drvdata(pdev);
2734 struct nic *nic = netdev_priv(netdev); 2734 struct nic *nic = netdev_priv(netdev);
@@ -2749,19 +2749,32 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
2749 E100_82552_SMARTSPEED, smartspeed | 2749 E100_82552_SMARTSPEED, smartspeed |
2750 E100_82552_REV_ANEG | E100_82552_ANEG_NOW); 2750 E100_82552_REV_ANEG | E100_82552_ANEG_NOW);
2751 } 2751 }
2752 if (pci_enable_wake(pdev, PCI_D3cold, true)) 2752 *enable_wake = true;
2753 pci_enable_wake(pdev, PCI_D3hot, true);
2754 } else { 2753 } else {
2755 pci_enable_wake(pdev, PCI_D3hot, false); 2754 *enable_wake = false;
2756 } 2755 }
2757 2756
2758 pci_disable_device(pdev); 2757 pci_disable_device(pdev);
2759 pci_set_power_state(pdev, PCI_D3hot); 2758}
2760 2759
2761 return 0; 2760static int __e100_power_off(struct pci_dev *pdev, bool wake)
2761{
2762 if (wake) {
2763 return pci_prepare_to_sleep(pdev);
2764 } else {
2765 pci_wake_from_d3(pdev, false);
2766 return pci_set_power_state(pdev, PCI_D3hot);
2767 }
2762} 2768}
2763 2769
2764#ifdef CONFIG_PM 2770#ifdef CONFIG_PM
2771static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
2772{
2773 bool wake;
2774 __e100_shutdown(pdev, &wake);
2775 return __e100_power_off(pdev, wake);
2776}
2777
2765static int e100_resume(struct pci_dev *pdev) 2778static int e100_resume(struct pci_dev *pdev)
2766{ 2779{
2767 struct net_device *netdev = pci_get_drvdata(pdev); 2780 struct net_device *netdev = pci_get_drvdata(pdev);
@@ -2792,7 +2805,10 @@ static int e100_resume(struct pci_dev *pdev)
2792 2805
2793static void e100_shutdown(struct pci_dev *pdev) 2806static void e100_shutdown(struct pci_dev *pdev)
2794{ 2807{
2795 e100_suspend(pdev, PMSG_SUSPEND); 2808 bool wake;
2809 __e100_shutdown(pdev, &wake);
2810 if (system_state == SYSTEM_POWER_OFF)
2811 __e100_power_off(pdev, wake);
2796} 2812}
2797 2813
2798/* ------------------ PCI Error Recovery infrastructure -------------- */ 2814/* ------------------ PCI Error Recovery infrastructure -------------- */
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index ddc5c533e89c..b1419e21b46b 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -156,8 +156,8 @@ static void e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid);
156static void e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid); 156static void e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid);
157static void e1000_restore_vlan(struct e1000_adapter *adapter); 157static void e1000_restore_vlan(struct e1000_adapter *adapter);
158 158
159static int e1000_suspend(struct pci_dev *pdev, pm_message_t state);
160#ifdef CONFIG_PM 159#ifdef CONFIG_PM
160static int e1000_suspend(struct pci_dev *pdev, pm_message_t state);
161static int e1000_resume(struct pci_dev *pdev); 161static int e1000_resume(struct pci_dev *pdev);
162#endif 162#endif
163static void e1000_shutdown(struct pci_dev *pdev); 163static void e1000_shutdown(struct pci_dev *pdev);
@@ -3738,7 +3738,7 @@ static irqreturn_t e1000_intr(int irq, void *data)
3738 struct e1000_hw *hw = &adapter->hw; 3738 struct e1000_hw *hw = &adapter->hw;
3739 u32 rctl, icr = er32(ICR); 3739 u32 rctl, icr = er32(ICR);
3740 3740
3741 if (unlikely((!icr) || test_bit(__E1000_RESETTING, &adapter->flags))) 3741 if (unlikely((!icr) || test_bit(__E1000_DOWN, &adapter->flags)))
3742 return IRQ_NONE; /* Not our interrupt */ 3742 return IRQ_NONE; /* Not our interrupt */
3743 3743
3744 /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is 3744 /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
@@ -3834,7 +3834,6 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
3834 struct e1000_buffer *buffer_info; 3834 struct e1000_buffer *buffer_info;
3835 unsigned int i, eop; 3835 unsigned int i, eop;
3836 unsigned int count = 0; 3836 unsigned int count = 0;
3837 bool cleaned;
3838 unsigned int total_tx_bytes=0, total_tx_packets=0; 3837 unsigned int total_tx_bytes=0, total_tx_packets=0;
3839 3838
3840 i = tx_ring->next_to_clean; 3839 i = tx_ring->next_to_clean;
@@ -3843,7 +3842,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
3843 3842
3844 while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) && 3843 while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) &&
3845 (count < tx_ring->count)) { 3844 (count < tx_ring->count)) {
3846 for (cleaned = false; !cleaned; count++) { 3845 bool cleaned = false;
3846 for ( ; !cleaned; count++) {
3847 tx_desc = E1000_TX_DESC(*tx_ring, i); 3847 tx_desc = E1000_TX_DESC(*tx_ring, i);
3848 buffer_info = &tx_ring->buffer_info[i]; 3848 buffer_info = &tx_ring->buffer_info[i];
3849 cleaned = (i == eop); 3849 cleaned = (i == eop);
@@ -3871,7 +3871,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
3871 tx_ring->next_to_clean = i; 3871 tx_ring->next_to_clean = i;
3872 3872
3873#define TX_WAKE_THRESHOLD 32 3873#define TX_WAKE_THRESHOLD 32
3874 if (unlikely(cleaned && netif_carrier_ok(netdev) && 3874 if (unlikely(count && netif_carrier_ok(netdev) &&
3875 E1000_DESC_UNUSED(tx_ring) >= TX_WAKE_THRESHOLD)) { 3875 E1000_DESC_UNUSED(tx_ring) >= TX_WAKE_THRESHOLD)) {
3876 /* Make sure that anybody stopping the queue after this 3876 /* Make sure that anybody stopping the queue after this
3877 * sees the new next_to_clean. 3877 * sees the new next_to_clean.
@@ -4601,7 +4601,7 @@ int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
4601 return 0; 4601 return 0;
4602} 4602}
4603 4603
4604static int e1000_suspend(struct pci_dev *pdev, pm_message_t state) 4604static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
4605{ 4605{
4606 struct net_device *netdev = pci_get_drvdata(pdev); 4606 struct net_device *netdev = pci_get_drvdata(pdev);
4607 struct e1000_adapter *adapter = netdev_priv(netdev); 4607 struct e1000_adapter *adapter = netdev_priv(netdev);
@@ -4664,22 +4664,18 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4664 4664
4665 ew32(WUC, E1000_WUC_PME_EN); 4665 ew32(WUC, E1000_WUC_PME_EN);
4666 ew32(WUFC, wufc); 4666 ew32(WUFC, wufc);
4667 pci_enable_wake(pdev, PCI_D3hot, 1);
4668 pci_enable_wake(pdev, PCI_D3cold, 1);
4669 } else { 4667 } else {
4670 ew32(WUC, 0); 4668 ew32(WUC, 0);
4671 ew32(WUFC, 0); 4669 ew32(WUFC, 0);
4672 pci_enable_wake(pdev, PCI_D3hot, 0);
4673 pci_enable_wake(pdev, PCI_D3cold, 0);
4674 } 4670 }
4675 4671
4676 e1000_release_manageability(adapter); 4672 e1000_release_manageability(adapter);
4677 4673
4674 *enable_wake = !!wufc;
4675
4678 /* make sure adapter isn't asleep if manageability is enabled */ 4676 /* make sure adapter isn't asleep if manageability is enabled */
4679 if (adapter->en_mng_pt) { 4677 if (adapter->en_mng_pt)
4680 pci_enable_wake(pdev, PCI_D3hot, 1); 4678 *enable_wake = true;
4681 pci_enable_wake(pdev, PCI_D3cold, 1);
4682 }
4683 4679
4684 if (hw->phy_type == e1000_phy_igp_3) 4680 if (hw->phy_type == e1000_phy_igp_3)
4685 e1000_phy_powerdown_workaround(hw); 4681 e1000_phy_powerdown_workaround(hw);
@@ -4693,12 +4689,29 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4693 4689
4694 pci_disable_device(pdev); 4690 pci_disable_device(pdev);
4695 4691
4696 pci_set_power_state(pdev, pci_choose_state(pdev, state));
4697
4698 return 0; 4692 return 0;
4699} 4693}
4700 4694
4701#ifdef CONFIG_PM 4695#ifdef CONFIG_PM
4696static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4697{
4698 int retval;
4699 bool wake;
4700
4701 retval = __e1000_shutdown(pdev, &wake);
4702 if (retval)
4703 return retval;
4704
4705 if (wake) {
4706 pci_prepare_to_sleep(pdev);
4707 } else {
4708 pci_wake_from_d3(pdev, false);
4709 pci_set_power_state(pdev, PCI_D3hot);
4710 }
4711
4712 return 0;
4713}
4714
4702static int e1000_resume(struct pci_dev *pdev) 4715static int e1000_resume(struct pci_dev *pdev)
4703{ 4716{
4704 struct net_device *netdev = pci_get_drvdata(pdev); 4717 struct net_device *netdev = pci_get_drvdata(pdev);
@@ -4753,7 +4766,14 @@ static int e1000_resume(struct pci_dev *pdev)
4753 4766
4754static void e1000_shutdown(struct pci_dev *pdev) 4767static void e1000_shutdown(struct pci_dev *pdev)
4755{ 4768{
4756 e1000_suspend(pdev, PMSG_SUSPEND); 4769 bool wake;
4770
4771 __e1000_shutdown(pdev, &wake);
4772
4773 if (system_state == SYSTEM_POWER_OFF) {
4774 pci_wake_from_d3(pdev, wake);
4775 pci_set_power_state(pdev, PCI_D3hot);
4776 }
4757} 4777}
4758 4778
4759#ifdef CONFIG_NET_POLL_CONTROLLER 4779#ifdef CONFIG_NET_POLL_CONTROLLER
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 409b58cad0e5..ca82f19a7ed1 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -621,7 +621,6 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
621 struct e1000_buffer *buffer_info; 621 struct e1000_buffer *buffer_info;
622 unsigned int i, eop; 622 unsigned int i, eop;
623 unsigned int count = 0; 623 unsigned int count = 0;
624 bool cleaned;
625 unsigned int total_tx_bytes = 0, total_tx_packets = 0; 624 unsigned int total_tx_bytes = 0, total_tx_packets = 0;
626 625
627 i = tx_ring->next_to_clean; 626 i = tx_ring->next_to_clean;
@@ -630,7 +629,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
630 629
631 while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) && 630 while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) &&
632 (count < tx_ring->count)) { 631 (count < tx_ring->count)) {
633 for (cleaned = 0; !cleaned; count++) { 632 bool cleaned = false;
633 for (; !cleaned; count++) {
634 tx_desc = E1000_TX_DESC(*tx_ring, i); 634 tx_desc = E1000_TX_DESC(*tx_ring, i);
635 buffer_info = &tx_ring->buffer_info[i]; 635 buffer_info = &tx_ring->buffer_info[i];
636 cleaned = (i == eop); 636 cleaned = (i == eop);
@@ -661,8 +661,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
661 tx_ring->next_to_clean = i; 661 tx_ring->next_to_clean = i;
662 662
663#define TX_WAKE_THRESHOLD 32 663#define TX_WAKE_THRESHOLD 32
664 if (cleaned && netif_carrier_ok(netdev) && 664 if (count && netif_carrier_ok(netdev) &&
665 e1000_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD) { 665 e1000_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD) {
666 /* Make sure that anybody stopping the queue after this 666 /* Make sure that anybody stopping the queue after this
667 * sees the new next_to_clean. 667 * sees the new next_to_clean.
668 */ 668 */
@@ -4346,7 +4346,7 @@ static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
4346 } 4346 }
4347} 4347}
4348 4348
4349static int e1000_suspend(struct pci_dev *pdev, pm_message_t state) 4349static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
4350{ 4350{
4351 struct net_device *netdev = pci_get_drvdata(pdev); 4351 struct net_device *netdev = pci_get_drvdata(pdev);
4352 struct e1000_adapter *adapter = netdev_priv(netdev); 4352 struct e1000_adapter *adapter = netdev_priv(netdev);
@@ -4409,20 +4409,16 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4409 4409
4410 ew32(WUC, E1000_WUC_PME_EN); 4410 ew32(WUC, E1000_WUC_PME_EN);
4411 ew32(WUFC, wufc); 4411 ew32(WUFC, wufc);
4412 pci_enable_wake(pdev, PCI_D3hot, 1);
4413 pci_enable_wake(pdev, PCI_D3cold, 1);
4414 } else { 4412 } else {
4415 ew32(WUC, 0); 4413 ew32(WUC, 0);
4416 ew32(WUFC, 0); 4414 ew32(WUFC, 0);
4417 pci_enable_wake(pdev, PCI_D3hot, 0);
4418 pci_enable_wake(pdev, PCI_D3cold, 0);
4419 } 4415 }
4420 4416
4417 *enable_wake = !!wufc;
4418
4421 /* make sure adapter isn't asleep if manageability is enabled */ 4419 /* make sure adapter isn't asleep if manageability is enabled */
4422 if (adapter->flags & FLAG_MNG_PT_ENABLED) { 4420 if (adapter->flags & FLAG_MNG_PT_ENABLED)
4423 pci_enable_wake(pdev, PCI_D3hot, 1); 4421 *enable_wake = true;
4424 pci_enable_wake(pdev, PCI_D3cold, 1);
4425 }
4426 4422
4427 if (adapter->hw.phy.type == e1000_phy_igp_3) 4423 if (adapter->hw.phy.type == e1000_phy_igp_3)
4428 e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); 4424 e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw);
@@ -4435,6 +4431,26 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4435 4431
4436 pci_disable_device(pdev); 4432 pci_disable_device(pdev);
4437 4433
4434 return 0;
4435}
4436
4437static void e1000_power_off(struct pci_dev *pdev, bool sleep, bool wake)
4438{
4439 if (sleep && wake) {
4440 pci_prepare_to_sleep(pdev);
4441 return;
4442 }
4443
4444 pci_wake_from_d3(pdev, wake);
4445 pci_set_power_state(pdev, PCI_D3hot);
4446}
4447
4448static void e1000_complete_shutdown(struct pci_dev *pdev, bool sleep,
4449 bool wake)
4450{
4451 struct net_device *netdev = pci_get_drvdata(pdev);
4452 struct e1000_adapter *adapter = netdev_priv(netdev);
4453
4438 /* 4454 /*
4439 * The pci-e switch on some quad port adapters will report a 4455 * The pci-e switch on some quad port adapters will report a
4440 * correctable error when the MAC transitions from D0 to D3. To 4456 * correctable error when the MAC transitions from D0 to D3. To
@@ -4450,14 +4466,12 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4450 pci_write_config_word(us_dev, pos + PCI_EXP_DEVCTL, 4466 pci_write_config_word(us_dev, pos + PCI_EXP_DEVCTL,
4451 (devctl & ~PCI_EXP_DEVCTL_CERE)); 4467 (devctl & ~PCI_EXP_DEVCTL_CERE));
4452 4468
4453 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 4469 e1000_power_off(pdev, sleep, wake);
4454 4470
4455 pci_write_config_word(us_dev, pos + PCI_EXP_DEVCTL, devctl); 4471 pci_write_config_word(us_dev, pos + PCI_EXP_DEVCTL, devctl);
4456 } else { 4472 } else {
4457 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 4473 e1000_power_off(pdev, sleep, wake);
4458 } 4474 }
4459
4460 return 0;
4461} 4475}
4462 4476
4463static void e1000e_disable_l1aspm(struct pci_dev *pdev) 4477static void e1000e_disable_l1aspm(struct pci_dev *pdev)
@@ -4486,6 +4500,18 @@ static void e1000e_disable_l1aspm(struct pci_dev *pdev)
4486} 4500}
4487 4501
4488#ifdef CONFIG_PM 4502#ifdef CONFIG_PM
4503static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4504{
4505 int retval;
4506 bool wake;
4507
4508 retval = __e1000_shutdown(pdev, &wake);
4509 if (!retval)
4510 e1000_complete_shutdown(pdev, true, wake);
4511
4512 return retval;
4513}
4514
4489static int e1000_resume(struct pci_dev *pdev) 4515static int e1000_resume(struct pci_dev *pdev)
4490{ 4516{
4491 struct net_device *netdev = pci_get_drvdata(pdev); 4517 struct net_device *netdev = pci_get_drvdata(pdev);
@@ -4549,7 +4575,12 @@ static int e1000_resume(struct pci_dev *pdev)
4549 4575
4550static void e1000_shutdown(struct pci_dev *pdev) 4576static void e1000_shutdown(struct pci_dev *pdev)
4551{ 4577{
4552 e1000_suspend(pdev, PMSG_SUSPEND); 4578 bool wake = false;
4579
4580 __e1000_shutdown(pdev, &wake);
4581
4582 if (system_state == SYSTEM_POWER_OFF)
4583 e1000_complete_shutdown(pdev, false, wake);
4553} 4584}
4554 4585
4555#ifdef CONFIG_NET_POLL_CONTROLLER 4586#ifdef CONFIG_NET_POLL_CONTROLLER
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 6e317caf429c..16a41389575a 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_0100" 43#define DRV_VERSION "EHEA_0101"
44 44
45/* eHEA capability flags */ 45/* eHEA capability flags */
46#define DLPAR_PORT_ADD_REM 1 46#define DLPAR_PORT_ADD_REM 1
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index ac0c5b438e0a..b22dab9153f6 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -545,14 +545,17 @@ static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array,
545 x &= (arr_len - 1); 545 x &= (arr_len - 1);
546 546
547 pref = skb_array[x]; 547 pref = skb_array[x];
548 prefetchw(pref); 548 if (pref) {
549 prefetchw(pref + EHEA_CACHE_LINE); 549 prefetchw(pref);
550 550 prefetchw(pref + EHEA_CACHE_LINE);
551 pref = (skb_array[x]->data); 551
552 prefetch(pref); 552 pref = (skb_array[x]->data);
553 prefetch(pref + EHEA_CACHE_LINE); 553 prefetch(pref);
554 prefetch(pref + EHEA_CACHE_LINE * 2); 554 prefetch(pref + EHEA_CACHE_LINE);
555 prefetch(pref + EHEA_CACHE_LINE * 3); 555 prefetch(pref + EHEA_CACHE_LINE * 2);
556 prefetch(pref + EHEA_CACHE_LINE * 3);
557 }
558
556 skb = skb_array[skb_index]; 559 skb = skb_array[skb_index];
557 skb_array[skb_index] = NULL; 560 skb_array[skb_index] = NULL;
558 return skb; 561 return skb;
@@ -569,12 +572,14 @@ static inline struct sk_buff *get_skb_by_index_ll(struct sk_buff **skb_array,
569 x &= (arr_len - 1); 572 x &= (arr_len - 1);
570 573
571 pref = skb_array[x]; 574 pref = skb_array[x];
572 prefetchw(pref); 575 if (pref) {
573 prefetchw(pref + EHEA_CACHE_LINE); 576 prefetchw(pref);
577 prefetchw(pref + EHEA_CACHE_LINE);
574 578
575 pref = (skb_array[x]->data); 579 pref = (skb_array[x]->data);
576 prefetchw(pref); 580 prefetchw(pref);
577 prefetchw(pref + EHEA_CACHE_LINE); 581 prefetchw(pref + EHEA_CACHE_LINE);
582 }
578 583
579 skb = skb_array[wqe_index]; 584 skb = skb_array[wqe_index];
580 skb_array[wqe_index] = NULL; 585 skb_array[wqe_index] = NULL;
@@ -3080,7 +3085,8 @@ static const struct net_device_ops ehea_netdev_ops = {
3080 .ndo_change_mtu = ehea_change_mtu, 3085 .ndo_change_mtu = ehea_change_mtu,
3081 .ndo_vlan_rx_register = ehea_vlan_rx_register, 3086 .ndo_vlan_rx_register = ehea_vlan_rx_register,
3082 .ndo_vlan_rx_add_vid = ehea_vlan_rx_add_vid, 3087 .ndo_vlan_rx_add_vid = ehea_vlan_rx_add_vid,
3083 .ndo_vlan_rx_kill_vid = ehea_vlan_rx_kill_vid 3088 .ndo_vlan_rx_kill_vid = ehea_vlan_rx_kill_vid,
3089 .ndo_tx_timeout = ehea_tx_watchdog,
3084}; 3090};
3085 3091
3086struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter, 3092struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter,
@@ -3142,7 +3148,6 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter,
3142 | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX 3148 | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX
3143 | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER 3149 | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER
3144 | NETIF_F_LLTX; 3150 | NETIF_F_LLTX;
3145 dev->tx_timeout = &ehea_tx_watchdog;
3146 dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT; 3151 dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT;
3147 3152
3148 INIT_WORK(&port->reset_task, ehea_reset_port); 3153 INIT_WORK(&port->reset_task, ehea_reset_port);
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index d37465020bcc..f9a846b1b92f 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -1880,6 +1880,7 @@ static void nv_init_tx(struct net_device *dev)
1880 np->tx_pkts_in_progress = 0; 1880 np->tx_pkts_in_progress = 0;
1881 np->tx_change_owner = NULL; 1881 np->tx_change_owner = NULL;
1882 np->tx_end_flip = NULL; 1882 np->tx_end_flip = NULL;
1883 np->tx_stop = 0;
1883 1884
1884 for (i = 0; i < np->tx_ring_size; i++) { 1885 for (i = 0; i < np->tx_ring_size; i++) {
1885 if (!nv_optimized(np)) { 1886 if (!nv_optimized(np)) {
@@ -2530,6 +2531,8 @@ static void nv_tx_timeout(struct net_device *dev)
2530 struct fe_priv *np = netdev_priv(dev); 2531 struct fe_priv *np = netdev_priv(dev);
2531 u8 __iomem *base = get_hwbase(dev); 2532 u8 __iomem *base = get_hwbase(dev);
2532 u32 status; 2533 u32 status;
2534 union ring_type put_tx;
2535 int saved_tx_limit;
2533 2536
2534 if (np->msi_flags & NV_MSI_X_ENABLED) 2537 if (np->msi_flags & NV_MSI_X_ENABLED)
2535 status = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK; 2538 status = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK;
@@ -2589,24 +2592,32 @@ static void nv_tx_timeout(struct net_device *dev)
2589 /* 1) stop tx engine */ 2592 /* 1) stop tx engine */
2590 nv_stop_tx(dev); 2593 nv_stop_tx(dev);
2591 2594
2592 /* 2) check that the packets were not sent already: */ 2595 /* 2) complete any outstanding tx and do not give HW any limited tx pkts */
2596 saved_tx_limit = np->tx_limit;
2597 np->tx_limit = 0; /* prevent giving HW any limited pkts */
2598 np->tx_stop = 0; /* prevent waking tx queue */
2593 if (!nv_optimized(np)) 2599 if (!nv_optimized(np))
2594 nv_tx_done(dev, np->tx_ring_size); 2600 nv_tx_done(dev, np->tx_ring_size);
2595 else 2601 else
2596 nv_tx_done_optimized(dev, np->tx_ring_size); 2602 nv_tx_done_optimized(dev, np->tx_ring_size);
2597 2603
2598 /* 3) if there are dead entries: clear everything */ 2604 /* save current HW postion */
2599 if (np->get_tx_ctx != np->put_tx_ctx) { 2605 if (np->tx_change_owner)
2600 printk(KERN_DEBUG "%s: tx_timeout: dead entries!\n", dev->name); 2606 put_tx.ex = np->tx_change_owner->first_tx_desc;
2601 nv_drain_tx(dev); 2607 else
2602 nv_init_tx(dev); 2608 put_tx = np->put_tx;
2603 setup_hw_rings(dev, NV_SETUP_TX_RING);
2604 }
2605 2609
2606 netif_wake_queue(dev); 2610 /* 3) clear all tx state */
2611 nv_drain_tx(dev);
2612 nv_init_tx(dev);
2613
2614 /* 4) restore state to current HW position */
2615 np->get_tx = np->put_tx = put_tx;
2616 np->tx_limit = saved_tx_limit;
2607 2617
2608 /* 4) restart tx engine */ 2618 /* 5) restart tx engine */
2609 nv_start_tx(dev); 2619 nv_start_tx(dev);
2620 netif_wake_queue(dev);
2610 spin_unlock_irq(&np->lock); 2621 spin_unlock_irq(&np->lock);
2611} 2622}
2612 2623
@@ -3745,14 +3756,14 @@ static int nv_napi_poll(struct napi_struct *napi, int budget)
3745 mod_timer(&np->nic_poll, jiffies + POLL_WAIT); 3756 mod_timer(&np->nic_poll, jiffies + POLL_WAIT);
3746 } 3757 }
3747 spin_unlock_irqrestore(&np->lock, flags); 3758 spin_unlock_irqrestore(&np->lock, flags);
3748 __napi_complete(napi); 3759 napi_complete(napi);
3749 return rx_work; 3760 return rx_work;
3750 } 3761 }
3751 3762
3752 if (rx_work < budget) { 3763 if (rx_work < budget) {
3753 /* re-enable interrupts 3764 /* re-enable interrupts
3754 (msix not enabled in napi) */ 3765 (msix not enabled in napi) */
3755 __napi_complete(napi); 3766 napi_complete(napi);
3756 3767
3757 writel(np->irqmask, base + NvRegIrqMask); 3768 writel(np->irqmask, base + NvRegIrqMask);
3758 } 3769 }
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index b037ce9857bf..a9cbc3191a2a 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -1019,6 +1019,22 @@ out_put_phy:
1019#define IS_FEC(match) 0 1019#define IS_FEC(match) 0
1020#endif 1020#endif
1021 1021
1022static const struct net_device_ops fs_enet_netdev_ops = {
1023 .ndo_open = fs_enet_open,
1024 .ndo_stop = fs_enet_close,
1025 .ndo_get_stats = fs_enet_get_stats,
1026 .ndo_start_xmit = fs_enet_start_xmit,
1027 .ndo_tx_timeout = fs_timeout,
1028 .ndo_set_multicast_list = fs_set_multicast_list,
1029 .ndo_do_ioctl = fs_ioctl,
1030 .ndo_validate_addr = eth_validate_addr,
1031 .ndo_set_mac_address = eth_mac_addr,
1032 .ndo_change_mtu = eth_change_mtu,
1033#ifdef CONFIG_NET_POLL_CONTROLLER
1034 .ndo_poll_controller = fs_enet_netpoll,
1035#endif
1036};
1037
1022static int __devinit fs_enet_probe(struct of_device *ofdev, 1038static int __devinit fs_enet_probe(struct of_device *ofdev,
1023 const struct of_device_id *match) 1039 const struct of_device_id *match)
1024{ 1040{
@@ -1093,22 +1109,13 @@ static int __devinit fs_enet_probe(struct of_device *ofdev,
1093 fep->tx_ring = fpi->tx_ring; 1109 fep->tx_ring = fpi->tx_ring;
1094 fep->rx_ring = fpi->rx_ring; 1110 fep->rx_ring = fpi->rx_ring;
1095 1111
1096 ndev->open = fs_enet_open; 1112 ndev->netdev_ops = &fs_enet_netdev_ops;
1097 ndev->hard_start_xmit = fs_enet_start_xmit;
1098 ndev->tx_timeout = fs_timeout;
1099 ndev->watchdog_timeo = 2 * HZ; 1113 ndev->watchdog_timeo = 2 * HZ;
1100 ndev->stop = fs_enet_close;
1101 ndev->get_stats = fs_enet_get_stats;
1102 ndev->set_multicast_list = fs_set_multicast_list;
1103#ifdef CONFIG_NET_POLL_CONTROLLER
1104 ndev->poll_controller = fs_enet_netpoll;
1105#endif
1106 if (fpi->use_napi) 1114 if (fpi->use_napi)
1107 netif_napi_add(ndev, &fep->napi, fs_enet_rx_napi, 1115 netif_napi_add(ndev, &fep->napi, fs_enet_rx_napi,
1108 fpi->napi_weight); 1116 fpi->napi_weight);
1109 1117
1110 ndev->ethtool_ops = &fs_ethtool_ops; 1118 ndev->ethtool_ops = &fs_ethtool_ops;
1111 ndev->do_ioctl = fs_ioctl;
1112 1119
1113 init_timer(&fep->phy_timer_list); 1120 init_timer(&fep->phy_timer_list);
1114 1121
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 65f55877be95..b2c49679bba7 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1583,8 +1583,10 @@ static void gfar_reset_task(struct work_struct *work)
1583 struct net_device *dev = priv->ndev; 1583 struct net_device *dev = priv->ndev;
1584 1584
1585 if (dev->flags & IFF_UP) { 1585 if (dev->flags & IFF_UP) {
1586 netif_stop_queue(dev);
1586 stop_gfar(dev); 1587 stop_gfar(dev);
1587 startup_gfar(dev); 1588 startup_gfar(dev);
1589 netif_start_queue(dev);
1588 } 1590 }
1589 1591
1590 netif_tx_schedule_all(dev); 1592 netif_tx_schedule_all(dev);
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 77e4b5b52fc8..806533c831c7 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -2686,6 +2686,32 @@ static int __devinit emac_init_config(struct emac_instance *dev)
2686 return 0; 2686 return 0;
2687} 2687}
2688 2688
2689static const struct net_device_ops emac_netdev_ops = {
2690 .ndo_open = emac_open,
2691 .ndo_stop = emac_close,
2692 .ndo_get_stats = emac_stats,
2693 .ndo_set_multicast_list = emac_set_multicast_list,
2694 .ndo_do_ioctl = emac_ioctl,
2695 .ndo_tx_timeout = emac_tx_timeout,
2696 .ndo_validate_addr = eth_validate_addr,
2697 .ndo_set_mac_address = eth_mac_addr,
2698 .ndo_start_xmit = emac_start_xmit,
2699 .ndo_change_mtu = eth_change_mtu,
2700};
2701
2702static const struct net_device_ops emac_gige_netdev_ops = {
2703 .ndo_open = emac_open,
2704 .ndo_stop = emac_close,
2705 .ndo_get_stats = emac_stats,
2706 .ndo_set_multicast_list = emac_set_multicast_list,
2707 .ndo_do_ioctl = emac_ioctl,
2708 .ndo_tx_timeout = emac_tx_timeout,
2709 .ndo_validate_addr = eth_validate_addr,
2710 .ndo_set_mac_address = eth_mac_addr,
2711 .ndo_start_xmit = emac_start_xmit_sg,
2712 .ndo_change_mtu = emac_change_mtu,
2713};
2714
2689static int __devinit emac_probe(struct of_device *ofdev, 2715static int __devinit emac_probe(struct of_device *ofdev,
2690 const struct of_device_id *match) 2716 const struct of_device_id *match)
2691{ 2717{
@@ -2827,23 +2853,14 @@ static int __devinit emac_probe(struct of_device *ofdev,
2827 if (err != 0) 2853 if (err != 0)
2828 goto err_detach_tah; 2854 goto err_detach_tah;
2829 2855
2830 /* Fill in the driver function table */
2831 ndev->open = &emac_open;
2832 if (dev->tah_dev) 2856 if (dev->tah_dev)
2833 ndev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; 2857 ndev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
2834 ndev->tx_timeout = &emac_tx_timeout;
2835 ndev->watchdog_timeo = 5 * HZ; 2858 ndev->watchdog_timeo = 5 * HZ;
2836 ndev->stop = &emac_close;
2837 ndev->get_stats = &emac_stats;
2838 ndev->set_multicast_list = &emac_set_multicast_list;
2839 ndev->do_ioctl = &emac_ioctl;
2840 if (emac_phy_supports_gige(dev->phy_mode)) { 2859 if (emac_phy_supports_gige(dev->phy_mode)) {
2841 ndev->hard_start_xmit = &emac_start_xmit_sg; 2860 ndev->netdev_ops = &emac_gige_netdev_ops;
2842 ndev->change_mtu = &emac_change_mtu;
2843 dev->commac.ops = &emac_commac_sg_ops; 2861 dev->commac.ops = &emac_commac_sg_ops;
2844 } else { 2862 } else
2845 ndev->hard_start_xmit = &emac_start_xmit; 2863 ndev->netdev_ops = &emac_netdev_ops;
2846 }
2847 SET_ETHTOOL_OPS(ndev, &emac_ethtool_ops); 2864 SET_ETHTOOL_OPS(ndev, &emac_ethtool_ops);
2848 2865
2849 netif_carrier_off(ndev); 2866 netif_carrier_off(ndev);
diff --git a/drivers/net/igb/e1000_mac.c b/drivers/net/igb/e1000_mac.c
index f4c315b5a900..472f3f124840 100644
--- a/drivers/net/igb/e1000_mac.c
+++ b/drivers/net/igb/e1000_mac.c
@@ -111,7 +111,7 @@ void igb_clear_vfta(struct e1000_hw *hw)
111 * Writes value at the given offset in the register array which stores 111 * Writes value at the given offset in the register array which stores
112 * the VLAN filter table. 112 * the VLAN filter table.
113 **/ 113 **/
114void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) 114static void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
115{ 115{
116 array_wr32(E1000_VFTA, offset, value); 116 array_wr32(E1000_VFTA, offset, value);
117 wrfl(); 117 wrfl();
diff --git a/drivers/net/igb/e1000_mac.h b/drivers/net/igb/e1000_mac.h
index a34de5269637..1d690b4c9ae4 100644
--- a/drivers/net/igb/e1000_mac.h
+++ b/drivers/net/igb/e1000_mac.h
@@ -66,7 +66,6 @@ void igb_rar_set(struct e1000_hw *hw, u8 *addr, u32 index);
66s32 igb_check_alt_mac_addr(struct e1000_hw *hw); 66s32 igb_check_alt_mac_addr(struct e1000_hw *hw);
67void igb_reset_adaptive(struct e1000_hw *hw); 67void igb_reset_adaptive(struct e1000_hw *hw);
68void igb_update_adaptive(struct e1000_hw *hw); 68void igb_update_adaptive(struct e1000_hw *hw);
69void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value);
70 69
71bool igb_enable_mng_pass_thru(struct e1000_hw *hw); 70bool igb_enable_mng_pass_thru(struct e1000_hw *hw);
72 71
diff --git a/drivers/net/igb/e1000_mbx.c b/drivers/net/igb/e1000_mbx.c
index fe71c7ddaa05..840782fb5736 100644
--- a/drivers/net/igb/e1000_mbx.c
+++ b/drivers/net/igb/e1000_mbx.c
@@ -188,7 +188,7 @@ out:
188 * returns SUCCESS if it successfully received a message notification and 188 * returns SUCCESS if it successfully received a message notification and
189 * copied it into the receive buffer. 189 * copied it into the receive buffer.
190 **/ 190 **/
191s32 igb_read_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id) 191static s32 igb_read_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
192{ 192{
193 struct e1000_mbx_info *mbx = &hw->mbx; 193 struct e1000_mbx_info *mbx = &hw->mbx;
194 s32 ret_val = -E1000_ERR_MBX; 194 s32 ret_val = -E1000_ERR_MBX;
@@ -214,7 +214,7 @@ out:
214 * returns SUCCESS if it successfully copied message into the buffer and 214 * returns SUCCESS if it successfully copied message into the buffer and
215 * received an ack to that message within delay * timeout period 215 * received an ack to that message within delay * timeout period
216 **/ 216 **/
217s32 igb_write_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id) 217static s32 igb_write_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
218{ 218{
219 struct e1000_mbx_info *mbx = &hw->mbx; 219 struct e1000_mbx_info *mbx = &hw->mbx;
220 s32 ret_val = 0; 220 s32 ret_val = 0;
@@ -232,19 +232,6 @@ out:
232 return ret_val; 232 return ret_val;
233} 233}
234 234
235/**
236 * e1000_init_mbx_ops_generic - Initialize NVM function pointers
237 * @hw: pointer to the HW structure
238 *
239 * Setups up the function pointers to no-op functions
240 **/
241void e1000_init_mbx_ops_generic(struct e1000_hw *hw)
242{
243 struct e1000_mbx_info *mbx = &hw->mbx;
244 mbx->ops.read_posted = igb_read_posted_mbx;
245 mbx->ops.write_posted = igb_write_posted_mbx;
246}
247
248static s32 igb_check_for_bit_pf(struct e1000_hw *hw, u32 mask) 235static s32 igb_check_for_bit_pf(struct e1000_hw *hw, u32 mask)
249{ 236{
250 u32 mbvficr = rd32(E1000_MBVFICR); 237 u32 mbvficr = rd32(E1000_MBVFICR);
diff --git a/drivers/net/igb/e1000_mbx.h b/drivers/net/igb/e1000_mbx.h
index 6ec9890a8f7a..ebc02ea3f198 100644
--- a/drivers/net/igb/e1000_mbx.h
+++ b/drivers/net/igb/e1000_mbx.h
@@ -67,8 +67,6 @@
67 67
68s32 igb_read_mbx(struct e1000_hw *, u32 *, u16, u16); 68s32 igb_read_mbx(struct e1000_hw *, u32 *, u16, u16);
69s32 igb_write_mbx(struct e1000_hw *, u32 *, u16, u16); 69s32 igb_write_mbx(struct e1000_hw *, u32 *, u16, u16);
70s32 igb_read_posted_mbx(struct e1000_hw *, u32 *, u16, u16);
71s32 igb_write_posted_mbx(struct e1000_hw *, u32 *, u16, u16);
72s32 igb_check_for_msg(struct e1000_hw *, u16); 70s32 igb_check_for_msg(struct e1000_hw *, u16);
73s32 igb_check_for_ack(struct e1000_hw *, u16); 71s32 igb_check_for_ack(struct e1000_hw *, u16);
74s32 igb_check_for_rst(struct e1000_hw *, u16); 72s32 igb_check_for_rst(struct e1000_hw *, u16);
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index db7274e62228..08c801490c72 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -1261,25 +1261,32 @@ static int __devinit igb_probe(struct pci_dev *pdev,
1261 int i; 1261 int i;
1262 unsigned char mac_addr[ETH_ALEN]; 1262 unsigned char mac_addr[ETH_ALEN];
1263 1263
1264 if (num_vfs) 1264 if (num_vfs) {
1265 adapter->vf_data = kcalloc(num_vfs, 1265 adapter->vf_data = kcalloc(num_vfs,
1266 sizeof(struct vf_data_storage), 1266 sizeof(struct vf_data_storage),
1267 GFP_KERNEL); 1267 GFP_KERNEL);
1268 if (!adapter->vf_data) { 1268 if (!adapter->vf_data) {
1269 dev_err(&pdev->dev, "Could not allocate VF private " 1269 dev_err(&pdev->dev,
1270 "data - IOV enable failed\n"); 1270 "Could not allocate VF private data - "
1271 } else { 1271 "IOV enable failed\n");
1272 err = pci_enable_sriov(pdev, num_vfs);
1273 if (!err) {
1274 adapter->vfs_allocated_count = num_vfs;
1275 dev_info(&pdev->dev, "%d vfs allocated\n", num_vfs);
1276 for (i = 0; i < adapter->vfs_allocated_count; i++) {
1277 random_ether_addr(mac_addr);
1278 igb_set_vf_mac(adapter, i, mac_addr);
1279 }
1280 } else { 1272 } else {
1281 kfree(adapter->vf_data); 1273 err = pci_enable_sriov(pdev, num_vfs);
1282 adapter->vf_data = NULL; 1274 if (!err) {
1275 adapter->vfs_allocated_count = num_vfs;
1276 dev_info(&pdev->dev,
1277 "%d vfs allocated\n",
1278 num_vfs);
1279 for (i = 0;
1280 i < adapter->vfs_allocated_count;
1281 i++) {
1282 random_ether_addr(mac_addr);
1283 igb_set_vf_mac(adapter, i,
1284 mac_addr);
1285 }
1286 } else {
1287 kfree(adapter->vf_data);
1288 adapter->vf_data = NULL;
1289 }
1283 } 1290 }
1284 } 1291 }
1285 } 1292 }
diff --git a/drivers/net/igbvf/igbvf.h b/drivers/net/igbvf/igbvf.h
index 936ed2a9435f..4bff35e46871 100644
--- a/drivers/net/igbvf/igbvf.h
+++ b/drivers/net/igbvf/igbvf.h
@@ -321,14 +321,11 @@ extern void igbvf_set_ethtool_ops(struct net_device *);
321extern int igbvf_up(struct igbvf_adapter *); 321extern int igbvf_up(struct igbvf_adapter *);
322extern void igbvf_down(struct igbvf_adapter *); 322extern void igbvf_down(struct igbvf_adapter *);
323extern void igbvf_reinit_locked(struct igbvf_adapter *); 323extern void igbvf_reinit_locked(struct igbvf_adapter *);
324extern void igbvf_reset(struct igbvf_adapter *);
325extern int igbvf_setup_rx_resources(struct igbvf_adapter *, struct igbvf_ring *); 324extern int igbvf_setup_rx_resources(struct igbvf_adapter *, struct igbvf_ring *);
326extern int igbvf_setup_tx_resources(struct igbvf_adapter *, struct igbvf_ring *); 325extern int igbvf_setup_tx_resources(struct igbvf_adapter *, struct igbvf_ring *);
327extern void igbvf_free_rx_resources(struct igbvf_ring *); 326extern void igbvf_free_rx_resources(struct igbvf_ring *);
328extern void igbvf_free_tx_resources(struct igbvf_ring *); 327extern void igbvf_free_tx_resources(struct igbvf_ring *);
329extern void igbvf_update_stats(struct igbvf_adapter *); 328extern void igbvf_update_stats(struct igbvf_adapter *);
330extern void igbvf_set_interrupt_capability(struct igbvf_adapter *);
331extern void igbvf_reset_interrupt_capability(struct igbvf_adapter *);
332 329
333extern unsigned int copybreak; 330extern unsigned int copybreak;
334 331
diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c
index c5648420dedf..b774666ad3cf 100644
--- a/drivers/net/igbvf/netdev.c
+++ b/drivers/net/igbvf/netdev.c
@@ -52,6 +52,9 @@ static const char igbvf_driver_string[] =
52static const char igbvf_copyright[] = "Copyright (c) 2009 Intel Corporation."; 52static const char igbvf_copyright[] = "Copyright (c) 2009 Intel Corporation.";
53 53
54static int igbvf_poll(struct napi_struct *napi, int budget); 54static int igbvf_poll(struct napi_struct *napi, int budget);
55static void igbvf_reset(struct igbvf_adapter *);
56static void igbvf_set_interrupt_capability(struct igbvf_adapter *);
57static void igbvf_reset_interrupt_capability(struct igbvf_adapter *);
55 58
56static struct igbvf_info igbvf_vf_info = { 59static struct igbvf_info igbvf_vf_info = {
57 .mac = e1000_vfadapt, 60 .mac = e1000_vfadapt,
@@ -990,7 +993,7 @@ static void igbvf_configure_msix(struct igbvf_adapter *adapter)
990 e1e_flush(); 993 e1e_flush();
991} 994}
992 995
993void igbvf_reset_interrupt_capability(struct igbvf_adapter *adapter) 996static void igbvf_reset_interrupt_capability(struct igbvf_adapter *adapter)
994{ 997{
995 if (adapter->msix_entries) { 998 if (adapter->msix_entries) {
996 pci_disable_msix(adapter->pdev); 999 pci_disable_msix(adapter->pdev);
@@ -1005,7 +1008,7 @@ void igbvf_reset_interrupt_capability(struct igbvf_adapter *adapter)
1005 * Attempt to configure interrupts using the best available 1008 * Attempt to configure interrupts using the best available
1006 * capabilities of the hardware and kernel. 1009 * capabilities of the hardware and kernel.
1007 **/ 1010 **/
1008void igbvf_set_interrupt_capability(struct igbvf_adapter *adapter) 1011static void igbvf_set_interrupt_capability(struct igbvf_adapter *adapter)
1009{ 1012{
1010 int err = -ENOMEM; 1013 int err = -ENOMEM;
1011 int i; 1014 int i;
@@ -1447,7 +1450,7 @@ static void igbvf_configure(struct igbvf_adapter *adapter)
1447 * set/changed during runtime. After reset the device needs to be 1450 * set/changed during runtime. After reset the device needs to be
1448 * properly configured for Rx, Tx etc. 1451 * properly configured for Rx, Tx etc.
1449 */ 1452 */
1450void igbvf_reset(struct igbvf_adapter *adapter) 1453static void igbvf_reset(struct igbvf_adapter *adapter)
1451{ 1454{
1452 struct e1000_mac_info *mac = &adapter->hw.mac; 1455 struct e1000_mac_info *mac = &adapter->hw.mac;
1453 struct net_device *netdev = adapter->netdev; 1456 struct net_device *netdev = adapter->netdev;
diff --git a/drivers/net/igbvf/vf.c b/drivers/net/igbvf/vf.c
index aa246c93279d..2a4faf9ade69 100644
--- a/drivers/net/igbvf/vf.c
+++ b/drivers/net/igbvf/vf.c
@@ -44,7 +44,7 @@ static s32 e1000_set_vfta_vf(struct e1000_hw *, u16, bool);
44 * e1000_init_mac_params_vf - Inits MAC params 44 * e1000_init_mac_params_vf - Inits MAC params
45 * @hw: pointer to the HW structure 45 * @hw: pointer to the HW structure
46 **/ 46 **/
47s32 e1000_init_mac_params_vf(struct e1000_hw *hw) 47static s32 e1000_init_mac_params_vf(struct e1000_hw *hw)
48{ 48{
49 struct e1000_mac_info *mac = &hw->mac; 49 struct e1000_mac_info *mac = &hw->mac;
50 50
diff --git a/drivers/net/igbvf/vf.h b/drivers/net/igbvf/vf.h
index ec07228f9478..1e8ce3741a67 100644
--- a/drivers/net/igbvf/vf.h
+++ b/drivers/net/igbvf/vf.h
@@ -259,7 +259,6 @@ struct e1000_hw {
259/* These functions must be implemented by drivers */ 259/* These functions must be implemented by drivers */
260void e1000_rlpml_set_vf(struct e1000_hw *, u16); 260void e1000_rlpml_set_vf(struct e1000_hw *, u16);
261void e1000_init_function_pointers_vf(struct e1000_hw *hw); 261void e1000_init_function_pointers_vf(struct e1000_hw *hw);
262s32 e1000_init_mac_params_vf(struct e1000_hw *hw);
263 262
264 263
265#endif /* _E1000_VF_H_ */ 264#endif /* _E1000_VF_H_ */
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
index cbc63ff13add..c5593f4665a4 100644
--- a/drivers/net/ioc3-eth.c
+++ b/drivers/net/ioc3-eth.c
@@ -1214,6 +1214,19 @@ static void __devinit ioc3_serial_probe(struct pci_dev *pdev, struct ioc3 *ioc3)
1214} 1214}
1215#endif 1215#endif
1216 1216
1217static const struct net_device_ops ioc3_netdev_ops = {
1218 .ndo_open = ioc3_open,
1219 .ndo_stop = ioc3_close,
1220 .ndo_start_xmit = ioc3_start_xmit,
1221 .ndo_tx_timeout = ioc3_timeout,
1222 .ndo_get_stats = ioc3_get_stats,
1223 .ndo_set_multicast_list = ioc3_set_multicast_list,
1224 .ndo_do_ioctl = ioc3_ioctl,
1225 .ndo_validate_addr = eth_validate_addr,
1226 .ndo_set_mac_address = ioc3_set_mac_address,
1227 .ndo_change_mtu = eth_change_mtu,
1228};
1229
1217static int __devinit ioc3_probe(struct pci_dev *pdev, 1230static int __devinit ioc3_probe(struct pci_dev *pdev,
1218 const struct pci_device_id *ent) 1231 const struct pci_device_id *ent)
1219{ 1232{
@@ -1310,15 +1323,8 @@ static int __devinit ioc3_probe(struct pci_dev *pdev,
1310 ioc3_get_eaddr(ip); 1323 ioc3_get_eaddr(ip);
1311 1324
1312 /* The IOC3-specific entries in the device structure. */ 1325 /* The IOC3-specific entries in the device structure. */
1313 dev->open = ioc3_open;
1314 dev->hard_start_xmit = ioc3_start_xmit;
1315 dev->tx_timeout = ioc3_timeout;
1316 dev->watchdog_timeo = 5 * HZ; 1326 dev->watchdog_timeo = 5 * HZ;
1317 dev->stop = ioc3_close; 1327 dev->netdev_ops = &ioc3_netdev_ops;
1318 dev->get_stats = ioc3_get_stats;
1319 dev->do_ioctl = ioc3_ioctl;
1320 dev->set_multicast_list = ioc3_set_multicast_list;
1321 dev->set_mac_address = ioc3_set_mac_address;
1322 dev->ethtool_ops = &ioc3_ethtool_ops; 1328 dev->ethtool_ops = &ioc3_ethtool_ops;
1323 dev->features = NETIF_F_IP_CSUM; 1329 dev->features = NETIF_F_IP_CSUM;
1324 1330
diff --git a/drivers/net/isa-skeleton.c b/drivers/net/isa-skeleton.c
index 3126678bdd3c..73585fd8f29f 100644
--- a/drivers/net/isa-skeleton.c
+++ b/drivers/net/isa-skeleton.c
@@ -181,6 +181,18 @@ out:
181} 181}
182#endif 182#endif
183 183
184static const struct net_device_ops netcard_netdev_ops = {
185 .ndo_open = net_open,
186 .ndo_stop = net_close,
187 .ndo_start_xmit = net_send_packet,
188 .ndo_get_stats = net_get_stats,
189 .ndo_set_multicast_list = set_multicast_list,
190 .ndo_tx_timeout = net_tx_timeout,
191 .ndo_validate_addr = eth_validate_addr,
192 .ndo_set_mac_address = eth_mac_addr,
193 .ndo_change_mtu = eth_change_mtu,
194};
195
184/* 196/*
185 * This is the real probe routine. Linux has a history of friendly device 197 * This is the real probe routine. Linux has a history of friendly device
186 * probes on the ISA bus. A good device probes avoids doing writes, and 198 * probes on the ISA bus. A good device probes avoids doing writes, and
@@ -303,13 +315,7 @@ static int __init netcard_probe1(struct net_device *dev, int ioaddr)
303 np = netdev_priv(dev); 315 np = netdev_priv(dev);
304 spin_lock_init(&np->lock); 316 spin_lock_init(&np->lock);
305 317
306 dev->open = net_open; 318 dev->netdev_ops = &netcard_netdev_ops;
307 dev->stop = net_close;
308 dev->hard_start_xmit = net_send_packet;
309 dev->get_stats = net_get_stats;
310 dev->set_multicast_list = &set_multicast_list;
311
312 dev->tx_timeout = &net_tx_timeout;
313 dev->watchdog_timeo = MY_TX_TIMEOUT; 319 dev->watchdog_timeo = MY_TX_TIMEOUT;
314 320
315 err = register_netdev(dev); 321 err = register_netdev(dev);
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c
index de4db0dc7879..4791238c3f6e 100644
--- a/drivers/net/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ixgbe/ixgbe_82598.c
@@ -885,61 +885,6 @@ static s32 ixgbe_clear_vfta_82598(struct ixgbe_hw *hw)
885} 885}
886 886
887/** 887/**
888 * ixgbe_blink_led_start_82598 - Blink LED based on index.
889 * @hw: pointer to hardware structure
890 * @index: led number to blink
891 **/
892static s32 ixgbe_blink_led_start_82598(struct ixgbe_hw *hw, u32 index)
893{
894 ixgbe_link_speed speed = 0;
895 bool link_up = 0;
896 u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
897 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
898
899 /*
900 * Link must be up to auto-blink the LEDs on the 82598EB MAC;
901 * force it if link is down.
902 */
903 hw->mac.ops.check_link(hw, &speed, &link_up, false);
904
905 if (!link_up) {
906 autoc_reg |= IXGBE_AUTOC_FLU;
907 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
908 msleep(10);
909 }
910
911 led_reg &= ~IXGBE_LED_MODE_MASK(index);
912 led_reg |= IXGBE_LED_BLINK(index);
913 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
914 IXGBE_WRITE_FLUSH(hw);
915
916 return 0;
917}
918
919/**
920 * ixgbe_blink_led_stop_82598 - Stop blinking LED based on index.
921 * @hw: pointer to hardware structure
922 * @index: led number to stop blinking
923 **/
924static s32 ixgbe_blink_led_stop_82598(struct ixgbe_hw *hw, u32 index)
925{
926 u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
927 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
928
929 autoc_reg &= ~IXGBE_AUTOC_FLU;
930 autoc_reg |= IXGBE_AUTOC_AN_RESTART;
931 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
932
933 led_reg &= ~IXGBE_LED_MODE_MASK(index);
934 led_reg &= ~IXGBE_LED_BLINK(index);
935 led_reg |= IXGBE_LED_LINK_ACTIVE << IXGBE_LED_MODE_SHIFT(index);
936 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
937 IXGBE_WRITE_FLUSH(hw);
938
939 return 0;
940}
941
942/**
943 * ixgbe_read_analog_reg8_82598 - Reads 8 bit Atlas analog register 888 * ixgbe_read_analog_reg8_82598 - Reads 8 bit Atlas analog register
944 * @hw: pointer to hardware structure 889 * @hw: pointer to hardware structure
945 * @reg: analog register to read 890 * @reg: analog register to read
@@ -1128,8 +1073,8 @@ static struct ixgbe_mac_operations mac_ops_82598 = {
1128 .get_link_capabilities = &ixgbe_get_link_capabilities_82598, 1073 .get_link_capabilities = &ixgbe_get_link_capabilities_82598,
1129 .led_on = &ixgbe_led_on_generic, 1074 .led_on = &ixgbe_led_on_generic,
1130 .led_off = &ixgbe_led_off_generic, 1075 .led_off = &ixgbe_led_off_generic,
1131 .blink_led_start = &ixgbe_blink_led_start_82598, 1076 .blink_led_start = &ixgbe_blink_led_start_generic,
1132 .blink_led_stop = &ixgbe_blink_led_stop_82598, 1077 .blink_led_stop = &ixgbe_blink_led_stop_generic,
1133 .set_rar = &ixgbe_set_rar_generic, 1078 .set_rar = &ixgbe_set_rar_generic,
1134 .clear_rar = &ixgbe_clear_rar_generic, 1079 .clear_rar = &ixgbe_clear_rar_generic,
1135 .set_vmdq = &ixgbe_set_vmdq_82598, 1080 .set_vmdq = &ixgbe_set_vmdq_82598,
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c
index beae7e012609..29771fbaa42d 100644
--- a/drivers/net/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ixgbe/ixgbe_82599.c
@@ -68,8 +68,6 @@ s32 ixgbe_clear_vmdq_82599(struct ixgbe_hw *hw, u32 rar, u32 vmdq);
68s32 ixgbe_set_vfta_82599(struct ixgbe_hw *hw, u32 vlan, 68s32 ixgbe_set_vfta_82599(struct ixgbe_hw *hw, u32 vlan,
69 u32 vind, bool vlan_on); 69 u32 vind, bool vlan_on);
70s32 ixgbe_clear_vfta_82599(struct ixgbe_hw *hw); 70s32 ixgbe_clear_vfta_82599(struct ixgbe_hw *hw);
71s32 ixgbe_blink_led_stop_82599(struct ixgbe_hw *hw, u32 index);
72s32 ixgbe_blink_led_start_82599(struct ixgbe_hw *hw, u32 index);
73s32 ixgbe_init_uta_tables_82599(struct ixgbe_hw *hw); 71s32 ixgbe_init_uta_tables_82599(struct ixgbe_hw *hw);
74s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val); 72s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val);
75s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val); 73s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val);
@@ -991,40 +989,6 @@ s32 ixgbe_clear_vfta_82599(struct ixgbe_hw *hw)
991} 989}
992 990
993/** 991/**
994 * ixgbe_blink_led_start_82599 - Blink LED based on index.
995 * @hw: pointer to hardware structure
996 * @index: led number to blink
997 **/
998s32 ixgbe_blink_led_start_82599(struct ixgbe_hw *hw, u32 index)
999{
1000 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
1001
1002 led_reg &= ~IXGBE_LED_MODE_MASK(index);
1003 led_reg |= IXGBE_LED_BLINK(index);
1004 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
1005 IXGBE_WRITE_FLUSH(hw);
1006
1007 return 0;
1008}
1009
1010/**
1011 * ixgbe_blink_led_stop_82599 - Stop blinking LED based on index.
1012 * @hw: pointer to hardware structure
1013 * @index: led number to stop blinking
1014 **/
1015s32 ixgbe_blink_led_stop_82599(struct ixgbe_hw *hw, u32 index)
1016{
1017 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
1018
1019 led_reg &= ~IXGBE_LED_MODE_MASK(index);
1020 led_reg &= ~IXGBE_LED_BLINK(index);
1021 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
1022 IXGBE_WRITE_FLUSH(hw);
1023
1024 return 0;
1025}
1026
1027/**
1028 * ixgbe_init_uta_tables_82599 - Initialize the Unicast Table Array 992 * ixgbe_init_uta_tables_82599 - Initialize the Unicast Table Array
1029 * @hw: pointer to hardware structure 993 * @hw: pointer to hardware structure
1030 **/ 994 **/
@@ -1243,8 +1207,8 @@ static struct ixgbe_mac_operations mac_ops_82599 = {
1243 .get_link_capabilities = &ixgbe_get_link_capabilities_82599, 1207 .get_link_capabilities = &ixgbe_get_link_capabilities_82599,
1244 .led_on = &ixgbe_led_on_generic, 1208 .led_on = &ixgbe_led_on_generic,
1245 .led_off = &ixgbe_led_off_generic, 1209 .led_off = &ixgbe_led_off_generic,
1246 .blink_led_start = &ixgbe_blink_led_start_82599, 1210 .blink_led_start = &ixgbe_blink_led_start_generic,
1247 .blink_led_stop = &ixgbe_blink_led_stop_82599, 1211 .blink_led_stop = &ixgbe_blink_led_stop_generic,
1248 .set_rar = &ixgbe_set_rar_generic, 1212 .set_rar = &ixgbe_set_rar_generic,
1249 .clear_rar = &ixgbe_clear_rar_generic, 1213 .clear_rar = &ixgbe_clear_rar_generic,
1250 .set_vmdq = &ixgbe_set_vmdq_82599, 1214 .set_vmdq = &ixgbe_set_vmdq_82599,
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index 63ab6671d08e..186a65069b33 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -50,7 +50,6 @@ static u16 ixgbe_calc_eeprom_checksum(struct ixgbe_hw *hw);
50static void ixgbe_enable_rar(struct ixgbe_hw *hw, u32 index); 50static void ixgbe_enable_rar(struct ixgbe_hw *hw, u32 index);
51static void ixgbe_disable_rar(struct ixgbe_hw *hw, u32 index); 51static void ixgbe_disable_rar(struct ixgbe_hw *hw, u32 index);
52static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr); 52static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr);
53static void ixgbe_add_mc_addr(struct ixgbe_hw *hw, u8 *mc_addr);
54static void ixgbe_add_uc_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq); 53static void ixgbe_add_uc_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq);
55 54
56/** 55/**
@@ -1377,8 +1376,7 @@ s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, u8 *addr_list,
1377 * Clear accounting of old secondary address list, 1376 * Clear accounting of old secondary address list,
1378 * don't count RAR[0] 1377 * don't count RAR[0]
1379 */ 1378 */
1380 uc_addr_in_use = hw->addr_ctrl.rar_used_count - 1379 uc_addr_in_use = hw->addr_ctrl.rar_used_count - 1;
1381 hw->addr_ctrl.mc_addr_in_rar_count - 1;
1382 hw->addr_ctrl.rar_used_count -= uc_addr_in_use; 1380 hw->addr_ctrl.rar_used_count -= uc_addr_in_use;
1383 hw->addr_ctrl.overflow_promisc = 0; 1381 hw->addr_ctrl.overflow_promisc = 0;
1384 1382
@@ -1493,40 +1491,6 @@ static void ixgbe_set_mta(struct ixgbe_hw *hw, u8 *mc_addr)
1493} 1491}
1494 1492
1495/** 1493/**
1496 * ixgbe_add_mc_addr - Adds a multicast address.
1497 * @hw: pointer to hardware structure
1498 * @mc_addr: new multicast address
1499 *
1500 * Adds it to unused receive address register or to the multicast table.
1501 **/
1502static void ixgbe_add_mc_addr(struct ixgbe_hw *hw, u8 *mc_addr)
1503{
1504 u32 rar_entries = hw->mac.num_rar_entries;
1505 u32 rar;
1506
1507 hw_dbg(hw, " MC Addr =%.2X %.2X %.2X %.2X %.2X %.2X\n",
1508 mc_addr[0], mc_addr[1], mc_addr[2],
1509 mc_addr[3], mc_addr[4], mc_addr[5]);
1510
1511 /*
1512 * Place this multicast address in the RAR if there is room,
1513 * else put it in the MTA
1514 */
1515 if (hw->addr_ctrl.rar_used_count < rar_entries) {
1516 /* use RAR from the end up for multicast */
1517 rar = rar_entries - hw->addr_ctrl.mc_addr_in_rar_count - 1;
1518 hw->mac.ops.set_rar(hw, rar, mc_addr, 0, IXGBE_RAH_AV);
1519 hw_dbg(hw, "Added a multicast address to RAR[%d]\n", rar);
1520 hw->addr_ctrl.rar_used_count++;
1521 hw->addr_ctrl.mc_addr_in_rar_count++;
1522 } else {
1523 ixgbe_set_mta(hw, mc_addr);
1524 }
1525
1526 hw_dbg(hw, "ixgbe_add_mc_addr Complete\n");
1527}
1528
1529/**
1530 * ixgbe_update_mc_addr_list_generic - Updates MAC list of multicast addresses 1494 * ixgbe_update_mc_addr_list_generic - Updates MAC list of multicast addresses
1531 * @hw: pointer to hardware structure 1495 * @hw: pointer to hardware structure
1532 * @mc_addr_list: the list of new multicast addresses 1496 * @mc_addr_list: the list of new multicast addresses
@@ -1542,7 +1506,6 @@ s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, u8 *mc_addr_list,
1542 u32 mc_addr_count, ixgbe_mc_addr_itr next) 1506 u32 mc_addr_count, ixgbe_mc_addr_itr next)
1543{ 1507{
1544 u32 i; 1508 u32 i;
1545 u32 rar_entries = hw->mac.num_rar_entries;
1546 u32 vmdq; 1509 u32 vmdq;
1547 1510
1548 /* 1511 /*
@@ -1550,18 +1513,8 @@ s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, u8 *mc_addr_list,
1550 * use. 1513 * use.
1551 */ 1514 */
1552 hw->addr_ctrl.num_mc_addrs = mc_addr_count; 1515 hw->addr_ctrl.num_mc_addrs = mc_addr_count;
1553 hw->addr_ctrl.rar_used_count -= hw->addr_ctrl.mc_addr_in_rar_count;
1554 hw->addr_ctrl.mc_addr_in_rar_count = 0;
1555 hw->addr_ctrl.mta_in_use = 0; 1516 hw->addr_ctrl.mta_in_use = 0;
1556 1517
1557 /* Zero out the other receive addresses. */
1558 hw_dbg(hw, "Clearing RAR[%d-%d]\n", hw->addr_ctrl.rar_used_count,
1559 rar_entries - 1);
1560 for (i = hw->addr_ctrl.rar_used_count; i < rar_entries; i++) {
1561 IXGBE_WRITE_REG(hw, IXGBE_RAL(i), 0);
1562 IXGBE_WRITE_REG(hw, IXGBE_RAH(i), 0);
1563 }
1564
1565 /* Clear the MTA */ 1518 /* Clear the MTA */
1566 hw_dbg(hw, " Clearing MTA\n"); 1519 hw_dbg(hw, " Clearing MTA\n");
1567 for (i = 0; i < hw->mac.mcft_size; i++) 1520 for (i = 0; i < hw->mac.mcft_size; i++)
@@ -1570,7 +1523,7 @@ s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, u8 *mc_addr_list,
1570 /* Add the new addresses */ 1523 /* Add the new addresses */
1571 for (i = 0; i < mc_addr_count; i++) { 1524 for (i = 0; i < mc_addr_count; i++) {
1572 hw_dbg(hw, " Adding the multicast addresses:\n"); 1525 hw_dbg(hw, " Adding the multicast addresses:\n");
1573 ixgbe_add_mc_addr(hw, next(hw, &mc_addr_list, &vmdq)); 1526 ixgbe_set_mta(hw, next(hw, &mc_addr_list, &vmdq));
1574 } 1527 }
1575 1528
1576 /* Enable mta */ 1529 /* Enable mta */
@@ -2071,3 +2024,58 @@ s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval)
2071 2024
2072 return 0; 2025 return 0;
2073} 2026}
2027
2028/**
2029 * ixgbe_blink_led_start_generic - Blink LED based on index.
2030 * @hw: pointer to hardware structure
2031 * @index: led number to blink
2032 **/
2033s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index)
2034{
2035 ixgbe_link_speed speed = 0;
2036 bool link_up = 0;
2037 u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
2038 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
2039
2040 /*
2041 * Link must be up to auto-blink the LEDs;
2042 * Force it if link is down.
2043 */
2044 hw->mac.ops.check_link(hw, &speed, &link_up, false);
2045
2046 if (!link_up) {
2047 autoc_reg |= IXGBE_AUTOC_FLU;
2048 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
2049 msleep(10);
2050 }
2051
2052 led_reg &= ~IXGBE_LED_MODE_MASK(index);
2053 led_reg |= IXGBE_LED_BLINK(index);
2054 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
2055 IXGBE_WRITE_FLUSH(hw);
2056
2057 return 0;
2058}
2059
2060/**
2061 * ixgbe_blink_led_stop_generic - Stop blinking LED based on index.
2062 * @hw: pointer to hardware structure
2063 * @index: led number to stop blinking
2064 **/
2065s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index)
2066{
2067 u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
2068 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
2069
2070 autoc_reg &= ~IXGBE_AUTOC_FLU;
2071 autoc_reg |= IXGBE_AUTOC_AN_RESTART;
2072 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
2073
2074 led_reg &= ~IXGBE_LED_MODE_MASK(index);
2075 led_reg &= ~IXGBE_LED_BLINK(index);
2076 led_reg |= IXGBE_LED_LINK_ACTIVE << IXGBE_LED_MODE_SHIFT(index);
2077 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
2078 IXGBE_WRITE_FLUSH(hw);
2079
2080 return 0;
2081}
diff --git a/drivers/net/ixgbe/ixgbe_common.h b/drivers/net/ixgbe/ixgbe_common.h
index 24f73e719c3f..dd260890ad0a 100644
--- a/drivers/net/ixgbe/ixgbe_common.h
+++ b/drivers/net/ixgbe/ixgbe_common.h
@@ -76,6 +76,9 @@ s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw);
76s32 ixgbe_read_analog_reg8_generic(struct ixgbe_hw *hw, u32 reg, u8 *val); 76s32 ixgbe_read_analog_reg8_generic(struct ixgbe_hw *hw, u32 reg, u8 *val);
77s32 ixgbe_write_analog_reg8_generic(struct ixgbe_hw *hw, u32 reg, u8 val); 77s32 ixgbe_write_analog_reg8_generic(struct ixgbe_hw *hw, u32 reg, u8 val);
78 78
79s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index);
80s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index);
81
79#define IXGBE_WRITE_REG(a, reg, value) writel((value), ((a)->hw_addr + (reg))) 82#define IXGBE_WRITE_REG(a, reg, value) writel((value), ((a)->hw_addr + (reg)))
80 83
81#ifndef writeq 84#ifndef writeq
diff --git a/drivers/net/ixgbe/ixgbe_dcb_82599.c b/drivers/net/ixgbe/ixgbe_dcb_82599.c
index 470b676c1dae..f4417fc3b0fd 100644
--- a/drivers/net/ixgbe/ixgbe_dcb_82599.c
+++ b/drivers/net/ixgbe/ixgbe_dcb_82599.c
@@ -290,7 +290,7 @@ s32 ixgbe_dcb_config_tx_data_arbiter_82599(struct ixgbe_hw *hw,
290s32 ixgbe_dcb_config_pfc_82599(struct ixgbe_hw *hw, 290s32 ixgbe_dcb_config_pfc_82599(struct ixgbe_hw *hw,
291 struct ixgbe_dcb_config *dcb_config) 291 struct ixgbe_dcb_config *dcb_config)
292{ 292{
293 u32 i, reg; 293 u32 i, reg, rx_pba_size;
294 294
295 /* If PFC is disabled globally then fall back to LFC. */ 295 /* If PFC is disabled globally then fall back to LFC. */
296 if (!dcb_config->pfc_mode_enable) { 296 if (!dcb_config->pfc_mode_enable) {
@@ -301,17 +301,23 @@ s32 ixgbe_dcb_config_pfc_82599(struct ixgbe_hw *hw,
301 301
302 /* Configure PFC Tx thresholds per TC */ 302 /* Configure PFC Tx thresholds per TC */
303 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { 303 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) {
304 /* Config and remember Tx */ 304 if (dcb_config->rx_pba_cfg == pba_equal)
305 rx_pba_size = IXGBE_RXPBSIZE_64KB;
306 else
307 rx_pba_size = (i < 4) ? IXGBE_RXPBSIZE_80KB
308 : IXGBE_RXPBSIZE_48KB;
309
310 reg = ((rx_pba_size >> 5) & 0xFFE0);
305 if (dcb_config->tc_config[i].dcb_pfc == pfc_enabled_full || 311 if (dcb_config->tc_config[i].dcb_pfc == pfc_enabled_full ||
306 dcb_config->tc_config[i].dcb_pfc == pfc_enabled_tx) { 312 dcb_config->tc_config[i].dcb_pfc == pfc_enabled_tx)
307 reg = hw->fc.high_water | IXGBE_FCRTH_FCEN; 313 reg |= IXGBE_FCRTL_XONE;
308 IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), reg); 314 IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), reg);
309 reg = hw->fc.low_water | IXGBE_FCRTL_XONE; 315
310 IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), reg); 316 reg = ((rx_pba_size >> 2) & 0xFFE0);
311 } else { 317 if (dcb_config->tc_config[i].dcb_pfc == pfc_enabled_full ||
312 IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), 0); 318 dcb_config->tc_config[i].dcb_pfc == pfc_enabled_tx)
313 IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), 0); 319 reg |= IXGBE_FCRTH_FCEN;
314 } 320 IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), reg);
315 } 321 }
316 322
317 /* Configure pause time (2 TCs per register) */ 323 /* Configure pause time (2 TCs per register) */
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index aafc120f164e..f0a20facc650 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -943,6 +943,24 @@ static void ixgbe_get_strings(struct net_device *netdev, u32 stringset,
943} 943}
944 944
945 945
946static int ixgbe_wol_exclusion(struct ixgbe_adapter *adapter,
947 struct ethtool_wolinfo *wol)
948{
949 struct ixgbe_hw *hw = &adapter->hw;
950 int retval = 1;
951
952 switch(hw->device_id) {
953 case IXGBE_DEV_ID_82599_KX4:
954 retval = 0;
955 break;
956 default:
957 wol->supported = 0;
958 retval = 0;
959 }
960
961 return retval;
962}
963
946static void ixgbe_get_wol(struct net_device *netdev, 964static void ixgbe_get_wol(struct net_device *netdev,
947 struct ethtool_wolinfo *wol) 965 struct ethtool_wolinfo *wol)
948{ 966{
@@ -952,7 +970,8 @@ static void ixgbe_get_wol(struct net_device *netdev,
952 WAKE_BCAST | WAKE_MAGIC; 970 WAKE_BCAST | WAKE_MAGIC;
953 wol->wolopts = 0; 971 wol->wolopts = 0;
954 972
955 if (!device_can_wakeup(&adapter->pdev->dev)) 973 if (ixgbe_wol_exclusion(adapter, wol) ||
974 !device_can_wakeup(&adapter->pdev->dev))
956 return; 975 return;
957 976
958 if (adapter->wol & IXGBE_WUFC_EX) 977 if (adapter->wol & IXGBE_WUFC_EX)
@@ -974,6 +993,9 @@ static int ixgbe_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
974 if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE)) 993 if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE))
975 return -EOPNOTSUPP; 994 return -EOPNOTSUPP;
976 995
996 if (ixgbe_wol_exclusion(adapter, wol))
997 return wol->wolopts ? -EOPNOTSUPP : 0;
998
977 adapter->wol = 0; 999 adapter->wol = 0;
978 1000
979 if (wol->wolopts & WAKE_UCAST) 1001 if (wol->wolopts & WAKE_UCAST)
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 9ef128ae6458..07e778d3e5d2 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -2723,17 +2723,21 @@ static inline bool ixgbe_set_rss_queues(struct ixgbe_adapter *adapter)
2723 **/ 2723 **/
2724static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter) 2724static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter)
2725{ 2725{
2726 /* Start with base case */
2727 adapter->num_rx_queues = 1;
2728 adapter->num_tx_queues = 1;
2729
2730#ifdef CONFIG_IXGBE_DCB 2726#ifdef CONFIG_IXGBE_DCB
2731 if (ixgbe_set_dcb_queues(adapter)) 2727 if (ixgbe_set_dcb_queues(adapter))
2732 return; 2728 goto done;
2733 2729
2734#endif 2730#endif
2735 if (ixgbe_set_rss_queues(adapter)) 2731 if (ixgbe_set_rss_queues(adapter))
2736 return; 2732 goto done;
2733
2734 /* fallback to base case */
2735 adapter->num_rx_queues = 1;
2736 adapter->num_tx_queues = 1;
2737
2738done:
2739 /* Notify the stack of the (possibly) reduced Tx Queue count. */
2740 adapter->netdev->real_num_tx_queues = adapter->num_tx_queues;
2737} 2741}
2738 2742
2739static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter, 2743static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
@@ -2837,11 +2841,55 @@ static inline bool ixgbe_cache_ring_dcb(struct ixgbe_adapter *adapter)
2837 } 2841 }
2838 ret = true; 2842 ret = true;
2839 } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) { 2843 } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
2840 for (i = 0; i < dcb_i; i++) { 2844 if (dcb_i == 8) {
2841 adapter->rx_ring[i].reg_idx = i << 4; 2845 /*
2842 adapter->tx_ring[i].reg_idx = i << 4; 2846 * Tx TC0 starts at: descriptor queue 0
2847 * Tx TC1 starts at: descriptor queue 32
2848 * Tx TC2 starts at: descriptor queue 64
2849 * Tx TC3 starts at: descriptor queue 80
2850 * Tx TC4 starts at: descriptor queue 96
2851 * Tx TC5 starts at: descriptor queue 104
2852 * Tx TC6 starts at: descriptor queue 112
2853 * Tx TC7 starts at: descriptor queue 120
2854 *
2855 * Rx TC0-TC7 are offset by 16 queues each
2856 */
2857 for (i = 0; i < 3; i++) {
2858 adapter->tx_ring[i].reg_idx = i << 5;
2859 adapter->rx_ring[i].reg_idx = i << 4;
2860 }
2861 for ( ; i < 5; i++) {
2862 adapter->tx_ring[i].reg_idx =
2863 ((i + 2) << 4);
2864 adapter->rx_ring[i].reg_idx = i << 4;
2865 }
2866 for ( ; i < dcb_i; i++) {
2867 adapter->tx_ring[i].reg_idx =
2868 ((i + 8) << 3);
2869 adapter->rx_ring[i].reg_idx = i << 4;
2870 }
2871
2872 ret = true;
2873 } else if (dcb_i == 4) {
2874 /*
2875 * Tx TC0 starts at: descriptor queue 0
2876 * Tx TC1 starts at: descriptor queue 64
2877 * Tx TC2 starts at: descriptor queue 96
2878 * Tx TC3 starts at: descriptor queue 112
2879 *
2880 * Rx TC0-TC3 are offset by 32 queues each
2881 */
2882 adapter->tx_ring[0].reg_idx = 0;
2883 adapter->tx_ring[1].reg_idx = 64;
2884 adapter->tx_ring[2].reg_idx = 96;
2885 adapter->tx_ring[3].reg_idx = 112;
2886 for (i = 0 ; i < dcb_i; i++)
2887 adapter->rx_ring[i].reg_idx = i << 5;
2888
2889 ret = true;
2890 } else {
2891 ret = false;
2843 } 2892 }
2844 ret = true;
2845 } else { 2893 } else {
2846 ret = false; 2894 ret = false;
2847 } 2895 }
@@ -2992,9 +3040,6 @@ try_msi:
2992 } 3040 }
2993 3041
2994out: 3042out:
2995 /* Notify the stack of the (possibly) reduced Tx Queue count. */
2996 adapter->netdev->real_num_tx_queues = adapter->num_tx_queues;
2997
2998 return err; 3043 return err;
2999} 3044}
3000 3045
@@ -3601,6 +3646,8 @@ static int ixgbe_resume(struct pci_dev *pdev)
3601 3646
3602 ixgbe_reset(adapter); 3647 ixgbe_reset(adapter);
3603 3648
3649 IXGBE_WRITE_REG(&adapter->hw, IXGBE_WUS, ~0);
3650
3604 if (netif_running(netdev)) { 3651 if (netif_running(netdev)) {
3605 err = ixgbe_open(adapter->netdev); 3652 err = ixgbe_open(adapter->netdev);
3606 if (err) 3653 if (err)
@@ -3611,9 +3658,9 @@ static int ixgbe_resume(struct pci_dev *pdev)
3611 3658
3612 return 0; 3659 return 0;
3613} 3660}
3614
3615#endif /* CONFIG_PM */ 3661#endif /* CONFIG_PM */
3616static int ixgbe_suspend(struct pci_dev *pdev, pm_message_t state) 3662
3663static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
3617{ 3664{
3618 struct net_device *netdev = pci_get_drvdata(pdev); 3665 struct net_device *netdev = pci_get_drvdata(pdev);
3619 struct ixgbe_adapter *adapter = netdev_priv(netdev); 3666 struct ixgbe_adapter *adapter = netdev_priv(netdev);
@@ -3672,18 +3719,46 @@ static int ixgbe_suspend(struct pci_dev *pdev, pm_message_t state)
3672 pci_enable_wake(pdev, PCI_D3cold, 0); 3719 pci_enable_wake(pdev, PCI_D3cold, 0);
3673 } 3720 }
3674 3721
3722 *enable_wake = !!wufc;
3723
3675 ixgbe_release_hw_control(adapter); 3724 ixgbe_release_hw_control(adapter);
3676 3725
3677 pci_disable_device(pdev); 3726 pci_disable_device(pdev);
3678 3727
3679 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 3728 return 0;
3729}
3730
3731#ifdef CONFIG_PM
3732static int ixgbe_suspend(struct pci_dev *pdev, pm_message_t state)
3733{
3734 int retval;
3735 bool wake;
3736
3737 retval = __ixgbe_shutdown(pdev, &wake);
3738 if (retval)
3739 return retval;
3740
3741 if (wake) {
3742 pci_prepare_to_sleep(pdev);
3743 } else {
3744 pci_wake_from_d3(pdev, false);
3745 pci_set_power_state(pdev, PCI_D3hot);
3746 }
3680 3747
3681 return 0; 3748 return 0;
3682} 3749}
3750#endif /* CONFIG_PM */
3683 3751
3684static void ixgbe_shutdown(struct pci_dev *pdev) 3752static void ixgbe_shutdown(struct pci_dev *pdev)
3685{ 3753{
3686 ixgbe_suspend(pdev, PMSG_SUSPEND); 3754 bool wake;
3755
3756 __ixgbe_shutdown(pdev, &wake);
3757
3758 if (system_state == SYSTEM_POWER_OFF) {
3759 pci_wake_from_d3(pdev, wake);
3760 pci_set_power_state(pdev, PCI_D3hot);
3761 }
3687} 3762}
3688 3763
3689/** 3764/**
@@ -3917,7 +3992,7 @@ static void ixgbe_sfp_config_module_task(struct work_struct *work)
3917 } 3992 }
3918 hw->mac.ops.setup_sfp(hw); 3993 hw->mac.ops.setup_sfp(hw);
3919 3994
3920 if (!adapter->flags & IXGBE_FLAG_IN_SFP_LINK_TASK) 3995 if (!(adapter->flags & IXGBE_FLAG_IN_SFP_LINK_TASK))
3921 /* This will also work for DA Twinax connections */ 3996 /* This will also work for DA Twinax connections */
3922 schedule_work(&adapter->multispeed_fiber_task); 3997 schedule_work(&adapter->multispeed_fiber_task);
3923 adapter->flags &= ~IXGBE_FLAG_IN_SFP_MOD_TASK; 3998 adapter->flags &= ~IXGBE_FLAG_IN_SFP_MOD_TASK;
@@ -4342,7 +4417,7 @@ static int ixgbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
4342 int count = 0; 4417 int count = 0;
4343 unsigned int f; 4418 unsigned int f;
4344 4419
4345 r_idx = (adapter->num_tx_queues - 1) & skb->queue_mapping; 4420 r_idx = skb->queue_mapping;
4346 tx_ring = &adapter->tx_ring[r_idx]; 4421 tx_ring = &adapter->tx_ring[r_idx];
4347 4422
4348 if (adapter->vlgrp && vlan_tx_tag_present(skb)) { 4423 if (adapter->vlgrp && vlan_tx_tag_present(skb)) {
@@ -4502,7 +4577,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
4502 const struct ixgbe_info *ii = ixgbe_info_tbl[ent->driver_data]; 4577 const struct ixgbe_info *ii = ixgbe_info_tbl[ent->driver_data];
4503 static int cards_found; 4578 static int cards_found;
4504 int i, err, pci_using_dac; 4579 int i, err, pci_using_dac;
4505 u16 pm_value = 0;
4506 u32 part_num, eec; 4580 u32 part_num, eec;
4507 4581
4508 err = pci_enable_device(pdev); 4582 err = pci_enable_device(pdev);
@@ -4690,11 +4764,8 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
4690 4764
4691 switch (pdev->device) { 4765 switch (pdev->device) {
4692 case IXGBE_DEV_ID_82599_KX4: 4766 case IXGBE_DEV_ID_82599_KX4:
4693#define IXGBE_PCIE_PMCSR 0x44 4767 adapter->wol = (IXGBE_WUFC_MAG | IXGBE_WUFC_EX |
4694 adapter->wol = IXGBE_WUFC_MAG; 4768 IXGBE_WUFC_MC | IXGBE_WUFC_BC);
4695 pci_read_config_word(pdev, IXGBE_PCIE_PMCSR, &pm_value);
4696 pci_write_config_word(pdev, IXGBE_PCIE_PMCSR,
4697 (pm_value | (1 << 8)));
4698 break; 4769 break;
4699 default: 4770 default:
4700 adapter->wol = 0; 4771 adapter->wol = 0;
diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index ece35040288c..621a7c0c46ba 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -2591,13 +2591,13 @@ static int
2591jme_pci_dma64(struct pci_dev *pdev) 2591jme_pci_dma64(struct pci_dev *pdev)
2592{ 2592{
2593 if (pdev->device == PCI_DEVICE_ID_JMICRON_JMC250 && 2593 if (pdev->device == PCI_DEVICE_ID_JMICRON_JMC250 &&
2594 !pci_set_dma_mask(pdev, DMA_64BIT_MASK)) 2594 !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)))
2595 if (!pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) 2595 if (!pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))
2596 return 1; 2596 return 1;
2597 2597
2598 if (pdev->device == PCI_DEVICE_ID_JMICRON_JMC250 && 2598 if (pdev->device == PCI_DEVICE_ID_JMICRON_JMC250 &&
2599 !pci_set_dma_mask(pdev, DMA_40BIT_MASK)) 2599 !pci_set_dma_mask(pdev, DMA_BIT_MASK(40)))
2600 if (!pci_set_consistent_dma_mask(pdev, DMA_40BIT_MASK)) 2600 if (!pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(40)))
2601 return 1; 2601 return 1;
2602 2602
2603 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) 2603 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))
diff --git a/drivers/net/mac89x0.c b/drivers/net/mac89x0.c
index 380a1a54d530..384e072de2e7 100644
--- a/drivers/net/mac89x0.c
+++ b/drivers/net/mac89x0.c
@@ -168,6 +168,17 @@ writereg(struct net_device *dev, int portno, int value)
168 nubus_writew(swab16(value), dev->mem_start + portno); 168 nubus_writew(swab16(value), dev->mem_start + portno);
169} 169}
170 170
171static const struct net_device_ops mac89x0_netdev_ops = {
172 .ndo_open = net_open,
173 .ndo_stop = net_close,
174 .ndo_start_xmit = net_send_packet,
175 .ndo_get_stats = net_get_stats,
176 .ndo_set_multicast_list = set_multicast_list,
177 .ndo_set_mac_address = set_mac_address,
178 .ndo_validate_addr = eth_validate_addr,
179 .ndo_change_mtu = eth_change_mtu,
180};
181
171/* Probe for the CS8900 card in slot E. We won't bother looking 182/* Probe for the CS8900 card in slot E. We won't bother looking
172 anywhere else until we have a really good reason to do so. */ 183 anywhere else until we have a really good reason to do so. */
173struct net_device * __init mac89x0_probe(int unit) 184struct net_device * __init mac89x0_probe(int unit)
@@ -280,12 +291,7 @@ struct net_device * __init mac89x0_probe(int unit)
280 291
281 printk(" IRQ %d ADDR %pM\n", dev->irq, dev->dev_addr); 292 printk(" IRQ %d ADDR %pM\n", dev->irq, dev->dev_addr);
282 293
283 dev->open = net_open; 294 dev->netdev_ops = &mac89x0_netdev_ops;
284 dev->stop = net_close;
285 dev->hard_start_xmit = net_send_packet;
286 dev->get_stats = net_get_stats;
287 dev->set_multicast_list = &set_multicast_list;
288 dev->set_mac_address = &set_mac_address;
289 295
290 err = register_netdev(dev); 296 err = register_netdev(dev);
291 if (err) 297 if (err)
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index f50501013b1c..e82aee41d77e 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -316,10 +316,11 @@ static void macb_tx(struct macb *bp)
316 dev_dbg(&bp->pdev->dev, "macb_tx status = %02lx\n", 316 dev_dbg(&bp->pdev->dev, "macb_tx status = %02lx\n",
317 (unsigned long)status); 317 (unsigned long)status);
318 318
319 if (status & MACB_BIT(UND)) { 319 if (status & (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) {
320 int i; 320 int i;
321 printk(KERN_ERR "%s: TX underrun, resetting buffers\n", 321 printk(KERN_ERR "%s: TX %s, resetting buffers\n",
322 bp->dev->name); 322 bp->dev->name, status & MACB_BIT(UND) ?
323 "underrun" : "retry limit exceeded");
323 324
324 /* Transfer ongoing, disable transmitter, to avoid confusion */ 325 /* Transfer ongoing, disable transmitter, to avoid confusion */
325 if (status & MACB_BIT(TGO)) 326 if (status & MACB_BIT(TGO))
@@ -520,27 +521,10 @@ static int macb_poll(struct napi_struct *napi, int budget)
520 macb_writel(bp, RSR, status); 521 macb_writel(bp, RSR, status);
521 522
522 work_done = 0; 523 work_done = 0;
523 if (!status) {
524 /*
525 * This may happen if an interrupt was pending before
526 * this function was called last time, and no packets
527 * have been received since.
528 */
529 napi_complete(napi);
530 goto out;
531 }
532 524
533 dev_dbg(&bp->pdev->dev, "poll: status = %08lx, budget = %d\n", 525 dev_dbg(&bp->pdev->dev, "poll: status = %08lx, budget = %d\n",
534 (unsigned long)status, budget); 526 (unsigned long)status, budget);
535 527
536 if (!(status & MACB_BIT(REC))) {
537 dev_warn(&bp->pdev->dev,
538 "No RX buffers complete, status = %02lx\n",
539 (unsigned long)status);
540 napi_complete(napi);
541 goto out;
542 }
543
544 work_done = macb_rx(bp, budget); 528 work_done = macb_rx(bp, budget);
545 if (work_done < budget) 529 if (work_done < budget)
546 napi_complete(napi); 530 napi_complete(napi);
@@ -549,7 +533,6 @@ static int macb_poll(struct napi_struct *napi, int budget)
549 * We've done what we can to clean the buffers. Make sure we 533 * We've done what we can to clean the buffers. Make sure we
550 * get notified when new packets arrive. 534 * get notified when new packets arrive.
551 */ 535 */
552out:
553 macb_writel(bp, IER, MACB_RX_INT_FLAGS); 536 macb_writel(bp, IER, MACB_RX_INT_FLAGS);
554 537
555 /* TODO: Handle errors */ 538 /* TODO: Handle errors */
@@ -590,7 +573,8 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
590 } 573 }
591 } 574 }
592 575
593 if (status & (MACB_BIT(TCOMP) | MACB_BIT(ISR_TUND))) 576 if (status & (MACB_BIT(TCOMP) | MACB_BIT(ISR_TUND) |
577 MACB_BIT(ISR_RLE)))
594 macb_tx(bp); 578 macb_tx(bp);
595 579
596 /* 580 /*
@@ -1100,6 +1084,18 @@ static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1100 return phy_mii_ioctl(phydev, if_mii(rq), cmd); 1084 return phy_mii_ioctl(phydev, if_mii(rq), cmd);
1101} 1085}
1102 1086
1087static const struct net_device_ops macb_netdev_ops = {
1088 .ndo_open = macb_open,
1089 .ndo_stop = macb_close,
1090 .ndo_start_xmit = macb_start_xmit,
1091 .ndo_set_multicast_list = macb_set_rx_mode,
1092 .ndo_get_stats = macb_get_stats,
1093 .ndo_do_ioctl = macb_ioctl,
1094 .ndo_validate_addr = eth_validate_addr,
1095 .ndo_change_mtu = eth_change_mtu,
1096 .ndo_set_mac_address = eth_mac_addr,
1097};
1098
1103static int __init macb_probe(struct platform_device *pdev) 1099static int __init macb_probe(struct platform_device *pdev)
1104{ 1100{
1105 struct eth_platform_data *pdata; 1101 struct eth_platform_data *pdata;
@@ -1175,12 +1171,7 @@ static int __init macb_probe(struct platform_device *pdev)
1175 goto err_out_iounmap; 1171 goto err_out_iounmap;
1176 } 1172 }
1177 1173
1178 dev->open = macb_open; 1174 dev->netdev_ops = &macb_netdev_ops;
1179 dev->stop = macb_close;
1180 dev->hard_start_xmit = macb_start_xmit;
1181 dev->get_stats = macb_get_stats;
1182 dev->set_multicast_list = macb_set_rx_mode;
1183 dev->do_ioctl = macb_ioctl;
1184 netif_napi_add(dev, &bp->napi, macb_poll, 64); 1175 netif_napi_add(dev, &bp->napi, macb_poll, 64);
1185 dev->ethtool_ops = &macb_ethtool_ops; 1176 dev->ethtool_ops = &macb_ethtool_ops;
1186 1177
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c
index 527166e35d56..acd143da161d 100644
--- a/drivers/net/macsonic.c
+++ b/drivers/net/macsonic.c
@@ -167,6 +167,18 @@ static int macsonic_close(struct net_device* dev)
167 return err; 167 return err;
168} 168}
169 169
170static const struct net_device_ops macsonic_netdev_ops = {
171 .ndo_open = macsonic_open,
172 .ndo_stop = macsonic_close,
173 .ndo_start_xmit = sonic_send_packet,
174 .ndo_set_multicast_list = sonic_multicast_list,
175 .ndo_tx_timeout = sonic_tx_timeout,
176 .ndo_get_stats = sonic_get_stats,
177 .ndo_validate_addr = eth_validate_addr,
178 .ndo_change_mtu = eth_change_mtu,
179 .ndo_set_mac_address = eth_mac_addr,
180};
181
170static int __init macsonic_init(struct net_device *dev) 182static int __init macsonic_init(struct net_device *dev)
171{ 183{
172 struct sonic_local* lp = netdev_priv(dev); 184 struct sonic_local* lp = netdev_priv(dev);
@@ -198,12 +210,7 @@ static int __init macsonic_init(struct net_device *dev)
198 lp->rra_laddr = lp->rda_laddr + (SIZEOF_SONIC_RD * SONIC_NUM_RDS 210 lp->rra_laddr = lp->rda_laddr + (SIZEOF_SONIC_RD * SONIC_NUM_RDS
199 * SONIC_BUS_SCALE(lp->dma_bitmode)); 211 * SONIC_BUS_SCALE(lp->dma_bitmode));
200 212
201 dev->open = macsonic_open; 213 dev->netdev_ops = &macsonic_netdev_ops;
202 dev->stop = macsonic_close;
203 dev->hard_start_xmit = sonic_send_packet;
204 dev->get_stats = sonic_get_stats;
205 dev->set_multicast_list = &sonic_multicast_list;
206 dev->tx_timeout = sonic_tx_timeout;
207 dev->watchdog_timeo = TX_TIMEOUT; 214 dev->watchdog_timeo = TX_TIMEOUT;
208 215
209 /* 216 /*
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 70d3ef4a2c5f..214a8cf2b708 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -376,7 +376,8 @@ static u32 macvlan_ethtool_get_rx_csum(struct net_device *dev)
376 const struct macvlan_dev *vlan = netdev_priv(dev); 376 const struct macvlan_dev *vlan = netdev_priv(dev);
377 struct net_device *lowerdev = vlan->lowerdev; 377 struct net_device *lowerdev = vlan->lowerdev;
378 378
379 if (lowerdev->ethtool_ops->get_rx_csum == NULL) 379 if (lowerdev->ethtool_ops == NULL ||
380 lowerdev->ethtool_ops->get_rx_csum == NULL)
380 return 0; 381 return 0;
381 return lowerdev->ethtool_ops->get_rx_csum(lowerdev); 382 return lowerdev->ethtool_ops->get_rx_csum(lowerdev);
382} 383}
@@ -387,7 +388,8 @@ static int macvlan_ethtool_get_settings(struct net_device *dev,
387 const struct macvlan_dev *vlan = netdev_priv(dev); 388 const struct macvlan_dev *vlan = netdev_priv(dev);
388 struct net_device *lowerdev = vlan->lowerdev; 389 struct net_device *lowerdev = vlan->lowerdev;
389 390
390 if (!lowerdev->ethtool_ops->get_settings) 391 if (!lowerdev->ethtool_ops ||
392 !lowerdev->ethtool_ops->get_settings)
391 return -EOPNOTSUPP; 393 return -EOPNOTSUPP;
392 394
393 return lowerdev->ethtool_ops->get_settings(lowerdev, cmd); 395 return lowerdev->ethtool_ops->get_settings(lowerdev, cmd);
@@ -398,7 +400,8 @@ static u32 macvlan_ethtool_get_flags(struct net_device *dev)
398 const struct macvlan_dev *vlan = netdev_priv(dev); 400 const struct macvlan_dev *vlan = netdev_priv(dev);
399 struct net_device *lowerdev = vlan->lowerdev; 401 struct net_device *lowerdev = vlan->lowerdev;
400 402
401 if (!lowerdev->ethtool_ops->get_flags) 403 if (!lowerdev->ethtool_ops ||
404 !lowerdev->ethtool_ops->get_flags)
402 return 0; 405 return 0;
403 return lowerdev->ethtool_ops->get_flags(lowerdev); 406 return lowerdev->ethtool_ops->get_flags(lowerdev);
404} 407}
diff --git a/drivers/net/mlx4/en_main.c b/drivers/net/mlx4/en_main.c
index eda72dd2120f..510633fd57f6 100644
--- a/drivers/net/mlx4/en_main.c
+++ b/drivers/net/mlx4/en_main.c
@@ -181,7 +181,7 @@ static void *mlx4_en_add(struct mlx4_dev *dev)
181 mdev->workqueue = create_singlethread_workqueue("mlx4_en"); 181 mdev->workqueue = create_singlethread_workqueue("mlx4_en");
182 if (!mdev->workqueue) { 182 if (!mdev->workqueue) {
183 err = -ENOMEM; 183 err = -ENOMEM;
184 goto err_close_nic; 184 goto err_mr;
185 } 185 }
186 186
187 /* At this stage all non-port specific tasks are complete: 187 /* At this stage all non-port specific tasks are complete:
@@ -214,9 +214,8 @@ err_free_netdev:
214 flush_workqueue(mdev->workqueue); 214 flush_workqueue(mdev->workqueue);
215 215
216 /* Stop event queue before we drop down to release shared SW state */ 216 /* Stop event queue before we drop down to release shared SW state */
217
218err_close_nic:
219 destroy_workqueue(mdev->workqueue); 217 destroy_workqueue(mdev->workqueue);
218
220err_mr: 219err_mr:
221 mlx4_mr_free(dev, &mdev->mr); 220 mlx4_mr_free(dev, &mdev->mr);
222err_uar: 221err_uar:
diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c
index 303c23de6cac..7bcc49de1637 100644
--- a/drivers/net/mlx4/en_netdev.c
+++ b/drivers/net/mlx4/en_netdev.c
@@ -348,11 +348,9 @@ static void mlx4_en_tx_timeout(struct net_device *dev)
348 if (netif_msg_timer(priv)) 348 if (netif_msg_timer(priv))
349 mlx4_warn(mdev, "Tx timeout called on port:%d\n", priv->port); 349 mlx4_warn(mdev, "Tx timeout called on port:%d\n", priv->port);
350 350
351 if (netif_carrier_ok(dev)) { 351 priv->port_stats.tx_timeout++;
352 priv->port_stats.tx_timeout++; 352 mlx4_dbg(DRV, priv, "Scheduling watchdog\n");
353 mlx4_dbg(DRV, priv, "Scheduling watchdog\n"); 353 queue_work(mdev->workqueue, &priv->watchdog_task);
354 queue_work(mdev->workqueue, &priv->watchdog_task);
355 }
356} 354}
357 355
358 356
@@ -585,7 +583,7 @@ int mlx4_en_start_port(struct net_device *dev)
585 err = mlx4_en_activate_cq(priv, cq); 583 err = mlx4_en_activate_cq(priv, cq);
586 if (err) { 584 if (err) {
587 mlx4_err(mdev, "Failed activating Rx CQ\n"); 585 mlx4_err(mdev, "Failed activating Rx CQ\n");
588 goto rx_err; 586 goto cq_err;
589 } 587 }
590 for (j = 0; j < cq->size; j++) 588 for (j = 0; j < cq->size; j++)
591 cq->buf[j].owner_sr_opcode = MLX4_CQE_OWNER_MASK; 589 cq->buf[j].owner_sr_opcode = MLX4_CQE_OWNER_MASK;
@@ -761,9 +759,14 @@ static void mlx4_en_restart(struct work_struct *work)
761 struct net_device *dev = priv->dev; 759 struct net_device *dev = priv->dev;
762 760
763 mlx4_dbg(DRV, priv, "Watchdog task called for port %d\n", priv->port); 761 mlx4_dbg(DRV, priv, "Watchdog task called for port %d\n", priv->port);
764 mlx4_en_stop_port(dev); 762
765 if (mlx4_en_start_port(dev)) 763 mutex_lock(&mdev->state_lock);
766 mlx4_err(mdev, "Failed restarting port %d\n", priv->port); 764 if (priv->port_up) {
765 mlx4_en_stop_port(dev);
766 if (mlx4_en_start_port(dev))
767 mlx4_err(mdev, "Failed restarting port %d\n", priv->port);
768 }
769 mutex_unlock(&mdev->state_lock);
767} 770}
768 771
769 772
@@ -1054,7 +1057,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
1054 * Set driver features 1057 * Set driver features
1055 */ 1058 */
1056 dev->features |= NETIF_F_SG; 1059 dev->features |= NETIF_F_SG;
1057 dev->features |= NETIF_F_HW_CSUM; 1060 dev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
1058 dev->features |= NETIF_F_HIGHDMA; 1061 dev->features |= NETIF_F_HIGHDMA;
1059 dev->features |= NETIF_F_HW_VLAN_TX | 1062 dev->features |= NETIF_F_HW_VLAN_TX |
1060 NETIF_F_HW_VLAN_RX | 1063 NETIF_F_HW_VLAN_RX |
diff --git a/drivers/net/mlx4/en_port.c b/drivers/net/mlx4/en_port.c
index c5a4c0389752..a29abe845d2e 100644
--- a/drivers/net/mlx4/en_port.c
+++ b/drivers/net/mlx4/en_port.c
@@ -151,6 +151,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
151 struct mlx4_cmd_mailbox *mailbox; 151 struct mlx4_cmd_mailbox *mailbox;
152 u64 in_mod = reset << 8 | port; 152 u64 in_mod = reset << 8 | port;
153 int err; 153 int err;
154 int i;
154 155
155 mailbox = mlx4_alloc_cmd_mailbox(mdev->dev); 156 mailbox = mlx4_alloc_cmd_mailbox(mdev->dev);
156 if (IS_ERR(mailbox)) 157 if (IS_ERR(mailbox))
@@ -165,38 +166,18 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
165 166
166 spin_lock_bh(&priv->stats_lock); 167 spin_lock_bh(&priv->stats_lock);
167 168
168 stats->rx_packets = be32_to_cpu(mlx4_en_stats->RTOTFRMS) - 169 stats->rx_packets = 0;
169 be32_to_cpu(mlx4_en_stats->RDROP); 170 stats->rx_bytes = 0;
170 stats->tx_packets = be64_to_cpu(mlx4_en_stats->TTOT_prio_0) + 171 for (i = 0; i < priv->rx_ring_num; i++) {
171 be64_to_cpu(mlx4_en_stats->TTOT_prio_1) + 172 stats->rx_packets += priv->rx_ring[i].packets;
172 be64_to_cpu(mlx4_en_stats->TTOT_prio_2) + 173 stats->rx_bytes += priv->rx_ring[i].bytes;
173 be64_to_cpu(mlx4_en_stats->TTOT_prio_3) + 174 }
174 be64_to_cpu(mlx4_en_stats->TTOT_prio_4) + 175 stats->tx_packets = 0;
175 be64_to_cpu(mlx4_en_stats->TTOT_prio_5) + 176 stats->tx_bytes = 0;
176 be64_to_cpu(mlx4_en_stats->TTOT_prio_6) + 177 for (i = 0; i <= priv->tx_ring_num; i++) {
177 be64_to_cpu(mlx4_en_stats->TTOT_prio_7) + 178 stats->tx_packets += priv->tx_ring[i].packets;
178 be64_to_cpu(mlx4_en_stats->TTOT_novlan) + 179 stats->tx_bytes += priv->tx_ring[i].bytes;
179 be64_to_cpu(mlx4_en_stats->TTOT_loopbk); 180 }
180 stats->rx_bytes = be64_to_cpu(mlx4_en_stats->ROCT_prio_0) +
181 be64_to_cpu(mlx4_en_stats->ROCT_prio_1) +
182 be64_to_cpu(mlx4_en_stats->ROCT_prio_2) +
183 be64_to_cpu(mlx4_en_stats->ROCT_prio_3) +
184 be64_to_cpu(mlx4_en_stats->ROCT_prio_4) +
185 be64_to_cpu(mlx4_en_stats->ROCT_prio_5) +
186 be64_to_cpu(mlx4_en_stats->ROCT_prio_6) +
187 be64_to_cpu(mlx4_en_stats->ROCT_prio_7) +
188 be64_to_cpu(mlx4_en_stats->ROCT_novlan);
189
190 stats->tx_bytes = be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_0) +
191 be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_1) +
192 be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_2) +
193 be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_3) +
194 be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_4) +
195 be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_5) +
196 be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_6) +
197 be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_7) +
198 be64_to_cpu(mlx4_en_stats->TTTLOCT_novlan) +
199 be64_to_cpu(mlx4_en_stats->TTTLOCT_loopbk);
200 181
201 stats->rx_errors = be64_to_cpu(mlx4_en_stats->PCS) + 182 stats->rx_errors = be64_to_cpu(mlx4_en_stats->PCS) +
202 be32_to_cpu(mlx4_en_stats->RdropLength) + 183 be32_to_cpu(mlx4_en_stats->RdropLength) +
diff --git a/drivers/net/mlx4/en_resources.c b/drivers/net/mlx4/en_resources.c
index a0545209e507..65ca706c04bb 100644
--- a/drivers/net/mlx4/en_resources.c
+++ b/drivers/net/mlx4/en_resources.c
@@ -94,3 +94,9 @@ void mlx4_en_unmap_buffer(struct mlx4_buf *buf)
94 94
95 vunmap(buf->direct.buf); 95 vunmap(buf->direct.buf);
96} 96}
97
98void mlx4_en_sqp_event(struct mlx4_qp *qp, enum mlx4_event event)
99{
100 return;
101}
102
diff --git a/drivers/net/mlx4/en_rx.c b/drivers/net/mlx4/en_rx.c
index 7e40741fb7d8..7942c4d3cd88 100644
--- a/drivers/net/mlx4/en_rx.c
+++ b/drivers/net/mlx4/en_rx.c
@@ -436,8 +436,9 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv)
436 /* Initialize page allocators */ 436 /* Initialize page allocators */
437 err = mlx4_en_init_allocator(priv, ring); 437 err = mlx4_en_init_allocator(priv, ring);
438 if (err) { 438 if (err) {
439 mlx4_err(mdev, "Failed initializing ring allocator\n"); 439 mlx4_err(mdev, "Failed initializing ring allocator\n");
440 goto err_allocator; 440 ring_ind--;
441 goto err_allocator;
441 } 442 }
442 443
443 /* Fill Rx buffers */ 444 /* Fill Rx buffers */
@@ -467,6 +468,7 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv)
467 ring->wqres.db.dma, &ring->srq); 468 ring->wqres.db.dma, &ring->srq);
468 if (err){ 469 if (err){
469 mlx4_err(mdev, "Failed to allocate srq\n"); 470 mlx4_err(mdev, "Failed to allocate srq\n");
471 ring_ind--;
470 goto err_srq; 472 goto err_srq;
471 } 473 }
472 ring->srq.event = mlx4_en_srq_event; 474 ring->srq.event = mlx4_en_srq_event;
@@ -608,6 +610,10 @@ static struct sk_buff *mlx4_en_rx_skb(struct mlx4_en_priv *priv,
608 used_frags = mlx4_en_complete_rx_desc(priv, rx_desc, skb_frags, 610 used_frags = mlx4_en_complete_rx_desc(priv, rx_desc, skb_frags,
609 skb_shinfo(skb)->frags, 611 skb_shinfo(skb)->frags,
610 page_alloc, length); 612 page_alloc, length);
613 if (unlikely(!used_frags)) {
614 kfree_skb(skb);
615 return NULL;
616 }
611 skb_shinfo(skb)->nr_frags = used_frags; 617 skb_shinfo(skb)->nr_frags = used_frags;
612 618
613 /* Copy headers into the skb linear buffer */ 619 /* Copy headers into the skb linear buffer */
@@ -926,12 +932,6 @@ void mlx4_en_set_default_rss_map(struct mlx4_en_priv *priv,
926 } 932 }
927} 933}
928 934
929static void mlx4_en_sqp_event(struct mlx4_qp *qp, enum mlx4_event event)
930{
931 return;
932}
933
934
935static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, 935static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv,
936 int qpn, int srqn, int cqn, 936 int qpn, int srqn, int cqn,
937 enum mlx4_qp_state *state, 937 enum mlx4_qp_state *state,
diff --git a/drivers/net/mlx4/en_tx.c b/drivers/net/mlx4/en_tx.c
index 4afd5993e31c..ac6fc499b280 100644
--- a/drivers/net/mlx4/en_tx.c
+++ b/drivers/net/mlx4/en_tx.c
@@ -112,6 +112,7 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
112 mlx4_err(mdev, "Failed allocating qp %d\n", ring->qpn); 112 mlx4_err(mdev, "Failed allocating qp %d\n", ring->qpn);
113 goto err_reserve; 113 goto err_reserve;
114 } 114 }
115 ring->qp.event = mlx4_en_sqp_event;
115 116
116 return 0; 117 return 0;
117 118
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c
index 102bac90a302..30bea9689694 100644
--- a/drivers/net/mlx4/main.c
+++ b/drivers/net/mlx4/main.c
@@ -976,7 +976,7 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
976 nreq = err; 976 nreq = err;
977 goto retry; 977 goto retry;
978 } 978 }
979 979 kfree(entries);
980 goto no_msi; 980 goto no_msi;
981 } 981 }
982 982
diff --git a/drivers/net/mlx4/mlx4_en.h b/drivers/net/mlx4/mlx4_en.h
index e9af32d41ca4..ef840abbcd39 100644
--- a/drivers/net/mlx4/mlx4_en.h
+++ b/drivers/net/mlx4/mlx4_en.h
@@ -538,6 +538,7 @@ int mlx4_en_poll_rx_cq(struct napi_struct *napi, int budget);
538void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride, 538void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride,
539 int is_tx, int rss, int qpn, int cqn, int srqn, 539 int is_tx, int rss, int qpn, int cqn, int srqn,
540 struct mlx4_qp_context *context); 540 struct mlx4_qp_context *context);
541void mlx4_en_sqp_event(struct mlx4_qp *qp, enum mlx4_event event);
541int mlx4_en_map_buffer(struct mlx4_buf *buf); 542int mlx4_en_map_buffer(struct mlx4_buf *buf);
542void mlx4_en_unmap_buffer(struct mlx4_buf *buf); 543void mlx4_en_unmap_buffer(struct mlx4_buf *buf);
543 544
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index b3185bf2c158..a400d7115f78 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -393,12 +393,12 @@ struct mv643xx_eth_private {
393 struct work_struct tx_timeout_task; 393 struct work_struct tx_timeout_task;
394 394
395 struct napi_struct napi; 395 struct napi_struct napi;
396 u8 oom;
396 u8 work_link; 397 u8 work_link;
397 u8 work_tx; 398 u8 work_tx;
398 u8 work_tx_end; 399 u8 work_tx_end;
399 u8 work_rx; 400 u8 work_rx;
400 u8 work_rx_refill; 401 u8 work_rx_refill;
401 u8 work_rx_oom;
402 402
403 int skb_size; 403 int skb_size;
404 struct sk_buff_head rx_recycle; 404 struct sk_buff_head rx_recycle;
@@ -661,7 +661,7 @@ static int rxq_refill(struct rx_queue *rxq, int budget)
661 dma_get_cache_alignment() - 1); 661 dma_get_cache_alignment() - 1);
662 662
663 if (skb == NULL) { 663 if (skb == NULL) {
664 mp->work_rx_oom |= 1 << rxq->index; 664 mp->oom = 1;
665 goto oom; 665 goto oom;
666 } 666 }
667 667
@@ -1255,7 +1255,6 @@ static void mib_counters_update(struct mv643xx_eth_private *mp)
1255 1255
1256 spin_lock_bh(&mp->mib_counters_lock); 1256 spin_lock_bh(&mp->mib_counters_lock);
1257 p->good_octets_received += mib_read(mp, 0x00); 1257 p->good_octets_received += mib_read(mp, 0x00);
1258 p->good_octets_received += (u64)mib_read(mp, 0x04) << 32;
1259 p->bad_octets_received += mib_read(mp, 0x08); 1258 p->bad_octets_received += mib_read(mp, 0x08);
1260 p->internal_mac_transmit_err += mib_read(mp, 0x0c); 1259 p->internal_mac_transmit_err += mib_read(mp, 0x0c);
1261 p->good_frames_received += mib_read(mp, 0x10); 1260 p->good_frames_received += mib_read(mp, 0x10);
@@ -1269,7 +1268,6 @@ static void mib_counters_update(struct mv643xx_eth_private *mp)
1269 p->frames_512_to_1023_octets += mib_read(mp, 0x30); 1268 p->frames_512_to_1023_octets += mib_read(mp, 0x30);
1270 p->frames_1024_to_max_octets += mib_read(mp, 0x34); 1269 p->frames_1024_to_max_octets += mib_read(mp, 0x34);
1271 p->good_octets_sent += mib_read(mp, 0x38); 1270 p->good_octets_sent += mib_read(mp, 0x38);
1272 p->good_octets_sent += (u64)mib_read(mp, 0x3c) << 32;
1273 p->good_frames_sent += mib_read(mp, 0x40); 1271 p->good_frames_sent += mib_read(mp, 0x40);
1274 p->excessive_collision += mib_read(mp, 0x44); 1272 p->excessive_collision += mib_read(mp, 0x44);
1275 p->multicast_frames_sent += mib_read(mp, 0x48); 1273 p->multicast_frames_sent += mib_read(mp, 0x48);
@@ -2167,8 +2165,10 @@ static int mv643xx_eth_poll(struct napi_struct *napi, int budget)
2167 2165
2168 mp = container_of(napi, struct mv643xx_eth_private, napi); 2166 mp = container_of(napi, struct mv643xx_eth_private, napi);
2169 2167
2170 mp->work_rx_refill |= mp->work_rx_oom; 2168 if (unlikely(mp->oom)) {
2171 mp->work_rx_oom = 0; 2169 mp->oom = 0;
2170 del_timer(&mp->rx_oom);
2171 }
2172 2172
2173 work_done = 0; 2173 work_done = 0;
2174 while (work_done < budget) { 2174 while (work_done < budget) {
@@ -2182,8 +2182,10 @@ static int mv643xx_eth_poll(struct napi_struct *napi, int budget)
2182 continue; 2182 continue;
2183 } 2183 }
2184 2184
2185 queue_mask = mp->work_tx | mp->work_tx_end | 2185 queue_mask = mp->work_tx | mp->work_tx_end | mp->work_rx;
2186 mp->work_rx | mp->work_rx_refill; 2186 if (likely(!mp->oom))
2187 queue_mask |= mp->work_rx_refill;
2188
2187 if (!queue_mask) { 2189 if (!queue_mask) {
2188 if (mv643xx_eth_collect_events(mp)) 2190 if (mv643xx_eth_collect_events(mp))
2189 continue; 2191 continue;
@@ -2204,7 +2206,7 @@ static int mv643xx_eth_poll(struct napi_struct *napi, int budget)
2204 txq_maybe_wake(mp->txq + queue); 2206 txq_maybe_wake(mp->txq + queue);
2205 } else if (mp->work_rx & queue_mask) { 2207 } else if (mp->work_rx & queue_mask) {
2206 work_done += rxq_process(mp->rxq + queue, work_tbd); 2208 work_done += rxq_process(mp->rxq + queue, work_tbd);
2207 } else if (mp->work_rx_refill & queue_mask) { 2209 } else if (!mp->oom && (mp->work_rx_refill & queue_mask)) {
2208 work_done += rxq_refill(mp->rxq + queue, work_tbd); 2210 work_done += rxq_refill(mp->rxq + queue, work_tbd);
2209 } else { 2211 } else {
2210 BUG(); 2212 BUG();
@@ -2212,7 +2214,7 @@ static int mv643xx_eth_poll(struct napi_struct *napi, int budget)
2212 } 2214 }
2213 2215
2214 if (work_done < budget) { 2216 if (work_done < budget) {
2215 if (mp->work_rx_oom) 2217 if (mp->oom)
2216 mod_timer(&mp->rx_oom, jiffies + (HZ / 10)); 2218 mod_timer(&mp->rx_oom, jiffies + (HZ / 10));
2217 napi_complete(napi); 2219 napi_complete(napi);
2218 wrlp(mp, INT_MASK, INT_TX_END | INT_RX | INT_EXT); 2220 wrlp(mp, INT_MASK, INT_TX_END | INT_RX | INT_EXT);
@@ -2372,7 +2374,7 @@ static int mv643xx_eth_open(struct net_device *dev)
2372 rxq_refill(mp->rxq + i, INT_MAX); 2374 rxq_refill(mp->rxq + i, INT_MAX);
2373 } 2375 }
2374 2376
2375 if (mp->work_rx_oom) { 2377 if (mp->oom) {
2376 mp->rx_oom.expires = jiffies + (HZ / 10); 2378 mp->rx_oom.expires = jiffies + (HZ / 10);
2377 add_timer(&mp->rx_oom); 2379 add_timer(&mp->rx_oom);
2378 } 2380 }
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 9eed126a82f0..f2c4a665e93f 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -2447,6 +2447,7 @@ static int myri10ge_open(struct net_device *dev)
2447 lro_mgr->lro_arr = ss->rx_done.lro_desc; 2447 lro_mgr->lro_arr = ss->rx_done.lro_desc;
2448 lro_mgr->get_frag_header = myri10ge_get_frag_header; 2448 lro_mgr->get_frag_header = myri10ge_get_frag_header;
2449 lro_mgr->max_aggr = myri10ge_lro_max_pkts; 2449 lro_mgr->max_aggr = myri10ge_lro_max_pkts;
2450 lro_mgr->frag_align_pad = 2;
2450 if (lro_mgr->max_aggr > MAX_SKB_FRAGS) 2451 if (lro_mgr->max_aggr > MAX_SKB_FRAGS)
2451 lro_mgr->max_aggr = MAX_SKB_FRAGS; 2452 lro_mgr->max_aggr = MAX_SKB_FRAGS;
2452 2453
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
index eb66f658f9d1..7d83896b8c26 100644
--- a/drivers/net/ne2k-pci.c
+++ b/drivers/net/ne2k-pci.c
@@ -374,18 +374,17 @@ static int __devinit ne2k_pci_init_one (struct pci_dev *pdev,
374 dev->ethtool_ops = &ne2k_pci_ethtool_ops; 374 dev->ethtool_ops = &ne2k_pci_ethtool_ops;
375 NS8390_init(dev, 0); 375 NS8390_init(dev, 0);
376 376
377 memcpy(dev->dev_addr, SA_prom, 6);
378 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
379
377 i = register_netdev(dev); 380 i = register_netdev(dev);
378 if (i) 381 if (i)
379 goto err_out_free_netdev; 382 goto err_out_free_netdev;
380 383
381 for(i = 0; i < 6; i++)
382 dev->dev_addr[i] = SA_prom[i];
383 printk("%s: %s found at %#lx, IRQ %d, %pM.\n", 384 printk("%s: %s found at %#lx, IRQ %d, %pM.\n",
384 dev->name, pci_clone_list[chip_idx].name, ioaddr, dev->irq, 385 dev->name, pci_clone_list[chip_idx].name, ioaddr, dev->irq,
385 dev->dev_addr); 386 dev->dev_addr);
386 387
387 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
388
389 return 0; 388 return 0;
390 389
391err_out_free_netdev: 390err_out_free_netdev:
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index eceadf787a67..bf4af5248cb7 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -664,7 +664,7 @@ static int netconsole_netdev_event(struct notifier_block *this,
664 struct netconsole_target *nt; 664 struct netconsole_target *nt;
665 struct net_device *dev = ptr; 665 struct net_device *dev = ptr;
666 666
667 if (!(event == NETDEV_CHANGENAME)) 667 if (!(event == NETDEV_CHANGENAME || event == NETDEV_UNREGISTER))
668 goto done; 668 goto done;
669 669
670 spin_lock_irqsave(&target_list_lock, flags); 670 spin_lock_irqsave(&target_list_lock, flags);
@@ -675,6 +675,15 @@ static int netconsole_netdev_event(struct notifier_block *this,
675 case NETDEV_CHANGENAME: 675 case NETDEV_CHANGENAME:
676 strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ); 676 strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ);
677 break; 677 break;
678 case NETDEV_UNREGISTER:
679 if (!nt->enabled)
680 break;
681 netpoll_cleanup(&nt->np);
682 nt->enabled = 0;
683 printk(KERN_INFO "netconsole: network logging stopped"
684 ", interface %s unregistered\n",
685 dev->name);
686 break;
678 } 687 }
679 } 688 }
680 netconsole_target_put(nt); 689 netconsole_target_put(nt);
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 2fbf9f9ddd37..652a36888361 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -1758,7 +1758,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1758 PCMCIA_MFC_DEVICE_CIS_PROD_ID12(0, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "DP83903.cis"), 1758 PCMCIA_MFC_DEVICE_CIS_PROD_ID12(0, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "DP83903.cis"),
1759 PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "DP83903.cis"), 1759 PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "DP83903.cis"),
1760 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "DP83903.cis"), 1760 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "DP83903.cis"),
1761 PCMCIA_DEVICE_CIS_MANF_CARD(0xc00f, 0x0002, "LA-PCM.cis"), 1761 PCMCIA_DEVICE_CIS_MANF_CARD(0xc00f, 0x0002, "cis/LA-PCM.cis"),
1762 PCMCIA_DEVICE_CIS_PROD_ID12("KTI", "PE520 PLUS", 0xad180345, 0x9d58d392, "PE520.cis"), 1762 PCMCIA_DEVICE_CIS_PROD_ID12("KTI", "PE520 PLUS", 0xad180345, 0x9d58d392, "PE520.cis"),
1763 PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "NE2K.cis"), 1763 PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "NE2K.cis"),
1764 PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "PE-200.cis"), 1764 PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "PE-200.cis"),
diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c
index cf24cc34debe..e7070515d2e3 100644
--- a/drivers/net/phy/fixed.c
+++ b/drivers/net/phy/fixed.c
@@ -19,6 +19,7 @@
19#include <linux/mii.h> 19#include <linux/mii.h>
20#include <linux/phy.h> 20#include <linux/phy.h>
21#include <linux/phy_fixed.h> 21#include <linux/phy_fixed.h>
22#include <linux/err.h>
22 23
23#define MII_REGS_NUM 29 24#define MII_REGS_NUM 29
24 25
@@ -207,8 +208,8 @@ static int __init fixed_mdio_bus_init(void)
207 int ret; 208 int ret;
208 209
209 pdev = platform_device_register_simple("Fixed MDIO bus", 0, NULL, 0); 210 pdev = platform_device_register_simple("Fixed MDIO bus", 0, NULL, 0);
210 if (!pdev) { 211 if (IS_ERR(pdev)) {
211 ret = -ENOMEM; 212 ret = PTR_ERR(pdev);
212 goto err_pdev; 213 goto err_pdev;
213 } 214 }
214 215
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index eb6411c4694f..7a3ec9d39a9a 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -69,6 +69,11 @@
69#define MII_M1111_COPPER 0 69#define MII_M1111_COPPER 0
70#define MII_M1111_FIBER 1 70#define MII_M1111_FIBER 1
71 71
72#define MII_88E1121_PHY_LED_CTRL 16
73#define MII_88E1121_PHY_LED_PAGE 3
74#define MII_88E1121_PHY_LED_DEF 0x0030
75#define MII_88E1121_PHY_PAGE 22
76
72#define MII_M1011_PHY_STATUS 0x11 77#define MII_M1011_PHY_STATUS 0x11
73#define MII_M1011_PHY_STATUS_1000 0x8000 78#define MII_M1011_PHY_STATUS_1000 0x8000
74#define MII_M1011_PHY_STATUS_100 0x4000 79#define MII_M1011_PHY_STATUS_100 0x4000
@@ -154,6 +159,30 @@ static int marvell_config_aneg(struct phy_device *phydev)
154 return err; 159 return err;
155} 160}
156 161
162static int m88e1121_config_aneg(struct phy_device *phydev)
163{
164 int err, temp;
165
166 err = phy_write(phydev, MII_BMCR, BMCR_RESET);
167 if (err < 0)
168 return err;
169
170 err = phy_write(phydev, MII_M1011_PHY_SCR,
171 MII_M1011_PHY_SCR_AUTO_CROSS);
172 if (err < 0)
173 return err;
174
175 temp = phy_read(phydev, MII_88E1121_PHY_PAGE);
176
177 phy_write(phydev, MII_88E1121_PHY_PAGE, MII_88E1121_PHY_LED_PAGE);
178 phy_write(phydev, MII_88E1121_PHY_LED_CTRL, MII_88E1121_PHY_LED_DEF);
179 phy_write(phydev, MII_88E1121_PHY_PAGE, temp);
180
181 err = genphy_config_aneg(phydev);
182
183 return err;
184}
185
157static int m88e1111_config_init(struct phy_device *phydev) 186static int m88e1111_config_init(struct phy_device *phydev)
158{ 187{
159 int err; 188 int err;
@@ -429,6 +458,18 @@ static int marvell_read_status(struct phy_device *phydev)
429 return 0; 458 return 0;
430} 459}
431 460
461static int m88e1121_did_interrupt(struct phy_device *phydev)
462{
463 int imask;
464
465 imask = phy_read(phydev, MII_M1011_IEVENT);
466
467 if (imask & MII_M1011_IMASK_INIT)
468 return 1;
469
470 return 0;
471}
472
432static struct phy_driver marvell_drivers[] = { 473static struct phy_driver marvell_drivers[] = {
433 { 474 {
434 .phy_id = 0x01410c60, 475 .phy_id = 0x01410c60,
@@ -482,6 +523,19 @@ static struct phy_driver marvell_drivers[] = {
482 .driver = {.owner = THIS_MODULE,}, 523 .driver = {.owner = THIS_MODULE,},
483 }, 524 },
484 { 525 {
526 .phy_id = 0x01410cb0,
527 .phy_id_mask = 0xfffffff0,
528 .name = "Marvell 88E1121R",
529 .features = PHY_GBIT_FEATURES,
530 .flags = PHY_HAS_INTERRUPT,
531 .config_aneg = &m88e1121_config_aneg,
532 .read_status = &marvell_read_status,
533 .ack_interrupt = &marvell_ack_interrupt,
534 .config_intr = &marvell_config_intr,
535 .did_interrupt = &m88e1121_did_interrupt,
536 .driver = { .owner = THIS_MODULE },
537 },
538 {
485 .phy_id = 0x01410cd0, 539 .phy_id = 0x01410cd0,
486 .phy_id_mask = 0xfffffff0, 540 .phy_id_mask = 0xfffffff0,
487 .name = "Marvell 88E1145", 541 .name = "Marvell 88E1145",
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 3ff1f425f1bb..61755cbd978e 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -434,7 +434,7 @@ void phy_start_machine(struct phy_device *phydev,
434 phydev->adjust_state = handler; 434 phydev->adjust_state = handler;
435 435
436 INIT_DELAYED_WORK(&phydev->state_queue, phy_state_machine); 436 INIT_DELAYED_WORK(&phydev->state_queue, phy_state_machine);
437 schedule_delayed_work(&phydev->state_queue, jiffies + HZ); 437 schedule_delayed_work(&phydev->state_queue, HZ);
438} 438}
439 439
440/** 440/**
@@ -655,6 +655,10 @@ static void phy_change(struct work_struct *work)
655 struct phy_device *phydev = 655 struct phy_device *phydev =
656 container_of(work, struct phy_device, phy_queue); 656 container_of(work, struct phy_device, phy_queue);
657 657
658 if (phydev->drv->did_interrupt &&
659 !phydev->drv->did_interrupt(phydev))
660 goto ignore;
661
658 err = phy_disable_interrupts(phydev); 662 err = phy_disable_interrupts(phydev);
659 663
660 if (err) 664 if (err)
@@ -681,6 +685,11 @@ static void phy_change(struct work_struct *work)
681 685
682 return; 686 return;
683 687
688ignore:
689 atomic_dec(&phydev->irq_disable);
690 enable_irq(phydev->irq);
691 return;
692
684irq_enable_err: 693irq_enable_err:
685 disable_irq(phydev->irq); 694 disable_irq(phydev->irq);
686 atomic_inc(&phydev->irq_disable); 695 atomic_inc(&phydev->irq_disable);
@@ -937,6 +946,5 @@ static void phy_state_machine(struct work_struct *work)
937 if (err < 0) 946 if (err < 0)
938 phy_error(phydev); 947 phy_error(phydev);
939 948
940 schedule_delayed_work(&phydev->state_queue, 949 schedule_delayed_work(&phydev->state_queue, PHY_STATE_TIME * HZ);
941 jiffies + PHY_STATE_TIME * HZ);
942} 950}
diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c
index a5ac2bd58b5b..4f3ada622f9b 100644
--- a/drivers/net/ps3_gelic_wireless.c
+++ b/drivers/net/ps3_gelic_wireless.c
@@ -2101,6 +2101,9 @@ static int gelic_wl_associate_bss(struct gelic_wl_info *wl,
2101 if (ret) { 2101 if (ret) {
2102 pr_debug("%s: WEP/WPA setup failed %d\n", __func__, 2102 pr_debug("%s: WEP/WPA setup failed %d\n", __func__,
2103 ret); 2103 ret);
2104 ret = -EPERM;
2105 gelic_wl_send_iwap_event(wl, NULL);
2106 goto out;
2104 } 2107 }
2105 2108
2106 /* start association */ 2109 /* start association */
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index dee23b159df2..7269a426051c 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -448,9 +448,6 @@ static void efx_init_channels(struct efx_nic *efx)
448 448
449 WARN_ON(channel->rx_pkt != NULL); 449 WARN_ON(channel->rx_pkt != NULL);
450 efx_rx_strategy(channel); 450 efx_rx_strategy(channel);
451
452 netif_napi_add(channel->napi_dev, &channel->napi_str,
453 efx_poll, napi_weight);
454 } 451 }
455} 452}
456 453
@@ -1321,6 +1318,8 @@ static int efx_init_napi(struct efx_nic *efx)
1321 1318
1322 efx_for_each_channel(channel, efx) { 1319 efx_for_each_channel(channel, efx) {
1323 channel->napi_dev = efx->net_dev; 1320 channel->napi_dev = efx->net_dev;
1321 netif_napi_add(channel->napi_dev, &channel->napi_str,
1322 efx_poll, napi_weight);
1324 } 1323 }
1325 return 0; 1324 return 0;
1326} 1325}
@@ -1330,6 +1329,8 @@ static void efx_fini_napi(struct efx_nic *efx)
1330 struct efx_channel *channel; 1329 struct efx_channel *channel;
1331 1330
1332 efx_for_each_channel(channel, efx) { 1331 efx_for_each_channel(channel, efx) {
1332 if (channel->napi_dev)
1333 netif_napi_del(&channel->napi_str);
1333 channel->napi_dev = NULL; 1334 channel->napi_dev = NULL;
1334 } 1335 }
1335} 1336}
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index d4629ab2c614..466a8abb0053 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -1176,9 +1176,9 @@ void falcon_sim_phy_event(struct efx_nic *efx)
1176 1176
1177 EFX_POPULATE_QWORD_1(phy_event, EV_CODE, GLOBAL_EV_DECODE); 1177 EFX_POPULATE_QWORD_1(phy_event, EV_CODE, GLOBAL_EV_DECODE);
1178 if (EFX_IS10G(efx)) 1178 if (EFX_IS10G(efx))
1179 EFX_SET_OWORD_FIELD(phy_event, XG_PHY_INTR, 1); 1179 EFX_SET_QWORD_FIELD(phy_event, XG_PHY_INTR, 1);
1180 else 1180 else
1181 EFX_SET_OWORD_FIELD(phy_event, G_PHY0_INTR, 1); 1181 EFX_SET_QWORD_FIELD(phy_event, G_PHY0_INTR, 1);
1182 1182
1183 falcon_generate_event(&efx->channel[0], &phy_event); 1183 falcon_generate_event(&efx->channel[0], &phy_event);
1184} 1184}
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 7b1882765a0c..3ab28bb00c12 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -1188,6 +1188,19 @@ out:
1188 return ret; 1188 return ret;
1189} 1189}
1190 1190
1191static const struct net_device_ops sh_eth_netdev_ops = {
1192 .ndo_open = sh_eth_open,
1193 .ndo_stop = sh_eth_close,
1194 .ndo_start_xmit = sh_eth_start_xmit,
1195 .ndo_get_stats = sh_eth_get_stats,
1196 .ndo_set_multicast_list = sh_eth_set_multicast_list,
1197 .ndo_tx_timeout = sh_eth_tx_timeout,
1198 .ndo_do_ioctl = sh_eth_do_ioctl,
1199 .ndo_validate_addr = eth_validate_addr,
1200 .ndo_set_mac_address = eth_mac_addr,
1201 .ndo_change_mtu = eth_change_mtu,
1202};
1203
1191static int sh_eth_drv_probe(struct platform_device *pdev) 1204static int sh_eth_drv_probe(struct platform_device *pdev)
1192{ 1205{
1193 int ret, i, devno = 0; 1206 int ret, i, devno = 0;
@@ -1240,13 +1253,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
1240 mdp->edmac_endian = pd->edmac_endian; 1253 mdp->edmac_endian = pd->edmac_endian;
1241 1254
1242 /* set function */ 1255 /* set function */
1243 ndev->open = sh_eth_open; 1256 ndev->netdev_ops = &sh_eth_netdev_ops;
1244 ndev->hard_start_xmit = sh_eth_start_xmit;
1245 ndev->stop = sh_eth_close;
1246 ndev->get_stats = sh_eth_get_stats;
1247 ndev->set_multicast_list = sh_eth_set_multicast_list;
1248 ndev->do_ioctl = sh_eth_do_ioctl;
1249 ndev->tx_timeout = sh_eth_tx_timeout;
1250 ndev->watchdog_timeo = TX_TIMEOUT; 1257 ndev->watchdog_timeo = TX_TIMEOUT;
1251 1258
1252 mdp->post_rx = POST_RX >> (devno << 1); 1259 mdp->post_rx = POST_RX >> (devno << 1);
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index b8978d4af1b7..c11cdd08ec57 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -2674,7 +2674,7 @@ static int skge_down(struct net_device *dev)
2674 if (netif_msg_ifdown(skge)) 2674 if (netif_msg_ifdown(skge))
2675 printk(KERN_INFO PFX "%s: disabling interface\n", dev->name); 2675 printk(KERN_INFO PFX "%s: disabling interface\n", dev->name);
2676 2676
2677 netif_stop_queue(dev); 2677 netif_tx_disable(dev);
2678 2678
2679 if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC) 2679 if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC)
2680 del_timer_sync(&skge->link_timer); 2680 del_timer_sync(&skge->link_timer);
@@ -2881,7 +2881,6 @@ static void skge_tx_clean(struct net_device *dev)
2881 } 2881 }
2882 2882
2883 skge->tx_ring.to_clean = e; 2883 skge->tx_ring.to_clean = e;
2884 netif_wake_queue(dev);
2885} 2884}
2886 2885
2887static void skge_tx_timeout(struct net_device *dev) 2886static void skge_tx_timeout(struct net_device *dev)
@@ -2893,6 +2892,7 @@ static void skge_tx_timeout(struct net_device *dev)
2893 2892
2894 skge_write8(skge->hw, Q_ADDR(txqaddr[skge->port], Q_CSR), CSR_STOP); 2893 skge_write8(skge->hw, Q_ADDR(txqaddr[skge->port], Q_CSR), CSR_STOP);
2895 skge_tx_clean(dev); 2894 skge_tx_clean(dev);
2895 netif_wake_queue(dev);
2896} 2896}
2897 2897
2898static int skge_change_mtu(struct net_device *dev, int new_mtu) 2898static int skge_change_mtu(struct net_device *dev, int new_mtu)
diff --git a/drivers/net/sun3_82586.c b/drivers/net/sun3_82586.c
index e0d84772771c..a39c0b9ba8b6 100644
--- a/drivers/net/sun3_82586.c
+++ b/drivers/net/sun3_82586.c
@@ -331,6 +331,18 @@ out:
331 return ERR_PTR(err); 331 return ERR_PTR(err);
332} 332}
333 333
334static const struct net_device_ops sun3_82586_netdev_ops = {
335 .ndo_open = sun3_82586_open,
336 .ndo_stop = sun3_82586_close,
337 .ndo_start_xmit = sun3_82586_send_packet,
338 .ndo_set_multicast_list = set_multicast_list,
339 .ndo_tx_timeout = sun3_82586_timeout,
340 .ndo_get_stats = sun3_82586_get_stats,
341 .ndo_validate_addr = eth_validate_addr,
342 .ndo_set_mac_address = eth_mac_addr,
343 .ndo_change_mtu = eth_change_mtu,
344};
345
334static int __init sun3_82586_probe1(struct net_device *dev,int ioaddr) 346static int __init sun3_82586_probe1(struct net_device *dev,int ioaddr)
335{ 347{
336 int i, size, retval; 348 int i, size, retval;
@@ -381,13 +393,8 @@ static int __init sun3_82586_probe1(struct net_device *dev,int ioaddr)
381 393
382 printk("Memaddr: 0x%lx, Memsize: %d, IRQ %d\n",dev->mem_start,size, dev->irq); 394 printk("Memaddr: 0x%lx, Memsize: %d, IRQ %d\n",dev->mem_start,size, dev->irq);
383 395
384 dev->open = sun3_82586_open; 396 dev->netdev_ops = &sun3_82586_netdev_ops;
385 dev->stop = sun3_82586_close;
386 dev->get_stats = sun3_82586_get_stats;
387 dev->tx_timeout = sun3_82586_timeout;
388 dev->watchdog_timeo = HZ/20; 397 dev->watchdog_timeo = HZ/20;
389 dev->hard_start_xmit = sun3_82586_send_packet;
390 dev->set_multicast_list = set_multicast_list;
391 398
392 dev->if_port = 0; 399 dev->if_port = 0;
393 return 0; 400 return 0;
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index d91e95b237b7..0ce2db6ce2bf 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -862,6 +862,22 @@ static int __devinit tc35815_init_dev_addr(struct net_device *dev)
862 return 0; 862 return 0;
863} 863}
864 864
865static const struct net_device_ops tc35815_netdev_ops = {
866 .ndo_open = tc35815_open,
867 .ndo_stop = tc35815_close,
868 .ndo_start_xmit = tc35815_send_packet,
869 .ndo_get_stats = tc35815_get_stats,
870 .ndo_set_multicast_list = tc35815_set_multicast_list,
871 .ndo_tx_timeout = tc35815_tx_timeout,
872 .ndo_do_ioctl = tc35815_ioctl,
873 .ndo_validate_addr = eth_validate_addr,
874 .ndo_change_mtu = eth_change_mtu,
875 .ndo_set_mac_address = eth_mac_addr,
876#ifdef CONFIG_NET_POLL_CONTROLLER
877 .ndo_poll_controller = tc35815_poll_controller,
878#endif
879};
880
865static int __devinit tc35815_init_one(struct pci_dev *pdev, 881static int __devinit tc35815_init_one(struct pci_dev *pdev,
866 const struct pci_device_id *ent) 882 const struct pci_device_id *ent)
867{ 883{
@@ -904,21 +920,12 @@ static int __devinit tc35815_init_one(struct pci_dev *pdev,
904 ioaddr = pcim_iomap_table(pdev)[1]; 920 ioaddr = pcim_iomap_table(pdev)[1];
905 921
906 /* Initialize the device structure. */ 922 /* Initialize the device structure. */
907 dev->open = tc35815_open; 923 dev->netdev_ops = &tc35815_netdev_ops;
908 dev->hard_start_xmit = tc35815_send_packet;
909 dev->stop = tc35815_close;
910 dev->get_stats = tc35815_get_stats;
911 dev->set_multicast_list = tc35815_set_multicast_list;
912 dev->do_ioctl = tc35815_ioctl;
913 dev->ethtool_ops = &tc35815_ethtool_ops; 924 dev->ethtool_ops = &tc35815_ethtool_ops;
914 dev->tx_timeout = tc35815_tx_timeout;
915 dev->watchdog_timeo = TC35815_TX_TIMEOUT; 925 dev->watchdog_timeo = TC35815_TX_TIMEOUT;
916#ifdef TC35815_NAPI 926#ifdef TC35815_NAPI
917 netif_napi_add(dev, &lp->napi, tc35815_poll, NAPI_WEIGHT); 927 netif_napi_add(dev, &lp->napi, tc35815_poll, NAPI_WEIGHT);
918#endif 928#endif
919#ifdef CONFIG_NET_POLL_CONTROLLER
920 dev->poll_controller = tc35815_poll_controller;
921#endif
922 929
923 dev->irq = pdev->irq; 930 dev->irq = pdev->irq;
924 dev->base_addr = (unsigned long)ioaddr; 931 dev->base_addr = (unsigned long)ioaddr;
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 6a736dda3ee2..201be425643a 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -2190,7 +2190,14 @@ static int tg3_nvram_read_using_eeprom(struct tg3 *tp,
2190 if (!(tmp & EEPROM_ADDR_COMPLETE)) 2190 if (!(tmp & EEPROM_ADDR_COMPLETE))
2191 return -EBUSY; 2191 return -EBUSY;
2192 2192
2193 *val = tr32(GRC_EEPROM_DATA); 2193 tmp = tr32(GRC_EEPROM_DATA);
2194
2195 /*
2196 * The data will always be opposite the native endian
2197 * format. Perform a blind byteswap to compensate.
2198 */
2199 *val = swab32(tmp);
2200
2194 return 0; 2201 return 0;
2195} 2202}
2196 2203
@@ -10663,7 +10670,13 @@ static int tg3_nvram_write_block_using_eeprom(struct tg3 *tp,
10663 10670
10664 memcpy(&data, buf + i, 4); 10671 memcpy(&data, buf + i, 4);
10665 10672
10666 tw32(GRC_EEPROM_DATA, be32_to_cpu(data)); 10673 /*
10674 * The SEEPROM interface expects the data to always be opposite
10675 * the native endian format. We accomplish this by reversing
10676 * all the operations that would have been performed on the
10677 * data from a call to tg3_nvram_read_be32().
10678 */
10679 tw32(GRC_EEPROM_DATA, swab32(be32_to_cpu(data)));
10667 10680
10668 val = tr32(GRC_EEPROM_ADDR); 10681 val = tr32(GRC_EEPROM_ADDR);
10669 tw32(GRC_EEPROM_ADDR, val | EEPROM_ADDR_COMPLETE); 10682 tw32(GRC_EEPROM_ADDR, val | EEPROM_ADDR_COMPLETE);
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c
index bb43e7fb2a50..0f78f99f9b20 100644
--- a/drivers/net/tsi108_eth.c
+++ b/drivers/net/tsi108_eth.c
@@ -1561,6 +1561,18 @@ static const struct ethtool_ops tsi108_ethtool_ops = {
1561 .set_settings = tsi108_set_settings, 1561 .set_settings = tsi108_set_settings,
1562}; 1562};
1563 1563
1564static const struct net_device_ops tsi108_netdev_ops = {
1565 .ndo_open = tsi108_open,
1566 .ndo_stop = tsi108_close,
1567 .ndo_start_xmit = tsi108_send_packet,
1568 .ndo_set_multicast_list = tsi108_set_rx_mode,
1569 .ndo_get_stats = tsi108_get_stats,
1570 .ndo_do_ioctl = tsi108_do_ioctl,
1571 .ndo_set_mac_address = tsi108_set_mac,
1572 .ndo_validate_addr = eth_validate_addr,
1573 .ndo_change_mtu = eth_change_mtu,
1574};
1575
1564static int 1576static int
1565tsi108_init_one(struct platform_device *pdev) 1577tsi108_init_one(struct platform_device *pdev)
1566{ 1578{
@@ -1616,14 +1628,8 @@ tsi108_init_one(struct platform_device *pdev)
1616 data->phy_type = einfo->phy_type; 1628 data->phy_type = einfo->phy_type;
1617 data->irq_num = einfo->irq_num; 1629 data->irq_num = einfo->irq_num;
1618 data->id = pdev->id; 1630 data->id = pdev->id;
1619 dev->open = tsi108_open;
1620 dev->stop = tsi108_close;
1621 dev->hard_start_xmit = tsi108_send_packet;
1622 dev->set_mac_address = tsi108_set_mac;
1623 dev->set_multicast_list = tsi108_set_rx_mode;
1624 dev->get_stats = tsi108_get_stats;
1625 netif_napi_add(dev, &data->napi, tsi108_poll, 64); 1631 netif_napi_add(dev, &data->napi, tsi108_poll, 64);
1626 dev->do_ioctl = tsi108_do_ioctl; 1632 dev->netdev_ops = &tsi108_netdev_ops;
1627 dev->ethtool_ops = &tsi108_ethtool_ops; 1633 dev->ethtool_ops = &tsi108_ethtool_ops;
1628 1634
1629 /* Apparently, the Linux networking code won't use scatter-gather 1635 /* Apparently, the Linux networking code won't use scatter-gather
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index a1b0697340ba..735bf41c654a 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -93,7 +93,6 @@ struct tun_file {
93 atomic_t count; 93 atomic_t count;
94 struct tun_struct *tun; 94 struct tun_struct *tun;
95 struct net *net; 95 struct net *net;
96 wait_queue_head_t read_wait;
97}; 96};
98 97
99struct tun_sock; 98struct tun_sock;
@@ -156,6 +155,7 @@ static int tun_attach(struct tun_struct *tun, struct file *file)
156 tfile->tun = tun; 155 tfile->tun = tun;
157 tun->tfile = tfile; 156 tun->tfile = tfile;
158 dev_hold(tun->dev); 157 dev_hold(tun->dev);
158 sock_hold(tun->sk);
159 atomic_inc(&tfile->count); 159 atomic_inc(&tfile->count);
160 160
161out: 161out:
@@ -165,11 +165,8 @@ out:
165 165
166static void __tun_detach(struct tun_struct *tun) 166static void __tun_detach(struct tun_struct *tun)
167{ 167{
168 struct tun_file *tfile = tun->tfile;
169
170 /* Detach from net device */ 168 /* Detach from net device */
171 netif_tx_lock_bh(tun->dev); 169 netif_tx_lock_bh(tun->dev);
172 tfile->tun = NULL;
173 tun->tfile = NULL; 170 tun->tfile = NULL;
174 netif_tx_unlock_bh(tun->dev); 171 netif_tx_unlock_bh(tun->dev);
175 172
@@ -333,12 +330,19 @@ static void tun_net_uninit(struct net_device *dev)
333 /* Inform the methods they need to stop using the dev. 330 /* Inform the methods they need to stop using the dev.
334 */ 331 */
335 if (tfile) { 332 if (tfile) {
336 wake_up_all(&tfile->read_wait); 333 wake_up_all(&tun->socket.wait);
337 if (atomic_dec_and_test(&tfile->count)) 334 if (atomic_dec_and_test(&tfile->count))
338 __tun_detach(tun); 335 __tun_detach(tun);
339 } 336 }
340} 337}
341 338
339static void tun_free_netdev(struct net_device *dev)
340{
341 struct tun_struct *tun = netdev_priv(dev);
342
343 sock_put(tun->sk);
344}
345
342/* Net device open. */ 346/* Net device open. */
343static int tun_net_open(struct net_device *dev) 347static int tun_net_open(struct net_device *dev)
344{ 348{
@@ -393,7 +397,7 @@ static int tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
393 /* Notify and wake up reader process */ 397 /* Notify and wake up reader process */
394 if (tun->flags & TUN_FASYNC) 398 if (tun->flags & TUN_FASYNC)
395 kill_fasync(&tun->fasync, SIGIO, POLL_IN); 399 kill_fasync(&tun->fasync, SIGIO, POLL_IN);
396 wake_up_interruptible(&tun->tfile->read_wait); 400 wake_up_interruptible(&tun->socket.wait);
397 return 0; 401 return 0;
398 402
399drop: 403drop:
@@ -490,7 +494,7 @@ static unsigned int tun_chr_poll(struct file *file, poll_table * wait)
490 494
491 DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name); 495 DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name);
492 496
493 poll_wait(file, &tfile->read_wait, wait); 497 poll_wait(file, &tun->socket.wait, wait);
494 498
495 if (!skb_queue_empty(&tun->readq)) 499 if (!skb_queue_empty(&tun->readq))
496 mask |= POLLIN | POLLRDNORM; 500 mask |= POLLIN | POLLRDNORM;
@@ -518,7 +522,7 @@ static inline struct sk_buff *tun_alloc_skb(struct tun_struct *tun,
518 int err; 522 int err;
519 523
520 /* Under a page? Don't bother with paged skb. */ 524 /* Under a page? Don't bother with paged skb. */
521 if (prepad + len < PAGE_SIZE) 525 if (prepad + len < PAGE_SIZE || !linear)
522 linear = len; 526 linear = len;
523 527
524 skb = sock_alloc_send_pskb(sk, prepad + linear, len - linear, noblock, 528 skb = sock_alloc_send_pskb(sk, prepad + linear, len - linear, noblock,
@@ -565,7 +569,8 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun,
565 569
566 if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) { 570 if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) {
567 align = NET_IP_ALIGN; 571 align = NET_IP_ALIGN;
568 if (unlikely(len < ETH_HLEN)) 572 if (unlikely(len < ETH_HLEN ||
573 (gso.hdr_len && gso.hdr_len < ETH_HLEN)))
569 return -EINVAL; 574 return -EINVAL;
570 } 575 }
571 576
@@ -762,7 +767,7 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
762 goto out; 767 goto out;
763 } 768 }
764 769
765 add_wait_queue(&tfile->read_wait, &wait); 770 add_wait_queue(&tun->socket.wait, &wait);
766 while (len) { 771 while (len) {
767 current->state = TASK_INTERRUPTIBLE; 772 current->state = TASK_INTERRUPTIBLE;
768 773
@@ -793,7 +798,7 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
793 } 798 }
794 799
795 current->state = TASK_RUNNING; 800 current->state = TASK_RUNNING;
796 remove_wait_queue(&tfile->read_wait, &wait); 801 remove_wait_queue(&tun->socket.wait, &wait);
797 802
798out: 803out:
799 tun_put(tun); 804 tun_put(tun);
@@ -810,7 +815,7 @@ static void tun_setup(struct net_device *dev)
810 tun->group = -1; 815 tun->group = -1;
811 816
812 dev->ethtool_ops = &tun_ethtool_ops; 817 dev->ethtool_ops = &tun_ethtool_ops;
813 dev->destructor = free_netdev; 818 dev->destructor = tun_free_netdev;
814} 819}
815 820
816/* Trivial set of netlink ops to allow deleting tun or tap 821/* Trivial set of netlink ops to allow deleting tun or tap
@@ -847,7 +852,7 @@ static void tun_sock_write_space(struct sock *sk)
847 852
848static void tun_sock_destruct(struct sock *sk) 853static void tun_sock_destruct(struct sock *sk)
849{ 854{
850 dev_put(container_of(sk, struct tun_sock, sk)->tun->dev); 855 free_netdev(container_of(sk, struct tun_sock, sk)->tun->dev);
851} 856}
852 857
853static struct proto tun_proto = { 858static struct proto tun_proto = {
@@ -861,7 +866,6 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
861 struct sock *sk; 866 struct sock *sk;
862 struct tun_struct *tun; 867 struct tun_struct *tun;
863 struct net_device *dev; 868 struct net_device *dev;
864 struct tun_file *tfile = file->private_data;
865 int err; 869 int err;
866 870
867 dev = __dev_get_by_name(net, ifr->ifr_name); 871 dev = __dev_get_by_name(net, ifr->ifr_name);
@@ -919,13 +923,10 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
919 if (!sk) 923 if (!sk)
920 goto err_free_dev; 924 goto err_free_dev;
921 925
922 /* This ref count is for tun->sk. */ 926 init_waitqueue_head(&tun->socket.wait);
923 dev_hold(dev);
924 sock_init_data(&tun->socket, sk); 927 sock_init_data(&tun->socket, sk);
925 sk->sk_write_space = tun_sock_write_space; 928 sk->sk_write_space = tun_sock_write_space;
926 sk->sk_destruct = tun_sock_destruct;
927 sk->sk_sndbuf = INT_MAX; 929 sk->sk_sndbuf = INT_MAX;
928 sk->sk_sleep = &tfile->read_wait;
929 930
930 tun->sk = sk; 931 tun->sk = sk;
931 container_of(sk, struct tun_sock, sk)->tun = tun; 932 container_of(sk, struct tun_sock, sk)->tun = tun;
@@ -941,11 +942,13 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
941 err = -EINVAL; 942 err = -EINVAL;
942 err = register_netdevice(tun->dev); 943 err = register_netdevice(tun->dev);
943 if (err < 0) 944 if (err < 0)
944 goto err_free_dev; 945 goto err_free_sk;
946
947 sk->sk_destruct = tun_sock_destruct;
945 948
946 err = tun_attach(tun, file); 949 err = tun_attach(tun, file);
947 if (err < 0) 950 if (err < 0)
948 goto err_free_dev; 951 goto failed;
949 } 952 }
950 953
951 DBG(KERN_INFO "%s: tun_set_iff\n", tun->dev->name); 954 DBG(KERN_INFO "%s: tun_set_iff\n", tun->dev->name);
@@ -1265,7 +1268,6 @@ static int tun_chr_open(struct inode *inode, struct file * file)
1265 atomic_set(&tfile->count, 0); 1268 atomic_set(&tfile->count, 0);
1266 tfile->tun = NULL; 1269 tfile->tun = NULL;
1267 tfile->net = get_net(current->nsproxy->net_ns); 1270 tfile->net = get_net(current->nsproxy->net_ns);
1268 init_waitqueue_head(&tfile->read_wait);
1269 file->private_data = tfile; 1271 file->private_data = tfile;
1270 return 0; 1272 return 0;
1271} 1273}
@@ -1283,14 +1285,16 @@ static int tun_chr_close(struct inode *inode, struct file *file)
1283 __tun_detach(tun); 1285 __tun_detach(tun);
1284 1286
1285 /* If desireable, unregister the netdevice. */ 1287 /* If desireable, unregister the netdevice. */
1286 if (!(tun->flags & TUN_PERSIST)) { 1288 if (!(tun->flags & TUN_PERSIST))
1287 sock_put(tun->sk);
1288 unregister_netdevice(tun->dev); 1289 unregister_netdevice(tun->dev);
1289 }
1290 1290
1291 rtnl_unlock(); 1291 rtnl_unlock();
1292 } 1292 }
1293 1293
1294 tun = tfile->tun;
1295 if (tun)
1296 sock_put(tun->sk);
1297
1294 put_net(tfile->net); 1298 put_net(tfile->net);
1295 kfree(tfile); 1299 kfree(tfile);
1296 1300
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index d3f39e86eb95..44f8392da117 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1394,7 +1394,8 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
1394 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) || 1394 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
1395 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) || 1395 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) ||
1396 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { 1396 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
1397 upsmr |= UCC_GETH_UPSMR_RPM; 1397 if (ugeth->phy_interface != PHY_INTERFACE_MODE_RMII)
1398 upsmr |= UCC_GETH_UPSMR_RPM;
1398 switch (ugeth->max_speed) { 1399 switch (ugeth->max_speed) {
1399 case SPEED_10: 1400 case SPEED_10:
1400 upsmr |= UCC_GETH_UPSMR_R10M; 1401 upsmr |= UCC_GETH_UPSMR_R10M;
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 8ee21030e9ac..dfc6cf765fbd 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -180,6 +180,20 @@ config USB_NET_CDCETHER
180 IEEE 802 "local assignment" bit is set in the address, a "usbX" 180 IEEE 802 "local assignment" bit is set in the address, a "usbX"
181 name is used instead. 181 name is used instead.
182 182
183config USB_NET_CDC_EEM
184 tristate "CDC EEM support"
185 depends on USB_USBNET && EXPERIMENTAL
186 help
187 This option supports devices conforming to the Communication Device
188 Class (CDC) Ethernet Emulation Model, a specification that's easy to
189 implement in device firmware. The CDC EEM specifications are available
190 from <http://www.usb.org/>.
191
192 This driver creates an interface named "ethX", where X depends on
193 what other networking devices you have in use. However, if the
194 IEEE 802 "local assignment" bit is set in the address, a "usbX"
195 name is used instead.
196
183config USB_NET_DM9601 197config USB_NET_DM9601
184 tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices" 198 tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices"
185 depends on USB_USBNET 199 depends on USB_USBNET
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index 88a87eeb376a..c8aef62cf2b7 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_USB_RTL8150) += rtl8150.o
9obj-$(CONFIG_USB_HSO) += hso.o 9obj-$(CONFIG_USB_HSO) += hso.o
10obj-$(CONFIG_USB_NET_AX8817X) += asix.o 10obj-$(CONFIG_USB_NET_AX8817X) += asix.o
11obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o 11obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o
12obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o
12obj-$(CONFIG_USB_NET_DM9601) += dm9601.o 13obj-$(CONFIG_USB_NET_DM9601) += dm9601.o
13obj-$(CONFIG_USB_NET_SMSC95XX) += smsc95xx.o 14obj-$(CONFIG_USB_NET_SMSC95XX) += smsc95xx.o
14obj-$(CONFIG_USB_NET_GL620A) += gl620a.o 15obj-$(CONFIG_USB_NET_GL620A) += gl620a.o
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
new file mode 100644
index 000000000000..80e01778dd3b
--- /dev/null
+++ b/drivers/net/usb/cdc_eem.c
@@ -0,0 +1,381 @@
1/*
2 * USB CDC EEM network interface driver
3 * Copyright (C) 2009 Oberthur Technologies
4 * by Omar Laazimani, Olivier Condemine
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/module.h>
22#include <linux/init.h>
23#include <linux/netdevice.h>
24#include <linux/etherdevice.h>
25#include <linux/ctype.h>
26#include <linux/ethtool.h>
27#include <linux/workqueue.h>
28#include <linux/mii.h>
29#include <linux/usb.h>
30#include <linux/crc32.h>
31#include <linux/usb/cdc.h>
32#include <linux/usb/usbnet.h>
33
34
35/*
36 * This driver is an implementation of the CDC "Ethernet Emulation
37 * Model" (EEM) specification, which encapsulates Ethernet frames
38 * for transport over USB using a simpler USB device model than the
39 * previous CDC "Ethernet Control Model" (ECM, or "CDC Ethernet").
40 *
41 * For details, see www.usb.org/developers/devclass_docs/CDC_EEM10.pdf
42 *
43 * This version has been tested with GIGAntIC WuaoW SIM Smart Card on 2.6.24,
44 * 2.6.27 and 2.6.30rc2 kernel.
45 * It has also been validated on Openmoko Om 2008.12 (based on 2.6.24 kernel).
46 * build on 23-April-2009
47 */
48
49#define EEM_HEAD 2 /* 2 byte header */
50
51/*-------------------------------------------------------------------------*/
52
53static void eem_linkcmd_complete(struct urb *urb)
54{
55 dev_kfree_skb(urb->context);
56 usb_free_urb(urb);
57}
58
59static void eem_linkcmd(struct usbnet *dev, struct sk_buff *skb)
60{
61 struct urb *urb;
62 int status;
63
64 urb = usb_alloc_urb(0, GFP_ATOMIC);
65 if (!urb)
66 goto fail;
67
68 usb_fill_bulk_urb(urb, dev->udev, dev->out,
69 skb->data, skb->len, eem_linkcmd_complete, skb);
70
71 status = usb_submit_urb(urb, GFP_ATOMIC);
72 if (status) {
73 usb_free_urb(urb);
74fail:
75 dev_kfree_skb(skb);
76 devwarn(dev, "link cmd failure\n");
77 return;
78 }
79}
80
81static int eem_bind(struct usbnet *dev, struct usb_interface *intf)
82{
83 int status = 0;
84
85 status = usbnet_get_endpoints(dev, intf);
86 if (status < 0) {
87 usb_set_intfdata(intf, NULL);
88 usb_driver_release_interface(driver_of(intf), intf);
89 return status;
90 }
91
92 /* no jumbogram (16K) support for now */
93
94 dev->net->hard_header_len += EEM_HEAD + ETH_FCS_LEN;
95
96 return 0;
97}
98
99/*
100 * EEM permits packing multiple Ethernet frames into USB transfers
101 * (a "bundle"), but for TX we don't try to do that.
102 */
103static struct sk_buff *eem_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
104 gfp_t flags)
105{
106 struct sk_buff *skb2 = NULL;
107 u16 len = skb->len;
108 u32 crc = 0;
109 int padlen = 0;
110
111 /* When ((len + EEM_HEAD + ETH_FCS_LEN) % dev->maxpacket) is
112 * zero, stick two bytes of zero length EEM packet on the end.
113 * Else the framework would add invalid single byte padding,
114 * since it can't know whether ZLPs will be handled right by
115 * all the relevant hardware and software.
116 */
117 if (!((len + EEM_HEAD + ETH_FCS_LEN) % dev->maxpacket))
118 padlen += 2;
119
120 if (!skb_cloned(skb)) {
121 int headroom = skb_headroom(skb);
122 int tailroom = skb_tailroom(skb);
123
124 if ((tailroom >= ETH_FCS_LEN + padlen)
125 && (headroom >= EEM_HEAD))
126 goto done;
127
128 if ((headroom + tailroom)
129 > (EEM_HEAD + ETH_FCS_LEN + padlen)) {
130 skb->data = memmove(skb->head +
131 EEM_HEAD,
132 skb->data,
133 skb->len);
134 skb_set_tail_pointer(skb, len);
135 goto done;
136 }
137 }
138
139 skb2 = skb_copy_expand(skb, EEM_HEAD, ETH_FCS_LEN + padlen, flags);
140 if (!skb2)
141 return NULL;
142
143 dev_kfree_skb_any(skb);
144 skb = skb2;
145
146done:
147 /* we don't use the "no Ethernet CRC" option */
148 crc = crc32_le(~0, skb->data, skb->len);
149 crc = ~crc;
150
151 put_unaligned_le32(crc, skb_put(skb, 4));
152
153 /* EEM packet header format:
154 * b0..13: length of ethernet frame
155 * b14: bmCRC (1 == valid Ethernet CRC)
156 * b15: bmType (0 == data)
157 */
158 len = skb->len;
159 put_unaligned_le16(BIT(14) | len, skb_push(skb, 2));
160
161 /* Bundle a zero length EEM packet if needed */
162 if (padlen)
163 put_unaligned_le16(0, skb_put(skb, 2));
164
165 return skb;
166}
167
168static int eem_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
169{
170 /*
171 * Our task here is to strip off framing, leaving skb with one
172 * data frame for the usbnet framework code to process. But we
173 * may have received multiple EEM payloads, or command payloads.
174 * So we must process _everything_ as if it's a header, except
175 * maybe the last data payload
176 *
177 * REVISIT the framework needs updating so that when we consume
178 * all payloads (the last or only message was a command, or a
179 * zero length EEM packet) that is not accounted as an rx_error.
180 */
181 do {
182 struct sk_buff *skb2 = NULL;
183 u16 header;
184 u16 len = 0;
185
186 /* incomplete EEM header? */
187 if (skb->len < EEM_HEAD)
188 return 0;
189
190 /*
191 * EEM packet header format:
192 * b0..14: EEM type dependant (Data or Command)
193 * b15: bmType
194 */
195 header = get_unaligned_le16(skb->data);
196 skb_pull(skb, EEM_HEAD);
197
198 /*
199 * The bmType bit helps to denote when EEM
200 * packet is data or command :
201 * bmType = 0 : EEM data payload
202 * bmType = 1 : EEM (link) command
203 */
204 if (header & BIT(15)) {
205 u16 bmEEMCmd;
206
207 /*
208 * EEM (link) command packet:
209 * b0..10: bmEEMCmdParam
210 * b11..13: bmEEMCmd
211 * b14: bmReserved (must be 0)
212 * b15: 1 (EEM command)
213 */
214 if (header & BIT(14)) {
215 devdbg(dev, "reserved command %04x\n", header);
216 continue;
217 }
218
219 bmEEMCmd = (header >> 11) & 0x7;
220 switch (bmEEMCmd) {
221
222 /* Responding to echo requests is mandatory. */
223 case 0: /* Echo command */
224 len = header & 0x7FF;
225
226 /* bogus command? */
227 if (skb->len < len)
228 return 0;
229
230 skb2 = skb_clone(skb, GFP_ATOMIC);
231 if (unlikely(!skb2))
232 goto next;
233 skb_trim(skb2, len);
234 put_unaligned_le16(BIT(15) | (1 << 11) | len,
235 skb_push(skb2, 2));
236 eem_linkcmd(dev, skb2);
237 break;
238
239 /*
240 * Host may choose to ignore hints.
241 * - suspend: peripheral ready to suspend
242 * - response: suggest N millisec polling
243 * - response complete: suggest N sec polling
244 */
245 case 2: /* Suspend hint */
246 case 3: /* Response hint */
247 case 4: /* Response complete hint */
248 continue;
249
250 /*
251 * Hosts should never receive host-to-peripheral
252 * or reserved command codes; or responses to an
253 * echo command we didn't send.
254 */
255 case 1: /* Echo response */
256 case 5: /* Tickle */
257 default: /* reserved */
258 devwarn(dev, "unexpected link command %d\n",
259 bmEEMCmd);
260 continue;
261 }
262
263 } else {
264 u32 crc, crc2;
265 int is_last;
266
267 /* zero length EEM packet? */
268 if (header == 0)
269 continue;
270
271 /*
272 * EEM data packet header :
273 * b0..13: length of ethernet frame
274 * b14: bmCRC
275 * b15: 0 (EEM data)
276 */
277 len = header & 0x3FFF;
278
279 /* bogus EEM payload? */
280 if (skb->len < len)
281 return 0;
282
283 /* bogus ethernet frame? */
284 if (len < (ETH_HLEN + ETH_FCS_LEN))
285 goto next;
286
287 /*
288 * Treat the last payload differently: framework
289 * code expects our "fixup" to have stripped off
290 * headers, so "skb" is a data packet (or error).
291 * Else if it's not the last payload, keep "skb"
292 * for further processing.
293 */
294 is_last = (len == skb->len);
295 if (is_last)
296 skb2 = skb;
297 else {
298 skb2 = skb_clone(skb, GFP_ATOMIC);
299 if (unlikely(!skb2))
300 return 0;
301 }
302
303 crc = get_unaligned_le32(skb2->data
304 + len - ETH_FCS_LEN);
305 skb_trim(skb2, len - ETH_FCS_LEN);
306
307 /*
308 * The bmCRC helps to denote when the CRC field in
309 * the Ethernet frame contains a calculated CRC:
310 * bmCRC = 1 : CRC is calculated
311 * bmCRC = 0 : CRC = 0xDEADBEEF
312 */
313 if (header & BIT(14))
314 crc2 = ~crc32_le(~0, skb2->data, len);
315 else
316 crc2 = 0xdeadbeef;
317
318 if (is_last)
319 return crc == crc2;
320
321 if (unlikely(crc != crc2)) {
322 dev->stats.rx_errors++;
323 dev_kfree_skb_any(skb2);
324 } else
325 usbnet_skb_return(dev, skb2);
326 }
327
328next:
329 skb_pull(skb, len);
330 } while (skb->len);
331
332 return 1;
333}
334
335static const struct driver_info eem_info = {
336 .description = "CDC EEM Device",
337 .flags = FLAG_ETHER,
338 .bind = eem_bind,
339 .rx_fixup = eem_rx_fixup,
340 .tx_fixup = eem_tx_fixup,
341};
342
343/*-------------------------------------------------------------------------*/
344
345static const struct usb_device_id products[] = {
346{
347 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_EEM,
348 USB_CDC_PROTO_EEM),
349 .driver_info = (unsigned long) &eem_info,
350},
351{
352 /* EMPTY == end of list */
353},
354};
355MODULE_DEVICE_TABLE(usb, products);
356
357static struct usb_driver eem_driver = {
358 .name = "cdc_eem",
359 .id_table = products,
360 .probe = usbnet_probe,
361 .disconnect = usbnet_disconnect,
362 .suspend = usbnet_suspend,
363 .resume = usbnet_resume,
364};
365
366
367static int __init eem_init(void)
368{
369 return usb_register(&eem_driver);
370}
371module_init(eem_init);
372
373static void __exit eem_exit(void)
374{
375 usb_deregister(&eem_driver);
376}
377module_exit(eem_exit);
378
379MODULE_AUTHOR("Omar Laazimani <omar.oberthur@gmail.com>");
380MODULE_DESCRIPTION("USB CDC EEM");
381MODULE_LICENSE("GPL");
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index a8228d87c8cf..2138535f2339 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -899,6 +899,7 @@ static int pegasus_start_xmit(struct sk_buff *skb, struct net_device *net)
899 /* cleanup should already have been scheduled */ 899 /* cleanup should already have been scheduled */
900 break; 900 break;
901 case -ENODEV: /* disconnect() upcoming */ 901 case -ENODEV: /* disconnect() upcoming */
902 case -EPERM:
902 netif_device_detach(pegasus->net); 903 netif_device_detach(pegasus->net);
903 break; 904 break;
904 default: 905 default:
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index dc1665326592..5a7283372b53 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -941,6 +941,16 @@ static int smsc95xx_reset(struct usbnet *dev)
941 if (netif_msg_ifup(dev)) 941 if (netif_msg_ifup(dev))
942 devdbg(dev, "ID_REV = 0x%08x", read_buf); 942 devdbg(dev, "ID_REV = 0x%08x", read_buf);
943 943
944 /* Configure GPIO pins as LED outputs */
945 write_buf = LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED |
946 LED_GPIO_CFG_FDX_LED;
947 ret = smsc95xx_write_reg(dev, LED_GPIO_CFG, write_buf);
948 if (ret < 0) {
949 devwarn(dev, "Failed to write LED_GPIO_CFG register, ret=%d",
950 ret);
951 return ret;
952 }
953
944 /* Init Tx */ 954 /* Init Tx */
945 write_buf = 0; 955 write_buf = 0;
946 ret = smsc95xx_write_reg(dev, FLOW, write_buf); 956 ret = smsc95xx_write_reg(dev, FLOW, write_buf);
@@ -1231,6 +1241,11 @@ static const struct usb_device_id products[] = {
1231 USB_DEVICE(0x0424, 0x9500), 1241 USB_DEVICE(0x0424, 0x9500),
1232 .driver_info = (unsigned long) &smsc95xx_info, 1242 .driver_info = (unsigned long) &smsc95xx_info,
1233 }, 1243 },
1244 {
1245 /* SMSC9512/9514 USB Hub & Ethernet Device */
1246 USB_DEVICE(0x0424, 0xec00),
1247 .driver_info = (unsigned long) &smsc95xx_info,
1248 },
1234 { }, /* END */ 1249 { }, /* END */
1235}; 1250};
1236MODULE_DEVICE_TABLE(usb, products); 1251MODULE_DEVICE_TABLE(usb, products);
diff --git a/drivers/net/usb/smsc95xx.h b/drivers/net/usb/smsc95xx.h
index 66b5c84f302e..86bc44977fbd 100644
--- a/drivers/net/usb/smsc95xx.h
+++ b/drivers/net/usb/smsc95xx.h
@@ -99,6 +99,9 @@
99#define PM_CTL_WUPS_MULTI_ (0x00000003) 99#define PM_CTL_WUPS_MULTI_ (0x00000003)
100 100
101#define LED_GPIO_CFG (0x24) 101#define LED_GPIO_CFG (0x24)
102#define LED_GPIO_CFG_SPD_LED (0x01000000)
103#define LED_GPIO_CFG_LNK_LED (0x00100000)
104#define LED_GPIO_CFG_FDX_LED (0x00010000)
102 105
103#define GPIO_CFG (0x28) 106#define GPIO_CFG (0x28)
104 107
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 015db1cece72..8e56fcf0a0e3 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -210,14 +210,11 @@ rx_drop:
210 210
211static struct net_device_stats *veth_get_stats(struct net_device *dev) 211static struct net_device_stats *veth_get_stats(struct net_device *dev)
212{ 212{
213 struct veth_priv *priv; 213 struct veth_priv *priv = netdev_priv(dev);
214 struct net_device_stats *dev_stats; 214 struct net_device_stats *dev_stats = &dev->stats;
215 int cpu; 215 unsigned int cpu;
216 struct veth_net_stats *stats; 216 struct veth_net_stats *stats;
217 217
218 priv = netdev_priv(dev);
219 dev_stats = &dev->stats;
220
221 dev_stats->rx_packets = 0; 218 dev_stats->rx_packets = 0;
222 dev_stats->tx_packets = 0; 219 dev_stats->tx_packets = 0;
223 dev_stats->rx_bytes = 0; 220 dev_stats->rx_bytes = 0;
@@ -225,16 +222,17 @@ static struct net_device_stats *veth_get_stats(struct net_device *dev)
225 dev_stats->tx_dropped = 0; 222 dev_stats->tx_dropped = 0;
226 dev_stats->rx_dropped = 0; 223 dev_stats->rx_dropped = 0;
227 224
228 for_each_online_cpu(cpu) { 225 if (priv->stats)
229 stats = per_cpu_ptr(priv->stats, cpu); 226 for_each_online_cpu(cpu) {
227 stats = per_cpu_ptr(priv->stats, cpu);
230 228
231 dev_stats->rx_packets += stats->rx_packets; 229 dev_stats->rx_packets += stats->rx_packets;
232 dev_stats->tx_packets += stats->tx_packets; 230 dev_stats->tx_packets += stats->tx_packets;
233 dev_stats->rx_bytes += stats->rx_bytes; 231 dev_stats->rx_bytes += stats->rx_bytes;
234 dev_stats->tx_bytes += stats->tx_bytes; 232 dev_stats->tx_bytes += stats->tx_bytes;
235 dev_stats->tx_dropped += stats->tx_dropped; 233 dev_stats->tx_dropped += stats->tx_dropped;
236 dev_stats->rx_dropped += stats->rx_dropped; 234 dev_stats->rx_dropped += stats->rx_dropped;
237 } 235 }
238 236
239 return dev_stats; 237 return dev_stats;
240} 238}
@@ -261,6 +259,8 @@ static int veth_close(struct net_device *dev)
261 netif_carrier_off(dev); 259 netif_carrier_off(dev);
262 netif_carrier_off(priv->peer); 260 netif_carrier_off(priv->peer);
263 261
262 free_percpu(priv->stats);
263 priv->stats = NULL;
264 return 0; 264 return 0;
265} 265}
266 266
@@ -291,15 +291,6 @@ static int veth_dev_init(struct net_device *dev)
291 return 0; 291 return 0;
292} 292}
293 293
294static void veth_dev_free(struct net_device *dev)
295{
296 struct veth_priv *priv;
297
298 priv = netdev_priv(dev);
299 free_percpu(priv->stats);
300 free_netdev(dev);
301}
302
303static const struct net_device_ops veth_netdev_ops = { 294static const struct net_device_ops veth_netdev_ops = {
304 .ndo_init = veth_dev_init, 295 .ndo_init = veth_dev_init,
305 .ndo_open = veth_open, 296 .ndo_open = veth_open,
@@ -317,7 +308,7 @@ static void veth_setup(struct net_device *dev)
317 dev->netdev_ops = &veth_netdev_ops; 308 dev->netdev_ops = &veth_netdev_ops;
318 dev->ethtool_ops = &veth_ethtool_ops; 309 dev->ethtool_ops = &veth_ethtool_ops;
319 dev->features |= NETIF_F_LLTX; 310 dev->features |= NETIF_F_LLTX;
320 dev->destructor = veth_dev_free; 311 dev->destructor = free_netdev;
321} 312}
322 313
323/* 314/*
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index fb53ef872df3..754a4b182c1d 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -377,7 +377,7 @@ static void velocity_print_info(struct velocity_info *vptr);
377static int velocity_open(struct net_device *dev); 377static int velocity_open(struct net_device *dev);
378static int velocity_change_mtu(struct net_device *dev, int mtu); 378static int velocity_change_mtu(struct net_device *dev, int mtu);
379static int velocity_xmit(struct sk_buff *skb, struct net_device *dev); 379static int velocity_xmit(struct sk_buff *skb, struct net_device *dev);
380static int velocity_intr(int irq, void *dev_instance); 380static irqreturn_t velocity_intr(int irq, void *dev_instance);
381static void velocity_set_multi(struct net_device *dev); 381static void velocity_set_multi(struct net_device *dev);
382static struct net_device_stats *velocity_get_stats(struct net_device *dev); 382static struct net_device_stats *velocity_get_stats(struct net_device *dev);
383static int velocity_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 383static int velocity_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
@@ -2215,7 +2215,7 @@ out:
2215 * efficiently as possible. 2215 * efficiently as possible.
2216 */ 2216 */
2217 2217
2218static int velocity_intr(int irq, void *dev_instance) 2218static irqreturn_t velocity_intr(int irq, void *dev_instance)
2219{ 2219{
2220 struct net_device *dev = dev_instance; 2220 struct net_device *dev = dev_instance;
2221 struct velocity_info *vptr = netdev_priv(dev); 2221 struct velocity_info *vptr = netdev_priv(dev);
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 9c82a39497e5..4d1d47953fc6 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -616,10 +616,11 @@ static int virtnet_open(struct net_device *dev)
616static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, 616static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd,
617 struct scatterlist *data, int out, int in) 617 struct scatterlist *data, int out, int in)
618{ 618{
619 struct scatterlist sg[VIRTNET_SEND_COMMAND_SG_MAX + 2]; 619 struct scatterlist *s, sg[VIRTNET_SEND_COMMAND_SG_MAX + 2];
620 struct virtio_net_ctrl_hdr ctrl; 620 struct virtio_net_ctrl_hdr ctrl;
621 virtio_net_ctrl_ack status = ~0; 621 virtio_net_ctrl_ack status = ~0;
622 unsigned int tmp; 622 unsigned int tmp;
623 int i;
623 624
624 if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)) { 625 if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)) {
625 BUG(); /* Caller should know better */ 626 BUG(); /* Caller should know better */
@@ -637,7 +638,8 @@ static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd,
637 sg_init_table(sg, out + in); 638 sg_init_table(sg, out + in);
638 639
639 sg_set_buf(&sg[0], &ctrl, sizeof(ctrl)); 640 sg_set_buf(&sg[0], &ctrl, sizeof(ctrl));
640 memcpy(&sg[1], data, sizeof(struct scatterlist) * (out + in - 2)); 641 for_each_sg(data, s, out + in - 2, i)
642 sg_set_buf(&sg[i + 1], sg_virt(s), s->length);
641 sg_set_buf(&sg[out + in - 1], &status, sizeof(status)); 643 sg_set_buf(&sg[out + in - 1], &status, sizeof(status));
642 644
643 if (vi->cvq->vq_ops->add_buf(vi->cvq, sg, out, in, vi) != 0) 645 if (vi->cvq->vq_ops->add_buf(vi->cvq, sg, out, in, vi) != 0)
@@ -692,7 +694,7 @@ static void virtnet_set_rx_mode(struct net_device *dev)
692 promisc = ((dev->flags & IFF_PROMISC) != 0); 694 promisc = ((dev->flags & IFF_PROMISC) != 0);
693 allmulti = ((dev->flags & IFF_ALLMULTI) != 0); 695 allmulti = ((dev->flags & IFF_ALLMULTI) != 0);
694 696
695 sg_set_buf(sg, &promisc, sizeof(promisc)); 697 sg_init_one(sg, &promisc, sizeof(promisc));
696 698
697 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX, 699 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX,
698 VIRTIO_NET_CTRL_RX_PROMISC, 700 VIRTIO_NET_CTRL_RX_PROMISC,
@@ -700,7 +702,7 @@ static void virtnet_set_rx_mode(struct net_device *dev)
700 dev_warn(&dev->dev, "Failed to %sable promisc mode.\n", 702 dev_warn(&dev->dev, "Failed to %sable promisc mode.\n",
701 promisc ? "en" : "dis"); 703 promisc ? "en" : "dis");
702 704
703 sg_set_buf(sg, &allmulti, sizeof(allmulti)); 705 sg_init_one(sg, &allmulti, sizeof(allmulti));
704 706
705 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX, 707 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX,
706 VIRTIO_NET_CTRL_RX_ALLMULTI, 708 VIRTIO_NET_CTRL_RX_ALLMULTI,
@@ -716,6 +718,8 @@ static void virtnet_set_rx_mode(struct net_device *dev)
716 return; 718 return;
717 } 719 }
718 720
721 sg_init_table(sg, 2);
722
719 /* Store the unicast list and count in the front of the buffer */ 723 /* Store the unicast list and count in the front of the buffer */
720 mac_data->entries = dev->uc_count; 724 mac_data->entries = dev->uc_count;
721 addr = dev->uc_list; 725 addr = dev->uc_list;
@@ -744,24 +748,24 @@ static void virtnet_set_rx_mode(struct net_device *dev)
744 kfree(buf); 748 kfree(buf);
745} 749}
746 750
747static void virnet_vlan_rx_add_vid(struct net_device *dev, u16 vid) 751static void virtnet_vlan_rx_add_vid(struct net_device *dev, u16 vid)
748{ 752{
749 struct virtnet_info *vi = netdev_priv(dev); 753 struct virtnet_info *vi = netdev_priv(dev);
750 struct scatterlist sg; 754 struct scatterlist sg;
751 755
752 sg_set_buf(&sg, &vid, sizeof(vid)); 756 sg_init_one(&sg, &vid, sizeof(vid));
753 757
754 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, 758 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN,
755 VIRTIO_NET_CTRL_VLAN_ADD, &sg, 1, 0)) 759 VIRTIO_NET_CTRL_VLAN_ADD, &sg, 1, 0))
756 dev_warn(&dev->dev, "Failed to add VLAN ID %d.\n", vid); 760 dev_warn(&dev->dev, "Failed to add VLAN ID %d.\n", vid);
757} 761}
758 762
759static void virnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid) 763static void virtnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid)
760{ 764{
761 struct virtnet_info *vi = netdev_priv(dev); 765 struct virtnet_info *vi = netdev_priv(dev);
762 struct scatterlist sg; 766 struct scatterlist sg;
763 767
764 sg_set_buf(&sg, &vid, sizeof(vid)); 768 sg_init_one(&sg, &vid, sizeof(vid));
765 769
766 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, 770 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN,
767 VIRTIO_NET_CTRL_VLAN_DEL, &sg, 1, 0)) 771 VIRTIO_NET_CTRL_VLAN_DEL, &sg, 1, 0))
@@ -794,8 +798,8 @@ static const struct net_device_ops virtnet_netdev = {
794 .ndo_set_mac_address = virtnet_set_mac_address, 798 .ndo_set_mac_address = virtnet_set_mac_address,
795 .ndo_set_rx_mode = virtnet_set_rx_mode, 799 .ndo_set_rx_mode = virtnet_set_rx_mode,
796 .ndo_change_mtu = virtnet_change_mtu, 800 .ndo_change_mtu = virtnet_change_mtu,
797 .ndo_vlan_rx_add_vid = virnet_vlan_rx_add_vid, 801 .ndo_vlan_rx_add_vid = virtnet_vlan_rx_add_vid,
798 .ndo_vlan_rx_kill_vid = virnet_vlan_rx_kill_vid, 802 .ndo_vlan_rx_kill_vid = virtnet_vlan_rx_kill_vid,
799#ifdef CONFIG_NET_POLL_CONTROLLER 803#ifdef CONFIG_NET_POLL_CONTROLLER
800 .ndo_poll_controller = virtnet_netpoll, 804 .ndo_poll_controller = virtnet_netpoll,
801#endif 805#endif
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index f21a6171c691..c36d3a3d655f 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -6713,11 +6713,11 @@ static int airo_set_auth(struct net_device *dev,
6713 local->config.authType = AUTH_ENCRYPT; 6713 local->config.authType = AUTH_ENCRYPT;
6714 } else 6714 } else
6715 return -EINVAL; 6715 return -EINVAL;
6716 break;
6717 6716
6718 /* Commit the changes to flags if needed */ 6717 /* Commit the changes to flags if needed */
6719 if (local->config.authType != currentAuthType) 6718 if (local->config.authType != currentAuthType)
6720 set_bit (FLAG_COMMIT, &local->flags); 6719 set_bit (FLAG_COMMIT, &local->flags);
6720 break;
6721 } 6721 }
6722 6722
6723 case IW_AUTH_WPA_ENABLED: 6723 case IW_AUTH_WPA_ENABLED:
diff --git a/drivers/net/wireless/ar9170/hw.h b/drivers/net/wireless/ar9170/hw.h
index 13091bd9d815..53e250a4278f 100644
--- a/drivers/net/wireless/ar9170/hw.h
+++ b/drivers/net/wireless/ar9170/hw.h
@@ -310,7 +310,7 @@ struct ar9170_tx_control {
310 310
311struct ar9170_rx_head { 311struct ar9170_rx_head {
312 u8 plcp[12]; 312 u8 plcp[12];
313}; 313} __packed;
314 314
315struct ar9170_rx_tail { 315struct ar9170_rx_tail {
316 union { 316 union {
@@ -318,16 +318,16 @@ struct ar9170_rx_tail {
318 u8 rssi_ant0, rssi_ant1, rssi_ant2, 318 u8 rssi_ant0, rssi_ant1, rssi_ant2,
319 rssi_ant0x, rssi_ant1x, rssi_ant2x, 319 rssi_ant0x, rssi_ant1x, rssi_ant2x,
320 rssi_combined; 320 rssi_combined;
321 }; 321 } __packed;
322 u8 rssi[7]; 322 u8 rssi[7];
323 }; 323 } __packed;
324 324
325 u8 evm_stream0[6], evm_stream1[6]; 325 u8 evm_stream0[6], evm_stream1[6];
326 u8 phy_err; 326 u8 phy_err;
327 u8 SAidx, DAidx; 327 u8 SAidx, DAidx;
328 u8 error; 328 u8 error;
329 u8 status; 329 u8 status;
330}; 330} __packed;
331 331
332#define AR9170_ENC_ALG_NONE 0x0 332#define AR9170_ENC_ALG_NONE 0x0
333#define AR9170_ENC_ALG_WEP64 0x1 333#define AR9170_ENC_ALG_WEP64 0x1
diff --git a/drivers/net/wireless/ar9170/usb.c b/drivers/net/wireless/ar9170/usb.c
index ad296840893e..fddda477095c 100644
--- a/drivers/net/wireless/ar9170/usb.c
+++ b/drivers/net/wireless/ar9170/usb.c
@@ -59,6 +59,8 @@ static struct usb_device_id ar9170_usb_ids[] = {
59 { USB_DEVICE(0x0cf3, 0x9170) }, 59 { USB_DEVICE(0x0cf3, 0x9170) },
60 /* Atheros TG121N */ 60 /* Atheros TG121N */
61 { USB_DEVICE(0x0cf3, 0x1001) }, 61 { USB_DEVICE(0x0cf3, 0x1001) },
62 /* Cace Airpcap NX */
63 { USB_DEVICE(0xcace, 0x0300) },
62 /* D-Link DWA 160A */ 64 /* D-Link DWA 160A */
63 { USB_DEVICE(0x07d1, 0x3c10) }, 65 { USB_DEVICE(0x07d1, 0x3c10) },
64 /* Netgear WNDA3100 */ 66 /* Netgear WNDA3100 */
@@ -67,6 +69,8 @@ static struct usb_device_id ar9170_usb_ids[] = {
67 { USB_DEVICE(0x0846, 0x9001) }, 69 { USB_DEVICE(0x0846, 0x9001) },
68 /* Zydas ZD1221 */ 70 /* Zydas ZD1221 */
69 { USB_DEVICE(0x0ace, 0x1221) }, 71 { USB_DEVICE(0x0ace, 0x1221) },
72 /* ZyXEL NWD271N */
73 { USB_DEVICE(0x0586, 0x3417) },
70 /* Z-Com UB81 BG */ 74 /* Z-Com UB81 BG */
71 { USB_DEVICE(0x0cde, 0x0023) }, 75 { USB_DEVICE(0x0cde, 0x0023) },
72 /* Z-Com UB82 ABG */ 76 /* Z-Com UB82 ABG */
@@ -619,6 +623,39 @@ static int ar9170_usb_open(struct ar9170 *ar)
619 return 0; 623 return 0;
620} 624}
621 625
626static int ar9170_usb_init_device(struct ar9170_usb *aru)
627{
628 int err;
629
630 err = ar9170_usb_alloc_rx_irq_urb(aru);
631 if (err)
632 goto err_out;
633
634 err = ar9170_usb_alloc_rx_bulk_urbs(aru);
635 if (err)
636 goto err_unrx;
637
638 err = ar9170_usb_upload_firmware(aru);
639 if (err) {
640 err = ar9170_echo_test(&aru->common, 0x60d43110);
641 if (err) {
642 /* force user invention, by disabling the device */
643 err = usb_driver_set_configuration(aru->udev, -1);
644 dev_err(&aru->udev->dev, "device is in a bad state. "
645 "please reconnect it!\n");
646 goto err_unrx;
647 }
648 }
649
650 return 0;
651
652err_unrx:
653 ar9170_usb_cancel_urbs(aru);
654
655err_out:
656 return err;
657}
658
622static int ar9170_usb_probe(struct usb_interface *intf, 659static int ar9170_usb_probe(struct usb_interface *intf,
623 const struct usb_device_id *id) 660 const struct usb_device_id *id)
624{ 661{
@@ -654,32 +691,16 @@ static int ar9170_usb_probe(struct usb_interface *intf,
654 691
655 err = ar9170_usb_reset(aru); 692 err = ar9170_usb_reset(aru);
656 if (err) 693 if (err)
657 goto err_unlock; 694 goto err_freehw;
658 695
659 err = ar9170_usb_request_firmware(aru); 696 err = ar9170_usb_request_firmware(aru);
660 if (err) 697 if (err)
661 goto err_unlock; 698 goto err_freehw;
662 699
663 err = ar9170_usb_alloc_rx_irq_urb(aru); 700 err = ar9170_usb_init_device(aru);
664 if (err) 701 if (err)
665 goto err_freefw; 702 goto err_freefw;
666 703
667 err = ar9170_usb_alloc_rx_bulk_urbs(aru);
668 if (err)
669 goto err_unrx;
670
671 err = ar9170_usb_upload_firmware(aru);
672 if (err) {
673 err = ar9170_echo_test(&aru->common, 0x60d43110);
674 if (err) {
675 /* force user invention, by disabling the device */
676 err = usb_driver_set_configuration(aru->udev, -1);
677 dev_err(&aru->udev->dev, "device is in a bad state. "
678 "please reconnect it!\n");
679 goto err_unrx;
680 }
681 }
682
683 err = ar9170_usb_open(ar); 704 err = ar9170_usb_open(ar);
684 if (err) 705 if (err)
685 goto err_unrx; 706 goto err_unrx;
@@ -699,7 +720,7 @@ err_freefw:
699 release_firmware(aru->init_values); 720 release_firmware(aru->init_values);
700 release_firmware(aru->firmware); 721 release_firmware(aru->firmware);
701 722
702err_unlock: 723err_freehw:
703 usb_set_intfdata(intf, NULL); 724 usb_set_intfdata(intf, NULL);
704 usb_put_dev(udev); 725 usb_put_dev(udev);
705 ieee80211_free_hw(ar->hw); 726 ieee80211_free_hw(ar->hw);
@@ -726,12 +747,65 @@ static void ar9170_usb_disconnect(struct usb_interface *intf)
726 ieee80211_free_hw(aru->common.hw); 747 ieee80211_free_hw(aru->common.hw);
727} 748}
728 749
750#ifdef CONFIG_PM
751static int ar9170_suspend(struct usb_interface *intf,
752 pm_message_t message)
753{
754 struct ar9170_usb *aru = usb_get_intfdata(intf);
755
756 if (!aru)
757 return -ENODEV;
758
759 aru->common.state = AR9170_IDLE;
760 ar9170_usb_cancel_urbs(aru);
761
762 return 0;
763}
764
765static int ar9170_resume(struct usb_interface *intf)
766{
767 struct ar9170_usb *aru = usb_get_intfdata(intf);
768 int err;
769
770 if (!aru)
771 return -ENODEV;
772
773 usb_unpoison_anchored_urbs(&aru->rx_submitted);
774 usb_unpoison_anchored_urbs(&aru->tx_submitted);
775
776 /*
777 * FIXME: firmware upload will fail on resume.
778 * but this is better than a hang!
779 */
780
781 err = ar9170_usb_init_device(aru);
782 if (err)
783 goto err_unrx;
784
785 err = ar9170_usb_open(&aru->common);
786 if (err)
787 goto err_unrx;
788
789 return 0;
790
791err_unrx:
792 aru->common.state = AR9170_IDLE;
793 ar9170_usb_cancel_urbs(aru);
794
795 return err;
796}
797#endif /* CONFIG_PM */
798
729static struct usb_driver ar9170_driver = { 799static struct usb_driver ar9170_driver = {
730 .name = "ar9170usb", 800 .name = "ar9170usb",
731 .probe = ar9170_usb_probe, 801 .probe = ar9170_usb_probe,
732 .disconnect = ar9170_usb_disconnect, 802 .disconnect = ar9170_usb_disconnect,
733 .id_table = ar9170_usb_ids, 803 .id_table = ar9170_usb_ids,
734 .soft_unbind = 1, 804 .soft_unbind = 1,
805#ifdef CONFIG_PM
806 .suspend = ar9170_suspend,
807 .resume = ar9170_resume,
808#endif /* CONFIG_PM */
735}; 809};
736 810
737static int __init ar9170_init(void) 811static int __init ar9170_init(void)
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
index 0c02f1c2bd94..744f4f4dd3d1 100644
--- a/drivers/net/wireless/at76c50x-usb.c
+++ b/drivers/net/wireless/at76c50x-usb.c
@@ -250,6 +250,8 @@ static struct usb_device_id dev_table[] = {
250 { USB_DEVICE(0x03eb, 0x7617), USB_DEVICE_DATA(BOARD_505A) }, 250 { USB_DEVICE(0x03eb, 0x7617), USB_DEVICE_DATA(BOARD_505A) },
251 /* Siemens Gigaset USB WLAN Adapter 11 */ 251 /* Siemens Gigaset USB WLAN Adapter 11 */
252 { USB_DEVICE(0x1690, 0x0701), USB_DEVICE_DATA(BOARD_505A) }, 252 { USB_DEVICE(0x1690, 0x0701), USB_DEVICE_DATA(BOARD_505A) },
253 /* OQO Model 01+ Internal Wi-Fi */
254 { USB_DEVICE(0x1557, 0x0002), USB_DEVICE_DATA(BOARD_505A) },
253 /* 255 /*
254 * at76c505amx-rfmd 256 * at76c505amx-rfmd
255 */ 257 */
diff --git a/drivers/net/wireless/ath5k/debug.c b/drivers/net/wireless/ath5k/debug.c
index 9770bb3d40f9..4904a07e4b59 100644
--- a/drivers/net/wireless/ath5k/debug.c
+++ b/drivers/net/wireless/ath5k/debug.c
@@ -424,7 +424,7 @@ ath5k_debug_dump_bands(struct ath5k_softc *sc)
424 424
425 for (b = 0; b < IEEE80211_NUM_BANDS; b++) { 425 for (b = 0; b < IEEE80211_NUM_BANDS; b++) {
426 struct ieee80211_supported_band *band = &sc->sbands[b]; 426 struct ieee80211_supported_band *band = &sc->sbands[b];
427 char bname[5]; 427 char bname[6];
428 switch (band->band) { 428 switch (band->band) {
429 case IEEE80211_BAND_2GHZ: 429 case IEEE80211_BAND_2GHZ:
430 strcpy(bname, "2 GHz"); 430 strcpy(bname, "2 GHz");
diff --git a/drivers/net/wireless/ath9k/pci.c b/drivers/net/wireless/ath9k/pci.c
index 6dbc58580abb..168411d322a2 100644
--- a/drivers/net/wireless/ath9k/pci.c
+++ b/drivers/net/wireless/ath9k/pci.c
@@ -93,14 +93,14 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
93 if (pci_enable_device(pdev)) 93 if (pci_enable_device(pdev))
94 return -EIO; 94 return -EIO;
95 95
96 ret = pci_set_dma_mask(pdev, DMA_32BIT_MASK); 96 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
97 97
98 if (ret) { 98 if (ret) {
99 printk(KERN_ERR "ath9k: 32-bit DMA not available\n"); 99 printk(KERN_ERR "ath9k: 32-bit DMA not available\n");
100 goto bad; 100 goto bad;
101 } 101 }
102 102
103 ret = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); 103 ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
104 104
105 if (ret) { 105 if (ret) {
106 printk(KERN_ERR "ath9k: 32-bit DMA consistent " 106 printk(KERN_ERR "ath9k: 32-bit DMA consistent "
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c
index 71cb18d6757d..dd1f30156740 100644
--- a/drivers/net/wireless/ath9k/recv.c
+++ b/drivers/net/wireless/ath9k/recv.c
@@ -493,6 +493,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
493 int hdrlen, padsize, retval; 493 int hdrlen, padsize, retval;
494 bool decrypt_error = false; 494 bool decrypt_error = false;
495 u8 keyix; 495 u8 keyix;
496 __le16 fc;
496 497
497 spin_lock_bh(&sc->rx.rxbuflock); 498 spin_lock_bh(&sc->rx.rxbuflock);
498 499
@@ -606,6 +607,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
606 /* see if any padding is done by the hw and remove it */ 607 /* see if any padding is done by the hw and remove it */
607 hdr = (struct ieee80211_hdr *)skb->data; 608 hdr = (struct ieee80211_hdr *)skb->data;
608 hdrlen = ieee80211_get_hdrlen_from_skb(skb); 609 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
610 fc = hdr->frame_control;
609 611
610 /* The MAC header is padded to have 32-bit boundary if the 612 /* The MAC header is padded to have 32-bit boundary if the
611 * packet payload is non-zero. The general calculation for 613 * packet payload is non-zero. The general calculation for
@@ -690,7 +692,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
690 sc->rx.rxotherant = 0; 692 sc->rx.rxotherant = 0;
691 } 693 }
692 694
693 if (ieee80211_is_beacon(hdr->frame_control) && 695 if (ieee80211_is_beacon(fc) &&
694 (sc->sc_flags & SC_OP_WAIT_FOR_BEACON)) { 696 (sc->sc_flags & SC_OP_WAIT_FOR_BEACON)) {
695 sc->sc_flags &= ~SC_OP_WAIT_FOR_BEACON; 697 sc->sc_flags &= ~SC_OP_WAIT_FOR_BEACON;
696 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_NETWORK_SLEEP); 698 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_NETWORK_SLEEP);
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 857d84148b1d..27eef8fb7107 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -1502,7 +1502,6 @@ static const struct net_device_ops atmel_netdev_ops = {
1502 .ndo_set_mac_address = atmel_set_mac_address, 1502 .ndo_set_mac_address = atmel_set_mac_address,
1503 .ndo_start_xmit = start_tx, 1503 .ndo_start_xmit = start_tx,
1504 .ndo_do_ioctl = atmel_ioctl, 1504 .ndo_do_ioctl = atmel_ioctl,
1505 .ndo_change_mtu = eth_change_mtu,
1506 .ndo_validate_addr = eth_validate_addr, 1505 .ndo_validate_addr = eth_validate_addr,
1507}; 1506};
1508 1507
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index e228c1de6e11..eae680b53052 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -555,11 +555,32 @@ address_error:
555 return 1; 555 return 1;
556} 556}
557 557
558static bool b43_rx_buffer_is_poisoned(struct b43_dmaring *ring, struct sk_buff *skb)
559{
560 unsigned char *f = skb->data + ring->frameoffset;
561
562 return ((f[0] & f[1] & f[2] & f[3] & f[4] & f[5] & f[6] & f[7]) == 0xFF);
563}
564
565static void b43_poison_rx_buffer(struct b43_dmaring *ring, struct sk_buff *skb)
566{
567 struct b43_rxhdr_fw4 *rxhdr;
568 unsigned char *frame;
569
570 /* This poisons the RX buffer to detect DMA failures. */
571
572 rxhdr = (struct b43_rxhdr_fw4 *)(skb->data);
573 rxhdr->frame_len = 0;
574
575 B43_WARN_ON(ring->rx_buffersize < ring->frameoffset + sizeof(struct b43_plcp_hdr6) + 2);
576 frame = skb->data + ring->frameoffset;
577 memset(frame, 0xFF, sizeof(struct b43_plcp_hdr6) + 2 /* padding */);
578}
579
558static int setup_rx_descbuffer(struct b43_dmaring *ring, 580static int setup_rx_descbuffer(struct b43_dmaring *ring,
559 struct b43_dmadesc_generic *desc, 581 struct b43_dmadesc_generic *desc,
560 struct b43_dmadesc_meta *meta, gfp_t gfp_flags) 582 struct b43_dmadesc_meta *meta, gfp_t gfp_flags)
561{ 583{
562 struct b43_rxhdr_fw4 *rxhdr;
563 dma_addr_t dmaaddr; 584 dma_addr_t dmaaddr;
564 struct sk_buff *skb; 585 struct sk_buff *skb;
565 586
@@ -568,6 +589,7 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring,
568 skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags); 589 skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags);
569 if (unlikely(!skb)) 590 if (unlikely(!skb))
570 return -ENOMEM; 591 return -ENOMEM;
592 b43_poison_rx_buffer(ring, skb);
571 dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0); 593 dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0);
572 if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { 594 if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) {
573 /* ugh. try to realloc in zone_dma */ 595 /* ugh. try to realloc in zone_dma */
@@ -578,6 +600,7 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring,
578 skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags); 600 skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags);
579 if (unlikely(!skb)) 601 if (unlikely(!skb))
580 return -ENOMEM; 602 return -ENOMEM;
603 b43_poison_rx_buffer(ring, skb);
581 dmaaddr = map_descbuffer(ring, skb->data, 604 dmaaddr = map_descbuffer(ring, skb->data,
582 ring->rx_buffersize, 0); 605 ring->rx_buffersize, 0);
583 if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { 606 if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) {
@@ -592,9 +615,6 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring,
592 ring->ops->fill_descriptor(ring, desc, dmaaddr, 615 ring->ops->fill_descriptor(ring, desc, dmaaddr,
593 ring->rx_buffersize, 0, 0, 0); 616 ring->rx_buffersize, 0, 0, 0);
594 617
595 rxhdr = (struct b43_rxhdr_fw4 *)(skb->data);
596 rxhdr->frame_len = 0;
597
598 return 0; 618 return 0;
599} 619}
600 620
@@ -1483,12 +1503,17 @@ static void dma_rx(struct b43_dmaring *ring, int *slot)
1483 len = le16_to_cpu(rxhdr->frame_len); 1503 len = le16_to_cpu(rxhdr->frame_len);
1484 } while (len == 0 && i++ < 5); 1504 } while (len == 0 && i++ < 5);
1485 if (unlikely(len == 0)) { 1505 if (unlikely(len == 0)) {
1486 /* recycle the descriptor buffer. */ 1506 dmaaddr = meta->dmaaddr;
1487 sync_descbuffer_for_device(ring, meta->dmaaddr, 1507 goto drop_recycle_buffer;
1488 ring->rx_buffersize);
1489 goto drop;
1490 } 1508 }
1491 } 1509 }
1510 if (unlikely(b43_rx_buffer_is_poisoned(ring, skb))) {
1511 /* Something went wrong with the DMA.
1512 * The device did not touch the buffer and did not overwrite the poison. */
1513 b43dbg(ring->dev->wl, "DMA RX: Dropping poisoned buffer.\n");
1514 dmaaddr = meta->dmaaddr;
1515 goto drop_recycle_buffer;
1516 }
1492 if (unlikely(len > ring->rx_buffersize)) { 1517 if (unlikely(len > ring->rx_buffersize)) {
1493 /* The data did not fit into one descriptor buffer 1518 /* The data did not fit into one descriptor buffer
1494 * and is split over multiple buffers. 1519 * and is split over multiple buffers.
@@ -1501,6 +1526,7 @@ static void dma_rx(struct b43_dmaring *ring, int *slot)
1501 while (1) { 1526 while (1) {
1502 desc = ops->idx2desc(ring, *slot, &meta); 1527 desc = ops->idx2desc(ring, *slot, &meta);
1503 /* recycle the descriptor buffer. */ 1528 /* recycle the descriptor buffer. */
1529 b43_poison_rx_buffer(ring, meta->skb);
1504 sync_descbuffer_for_device(ring, meta->dmaaddr, 1530 sync_descbuffer_for_device(ring, meta->dmaaddr,
1505 ring->rx_buffersize); 1531 ring->rx_buffersize);
1506 *slot = next_slot(ring, *slot); 1532 *slot = next_slot(ring, *slot);
@@ -1519,8 +1545,7 @@ static void dma_rx(struct b43_dmaring *ring, int *slot)
1519 err = setup_rx_descbuffer(ring, desc, meta, GFP_ATOMIC); 1545 err = setup_rx_descbuffer(ring, desc, meta, GFP_ATOMIC);
1520 if (unlikely(err)) { 1546 if (unlikely(err)) {
1521 b43dbg(ring->dev->wl, "DMA RX: setup_rx_descbuffer() failed\n"); 1547 b43dbg(ring->dev->wl, "DMA RX: setup_rx_descbuffer() failed\n");
1522 sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize); 1548 goto drop_recycle_buffer;
1523 goto drop;
1524 } 1549 }
1525 1550
1526 unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0); 1551 unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0);
@@ -1530,6 +1555,11 @@ static void dma_rx(struct b43_dmaring *ring, int *slot)
1530 b43_rx(ring->dev, skb, rxhdr); 1555 b43_rx(ring->dev, skb, rxhdr);
1531drop: 1556drop:
1532 return; 1557 return;
1558
1559drop_recycle_buffer:
1560 /* Poison and recycle the RX buffer. */
1561 b43_poison_rx_buffer(ring, skb);
1562 sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize);
1533} 1563}
1534 1564
1535void b43_dma_rx(struct b43_dmaring *ring) 1565void b43_dma_rx(struct b43_dmaring *ring)
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 4896e0831114..79b685e300c7 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3974,6 +3974,11 @@ static void setup_struct_phy_for_init(struct b43_wldev *dev,
3974 phy->next_txpwr_check_time = jiffies; 3974 phy->next_txpwr_check_time = jiffies;
3975 /* PHY TX errors counter. */ 3975 /* PHY TX errors counter. */
3976 atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT); 3976 atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT);
3977
3978#if B43_DEBUG
3979 phy->phy_locked = 0;
3980 phy->radio_locked = 0;
3981#endif
3977} 3982}
3978 3983
3979static void setup_struct_wldev_for_init(struct b43_wldev *dev) 3984static void setup_struct_wldev_for_init(struct b43_wldev *dev)
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
index 026b61c03fb9..e176b6e0d9cf 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -131,12 +131,16 @@ void b43_radio_lock(struct b43_wldev *dev)
131{ 131{
132 u32 macctl; 132 u32 macctl;
133 133
134#if B43_DEBUG
135 B43_WARN_ON(dev->phy.radio_locked);
136 dev->phy.radio_locked = 1;
137#endif
138
134 macctl = b43_read32(dev, B43_MMIO_MACCTL); 139 macctl = b43_read32(dev, B43_MMIO_MACCTL);
135 B43_WARN_ON(macctl & B43_MACCTL_RADIOLOCK);
136 macctl |= B43_MACCTL_RADIOLOCK; 140 macctl |= B43_MACCTL_RADIOLOCK;
137 b43_write32(dev, B43_MMIO_MACCTL, macctl); 141 b43_write32(dev, B43_MMIO_MACCTL, macctl);
138 /* Commit the write and wait for the device 142 /* Commit the write and wait for the firmware
139 * to exit any radio register access. */ 143 * to finish any radio register access. */
140 b43_read32(dev, B43_MMIO_MACCTL); 144 b43_read32(dev, B43_MMIO_MACCTL);
141 udelay(10); 145 udelay(10);
142} 146}
@@ -145,11 +149,15 @@ void b43_radio_unlock(struct b43_wldev *dev)
145{ 149{
146 u32 macctl; 150 u32 macctl;
147 151
152#if B43_DEBUG
153 B43_WARN_ON(!dev->phy.radio_locked);
154 dev->phy.radio_locked = 0;
155#endif
156
148 /* Commit any write */ 157 /* Commit any write */
149 b43_read16(dev, B43_MMIO_PHY_VER); 158 b43_read16(dev, B43_MMIO_PHY_VER);
150 /* unlock */ 159 /* unlock */
151 macctl = b43_read32(dev, B43_MMIO_MACCTL); 160 macctl = b43_read32(dev, B43_MMIO_MACCTL);
152 B43_WARN_ON(!(macctl & B43_MACCTL_RADIOLOCK));
153 macctl &= ~B43_MACCTL_RADIOLOCK; 161 macctl &= ~B43_MACCTL_RADIOLOCK;
154 b43_write32(dev, B43_MMIO_MACCTL, macctl); 162 b43_write32(dev, B43_MMIO_MACCTL, macctl);
155} 163}
diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h
index c9f5430d1d7d..b2d99101947b 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -245,8 +245,10 @@ struct b43_phy {
245 atomic_t txerr_cnt; 245 atomic_t txerr_cnt;
246 246
247#ifdef CONFIG_B43_DEBUG 247#ifdef CONFIG_B43_DEBUG
248 /* PHY registers locked by b43_phy_lock()? */ 248 /* PHY registers locked (w.r.t. firmware) */
249 bool phy_locked; 249 bool phy_locked;
250 /* Radio registers locked (w.r.t. firmware) */
251 bool radio_locked;
250#endif /* B43_DEBUG */ 252#endif /* B43_DEBUG */
251}; 253};
252 254
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 2399328e8de7..527525cc0919 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -1192,7 +1192,7 @@ int iwl3945_hw_nic_init(struct iwl_priv *priv)
1192 return -ENOMEM; 1192 return -ENOMEM;
1193 } 1193 }
1194 } else 1194 } else
1195 iwl_rx_queue_reset(priv, rxq); 1195 iwl3945_rx_queue_reset(priv, rxq);
1196 1196
1197 iwl3945_rx_replenish(priv); 1197 iwl3945_rx_replenish(priv);
1198 1198
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index ab7aaf6872c7..55188844657b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -215,6 +215,7 @@ extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm);
215extern int iwl3945_tx_queue_init(struct iwl_priv *priv, 215extern int iwl3945_tx_queue_init(struct iwl_priv *priv,
216 struct iwl_tx_queue *txq, int count, u32 id); 216 struct iwl_tx_queue *txq, int count, u32 id);
217extern void iwl3945_rx_replenish(void *data); 217extern void iwl3945_rx_replenish(void *data);
218extern void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq);
218extern void iwl3945_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq); 219extern void iwl3945_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq);
219extern int iwl3945_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, 220extern int iwl3945_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len,
220 const void *data); 221 const void *data);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 3889158b359c..1ef4192207a5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -976,11 +976,9 @@ void iwl_rx_handle(struct iwl_priv *priv)
976 976
977 rxq->queue[i] = NULL; 977 rxq->queue[i] = NULL;
978 978
979 dma_sync_single_range_for_cpu( 979 pci_unmap_single(priv->pci_dev, rxb->real_dma_addr,
980 &priv->pci_dev->dev, rxb->real_dma_addr, 980 priv->hw_params.rx_buf_size + 256,
981 rxb->aligned_dma_addr - rxb->real_dma_addr, 981 PCI_DMA_FROMDEVICE);
982 priv->hw_params.rx_buf_size,
983 PCI_DMA_FROMDEVICE);
984 pkt = (struct iwl_rx_packet *)rxb->skb->data; 982 pkt = (struct iwl_rx_packet *)rxb->skb->data;
985 983
986 /* Reclaim a command buffer only if this packet is a response 984 /* Reclaim a command buffer only if this packet is a response
@@ -1031,9 +1029,6 @@ void iwl_rx_handle(struct iwl_priv *priv)
1031 rxb->skb = NULL; 1029 rxb->skb = NULL;
1032 } 1030 }
1033 1031
1034 pci_unmap_single(priv->pci_dev, rxb->real_dma_addr,
1035 priv->hw_params.rx_buf_size + 256,
1036 PCI_DMA_FROMDEVICE);
1037 spin_lock_irqsave(&rxq->lock, flags); 1032 spin_lock_irqsave(&rxq->lock, flags);
1038 list_add_tail(&rxb->list, &priv->rxq.rx_used); 1033 list_add_tail(&rxb->list, &priv->rxq.rx_used);
1039 spin_unlock_irqrestore(&rxq->lock, flags); 1034 spin_unlock_irqrestore(&rxq->lock, flags);
diff --git a/drivers/net/wireless/iwlwifi/iwl-csr.h b/drivers/net/wireless/iwlwifi/iwl-csr.h
index 2f1242447b3b..6e983149b83b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-csr.h
+++ b/drivers/net/wireless/iwlwifi/iwl-csr.h
@@ -223,7 +223,7 @@
223#define CSR_EEPROM_REG_MSK_DATA (0xFFFF0000) 223#define CSR_EEPROM_REG_MSK_DATA (0xFFFF0000)
224 224
225/* EEPROM GP */ 225/* EEPROM GP */
226#define CSR_EEPROM_GP_VALID_MSK (0x00000006) 226#define CSR_EEPROM_GP_VALID_MSK (0x00000007)
227#define CSR_EEPROM_GP_BAD_SIGNATURE (0x00000000) 227#define CSR_EEPROM_GP_BAD_SIGNATURE (0x00000000)
228#define CSR_EEPROM_GP_IF_OWNER_MSK (0x00000180) 228#define CSR_EEPROM_GP_IF_OWNER_MSK (0x00000180)
229 229
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index ec9a13846edd..cf7f0db58fcf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -360,12 +360,16 @@ struct iwl_host_cmd {
360 360
361/** 361/**
362 * struct iwl_rx_queue - Rx queue 362 * struct iwl_rx_queue - Rx queue
363 * @bd: driver's pointer to buffer of receive buffer descriptors (rbd)
364 * @dma_addr: bus address of buffer of receive buffer descriptors (rbd)
363 * @read: Shared index to newest available Rx buffer 365 * @read: Shared index to newest available Rx buffer
364 * @write: Shared index to oldest written Rx packet 366 * @write: Shared index to oldest written Rx packet
365 * @free_count: Number of pre-allocated buffers in rx_free 367 * @free_count: Number of pre-allocated buffers in rx_free
366 * @rx_free: list of free SKBs for use 368 * @rx_free: list of free SKBs for use
367 * @rx_used: List of Rx buffers with no SKB 369 * @rx_used: List of Rx buffers with no SKB
368 * @need_update: flag to indicate we need to update read/write index 370 * @need_update: flag to indicate we need to update read/write index
371 * @rb_stts: driver's pointer to receive buffer status
372 * @rb_stts_dma: bus address of receive buffer status
369 * 373 *
370 * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers 374 * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers
371 */ 375 */
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 23644cf884f1..e7c65c4f741b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -925,11 +925,11 @@ void iwl_bg_scan_completed(struct work_struct *work)
925 925
926 IWL_DEBUG_SCAN(priv, "SCAN complete scan\n"); 926 IWL_DEBUG_SCAN(priv, "SCAN complete scan\n");
927 927
928 ieee80211_scan_completed(priv->hw, false);
929
928 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 930 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
929 return; 931 return;
930 932
931 ieee80211_scan_completed(priv->hw, false);
932
933 /* Since setting the TXPOWER may have been deferred while 933 /* Since setting the TXPOWER may have been deferred while
934 * performing the scan, fire one off */ 934 * performing the scan, fire one off */
935 mutex_lock(&priv->mutex); 935 mutex_lock(&priv->mutex);
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 1f117a49c569..71d5b8a1a73e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -799,6 +799,22 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
799 /* Copy MAC header from skb into command buffer */ 799 /* Copy MAC header from skb into command buffer */
800 memcpy(tx_cmd->hdr, hdr, hdr_len); 800 memcpy(tx_cmd->hdr, hdr, hdr_len);
801 801
802
803 /* Total # bytes to be transmitted */
804 len = (u16)skb->len;
805 tx_cmd->len = cpu_to_le16(len);
806
807 if (info->control.hw_key)
808 iwl_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id);
809
810 /* TODO need this for burst mode later on */
811 iwl_tx_cmd_build_basic(priv, tx_cmd, info, hdr, sta_id);
812
813 /* set is_hcca to 0; it probably will never be implemented */
814 iwl_tx_cmd_build_rate(priv, tx_cmd, info, fc, sta_id, 0);
815
816 iwl_update_tx_stats(priv, le16_to_cpu(fc), len);
817
802 /* 818 /*
803 * Use the first empty entry in this queue's command buffer array 819 * Use the first empty entry in this queue's command buffer array
804 * to contain the Tx command and MAC header concatenated together 820 * to contain the Tx command and MAC header concatenated together
@@ -819,21 +835,30 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
819 else 835 else
820 len_org = 0; 836 len_org = 0;
821 837
838 /* Tell NIC about any 2-byte padding after MAC header */
839 if (len_org)
840 tx_cmd->tx_flags |= TX_CMD_FLG_MH_PAD_MSK;
841
822 /* Physical address of this Tx command's header (not MAC header!), 842 /* Physical address of this Tx command's header (not MAC header!),
823 * within command buffer array. */ 843 * within command buffer array. */
824 txcmd_phys = pci_map_single(priv->pci_dev, 844 txcmd_phys = pci_map_single(priv->pci_dev,
825 out_cmd, sizeof(struct iwl_cmd), 845 &out_cmd->hdr, len,
826 PCI_DMA_BIDIRECTIONAL); 846 PCI_DMA_BIDIRECTIONAL);
827 pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys); 847 pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys);
828 pci_unmap_len_set(&out_cmd->meta, len, sizeof(struct iwl_cmd)); 848 pci_unmap_len_set(&out_cmd->meta, len, len);
829 /* Add buffer containing Tx command and MAC(!) header to TFD's 849 /* Add buffer containing Tx command and MAC(!) header to TFD's
830 * first entry */ 850 * first entry */
831 txcmd_phys += offsetof(struct iwl_cmd, hdr);
832 priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, 851 priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
833 txcmd_phys, len, 1, 0); 852 txcmd_phys, len, 1, 0);
834 853
835 if (info->control.hw_key) 854 if (!ieee80211_has_morefrags(hdr->frame_control)) {
836 iwl_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id); 855 txq->need_update = 1;
856 if (qc)
857 priv->stations[sta_id].tid[tid].seq_number = seq_number;
858 } else {
859 wait_write_ptr = 1;
860 txq->need_update = 0;
861 }
837 862
838 /* Set up TFD's 2nd entry to point directly to remainder of skb, 863 /* Set up TFD's 2nd entry to point directly to remainder of skb,
839 * if any (802.11 null frames have no payload). */ 864 * if any (802.11 null frames have no payload). */
@@ -846,41 +871,29 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
846 0, 0); 871 0, 0);
847 } 872 }
848 873
849 /* Tell NIC about any 2-byte padding after MAC header */
850 if (len_org)
851 tx_cmd->tx_flags |= TX_CMD_FLG_MH_PAD_MSK;
852
853 /* Total # bytes to be transmitted */
854 len = (u16)skb->len;
855 tx_cmd->len = cpu_to_le16(len);
856 /* TODO need this for burst mode later on */
857 iwl_tx_cmd_build_basic(priv, tx_cmd, info, hdr, sta_id);
858
859 /* set is_hcca to 0; it probably will never be implemented */
860 iwl_tx_cmd_build_rate(priv, tx_cmd, info, fc, sta_id, 0);
861
862 iwl_update_tx_stats(priv, le16_to_cpu(fc), len);
863
864 scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) + 874 scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) +
865 offsetof(struct iwl_tx_cmd, scratch); 875 offsetof(struct iwl_tx_cmd, scratch);
876
877 len = sizeof(struct iwl_tx_cmd) +
878 sizeof(struct iwl_cmd_header) + hdr_len;
879 /* take back ownership of DMA buffer to enable update */
880 pci_dma_sync_single_for_cpu(priv->pci_dev, txcmd_phys,
881 len, PCI_DMA_BIDIRECTIONAL);
866 tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); 882 tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys);
867 tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys); 883 tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys);
868 884
869 if (!ieee80211_has_morefrags(hdr->frame_control)) { 885 IWL_DEBUG_TX(priv, "sequence nr = 0X%x \n",
870 txq->need_update = 1; 886 le16_to_cpu(out_cmd->hdr.sequence));
871 if (qc) 887 IWL_DEBUG_TX(priv, "tx_flags = 0X%x \n", le32_to_cpu(tx_cmd->tx_flags));
872 priv->stations[sta_id].tid[tid].seq_number = seq_number;
873 } else {
874 wait_write_ptr = 1;
875 txq->need_update = 0;
876 }
877
878 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd, sizeof(*tx_cmd)); 888 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd, sizeof(*tx_cmd));
879
880 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len); 889 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len);
881 890
882 /* Set up entry for this TFD in Tx byte-count array */ 891 /* Set up entry for this TFD in Tx byte-count array */
883 priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, len); 892 priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq,
893 le16_to_cpu(tx_cmd->len));
894
895 pci_dma_sync_single_for_device(priv->pci_dev, txcmd_phys,
896 len, PCI_DMA_BIDIRECTIONAL);
884 897
885 /* Tell device the write index *just past* this latest filled TFD */ 898 /* Tell device the write index *just past* this latest filled TFD */
886 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 899 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
@@ -968,18 +981,9 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
968 INDEX_TO_SEQ(q->write_ptr)); 981 INDEX_TO_SEQ(q->write_ptr));
969 if (out_cmd->meta.flags & CMD_SIZE_HUGE) 982 if (out_cmd->meta.flags & CMD_SIZE_HUGE)
970 out_cmd->hdr.sequence |= SEQ_HUGE_FRAME; 983 out_cmd->hdr.sequence |= SEQ_HUGE_FRAME;
971 len = (idx == TFD_CMD_SLOTS) ? 984 len = sizeof(struct iwl_cmd) - sizeof(struct iwl_cmd_meta);
972 IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd); 985 len += (idx == TFD_CMD_SLOTS) ? IWL_MAX_SCAN_SIZE : 0;
973
974 phys_addr = pci_map_single(priv->pci_dev, out_cmd,
975 len, PCI_DMA_BIDIRECTIONAL);
976 pci_unmap_addr_set(&out_cmd->meta, mapping, phys_addr);
977 pci_unmap_len_set(&out_cmd->meta, len, len);
978 phys_addr += offsetof(struct iwl_cmd, hdr);
979 986
980 priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
981 phys_addr, fix_size, 1,
982 U32_PAD(cmd->len));
983 987
984#ifdef CONFIG_IWLWIFI_DEBUG 988#ifdef CONFIG_IWLWIFI_DEBUG
985 switch (out_cmd->hdr.cmd) { 989 switch (out_cmd->hdr.cmd) {
@@ -1007,6 +1011,15 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
1007 /* Set up entry in queue's byte count circular buffer */ 1011 /* Set up entry in queue's byte count circular buffer */
1008 priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, 0); 1012 priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, 0);
1009 1013
1014 phys_addr = pci_map_single(priv->pci_dev, &out_cmd->hdr,
1015 fix_size, PCI_DMA_BIDIRECTIONAL);
1016 pci_unmap_addr_set(&out_cmd->meta, mapping, phys_addr);
1017 pci_unmap_len_set(&out_cmd->meta, len, fix_size);
1018
1019 priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
1020 phys_addr, fix_size, 1,
1021 U32_PAD(cmd->len));
1022
1010 /* Increment and update queue's write index */ 1023 /* Increment and update queue's write index */
1011 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 1024 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
1012 ret = iwl_txq_update_write_ptr(priv, txq); 1025 ret = iwl_txq_update_write_ptr(priv, txq);
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index ce729281ff62..70a00c8ee42e 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -972,7 +972,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
972 dma_addr_t phys_addr; 972 dma_addr_t phys_addr;
973 dma_addr_t txcmd_phys; 973 dma_addr_t txcmd_phys;
974 int txq_id = skb_get_queue_mapping(skb); 974 int txq_id = skb_get_queue_mapping(skb);
975 u16 len, idx, len_org, hdr_len; 975 u16 len, idx, len_org, hdr_len; /* TODO: len_org is not used */
976 u8 id; 976 u8 id;
977 u8 unicast; 977 u8 unicast;
978 u8 sta_id; 978 u8 sta_id;
@@ -1074,6 +1074,40 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
1074 /* Copy MAC header from skb into command buffer */ 1074 /* Copy MAC header from skb into command buffer */
1075 memcpy(tx->hdr, hdr, hdr_len); 1075 memcpy(tx->hdr, hdr, hdr_len);
1076 1076
1077
1078 if (info->control.hw_key)
1079 iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, sta_id);
1080
1081 /* TODO need this for burst mode later on */
1082 iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, sta_id);
1083
1084 /* set is_hcca to 0; it probably will never be implemented */
1085 iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0);
1086
1087 /* Total # bytes to be transmitted */
1088 len = (u16)skb->len;
1089 tx->len = cpu_to_le16(len);
1090
1091
1092 tx->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK;
1093 tx->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK;
1094
1095 if (!ieee80211_has_morefrags(hdr->frame_control)) {
1096 txq->need_update = 1;
1097 if (qc)
1098 priv->stations_39[sta_id].tid[tid].seq_number = seq_number;
1099 } else {
1100 wait_write_ptr = 1;
1101 txq->need_update = 0;
1102 }
1103
1104 IWL_DEBUG_TX(priv, "sequence nr = 0X%x \n",
1105 le16_to_cpu(out_cmd->hdr.sequence));
1106 IWL_DEBUG_TX(priv, "tx_flags = 0X%x \n", le32_to_cpu(tx->tx_flags));
1107 iwl_print_hex_dump(priv, IWL_DL_TX, tx, sizeof(*tx));
1108 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx->hdr,
1109 ieee80211_hdrlen(fc));
1110
1077 /* 1111 /*
1078 * Use the first empty entry in this queue's command buffer array 1112 * Use the first empty entry in this queue's command buffer array
1079 * to contain the Tx command and MAC header concatenated together 1113 * to contain the Tx command and MAC header concatenated together
@@ -1096,22 +1130,18 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
1096 1130
1097 /* Physical address of this Tx command's header (not MAC header!), 1131 /* Physical address of this Tx command's header (not MAC header!),
1098 * within command buffer array. */ 1132 * within command buffer array. */
1099 txcmd_phys = pci_map_single(priv->pci_dev, 1133 txcmd_phys = pci_map_single(priv->pci_dev, &out_cmd->hdr,
1100 out_cmd, sizeof(struct iwl_cmd), 1134 len, PCI_DMA_TODEVICE);
1101 PCI_DMA_TODEVICE); 1135 /* we do not map meta data ... so we can safely access address to
1136 * provide to unmap command*/
1102 pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys); 1137 pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys);
1103 pci_unmap_len_set(&out_cmd->meta, len, sizeof(struct iwl_cmd)); 1138 pci_unmap_len_set(&out_cmd->meta, len, len);
1104 /* Add buffer containing Tx command and MAC(!) header to TFD's
1105 * first entry */
1106 txcmd_phys += offsetof(struct iwl_cmd, hdr);
1107 1139
1108 /* Add buffer containing Tx command and MAC(!) header to TFD's 1140 /* Add buffer containing Tx command and MAC(!) header to TFD's
1109 * first entry */ 1141 * first entry */
1110 priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, 1142 priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
1111 txcmd_phys, len, 1, 0); 1143 txcmd_phys, len, 1, 0);
1112 1144
1113 if (info->control.hw_key)
1114 iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, sta_id);
1115 1145
1116 /* Set up TFD's 2nd entry to point directly to remainder of skb, 1146 /* Set up TFD's 2nd entry to point directly to remainder of skb,
1117 * if any (802.11 null frames have no payload). */ 1147 * if any (802.11 null frames have no payload). */
@@ -1124,32 +1154,6 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
1124 0, U32_PAD(len)); 1154 0, U32_PAD(len));
1125 } 1155 }
1126 1156
1127 /* Total # bytes to be transmitted */
1128 len = (u16)skb->len;
1129 tx->len = cpu_to_le16(len);
1130
1131 /* TODO need this for burst mode later on */
1132 iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, sta_id);
1133
1134 /* set is_hcca to 0; it probably will never be implemented */
1135 iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0);
1136
1137 tx->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK;
1138 tx->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK;
1139
1140 if (!ieee80211_has_morefrags(hdr->frame_control)) {
1141 txq->need_update = 1;
1142 if (qc)
1143 priv->stations_39[sta_id].tid[tid].seq_number = seq_number;
1144 } else {
1145 wait_write_ptr = 1;
1146 txq->need_update = 0;
1147 }
1148
1149 iwl_print_hex_dump(priv, IWL_DL_TX, tx, sizeof(*tx));
1150
1151 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx->hdr,
1152 ieee80211_hdrlen(fc));
1153 1157
1154 /* Tell device the write index *just past* this latest filled TFD */ 1158 /* Tell device the write index *just past* this latest filled TFD */
1155 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 1159 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
@@ -1661,6 +1665,36 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv)
1661 spin_unlock_irqrestore(&rxq->lock, flags); 1665 spin_unlock_irqrestore(&rxq->lock, flags);
1662} 1666}
1663 1667
1668void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
1669{
1670 unsigned long flags;
1671 int i;
1672 spin_lock_irqsave(&rxq->lock, flags);
1673 INIT_LIST_HEAD(&rxq->rx_free);
1674 INIT_LIST_HEAD(&rxq->rx_used);
1675 /* Fill the rx_used queue with _all_ of the Rx buffers */
1676 for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) {
1677 /* In the reset function, these buffers may have been allocated
1678 * to an SKB, so we need to unmap and free potential storage */
1679 if (rxq->pool[i].skb != NULL) {
1680 pci_unmap_single(priv->pci_dev,
1681 rxq->pool[i].real_dma_addr,
1682 priv->hw_params.rx_buf_size,
1683 PCI_DMA_FROMDEVICE);
1684 priv->alloc_rxb_skb--;
1685 dev_kfree_skb(rxq->pool[i].skb);
1686 rxq->pool[i].skb = NULL;
1687 }
1688 list_add_tail(&rxq->pool[i].list, &rxq->rx_used);
1689 }
1690
1691 /* Set us so that we have processed and used all buffers, but have
1692 * not restocked the Rx queue with fresh buffers */
1693 rxq->read = rxq->write = 0;
1694 rxq->free_count = 0;
1695 spin_unlock_irqrestore(&rxq->lock, flags);
1696}
1697
1664/* 1698/*
1665 * this should be called while priv->lock is locked 1699 * this should be called while priv->lock is locked
1666 */ 1700 */
@@ -1685,6 +1719,34 @@ void iwl3945_rx_replenish(void *data)
1685 spin_unlock_irqrestore(&priv->lock, flags); 1719 spin_unlock_irqrestore(&priv->lock, flags);
1686} 1720}
1687 1721
1722/* Assumes that the skb field of the buffers in 'pool' is kept accurate.
1723 * If an SKB has been detached, the POOL needs to have its SKB set to NULL
1724 * This free routine walks the list of POOL entries and if SKB is set to
1725 * non NULL it is unmapped and freed
1726 */
1727static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
1728{
1729 int i;
1730 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) {
1731 if (rxq->pool[i].skb != NULL) {
1732 pci_unmap_single(priv->pci_dev,
1733 rxq->pool[i].real_dma_addr,
1734 priv->hw_params.rx_buf_size,
1735 PCI_DMA_FROMDEVICE);
1736 dev_kfree_skb(rxq->pool[i].skb);
1737 }
1738 }
1739
1740 pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd,
1741 rxq->dma_addr);
1742 pci_free_consistent(priv->pci_dev, sizeof(struct iwl_rb_status),
1743 rxq->rb_stts, rxq->rb_stts_dma);
1744 rxq->bd = NULL;
1745 rxq->rb_stts = NULL;
1746}
1747EXPORT_SYMBOL(iwl3945_rx_queue_free);
1748
1749
1688/* Convert linear signal-to-noise ratio into dB */ 1750/* Convert linear signal-to-noise ratio into dB */
1689static u8 ratio2dB[100] = { 1751static u8 ratio2dB[100] = {
1690/* 0 1 2 3 4 5 6 7 8 9 */ 1752/* 0 1 2 3 4 5 6 7 8 9 */
@@ -1802,9 +1864,9 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1802 1864
1803 rxq->queue[i] = NULL; 1865 rxq->queue[i] = NULL;
1804 1866
1805 pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->real_dma_addr, 1867 pci_unmap_single(priv->pci_dev, rxb->real_dma_addr,
1806 priv->hw_params.rx_buf_size, 1868 priv->hw_params.rx_buf_size,
1807 PCI_DMA_FROMDEVICE); 1869 PCI_DMA_FROMDEVICE);
1808 pkt = (struct iwl_rx_packet *)rxb->skb->data; 1870 pkt = (struct iwl_rx_packet *)rxb->skb->data;
1809 1871
1810 /* Reclaim a command buffer only if this packet is a response 1872 /* Reclaim a command buffer only if this packet is a response
@@ -1852,9 +1914,6 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1852 rxb->skb = NULL; 1914 rxb->skb = NULL;
1853 } 1915 }
1854 1916
1855 pci_unmap_single(priv->pci_dev, rxb->real_dma_addr,
1856 priv->hw_params.rx_buf_size,
1857 PCI_DMA_FROMDEVICE);
1858 spin_lock_irqsave(&rxq->lock, flags); 1917 spin_lock_irqsave(&rxq->lock, flags);
1859 list_add_tail(&rxb->list, &priv->rxq.rx_used); 1918 list_add_tail(&rxb->list, &priv->rxq.rx_used);
1860 spin_unlock_irqrestore(&rxq->lock, flags); 1919 spin_unlock_irqrestore(&rxq->lock, flags);
@@ -4075,7 +4134,7 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
4075 if (!static_key) { 4134 if (!static_key) {
4076 sta_id = iwl3945_hw_find_station(priv, addr); 4135 sta_id = iwl3945_hw_find_station(priv, addr);
4077 if (sta_id == IWL_INVALID_STATION) { 4136 if (sta_id == IWL_INVALID_STATION) {
4078 IWL_DEBUG_MAC80211(priv, "leave - %pMnot in station map.\n", 4137 IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n",
4079 addr); 4138 addr);
4080 return -EINVAL; 4139 return -EINVAL;
4081 } 4140 }
@@ -4913,6 +4972,8 @@ static int iwl3945_setup_mac(struct iwl_priv *priv)
4913 4972
4914 hw->wiphy->custom_regulatory = true; 4973 hw->wiphy->custom_regulatory = true;
4915 4974
4975 hw->wiphy->max_scan_ssids = 1; /* WILL FIX */
4976
4916 /* Default value; 4 EDCA QOS priorities */ 4977 /* Default value; 4 EDCA QOS priorities */
4917 hw->queues = 4; 4978 hw->queues = 4;
4918 4979
@@ -5194,12 +5255,12 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
5194 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); 5255 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group);
5195 5256
5196 iwl_rfkill_unregister(priv); 5257 iwl_rfkill_unregister(priv);
5197 cancel_delayed_work(&priv->rfkill_poll); 5258 cancel_delayed_work_sync(&priv->rfkill_poll);
5198 5259
5199 iwl3945_dealloc_ucode_pci(priv); 5260 iwl3945_dealloc_ucode_pci(priv);
5200 5261
5201 if (priv->rxq.bd) 5262 if (priv->rxq.bd)
5202 iwl_rx_queue_free(priv, &priv->rxq); 5263 iwl3945_rx_queue_free(priv, &priv->rxq);
5203 iwl3945_hw_txq_ctx_free(priv); 5264 iwl3945_hw_txq_ctx_free(priv);
5204 5265
5205 iwl3945_unset_hw_params(priv); 5266 iwl3945_unset_hw_params(priv);
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c
index 63d7e19ce9bd..8e669775cb5d 100644
--- a/drivers/net/wireless/libertas/rx.c
+++ b/drivers/net/wireless/libertas/rx.c
@@ -170,6 +170,7 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)
170 lbs_deb_rx("rx err: frame received with bad length\n"); 170 lbs_deb_rx("rx err: frame received with bad length\n");
171 dev->stats.rx_length_errors++; 171 dev->stats.rx_length_errors++;
172 ret = 0; 172 ret = 0;
173 dev_kfree_skb(skb);
173 goto done; 174 goto done;
174 } 175 }
175 176
@@ -181,6 +182,7 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)
181 lbs_pr_alert("rxpd not ok\n"); 182 lbs_pr_alert("rxpd not ok\n");
182 dev->stats.rx_errors++; 183 dev->stats.rx_errors++;
183 ret = 0; 184 ret = 0;
185 dev_kfree_skb(skb);
184 goto done; 186 goto done;
185 } 187 }
186 188
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index 57a0268d1bae..a9a970469c2a 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -893,8 +893,7 @@ static int mwl8k_rxq_init(struct ieee80211_hw *hw, int index)
893 rx_desc->next_rx_desc_phys_addr = 893 rx_desc->next_rx_desc_phys_addr =
894 cpu_to_le32(rxq->rx_desc_dma 894 cpu_to_le32(rxq->rx_desc_dma
895 + nexti * sizeof(*rx_desc)); 895 + nexti * sizeof(*rx_desc));
896 rx_desc->rx_ctrl = 896 rx_desc->rx_ctrl = MWL8K_RX_CTRL_OWNED_BY_HOST;
897 cpu_to_le32(MWL8K_RX_CTRL_OWNED_BY_HOST);
898 } 897 }
899 898
900 return 0; 899 return 0;
@@ -3720,12 +3719,12 @@ err_free_reg:
3720 return rc; 3719 return rc;
3721} 3720}
3722 3721
3723static void __devexit mwl8k_remove(struct pci_dev *pdev) 3722static void __devexit mwl8k_shutdown(struct pci_dev *pdev)
3724{ 3723{
3725 printk(KERN_ERR "===>%s(%u)\n", __func__, __LINE__); 3724 printk(KERN_ERR "===>%s(%u)\n", __func__, __LINE__);
3726} 3725}
3727 3726
3728static void __devexit mwl8k_shutdown(struct pci_dev *pdev) 3727static void __devexit mwl8k_remove(struct pci_dev *pdev)
3729{ 3728{
3730 struct ieee80211_hw *hw = pci_get_drvdata(pdev); 3729 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
3731 struct mwl8k_priv *priv; 3730 struct mwl8k_priv *priv;
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c
index 081428d9409e..632fac86a308 100644
--- a/drivers/net/wireless/orinoco/hw.c
+++ b/drivers/net/wireless/orinoco/hw.c
@@ -372,15 +372,13 @@ int __orinoco_hw_set_tkip_key(hermes_t *hw, int key_idx, int set_tx,
372 } 372 }
373 373
374 /* Wait upto 100ms for tx queue to empty */ 374 /* Wait upto 100ms for tx queue to empty */
375 k = 100; 375 for (k = 100; k > 0; k--) {
376 do {
377 k--;
378 udelay(1000); 376 udelay(1000);
379 ret = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_TXQUEUEEMPTY, 377 ret = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_TXQUEUEEMPTY,
380 &xmitting); 378 &xmitting);
381 if (ret) 379 if (ret || !xmitting)
382 break; 380 break;
383 } while ((k > 0) && xmitting); 381 }
384 382
385 if (k == 0) 383 if (k == 0)
386 ret = -ETIMEDOUT; 384 ret = -ETIMEDOUT;
diff --git a/drivers/net/wireless/p54/p54.h b/drivers/net/wireless/p54/p54.h
index 2dda5fe418b6..ecf8b6ed5a47 100644
--- a/drivers/net/wireless/p54/p54.h
+++ b/drivers/net/wireless/p54/p54.h
@@ -14,9 +14,9 @@
14 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
15 */ 15 */
16 16
17#ifdef CONFIG_MAC80211_LEDS 17#ifdef CONFIG_P54_LEDS
18#include <linux/leds.h> 18#include <linux/leds.h>
19#endif /* CONFIG_MAC80211_LEDS */ 19#endif /* CONFIG_P54_LEDS */
20 20
21enum p54_control_frame_types { 21enum p54_control_frame_types {
22 P54_CONTROL_TYPE_SETUP = 0, 22 P54_CONTROL_TYPE_SETUP = 0,
@@ -116,7 +116,7 @@ enum fw_state {
116 FW_STATE_RESETTING, 116 FW_STATE_RESETTING,
117}; 117};
118 118
119#ifdef CONFIG_MAC80211_LEDS 119#ifdef CONFIG_P54_LEDS
120 120
121#define P54_LED_MAX_NAME_LEN 31 121#define P54_LED_MAX_NAME_LEN 31
122 122
@@ -129,7 +129,7 @@ struct p54_led_dev {
129 unsigned int registered; 129 unsigned int registered;
130}; 130};
131 131
132#endif /* CONFIG_MAC80211_LEDS */ 132#endif /* CONFIG_P54_LEDS */
133 133
134struct p54_common { 134struct p54_common {
135 struct ieee80211_hw *hw; 135 struct ieee80211_hw *hw;
@@ -177,10 +177,10 @@ struct p54_common {
177 u8 privacy_caps; 177 u8 privacy_caps;
178 u8 rx_keycache_size; 178 u8 rx_keycache_size;
179 /* LED management */ 179 /* LED management */
180 #ifdef CONFIG_MAC80211_LEDS 180#ifdef CONFIG_P54_LEDS
181 struct p54_led_dev assoc_led; 181 struct p54_led_dev assoc_led;
182 struct p54_led_dev tx_led; 182 struct p54_led_dev tx_led;
183 #endif /* CONFIG_MAC80211_LEDS */ 183#endif /* CONFIG_P54_LEDS */
184 u16 softled_state; /* bit field of glowing LEDs */ 184 u16 softled_state; /* bit field of glowing LEDs */
185}; 185};
186 186
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 0c1b0577d4ee..c8f0232ee5e0 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -2543,8 +2543,6 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len)
2543 priv->basic_rate_mask = 0x15f; 2543 priv->basic_rate_mask = 0x15f;
2544 skb_queue_head_init(&priv->tx_queue); 2544 skb_queue_head_init(&priv->tx_queue);
2545 dev->flags = IEEE80211_HW_RX_INCLUDES_FCS | 2545 dev->flags = IEEE80211_HW_RX_INCLUDES_FCS |
2546 IEEE80211_HW_SUPPORTS_PS |
2547 IEEE80211_HW_PS_NULLFUNC_STACK |
2548 IEEE80211_HW_SIGNAL_DBM | 2546 IEEE80211_HW_SIGNAL_DBM |
2549 IEEE80211_HW_NOISE_DBM; 2547 IEEE80211_HW_NOISE_DBM;
2550 2548
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c
index e3569a0a952d..b1610ea4bb3d 100644
--- a/drivers/net/wireless/p54/p54pci.c
+++ b/drivers/net/wireless/p54/p54pci.c
@@ -492,8 +492,8 @@ static int __devinit p54p_probe(struct pci_dev *pdev,
492 goto err_disable_dev; 492 goto err_disable_dev;
493 } 493 }
494 494
495 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) || 495 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) ||
496 pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) { 496 pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
497 dev_err(&pdev->dev, "No suitable DMA available\n"); 497 dev_err(&pdev->dev, "No suitable DMA available\n");
498 goto err_free_reg; 498 goto err_free_reg;
499 } 499 }
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
index 2b222aaa6f0a..d1fe577de3d4 100644
--- a/drivers/net/wireless/p54/p54spi.c
+++ b/drivers/net/wireless/p54/p54spi.c
@@ -457,9 +457,10 @@ static int p54spi_wq_tx(struct p54s_priv *priv)
457 struct ieee80211_tx_info *info; 457 struct ieee80211_tx_info *info;
458 struct p54_tx_info *minfo; 458 struct p54_tx_info *minfo;
459 struct p54s_tx_info *dinfo; 459 struct p54s_tx_info *dinfo;
460 unsigned long flags;
460 int ret = 0; 461 int ret = 0;
461 462
462 spin_lock_bh(&priv->tx_lock); 463 spin_lock_irqsave(&priv->tx_lock, flags);
463 464
464 while (!list_empty(&priv->tx_pending)) { 465 while (!list_empty(&priv->tx_pending)) {
465 entry = list_entry(priv->tx_pending.next, 466 entry = list_entry(priv->tx_pending.next,
@@ -467,7 +468,7 @@ static int p54spi_wq_tx(struct p54s_priv *priv)
467 468
468 list_del_init(&entry->tx_list); 469 list_del_init(&entry->tx_list);
469 470
470 spin_unlock_bh(&priv->tx_lock); 471 spin_unlock_irqrestore(&priv->tx_lock, flags);
471 472
472 dinfo = container_of((void *) entry, struct p54s_tx_info, 473 dinfo = container_of((void *) entry, struct p54s_tx_info,
473 tx_list); 474 tx_list);
@@ -479,16 +480,14 @@ static int p54spi_wq_tx(struct p54s_priv *priv)
479 480
480 ret = p54spi_tx_frame(priv, skb); 481 ret = p54spi_tx_frame(priv, skb);
481 482
482 spin_lock_bh(&priv->tx_lock);
483
484 if (ret < 0) { 483 if (ret < 0) {
485 p54_free_skb(priv->hw, skb); 484 p54_free_skb(priv->hw, skb);
486 goto out; 485 return ret;
487 } 486 }
488 }
489 487
490out: 488 spin_lock_irqsave(&priv->tx_lock, flags);
491 spin_unlock_bh(&priv->tx_lock); 489 }
490 spin_unlock_irqrestore(&priv->tx_lock, flags);
492 return ret; 491 return ret;
493} 492}
494 493
@@ -498,12 +497,13 @@ static void p54spi_op_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
498 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 497 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
499 struct p54_tx_info *mi = (struct p54_tx_info *) info->rate_driver_data; 498 struct p54_tx_info *mi = (struct p54_tx_info *) info->rate_driver_data;
500 struct p54s_tx_info *di = (struct p54s_tx_info *) mi->data; 499 struct p54s_tx_info *di = (struct p54s_tx_info *) mi->data;
500 unsigned long flags;
501 501
502 BUILD_BUG_ON(sizeof(*di) > sizeof((mi->data))); 502 BUILD_BUG_ON(sizeof(*di) > sizeof((mi->data)));
503 503
504 spin_lock_bh(&priv->tx_lock); 504 spin_lock_irqsave(&priv->tx_lock, flags);
505 list_add_tail(&di->tx_list, &priv->tx_pending); 505 list_add_tail(&di->tx_list, &priv->tx_pending);
506 spin_unlock_bh(&priv->tx_lock); 506 spin_unlock_irqrestore(&priv->tx_lock, flags);
507 507
508 queue_work(priv->hw->workqueue, &priv->work); 508 queue_work(priv->hw->workqueue, &priv->work);
509} 509}
@@ -604,6 +604,7 @@ out:
604static void p54spi_op_stop(struct ieee80211_hw *dev) 604static void p54spi_op_stop(struct ieee80211_hw *dev)
605{ 605{
606 struct p54s_priv *priv = dev->priv; 606 struct p54s_priv *priv = dev->priv;
607 unsigned long flags;
607 608
608 if (mutex_lock_interruptible(&priv->mutex)) { 609 if (mutex_lock_interruptible(&priv->mutex)) {
609 /* FIXME: how to handle this error? */ 610 /* FIXME: how to handle this error? */
@@ -615,9 +616,9 @@ static void p54spi_op_stop(struct ieee80211_hw *dev)
615 cancel_work_sync(&priv->work); 616 cancel_work_sync(&priv->work);
616 617
617 p54spi_power_off(priv); 618 p54spi_power_off(priv);
618 spin_lock_bh(&priv->tx_lock); 619 spin_lock_irqsave(&priv->tx_lock, flags);
619 INIT_LIST_HEAD(&priv->tx_pending); 620 INIT_LIST_HEAD(&priv->tx_pending);
620 spin_unlock_bh(&priv->tx_lock); 621 spin_unlock_irqrestore(&priv->tx_lock, flags);
621 622
622 priv->fw_state = FW_STATE_OFF; 623 priv->fw_state = FW_STATE_OFF;
623 mutex_unlock(&priv->mutex); 624 mutex_unlock(&priv->mutex);
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index da6640afc835..6cc6cbc9234f 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -71,6 +71,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
71 {USB_DEVICE(0x1260, 0xee22)}, /* SMC 2862W-G version 2 */ 71 {USB_DEVICE(0x1260, 0xee22)}, /* SMC 2862W-G version 2 */
72 {USB_DEVICE(0x13b1, 0x000a)}, /* Linksys WUSB54G ver 2 */ 72 {USB_DEVICE(0x13b1, 0x000a)}, /* Linksys WUSB54G ver 2 */
73 {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ 73 {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */
74 {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */
74 {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ 75 {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */
75 {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ 76 {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */
76 {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */ 77 {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index db91db776508..bebf735cd4bd 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -2558,6 +2558,11 @@ static int rndis_wext_bind(struct usbnet *usbdev, struct usb_interface *intf)
2558 mutex_init(&priv->command_lock); 2558 mutex_init(&priv->command_lock);
2559 spin_lock_init(&priv->stats_lock); 2559 spin_lock_init(&priv->stats_lock);
2560 2560
2561 /* because rndis_command() sleeps we need to use workqueue */
2562 priv->workqueue = create_singlethread_workqueue("rndis_wlan");
2563 INIT_WORK(&priv->work, rndis_wext_worker);
2564 INIT_DELAYED_WORK(&priv->stats_work, rndis_update_wireless_stats);
2565
2561 /* try bind rndis_host */ 2566 /* try bind rndis_host */
2562 retval = generic_rndis_bind(usbdev, intf, FLAG_RNDIS_PHYM_WIRELESS); 2567 retval = generic_rndis_bind(usbdev, intf, FLAG_RNDIS_PHYM_WIRELESS);
2563 if (retval < 0) 2568 if (retval < 0)
@@ -2603,16 +2608,17 @@ static int rndis_wext_bind(struct usbnet *usbdev, struct usb_interface *intf)
2603 disassociate(usbdev, 1); 2608 disassociate(usbdev, 1);
2604 netif_carrier_off(usbdev->net); 2609 netif_carrier_off(usbdev->net);
2605 2610
2606 /* because rndis_command() sleeps we need to use workqueue */
2607 priv->workqueue = create_singlethread_workqueue("rndis_wlan");
2608 INIT_DELAYED_WORK(&priv->stats_work, rndis_update_wireless_stats);
2609 queue_delayed_work(priv->workqueue, &priv->stats_work, 2611 queue_delayed_work(priv->workqueue, &priv->stats_work,
2610 round_jiffies_relative(STATS_UPDATE_JIFFIES)); 2612 round_jiffies_relative(STATS_UPDATE_JIFFIES));
2611 INIT_WORK(&priv->work, rndis_wext_worker);
2612 2613
2613 return 0; 2614 return 0;
2614 2615
2615fail: 2616fail:
2617 cancel_delayed_work_sync(&priv->stats_work);
2618 cancel_work_sync(&priv->work);
2619 flush_workqueue(priv->workqueue);
2620 destroy_workqueue(priv->workqueue);
2621
2616 kfree(priv); 2622 kfree(priv);
2617 return retval; 2623 return retval;
2618} 2624}
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 05f94e21b423..5752aaae906b 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -646,10 +646,8 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
646 * Register HW. 646 * Register HW.
647 */ 647 */
648 status = ieee80211_register_hw(rt2x00dev->hw); 648 status = ieee80211_register_hw(rt2x00dev->hw);
649 if (status) { 649 if (status)
650 rt2x00lib_remove_hw(rt2x00dev);
651 return status; 650 return status;
652 }
653 651
654 set_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags); 652 set_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags);
655 653
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index 43fa0f849003..9730b4f8fd26 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -369,8 +369,6 @@ int rt2x00pci_suspend(struct pci_dev *pci_dev, pm_message_t state)
369 if (retval) 369 if (retval)
370 return retval; 370 return retval;
371 371
372 rt2x00pci_free_reg(rt2x00dev);
373
374 pci_save_state(pci_dev); 372 pci_save_state(pci_dev);
375 pci_disable_device(pci_dev); 373 pci_disable_device(pci_dev);
376 return pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)); 374 return pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state));
@@ -381,7 +379,6 @@ int rt2x00pci_resume(struct pci_dev *pci_dev)
381{ 379{
382 struct ieee80211_hw *hw = pci_get_drvdata(pci_dev); 380 struct ieee80211_hw *hw = pci_get_drvdata(pci_dev);
383 struct rt2x00_dev *rt2x00dev = hw->priv; 381 struct rt2x00_dev *rt2x00dev = hw->priv;
384 int retval;
385 382
386 if (pci_set_power_state(pci_dev, PCI_D0) || 383 if (pci_set_power_state(pci_dev, PCI_D0) ||
387 pci_enable_device(pci_dev) || 384 pci_enable_device(pci_dev) ||
@@ -390,20 +387,7 @@ int rt2x00pci_resume(struct pci_dev *pci_dev)
390 return -EIO; 387 return -EIO;
391 } 388 }
392 389
393 retval = rt2x00pci_alloc_reg(rt2x00dev); 390 return rt2x00lib_resume(rt2x00dev);
394 if (retval)
395 return retval;
396
397 retval = rt2x00lib_resume(rt2x00dev);
398 if (retval)
399 goto exit_free_reg;
400
401 return 0;
402
403exit_free_reg:
404 rt2x00pci_free_reg(rt2x00dev);
405
406 return retval;
407} 391}
408EXPORT_SYMBOL_GPL(rt2x00pci_resume); 392EXPORT_SYMBOL_GPL(rt2x00pci_resume);
409#endif /* CONFIG_PM */ 393#endif /* CONFIG_PM */
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 7d50ca82375e..501544882c2c 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -702,8 +702,6 @@ int rt2x00usb_suspend(struct usb_interface *usb_intf, pm_message_t state)
702 if (retval) 702 if (retval)
703 return retval; 703 return retval;
704 704
705 rt2x00usb_free_reg(rt2x00dev);
706
707 /* 705 /*
708 * Decrease usbdev refcount. 706 * Decrease usbdev refcount.
709 */ 707 */
@@ -717,24 +715,10 @@ int rt2x00usb_resume(struct usb_interface *usb_intf)
717{ 715{
718 struct ieee80211_hw *hw = usb_get_intfdata(usb_intf); 716 struct ieee80211_hw *hw = usb_get_intfdata(usb_intf);
719 struct rt2x00_dev *rt2x00dev = hw->priv; 717 struct rt2x00_dev *rt2x00dev = hw->priv;
720 int retval;
721 718
722 usb_get_dev(interface_to_usbdev(usb_intf)); 719 usb_get_dev(interface_to_usbdev(usb_intf));
723 720
724 retval = rt2x00usb_alloc_reg(rt2x00dev); 721 return rt2x00lib_resume(rt2x00dev);
725 if (retval)
726 return retval;
727
728 retval = rt2x00lib_resume(rt2x00dev);
729 if (retval)
730 goto exit_free_reg;
731
732 return 0;
733
734exit_free_reg:
735 rt2x00usb_free_reg(rt2x00dev);
736
737 return retval;
738} 722}
739EXPORT_SYMBOL_GPL(rt2x00usb_resume); 723EXPORT_SYMBOL_GPL(rt2x00usb_resume);
740#endif /* CONFIG_PM */ 724#endif /* CONFIG_PM */
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 420fff42c0dd..853b2b279b64 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2369,6 +2369,8 @@ static struct usb_device_id rt73usb_device_table[] = {
2369 /* Buffalo */ 2369 /* Buffalo */
2370 { USB_DEVICE(0x0411, 0x00d8), USB_DEVICE_DATA(&rt73usb_ops) }, 2370 { USB_DEVICE(0x0411, 0x00d8), USB_DEVICE_DATA(&rt73usb_ops) },
2371 { USB_DEVICE(0x0411, 0x00f4), USB_DEVICE_DATA(&rt73usb_ops) }, 2371 { USB_DEVICE(0x0411, 0x00f4), USB_DEVICE_DATA(&rt73usb_ops) },
2372 { USB_DEVICE(0x0411, 0x0116), USB_DEVICE_DATA(&rt73usb_ops) },
2373 { USB_DEVICE(0x0411, 0x0119), USB_DEVICE_DATA(&rt73usb_ops) },
2372 /* CNet */ 2374 /* CNet */
2373 { USB_DEVICE(0x1371, 0x9022), USB_DEVICE_DATA(&rt73usb_ops) }, 2375 { USB_DEVICE(0x1371, 0x9022), USB_DEVICE_DATA(&rt73usb_ops) },
2374 { USB_DEVICE(0x1371, 0x9032), USB_DEVICE_DATA(&rt73usb_ops) }, 2376 { USB_DEVICE(0x1371, 0x9032), USB_DEVICE_DATA(&rt73usb_ops) },
diff --git a/drivers/net/xtsonic.c b/drivers/net/xtsonic.c
index a12a7211c982..5a4ad156f63e 100644
--- a/drivers/net/xtsonic.c
+++ b/drivers/net/xtsonic.c
@@ -108,6 +108,18 @@ static int xtsonic_close(struct net_device *dev)
108 return err; 108 return err;
109} 109}
110 110
111static const struct net_device_ops xtsonic_netdev_ops = {
112 .ndo_open = xtsonic_open,
113 .ndo_stop = xtsonic_close,
114 .ndo_start_xmit = sonic_send_packet,
115 .ndo_get_stats = sonic_get_stats,
116 .ndo_set_multicast_list = sonic_multicast_list,
117 .ndo_tx_timeout = sonic_tx_timeout,
118 .ndo_validate_addr = eth_validate_addr,
119 .ndo_change_mtu = eth_change_mtu,
120 .ndo_set_mac_address = eth_mac_addr,
121};
122
111static int __init sonic_probe1(struct net_device *dev) 123static int __init sonic_probe1(struct net_device *dev)
112{ 124{
113 static unsigned version_printed = 0; 125 static unsigned version_printed = 0;
@@ -205,12 +217,7 @@ static int __init sonic_probe1(struct net_device *dev)
205 lp->rra_laddr = lp->rda_laddr + (SIZEOF_SONIC_RD * SONIC_NUM_RDS 217 lp->rra_laddr = lp->rda_laddr + (SIZEOF_SONIC_RD * SONIC_NUM_RDS
206 * SONIC_BUS_SCALE(lp->dma_bitmode)); 218 * SONIC_BUS_SCALE(lp->dma_bitmode));
207 219
208 dev->open = xtsonic_open; 220 dev->netdev_ops = &xtsonic_netdev_ops;
209 dev->stop = xtsonic_close;
210 dev->hard_start_xmit = sonic_send_packet;
211 dev->get_stats = sonic_get_stats;
212 dev->set_multicast_list = &sonic_multicast_list;
213 dev->tx_timeout = sonic_tx_timeout;
214 dev->watchdog_timeo = TX_TIMEOUT; 221 dev->watchdog_timeo = TX_TIMEOUT;
215 222
216 /* 223 /*