aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-16 04:09:10 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-16 04:09:10 -0500
commitaf2519fb2298cdf7540082c36f4d8c66bbff103f (patch)
tree1d290d28d42d42f9e693457762c4008988628060 /drivers/net
parent961d7d0ee5150e0197cc81c2a8884ecb230276e2 (diff)
parent7cb36b6ccdca03bd87e8faca7fd920643dd1aec7 (diff)
Merge branch 'linus' into core/iommu
Conflicts: arch/ia64/include/asm/dma-mapping.h arch/ia64/include/asm/machvec.h arch/ia64/include/asm/machvec_sn2.h
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/3c503.c1
-rw-r--r--drivers/net/3c59x.c2
-rw-r--r--drivers/net/8139cp.c2
-rw-r--r--drivers/net/8139too.c2
-rw-r--r--drivers/net/8390.c1
-rw-r--r--drivers/net/8390p.c1
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/acenic.c1
-rw-r--r--drivers/net/arm/etherh.c1
-rw-r--r--drivers/net/arm/ks8695net.c1
-rw-r--r--drivers/net/ax88796.c27
-rw-r--r--drivers/net/b44.c17
-rw-r--r--drivers/net/b44.h2
-rw-r--r--drivers/net/bnx2x.h19
-rw-r--r--drivers/net/bnx2x_main.c178
-rw-r--r--drivers/net/cxgb3/adapter.h7
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c22
-rw-r--r--drivers/net/cxgb3/sge.c2
-rw-r--r--drivers/net/e1000e/ich8lan.c19
-rw-r--r--drivers/net/e2100.c1
-rw-r--r--drivers/net/ehea/ehea_main.c8
-rw-r--r--drivers/net/ehea/ehea_qmr.c18
-rw-r--r--drivers/net/enic/enic_main.c1
-rw-r--r--drivers/net/forcedeth.c22
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c1
-rw-r--r--drivers/net/gianfar.c23
-rw-r--r--drivers/net/hamachi.c1
-rw-r--r--drivers/net/hamradio/6pack.c3
-rw-r--r--drivers/net/hp-plus.c1
-rw-r--r--drivers/net/hydra.c1
-rw-r--r--drivers/net/ibm_newemac/mal.c4
-rw-r--r--drivers/net/ibm_newemac/mal.h2
-rw-r--r--drivers/net/ibmveth.c16
-rw-r--r--drivers/net/irda/au1k_ir.c2
-rw-r--r--drivers/net/irda/donauboe.c8
-rw-r--r--drivers/net/irda/irda-usb.c2
-rw-r--r--drivers/net/iseries_veth.c2
-rw-r--r--drivers/net/korina.c158
-rw-r--r--drivers/net/mac8390.c1
-rw-r--r--drivers/net/mlx4/en_netdev.c1
-rw-r--r--drivers/net/mlx4/main.c4
-rw-r--r--drivers/net/ne-h8300.c1
-rw-r--r--drivers/net/ne2k-pci.c1
-rw-r--r--drivers/net/netxen/netxen_nic.h146
-rw-r--r--drivers/net/netxen/netxen_nic_ctx.c50
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c31
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c97
-rw-r--r--drivers/net/netxen/netxen_nic_init.c105
-rw-r--r--drivers/net/netxen/netxen_nic_main.c203
-rw-r--r--drivers/net/ns83820.c1
-rw-r--r--drivers/net/pasemi_mac.c6
-rw-r--r--drivers/net/phy/phy_device.c9
-rw-r--r--drivers/net/ppp_generic.c43
-rw-r--r--drivers/net/qlge/qlge.h61
-rw-r--r--drivers/net/qlge/qlge_dbg.c62
-rw-r--r--drivers/net/qlge/qlge_main.c80
-rw-r--r--drivers/net/r6040.c43
-rw-r--r--drivers/net/sc92031.c1
-rw-r--r--drivers/net/sfc/tenxpress.c5
-rw-r--r--drivers/net/sis900.c9
-rw-r--r--drivers/net/smc-mca.c1
-rw-r--r--drivers/net/smc-ultra.c1
-rw-r--r--drivers/net/smsc911x.c4
-rw-r--r--drivers/net/smsc9420.c1
-rw-r--r--drivers/net/ucc_geth.c128
-rw-r--r--drivers/net/ucc_geth.h114
-rw-r--r--drivers/net/usb/hso.c12
-rw-r--r--drivers/net/via-rhine.c1
-rw-r--r--drivers/net/via-velocity.c1
-rw-r--r--drivers/net/wan/ixp4xx_hss.c6
-rw-r--r--drivers/net/wd.c1
-rw-r--r--drivers/net/wireless/Kconfig2
-rw-r--r--drivers/net/wireless/ath5k/base.c8
-rw-r--r--drivers/net/wireless/ath5k/pcu.c4
-rw-r--r--drivers/net/wireless/ath5k/reg.h2
-rw-r--r--drivers/net/wireless/ath9k/Kconfig1
-rw-r--r--drivers/net/wireless/ath9k/main.c4
-rw-r--r--drivers/net/wireless/ath9k/xmit.c48
-rw-r--r--drivers/net/wireless/b43/main.c2
-rw-r--r--drivers/net/wireless/b43legacy/main.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-hcmd.c1
-rw-r--r--drivers/net/wireless/libertas/main.c7
-rw-r--r--drivers/net/wireless/libertas_tf/main.c2
-rw-r--r--drivers/net/wireless/orinoco/orinoco.c28
-rw-r--r--drivers/net/wireless/orinoco/orinoco_cs.c1
-rw-r--r--drivers/net/wireless/p54/p54common.c34
-rw-r--r--drivers/net/wireless/p54/p54usb.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c23
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c8
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00leds.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00lib.h11
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c6
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c1
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180_dev.c1
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187_dev.c5
-rw-r--r--drivers/net/yellowfin.c1
-rw-r--r--drivers/net/zorro8390.c1
100 files changed, 1087 insertions, 937 deletions
diff --git a/drivers/net/3c503.c b/drivers/net/3c503.c
index c092c3929224..5b91a85fe107 100644
--- a/drivers/net/3c503.c
+++ b/drivers/net/3c503.c
@@ -177,6 +177,7 @@ static const struct net_device_ops el2_netdev_ops = {
177 .ndo_get_stats = eip_get_stats, 177 .ndo_get_stats = eip_get_stats,
178 .ndo_set_multicast_list = eip_set_multicast_list, 178 .ndo_set_multicast_list = eip_set_multicast_list,
179 .ndo_validate_addr = eth_validate_addr, 179 .ndo_validate_addr = eth_validate_addr,
180 .ndo_set_mac_address = eth_mac_addr,
180 .ndo_change_mtu = eth_change_mtu, 181 .ndo_change_mtu = eth_change_mtu,
181#ifdef CONFIG_NET_POLL_CONTROLLER 182#ifdef CONFIG_NET_POLL_CONTROLLER
182 .ndo_poll_controller = eip_poll, 183 .ndo_poll_controller = eip_poll,
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 665e7fdf27a1..cdbbb6226fc5 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -3109,6 +3109,8 @@ static void acpi_set_WOL(struct net_device *dev)
3109 struct vortex_private *vp = netdev_priv(dev); 3109 struct vortex_private *vp = netdev_priv(dev);
3110 void __iomem *ioaddr = vp->ioaddr; 3110 void __iomem *ioaddr = vp->ioaddr;
3111 3111
3112 device_set_wakeup_enable(vp->gendev, vp->enable_wol);
3113
3112 if (vp->enable_wol) { 3114 if (vp->enable_wol) {
3113 /* Power up on: 1==Downloaded Filter, 2==Magic Packets, 4==Link Status. */ 3115 /* Power up on: 1==Downloaded Filter, 2==Magic Packets, 4==Link Status. */
3114 EL3WINDOW(7); 3116 EL3WINDOW(7);
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index dd7ac8290aec..4e19ae3ce6be 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -1821,6 +1821,7 @@ static const struct net_device_ops cp_netdev_ops = {
1821 .ndo_open = cp_open, 1821 .ndo_open = cp_open,
1822 .ndo_stop = cp_close, 1822 .ndo_stop = cp_close,
1823 .ndo_validate_addr = eth_validate_addr, 1823 .ndo_validate_addr = eth_validate_addr,
1824 .ndo_set_mac_address = eth_mac_addr,
1824 .ndo_set_multicast_list = cp_set_rx_mode, 1825 .ndo_set_multicast_list = cp_set_rx_mode,
1825 .ndo_get_stats = cp_get_stats, 1826 .ndo_get_stats = cp_get_stats,
1826 .ndo_do_ioctl = cp_ioctl, 1827 .ndo_do_ioctl = cp_ioctl,
@@ -1832,6 +1833,7 @@ static const struct net_device_ops cp_netdev_ops = {
1832#ifdef BROKEN 1833#ifdef BROKEN
1833 .ndo_change_mtu = cp_change_mtu, 1834 .ndo_change_mtu = cp_change_mtu,
1834#endif 1835#endif
1836
1835#ifdef CONFIG_NET_POLL_CONTROLLER 1837#ifdef CONFIG_NET_POLL_CONTROLLER
1836 .ndo_poll_controller = cp_poll_controller, 1838 .ndo_poll_controller = cp_poll_controller,
1837#endif 1839#endif
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index fe370f805793..a5b24202d564 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -917,6 +917,7 @@ static const struct net_device_ops rtl8139_netdev_ops = {
917 .ndo_stop = rtl8139_close, 917 .ndo_stop = rtl8139_close,
918 .ndo_get_stats = rtl8139_get_stats, 918 .ndo_get_stats = rtl8139_get_stats,
919 .ndo_validate_addr = eth_validate_addr, 919 .ndo_validate_addr = eth_validate_addr,
920 .ndo_set_mac_address = eth_mac_addr,
920 .ndo_start_xmit = rtl8139_start_xmit, 921 .ndo_start_xmit = rtl8139_start_xmit,
921 .ndo_set_multicast_list = rtl8139_set_rx_mode, 922 .ndo_set_multicast_list = rtl8139_set_rx_mode,
922 .ndo_do_ioctl = netdev_ioctl, 923 .ndo_do_ioctl = netdev_ioctl,
@@ -924,7 +925,6 @@ static const struct net_device_ops rtl8139_netdev_ops = {
924#ifdef CONFIG_NET_POLL_CONTROLLER 925#ifdef CONFIG_NET_POLL_CONTROLLER
925 .ndo_poll_controller = rtl8139_poll_controller, 926 .ndo_poll_controller = rtl8139_poll_controller,
926#endif 927#endif
927
928}; 928};
929 929
930static int __devinit rtl8139_init_one (struct pci_dev *pdev, 930static int __devinit rtl8139_init_one (struct pci_dev *pdev,
diff --git a/drivers/net/8390.c b/drivers/net/8390.c
index fbe609a51e02..ec3e22e6306f 100644
--- a/drivers/net/8390.c
+++ b/drivers/net/8390.c
@@ -63,6 +63,7 @@ const struct net_device_ops ei_netdev_ops = {
63 .ndo_get_stats = ei_get_stats, 63 .ndo_get_stats = ei_get_stats,
64 .ndo_set_multicast_list = ei_set_multicast_list, 64 .ndo_set_multicast_list = ei_set_multicast_list,
65 .ndo_validate_addr = eth_validate_addr, 65 .ndo_validate_addr = eth_validate_addr,
66 .ndo_set_mac_address = eth_mac_addr,
66 .ndo_change_mtu = eth_change_mtu, 67 .ndo_change_mtu = eth_change_mtu,
67#ifdef CONFIG_NET_POLL_CONTROLLER 68#ifdef CONFIG_NET_POLL_CONTROLLER
68 .ndo_poll_controller = ei_poll, 69 .ndo_poll_controller = ei_poll,
diff --git a/drivers/net/8390p.c b/drivers/net/8390p.c
index ee70b358a816..da863c91d1d0 100644
--- a/drivers/net/8390p.c
+++ b/drivers/net/8390p.c
@@ -68,6 +68,7 @@ const struct net_device_ops eip_netdev_ops = {
68 .ndo_get_stats = eip_get_stats, 68 .ndo_get_stats = eip_get_stats,
69 .ndo_set_multicast_list = eip_set_multicast_list, 69 .ndo_set_multicast_list = eip_set_multicast_list,
70 .ndo_validate_addr = eth_validate_addr, 70 .ndo_validate_addr = eth_validate_addr,
71 .ndo_set_mac_address = eth_mac_addr,
71 .ndo_change_mtu = eth_change_mtu, 72 .ndo_change_mtu = eth_change_mtu,
72#ifdef CONFIG_NET_POLL_CONTROLLER 73#ifdef CONFIG_NET_POLL_CONTROLLER
73 .ndo_poll_controller = eip_poll, 74 .ndo_poll_controller = eip_poll,
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 65afda4a62d9..9fe8cb7d43ac 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1600,7 +1600,7 @@ config 8139_OLD_RX_RESET
1600 old RX-reset behavior. If unsure, say N. 1600 old RX-reset behavior. If unsure, say N.
1601 1601
1602config R6040 1602config R6040
1603 tristate "RDC R6040 Fast Ethernet Adapter support (EXPERIMENTAL)" 1603 tristate "RDC R6040 Fast Ethernet Adapter support"
1604 depends on NET_PCI && PCI 1604 depends on NET_PCI && PCI
1605 select CRC32 1605 select CRC32
1606 select MII 1606 select MII
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index 5b396ff6c83f..9589d620639d 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -460,6 +460,7 @@ static const struct net_device_ops ace_netdev_ops = {
460 .ndo_get_stats = ace_get_stats, 460 .ndo_get_stats = ace_get_stats,
461 .ndo_start_xmit = ace_start_xmit, 461 .ndo_start_xmit = ace_start_xmit,
462 .ndo_set_multicast_list = ace_set_multicast_list, 462 .ndo_set_multicast_list = ace_set_multicast_list,
463 .ndo_validate_addr = eth_validate_addr,
463 .ndo_set_mac_address = ace_set_mac_addr, 464 .ndo_set_mac_address = ace_set_mac_addr,
464 .ndo_change_mtu = ace_change_mtu, 465 .ndo_change_mtu = ace_change_mtu,
465#if ACENIC_DO_VLAN 466#if ACENIC_DO_VLAN
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c
index 6278606d1049..d15d8b79d8e5 100644
--- a/drivers/net/arm/etherh.c
+++ b/drivers/net/arm/etherh.c
@@ -646,6 +646,7 @@ static const struct net_device_ops etherh_netdev_ops = {
646 .ndo_get_stats = ei_get_stats, 646 .ndo_get_stats = ei_get_stats,
647 .ndo_set_multicast_list = ei_set_multicast_list, 647 .ndo_set_multicast_list = ei_set_multicast_list,
648 .ndo_validate_addr = eth_validate_addr, 648 .ndo_validate_addr = eth_validate_addr,
649 .ndo_set_mac_address = eth_set_mac_addr,
649 .ndo_change_mtu = eth_change_mtu, 650 .ndo_change_mtu = eth_change_mtu,
650#ifdef CONFIG_NET_POLL_CONTROLLER 651#ifdef CONFIG_NET_POLL_CONTROLLER
651 .ndo_poll_controller = ei_poll, 652 .ndo_poll_controller = ei_poll,
diff --git a/drivers/net/arm/ks8695net.c b/drivers/net/arm/ks8695net.c
index 9ad22d1b00fd..1cf2f949c0b4 100644
--- a/drivers/net/arm/ks8695net.c
+++ b/drivers/net/arm/ks8695net.c
@@ -1357,6 +1357,7 @@ static const struct net_device_ops ks8695_netdev_ops = {
1357 .ndo_start_xmit = ks8695_start_xmit, 1357 .ndo_start_xmit = ks8695_start_xmit,
1358 .ndo_tx_timeout = ks8695_timeout, 1358 .ndo_tx_timeout = ks8695_timeout,
1359 .ndo_set_mac_address = ks8695_set_mac, 1359 .ndo_set_mac_address = ks8695_set_mac,
1360 .ndo_validate_addr = eth_validate_addr,
1360 .ndo_set_multicast_list = ks8695_set_multicast, 1361 .ndo_set_multicast_list = ks8695_set_multicast,
1361}; 1362};
1362 1363
diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c
index 337488ec707c..a4eb6c40678c 100644
--- a/drivers/net/ax88796.c
+++ b/drivers/net/ax88796.c
@@ -37,7 +37,10 @@ static int phy_debug = 0;
37#define __ei_open ax_ei_open 37#define __ei_open ax_ei_open
38#define __ei_close ax_ei_close 38#define __ei_close ax_ei_close
39#define __ei_poll ax_ei_poll 39#define __ei_poll ax_ei_poll
40#define __ei_start_xmit ax_ei_start_xmit
40#define __ei_tx_timeout ax_ei_tx_timeout 41#define __ei_tx_timeout ax_ei_tx_timeout
42#define __ei_get_stats ax_ei_get_stats
43#define __ei_set_multicast_list ax_ei_set_multicast_list
41#define __ei_interrupt ax_ei_interrupt 44#define __ei_interrupt ax_ei_interrupt
42#define ____alloc_ei_netdev ax__alloc_ei_netdev 45#define ____alloc_ei_netdev ax__alloc_ei_netdev
43#define __NS8390_init ax_NS8390_init 46#define __NS8390_init ax_NS8390_init
@@ -623,6 +626,23 @@ static void ax_eeprom_register_write(struct eeprom_93cx6 *eeprom)
623} 626}
624#endif 627#endif
625 628
629static const struct net_device_ops ax_netdev_ops = {
630 .ndo_open = ax_open,
631 .ndo_stop = ax_close,
632 .ndo_do_ioctl = ax_ioctl,
633
634 .ndo_start_xmit = ax_ei_start_xmit,
635 .ndo_tx_timeout = ax_ei_tx_timeout,
636 .ndo_get_stats = ax_ei_get_stats,
637 .ndo_set_multicast_list = ax_ei_set_multicast_list,
638 .ndo_validate_addr = eth_validate_addr,
639 .ndo_set_mac_address = eth_mac_addr,
640 .ndo_change_mtu = eth_change_mtu,
641#ifdef CONFIG_NET_POLL_CONTROLLER
642 .ndo_poll_controller = ax_ei_poll,
643#endif
644};
645
626/* setup code */ 646/* setup code */
627 647
628static void ax_initial_setup(struct net_device *dev, struct ei_device *ei_local) 648static void ax_initial_setup(struct net_device *dev, struct ei_device *ei_local)
@@ -738,9 +758,7 @@ static int ax_init_dev(struct net_device *dev, int first_init)
738 ei_status.get_8390_hdr = &ax_get_8390_hdr; 758 ei_status.get_8390_hdr = &ax_get_8390_hdr;
739 ei_status.priv = 0; 759 ei_status.priv = 0;
740 760
741 dev->open = ax_open; 761 dev->netdev_ops = &ax_netdev_ops;
742 dev->stop = ax_close;
743 dev->do_ioctl = ax_ioctl;
744 dev->ethtool_ops = &ax_ethtool_ops; 762 dev->ethtool_ops = &ax_ethtool_ops;
745 763
746 ax->msg_enable = NETIF_MSG_LINK; 764 ax->msg_enable = NETIF_MSG_LINK;
@@ -753,9 +771,6 @@ static int ax_init_dev(struct net_device *dev, int first_init)
753 ax->mii.mdio_write = ax_phy_write; 771 ax->mii.mdio_write = ax_phy_write;
754 ax->mii.dev = dev; 772 ax->mii.dev = dev;
755 773
756#ifdef CONFIG_NET_POLL_CONTROLLER
757 dev->poll_controller = ax_ei_poll;
758#endif
759 ax_NS8390_init(dev, 0); 774 ax_NS8390_init(dev, 0);
760 775
761 if (first_init) 776 if (first_init)
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 6926ebedfdc9..c38512ebcea6 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -73,8 +73,8 @@
73 (BP)->tx_cons - (BP)->tx_prod - TX_RING_GAP(BP)) 73 (BP)->tx_cons - (BP)->tx_prod - TX_RING_GAP(BP))
74#define NEXT_TX(N) (((N) + 1) & (B44_TX_RING_SIZE - 1)) 74#define NEXT_TX(N) (((N) + 1) & (B44_TX_RING_SIZE - 1))
75 75
76#define RX_PKT_OFFSET 30 76#define RX_PKT_OFFSET (RX_HEADER_LEN + 2)
77#define RX_PKT_BUF_SZ (1536 + RX_PKT_OFFSET + 64) 77#define RX_PKT_BUF_SZ (1536 + RX_PKT_OFFSET)
78 78
79/* minimum number of free TX descriptors required to wake up TX process */ 79/* minimum number of free TX descriptors required to wake up TX process */
80#define B44_TX_WAKEUP_THRESH (B44_TX_RING_SIZE / 4) 80#define B44_TX_WAKEUP_THRESH (B44_TX_RING_SIZE / 4)
@@ -679,10 +679,10 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
679 dev_kfree_skb_any(skb); 679 dev_kfree_skb_any(skb);
680 return -ENOMEM; 680 return -ENOMEM;
681 } 681 }
682 bp->force_copybreak = 1;
682 } 683 }
683 684
684 rh = (struct rx_header *) skb->data; 685 rh = (struct rx_header *) skb->data;
685 skb_reserve(skb, RX_PKT_OFFSET);
686 686
687 rh->len = 0; 687 rh->len = 0;
688 rh->flags = 0; 688 rh->flags = 0;
@@ -693,13 +693,13 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
693 if (src_map != NULL) 693 if (src_map != NULL)
694 src_map->skb = NULL; 694 src_map->skb = NULL;
695 695
696 ctrl = (DESC_CTRL_LEN & (RX_PKT_BUF_SZ - RX_PKT_OFFSET)); 696 ctrl = (DESC_CTRL_LEN & RX_PKT_BUF_SZ);
697 if (dest_idx == (B44_RX_RING_SIZE - 1)) 697 if (dest_idx == (B44_RX_RING_SIZE - 1))
698 ctrl |= DESC_CTRL_EOT; 698 ctrl |= DESC_CTRL_EOT;
699 699
700 dp = &bp->rx_ring[dest_idx]; 700 dp = &bp->rx_ring[dest_idx];
701 dp->ctrl = cpu_to_le32(ctrl); 701 dp->ctrl = cpu_to_le32(ctrl);
702 dp->addr = cpu_to_le32((u32) mapping + RX_PKT_OFFSET + bp->dma_offset); 702 dp->addr = cpu_to_le32((u32) mapping + bp->dma_offset);
703 703
704 if (bp->flags & B44_FLAG_RX_RING_HACK) 704 if (bp->flags & B44_FLAG_RX_RING_HACK)
705 b44_sync_dma_desc_for_device(bp->sdev, bp->rx_ring_dma, 705 b44_sync_dma_desc_for_device(bp->sdev, bp->rx_ring_dma,
@@ -801,7 +801,7 @@ static int b44_rx(struct b44 *bp, int budget)
801 /* Omit CRC. */ 801 /* Omit CRC. */
802 len -= 4; 802 len -= 4;
803 803
804 if (len > RX_COPY_THRESHOLD) { 804 if (!bp->force_copybreak && len > RX_COPY_THRESHOLD) {
805 int skb_size; 805 int skb_size;
806 skb_size = b44_alloc_rx_skb(bp, cons, bp->rx_prod); 806 skb_size = b44_alloc_rx_skb(bp, cons, bp->rx_prod);
807 if (skb_size < 0) 807 if (skb_size < 0)
@@ -809,8 +809,8 @@ static int b44_rx(struct b44 *bp, int budget)
809 ssb_dma_unmap_single(bp->sdev, map, 809 ssb_dma_unmap_single(bp->sdev, map,
810 skb_size, DMA_FROM_DEVICE); 810 skb_size, DMA_FROM_DEVICE);
811 /* Leave out rx_header */ 811 /* Leave out rx_header */
812 skb_put(skb, len + RX_PKT_OFFSET); 812 skb_put(skb, len + RX_PKT_OFFSET);
813 skb_pull(skb, RX_PKT_OFFSET); 813 skb_pull(skb, RX_PKT_OFFSET);
814 } else { 814 } else {
815 struct sk_buff *copy_skb; 815 struct sk_buff *copy_skb;
816 816
@@ -2153,6 +2153,7 @@ static int __devinit b44_init_one(struct ssb_device *sdev,
2153 bp = netdev_priv(dev); 2153 bp = netdev_priv(dev);
2154 bp->sdev = sdev; 2154 bp->sdev = sdev;
2155 bp->dev = dev; 2155 bp->dev = dev;
2156 bp->force_copybreak = 0;
2156 2157
2157 bp->msg_enable = netif_msg_init(b44_debug, B44_DEF_MSG_ENABLE); 2158 bp->msg_enable = netif_msg_init(b44_debug, B44_DEF_MSG_ENABLE);
2158 2159
diff --git a/drivers/net/b44.h b/drivers/net/b44.h
index 7db0c84a7950..e678498de6db 100644
--- a/drivers/net/b44.h
+++ b/drivers/net/b44.h
@@ -395,7 +395,7 @@ struct b44 {
395 u32 rx_pending; 395 u32 rx_pending;
396 u32 tx_pending; 396 u32 tx_pending;
397 u8 phy_addr; 397 u8 phy_addr;
398 398 u8 force_copybreak;
399 struct mii_if_info mii_if; 399 struct mii_if_info mii_if;
400}; 400};
401 401
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h
index fd705d1295a7..6fcccef4cf3d 100644
--- a/drivers/net/bnx2x.h
+++ b/drivers/net/bnx2x.h
@@ -20,6 +20,11 @@
20 * (you will need to reboot afterwards) */ 20 * (you will need to reboot afterwards) */
21/* #define BNX2X_STOP_ON_ERROR */ 21/* #define BNX2X_STOP_ON_ERROR */
22 22
23#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
24#define BCM_VLAN 1
25#endif
26
27
23/* error/debug prints */ 28/* error/debug prints */
24 29
25#define DRV_MODULE_NAME "bnx2x" 30#define DRV_MODULE_NAME "bnx2x"
@@ -78,11 +83,6 @@
78#endif 83#endif
79 84
80 85
81#ifdef NETIF_F_HW_VLAN_TX
82#define BCM_VLAN 1
83#endif
84
85
86#define U64_LO(x) (u32)(((u64)(x)) & 0xffffffff) 86#define U64_LO(x) (u32)(((u64)(x)) & 0xffffffff)
87#define U64_HI(x) (u32)(((u64)(x)) >> 32) 87#define U64_HI(x) (u32)(((u64)(x)) >> 32)
88#define HILO_U64(hi, lo) ((((u64)(hi)) << 32) + (lo)) 88#define HILO_U64(hi, lo) ((((u64)(hi)) << 32) + (lo))
@@ -150,6 +150,9 @@ struct sw_rx_page {
150 150
151#define PAGES_PER_SGE_SHIFT 0 151#define PAGES_PER_SGE_SHIFT 0
152#define PAGES_PER_SGE (1 << PAGES_PER_SGE_SHIFT) 152#define PAGES_PER_SGE (1 << PAGES_PER_SGE_SHIFT)
153#define SGE_PAGE_SIZE PAGE_SIZE
154#define SGE_PAGE_SHIFT PAGE_SHIFT
155#define SGE_PAGE_ALIGN(addr) PAGE_ALIGN(addr)
153 156
154#define BCM_RX_ETH_PAYLOAD_ALIGN 64 157#define BCM_RX_ETH_PAYLOAD_ALIGN 64
155 158
@@ -736,7 +739,7 @@ struct bnx2x {
736 struct bnx2x_fastpath fp[MAX_CONTEXT]; 739 struct bnx2x_fastpath fp[MAX_CONTEXT];
737 void __iomem *regview; 740 void __iomem *regview;
738 void __iomem *doorbells; 741 void __iomem *doorbells;
739#define BNX2X_DB_SIZE (16*2048) 742#define BNX2X_DB_SIZE (16*BCM_PAGE_SIZE)
740 743
741 struct net_device *dev; 744 struct net_device *dev;
742 struct pci_dev *pdev; 745 struct pci_dev *pdev;
@@ -801,6 +804,8 @@ struct bnx2x {
801#define TPA_ENABLE_FLAG 0x80 804#define TPA_ENABLE_FLAG 0x80
802#define NO_MCP_FLAG 0x100 805#define NO_MCP_FLAG 0x100
803#define BP_NOMCP(bp) (bp->flags & NO_MCP_FLAG) 806#define BP_NOMCP(bp) (bp->flags & NO_MCP_FLAG)
807#define HW_VLAN_TX_FLAG 0x400
808#define HW_VLAN_RX_FLAG 0x800
804 809
805 int func; 810 int func;
806#define BP_PORT(bp) (bp->func % PORT_MAX) 811#define BP_PORT(bp) (bp->func % PORT_MAX)
@@ -811,7 +816,7 @@ struct bnx2x {
811 int pm_cap; 816 int pm_cap;
812 int pcie_cap; 817 int pcie_cap;
813 818
814 struct work_struct sp_task; 819 struct delayed_work sp_task;
815 struct work_struct reset_task; 820 struct work_struct reset_task;
816 821
817 struct timer_list timer; 822 struct timer_list timer;
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 4be05847f86f..7c533797c064 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -38,9 +38,7 @@
38#include <linux/time.h> 38#include <linux/time.h>
39#include <linux/ethtool.h> 39#include <linux/ethtool.h>
40#include <linux/mii.h> 40#include <linux/mii.h>
41#ifdef NETIF_F_HW_VLAN_TX 41#include <linux/if_vlan.h>
42 #include <linux/if_vlan.h>
43#endif
44#include <net/ip.h> 42#include <net/ip.h>
45#include <net/tcp.h> 43#include <net/tcp.h>
46#include <net/checksum.h> 44#include <net/checksum.h>
@@ -95,6 +93,7 @@ MODULE_PARM_DESC(debug, "default debug msglevel");
95module_param(use_multi, int, 0); 93module_param(use_multi, int, 0);
96MODULE_PARM_DESC(use_multi, "use per-CPU queues"); 94MODULE_PARM_DESC(use_multi, "use per-CPU queues");
97#endif 95#endif
96static struct workqueue_struct *bnx2x_wq;
98 97
99enum bnx2x_board_type { 98enum bnx2x_board_type {
100 BCM57710 = 0, 99 BCM57710 = 0,
@@ -671,7 +670,8 @@ static void bnx2x_int_disable_sync(struct bnx2x *bp, int disable_hw)
671 synchronize_irq(bp->pdev->irq); 670 synchronize_irq(bp->pdev->irq);
672 671
673 /* make sure sp_task is not running */ 672 /* make sure sp_task is not running */
674 cancel_work_sync(&bp->sp_task); 673 cancel_delayed_work(&bp->sp_task);
674 flush_workqueue(bnx2x_wq);
675} 675}
676 676
677/* fast path */ 677/* fast path */
@@ -972,7 +972,7 @@ static inline void bnx2x_free_rx_sge(struct bnx2x *bp,
972 return; 972 return;
973 973
974 pci_unmap_page(bp->pdev, pci_unmap_addr(sw_buf, mapping), 974 pci_unmap_page(bp->pdev, pci_unmap_addr(sw_buf, mapping),
975 BCM_PAGE_SIZE*PAGES_PER_SGE, PCI_DMA_FROMDEVICE); 975 SGE_PAGE_SIZE*PAGES_PER_SGE, PCI_DMA_FROMDEVICE);
976 __free_pages(page, PAGES_PER_SGE_SHIFT); 976 __free_pages(page, PAGES_PER_SGE_SHIFT);
977 977
978 sw_buf->page = NULL; 978 sw_buf->page = NULL;
@@ -1000,7 +1000,7 @@ static inline int bnx2x_alloc_rx_sge(struct bnx2x *bp,
1000 if (unlikely(page == NULL)) 1000 if (unlikely(page == NULL))
1001 return -ENOMEM; 1001 return -ENOMEM;
1002 1002
1003 mapping = pci_map_page(bp->pdev, page, 0, BCM_PAGE_SIZE*PAGES_PER_SGE, 1003 mapping = pci_map_page(bp->pdev, page, 0, SGE_PAGE_SIZE*PAGES_PER_SGE,
1004 PCI_DMA_FROMDEVICE); 1004 PCI_DMA_FROMDEVICE);
1005 if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) { 1005 if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) {
1006 __free_pages(page, PAGES_PER_SGE_SHIFT); 1006 __free_pages(page, PAGES_PER_SGE_SHIFT);
@@ -1096,9 +1096,9 @@ static void bnx2x_update_sge_prod(struct bnx2x_fastpath *fp,
1096 struct eth_fast_path_rx_cqe *fp_cqe) 1096 struct eth_fast_path_rx_cqe *fp_cqe)
1097{ 1097{
1098 struct bnx2x *bp = fp->bp; 1098 struct bnx2x *bp = fp->bp;
1099 u16 sge_len = BCM_PAGE_ALIGN(le16_to_cpu(fp_cqe->pkt_len) - 1099 u16 sge_len = SGE_PAGE_ALIGN(le16_to_cpu(fp_cqe->pkt_len) -
1100 le16_to_cpu(fp_cqe->len_on_bd)) >> 1100 le16_to_cpu(fp_cqe->len_on_bd)) >>
1101 BCM_PAGE_SHIFT; 1101 SGE_PAGE_SHIFT;
1102 u16 last_max, last_elem, first_elem; 1102 u16 last_max, last_elem, first_elem;
1103 u16 delta = 0; 1103 u16 delta = 0;
1104 u16 i; 1104 u16 i;
@@ -1203,22 +1203,22 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
1203 u16 cqe_idx) 1203 u16 cqe_idx)
1204{ 1204{
1205 struct sw_rx_page *rx_pg, old_rx_pg; 1205 struct sw_rx_page *rx_pg, old_rx_pg;
1206 struct page *sge;
1207 u16 len_on_bd = le16_to_cpu(fp_cqe->len_on_bd); 1206 u16 len_on_bd = le16_to_cpu(fp_cqe->len_on_bd);
1208 u32 i, frag_len, frag_size, pages; 1207 u32 i, frag_len, frag_size, pages;
1209 int err; 1208 int err;
1210 int j; 1209 int j;
1211 1210
1212 frag_size = le16_to_cpu(fp_cqe->pkt_len) - len_on_bd; 1211 frag_size = le16_to_cpu(fp_cqe->pkt_len) - len_on_bd;
1213 pages = BCM_PAGE_ALIGN(frag_size) >> BCM_PAGE_SHIFT; 1212 pages = SGE_PAGE_ALIGN(frag_size) >> SGE_PAGE_SHIFT;
1214 1213
1215 /* This is needed in order to enable forwarding support */ 1214 /* This is needed in order to enable forwarding support */
1216 if (frag_size) 1215 if (frag_size)
1217 skb_shinfo(skb)->gso_size = min((u32)BCM_PAGE_SIZE, 1216 skb_shinfo(skb)->gso_size = min((u32)SGE_PAGE_SIZE,
1218 max(frag_size, (u32)len_on_bd)); 1217 max(frag_size, (u32)len_on_bd));
1219 1218
1220#ifdef BNX2X_STOP_ON_ERROR 1219#ifdef BNX2X_STOP_ON_ERROR
1221 if (pages > 8*PAGES_PER_SGE) { 1220 if (pages >
1221 min((u32)8, (u32)MAX_SKB_FRAGS) * SGE_PAGE_SIZE * PAGES_PER_SGE) {
1222 BNX2X_ERR("SGL length is too long: %d. CQE index is %d\n", 1222 BNX2X_ERR("SGL length is too long: %d. CQE index is %d\n",
1223 pages, cqe_idx); 1223 pages, cqe_idx);
1224 BNX2X_ERR("fp_cqe->pkt_len = %d fp_cqe->len_on_bd = %d\n", 1224 BNX2X_ERR("fp_cqe->pkt_len = %d fp_cqe->len_on_bd = %d\n",
@@ -1234,9 +1234,8 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
1234 1234
1235 /* FW gives the indices of the SGE as if the ring is an array 1235 /* FW gives the indices of the SGE as if the ring is an array
1236 (meaning that "next" element will consume 2 indices) */ 1236 (meaning that "next" element will consume 2 indices) */
1237 frag_len = min(frag_size, (u32)(BCM_PAGE_SIZE*PAGES_PER_SGE)); 1237 frag_len = min(frag_size, (u32)(SGE_PAGE_SIZE*PAGES_PER_SGE));
1238 rx_pg = &fp->rx_page_ring[sge_idx]; 1238 rx_pg = &fp->rx_page_ring[sge_idx];
1239 sge = rx_pg->page;
1240 old_rx_pg = *rx_pg; 1239 old_rx_pg = *rx_pg;
1241 1240
1242 /* If we fail to allocate a substitute page, we simply stop 1241 /* If we fail to allocate a substitute page, we simply stop
@@ -1249,7 +1248,7 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
1249 1248
1250 /* Unmap the page as we r going to pass it to the stack */ 1249 /* Unmap the page as we r going to pass it to the stack */
1251 pci_unmap_page(bp->pdev, pci_unmap_addr(&old_rx_pg, mapping), 1250 pci_unmap_page(bp->pdev, pci_unmap_addr(&old_rx_pg, mapping),
1252 BCM_PAGE_SIZE*PAGES_PER_SGE, PCI_DMA_FROMDEVICE); 1251 SGE_PAGE_SIZE*PAGES_PER_SGE, PCI_DMA_FROMDEVICE);
1253 1252
1254 /* Add one frag and update the appropriate fields in the skb */ 1253 /* Add one frag and update the appropriate fields in the skb */
1255 skb_fill_page_desc(skb, j, old_rx_pg.page, 0, frag_len); 1254 skb_fill_page_desc(skb, j, old_rx_pg.page, 0, frag_len);
@@ -1282,6 +1281,13 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
1282 if (likely(new_skb)) { 1281 if (likely(new_skb)) {
1283 /* fix ip xsum and give it to the stack */ 1282 /* fix ip xsum and give it to the stack */
1284 /* (no need to map the new skb) */ 1283 /* (no need to map the new skb) */
1284#ifdef BCM_VLAN
1285 int is_vlan_cqe =
1286 (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
1287 PARSING_FLAGS_VLAN);
1288 int is_not_hwaccel_vlan_cqe =
1289 (is_vlan_cqe && (!(bp->flags & HW_VLAN_RX_FLAG)));
1290#endif
1285 1291
1286 prefetch(skb); 1292 prefetch(skb);
1287 prefetch(((char *)(skb)) + 128); 1293 prefetch(((char *)(skb)) + 128);
@@ -1306,6 +1312,12 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
1306 struct iphdr *iph; 1312 struct iphdr *iph;
1307 1313
1308 iph = (struct iphdr *)skb->data; 1314 iph = (struct iphdr *)skb->data;
1315#ifdef BCM_VLAN
1316 /* If there is no Rx VLAN offloading -
1317 take VLAN tag into an account */
1318 if (unlikely(is_not_hwaccel_vlan_cqe))
1319 iph = (struct iphdr *)((u8 *)iph + VLAN_HLEN);
1320#endif
1309 iph->check = 0; 1321 iph->check = 0;
1310 iph->check = ip_fast_csum((u8 *)iph, iph->ihl); 1322 iph->check = ip_fast_csum((u8 *)iph, iph->ihl);
1311 } 1323 }
@@ -1313,9 +1325,8 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
1313 if (!bnx2x_fill_frag_skb(bp, fp, skb, 1325 if (!bnx2x_fill_frag_skb(bp, fp, skb,
1314 &cqe->fast_path_cqe, cqe_idx)) { 1326 &cqe->fast_path_cqe, cqe_idx)) {
1315#ifdef BCM_VLAN 1327#ifdef BCM_VLAN
1316 if ((bp->vlgrp != NULL) && 1328 if ((bp->vlgrp != NULL) && is_vlan_cqe &&
1317 (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & 1329 (!is_not_hwaccel_vlan_cqe))
1318 PARSING_FLAGS_VLAN))
1319 vlan_hwaccel_receive_skb(skb, bp->vlgrp, 1330 vlan_hwaccel_receive_skb(skb, bp->vlgrp,
1320 le16_to_cpu(cqe->fast_path_cqe. 1331 le16_to_cpu(cqe->fast_path_cqe.
1321 vlan_tag)); 1332 vlan_tag));
@@ -1355,11 +1366,23 @@ static inline void bnx2x_update_rx_prod(struct bnx2x *bp,
1355 rx_prods.cqe_prod = rx_comp_prod; 1366 rx_prods.cqe_prod = rx_comp_prod;
1356 rx_prods.sge_prod = rx_sge_prod; 1367 rx_prods.sge_prod = rx_sge_prod;
1357 1368
1369 /*
1370 * Make sure that the BD and SGE data is updated before updating the
1371 * producers since FW might read the BD/SGE right after the producer
1372 * is updated.
1373 * This is only applicable for weak-ordered memory model archs such
1374 * as IA-64. The following barrier is also mandatory since FW will
1375 * assumes BDs must have buffers.
1376 */
1377 wmb();
1378
1358 for (i = 0; i < sizeof(struct tstorm_eth_rx_producers)/4; i++) 1379 for (i = 0; i < sizeof(struct tstorm_eth_rx_producers)/4; i++)
1359 REG_WR(bp, BAR_TSTRORM_INTMEM + 1380 REG_WR(bp, BAR_TSTRORM_INTMEM +
1360 TSTORM_RX_PRODS_OFFSET(BP_PORT(bp), FP_CL_ID(fp)) + i*4, 1381 TSTORM_RX_PRODS_OFFSET(BP_PORT(bp), FP_CL_ID(fp)) + i*4,
1361 ((u32 *)&rx_prods)[i]); 1382 ((u32 *)&rx_prods)[i]);
1362 1383
1384 mmiowb(); /* keep prod updates ordered */
1385
1363 DP(NETIF_MSG_RX_STATUS, 1386 DP(NETIF_MSG_RX_STATUS,
1364 "Wrote: bd_prod %u cqe_prod %u sge_prod %u\n", 1387 "Wrote: bd_prod %u cqe_prod %u sge_prod %u\n",
1365 bd_prod, rx_comp_prod, rx_sge_prod); 1388 bd_prod, rx_comp_prod, rx_sge_prod);
@@ -1415,7 +1438,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
1415 DP(NETIF_MSG_RX_STATUS, "CQE type %x err %x status %x" 1438 DP(NETIF_MSG_RX_STATUS, "CQE type %x err %x status %x"
1416 " queue %x vlan %x len %u\n", CQE_TYPE(cqe_fp_flags), 1439 " queue %x vlan %x len %u\n", CQE_TYPE(cqe_fp_flags),
1417 cqe_fp_flags, cqe->fast_path_cqe.status_flags, 1440 cqe_fp_flags, cqe->fast_path_cqe.status_flags,
1418 cqe->fast_path_cqe.rss_hash_result, 1441 le32_to_cpu(cqe->fast_path_cqe.rss_hash_result),
1419 le16_to_cpu(cqe->fast_path_cqe.vlan_tag), 1442 le16_to_cpu(cqe->fast_path_cqe.vlan_tag),
1420 le16_to_cpu(cqe->fast_path_cqe.pkt_len)); 1443 le16_to_cpu(cqe->fast_path_cqe.pkt_len));
1421 1444
@@ -1547,7 +1570,7 @@ reuse_rx:
1547 } 1570 }
1548 1571
1549#ifdef BCM_VLAN 1572#ifdef BCM_VLAN
1550 if ((bp->vlgrp != NULL) && 1573 if ((bp->vlgrp != NULL) && (bp->flags & HW_VLAN_RX_FLAG) &&
1551 (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & 1574 (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
1552 PARSING_FLAGS_VLAN)) 1575 PARSING_FLAGS_VLAN))
1553 vlan_hwaccel_receive_skb(skb, bp->vlgrp, 1576 vlan_hwaccel_receive_skb(skb, bp->vlgrp,
@@ -1580,7 +1603,6 @@ next_cqe:
1580 /* Update producers */ 1603 /* Update producers */
1581 bnx2x_update_rx_prod(bp, fp, bd_prod_fw, sw_comp_prod, 1604 bnx2x_update_rx_prod(bp, fp, bd_prod_fw, sw_comp_prod,
1582 fp->rx_sge_prod); 1605 fp->rx_sge_prod);
1583 mmiowb(); /* keep prod updates ordered */
1584 1606
1585 fp->rx_pkt += rx_pkt; 1607 fp->rx_pkt += rx_pkt;
1586 fp->rx_calls++; 1608 fp->rx_calls++;
@@ -1660,7 +1682,7 @@ static irqreturn_t bnx2x_interrupt(int irq, void *dev_instance)
1660 1682
1661 1683
1662 if (unlikely(status & 0x1)) { 1684 if (unlikely(status & 0x1)) {
1663 schedule_work(&bp->sp_task); 1685 queue_delayed_work(bnx2x_wq, &bp->sp_task, 0);
1664 1686
1665 status &= ~0x1; 1687 status &= ~0x1;
1666 if (!status) 1688 if (!status)
@@ -1887,7 +1909,8 @@ static int bnx2x_set_spio(struct bnx2x *bp, int spio_num, u32 mode)
1887 1909
1888static void bnx2x_calc_fc_adv(struct bnx2x *bp) 1910static void bnx2x_calc_fc_adv(struct bnx2x *bp)
1889{ 1911{
1890 switch (bp->link_vars.ieee_fc) { 1912 switch (bp->link_vars.ieee_fc &
1913 MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_MASK) {
1891 case MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_NONE: 1914 case MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_NONE:
1892 bp->port.advertising &= ~(ADVERTISED_Asym_Pause | 1915 bp->port.advertising &= ~(ADVERTISED_Asym_Pause |
1893 ADVERTISED_Pause); 1916 ADVERTISED_Pause);
@@ -1957,10 +1980,11 @@ static u8 bnx2x_initial_phy_init(struct bnx2x *bp)
1957 rc = bnx2x_phy_init(&bp->link_params, &bp->link_vars); 1980 rc = bnx2x_phy_init(&bp->link_params, &bp->link_vars);
1958 bnx2x_release_phy_lock(bp); 1981 bnx2x_release_phy_lock(bp);
1959 1982
1983 bnx2x_calc_fc_adv(bp);
1984
1960 if (bp->link_vars.link_up) 1985 if (bp->link_vars.link_up)
1961 bnx2x_link_report(bp); 1986 bnx2x_link_report(bp);
1962 1987
1963 bnx2x_calc_fc_adv(bp);
1964 1988
1965 return rc; 1989 return rc;
1966 } 1990 }
@@ -2220,9 +2244,7 @@ static void bnx2x_link_attn(struct bnx2x *bp)
2220 /* Make sure that we are synced with the current statistics */ 2244 /* Make sure that we are synced with the current statistics */
2221 bnx2x_stats_handle(bp, STATS_EVENT_STOP); 2245 bnx2x_stats_handle(bp, STATS_EVENT_STOP);
2222 2246
2223 bnx2x_acquire_phy_lock(bp);
2224 bnx2x_link_update(&bp->link_params, &bp->link_vars); 2247 bnx2x_link_update(&bp->link_params, &bp->link_vars);
2225 bnx2x_release_phy_lock(bp);
2226 2248
2227 if (bp->link_vars.link_up) { 2249 if (bp->link_vars.link_up) {
2228 2250
@@ -2471,6 +2493,8 @@ static void bnx2x_attn_int_asserted(struct bnx2x *bp, u32 asserted)
2471 if (asserted & ATTN_HARD_WIRED_MASK) { 2493 if (asserted & ATTN_HARD_WIRED_MASK) {
2472 if (asserted & ATTN_NIG_FOR_FUNC) { 2494 if (asserted & ATTN_NIG_FOR_FUNC) {
2473 2495
2496 bnx2x_acquire_phy_lock(bp);
2497
2474 /* save nig interrupt mask */ 2498 /* save nig interrupt mask */
2475 bp->nig_mask = REG_RD(bp, nig_int_mask_addr); 2499 bp->nig_mask = REG_RD(bp, nig_int_mask_addr);
2476 REG_WR(bp, nig_int_mask_addr, 0); 2500 REG_WR(bp, nig_int_mask_addr, 0);
@@ -2526,8 +2550,10 @@ static void bnx2x_attn_int_asserted(struct bnx2x *bp, u32 asserted)
2526 REG_WR(bp, hc_addr, asserted); 2550 REG_WR(bp, hc_addr, asserted);
2527 2551
2528 /* now set back the mask */ 2552 /* now set back the mask */
2529 if (asserted & ATTN_NIG_FOR_FUNC) 2553 if (asserted & ATTN_NIG_FOR_FUNC) {
2530 REG_WR(bp, nig_int_mask_addr, bp->nig_mask); 2554 REG_WR(bp, nig_int_mask_addr, bp->nig_mask);
2555 bnx2x_release_phy_lock(bp);
2556 }
2531} 2557}
2532 2558
2533static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn) 2559static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn)
@@ -2795,8 +2821,10 @@ static void bnx2x_attn_int_deasserted(struct bnx2x *bp, u32 deasserted)
2795static void bnx2x_attn_int(struct bnx2x *bp) 2821static void bnx2x_attn_int(struct bnx2x *bp)
2796{ 2822{
2797 /* read local copy of bits */ 2823 /* read local copy of bits */
2798 u32 attn_bits = bp->def_status_blk->atten_status_block.attn_bits; 2824 u32 attn_bits = le32_to_cpu(bp->def_status_blk->atten_status_block.
2799 u32 attn_ack = bp->def_status_blk->atten_status_block.attn_bits_ack; 2825 attn_bits);
2826 u32 attn_ack = le32_to_cpu(bp->def_status_blk->atten_status_block.
2827 attn_bits_ack);
2800 u32 attn_state = bp->attn_state; 2828 u32 attn_state = bp->attn_state;
2801 2829
2802 /* look for changed bits */ 2830 /* look for changed bits */
@@ -2820,7 +2848,7 @@ static void bnx2x_attn_int(struct bnx2x *bp)
2820 2848
2821static void bnx2x_sp_task(struct work_struct *work) 2849static void bnx2x_sp_task(struct work_struct *work)
2822{ 2850{
2823 struct bnx2x *bp = container_of(work, struct bnx2x, sp_task); 2851 struct bnx2x *bp = container_of(work, struct bnx2x, sp_task.work);
2824 u16 status; 2852 u16 status;
2825 2853
2826 2854
@@ -2844,7 +2872,7 @@ static void bnx2x_sp_task(struct work_struct *work)
2844 if (status & 0x2) 2872 if (status & 0x2)
2845 bp->stats_pending = 0; 2873 bp->stats_pending = 0;
2846 2874
2847 bnx2x_ack_sb(bp, DEF_SB_ID, ATTENTION_ID, bp->def_att_idx, 2875 bnx2x_ack_sb(bp, DEF_SB_ID, ATTENTION_ID, le16_to_cpu(bp->def_att_idx),
2848 IGU_INT_NOP, 1); 2876 IGU_INT_NOP, 1);
2849 bnx2x_ack_sb(bp, DEF_SB_ID, USTORM_ID, le16_to_cpu(bp->def_u_idx), 2877 bnx2x_ack_sb(bp, DEF_SB_ID, USTORM_ID, le16_to_cpu(bp->def_u_idx),
2850 IGU_INT_NOP, 1); 2878 IGU_INT_NOP, 1);
@@ -2875,7 +2903,7 @@ static irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance)
2875 return IRQ_HANDLED; 2903 return IRQ_HANDLED;
2876#endif 2904#endif
2877 2905
2878 schedule_work(&bp->sp_task); 2906 queue_delayed_work(bnx2x_wq, &bp->sp_task, 0);
2879 2907
2880 return IRQ_HANDLED; 2908 return IRQ_HANDLED;
2881} 2909}
@@ -2892,7 +2920,7 @@ static irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance)
2892#define ADD_64(s_hi, a_hi, s_lo, a_lo) \ 2920#define ADD_64(s_hi, a_hi, s_lo, a_lo) \
2893 do { \ 2921 do { \
2894 s_lo += a_lo; \ 2922 s_lo += a_lo; \
2895 s_hi += a_hi + (s_lo < a_lo) ? 1 : 0; \ 2923 s_hi += a_hi + ((s_lo < a_lo) ? 1 : 0); \
2896 } while (0) 2924 } while (0)
2897 2925
2898/* difference = minuend - subtrahend */ 2926/* difference = minuend - subtrahend */
@@ -4496,7 +4524,7 @@ static void bnx2x_init_context(struct bnx2x *bp)
4496 4524
4497static void bnx2x_init_ind_table(struct bnx2x *bp) 4525static void bnx2x_init_ind_table(struct bnx2x *bp)
4498{ 4526{
4499 int port = BP_PORT(bp); 4527 int func = BP_FUNC(bp);
4500 int i; 4528 int i;
4501 4529
4502 if (!is_multi(bp)) 4530 if (!is_multi(bp))
@@ -4505,10 +4533,8 @@ static void bnx2x_init_ind_table(struct bnx2x *bp)
4505 DP(NETIF_MSG_IFUP, "Initializing indirection table\n"); 4533 DP(NETIF_MSG_IFUP, "Initializing indirection table\n");
4506 for (i = 0; i < TSTORM_INDIRECTION_TABLE_SIZE; i++) 4534 for (i = 0; i < TSTORM_INDIRECTION_TABLE_SIZE; i++)
4507 REG_WR8(bp, BAR_TSTRORM_INTMEM + 4535 REG_WR8(bp, BAR_TSTRORM_INTMEM +
4508 TSTORM_INDIRECTION_TABLE_OFFSET(port) + i, 4536 TSTORM_INDIRECTION_TABLE_OFFSET(func) + i,
4509 i % bp->num_queues); 4537 BP_CL_ID(bp) + (i % bp->num_queues));
4510
4511 REG_WR(bp, PRS_REG_A_PRSU_20, 0xf);
4512} 4538}
4513 4539
4514static void bnx2x_set_client_config(struct bnx2x *bp) 4540static void bnx2x_set_client_config(struct bnx2x *bp)
@@ -4517,12 +4543,12 @@ static void bnx2x_set_client_config(struct bnx2x *bp)
4517 int port = BP_PORT(bp); 4543 int port = BP_PORT(bp);
4518 int i; 4544 int i;
4519 4545
4520 tstorm_client.mtu = bp->dev->mtu + ETH_OVREHEAD; 4546 tstorm_client.mtu = bp->dev->mtu;
4521 tstorm_client.statistics_counter_id = BP_CL_ID(bp); 4547 tstorm_client.statistics_counter_id = BP_CL_ID(bp);
4522 tstorm_client.config_flags = 4548 tstorm_client.config_flags =
4523 TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE; 4549 TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE;
4524#ifdef BCM_VLAN 4550#ifdef BCM_VLAN
4525 if (bp->rx_mode && bp->vlgrp) { 4551 if (bp->rx_mode && bp->vlgrp && (bp->flags & HW_VLAN_RX_FLAG)) {
4526 tstorm_client.config_flags |= 4552 tstorm_client.config_flags |=
4527 TSTORM_ETH_CLIENT_CONFIG_VLAN_REMOVAL_ENABLE; 4553 TSTORM_ETH_CLIENT_CONFIG_VLAN_REMOVAL_ENABLE;
4528 DP(NETIF_MSG_IFUP, "vlan removal enabled\n"); 4554 DP(NETIF_MSG_IFUP, "vlan removal enabled\n");
@@ -4531,7 +4557,7 @@ static void bnx2x_set_client_config(struct bnx2x *bp)
4531 4557
4532 if (bp->flags & TPA_ENABLE_FLAG) { 4558 if (bp->flags & TPA_ENABLE_FLAG) {
4533 tstorm_client.max_sges_for_packet = 4559 tstorm_client.max_sges_for_packet =
4534 BCM_PAGE_ALIGN(tstorm_client.mtu) >> BCM_PAGE_SHIFT; 4560 SGE_PAGE_ALIGN(tstorm_client.mtu) >> SGE_PAGE_SHIFT;
4535 tstorm_client.max_sges_for_packet = 4561 tstorm_client.max_sges_for_packet =
4536 ((tstorm_client.max_sges_for_packet + 4562 ((tstorm_client.max_sges_for_packet +
4537 PAGES_PER_SGE - 1) & (~(PAGES_PER_SGE - 1))) >> 4563 PAGES_PER_SGE - 1) & (~(PAGES_PER_SGE - 1))) >>
@@ -4714,10 +4740,11 @@ static void bnx2x_init_internal_func(struct bnx2x *bp)
4714 bp->e1hov); 4740 bp->e1hov);
4715 } 4741 }
4716 4742
4717 /* Init CQ ring mapping and aggregation size */ 4743 /* Init CQ ring mapping and aggregation size, the FW limit is 8 frags */
4718 max_agg_size = min((u32)(bp->rx_buf_size + 4744 max_agg_size =
4719 8*BCM_PAGE_SIZE*PAGES_PER_SGE), 4745 min((u32)(min((u32)8, (u32)MAX_SKB_FRAGS) *
4720 (u32)0xffff); 4746 SGE_PAGE_SIZE * PAGES_PER_SGE),
4747 (u32)0xffff);
4721 for_each_queue(bp, i) { 4748 for_each_queue(bp, i) {
4722 struct bnx2x_fastpath *fp = &bp->fp[i]; 4749 struct bnx2x_fastpath *fp = &bp->fp[i];
4723 4750
@@ -4785,6 +4812,15 @@ static void bnx2x_nic_init(struct bnx2x *bp, u32 load_code)
4785 bnx2x_init_context(bp); 4812 bnx2x_init_context(bp);
4786 bnx2x_init_internal(bp, load_code); 4813 bnx2x_init_internal(bp, load_code);
4787 bnx2x_init_ind_table(bp); 4814 bnx2x_init_ind_table(bp);
4815 bnx2x_stats_init(bp);
4816
4817 /* At this point, we are ready for interrupts */
4818 atomic_set(&bp->intr_sem, 0);
4819
4820 /* flush all before enabling interrupts */
4821 mb();
4822 mmiowb();
4823
4788 bnx2x_int_enable(bp); 4824 bnx2x_int_enable(bp);
4789} 4825}
4790 4826
@@ -5134,7 +5170,6 @@ static int bnx2x_init_common(struct bnx2x *bp)
5134 REG_WR(bp, PXP2_REG_RQ_SRC_ENDIAN_M, 1); 5170 REG_WR(bp, PXP2_REG_RQ_SRC_ENDIAN_M, 1);
5135 REG_WR(bp, PXP2_REG_RQ_CDU_ENDIAN_M, 1); 5171 REG_WR(bp, PXP2_REG_RQ_CDU_ENDIAN_M, 1);
5136 REG_WR(bp, PXP2_REG_RQ_DBG_ENDIAN_M, 1); 5172 REG_WR(bp, PXP2_REG_RQ_DBG_ENDIAN_M, 1);
5137 REG_WR(bp, PXP2_REG_RQ_HC_ENDIAN_M, 1);
5138 5173
5139/* REG_WR(bp, PXP2_REG_RD_PBF_SWAP_MODE, 1); */ 5174/* REG_WR(bp, PXP2_REG_RD_PBF_SWAP_MODE, 1); */
5140 REG_WR(bp, PXP2_REG_RD_QM_SWAP_MODE, 1); 5175 REG_WR(bp, PXP2_REG_RD_QM_SWAP_MODE, 1);
@@ -5212,6 +5247,7 @@ static int bnx2x_init_common(struct bnx2x *bp)
5212 } 5247 }
5213 5248
5214 bnx2x_init_block(bp, PRS_COMMON_START, PRS_COMMON_END); 5249 bnx2x_init_block(bp, PRS_COMMON_START, PRS_COMMON_END);
5250 REG_WR(bp, PRS_REG_A_PRSU_20, 0xf);
5215 /* set NIC mode */ 5251 /* set NIC mode */
5216 REG_WR(bp, PRS_REG_NIC_MODE, 1); 5252 REG_WR(bp, PRS_REG_NIC_MODE, 1);
5217 if (CHIP_IS_E1H(bp)) 5253 if (CHIP_IS_E1H(bp))
@@ -6393,17 +6429,8 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6393 } 6429 }
6394 } 6430 }
6395 6431
6396 bnx2x_stats_init(bp);
6397
6398 bp->state = BNX2X_STATE_OPENING_WAIT4_PORT; 6432 bp->state = BNX2X_STATE_OPENING_WAIT4_PORT;
6399 6433
6400 /* Enable Rx interrupt handling before sending the ramrod
6401 as it's completed on Rx FP queue */
6402 bnx2x_napi_enable(bp);
6403
6404 /* Enable interrupt handling */
6405 atomic_set(&bp->intr_sem, 0);
6406
6407 rc = bnx2x_setup_leading(bp); 6434 rc = bnx2x_setup_leading(bp);
6408 if (rc) { 6435 if (rc) {
6409 BNX2X_ERR("Setup leading failed!\n"); 6436 BNX2X_ERR("Setup leading failed!\n");
@@ -7501,7 +7528,7 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp)
7501 7528
7502 mutex_init(&bp->port.phy_mutex); 7529 mutex_init(&bp->port.phy_mutex);
7503 7530
7504 INIT_WORK(&bp->sp_task, bnx2x_sp_task); 7531 INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task);
7505 INIT_WORK(&bp->reset_task, bnx2x_reset_task); 7532 INIT_WORK(&bp->reset_task, bnx2x_reset_task);
7506 7533
7507 rc = bnx2x_get_hwinfo(bp); 7534 rc = bnx2x_get_hwinfo(bp);
@@ -8727,6 +8754,8 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode, u8 link_up)
8727 tx_bd->general_data = ((UNICAST_ADDRESS << 8754 tx_bd->general_data = ((UNICAST_ADDRESS <<
8728 ETH_TX_BD_ETH_ADDR_TYPE_SHIFT) | 1); 8755 ETH_TX_BD_ETH_ADDR_TYPE_SHIFT) | 1);
8729 8756
8757 wmb();
8758
8730 fp->hw_tx_prods->bds_prod = 8759 fp->hw_tx_prods->bds_prod =
8731 cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + 1); 8760 cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + 1);
8732 mb(); /* FW restriction: must not reorder writing nbd and packets */ 8761 mb(); /* FW restriction: must not reorder writing nbd and packets */
@@ -8778,7 +8807,6 @@ test_loopback_rx_exit:
8778 /* Update producers */ 8807 /* Update producers */
8779 bnx2x_update_rx_prod(bp, fp, fp->rx_bd_prod, fp->rx_comp_prod, 8808 bnx2x_update_rx_prod(bp, fp, fp->rx_bd_prod, fp->rx_comp_prod,
8780 fp->rx_sge_prod); 8809 fp->rx_sge_prod);
8781 mmiowb(); /* keep prod updates ordered */
8782 8810
8783test_loopback_exit: 8811test_loopback_exit:
8784 bp->link_params.loopback_mode = LOOPBACK_NONE; 8812 bp->link_params.loopback_mode = LOOPBACK_NONE;
@@ -9549,11 +9577,14 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
9549 "sending pkt %u @%p next_idx %u bd %u @%p\n", 9577 "sending pkt %u @%p next_idx %u bd %u @%p\n",
9550 pkt_prod, tx_buf, fp->tx_pkt_prod, bd_prod, tx_bd); 9578 pkt_prod, tx_buf, fp->tx_pkt_prod, bd_prod, tx_bd);
9551 9579
9552 if ((bp->vlgrp != NULL) && vlan_tx_tag_present(skb)) { 9580#ifdef BCM_VLAN
9581 if ((bp->vlgrp != NULL) && vlan_tx_tag_present(skb) &&
9582 (bp->flags & HW_VLAN_TX_FLAG)) {
9553 tx_bd->vlan = cpu_to_le16(vlan_tx_tag_get(skb)); 9583 tx_bd->vlan = cpu_to_le16(vlan_tx_tag_get(skb));
9554 tx_bd->bd_flags.as_bitfield |= ETH_TX_BD_FLAGS_VLAN_TAG; 9584 tx_bd->bd_flags.as_bitfield |= ETH_TX_BD_FLAGS_VLAN_TAG;
9555 vlan_off += 4; 9585 vlan_off += 4;
9556 } else 9586 } else
9587#endif
9557 tx_bd->vlan = cpu_to_le16(pkt_prod); 9588 tx_bd->vlan = cpu_to_le16(pkt_prod);
9558 9589
9559 if (xmit_type) { 9590 if (xmit_type) {
@@ -9705,6 +9736,15 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
9705 9736
9706 DP(NETIF_MSG_TX_QUEUED, "doorbell: nbd %d bd %u\n", nbd, bd_prod); 9737 DP(NETIF_MSG_TX_QUEUED, "doorbell: nbd %d bd %u\n", nbd, bd_prod);
9707 9738
9739 /*
9740 * Make sure that the BD data is updated before updating the producer
9741 * since FW might read the BD right after the producer is updated.
9742 * This is only applicable for weak-ordered memory model archs such
9743 * as IA-64. The following barrier is also mandatory since FW will
9744 * assumes packets must have BDs.
9745 */
9746 wmb();
9747
9708 fp->hw_tx_prods->bds_prod = 9748 fp->hw_tx_prods->bds_prod =
9709 cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + nbd); 9749 cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + nbd);
9710 mb(); /* FW restriction: must not reorder writing nbd and packets */ 9750 mb(); /* FW restriction: must not reorder writing nbd and packets */
@@ -9718,6 +9758,9 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
9718 dev->trans_start = jiffies; 9758 dev->trans_start = jiffies;
9719 9759
9720 if (unlikely(bnx2x_tx_avail(fp) < MAX_SKB_FRAGS + 3)) { 9760 if (unlikely(bnx2x_tx_avail(fp) < MAX_SKB_FRAGS + 3)) {
9761 /* We want bnx2x_tx_int to "see" the updated tx_bd_prod
9762 if we put Tx into XOFF state. */
9763 smp_mb();
9721 netif_stop_queue(dev); 9764 netif_stop_queue(dev);
9722 bp->eth_stats.driver_xoff++; 9765 bp->eth_stats.driver_xoff++;
9723 if (bnx2x_tx_avail(fp) >= MAX_SKB_FRAGS + 3) 9766 if (bnx2x_tx_avail(fp) >= MAX_SKB_FRAGS + 3)
@@ -9987,6 +10030,16 @@ static void bnx2x_vlan_rx_register(struct net_device *dev,
9987 struct bnx2x *bp = netdev_priv(dev); 10030 struct bnx2x *bp = netdev_priv(dev);
9988 10031
9989 bp->vlgrp = vlgrp; 10032 bp->vlgrp = vlgrp;
10033
10034 /* Set flags according to the required capabilities */
10035 bp->flags &= ~(HW_VLAN_RX_FLAG | HW_VLAN_TX_FLAG);
10036
10037 if (dev->features & NETIF_F_HW_VLAN_TX)
10038 bp->flags |= HW_VLAN_TX_FLAG;
10039
10040 if (dev->features & NETIF_F_HW_VLAN_RX)
10041 bp->flags |= HW_VLAN_RX_FLAG;
10042
9990 if (netif_running(dev)) 10043 if (netif_running(dev))
9991 bnx2x_set_client_config(bp); 10044 bnx2x_set_client_config(bp);
9992} 10045}
@@ -10143,6 +10196,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
10143 dev->features |= NETIF_F_HIGHDMA; 10196 dev->features |= NETIF_F_HIGHDMA;
10144#ifdef BCM_VLAN 10197#ifdef BCM_VLAN
10145 dev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); 10198 dev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
10199 bp->flags |= (HW_VLAN_RX_FLAG | HW_VLAN_TX_FLAG);
10146#endif 10200#endif
10147 dev->features |= (NETIF_F_TSO | NETIF_F_TSO_ECN); 10201 dev->features |= (NETIF_F_TSO | NETIF_F_TSO_ECN);
10148 dev->features |= NETIF_F_TSO6; 10202 dev->features |= NETIF_F_TSO6;
@@ -10519,12 +10573,20 @@ static struct pci_driver bnx2x_pci_driver = {
10519 10573
10520static int __init bnx2x_init(void) 10574static int __init bnx2x_init(void)
10521{ 10575{
10576 bnx2x_wq = create_singlethread_workqueue("bnx2x");
10577 if (bnx2x_wq == NULL) {
10578 printk(KERN_ERR PFX "Cannot create workqueue\n");
10579 return -ENOMEM;
10580 }
10581
10522 return pci_register_driver(&bnx2x_pci_driver); 10582 return pci_register_driver(&bnx2x_pci_driver);
10523} 10583}
10524 10584
10525static void __exit bnx2x_cleanup(void) 10585static void __exit bnx2x_cleanup(void)
10526{ 10586{
10527 pci_unregister_driver(&bnx2x_pci_driver); 10587 pci_unregister_driver(&bnx2x_pci_driver);
10588
10589 destroy_workqueue(bnx2x_wq);
10528} 10590}
10529 10591
10530module_init(bnx2x_init); 10592module_init(bnx2x_init);
diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index 5b346f9eaa8b..a89d8cc51205 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -50,12 +50,17 @@ struct vlan_group;
50struct adapter; 50struct adapter;
51struct sge_qset; 51struct sge_qset;
52 52
53enum { /* rx_offload flags */
54 T3_RX_CSUM = 1 << 0,
55 T3_LRO = 1 << 1,
56};
57
53struct port_info { 58struct port_info {
54 struct adapter *adapter; 59 struct adapter *adapter;
55 struct vlan_group *vlan_grp; 60 struct vlan_group *vlan_grp;
56 struct sge_qset *qs; 61 struct sge_qset *qs;
57 u8 port_id; 62 u8 port_id;
58 u8 rx_csum_offload; 63 u8 rx_offload;
59 u8 nqsets; 64 u8 nqsets;
60 u8 first_qset; 65 u8 first_qset;
61 struct cphy phy; 66 struct cphy phy;
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 2847f947499d..0089746b8d02 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -546,7 +546,7 @@ static int setup_sge_qsets(struct adapter *adap)
546 pi->qs = &adap->sge.qs[pi->first_qset]; 546 pi->qs = &adap->sge.qs[pi->first_qset];
547 for (j = pi->first_qset; j < pi->first_qset + pi->nqsets; 547 for (j = pi->first_qset; j < pi->first_qset + pi->nqsets;
548 ++j, ++qset_idx) { 548 ++j, ++qset_idx) {
549 set_qset_lro(dev, qset_idx, pi->rx_csum_offload); 549 set_qset_lro(dev, qset_idx, pi->rx_offload & T3_LRO);
550 err = t3_sge_alloc_qset(adap, qset_idx, 1, 550 err = t3_sge_alloc_qset(adap, qset_idx, 1,
551 (adap->flags & USING_MSIX) ? qset_idx + 1 : 551 (adap->flags & USING_MSIX) ? qset_idx + 1 :
552 irq_idx, 552 irq_idx,
@@ -1657,17 +1657,19 @@ static u32 get_rx_csum(struct net_device *dev)
1657{ 1657{
1658 struct port_info *p = netdev_priv(dev); 1658 struct port_info *p = netdev_priv(dev);
1659 1659
1660 return p->rx_csum_offload; 1660 return p->rx_offload & T3_RX_CSUM;
1661} 1661}
1662 1662
1663static int set_rx_csum(struct net_device *dev, u32 data) 1663static int set_rx_csum(struct net_device *dev, u32 data)
1664{ 1664{
1665 struct port_info *p = netdev_priv(dev); 1665 struct port_info *p = netdev_priv(dev);
1666 1666
1667 p->rx_csum_offload = data; 1667 if (data) {
1668 if (!data) { 1668 p->rx_offload |= T3_RX_CSUM;
1669 } else {
1669 int i; 1670 int i;
1670 1671
1672 p->rx_offload &= ~(T3_RX_CSUM | T3_LRO);
1671 for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) 1673 for (i = p->first_qset; i < p->first_qset + p->nqsets; i++)
1672 set_qset_lro(dev, i, 0); 1674 set_qset_lro(dev, i, 0);
1673 } 1675 }
@@ -1830,15 +1832,18 @@ static int cxgb3_set_flags(struct net_device *dev, u32 data)
1830 int i; 1832 int i;
1831 1833
1832 if (data & ETH_FLAG_LRO) { 1834 if (data & ETH_FLAG_LRO) {
1833 if (!pi->rx_csum_offload) 1835 if (!(pi->rx_offload & T3_RX_CSUM))
1834 return -EINVAL; 1836 return -EINVAL;
1835 1837
1838 pi->rx_offload |= T3_LRO;
1836 for (i = pi->first_qset; i < pi->first_qset + pi->nqsets; i++) 1839 for (i = pi->first_qset; i < pi->first_qset + pi->nqsets; i++)
1837 set_qset_lro(dev, i, 1); 1840 set_qset_lro(dev, i, 1);
1838 1841
1839 } else 1842 } else {
1843 pi->rx_offload &= ~T3_LRO;
1840 for (i = pi->first_qset; i < pi->first_qset + pi->nqsets; i++) 1844 for (i = pi->first_qset; i < pi->first_qset + pi->nqsets; i++)
1841 set_qset_lro(dev, i, 0); 1845 set_qset_lro(dev, i, 0);
1846 }
1842 1847
1843 return 0; 1848 return 0;
1844} 1849}
@@ -1926,7 +1931,7 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
1926 pi = adap2pinfo(adapter, i); 1931 pi = adap2pinfo(adapter, i);
1927 if (t.qset_idx >= pi->first_qset && 1932 if (t.qset_idx >= pi->first_qset &&
1928 t.qset_idx < pi->first_qset + pi->nqsets && 1933 t.qset_idx < pi->first_qset + pi->nqsets &&
1929 !pi->rx_csum_offload) 1934 !(pi->rx_offload & T3_RX_CSUM))
1930 return -EINVAL; 1935 return -EINVAL;
1931 } 1936 }
1932 1937
@@ -2946,7 +2951,7 @@ static int __devinit init_one(struct pci_dev *pdev,
2946 adapter->port[i] = netdev; 2951 adapter->port[i] = netdev;
2947 pi = netdev_priv(netdev); 2952 pi = netdev_priv(netdev);
2948 pi->adapter = adapter; 2953 pi->adapter = adapter;
2949 pi->rx_csum_offload = 1; 2954 pi->rx_offload = T3_RX_CSUM | T3_LRO;
2950 pi->port_id = i; 2955 pi->port_id = i;
2951 netif_carrier_off(netdev); 2956 netif_carrier_off(netdev);
2952 netif_tx_stop_all_queues(netdev); 2957 netif_tx_stop_all_queues(netdev);
@@ -2955,6 +2960,7 @@ static int __devinit init_one(struct pci_dev *pdev,
2955 netdev->mem_end = mmio_start + mmio_len - 1; 2960 netdev->mem_end = mmio_start + mmio_len - 1;
2956 netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO; 2961 netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO;
2957 netdev->features |= NETIF_F_LLTX; 2962 netdev->features |= NETIF_F_LLTX;
2963 netdev->features |= NETIF_F_LRO;
2958 if (pci_using_dac) 2964 if (pci_using_dac)
2959 netdev->features |= NETIF_F_HIGHDMA; 2965 netdev->features |= NETIF_F_HIGHDMA;
2960 2966
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 6c641a889471..14f9fb3e8795 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1932,7 +1932,7 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq,
1932 skb_pull(skb, sizeof(*p) + pad); 1932 skb_pull(skb, sizeof(*p) + pad);
1933 skb->protocol = eth_type_trans(skb, adap->port[p->iff]); 1933 skb->protocol = eth_type_trans(skb, adap->port[p->iff]);
1934 pi = netdev_priv(skb->dev); 1934 pi = netdev_priv(skb->dev);
1935 if (pi->rx_csum_offload && p->csum_valid && p->csum == htons(0xffff) && 1935 if ((pi->rx_offload & T3_RX_CSUM) && p->csum_valid && p->csum == htons(0xffff) &&
1936 !p->fragment) { 1936 !p->fragment) {
1937 qs->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++; 1937 qs->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++;
1938 skb->ip_summed = CHECKSUM_UNNECESSARY; 1938 skb->ip_summed = CHECKSUM_UNNECESSARY;
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index f2a5963b5a95..e415e81ecd3e 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -390,7 +390,8 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
390} 390}
391 391
392static DEFINE_MUTEX(nvm_mutex); 392static DEFINE_MUTEX(nvm_mutex);
393static pid_t nvm_owner = -1; 393static pid_t nvm_owner_pid = -1;
394static char nvm_owner_name[TASK_COMM_LEN] = "";
394 395
395/** 396/**
396 * e1000_acquire_swflag_ich8lan - Acquire software control flag 397 * e1000_acquire_swflag_ich8lan - Acquire software control flag
@@ -408,11 +409,15 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
408 might_sleep(); 409 might_sleep();
409 410
410 if (!mutex_trylock(&nvm_mutex)) { 411 if (!mutex_trylock(&nvm_mutex)) {
411 WARN(1, KERN_ERR "e1000e mutex contention. Owned by pid %d\n", 412 WARN(1, KERN_ERR "e1000e mutex contention. Owned by process "
412 nvm_owner); 413 "%s (pid %d), required by process %s (pid %d)\n",
414 nvm_owner_name, nvm_owner_pid,
415 current->comm, current->pid);
416
413 mutex_lock(&nvm_mutex); 417 mutex_lock(&nvm_mutex);
414 } 418 }
415 nvm_owner = current->pid; 419 nvm_owner_pid = current->pid;
420 strncpy(nvm_owner_name, current->comm, TASK_COMM_LEN);
416 421
417 while (timeout) { 422 while (timeout) {
418 extcnf_ctrl = er32(EXTCNF_CTRL); 423 extcnf_ctrl = er32(EXTCNF_CTRL);
@@ -430,7 +435,8 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
430 hw_dbg(hw, "FW or HW has locked the resource for too long.\n"); 435 hw_dbg(hw, "FW or HW has locked the resource for too long.\n");
431 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; 436 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
432 ew32(EXTCNF_CTRL, extcnf_ctrl); 437 ew32(EXTCNF_CTRL, extcnf_ctrl);
433 nvm_owner = -1; 438 nvm_owner_pid = -1;
439 strcpy(nvm_owner_name, "");
434 mutex_unlock(&nvm_mutex); 440 mutex_unlock(&nvm_mutex);
435 return -E1000_ERR_CONFIG; 441 return -E1000_ERR_CONFIG;
436 } 442 }
@@ -454,7 +460,8 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
454 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; 460 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
455 ew32(EXTCNF_CTRL, extcnf_ctrl); 461 ew32(EXTCNF_CTRL, extcnf_ctrl);
456 462
457 nvm_owner = -1; 463 nvm_owner_pid = -1;
464 strcpy(nvm_owner_name, "");
458 mutex_unlock(&nvm_mutex); 465 mutex_unlock(&nvm_mutex);
459} 466}
460 467
diff --git a/drivers/net/e2100.c b/drivers/net/e2100.c
index 20eb05cddb83..b07ba1924de0 100644
--- a/drivers/net/e2100.c
+++ b/drivers/net/e2100.c
@@ -169,6 +169,7 @@ static const struct net_device_ops e21_netdev_ops = {
169 .ndo_get_stats = ei_get_stats, 169 .ndo_get_stats = ei_get_stats,
170 .ndo_set_multicast_list = ei_set_multicast_list, 170 .ndo_set_multicast_list = ei_set_multicast_list,
171 .ndo_validate_addr = eth_validate_addr, 171 .ndo_validate_addr = eth_validate_addr,
172 .ndo_set_mac_address = eth_mac_addr,
172 .ndo_change_mtu = eth_change_mtu, 173 .ndo_change_mtu = eth_change_mtu,
173#ifdef CONFIG_NET_POLL_CONTROLLER 174#ifdef CONFIG_NET_POLL_CONTROLLER
174 .ndo_poll_controller = ei_poll, 175 .ndo_poll_controller = ei_poll,
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index e3131ea629cd..dfe92264e825 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -132,7 +132,7 @@ void ehea_dump(void *adr, int len, char *msg)
132 int x; 132 int x;
133 unsigned char *deb = adr; 133 unsigned char *deb = adr;
134 for (x = 0; x < len; x += 16) { 134 for (x = 0; x < len; x += 16) {
135 printk(DRV_NAME " %s adr=%p ofs=%04x %016lx %016lx\n", msg, 135 printk(DRV_NAME " %s adr=%p ofs=%04x %016llx %016llx\n", msg,
136 deb, x, *((u64 *)&deb[0]), *((u64 *)&deb[8])); 136 deb, x, *((u64 *)&deb[0]), *((u64 *)&deb[8]));
137 deb += 16; 137 deb += 16;
138 } 138 }
@@ -883,7 +883,7 @@ static irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param)
883 883
884 while (eqe) { 884 while (eqe) {
885 qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry); 885 qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry);
886 ehea_error("QP aff_err: entry=0x%lx, token=0x%x", 886 ehea_error("QP aff_err: entry=0x%llx, token=0x%x",
887 eqe->entry, qp_token); 887 eqe->entry, qp_token);
888 888
889 qp = port->port_res[qp_token].qp; 889 qp = port->port_res[qp_token].qp;
@@ -1159,7 +1159,7 @@ static void ehea_parse_eqe(struct ehea_adapter *adapter, u64 eqe)
1159 netif_stop_queue(port->netdev); 1159 netif_stop_queue(port->netdev);
1160 break; 1160 break;
1161 default: 1161 default:
1162 ehea_error("unknown event code %x, eqe=0x%lX", ec, eqe); 1162 ehea_error("unknown event code %x, eqe=0x%llX", ec, eqe);
1163 break; 1163 break;
1164 } 1164 }
1165} 1165}
@@ -1971,7 +1971,7 @@ static void ehea_set_multicast_list(struct net_device *dev)
1971 } 1971 }
1972 1972
1973 if (dev->mc_count > port->adapter->max_mc_mac) { 1973 if (dev->mc_count > port->adapter->max_mc_mac) {
1974 ehea_info("Mcast registration limit reached (0x%lx). " 1974 ehea_info("Mcast registration limit reached (0x%llx). "
1975 "Use ALLMULTI!", 1975 "Use ALLMULTI!",
1976 port->adapter->max_mc_mac); 1976 port->adapter->max_mc_mac);
1977 goto out; 1977 goto out;
diff --git a/drivers/net/ehea/ehea_qmr.c b/drivers/net/ehea/ehea_qmr.c
index 225c692b5d99..49d766ebbcf4 100644
--- a/drivers/net/ehea/ehea_qmr.c
+++ b/drivers/net/ehea/ehea_qmr.c
@@ -168,7 +168,7 @@ struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter,
168 cq->fw_handle, rpage, 1); 168 cq->fw_handle, rpage, 1);
169 if (hret < H_SUCCESS) { 169 if (hret < H_SUCCESS) {
170 ehea_error("register_rpage_cq failed ehea_cq=%p " 170 ehea_error("register_rpage_cq failed ehea_cq=%p "
171 "hret=%lx counter=%i act_pages=%i", 171 "hret=%llx counter=%i act_pages=%i",
172 cq, hret, counter, cq->attr.nr_pages); 172 cq, hret, counter, cq->attr.nr_pages);
173 goto out_kill_hwq; 173 goto out_kill_hwq;
174 } 174 }
@@ -178,13 +178,13 @@ struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter,
178 178
179 if ((hret != H_SUCCESS) || (vpage)) { 179 if ((hret != H_SUCCESS) || (vpage)) {
180 ehea_error("registration of pages not " 180 ehea_error("registration of pages not "
181 "complete hret=%lx\n", hret); 181 "complete hret=%llx\n", hret);
182 goto out_kill_hwq; 182 goto out_kill_hwq;
183 } 183 }
184 } else { 184 } else {
185 if (hret != H_PAGE_REGISTERED) { 185 if (hret != H_PAGE_REGISTERED) {
186 ehea_error("CQ: registration of page failed " 186 ehea_error("CQ: registration of page failed "
187 "hret=%lx\n", hret); 187 "hret=%llx\n", hret);
188 goto out_kill_hwq; 188 goto out_kill_hwq;
189 } 189 }
190 } 190 }
@@ -986,15 +986,15 @@ void print_error_data(u64 *data)
986 length = EHEA_PAGESIZE; 986 length = EHEA_PAGESIZE;
987 987
988 if (type == 0x8) /* Queue Pair */ 988 if (type == 0x8) /* Queue Pair */
989 ehea_error("QP (resource=%lX) state: AER=0x%lX, AERR=0x%lX, " 989 ehea_error("QP (resource=%llX) state: AER=0x%llX, AERR=0x%llX, "
990 "port=%lX", resource, data[6], data[12], data[22]); 990 "port=%llX", resource, data[6], data[12], data[22]);
991 991
992 if (type == 0x4) /* Completion Queue */ 992 if (type == 0x4) /* Completion Queue */
993 ehea_error("CQ (resource=%lX) state: AER=0x%lX", resource, 993 ehea_error("CQ (resource=%llX) state: AER=0x%llX", resource,
994 data[6]); 994 data[6]);
995 995
996 if (type == 0x3) /* Event Queue */ 996 if (type == 0x3) /* Event Queue */
997 ehea_error("EQ (resource=%lX) state: AER=0x%lX", resource, 997 ehea_error("EQ (resource=%llX) state: AER=0x%llX", resource,
998 data[6]); 998 data[6]);
999 999
1000 ehea_dump(data, length, "error data"); 1000 ehea_dump(data, length, "error data");
@@ -1016,11 +1016,11 @@ void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle)
1016 rblock); 1016 rblock);
1017 1017
1018 if (ret == H_R_STATE) 1018 if (ret == H_R_STATE)
1019 ehea_error("No error data is available: %lX.", res_handle); 1019 ehea_error("No error data is available: %llX.", res_handle);
1020 else if (ret == H_SUCCESS) 1020 else if (ret == H_SUCCESS)
1021 print_error_data(rblock); 1021 print_error_data(rblock);
1022 else 1022 else
1023 ehea_error("Error data could not be fetched: %lX", res_handle); 1023 ehea_error("Error data could not be fetched: %llX", res_handle);
1024 1024
1025 kfree(rblock); 1025 kfree(rblock);
1026} 1026}
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index d039e16f2763..7d60551d538f 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -1599,6 +1599,7 @@ static const struct net_device_ops enic_netdev_ops = {
1599 .ndo_start_xmit = enic_hard_start_xmit, 1599 .ndo_start_xmit = enic_hard_start_xmit,
1600 .ndo_get_stats = enic_get_stats, 1600 .ndo_get_stats = enic_get_stats,
1601 .ndo_validate_addr = eth_validate_addr, 1601 .ndo_validate_addr = eth_validate_addr,
1602 .ndo_set_mac_address = eth_mac_addr,
1602 .ndo_set_multicast_list = enic_set_multicast_list, 1603 .ndo_set_multicast_list = enic_set_multicast_list,
1603 .ndo_change_mtu = enic_change_mtu, 1604 .ndo_change_mtu = enic_change_mtu,
1604 .ndo_vlan_rx_register = enic_vlan_rx_register, 1605 .ndo_vlan_rx_register = enic_vlan_rx_register,
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 5b68dc20168d..5b910cf63740 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -13,7 +13,7 @@
13 * Copyright (C) 2004 Andrew de Quincey (wol support) 13 * Copyright (C) 2004 Andrew de Quincey (wol support)
14 * Copyright (C) 2004 Carl-Daniel Hailfinger (invalid MAC handling, insane 14 * Copyright (C) 2004 Carl-Daniel Hailfinger (invalid MAC handling, insane
15 * IRQ rate fixes, bigendian fixes, cleanups, verification) 15 * IRQ rate fixes, bigendian fixes, cleanups, verification)
16 * Copyright (c) 2004,2005,2006,2007,2008 NVIDIA Corporation 16 * Copyright (c) 2004,2005,2006,2007,2008,2009 NVIDIA Corporation
17 * 17 *
18 * This program is free software; you can redistribute it and/or modify 18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by 19 * it under the terms of the GNU General Public License as published by
@@ -39,7 +39,7 @@
39 * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few 39 * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few
40 * superfluous timer interrupts from the nic. 40 * superfluous timer interrupts from the nic.
41 */ 41 */
42#define FORCEDETH_VERSION "0.61" 42#define FORCEDETH_VERSION "0.62"
43#define DRV_NAME "forcedeth" 43#define DRV_NAME "forcedeth"
44 44
45#include <linux/module.h> 45#include <linux/module.h>
@@ -2096,14 +2096,15 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
2096 ((skb_shinfo(skb)->frags[i].size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); 2096 ((skb_shinfo(skb)->frags[i].size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0);
2097 } 2097 }
2098 2098
2099 spin_lock_irqsave(&np->lock, flags);
2099 empty_slots = nv_get_empty_tx_slots(np); 2100 empty_slots = nv_get_empty_tx_slots(np);
2100 if (unlikely(empty_slots <= entries)) { 2101 if (unlikely(empty_slots <= entries)) {
2101 spin_lock_irqsave(&np->lock, flags);
2102 netif_stop_queue(dev); 2102 netif_stop_queue(dev);
2103 np->tx_stop = 1; 2103 np->tx_stop = 1;
2104 spin_unlock_irqrestore(&np->lock, flags); 2104 spin_unlock_irqrestore(&np->lock, flags);
2105 return NETDEV_TX_BUSY; 2105 return NETDEV_TX_BUSY;
2106 } 2106 }
2107 spin_unlock_irqrestore(&np->lock, flags);
2107 2108
2108 start_tx = put_tx = np->put_tx.orig; 2109 start_tx = put_tx = np->put_tx.orig;
2109 2110
@@ -2214,14 +2215,15 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev)
2214 ((skb_shinfo(skb)->frags[i].size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); 2215 ((skb_shinfo(skb)->frags[i].size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0);
2215 } 2216 }
2216 2217
2218 spin_lock_irqsave(&np->lock, flags);
2217 empty_slots = nv_get_empty_tx_slots(np); 2219 empty_slots = nv_get_empty_tx_slots(np);
2218 if (unlikely(empty_slots <= entries)) { 2220 if (unlikely(empty_slots <= entries)) {
2219 spin_lock_irqsave(&np->lock, flags);
2220 netif_stop_queue(dev); 2221 netif_stop_queue(dev);
2221 np->tx_stop = 1; 2222 np->tx_stop = 1;
2222 spin_unlock_irqrestore(&np->lock, flags); 2223 spin_unlock_irqrestore(&np->lock, flags);
2223 return NETDEV_TX_BUSY; 2224 return NETDEV_TX_BUSY;
2224 } 2225 }
2226 spin_unlock_irqrestore(&np->lock, flags);
2225 2227
2226 start_tx = put_tx = np->put_tx.ex; 2228 start_tx = put_tx = np->put_tx.ex;
2227 start_tx_ctx = np->put_tx_ctx; 2229 start_tx_ctx = np->put_tx_ctx;
@@ -3403,10 +3405,10 @@ static irqreturn_t nv_nic_irq(int foo, void *data)
3403 3405
3404#ifdef CONFIG_FORCEDETH_NAPI 3406#ifdef CONFIG_FORCEDETH_NAPI
3405 if (events & NVREG_IRQ_RX_ALL) { 3407 if (events & NVREG_IRQ_RX_ALL) {
3408 spin_lock(&np->lock);
3406 netif_rx_schedule(&np->napi); 3409 netif_rx_schedule(&np->napi);
3407 3410
3408 /* Disable furthur receive irq's */ 3411 /* Disable furthur receive irq's */
3409 spin_lock(&np->lock);
3410 np->irqmask &= ~NVREG_IRQ_RX_ALL; 3412 np->irqmask &= ~NVREG_IRQ_RX_ALL;
3411 3413
3412 if (np->msi_flags & NV_MSI_X_ENABLED) 3414 if (np->msi_flags & NV_MSI_X_ENABLED)
@@ -3520,10 +3522,10 @@ static irqreturn_t nv_nic_irq_optimized(int foo, void *data)
3520 3522
3521#ifdef CONFIG_FORCEDETH_NAPI 3523#ifdef CONFIG_FORCEDETH_NAPI
3522 if (events & NVREG_IRQ_RX_ALL) { 3524 if (events & NVREG_IRQ_RX_ALL) {
3525 spin_lock(&np->lock);
3523 netif_rx_schedule(&np->napi); 3526 netif_rx_schedule(&np->napi);
3524 3527
3525 /* Disable furthur receive irq's */ 3528 /* Disable furthur receive irq's */
3526 spin_lock(&np->lock);
3527 np->irqmask &= ~NVREG_IRQ_RX_ALL; 3529 np->irqmask &= ~NVREG_IRQ_RX_ALL;
3528 3530
3529 if (np->msi_flags & NV_MSI_X_ENABLED) 3531 if (np->msi_flags & NV_MSI_X_ENABLED)
@@ -6167,19 +6169,19 @@ static struct pci_device_id pci_tbl[] = {
6167 }, 6169 },
6168 { /* MCP79 Ethernet Controller */ 6170 { /* MCP79 Ethernet Controller */
6169 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36), 6171 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36),
6170 .driver_data = DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V3|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT|DEV_HAS_GEAR_MODE, 6172 .driver_data = DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V3|DEV_HAS_TEST_EXTENDED|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT|DEV_HAS_GEAR_MODE,
6171 }, 6173 },
6172 { /* MCP79 Ethernet Controller */ 6174 { /* MCP79 Ethernet Controller */
6173 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37), 6175 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37),
6174 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V3|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT|DEV_HAS_GEAR_MODE, 6176 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V3|DEV_HAS_TEST_EXTENDED|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT|DEV_HAS_GEAR_MODE,
6175 }, 6177 },
6176 { /* MCP79 Ethernet Controller */ 6178 { /* MCP79 Ethernet Controller */
6177 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38), 6179 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38),
6178 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V3|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT|DEV_HAS_GEAR_MODE, 6180 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V3|DEV_HAS_TEST_EXTENDED|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT|DEV_HAS_GEAR_MODE,
6179 }, 6181 },
6180 { /* MCP79 Ethernet Controller */ 6182 { /* MCP79 Ethernet Controller */
6181 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39), 6183 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39),
6182 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V3|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT|DEV_HAS_GEAR_MODE, 6184 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V3|DEV_HAS_TEST_EXTENDED|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT|DEV_HAS_GEAR_MODE,
6183 }, 6185 },
6184 {0,}, 6186 {0,},
6185}; 6187};
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 4e6a9195fe5f..ce900e54d8d1 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -795,6 +795,7 @@ static int fs_enet_open(struct net_device *dev)
795 795
796 err = fs_init_phy(dev); 796 err = fs_init_phy(dev);
797 if (err) { 797 if (err) {
798 free_irq(fep->interrupt, dev);
798 if (fep->fpi->use_napi) 799 if (fep->fpi->use_napi)
799 napi_disable(&fep->napi); 800 napi_disable(&fep->napi);
800 return err; 801 return err;
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 1b8deca8b9f8..ea530673236e 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -296,6 +296,20 @@ err_out:
296 return err; 296 return err;
297} 297}
298 298
299/* Ioctl MII Interface */
300static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
301{
302 struct gfar_private *priv = netdev_priv(dev);
303
304 if (!netif_running(dev))
305 return -EINVAL;
306
307 if (!priv->phydev)
308 return -ENODEV;
309
310 return phy_mii_ioctl(priv->phydev, if_mii(rq), cmd);
311}
312
299/* Set up the ethernet device structure, private data, 313/* Set up the ethernet device structure, private data,
300 * and anything else we need before we start */ 314 * and anything else we need before we start */
301static int gfar_probe(struct of_device *ofdev, 315static int gfar_probe(struct of_device *ofdev,
@@ -366,6 +380,7 @@ static int gfar_probe(struct of_device *ofdev,
366 dev->set_multicast_list = gfar_set_multi; 380 dev->set_multicast_list = gfar_set_multi;
367 381
368 dev->ethtool_ops = &gfar_ethtool_ops; 382 dev->ethtool_ops = &gfar_ethtool_ops;
383 dev->do_ioctl = gfar_ioctl;
369 384
370 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM) { 385 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM) {
371 priv->rx_csum_enable = 1; 386 priv->rx_csum_enable = 1;
@@ -1607,10 +1622,18 @@ static int gfar_clean_tx_ring(struct net_device *dev)
1607static void gfar_schedule_cleanup(struct net_device *dev) 1622static void gfar_schedule_cleanup(struct net_device *dev)
1608{ 1623{
1609 struct gfar_private *priv = netdev_priv(dev); 1624 struct gfar_private *priv = netdev_priv(dev);
1625 unsigned long flags;
1626
1627 spin_lock_irqsave(&priv->txlock, flags);
1628 spin_lock(&priv->rxlock);
1629
1610 if (netif_rx_schedule_prep(&priv->napi)) { 1630 if (netif_rx_schedule_prep(&priv->napi)) {
1611 gfar_write(&priv->regs->imask, IMASK_RTX_DISABLED); 1631 gfar_write(&priv->regs->imask, IMASK_RTX_DISABLED);
1612 __netif_rx_schedule(&priv->napi); 1632 __netif_rx_schedule(&priv->napi);
1613 } 1633 }
1634
1635 spin_unlock(&priv->rxlock);
1636 spin_unlock_irqrestore(&priv->txlock, flags);
1614} 1637}
1615 1638
1616/* Interrupt Handler for Transmit complete */ 1639/* Interrupt Handler for Transmit complete */
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index 32200227c923..7e8b3c59a7d6 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -576,6 +576,7 @@ static const struct net_device_ops hamachi_netdev_ops = {
576 .ndo_set_multicast_list = set_rx_mode, 576 .ndo_set_multicast_list = set_rx_mode,
577 .ndo_change_mtu = eth_change_mtu, 577 .ndo_change_mtu = eth_change_mtu,
578 .ndo_validate_addr = eth_validate_addr, 578 .ndo_validate_addr = eth_validate_addr,
579 .ndo_set_mac_address = eth_mac_addr,
579 .ndo_tx_timeout = hamachi_tx_timeout, 580 .ndo_tx_timeout = hamachi_tx_timeout,
580 .ndo_do_ioctl = netdev_ioctl, 581 .ndo_do_ioctl = netdev_ioctl,
581}; 582};
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index 50f1e172ee8f..2d4089894ec7 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -717,11 +717,12 @@ static int sixpack_ioctl(struct tty_struct *tty, struct file *file,
717 unsigned int cmd, unsigned long arg) 717 unsigned int cmd, unsigned long arg)
718{ 718{
719 struct sixpack *sp = sp_get(tty); 719 struct sixpack *sp = sp_get(tty);
720 struct net_device *dev = sp->dev; 720 struct net_device *dev;
721 unsigned int tmp, err; 721 unsigned int tmp, err;
722 722
723 if (!sp) 723 if (!sp)
724 return -ENXIO; 724 return -ENXIO;
725 dev = sp->dev;
725 726
726 switch(cmd) { 727 switch(cmd) {
727 case SIOCGIFNAME: 728 case SIOCGIFNAME:
diff --git a/drivers/net/hp-plus.c b/drivers/net/hp-plus.c
index b507dbc16e62..5e070f446635 100644
--- a/drivers/net/hp-plus.c
+++ b/drivers/net/hp-plus.c
@@ -166,6 +166,7 @@ static const struct net_device_ops hpp_netdev_ops = {
166 .ndo_get_stats = eip_get_stats, 166 .ndo_get_stats = eip_get_stats,
167 .ndo_set_multicast_list = eip_set_multicast_list, 167 .ndo_set_multicast_list = eip_set_multicast_list,
168 .ndo_validate_addr = eth_validate_addr, 168 .ndo_validate_addr = eth_validate_addr,
169 .ndo_set_mac_address = eth_mac_addr,
169 .ndo_change_mtu = eth_change_mtu, 170 .ndo_change_mtu = eth_change_mtu,
170#ifdef CONFIG_NET_POLL_CONTROLLER 171#ifdef CONFIG_NET_POLL_CONTROLLER
171 .ndo_poll_controller = eip_poll, 172 .ndo_poll_controller = eip_poll,
diff --git a/drivers/net/hydra.c b/drivers/net/hydra.c
index 9cb38a8d4387..8ac0930c183c 100644
--- a/drivers/net/hydra.c
+++ b/drivers/net/hydra.c
@@ -103,6 +103,7 @@ static const struct net_device_ops hydra_netdev_ops = {
103 .ndo_get_stats = ei_get_stats, 103 .ndo_get_stats = ei_get_stats,
104 .ndo_set_multicast_list = ei_set_multicast_list, 104 .ndo_set_multicast_list = ei_set_multicast_list,
105 .ndo_validate_addr = eth_validate_addr, 105 .ndo_validate_addr = eth_validate_addr,
106 .ndo_set_mac_address = eth_mac_addr,
106 .ndo_change_mtu = eth_change_mtu, 107 .ndo_change_mtu = eth_change_mtu,
107#ifdef CONFIG_NET_POLL_CONTROLLER 108#ifdef CONFIG_NET_POLL_CONTROLLER
108 .ndo_poll_controller = ei_poll, 109 .ndo_poll_controller = ei_poll,
diff --git a/drivers/net/ibm_newemac/mal.c b/drivers/net/ibm_newemac/mal.c
index ecf9798987fa..2a2fc17b2878 100644
--- a/drivers/net/ibm_newemac/mal.c
+++ b/drivers/net/ibm_newemac/mal.c
@@ -613,7 +613,9 @@ static int __devinit mal_probe(struct of_device *ofdev,
613 INIT_LIST_HEAD(&mal->list); 613 INIT_LIST_HEAD(&mal->list);
614 spin_lock_init(&mal->lock); 614 spin_lock_init(&mal->lock);
615 615
616 netif_napi_add(NULL, &mal->napi, mal_poll, 616 init_dummy_netdev(&mal->dummy_dev);
617
618 netif_napi_add(&mal->dummy_dev, &mal->napi, mal_poll,
617 CONFIG_IBM_NEW_EMAC_POLL_WEIGHT); 619 CONFIG_IBM_NEW_EMAC_POLL_WEIGHT);
618 620
619 /* Load power-on reset defaults */ 621 /* Load power-on reset defaults */
diff --git a/drivers/net/ibm_newemac/mal.h b/drivers/net/ibm_newemac/mal.h
index 2f0a87360844..9ededfbf0726 100644
--- a/drivers/net/ibm_newemac/mal.h
+++ b/drivers/net/ibm_newemac/mal.h
@@ -214,6 +214,8 @@ struct mal_instance {
214 int index; 214 int index;
215 spinlock_t lock; 215 spinlock_t lock;
216 216
217 struct net_device dummy_dev;
218
217 unsigned int features; 219 unsigned int features;
218}; 220};
219 221
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index ca3bb9f7321b..dfa6348ac1dc 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -602,7 +602,7 @@ static int ibmveth_open(struct net_device *netdev)
602 602
603 if(lpar_rc != H_SUCCESS) { 603 if(lpar_rc != H_SUCCESS) {
604 ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc); 604 ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc);
605 ibmveth_error_printk("buffer TCE:0x%lx filter TCE:0x%lx rxq desc:0x%lx MAC:0x%lx\n", 605 ibmveth_error_printk("buffer TCE:0x%llx filter TCE:0x%llx rxq desc:0x%llx MAC:0x%llx\n",
606 adapter->buffer_list_dma, 606 adapter->buffer_list_dma,
607 adapter->filter_list_dma, 607 adapter->filter_list_dma,
608 rxq_desc.desc, 608 rxq_desc.desc,
@@ -1378,13 +1378,13 @@ static int ibmveth_show(struct seq_file *seq, void *v)
1378 seq_printf(seq, "Firmware MAC: %pM\n", firmware_mac); 1378 seq_printf(seq, "Firmware MAC: %pM\n", firmware_mac);
1379 1379
1380 seq_printf(seq, "\nAdapter Statistics:\n"); 1380 seq_printf(seq, "\nAdapter Statistics:\n");
1381 seq_printf(seq, " TX: vio_map_single failres: %ld\n", adapter->tx_map_failed); 1381 seq_printf(seq, " TX: vio_map_single failres: %lld\n", adapter->tx_map_failed);
1382 seq_printf(seq, " send failures: %ld\n", adapter->tx_send_failed); 1382 seq_printf(seq, " send failures: %lld\n", adapter->tx_send_failed);
1383 seq_printf(seq, " RX: replenish task cycles: %ld\n", adapter->replenish_task_cycles); 1383 seq_printf(seq, " RX: replenish task cycles: %lld\n", adapter->replenish_task_cycles);
1384 seq_printf(seq, " alloc_skb_failures: %ld\n", adapter->replenish_no_mem); 1384 seq_printf(seq, " alloc_skb_failures: %lld\n", adapter->replenish_no_mem);
1385 seq_printf(seq, " add buffer failures: %ld\n", adapter->replenish_add_buff_failure); 1385 seq_printf(seq, " add buffer failures: %lld\n", adapter->replenish_add_buff_failure);
1386 seq_printf(seq, " invalid buffers: %ld\n", adapter->rx_invalid_buffer); 1386 seq_printf(seq, " invalid buffers: %lld\n", adapter->rx_invalid_buffer);
1387 seq_printf(seq, " no buffers: %ld\n", adapter->rx_no_buffer); 1387 seq_printf(seq, " no buffers: %lld\n", adapter->rx_no_buffer);
1388 1388
1389 return 0; 1389 return 0;
1390} 1390}
diff --git a/drivers/net/irda/au1k_ir.c b/drivers/net/irda/au1k_ir.c
index 75a1d0a86dee..941164076a2b 100644
--- a/drivers/net/irda/au1k_ir.c
+++ b/drivers/net/irda/au1k_ir.c
@@ -594,7 +594,7 @@ static int au1k_irda_rx(struct net_device *dev)
594 update_rx_stats(dev, flags, count); 594 update_rx_stats(dev, flags, count);
595 skb=alloc_skb(count+1,GFP_ATOMIC); 595 skb=alloc_skb(count+1,GFP_ATOMIC);
596 if (skb == NULL) { 596 if (skb == NULL) {
597 aup->stats.rx_dropped++; 597 aup->netdev->stats.rx_dropped++;
598 continue; 598 continue;
599 } 599 }
600 skb_reserve(skb, 1); 600 skb_reserve(skb, 1);
diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c
index 687c2d53d4d2..6f3e7f71658d 100644
--- a/drivers/net/irda/donauboe.c
+++ b/drivers/net/irda/donauboe.c
@@ -1194,13 +1194,13 @@ toshoboe_interrupt (int irq, void *dev_id)
1194 txp = txpc; 1194 txp = txpc;
1195 txpc++; 1195 txpc++;
1196 txpc %= TX_SLOTS; 1196 txpc %= TX_SLOTS;
1197 self->stats.tx_packets++; 1197 self->netdev->stats.tx_packets++;
1198 if (self->ring->tx[txpc].control & OBOE_CTL_TX_HW_OWNS) 1198 if (self->ring->tx[txpc].control & OBOE_CTL_TX_HW_OWNS)
1199 self->ring->tx[txp].control &= ~OBOE_CTL_TX_RTCENTX; 1199 self->ring->tx[txp].control &= ~OBOE_CTL_TX_RTCENTX;
1200 } 1200 }
1201 self->stats.tx_packets--; 1201 self->netdev->stats.tx_packets--;
1202#else 1202#else
1203 self->stats.tx_packets++; 1203 self->netdev->stats.tx_packets++;
1204#endif 1204#endif
1205 toshoboe_start_DMA(self, OBOE_CONFIG0H_ENTX); 1205 toshoboe_start_DMA(self, OBOE_CONFIG0H_ENTX);
1206 } 1206 }
@@ -1280,7 +1280,7 @@ dumpbufs(self->rx_bufs[self->rxs],len,'<');
1280 skb_put (skb, len); 1280 skb_put (skb, len);
1281 skb_copy_to_linear_data(skb, self->rx_bufs[self->rxs], 1281 skb_copy_to_linear_data(skb, self->rx_bufs[self->rxs],
1282 len); 1282 len);
1283 self->stats.rx_packets++; 1283 self->netdev->stats.rx_packets++;
1284 skb->dev = self->netdev; 1284 skb->dev = self->netdev;
1285 skb_reset_mac_header(skb); 1285 skb_reset_mac_header(skb);
1286 skb->protocol = htons (ETH_P_IRDA); 1286 skb->protocol = htons (ETH_P_IRDA);
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index 29118f58a141..3a22dc41b656 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -1073,7 +1073,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self)
1073{ 1073{
1074 unsigned int i; 1074 unsigned int i;
1075 int ret; 1075 int ret;
1076 char stir421x_fw_name[11]; 1076 char stir421x_fw_name[12];
1077 const struct firmware *fw; 1077 const struct firmware *fw;
1078 const unsigned char *fw_version_ptr; /* pointer to version string */ 1078 const unsigned char *fw_version_ptr; /* pointer to version string */
1079 unsigned long fw_version = 0; 1079 unsigned long fw_version = 0;
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c
index c7457f97259d..cb793c2bade2 100644
--- a/drivers/net/iseries_veth.c
+++ b/drivers/net/iseries_veth.c
@@ -429,7 +429,7 @@ SIMPLE_PORT_ATTR(promiscuous);
429SIMPLE_PORT_ATTR(num_mcast); 429SIMPLE_PORT_ATTR(num_mcast);
430CUSTOM_PORT_ATTR(lpar_map, "0x%X\n", port->lpar_map); 430CUSTOM_PORT_ATTR(lpar_map, "0x%X\n", port->lpar_map);
431CUSTOM_PORT_ATTR(stopped_map, "0x%X\n", port->stopped_map); 431CUSTOM_PORT_ATTR(stopped_map, "0x%X\n", port->stopped_map);
432CUSTOM_PORT_ATTR(mac_addr, "0x%lX\n", port->mac_addr); 432CUSTOM_PORT_ATTR(mac_addr, "0x%llX\n", port->mac_addr);
433 433
434#define GET_PORT_ATTR(_name) (&veth_port_attr_##_name.attr) 434#define GET_PORT_ATTR(_name) (&veth_port_attr_##_name.attr)
435static struct attribute *veth_port_default_attrs[] = { 435static struct attribute *veth_port_default_attrs[] = {
diff --git a/drivers/net/korina.c b/drivers/net/korina.c
index 4a5580c1126a..1d6e48e13366 100644
--- a/drivers/net/korina.c
+++ b/drivers/net/korina.c
@@ -84,7 +84,10 @@
84#define KORINA_NUM_RDS 64 /* number of receive descriptors */ 84#define KORINA_NUM_RDS 64 /* number of receive descriptors */
85#define KORINA_NUM_TDS 64 /* number of transmit descriptors */ 85#define KORINA_NUM_TDS 64 /* number of transmit descriptors */
86 86
87#define KORINA_RBSIZE 536 /* size of one resource buffer = Ether MTU */ 87/* KORINA_RBSIZE is the hardware's default maximum receive
88 * frame size in bytes. Having this hardcoded means that there
89 * is no support for MTU sizes greater than 1500. */
90#define KORINA_RBSIZE 1536 /* size of one resource buffer = Ether MTU */
88#define KORINA_RDS_MASK (KORINA_NUM_RDS - 1) 91#define KORINA_RDS_MASK (KORINA_NUM_RDS - 1)
89#define KORINA_TDS_MASK (KORINA_NUM_TDS - 1) 92#define KORINA_TDS_MASK (KORINA_NUM_TDS - 1)
90#define RD_RING_SIZE (KORINA_NUM_RDS * sizeof(struct dma_desc)) 93#define RD_RING_SIZE (KORINA_NUM_RDS * sizeof(struct dma_desc))
@@ -196,7 +199,7 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
196 struct korina_private *lp = netdev_priv(dev); 199 struct korina_private *lp = netdev_priv(dev);
197 unsigned long flags; 200 unsigned long flags;
198 u32 length; 201 u32 length;
199 u32 chain_index; 202 u32 chain_prev, chain_next;
200 struct dma_desc *td; 203 struct dma_desc *td;
201 204
202 spin_lock_irqsave(&lp->lock, flags); 205 spin_lock_irqsave(&lp->lock, flags);
@@ -228,8 +231,8 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
228 /* Setup the transmit descriptor. */ 231 /* Setup the transmit descriptor. */
229 dma_cache_inv((u32) td, sizeof(*td)); 232 dma_cache_inv((u32) td, sizeof(*td));
230 td->ca = CPHYSADDR(skb->data); 233 td->ca = CPHYSADDR(skb->data);
231 chain_index = (lp->tx_chain_tail - 1) & 234 chain_prev = (lp->tx_chain_tail - 1) & KORINA_TDS_MASK;
232 KORINA_TDS_MASK; 235 chain_next = (lp->tx_chain_tail + 1) & KORINA_TDS_MASK;
233 236
234 if (readl(&(lp->tx_dma_regs->dmandptr)) == 0) { 237 if (readl(&(lp->tx_dma_regs->dmandptr)) == 0) {
235 if (lp->tx_chain_status == desc_empty) { 238 if (lp->tx_chain_status == desc_empty) {
@@ -237,7 +240,7 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
237 td->control = DMA_COUNT(length) | 240 td->control = DMA_COUNT(length) |
238 DMA_DESC_COF | DMA_DESC_IOF; 241 DMA_DESC_COF | DMA_DESC_IOF;
239 /* Move tail */ 242 /* Move tail */
240 lp->tx_chain_tail = chain_index; 243 lp->tx_chain_tail = chain_next;
241 /* Write to NDPTR */ 244 /* Write to NDPTR */
242 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), 245 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]),
243 &lp->tx_dma_regs->dmandptr); 246 &lp->tx_dma_regs->dmandptr);
@@ -248,12 +251,12 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
248 td->control = DMA_COUNT(length) | 251 td->control = DMA_COUNT(length) |
249 DMA_DESC_COF | DMA_DESC_IOF; 252 DMA_DESC_COF | DMA_DESC_IOF;
250 /* Link to prev */ 253 /* Link to prev */
251 lp->td_ring[chain_index].control &= 254 lp->td_ring[chain_prev].control &=
252 ~DMA_DESC_COF; 255 ~DMA_DESC_COF;
253 /* Link to prev */ 256 /* Link to prev */
254 lp->td_ring[chain_index].link = CPHYSADDR(td); 257 lp->td_ring[chain_prev].link = CPHYSADDR(td);
255 /* Move tail */ 258 /* Move tail */
256 lp->tx_chain_tail = chain_index; 259 lp->tx_chain_tail = chain_next;
257 /* Write to NDPTR */ 260 /* Write to NDPTR */
258 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), 261 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]),
259 &(lp->tx_dma_regs->dmandptr)); 262 &(lp->tx_dma_regs->dmandptr));
@@ -267,17 +270,16 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
267 td->control = DMA_COUNT(length) | 270 td->control = DMA_COUNT(length) |
268 DMA_DESC_COF | DMA_DESC_IOF; 271 DMA_DESC_COF | DMA_DESC_IOF;
269 /* Move tail */ 272 /* Move tail */
270 lp->tx_chain_tail = chain_index; 273 lp->tx_chain_tail = chain_next;
271 lp->tx_chain_status = desc_filled; 274 lp->tx_chain_status = desc_filled;
272 netif_stop_queue(dev);
273 } else { 275 } else {
274 /* Update tail */ 276 /* Update tail */
275 td->control = DMA_COUNT(length) | 277 td->control = DMA_COUNT(length) |
276 DMA_DESC_COF | DMA_DESC_IOF; 278 DMA_DESC_COF | DMA_DESC_IOF;
277 lp->td_ring[chain_index].control &= 279 lp->td_ring[chain_prev].control &=
278 ~DMA_DESC_COF; 280 ~DMA_DESC_COF;
279 lp->td_ring[chain_index].link = CPHYSADDR(td); 281 lp->td_ring[chain_prev].link = CPHYSADDR(td);
280 lp->tx_chain_tail = chain_index; 282 lp->tx_chain_tail = chain_next;
281 } 283 }
282 } 284 }
283 dma_cache_wback((u32) td, sizeof(*td)); 285 dma_cache_wback((u32) td, sizeof(*td));
@@ -327,13 +329,13 @@ static irqreturn_t korina_rx_dma_interrupt(int irq, void *dev_id)
327 329
328 dmas = readl(&lp->rx_dma_regs->dmas); 330 dmas = readl(&lp->rx_dma_regs->dmas);
329 if (dmas & (DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR)) { 331 if (dmas & (DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR)) {
330 netif_rx_schedule_prep(&lp->napi);
331
332 dmasm = readl(&lp->rx_dma_regs->dmasm); 332 dmasm = readl(&lp->rx_dma_regs->dmasm);
333 writel(dmasm | (DMA_STAT_DONE | 333 writel(dmasm | (DMA_STAT_DONE |
334 DMA_STAT_HALT | DMA_STAT_ERR), 334 DMA_STAT_HALT | DMA_STAT_ERR),
335 &lp->rx_dma_regs->dmasm); 335 &lp->rx_dma_regs->dmasm);
336 336
337 netif_rx_schedule(&lp->napi);
338
337 if (dmas & DMA_STAT_ERR) 339 if (dmas & DMA_STAT_ERR)
338 printk(KERN_ERR DRV_NAME "%s: DMA error\n", dev->name); 340 printk(KERN_ERR DRV_NAME "%s: DMA error\n", dev->name);
339 341
@@ -350,15 +352,20 @@ static int korina_rx(struct net_device *dev, int limit)
350 struct dma_desc *rd = &lp->rd_ring[lp->rx_next_done]; 352 struct dma_desc *rd = &lp->rd_ring[lp->rx_next_done];
351 struct sk_buff *skb, *skb_new; 353 struct sk_buff *skb, *skb_new;
352 u8 *pkt_buf; 354 u8 *pkt_buf;
353 u32 devcs, pkt_len, dmas, rx_free_desc; 355 u32 devcs, pkt_len, dmas;
354 int count; 356 int count;
355 357
356 dma_cache_inv((u32)rd, sizeof(*rd)); 358 dma_cache_inv((u32)rd, sizeof(*rd));
357 359
358 for (count = 0; count < limit; count++) { 360 for (count = 0; count < limit; count++) {
361 skb = lp->rx_skb[lp->rx_next_done];
362 skb_new = NULL;
359 363
360 devcs = rd->devcs; 364 devcs = rd->devcs;
361 365
366 if ((KORINA_RBSIZE - (u32)DMA_COUNT(rd->control)) == 0)
367 break;
368
362 /* Update statistics counters */ 369 /* Update statistics counters */
363 if (devcs & ETH_RX_CRC) 370 if (devcs & ETH_RX_CRC)
364 dev->stats.rx_crc_errors++; 371 dev->stats.rx_crc_errors++;
@@ -381,63 +388,55 @@ static int korina_rx(struct net_device *dev, int limit)
381 * in Rc32434 (errata ref #077) */ 388 * in Rc32434 (errata ref #077) */
382 dev->stats.rx_errors++; 389 dev->stats.rx_errors++;
383 dev->stats.rx_dropped++; 390 dev->stats.rx_dropped++;
384 } 391 } else if ((devcs & ETH_RX_ROK)) {
385
386 while ((rx_free_desc = KORINA_RBSIZE - (u32)DMA_COUNT(rd->control)) != 0) {
387 /* init the var. used for the later
388 * operations within the while loop */
389 skb_new = NULL;
390 pkt_len = RCVPKT_LENGTH(devcs); 392 pkt_len = RCVPKT_LENGTH(devcs);
391 skb = lp->rx_skb[lp->rx_next_done]; 393
392 394 /* must be the (first and) last
393 if ((devcs & ETH_RX_ROK)) { 395 * descriptor then */
394 /* must be the (first and) last 396 pkt_buf = (u8 *)lp->rx_skb[lp->rx_next_done]->data;
395 * descriptor then */ 397
396 pkt_buf = (u8 *)lp->rx_skb[lp->rx_next_done]->data; 398 /* invalidate the cache */
397 399 dma_cache_inv((unsigned long)pkt_buf, pkt_len - 4);
398 /* invalidate the cache */ 400
399 dma_cache_inv((unsigned long)pkt_buf, pkt_len - 4); 401 /* Malloc up new buffer. */
400 402 skb_new = netdev_alloc_skb(dev, KORINA_RBSIZE + 2);
401 /* Malloc up new buffer. */ 403
402 skb_new = netdev_alloc_skb(dev, KORINA_RBSIZE + 2); 404 if (!skb_new)
403 405 break;
404 if (!skb_new) 406 /* Do not count the CRC */
405 break; 407 skb_put(skb, pkt_len - 4);
406 /* Do not count the CRC */ 408 skb->protocol = eth_type_trans(skb, dev);
407 skb_put(skb, pkt_len - 4); 409
408 skb->protocol = eth_type_trans(skb, dev); 410 /* Pass the packet to upper layers */
409 411 netif_receive_skb(skb);
410 /* Pass the packet to upper layers */ 412 dev->stats.rx_packets++;
411 netif_receive_skb(skb); 413 dev->stats.rx_bytes += pkt_len;
412 dev->stats.rx_packets++; 414
413 dev->stats.rx_bytes += pkt_len; 415 /* Update the mcast stats */
414 416 if (devcs & ETH_RX_MP)
415 /* Update the mcast stats */ 417 dev->stats.multicast++;
416 if (devcs & ETH_RX_MP) 418
417 dev->stats.multicast++; 419 lp->rx_skb[lp->rx_next_done] = skb_new;
418
419 lp->rx_skb[lp->rx_next_done] = skb_new;
420 }
421
422 rd->devcs = 0;
423
424 /* Restore descriptor's curr_addr */
425 if (skb_new)
426 rd->ca = CPHYSADDR(skb_new->data);
427 else
428 rd->ca = CPHYSADDR(skb->data);
429
430 rd->control = DMA_COUNT(KORINA_RBSIZE) |
431 DMA_DESC_COD | DMA_DESC_IOD;
432 lp->rd_ring[(lp->rx_next_done - 1) &
433 KORINA_RDS_MASK].control &=
434 ~DMA_DESC_COD;
435
436 lp->rx_next_done = (lp->rx_next_done + 1) & KORINA_RDS_MASK;
437 dma_cache_wback((u32)rd, sizeof(*rd));
438 rd = &lp->rd_ring[lp->rx_next_done];
439 writel(~DMA_STAT_DONE, &lp->rx_dma_regs->dmas);
440 } 420 }
421
422 rd->devcs = 0;
423
424 /* Restore descriptor's curr_addr */
425 if (skb_new)
426 rd->ca = CPHYSADDR(skb_new->data);
427 else
428 rd->ca = CPHYSADDR(skb->data);
429
430 rd->control = DMA_COUNT(KORINA_RBSIZE) |
431 DMA_DESC_COD | DMA_DESC_IOD;
432 lp->rd_ring[(lp->rx_next_done - 1) &
433 KORINA_RDS_MASK].control &=
434 ~DMA_DESC_COD;
435
436 lp->rx_next_done = (lp->rx_next_done + 1) & KORINA_RDS_MASK;
437 dma_cache_wback((u32)rd, sizeof(*rd));
438 rd = &lp->rd_ring[lp->rx_next_done];
439 writel(~DMA_STAT_DONE, &lp->rx_dma_regs->dmas);
441 } 440 }
442 441
443 dmas = readl(&lp->rx_dma_regs->dmas); 442 dmas = readl(&lp->rx_dma_regs->dmas);
@@ -623,12 +622,12 @@ korina_tx_dma_interrupt(int irq, void *dev_id)
623 dmas = readl(&lp->tx_dma_regs->dmas); 622 dmas = readl(&lp->tx_dma_regs->dmas);
624 623
625 if (dmas & (DMA_STAT_FINI | DMA_STAT_ERR)) { 624 if (dmas & (DMA_STAT_FINI | DMA_STAT_ERR)) {
626 korina_tx(dev);
627
628 dmasm = readl(&lp->tx_dma_regs->dmasm); 625 dmasm = readl(&lp->tx_dma_regs->dmasm);
629 writel(dmasm | (DMA_STAT_FINI | DMA_STAT_ERR), 626 writel(dmasm | (DMA_STAT_FINI | DMA_STAT_ERR),
630 &lp->tx_dma_regs->dmasm); 627 &lp->tx_dma_regs->dmasm);
631 628
629 korina_tx(dev);
630
632 if (lp->tx_chain_status == desc_filled && 631 if (lp->tx_chain_status == desc_filled &&
633 (readl(&(lp->tx_dma_regs->dmandptr)) == 0)) { 632 (readl(&(lp->tx_dma_regs->dmandptr)) == 0)) {
634 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), 633 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]),
@@ -901,6 +900,8 @@ static int korina_restart(struct net_device *dev)
901 900
902 korina_free_ring(dev); 901 korina_free_ring(dev);
903 902
903 napi_disable(&lp->napi);
904
904 ret = korina_init(dev); 905 ret = korina_init(dev);
905 if (ret < 0) { 906 if (ret < 0) {
906 printk(KERN_ERR DRV_NAME "%s: cannot restart device\n", 907 printk(KERN_ERR DRV_NAME "%s: cannot restart device\n",
@@ -999,14 +1000,14 @@ static int korina_open(struct net_device *dev)
999 * that handles the Done Finished 1000 * that handles the Done Finished
1000 * Ovr and Und Events */ 1001 * Ovr and Und Events */
1001 ret = request_irq(lp->rx_irq, &korina_rx_dma_interrupt, 1002 ret = request_irq(lp->rx_irq, &korina_rx_dma_interrupt,
1002 IRQF_SHARED | IRQF_DISABLED, "Korina ethernet Rx", dev); 1003 IRQF_DISABLED, "Korina ethernet Rx", dev);
1003 if (ret < 0) { 1004 if (ret < 0) {
1004 printk(KERN_ERR DRV_NAME "%s: unable to get Rx DMA IRQ %d\n", 1005 printk(KERN_ERR DRV_NAME "%s: unable to get Rx DMA IRQ %d\n",
1005 dev->name, lp->rx_irq); 1006 dev->name, lp->rx_irq);
1006 goto err_release; 1007 goto err_release;
1007 } 1008 }
1008 ret = request_irq(lp->tx_irq, &korina_tx_dma_interrupt, 1009 ret = request_irq(lp->tx_irq, &korina_tx_dma_interrupt,
1009 IRQF_SHARED | IRQF_DISABLED, "Korina ethernet Tx", dev); 1010 IRQF_DISABLED, "Korina ethernet Tx", dev);
1010 if (ret < 0) { 1011 if (ret < 0) {
1011 printk(KERN_ERR DRV_NAME "%s: unable to get Tx DMA IRQ %d\n", 1012 printk(KERN_ERR DRV_NAME "%s: unable to get Tx DMA IRQ %d\n",
1012 dev->name, lp->tx_irq); 1013 dev->name, lp->tx_irq);
@@ -1015,7 +1016,7 @@ static int korina_open(struct net_device *dev)
1015 1016
1016 /* Install handler for overrun error. */ 1017 /* Install handler for overrun error. */
1017 ret = request_irq(lp->ovr_irq, &korina_ovr_interrupt, 1018 ret = request_irq(lp->ovr_irq, &korina_ovr_interrupt,
1018 IRQF_SHARED | IRQF_DISABLED, "Ethernet Overflow", dev); 1019 IRQF_DISABLED, "Ethernet Overflow", dev);
1019 if (ret < 0) { 1020 if (ret < 0) {
1020 printk(KERN_ERR DRV_NAME"%s: unable to get OVR IRQ %d\n", 1021 printk(KERN_ERR DRV_NAME"%s: unable to get OVR IRQ %d\n",
1021 dev->name, lp->ovr_irq); 1022 dev->name, lp->ovr_irq);
@@ -1024,7 +1025,7 @@ static int korina_open(struct net_device *dev)
1024 1025
1025 /* Install handler for underflow error. */ 1026 /* Install handler for underflow error. */
1026 ret = request_irq(lp->und_irq, &korina_und_interrupt, 1027 ret = request_irq(lp->und_irq, &korina_und_interrupt,
1027 IRQF_SHARED | IRQF_DISABLED, "Ethernet Underflow", dev); 1028 IRQF_DISABLED, "Ethernet Underflow", dev);
1028 if (ret < 0) { 1029 if (ret < 0) {
1029 printk(KERN_ERR DRV_NAME "%s: unable to get UND IRQ %d\n", 1030 printk(KERN_ERR DRV_NAME "%s: unable to get UND IRQ %d\n",
1030 dev->name, lp->und_irq); 1031 dev->name, lp->und_irq);
@@ -1067,6 +1068,8 @@ static int korina_close(struct net_device *dev)
1067 1068
1068 korina_free_ring(dev); 1069 korina_free_ring(dev);
1069 1070
1071 napi_disable(&lp->napi);
1072
1070 free_irq(lp->rx_irq, dev); 1073 free_irq(lp->rx_irq, dev);
1071 free_irq(lp->tx_irq, dev); 1074 free_irq(lp->tx_irq, dev);
1072 free_irq(lp->ovr_irq, dev); 1075 free_irq(lp->ovr_irq, dev);
@@ -1089,7 +1092,6 @@ static int korina_probe(struct platform_device *pdev)
1089 return -ENOMEM; 1092 return -ENOMEM;
1090 } 1093 }
1091 SET_NETDEV_DEV(dev, &pdev->dev); 1094 SET_NETDEV_DEV(dev, &pdev->dev);
1092 platform_set_drvdata(pdev, dev);
1093 lp = netdev_priv(dev); 1095 lp = netdev_priv(dev);
1094 1096
1095 bif->dev = dev; 1097 bif->dev = dev;
diff --git a/drivers/net/mac8390.c b/drivers/net/mac8390.c
index 57716e22660c..8e884869a05b 100644
--- a/drivers/net/mac8390.c
+++ b/drivers/net/mac8390.c
@@ -486,6 +486,7 @@ static const struct net_device_ops mac8390_netdev_ops = {
486 .ndo_get_stats = ei_get_stats, 486 .ndo_get_stats = ei_get_stats,
487 .ndo_set_multicast_list = ei_set_multicast_list, 487 .ndo_set_multicast_list = ei_set_multicast_list,
488 .ndo_validate_addr = eth_validate_addr, 488 .ndo_validate_addr = eth_validate_addr,
489 .ndo_set_mac_address = eth_mac_addr,
489 .ndo_change_mtu = eth_change_mtu, 490 .ndo_change_mtu = eth_change_mtu,
490#ifdef CONFIG_NET_POLL_CONTROLLER 491#ifdef CONFIG_NET_POLL_CONTROLLER
491 .ndo_poll_controller = ei_poll, 492 .ndo_poll_controller = ei_poll,
diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c
index 15bb38d99304..9f6644a44030 100644
--- a/drivers/net/mlx4/en_netdev.c
+++ b/drivers/net/mlx4/en_netdev.c
@@ -952,6 +952,7 @@ static const struct net_device_ops mlx4_netdev_ops = {
952 .ndo_get_stats = mlx4_en_get_stats, 952 .ndo_get_stats = mlx4_en_get_stats,
953 .ndo_set_multicast_list = mlx4_en_set_multicast, 953 .ndo_set_multicast_list = mlx4_en_set_multicast,
954 .ndo_set_mac_address = mlx4_en_set_mac, 954 .ndo_set_mac_address = mlx4_en_set_mac,
955 .ndo_validate_addr = eth_validate_addr,
955 .ndo_change_mtu = mlx4_en_change_mtu, 956 .ndo_change_mtu = mlx4_en_change_mtu,
956 .ndo_tx_timeout = mlx4_en_tx_timeout, 957 .ndo_tx_timeout = mlx4_en_tx_timeout,
957 .ndo_vlan_rx_register = mlx4_en_vlan_rx_register, 958 .ndo_vlan_rx_register = mlx4_en_vlan_rx_register,
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c
index 710c79e7a2db..6ef2490d5c3e 100644
--- a/drivers/net/mlx4/main.c
+++ b/drivers/net/mlx4/main.c
@@ -912,8 +912,8 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
912 int i; 912 int i;
913 913
914 if (msi_x) { 914 if (msi_x) {
915 nreq = min(dev->caps.num_eqs - dev->caps.reserved_eqs, 915 nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs,
916 num_possible_cpus() + 1); 916 num_possible_cpus() + 1);
917 entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL); 917 entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL);
918 if (!entries) 918 if (!entries)
919 goto no_msi; 919 goto no_msi;
diff --git a/drivers/net/ne-h8300.c b/drivers/net/ne-h8300.c
index b57239171046..7bd6662d5b04 100644
--- a/drivers/net/ne-h8300.c
+++ b/drivers/net/ne-h8300.c
@@ -202,6 +202,7 @@ static const struct net_device_ops ne_netdev_ops = {
202 .ndo_get_stats = ei_get_stats, 202 .ndo_get_stats = ei_get_stats,
203 .ndo_set_multicast_list = ei_set_multicast_list, 203 .ndo_set_multicast_list = ei_set_multicast_list,
204 .ndo_validate_addr = eth_validate_addr, 204 .ndo_validate_addr = eth_validate_addr,
205 .ndo_set_mac_address = eth_mac_addr,
205 .ndo_change_mtu = eth_change_mtu, 206 .ndo_change_mtu = eth_change_mtu,
206#ifdef CONFIG_NET_POLL_CONTROLLER 207#ifdef CONFIG_NET_POLL_CONTROLLER
207 .ndo_poll_controller = ei_poll, 208 .ndo_poll_controller = ei_poll,
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
index 62f20ba211cb..f090d3b9ec94 100644
--- a/drivers/net/ne2k-pci.c
+++ b/drivers/net/ne2k-pci.c
@@ -208,6 +208,7 @@ static const struct net_device_ops ne2k_netdev_ops = {
208 .ndo_get_stats = ei_get_stats, 208 .ndo_get_stats = ei_get_stats,
209 .ndo_set_multicast_list = ei_set_multicast_list, 209 .ndo_set_multicast_list = ei_set_multicast_list,
210 .ndo_validate_addr = eth_validate_addr, 210 .ndo_validate_addr = eth_validate_addr,
211 .ndo_set_mac_address = eth_mac_addr,
211 .ndo_change_mtu = eth_change_mtu, 212 .ndo_change_mtu = eth_change_mtu,
212#ifdef CONFIG_NET_POLL_CONTROLLER 213#ifdef CONFIG_NET_POLL_CONTROLLER
213 .ndo_poll_controller = ei_poll, 214 .ndo_poll_controller = ei_poll,
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index f8e601c51da7..c11c568fd7db 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -308,27 +308,16 @@ struct netxen_ring_ctx {
308#define netxen_set_cmd_desc_ctxid(cmd_desc, var) \ 308#define netxen_set_cmd_desc_ctxid(cmd_desc, var) \
309 ((cmd_desc)->port_ctxid |= ((var) << 4 & 0xF0)) 309 ((cmd_desc)->port_ctxid |= ((var) << 4 & 0xF0))
310 310
311#define netxen_set_cmd_desc_flags(cmd_desc, val) \ 311#define netxen_set_tx_port(_desc, _port) \
312 (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \ 312 (_desc)->port_ctxid = ((_port) & 0xf) | (((_port) << 4) & 0xf0)
313 ~cpu_to_le16(0x7f)) | cpu_to_le16((val) & 0x7f) 313
314#define netxen_set_cmd_desc_opcode(cmd_desc, val) \ 314#define netxen_set_tx_flags_opcode(_desc, _flags, _opcode) \
315 (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \ 315 (_desc)->flags_opcode = \
316 ~cpu_to_le16((u16)0x3f << 7)) | cpu_to_le16(((val) & 0x3f) << 7) 316 cpu_to_le16(((_flags) & 0x7f) | (((_opcode) & 0x3f) << 7))
317 317
318#define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \ 318#define netxen_set_tx_frags_len(_desc, _frags, _len) \
319 (cmd_desc)->num_of_buffers_total_length = \ 319 (_desc)->num_of_buffers_total_length = \
320 ((cmd_desc)->num_of_buffers_total_length & \ 320 cpu_to_le32(((_frags) & 0xff) | (((_len) & 0xffffff) << 8))
321 ~cpu_to_le32(0xff)) | cpu_to_le32((val) & 0xff)
322#define netxen_set_cmd_desc_totallength(cmd_desc, val) \
323 (cmd_desc)->num_of_buffers_total_length = \
324 ((cmd_desc)->num_of_buffers_total_length & \
325 ~cpu_to_le32((u32)0xffffff << 8)) | \
326 cpu_to_le32(((val) & 0xffffff) << 8)
327
328#define netxen_get_cmd_desc_opcode(cmd_desc) \
329 ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003f)
330#define netxen_get_cmd_desc_totallength(cmd_desc) \
331 ((le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) & 0xffffff)
332 321
333struct cmd_desc_type0 { 322struct cmd_desc_type0 {
334 u8 tcp_hdr_offset; /* For LSO only */ 323 u8 tcp_hdr_offset; /* For LSO only */
@@ -510,7 +499,8 @@ typedef enum {
510 NETXEN_BRDTYPE_P3_10G_SFP_CT = 0x002a, 499 NETXEN_BRDTYPE_P3_10G_SFP_CT = 0x002a,
511 NETXEN_BRDTYPE_P3_10G_SFP_QT = 0x002b, 500 NETXEN_BRDTYPE_P3_10G_SFP_QT = 0x002b,
512 NETXEN_BRDTYPE_P3_10G_CX4 = 0x0031, 501 NETXEN_BRDTYPE_P3_10G_CX4 = 0x0031,
513 NETXEN_BRDTYPE_P3_10G_XFP = 0x0032 502 NETXEN_BRDTYPE_P3_10G_XFP = 0x0032,
503 NETXEN_BRDTYPE_P3_10G_TP = 0x0080
514 504
515} netxen_brdtype_t; 505} netxen_brdtype_t;
516 506
@@ -757,7 +747,7 @@ extern char netxen_nic_driver_name[];
757 */ 747 */
758struct netxen_skb_frag { 748struct netxen_skb_frag {
759 u64 dma; 749 u64 dma;
760 u32 length; 750 ulong length;
761}; 751};
762 752
763#define _netxen_set_bits(config_word, start, bits, val) {\ 753#define _netxen_set_bits(config_word, start, bits, val) {\
@@ -783,13 +773,7 @@ struct netxen_skb_frag {
783struct netxen_cmd_buffer { 773struct netxen_cmd_buffer {
784 struct sk_buff *skb; 774 struct sk_buff *skb;
785 struct netxen_skb_frag frag_array[MAX_BUFFERS_PER_CMD + 1]; 775 struct netxen_skb_frag frag_array[MAX_BUFFERS_PER_CMD + 1];
786 u32 total_length; 776 u32 frag_count;
787 u32 mss;
788 u16 port;
789 u8 cmd;
790 u8 frag_count;
791 unsigned long time_stamp;
792 u32 state;
793}; 777};
794 778
795/* In rx_buffer, we do not need multiple fragments as is a single buffer */ 779/* In rx_buffer, we do not need multiple fragments as is a single buffer */
@@ -876,7 +860,6 @@ struct nx_host_rds_ring {
876 u32 skb_size; 860 u32 skb_size;
877 struct netxen_rx_buffer *rx_buf_arr; /* rx buffers for receive */ 861 struct netxen_rx_buffer *rx_buf_arr; /* rx buffers for receive */
878 struct list_head free_list; 862 struct list_head free_list;
879 int begin_alloc;
880}; 863};
881 864
882/* 865/*
@@ -995,31 +978,31 @@ struct netxen_recv_context {
995 */ 978 */
996 979
997typedef struct { 980typedef struct {
998 u64 host_phys_addr; /* Ring base addr */ 981 __le64 host_phys_addr; /* Ring base addr */
999 u32 ring_size; /* Ring entries */ 982 __le32 ring_size; /* Ring entries */
1000 u16 msi_index; 983 __le16 msi_index;
1001 u16 rsvd; /* Padding */ 984 __le16 rsvd; /* Padding */
1002} nx_hostrq_sds_ring_t; 985} nx_hostrq_sds_ring_t;
1003 986
1004typedef struct { 987typedef struct {
1005 u64 host_phys_addr; /* Ring base addr */ 988 __le64 host_phys_addr; /* Ring base addr */
1006 u64 buff_size; /* Packet buffer size */ 989 __le64 buff_size; /* Packet buffer size */
1007 u32 ring_size; /* Ring entries */ 990 __le32 ring_size; /* Ring entries */
1008 u32 ring_kind; /* Class of ring */ 991 __le32 ring_kind; /* Class of ring */
1009} nx_hostrq_rds_ring_t; 992} nx_hostrq_rds_ring_t;
1010 993
1011typedef struct { 994typedef struct {
1012 u64 host_rsp_dma_addr; /* Response dma'd here */ 995 __le64 host_rsp_dma_addr; /* Response dma'd here */
1013 u32 capabilities[4]; /* Flag bit vector */ 996 __le32 capabilities[4]; /* Flag bit vector */
1014 u32 host_int_crb_mode; /* Interrupt crb usage */ 997 __le32 host_int_crb_mode; /* Interrupt crb usage */
1015 u32 host_rds_crb_mode; /* RDS crb usage */ 998 __le32 host_rds_crb_mode; /* RDS crb usage */
1016 /* These ring offsets are relative to data[0] below */ 999 /* These ring offsets are relative to data[0] below */
1017 u32 rds_ring_offset; /* Offset to RDS config */ 1000 __le32 rds_ring_offset; /* Offset to RDS config */
1018 u32 sds_ring_offset; /* Offset to SDS config */ 1001 __le32 sds_ring_offset; /* Offset to SDS config */
1019 u16 num_rds_rings; /* Count of RDS rings */ 1002 __le16 num_rds_rings; /* Count of RDS rings */
1020 u16 num_sds_rings; /* Count of SDS rings */ 1003 __le16 num_sds_rings; /* Count of SDS rings */
1021 u16 rsvd1; /* Padding */ 1004 __le16 rsvd1; /* Padding */
1022 u16 rsvd2; /* Padding */ 1005 __le16 rsvd2; /* Padding */
1023 u8 reserved[128]; /* reserve space for future expansion*/ 1006 u8 reserved[128]; /* reserve space for future expansion*/
1024 /* MUST BE 64-bit aligned. 1007 /* MUST BE 64-bit aligned.
1025 The following is packed: 1008 The following is packed:
@@ -1029,24 +1012,24 @@ typedef struct {
1029} nx_hostrq_rx_ctx_t; 1012} nx_hostrq_rx_ctx_t;
1030 1013
1031typedef struct { 1014typedef struct {
1032 u32 host_producer_crb; /* Crb to use */ 1015 __le32 host_producer_crb; /* Crb to use */
1033 u32 rsvd1; /* Padding */ 1016 __le32 rsvd1; /* Padding */
1034} nx_cardrsp_rds_ring_t; 1017} nx_cardrsp_rds_ring_t;
1035 1018
1036typedef struct { 1019typedef struct {
1037 u32 host_consumer_crb; /* Crb to use */ 1020 __le32 host_consumer_crb; /* Crb to use */
1038 u32 interrupt_crb; /* Crb to use */ 1021 __le32 interrupt_crb; /* Crb to use */
1039} nx_cardrsp_sds_ring_t; 1022} nx_cardrsp_sds_ring_t;
1040 1023
1041typedef struct { 1024typedef struct {
1042 /* These ring offsets are relative to data[0] below */ 1025 /* These ring offsets are relative to data[0] below */
1043 u32 rds_ring_offset; /* Offset to RDS config */ 1026 __le32 rds_ring_offset; /* Offset to RDS config */
1044 u32 sds_ring_offset; /* Offset to SDS config */ 1027 __le32 sds_ring_offset; /* Offset to SDS config */
1045 u32 host_ctx_state; /* Starting State */ 1028 __le32 host_ctx_state; /* Starting State */
1046 u32 num_fn_per_port; /* How many PCI fn share the port */ 1029 __le32 num_fn_per_port; /* How many PCI fn share the port */
1047 u16 num_rds_rings; /* Count of RDS rings */ 1030 __le16 num_rds_rings; /* Count of RDS rings */
1048 u16 num_sds_rings; /* Count of SDS rings */ 1031 __le16 num_sds_rings; /* Count of SDS rings */
1049 u16 context_id; /* Handle for context */ 1032 __le16 context_id; /* Handle for context */
1050 u8 phys_port; /* Physical id of port */ 1033 u8 phys_port; /* Physical id of port */
1051 u8 virt_port; /* Virtual/Logical id of port */ 1034 u8 virt_port; /* Virtual/Logical id of port */
1052 u8 reserved[128]; /* save space for future expansion */ 1035 u8 reserved[128]; /* save space for future expansion */
@@ -1072,34 +1055,34 @@ typedef struct {
1072 */ 1055 */
1073 1056
1074typedef struct { 1057typedef struct {
1075 u64 host_phys_addr; /* Ring base addr */ 1058 __le64 host_phys_addr; /* Ring base addr */
1076 u32 ring_size; /* Ring entries */ 1059 __le32 ring_size; /* Ring entries */
1077 u32 rsvd; /* Padding */ 1060 __le32 rsvd; /* Padding */
1078} nx_hostrq_cds_ring_t; 1061} nx_hostrq_cds_ring_t;
1079 1062
1080typedef struct { 1063typedef struct {
1081 u64 host_rsp_dma_addr; /* Response dma'd here */ 1064 __le64 host_rsp_dma_addr; /* Response dma'd here */
1082 u64 cmd_cons_dma_addr; /* */ 1065 __le64 cmd_cons_dma_addr; /* */
1083 u64 dummy_dma_addr; /* */ 1066 __le64 dummy_dma_addr; /* */
1084 u32 capabilities[4]; /* Flag bit vector */ 1067 __le32 capabilities[4]; /* Flag bit vector */
1085 u32 host_int_crb_mode; /* Interrupt crb usage */ 1068 __le32 host_int_crb_mode; /* Interrupt crb usage */
1086 u32 rsvd1; /* Padding */ 1069 __le32 rsvd1; /* Padding */
1087 u16 rsvd2; /* Padding */ 1070 __le16 rsvd2; /* Padding */
1088 u16 interrupt_ctl; 1071 __le16 interrupt_ctl;
1089 u16 msi_index; 1072 __le16 msi_index;
1090 u16 rsvd3; /* Padding */ 1073 __le16 rsvd3; /* Padding */
1091 nx_hostrq_cds_ring_t cds_ring; /* Desc of cds ring */ 1074 nx_hostrq_cds_ring_t cds_ring; /* Desc of cds ring */
1092 u8 reserved[128]; /* future expansion */ 1075 u8 reserved[128]; /* future expansion */
1093} nx_hostrq_tx_ctx_t; 1076} nx_hostrq_tx_ctx_t;
1094 1077
1095typedef struct { 1078typedef struct {
1096 u32 host_producer_crb; /* Crb to use */ 1079 __le32 host_producer_crb; /* Crb to use */
1097 u32 interrupt_crb; /* Crb to use */ 1080 __le32 interrupt_crb; /* Crb to use */
1098} nx_cardrsp_cds_ring_t; 1081} nx_cardrsp_cds_ring_t;
1099 1082
1100typedef struct { 1083typedef struct {
1101 u32 host_ctx_state; /* Starting state */ 1084 __le32 host_ctx_state; /* Starting state */
1102 u16 context_id; /* Handle for context */ 1085 __le16 context_id; /* Handle for context */
1103 u8 phys_port; /* Physical id of port */ 1086 u8 phys_port; /* Physical id of port */
1104 u8 virt_port; /* Virtual/Logical id of port */ 1087 u8 virt_port; /* Virtual/Logical id of port */
1105 nx_cardrsp_cds_ring_t cds_ring; /* Card cds settings */ 1088 nx_cardrsp_cds_ring_t cds_ring; /* Card cds settings */
@@ -1202,9 +1185,9 @@ enum {
1202#define VPORT_MISS_MODE_ACCEPT_MULTI 2 /* accept unmatched multicast */ 1185#define VPORT_MISS_MODE_ACCEPT_MULTI 2 /* accept unmatched multicast */
1203 1186
1204typedef struct { 1187typedef struct {
1205 u64 qhdr; 1188 __le64 qhdr;
1206 u64 req_hdr; 1189 __le64 req_hdr;
1207 u64 words[6]; 1190 __le64 words[6];
1208} nx_nic_req_t; 1191} nx_nic_req_t;
1209 1192
1210typedef struct { 1193typedef struct {
@@ -1486,8 +1469,6 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter);
1486 1469
1487void netxen_initialize_adapter_ops(struct netxen_adapter *adapter); 1470void netxen_initialize_adapter_ops(struct netxen_adapter *adapter);
1488int netxen_init_firmware(struct netxen_adapter *adapter); 1471int netxen_init_firmware(struct netxen_adapter *adapter);
1489void netxen_tso_check(struct netxen_adapter *adapter,
1490 struct cmd_desc_type0 *desc, struct sk_buff *skb);
1491void netxen_nic_clear_stats(struct netxen_adapter *adapter); 1472void netxen_nic_clear_stats(struct netxen_adapter *adapter);
1492void netxen_watchdog_task(struct work_struct *work); 1473void netxen_watchdog_task(struct work_struct *work);
1493void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, 1474void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx,
@@ -1496,6 +1477,7 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter);
1496u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctx, int max); 1477u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctx, int max);
1497void netxen_p2_nic_set_multi(struct net_device *netdev); 1478void netxen_p2_nic_set_multi(struct net_device *netdev);
1498void netxen_p3_nic_set_multi(struct net_device *netdev); 1479void netxen_p3_nic_set_multi(struct net_device *netdev);
1480void netxen_p3_free_mac_list(struct netxen_adapter *adapter);
1499int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32); 1481int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32);
1500int netxen_config_intr_coalesce(struct netxen_adapter *adapter); 1482int netxen_config_intr_coalesce(struct netxen_adapter *adapter);
1501 1483
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c
index 64b51643c626..746bdb470418 100644
--- a/drivers/net/netxen/netxen_nic_ctx.c
+++ b/drivers/net/netxen/netxen_nic_ctx.c
@@ -76,7 +76,7 @@ netxen_api_unlock(struct netxen_adapter *adapter)
76static u32 76static u32
77netxen_poll_rsp(struct netxen_adapter *adapter) 77netxen_poll_rsp(struct netxen_adapter *adapter)
78{ 78{
79 u32 raw_rsp, rsp = NX_CDRP_RSP_OK; 79 u32 rsp = NX_CDRP_RSP_OK;
80 int timeout = 0; 80 int timeout = 0;
81 81
82 do { 82 do {
@@ -86,10 +86,7 @@ netxen_poll_rsp(struct netxen_adapter *adapter)
86 if (++timeout > NX_OS_CRB_RETRY_COUNT) 86 if (++timeout > NX_OS_CRB_RETRY_COUNT)
87 return NX_CDRP_RSP_TIMEOUT; 87 return NX_CDRP_RSP_TIMEOUT;
88 88
89 netxen_nic_read_w1(adapter, NX_CDRP_CRB_OFFSET, 89 netxen_nic_read_w1(adapter, NX_CDRP_CRB_OFFSET, &rsp);
90 &raw_rsp);
91
92 rsp = le32_to_cpu(raw_rsp);
93 } while (!NX_CDRP_IS_RSP(rsp)); 90 } while (!NX_CDRP_IS_RSP(rsp));
94 91
95 return rsp; 92 return rsp;
@@ -109,20 +106,16 @@ netxen_issue_cmd(struct netxen_adapter *adapter,
109 if (netxen_api_lock(adapter)) 106 if (netxen_api_lock(adapter))
110 return NX_RCODE_TIMEOUT; 107 return NX_RCODE_TIMEOUT;
111 108
112 netxen_nic_write_w1(adapter, NX_SIGN_CRB_OFFSET, 109 netxen_nic_write_w1(adapter, NX_SIGN_CRB_OFFSET, signature);
113 cpu_to_le32(signature));
114 110
115 netxen_nic_write_w1(adapter, NX_ARG1_CRB_OFFSET, 111 netxen_nic_write_w1(adapter, NX_ARG1_CRB_OFFSET, arg1);
116 cpu_to_le32(arg1));
117 112
118 netxen_nic_write_w1(adapter, NX_ARG2_CRB_OFFSET, 113 netxen_nic_write_w1(adapter, NX_ARG2_CRB_OFFSET, arg2);
119 cpu_to_le32(arg2));
120 114
121 netxen_nic_write_w1(adapter, NX_ARG3_CRB_OFFSET, 115 netxen_nic_write_w1(adapter, NX_ARG3_CRB_OFFSET, arg3);
122 cpu_to_le32(arg3));
123 116
124 netxen_nic_write_w1(adapter, NX_CDRP_CRB_OFFSET, 117 netxen_nic_write_w1(adapter, NX_CDRP_CRB_OFFSET,
125 cpu_to_le32(NX_CDRP_FORM_CMD(cmd))); 118 NX_CDRP_FORM_CMD(cmd));
126 119
127 rsp = netxen_poll_rsp(adapter); 120 rsp = netxen_poll_rsp(adapter);
128 121
@@ -133,7 +126,6 @@ netxen_issue_cmd(struct netxen_adapter *adapter,
133 rcode = NX_RCODE_TIMEOUT; 126 rcode = NX_RCODE_TIMEOUT;
134 } else if (rsp == NX_CDRP_RSP_FAIL) { 127 } else if (rsp == NX_CDRP_RSP_FAIL) {
135 netxen_nic_read_w1(adapter, NX_ARG1_CRB_OFFSET, &rcode); 128 netxen_nic_read_w1(adapter, NX_ARG1_CRB_OFFSET, &rcode);
136 rcode = le32_to_cpu(rcode);
137 129
138 printk(KERN_ERR "%s: failed card response code:0x%x\n", 130 printk(KERN_ERR "%s: failed card response code:0x%x\n",
139 netxen_nic_driver_name, rcode); 131 netxen_nic_driver_name, rcode);
@@ -183,7 +175,7 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
183 175
184 int i, nrds_rings, nsds_rings; 176 int i, nrds_rings, nsds_rings;
185 size_t rq_size, rsp_size; 177 size_t rq_size, rsp_size;
186 u32 cap, reg; 178 u32 cap, reg, val;
187 179
188 int err; 180 int err;
189 181
@@ -225,11 +217,14 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
225 217
226 prq->num_rds_rings = cpu_to_le16(nrds_rings); 218 prq->num_rds_rings = cpu_to_le16(nrds_rings);
227 prq->num_sds_rings = cpu_to_le16(nsds_rings); 219 prq->num_sds_rings = cpu_to_le16(nsds_rings);
228 prq->rds_ring_offset = 0; 220 prq->rds_ring_offset = cpu_to_le32(0);
229 prq->sds_ring_offset = prq->rds_ring_offset + 221
222 val = le32_to_cpu(prq->rds_ring_offset) +
230 (sizeof(nx_hostrq_rds_ring_t) * nrds_rings); 223 (sizeof(nx_hostrq_rds_ring_t) * nrds_rings);
224 prq->sds_ring_offset = cpu_to_le32(val);
231 225
232 prq_rds = (nx_hostrq_rds_ring_t *)(prq->data + prq->rds_ring_offset); 226 prq_rds = (nx_hostrq_rds_ring_t *)(prq->data +
227 le32_to_cpu(prq->rds_ring_offset));
233 228
234 for (i = 0; i < nrds_rings; i++) { 229 for (i = 0; i < nrds_rings; i++) {
235 230
@@ -241,17 +236,14 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
241 prq_rds[i].buff_size = cpu_to_le64(rds_ring->dma_size); 236 prq_rds[i].buff_size = cpu_to_le64(rds_ring->dma_size);
242 } 237 }
243 238
244 prq_sds = (nx_hostrq_sds_ring_t *)(prq->data + prq->sds_ring_offset); 239 prq_sds = (nx_hostrq_sds_ring_t *)(prq->data +
240 le32_to_cpu(prq->sds_ring_offset));
245 241
246 prq_sds[0].host_phys_addr = 242 prq_sds[0].host_phys_addr =
247 cpu_to_le64(recv_ctx->rcv_status_desc_phys_addr); 243 cpu_to_le64(recv_ctx->rcv_status_desc_phys_addr);
248 prq_sds[0].ring_size = cpu_to_le32(adapter->max_rx_desc_count); 244 prq_sds[0].ring_size = cpu_to_le32(adapter->max_rx_desc_count);
249 /* only one msix vector for now */ 245 /* only one msix vector for now */
250 prq_sds[0].msi_index = cpu_to_le32(0); 246 prq_sds[0].msi_index = cpu_to_le16(0);
251
252 /* now byteswap offsets */
253 prq->rds_ring_offset = cpu_to_le32(prq->rds_ring_offset);
254 prq->sds_ring_offset = cpu_to_le32(prq->sds_ring_offset);
255 247
256 phys_addr = hostrq_phys_addr; 248 phys_addr = hostrq_phys_addr;
257 err = netxen_issue_cmd(adapter, 249 err = netxen_issue_cmd(adapter,
@@ -269,9 +261,9 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
269 261
270 262
271 prsp_rds = ((nx_cardrsp_rds_ring_t *) 263 prsp_rds = ((nx_cardrsp_rds_ring_t *)
272 &prsp->data[prsp->rds_ring_offset]); 264 &prsp->data[le32_to_cpu(prsp->rds_ring_offset)]);
273 265
274 for (i = 0; i < le32_to_cpu(prsp->num_rds_rings); i++) { 266 for (i = 0; i < le16_to_cpu(prsp->num_rds_rings); i++) {
275 rds_ring = &recv_ctx->rds_rings[i]; 267 rds_ring = &recv_ctx->rds_rings[i];
276 268
277 reg = le32_to_cpu(prsp_rds[i].host_producer_crb); 269 reg = le32_to_cpu(prsp_rds[i].host_producer_crb);
@@ -279,7 +271,7 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
279 } 271 }
280 272
281 prsp_sds = ((nx_cardrsp_sds_ring_t *) 273 prsp_sds = ((nx_cardrsp_sds_ring_t *)
282 &prsp->data[prsp->sds_ring_offset]); 274 &prsp->data[le32_to_cpu(prsp->sds_ring_offset)]);
283 reg = le32_to_cpu(prsp_sds[0].host_consumer_crb); 275 reg = le32_to_cpu(prsp_sds[0].host_consumer_crb);
284 recv_ctx->crb_sts_consumer = NETXEN_NIC_REG(reg - 0x200); 276 recv_ctx->crb_sts_consumer = NETXEN_NIC_REG(reg - 0x200);
285 277
@@ -288,7 +280,7 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
288 280
289 recv_ctx->state = le32_to_cpu(prsp->host_ctx_state); 281 recv_ctx->state = le32_to_cpu(prsp->host_ctx_state);
290 recv_ctx->context_id = le16_to_cpu(prsp->context_id); 282 recv_ctx->context_id = le16_to_cpu(prsp->context_id);
291 recv_ctx->virt_port = le16_to_cpu(prsp->virt_port); 283 recv_ctx->virt_port = prsp->virt_port;
292 284
293out_free_rsp: 285out_free_rsp:
294 pci_free_consistent(adapter->pdev, rsp_size, prsp, cardrsp_phys_addr); 286 pci_free_consistent(adapter->pdev, rsp_size, prsp, cardrsp_phys_addr);
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index e45ce2951729..c0bd40fcf708 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -136,11 +136,9 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
136 136
137 ecmd->port = PORT_TP; 137 ecmd->port = PORT_TP;
138 138
139 if (netif_running(dev)) { 139 ecmd->speed = adapter->link_speed;
140 ecmd->speed = adapter->link_speed; 140 ecmd->duplex = adapter->link_duplex;
141 ecmd->duplex = adapter->link_duplex; 141 ecmd->autoneg = adapter->link_autoneg;
142 ecmd->autoneg = adapter->link_autoneg;
143 }
144 142
145 } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { 143 } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) {
146 u32 val; 144 u32 val;
@@ -171,7 +169,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
171 } else 169 } else
172 return -EIO; 170 return -EIO;
173 171
174 ecmd->phy_address = adapter->portnum; 172 ecmd->phy_address = adapter->physical_port;
175 ecmd->transceiver = XCVR_EXTERNAL; 173 ecmd->transceiver = XCVR_EXTERNAL;
176 174
177 switch ((netxen_brdtype_t) boardinfo->board_type) { 175 switch ((netxen_brdtype_t) boardinfo->board_type) {
@@ -180,13 +178,13 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
180 case NETXEN_BRDTYPE_P3_REF_QG: 178 case NETXEN_BRDTYPE_P3_REF_QG:
181 case NETXEN_BRDTYPE_P3_4_GB: 179 case NETXEN_BRDTYPE_P3_4_GB:
182 case NETXEN_BRDTYPE_P3_4_GB_MM: 180 case NETXEN_BRDTYPE_P3_4_GB_MM:
183 case NETXEN_BRDTYPE_P3_10000_BASE_T:
184 181
185 ecmd->supported |= SUPPORTED_Autoneg; 182 ecmd->supported |= SUPPORTED_Autoneg;
186 ecmd->advertising |= ADVERTISED_Autoneg; 183 ecmd->advertising |= ADVERTISED_Autoneg;
187 case NETXEN_BRDTYPE_P2_SB31_10G_CX4: 184 case NETXEN_BRDTYPE_P2_SB31_10G_CX4:
188 case NETXEN_BRDTYPE_P3_10G_CX4: 185 case NETXEN_BRDTYPE_P3_10G_CX4:
189 case NETXEN_BRDTYPE_P3_10G_CX4_LP: 186 case NETXEN_BRDTYPE_P3_10G_CX4_LP:
187 case NETXEN_BRDTYPE_P3_10000_BASE_T:
190 ecmd->supported |= SUPPORTED_TP; 188 ecmd->supported |= SUPPORTED_TP;
191 ecmd->advertising |= ADVERTISED_TP; 189 ecmd->advertising |= ADVERTISED_TP;
192 ecmd->port = PORT_TP; 190 ecmd->port = PORT_TP;
@@ -204,16 +202,33 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
204 ecmd->port = PORT_FIBRE; 202 ecmd->port = PORT_FIBRE;
205 ecmd->autoneg = AUTONEG_DISABLE; 203 ecmd->autoneg = AUTONEG_DISABLE;
206 break; 204 break;
207 case NETXEN_BRDTYPE_P2_SB31_10G:
208 case NETXEN_BRDTYPE_P3_10G_SFP_PLUS: 205 case NETXEN_BRDTYPE_P3_10G_SFP_PLUS:
209 case NETXEN_BRDTYPE_P3_10G_SFP_CT: 206 case NETXEN_BRDTYPE_P3_10G_SFP_CT:
210 case NETXEN_BRDTYPE_P3_10G_SFP_QT: 207 case NETXEN_BRDTYPE_P3_10G_SFP_QT:
208 ecmd->advertising |= ADVERTISED_TP;
209 ecmd->supported |= SUPPORTED_TP;
210 case NETXEN_BRDTYPE_P2_SB31_10G:
211 case NETXEN_BRDTYPE_P3_10G_XFP: 211 case NETXEN_BRDTYPE_P3_10G_XFP:
212 ecmd->supported |= SUPPORTED_FIBRE; 212 ecmd->supported |= SUPPORTED_FIBRE;
213 ecmd->advertising |= ADVERTISED_FIBRE; 213 ecmd->advertising |= ADVERTISED_FIBRE;
214 ecmd->port = PORT_FIBRE; 214 ecmd->port = PORT_FIBRE;
215 ecmd->autoneg = AUTONEG_DISABLE; 215 ecmd->autoneg = AUTONEG_DISABLE;
216 break; 216 break;
217 case NETXEN_BRDTYPE_P3_10G_TP:
218 if (adapter->ahw.board_type == NETXEN_NIC_XGBE) {
219 ecmd->autoneg = AUTONEG_DISABLE;
220 ecmd->supported |= (SUPPORTED_FIBRE | SUPPORTED_TP);
221 ecmd->advertising |=
222 (ADVERTISED_FIBRE | ADVERTISED_TP);
223 ecmd->port = PORT_FIBRE;
224 } else {
225 ecmd->autoneg = AUTONEG_ENABLE;
226 ecmd->supported |= (SUPPORTED_TP |SUPPORTED_Autoneg);
227 ecmd->advertising |=
228 (ADVERTISED_TP | ADVERTISED_Autoneg);
229 ecmd->port = PORT_TP;
230 }
231 break;
217 default: 232 default:
218 printk(KERN_ERR "netxen-nic: Unsupported board model %d\n", 233 printk(KERN_ERR "netxen-nic: Unsupported board model %d\n",
219 (netxen_brdtype_t) boardinfo->board_type); 234 (netxen_brdtype_t) boardinfo->board_type);
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index aa6e603bfcbf..821cff68b3f3 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -503,17 +503,15 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter,
503 503
504 i = 0; 504 i = 0;
505 505
506 netif_tx_lock_bh(adapter->netdev);
507
506 producer = adapter->cmd_producer; 508 producer = adapter->cmd_producer;
507 do { 509 do {
508 cmd_desc = &cmd_desc_arr[i]; 510 cmd_desc = &cmd_desc_arr[i];
509 511
510 pbuf = &adapter->cmd_buf_arr[producer]; 512 pbuf = &adapter->cmd_buf_arr[producer];
511 pbuf->mss = 0;
512 pbuf->total_length = 0;
513 pbuf->skb = NULL; 513 pbuf->skb = NULL;
514 pbuf->cmd = 0;
515 pbuf->frag_count = 0; 514 pbuf->frag_count = 0;
516 pbuf->port = 0;
517 515
518 /* adapter->ahw.cmd_desc_head[producer] = *cmd_desc; */ 516 /* adapter->ahw.cmd_desc_head[producer] = *cmd_desc; */
519 memcpy(&adapter->ahw.cmd_desc_head[producer], 517 memcpy(&adapter->ahw.cmd_desc_head[producer],
@@ -531,6 +529,8 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter,
531 529
532 netxen_nic_update_cmd_producer(adapter, adapter->cmd_producer); 530 netxen_nic_update_cmd_producer(adapter, adapter->cmd_producer);
533 531
532 netif_tx_unlock_bh(adapter->netdev);
533
534 return 0; 534 return 0;
535} 535}
536 536
@@ -539,16 +539,19 @@ static int nx_p3_sre_macaddr_change(struct net_device *dev,
539{ 539{
540 struct netxen_adapter *adapter = netdev_priv(dev); 540 struct netxen_adapter *adapter = netdev_priv(dev);
541 nx_nic_req_t req; 541 nx_nic_req_t req;
542 nx_mac_req_t mac_req; 542 nx_mac_req_t *mac_req;
543 u64 word;
543 int rv; 544 int rv;
544 545
545 memset(&req, 0, sizeof(nx_nic_req_t)); 546 memset(&req, 0, sizeof(nx_nic_req_t));
546 req.qhdr |= (NX_NIC_REQUEST << 23); 547 req.qhdr = cpu_to_le64(NX_NIC_REQUEST << 23);
547 req.req_hdr |= NX_MAC_EVENT; 548
548 req.req_hdr |= ((u64)adapter->portnum << 16); 549 word = NX_MAC_EVENT | ((u64)adapter->portnum << 16);
549 mac_req.op = op; 550 req.req_hdr = cpu_to_le64(word);
550 memcpy(&mac_req.mac_addr, addr, 6); 551
551 req.words[0] = cpu_to_le64(*(u64 *)&mac_req); 552 mac_req = (nx_mac_req_t *)&req.words[0];
553 mac_req->op = op;
554 memcpy(mac_req->mac_addr, addr, 6);
552 555
553 rv = netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1); 556 rv = netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1);
554 if (rv != 0) { 557 if (rv != 0) {
@@ -612,18 +615,35 @@ send_fw_cmd:
612int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) 615int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode)
613{ 616{
614 nx_nic_req_t req; 617 nx_nic_req_t req;
618 u64 word;
615 619
616 memset(&req, 0, sizeof(nx_nic_req_t)); 620 memset(&req, 0, sizeof(nx_nic_req_t));
617 621
618 req.qhdr |= (NX_HOST_REQUEST << 23); 622 req.qhdr = cpu_to_le64(NX_HOST_REQUEST << 23);
619 req.req_hdr |= NX_NIC_H2C_OPCODE_PROXY_SET_VPORT_MISS_MODE; 623
620 req.req_hdr |= ((u64)adapter->portnum << 16); 624 word = NX_NIC_H2C_OPCODE_PROXY_SET_VPORT_MISS_MODE |
625 ((u64)adapter->portnum << 16);
626 req.req_hdr = cpu_to_le64(word);
627
621 req.words[0] = cpu_to_le64(mode); 628 req.words[0] = cpu_to_le64(mode);
622 629
623 return netxen_send_cmd_descs(adapter, 630 return netxen_send_cmd_descs(adapter,
624 (struct cmd_desc_type0 *)&req, 1); 631 (struct cmd_desc_type0 *)&req, 1);
625} 632}
626 633
634void netxen_p3_free_mac_list(struct netxen_adapter *adapter)
635{
636 nx_mac_list_t *cur, *next;
637
638 cur = adapter->mac_list;
639
640 while (cur) {
641 next = cur->next;
642 kfree(cur);
643 cur = next;
644 }
645}
646
627#define NETXEN_CONFIG_INTR_COALESCE 3 647#define NETXEN_CONFIG_INTR_COALESCE 3
628 648
629/* 649/*
@@ -632,13 +652,15 @@ int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode)
632int netxen_config_intr_coalesce(struct netxen_adapter *adapter) 652int netxen_config_intr_coalesce(struct netxen_adapter *adapter)
633{ 653{
634 nx_nic_req_t req; 654 nx_nic_req_t req;
655 u64 word;
635 int rv; 656 int rv;
636 657
637 memset(&req, 0, sizeof(nx_nic_req_t)); 658 memset(&req, 0, sizeof(nx_nic_req_t));
638 659
639 req.qhdr |= (NX_NIC_REQUEST << 23); 660 req.qhdr = cpu_to_le64(NX_NIC_REQUEST << 23);
640 req.req_hdr |= NETXEN_CONFIG_INTR_COALESCE; 661
641 req.req_hdr |= ((u64)adapter->portnum << 16); 662 word = NETXEN_CONFIG_INTR_COALESCE | ((u64)adapter->portnum << 16);
663 req.req_hdr = cpu_to_le64(word);
642 664
643 memcpy(&req.words[0], &adapter->coal, sizeof(adapter->coal)); 665 memcpy(&req.words[0], &adapter->coal, sizeof(adapter->coal));
644 666
@@ -772,13 +794,10 @@ int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, __le64 *mac)
772 adapter->hw_read_wx(adapter, crbaddr, &mac_lo, 4); 794 adapter->hw_read_wx(adapter, crbaddr, &mac_lo, 4);
773 adapter->hw_read_wx(adapter, crbaddr+4, &mac_hi, 4); 795 adapter->hw_read_wx(adapter, crbaddr+4, &mac_hi, 4);
774 796
775 mac_hi = cpu_to_le32(mac_hi);
776 mac_lo = cpu_to_le32(mac_lo);
777
778 if (pci_func & 1) 797 if (pci_func & 1)
779 *mac = ((mac_lo >> 16) | ((u64)mac_hi << 16)); 798 *mac = le64_to_cpu((mac_lo >> 16) | ((u64)mac_hi << 16));
780 else 799 else
781 *mac = ((mac_lo) | ((u64)mac_hi << 32)); 800 *mac = le64_to_cpu((u64)mac_lo | ((u64)mac_hi << 32));
782 801
783 return 0; 802 return 0;
784} 803}
@@ -937,7 +956,7 @@ int netxen_load_firmware(struct netxen_adapter *adapter)
937{ 956{
938 int i; 957 int i;
939 u32 data, size = 0; 958 u32 data, size = 0;
940 u32 flashaddr = NETXEN_BOOTLD_START, memaddr = NETXEN_BOOTLD_START; 959 u32 flashaddr = NETXEN_BOOTLD_START;
941 960
942 size = (NETXEN_IMAGE_START - NETXEN_BOOTLD_START)/4; 961 size = (NETXEN_IMAGE_START - NETXEN_BOOTLD_START)/4;
943 962
@@ -949,10 +968,8 @@ int netxen_load_firmware(struct netxen_adapter *adapter)
949 if (netxen_rom_fast_read(adapter, flashaddr, (int *)&data) != 0) 968 if (netxen_rom_fast_read(adapter, flashaddr, (int *)&data) != 0)
950 return -EIO; 969 return -EIO;
951 970
952 adapter->pci_mem_write(adapter, memaddr, &data, 4); 971 adapter->pci_mem_write(adapter, flashaddr, &data, 4);
953 flashaddr += 4; 972 flashaddr += 4;
954 memaddr += 4;
955 cond_resched();
956 } 973 }
957 msleep(1); 974 msleep(1);
958 975
@@ -2034,7 +2051,13 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter)
2034 rv = -1; 2051 rv = -1;
2035 } 2052 }
2036 2053
2037 DPRINTK(INFO, "Discovered board type:0x%x ", boardinfo->board_type); 2054 if (boardinfo->board_type == NETXEN_BRDTYPE_P3_4_GB_MM) {
2055 u32 gpio = netxen_nic_reg_read(adapter,
2056 NETXEN_ROMUSB_GLB_PAD_GPIO_I);
2057 if ((gpio & 0x8000) == 0)
2058 boardinfo->board_type = NETXEN_BRDTYPE_P3_10G_TP;
2059 }
2060
2038 switch ((netxen_brdtype_t) boardinfo->board_type) { 2061 switch ((netxen_brdtype_t) boardinfo->board_type) {
2039 case NETXEN_BRDTYPE_P2_SB35_4G: 2062 case NETXEN_BRDTYPE_P2_SB35_4G:
2040 adapter->ahw.board_type = NETXEN_NIC_GBE; 2063 adapter->ahw.board_type = NETXEN_NIC_GBE;
@@ -2053,7 +2076,6 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter)
2053 case NETXEN_BRDTYPE_P3_10G_SFP_QT: 2076 case NETXEN_BRDTYPE_P3_10G_SFP_QT:
2054 case NETXEN_BRDTYPE_P3_10G_XFP: 2077 case NETXEN_BRDTYPE_P3_10G_XFP:
2055 case NETXEN_BRDTYPE_P3_10000_BASE_T: 2078 case NETXEN_BRDTYPE_P3_10000_BASE_T:
2056
2057 adapter->ahw.board_type = NETXEN_NIC_XGBE; 2079 adapter->ahw.board_type = NETXEN_NIC_XGBE;
2058 break; 2080 break;
2059 case NETXEN_BRDTYPE_P1_BD: 2081 case NETXEN_BRDTYPE_P1_BD:
@@ -2063,9 +2085,12 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter)
2063 case NETXEN_BRDTYPE_P3_REF_QG: 2085 case NETXEN_BRDTYPE_P3_REF_QG:
2064 case NETXEN_BRDTYPE_P3_4_GB: 2086 case NETXEN_BRDTYPE_P3_4_GB:
2065 case NETXEN_BRDTYPE_P3_4_GB_MM: 2087 case NETXEN_BRDTYPE_P3_4_GB_MM:
2066
2067 adapter->ahw.board_type = NETXEN_NIC_GBE; 2088 adapter->ahw.board_type = NETXEN_NIC_GBE;
2068 break; 2089 break;
2090 case NETXEN_BRDTYPE_P3_10G_TP:
2091 adapter->ahw.board_type = (adapter->portnum < 2) ?
2092 NETXEN_NIC_XGBE : NETXEN_NIC_GBE;
2093 break;
2069 default: 2094 default:
2070 printk("%s: Unknown(%x)\n", netxen_nic_driver_name, 2095 printk("%s: Unknown(%x)\n", netxen_nic_driver_name,
2071 boardinfo->board_type); 2096 boardinfo->board_type);
@@ -2110,12 +2135,16 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter)
2110{ 2135{
2111 __u32 status; 2136 __u32 status;
2112 __u32 autoneg; 2137 __u32 autoneg;
2113 __u32 mode;
2114 __u32 port_mode; 2138 __u32 port_mode;
2115 2139
2116 netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode); 2140 if (!netif_carrier_ok(adapter->netdev)) {
2117 if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */ 2141 adapter->link_speed = 0;
2142 adapter->link_duplex = -1;
2143 adapter->link_autoneg = AUTONEG_ENABLE;
2144 return;
2145 }
2118 2146
2147 if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
2119 adapter->hw_read_wx(adapter, 2148 adapter->hw_read_wx(adapter,
2120 NETXEN_PORT_MODE_ADDR, &port_mode, 4); 2149 NETXEN_PORT_MODE_ADDR, &port_mode, 4);
2121 if (port_mode == NETXEN_PORT_MODE_802_3_AP) { 2150 if (port_mode == NETXEN_PORT_MODE_802_3_AP) {
@@ -2141,7 +2170,7 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter)
2141 adapter->link_speed = SPEED_1000; 2170 adapter->link_speed = SPEED_1000;
2142 break; 2171 break;
2143 default: 2172 default:
2144 adapter->link_speed = -1; 2173 adapter->link_speed = 0;
2145 break; 2174 break;
2146 } 2175 }
2147 switch (netxen_get_phy_duplex(status)) { 2176 switch (netxen_get_phy_duplex(status)) {
@@ -2164,7 +2193,7 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter)
2164 goto link_down; 2193 goto link_down;
2165 } else { 2194 } else {
2166 link_down: 2195 link_down:
2167 adapter->link_speed = -1; 2196 adapter->link_speed = 0;
2168 adapter->link_duplex = -1; 2197 adapter->link_duplex = -1;
2169 } 2198 }
2170 } 2199 }
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index d924468e506e..ca7c8d8050c9 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -308,7 +308,6 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter)
308 } 308 }
309 memset(rds_ring->rx_buf_arr, 0, RCV_BUFFSIZE); 309 memset(rds_ring->rx_buf_arr, 0, RCV_BUFFSIZE);
310 INIT_LIST_HEAD(&rds_ring->free_list); 310 INIT_LIST_HEAD(&rds_ring->free_list);
311 rds_ring->begin_alloc = 0;
312 /* 311 /*
313 * Now go through all of them, set reference handles 312 * Now go through all of them, set reference handles
314 * and put them in the queues. 313 * and put them in the queues.
@@ -439,6 +438,8 @@ static int netxen_wait_rom_done(struct netxen_adapter *adapter)
439 long timeout = 0; 438 long timeout = 0;
440 long done = 0; 439 long done = 0;
441 440
441 cond_resched();
442
442 while (done == 0) { 443 while (done == 0) {
443 done = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_GLB_STATUS); 444 done = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_GLB_STATUS);
444 done &= 2; 445 done &= 2;
@@ -533,12 +534,9 @@ static int do_rom_fast_write(struct netxen_adapter *adapter, int addr,
533static int do_rom_fast_read(struct netxen_adapter *adapter, 534static int do_rom_fast_read(struct netxen_adapter *adapter,
534 int addr, int *valp) 535 int addr, int *valp)
535{ 536{
536 cond_resched();
537
538 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr); 537 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr);
539 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3);
540 udelay(100); /* prevent bursting on CRB */
541 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); 538 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0);
539 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3);
542 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb); 540 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb);
543 if (netxen_wait_rom_done(adapter)) { 541 if (netxen_wait_rom_done(adapter)) {
544 printk("Error waiting for rom done\n"); 542 printk("Error waiting for rom done\n");
@@ -546,7 +544,7 @@ static int do_rom_fast_read(struct netxen_adapter *adapter,
546 } 544 }
547 /* reset abyte_cnt and dummy_byte_cnt */ 545 /* reset abyte_cnt and dummy_byte_cnt */
548 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); 546 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0);
549 udelay(100); /* prevent bursting on CRB */ 547 udelay(10);
550 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); 548 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0);
551 549
552 *valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA); 550 *valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA);
@@ -884,14 +882,16 @@ int netxen_flash_unlock(struct netxen_adapter *adapter)
884int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) 882int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
885{ 883{
886 int addr, val; 884 int addr, val;
887 int i, init_delay = 0; 885 int i, n, init_delay = 0;
888 struct crb_addr_pair *buf; 886 struct crb_addr_pair *buf;
889 unsigned offset, n; 887 unsigned offset;
890 u32 off; 888 u32 off;
891 889
892 /* resetall */ 890 /* resetall */
891 rom_lock(adapter);
893 netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET, 892 netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET,
894 0xffffffff); 893 0xffffffff);
894 netxen_rom_unlock(adapter);
895 895
896 if (verbose) { 896 if (verbose) {
897 if (netxen_rom_fast_read(adapter, NETXEN_BOARDTYPE, &val) == 0) 897 if (netxen_rom_fast_read(adapter, NETXEN_BOARDTYPE, &val) == 0)
@@ -910,7 +910,7 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
910 910
911 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { 911 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
912 if (netxen_rom_fast_read(adapter, 0, &n) != 0 || 912 if (netxen_rom_fast_read(adapter, 0, &n) != 0 ||
913 (n != 0xcafecafeUL) || 913 (n != 0xcafecafe) ||
914 netxen_rom_fast_read(adapter, 4, &n) != 0) { 914 netxen_rom_fast_read(adapter, 4, &n) != 0) {
915 printk(KERN_ERR "%s: ERROR Reading crb_init area: " 915 printk(KERN_ERR "%s: ERROR Reading crb_init area: "
916 "n: %08x\n", netxen_nic_driver_name, n); 916 "n: %08x\n", netxen_nic_driver_name, n);
@@ -975,6 +975,14 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
975 /* do not reset PCI */ 975 /* do not reset PCI */
976 if (off == (ROMUSB_GLB + 0xbc)) 976 if (off == (ROMUSB_GLB + 0xbc))
977 continue; 977 continue;
978 if (off == (ROMUSB_GLB + 0xa8))
979 continue;
980 if (off == (ROMUSB_GLB + 0xc8)) /* core clock */
981 continue;
982 if (off == (ROMUSB_GLB + 0x24)) /* MN clock */
983 continue;
984 if (off == (ROMUSB_GLB + 0x1c)) /* MS clock */
985 continue;
978 if (off == (NETXEN_CRB_PEG_NET_1 + 0x18)) 986 if (off == (NETXEN_CRB_PEG_NET_1 + 0x18))
979 buf[i].data = 0x1020; 987 buf[i].data = 0x1020;
980 /* skip the function enable register */ 988 /* skip the function enable register */
@@ -992,23 +1000,21 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
992 continue; 1000 continue;
993 } 1001 }
994 1002
1003 init_delay = 1;
995 /* After writing this register, HW needs time for CRB */ 1004 /* After writing this register, HW needs time for CRB */
996 /* to quiet down (else crb_window returns 0xffffffff) */ 1005 /* to quiet down (else crb_window returns 0xffffffff) */
997 if (off == NETXEN_ROMUSB_GLB_SW_RESET) { 1006 if (off == NETXEN_ROMUSB_GLB_SW_RESET) {
998 init_delay = 1; 1007 init_delay = 1000;
999 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { 1008 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
1000 /* hold xdma in reset also */ 1009 /* hold xdma in reset also */
1001 buf[i].data = NETXEN_NIC_XDMA_RESET; 1010 buf[i].data = NETXEN_NIC_XDMA_RESET;
1011 buf[i].data = 0x8000ff;
1002 } 1012 }
1003 } 1013 }
1004 1014
1005 adapter->hw_write_wx(adapter, off, &buf[i].data, 4); 1015 adapter->hw_write_wx(adapter, off, &buf[i].data, 4);
1006 1016
1007 if (init_delay == 1) { 1017 msleep(init_delay);
1008 msleep(1000);
1009 init_delay = 0;
1010 }
1011 msleep(1);
1012 } 1018 }
1013 kfree(buf); 1019 kfree(buf);
1014 1020
@@ -1277,7 +1283,7 @@ static void netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
1277 1283
1278 dev_kfree_skb_any(skb); 1284 dev_kfree_skb_any(skb);
1279 for (i = 0; i < nr_frags; i++) { 1285 for (i = 0; i < nr_frags; i++) {
1280 index = frag_desc->frag_handles[i]; 1286 index = le16_to_cpu(frag_desc->frag_handles[i]);
1281 skb = netxen_process_rxbuf(adapter, 1287 skb = netxen_process_rxbuf(adapter,
1282 rds_ring, index, cksum); 1288 rds_ring, index, cksum);
1283 if (skb) 1289 if (skb)
@@ -1428,7 +1434,6 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid)
1428 struct rcv_desc *pdesc; 1434 struct rcv_desc *pdesc;
1429 struct netxen_rx_buffer *buffer; 1435 struct netxen_rx_buffer *buffer;
1430 int count = 0; 1436 int count = 0;
1431 int index = 0;
1432 netxen_ctx_msg msg = 0; 1437 netxen_ctx_msg msg = 0;
1433 dma_addr_t dma; 1438 dma_addr_t dma;
1434 struct list_head *head; 1439 struct list_head *head;
@@ -1436,7 +1441,6 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid)
1436 rds_ring = &recv_ctx->rds_rings[ringid]; 1441 rds_ring = &recv_ctx->rds_rings[ringid];
1437 1442
1438 producer = rds_ring->producer; 1443 producer = rds_ring->producer;
1439 index = rds_ring->begin_alloc;
1440 head = &rds_ring->free_list; 1444 head = &rds_ring->free_list;
1441 1445
1442 /* We can start writing rx descriptors into the phantom memory. */ 1446 /* We can start writing rx descriptors into the phantom memory. */
@@ -1444,39 +1448,37 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid)
1444 1448
1445 skb = dev_alloc_skb(rds_ring->skb_size); 1449 skb = dev_alloc_skb(rds_ring->skb_size);
1446 if (unlikely(!skb)) { 1450 if (unlikely(!skb)) {
1447 rds_ring->begin_alloc = index;
1448 break; 1451 break;
1449 } 1452 }
1450 1453
1454 if (!adapter->ahw.cut_through)
1455 skb_reserve(skb, 2);
1456
1457 dma = pci_map_single(pdev, skb->data,
1458 rds_ring->dma_size, PCI_DMA_FROMDEVICE);
1459 if (pci_dma_mapping_error(pdev, dma)) {
1460 dev_kfree_skb_any(skb);
1461 break;
1462 }
1463
1464 count++;
1451 buffer = list_entry(head->next, struct netxen_rx_buffer, list); 1465 buffer = list_entry(head->next, struct netxen_rx_buffer, list);
1452 list_del(&buffer->list); 1466 list_del(&buffer->list);
1453 1467
1454 count++; /* now there should be no failure */
1455 pdesc = &rds_ring->desc_head[producer];
1456
1457 if (!adapter->ahw.cut_through)
1458 skb_reserve(skb, 2);
1459 /* This will be setup when we receive the
1460 * buffer after it has been filled FSL TBD TBD
1461 * skb->dev = netdev;
1462 */
1463 dma = pci_map_single(pdev, skb->data, rds_ring->dma_size,
1464 PCI_DMA_FROMDEVICE);
1465 pdesc->addr_buffer = cpu_to_le64(dma);
1466 buffer->skb = skb; 1468 buffer->skb = skb;
1467 buffer->state = NETXEN_BUFFER_BUSY; 1469 buffer->state = NETXEN_BUFFER_BUSY;
1468 buffer->dma = dma; 1470 buffer->dma = dma;
1471
1469 /* make a rcv descriptor */ 1472 /* make a rcv descriptor */
1473 pdesc = &rds_ring->desc_head[producer];
1474 pdesc->addr_buffer = cpu_to_le64(dma);
1470 pdesc->reference_handle = cpu_to_le16(buffer->ref_handle); 1475 pdesc->reference_handle = cpu_to_le16(buffer->ref_handle);
1471 pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size); 1476 pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size);
1472 DPRINTK(INFO, "done writing descripter\n"); 1477
1473 producer = 1478 producer = get_next_index(producer, rds_ring->max_rx_desc_count);
1474 get_next_index(producer, rds_ring->max_rx_desc_count);
1475 index = get_next_index(index, rds_ring->max_rx_desc_count);
1476 } 1479 }
1477 /* if we did allocate buffers, then write the count to Phantom */ 1480 /* if we did allocate buffers, then write the count to Phantom */
1478 if (count) { 1481 if (count) {
1479 rds_ring->begin_alloc = index;
1480 rds_ring->producer = producer; 1482 rds_ring->producer = producer;
1481 /* Window = 1 */ 1483 /* Window = 1 */
1482 adapter->pci_write_normalize(adapter, 1484 adapter->pci_write_normalize(adapter,
@@ -1515,49 +1517,50 @@ static void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter,
1515 struct rcv_desc *pdesc; 1517 struct rcv_desc *pdesc;
1516 struct netxen_rx_buffer *buffer; 1518 struct netxen_rx_buffer *buffer;
1517 int count = 0; 1519 int count = 0;
1518 int index = 0;
1519 struct list_head *head; 1520 struct list_head *head;
1521 dma_addr_t dma;
1520 1522
1521 rds_ring = &recv_ctx->rds_rings[ringid]; 1523 rds_ring = &recv_ctx->rds_rings[ringid];
1522 1524
1523 producer = rds_ring->producer; 1525 producer = rds_ring->producer;
1524 index = rds_ring->begin_alloc;
1525 head = &rds_ring->free_list; 1526 head = &rds_ring->free_list;
1526 /* We can start writing rx descriptors into the phantom memory. */ 1527 /* We can start writing rx descriptors into the phantom memory. */
1527 while (!list_empty(head)) { 1528 while (!list_empty(head)) {
1528 1529
1529 skb = dev_alloc_skb(rds_ring->skb_size); 1530 skb = dev_alloc_skb(rds_ring->skb_size);
1530 if (unlikely(!skb)) { 1531 if (unlikely(!skb)) {
1531 rds_ring->begin_alloc = index;
1532 break; 1532 break;
1533 } 1533 }
1534 1534
1535 if (!adapter->ahw.cut_through)
1536 skb_reserve(skb, 2);
1537
1538 dma = pci_map_single(pdev, skb->data,
1539 rds_ring->dma_size, PCI_DMA_FROMDEVICE);
1540 if (pci_dma_mapping_error(pdev, dma)) {
1541 dev_kfree_skb_any(skb);
1542 break;
1543 }
1544
1545 count++;
1535 buffer = list_entry(head->next, struct netxen_rx_buffer, list); 1546 buffer = list_entry(head->next, struct netxen_rx_buffer, list);
1536 list_del(&buffer->list); 1547 list_del(&buffer->list);
1537 1548
1538 count++; /* now there should be no failure */
1539 pdesc = &rds_ring->desc_head[producer];
1540 if (!adapter->ahw.cut_through)
1541 skb_reserve(skb, 2);
1542 buffer->skb = skb; 1549 buffer->skb = skb;
1543 buffer->state = NETXEN_BUFFER_BUSY; 1550 buffer->state = NETXEN_BUFFER_BUSY;
1544 buffer->dma = pci_map_single(pdev, skb->data, 1551 buffer->dma = dma;
1545 rds_ring->dma_size,
1546 PCI_DMA_FROMDEVICE);
1547 1552
1548 /* make a rcv descriptor */ 1553 /* make a rcv descriptor */
1554 pdesc = &rds_ring->desc_head[producer];
1549 pdesc->reference_handle = cpu_to_le16(buffer->ref_handle); 1555 pdesc->reference_handle = cpu_to_le16(buffer->ref_handle);
1550 pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size); 1556 pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size);
1551 pdesc->addr_buffer = cpu_to_le64(buffer->dma); 1557 pdesc->addr_buffer = cpu_to_le64(buffer->dma);
1552 producer = 1558
1553 get_next_index(producer, rds_ring->max_rx_desc_count); 1559 producer = get_next_index(producer, rds_ring->max_rx_desc_count);
1554 index = get_next_index(index, rds_ring->max_rx_desc_count);
1555 buffer = &rds_ring->rx_buf_arr[index];
1556 } 1560 }
1557 1561
1558 /* if we did allocate buffers, then write the count to Phantom */ 1562 /* if we did allocate buffers, then write the count to Phantom */
1559 if (count) { 1563 if (count) {
1560 rds_ring->begin_alloc = index;
1561 rds_ring->producer = producer; 1564 rds_ring->producer = producer;
1562 /* Window = 1 */ 1565 /* Window = 1 */
1563 adapter->pci_write_normalize(adapter, 1566 adapter->pci_write_normalize(adapter,
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index ba01524b5531..86867405a367 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -39,6 +39,7 @@
39#include "netxen_nic_phan_reg.h" 39#include "netxen_nic_phan_reg.h"
40 40
41#include <linux/dma-mapping.h> 41#include <linux/dma-mapping.h>
42#include <linux/if_vlan.h>
42#include <net/ip.h> 43#include <net/ip.h>
43 44
44MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); 45MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver");
@@ -242,7 +243,7 @@ static void netxen_check_options(struct netxen_adapter *adapter)
242 case NETXEN_BRDTYPE_P3_4_GB: 243 case NETXEN_BRDTYPE_P3_4_GB:
243 case NETXEN_BRDTYPE_P3_4_GB_MM: 244 case NETXEN_BRDTYPE_P3_4_GB_MM:
244 adapter->msix_supported = !!use_msi_x; 245 adapter->msix_supported = !!use_msi_x;
245 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_10G; 246 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G;
246 break; 247 break;
247 248
248 case NETXEN_BRDTYPE_P2_SB35_4G: 249 case NETXEN_BRDTYPE_P2_SB35_4G:
@@ -251,6 +252,14 @@ static void netxen_check_options(struct netxen_adapter *adapter)
251 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; 252 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G;
252 break; 253 break;
253 254
255 case NETXEN_BRDTYPE_P3_10G_TP:
256 adapter->msix_supported = !!use_msi_x;
257 if (adapter->ahw.board_type == NETXEN_NIC_XGBE)
258 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_10G;
259 else
260 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G;
261 break;
262
254 default: 263 default:
255 adapter->msix_supported = 0; 264 adapter->msix_supported = 0;
256 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; 265 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G;
@@ -271,10 +280,15 @@ static void netxen_check_options(struct netxen_adapter *adapter)
271static int 280static int
272netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot) 281netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot)
273{ 282{
274 int ret = 0; 283 u32 val, timeout;
275 284
276 if (first_boot == 0x55555555) { 285 if (first_boot == 0x55555555) {
277 /* This is the first boot after power up */ 286 /* This is the first boot after power up */
287 adapter->pci_write_normalize(adapter,
288 NETXEN_CAM_RAM(0x1fc), NETXEN_BDINFO_MAGIC);
289
290 if (!NX_IS_REVISION_P2(adapter->ahw.revision_id))
291 return 0;
278 292
279 /* PCI bus master workaround */ 293 /* PCI bus master workaround */
280 adapter->hw_read_wx(adapter, 294 adapter->hw_read_wx(adapter,
@@ -294,18 +308,26 @@ netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot)
294 /* clear the register for future unloads/loads */ 308 /* clear the register for future unloads/loads */
295 adapter->pci_write_normalize(adapter, 309 adapter->pci_write_normalize(adapter,
296 NETXEN_CAM_RAM(0x1fc), 0); 310 NETXEN_CAM_RAM(0x1fc), 0);
297 ret = -1; 311 return -EIO;
298 } 312 }
299 313
300 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { 314 /* Start P2 boot loader */
301 /* Start P2 boot loader */ 315 val = adapter->pci_read_normalize(adapter,
302 adapter->pci_write_normalize(adapter, 316 NETXEN_ROMUSB_GLB_PEGTUNE_DONE);
303 NETXEN_CAM_RAM(0x1fc), NETXEN_BDINFO_MAGIC); 317 adapter->pci_write_normalize(adapter,
304 adapter->pci_write_normalize(adapter, 318 NETXEN_ROMUSB_GLB_PEGTUNE_DONE, val | 0x1);
305 NETXEN_ROMUSB_GLB_PEGTUNE_DONE, 1); 319 timeout = 0;
306 } 320 do {
321 msleep(1);
322 val = adapter->pci_read_normalize(adapter,
323 NETXEN_CAM_RAM(0x1fc));
324
325 if (++timeout > 5000)
326 return -EIO;
327
328 } while (val == NETXEN_BDINFO_MAGIC);
307 } 329 }
308 return ret; 330 return 0;
309} 331}
310 332
311static void netxen_set_port_mode(struct netxen_adapter *adapter) 333static void netxen_set_port_mode(struct netxen_adapter *adapter)
@@ -784,8 +806,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
784 CRB_CMDPEG_STATE, 0); 806 CRB_CMDPEG_STATE, 0);
785 netxen_pinit_from_rom(adapter, 0); 807 netxen_pinit_from_rom(adapter, 0);
786 msleep(1); 808 msleep(1);
787 netxen_load_firmware(adapter);
788 } 809 }
810 netxen_load_firmware(adapter);
789 811
790 if (NX_IS_REVISION_P3(revision_id)) 812 if (NX_IS_REVISION_P3(revision_id))
791 netxen_pcie_strap_init(adapter); 813 netxen_pcie_strap_init(adapter);
@@ -801,13 +823,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
801 823
802 } 824 }
803 825
804 if ((first_boot == 0x55555555) &&
805 (NX_IS_REVISION_P2(revision_id))) {
806 /* Unlock the HW, prompting the boot sequence */
807 adapter->pci_write_normalize(adapter,
808 NETXEN_ROMUSB_GLB_PEGTUNE_DONE, 1);
809 }
810
811 err = netxen_initialize_adapter_offload(adapter); 826 err = netxen_initialize_adapter_offload(adapter);
812 if (err) 827 if (err)
813 goto err_out_iounmap; 828 goto err_out_iounmap;
@@ -821,7 +836,9 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
821 adapter->pci_write_normalize(adapter, CRB_DRIVER_VERSION, i); 836 adapter->pci_write_normalize(adapter, CRB_DRIVER_VERSION, i);
822 837
823 /* Handshake with the card before we register the devices. */ 838 /* Handshake with the card before we register the devices. */
824 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); 839 err = netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
840 if (err)
841 goto err_out_free_offload;
825 842
826 } /* first_driver */ 843 } /* first_driver */
827 844
@@ -925,6 +942,7 @@ err_out_disable_msi:
925 if (adapter->flags & NETXEN_NIC_MSI_ENABLED) 942 if (adapter->flags & NETXEN_NIC_MSI_ENABLED)
926 pci_disable_msi(pdev); 943 pci_disable_msi(pdev);
927 944
945err_out_free_offload:
928 if (first_driver) 946 if (first_driver)
929 netxen_free_adapter_offload(adapter); 947 netxen_free_adapter_offload(adapter);
930 948
@@ -968,6 +986,9 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
968 netxen_free_hw_resources(adapter); 986 netxen_free_hw_resources(adapter);
969 netxen_release_rx_buffers(adapter); 987 netxen_release_rx_buffers(adapter);
970 netxen_free_sw_resources(adapter); 988 netxen_free_sw_resources(adapter);
989
990 if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
991 netxen_p3_free_mac_list(adapter);
971 } 992 }
972 993
973 if (adapter->portnum == 0) 994 if (adapter->portnum == 0)
@@ -1137,29 +1158,64 @@ static int netxen_nic_close(struct net_device *netdev)
1137 return 0; 1158 return 0;
1138} 1159}
1139 1160
1140void netxen_tso_check(struct netxen_adapter *adapter, 1161static bool netxen_tso_check(struct net_device *netdev,
1141 struct cmd_desc_type0 *desc, struct sk_buff *skb) 1162 struct cmd_desc_type0 *desc, struct sk_buff *skb)
1142{ 1163{
1143 if (desc->mss) { 1164 bool tso = false;
1144 desc->total_hdr_length = (sizeof(struct ethhdr) + 1165 u8 opcode = TX_ETHER_PKT;
1145 ip_hdrlen(skb) + tcp_hdrlen(skb));
1146 1166
1147 if ((NX_IS_REVISION_P3(adapter->ahw.revision_id)) && 1167 if ((netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) &&
1148 (skb->protocol == htons(ETH_P_IPV6))) 1168 skb_shinfo(skb)->gso_size > 0) {
1149 netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO6); 1169
1150 else 1170 desc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size);
1151 netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO); 1171 desc->total_hdr_length =
1172 skb_transport_offset(skb) + tcp_hdrlen(skb);
1173
1174 opcode = (skb->protocol == htons(ETH_P_IPV6)) ?
1175 TX_TCP_LSO6 : TX_TCP_LSO;
1176 tso = true;
1152 1177
1153 } else if (skb->ip_summed == CHECKSUM_PARTIAL) { 1178 } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
1154 if (ip_hdr(skb)->protocol == IPPROTO_TCP) 1179 u8 l4proto;
1155 netxen_set_cmd_desc_opcode(desc, TX_TCP_PKT); 1180
1156 else if (ip_hdr(skb)->protocol == IPPROTO_UDP) 1181 if (skb->protocol == htons(ETH_P_IP)) {
1157 netxen_set_cmd_desc_opcode(desc, TX_UDP_PKT); 1182 l4proto = ip_hdr(skb)->protocol;
1158 else 1183
1159 return; 1184 if (l4proto == IPPROTO_TCP)
1185 opcode = TX_TCP_PKT;
1186 else if(l4proto == IPPROTO_UDP)
1187 opcode = TX_UDP_PKT;
1188 } else if (skb->protocol == htons(ETH_P_IPV6)) {
1189 l4proto = ipv6_hdr(skb)->nexthdr;
1190
1191 if (l4proto == IPPROTO_TCP)
1192 opcode = TX_TCPV6_PKT;
1193 else if(l4proto == IPPROTO_UDP)
1194 opcode = TX_UDPV6_PKT;
1195 }
1160 } 1196 }
1161 desc->tcp_hdr_offset = skb_transport_offset(skb); 1197 desc->tcp_hdr_offset = skb_transport_offset(skb);
1162 desc->ip_hdr_offset = skb_network_offset(skb); 1198 desc->ip_hdr_offset = skb_network_offset(skb);
1199 netxen_set_tx_flags_opcode(desc, 0, opcode);
1200 return tso;
1201}
1202
1203static void
1204netxen_clean_tx_dma_mapping(struct pci_dev *pdev,
1205 struct netxen_cmd_buffer *pbuf, int last)
1206{
1207 int k;
1208 struct netxen_skb_frag *buffrag;
1209
1210 buffrag = &pbuf->frag_array[0];
1211 pci_unmap_single(pdev, buffrag->dma,
1212 buffrag->length, PCI_DMA_TODEVICE);
1213
1214 for (k = 1; k < last; k++) {
1215 buffrag = &pbuf->frag_array[k];
1216 pci_unmap_page(pdev, buffrag->dma,
1217 buffrag->length, PCI_DMA_TODEVICE);
1218 }
1163} 1219}
1164 1220
1165static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 1221static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
@@ -1167,33 +1223,22 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1167 struct netxen_adapter *adapter = netdev_priv(netdev); 1223 struct netxen_adapter *adapter = netdev_priv(netdev);
1168 struct netxen_hardware_context *hw = &adapter->ahw; 1224 struct netxen_hardware_context *hw = &adapter->ahw;
1169 unsigned int first_seg_len = skb->len - skb->data_len; 1225 unsigned int first_seg_len = skb->len - skb->data_len;
1226 struct netxen_cmd_buffer *pbuf;
1170 struct netxen_skb_frag *buffrag; 1227 struct netxen_skb_frag *buffrag;
1171 unsigned int i; 1228 struct cmd_desc_type0 *hwdesc;
1229 struct pci_dev *pdev = adapter->pdev;
1230 dma_addr_t temp_dma;
1231 int i, k;
1172 1232
1173 u32 producer, consumer; 1233 u32 producer, consumer;
1174 u32 saved_producer = 0; 1234 int frag_count, no_of_desc;
1175 struct cmd_desc_type0 *hwdesc;
1176 int k;
1177 struct netxen_cmd_buffer *pbuf = NULL;
1178 int frag_count;
1179 int no_of_desc;
1180 u32 num_txd = adapter->max_tx_desc_count; 1235 u32 num_txd = adapter->max_tx_desc_count;
1236 bool is_tso = false;
1181 1237
1182 frag_count = skb_shinfo(skb)->nr_frags + 1; 1238 frag_count = skb_shinfo(skb)->nr_frags + 1;
1183 1239
1184 /* There 4 fragments per descriptor */ 1240 /* There 4 fragments per descriptor */
1185 no_of_desc = (frag_count + 3) >> 2; 1241 no_of_desc = (frag_count + 3) >> 2;
1186 if (netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) {
1187 if (skb_shinfo(skb)->gso_size > 0) {
1188
1189 no_of_desc++;
1190 if ((ip_hdrlen(skb) + tcp_hdrlen(skb) +
1191 sizeof(struct ethhdr)) >
1192 (sizeof(struct cmd_desc_type0) - 2)) {
1193 no_of_desc++;
1194 }
1195 }
1196 }
1197 1242
1198 producer = adapter->cmd_producer; 1243 producer = adapter->cmd_producer;
1199 smp_mb(); 1244 smp_mb();
@@ -1205,34 +1250,26 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1205 } 1250 }
1206 1251
1207 /* Copy the descriptors into the hardware */ 1252 /* Copy the descriptors into the hardware */
1208 saved_producer = producer;
1209 hwdesc = &hw->cmd_desc_head[producer]; 1253 hwdesc = &hw->cmd_desc_head[producer];
1210 memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); 1254 memset(hwdesc, 0, sizeof(struct cmd_desc_type0));
1211 /* Take skb->data itself */ 1255 /* Take skb->data itself */
1212 pbuf = &adapter->cmd_buf_arr[producer]; 1256 pbuf = &adapter->cmd_buf_arr[producer];
1213 if ((netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) && 1257
1214 skb_shinfo(skb)->gso_size > 0) { 1258 is_tso = netxen_tso_check(netdev, hwdesc, skb);
1215 pbuf->mss = skb_shinfo(skb)->gso_size; 1259
1216 hwdesc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size);
1217 } else {
1218 pbuf->mss = 0;
1219 hwdesc->mss = 0;
1220 }
1221 pbuf->total_length = skb->len;
1222 pbuf->skb = skb; 1260 pbuf->skb = skb;
1223 pbuf->cmd = TX_ETHER_PKT;
1224 pbuf->frag_count = frag_count; 1261 pbuf->frag_count = frag_count;
1225 pbuf->port = adapter->portnum;
1226 buffrag = &pbuf->frag_array[0]; 1262 buffrag = &pbuf->frag_array[0];
1227 buffrag->dma = pci_map_single(adapter->pdev, skb->data, first_seg_len, 1263 temp_dma = pci_map_single(pdev, skb->data, first_seg_len,
1228 PCI_DMA_TODEVICE); 1264 PCI_DMA_TODEVICE);
1265 if (pci_dma_mapping_error(pdev, temp_dma))
1266 goto drop_packet;
1267
1268 buffrag->dma = temp_dma;
1229 buffrag->length = first_seg_len; 1269 buffrag->length = first_seg_len;
1230 netxen_set_cmd_desc_totallength(hwdesc, skb->len); 1270 netxen_set_tx_frags_len(hwdesc, frag_count, skb->len);
1231 netxen_set_cmd_desc_num_of_buff(hwdesc, frag_count); 1271 netxen_set_tx_port(hwdesc, adapter->portnum);
1232 netxen_set_cmd_desc_opcode(hwdesc, TX_ETHER_PKT);
1233 1272
1234 netxen_set_cmd_desc_port(hwdesc, adapter->portnum);
1235 netxen_set_cmd_desc_ctxid(hwdesc, adapter->portnum);
1236 hwdesc->buffer1_length = cpu_to_le16(first_seg_len); 1273 hwdesc->buffer1_length = cpu_to_le16(first_seg_len);
1237 hwdesc->addr_buffer1 = cpu_to_le64(buffrag->dma); 1274 hwdesc->addr_buffer1 = cpu_to_le64(buffrag->dma);
1238 1275
@@ -1240,7 +1277,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1240 struct skb_frag_struct *frag; 1277 struct skb_frag_struct *frag;
1241 int len, temp_len; 1278 int len, temp_len;
1242 unsigned long offset; 1279 unsigned long offset;
1243 dma_addr_t temp_dma;
1244 1280
1245 /* move to next desc. if there is a need */ 1281 /* move to next desc. if there is a need */
1246 if ((i & 0x3) == 0) { 1282 if ((i & 0x3) == 0) {
@@ -1256,8 +1292,12 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1256 offset = frag->page_offset; 1292 offset = frag->page_offset;
1257 1293
1258 temp_len = len; 1294 temp_len = len;
1259 temp_dma = pci_map_page(adapter->pdev, frag->page, offset, 1295 temp_dma = pci_map_page(pdev, frag->page, offset,
1260 len, PCI_DMA_TODEVICE); 1296 len, PCI_DMA_TODEVICE);
1297 if (pci_dma_mapping_error(pdev, temp_dma)) {
1298 netxen_clean_tx_dma_mapping(pdev, pbuf, i);
1299 goto drop_packet;
1300 }
1261 1301
1262 buffrag++; 1302 buffrag++;
1263 buffrag->dma = temp_dma; 1303 buffrag->dma = temp_dma;
@@ -1285,16 +1325,12 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1285 } 1325 }
1286 producer = get_next_index(producer, num_txd); 1326 producer = get_next_index(producer, num_txd);
1287 1327
1288 /* might change opcode to TX_TCP_LSO */
1289 netxen_tso_check(adapter, &hw->cmd_desc_head[saved_producer], skb);
1290
1291 /* For LSO, we need to copy the MAC/IP/TCP headers into 1328 /* For LSO, we need to copy the MAC/IP/TCP headers into
1292 * the descriptor ring 1329 * the descriptor ring
1293 */ 1330 */
1294 if (netxen_get_cmd_desc_opcode(&hw->cmd_desc_head[saved_producer]) 1331 if (is_tso) {
1295 == TX_TCP_LSO) {
1296 int hdr_len, first_hdr_len, more_hdr; 1332 int hdr_len, first_hdr_len, more_hdr;
1297 hdr_len = hw->cmd_desc_head[saved_producer].total_hdr_length; 1333 hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
1298 if (hdr_len > (sizeof(struct cmd_desc_type0) - 2)) { 1334 if (hdr_len > (sizeof(struct cmd_desc_type0) - 2)) {
1299 first_hdr_len = sizeof(struct cmd_desc_type0) - 2; 1335 first_hdr_len = sizeof(struct cmd_desc_type0) - 2;
1300 more_hdr = 1; 1336 more_hdr = 1;
@@ -1336,6 +1372,11 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1336 netdev->trans_start = jiffies; 1372 netdev->trans_start = jiffies;
1337 1373
1338 return NETDEV_TX_OK; 1374 return NETDEV_TX_OK;
1375
1376drop_packet:
1377 adapter->stats.txdropped++;
1378 dev_kfree_skb_any(skb);
1379 return NETDEV_TX_OK;
1339} 1380}
1340 1381
1341static int netxen_nic_check_temp(struct netxen_adapter *adapter) 1382static int netxen_nic_check_temp(struct netxen_adapter *adapter)
@@ -1407,6 +1448,8 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter)
1407 netif_carrier_off(netdev); 1448 netif_carrier_off(netdev);
1408 netif_stop_queue(netdev); 1449 netif_stop_queue(netdev);
1409 } 1450 }
1451
1452 netxen_nic_set_link_parameters(adapter);
1410 } else if (!adapter->ahw.linkup && linkup) { 1453 } else if (!adapter->ahw.linkup && linkup) {
1411 printk(KERN_INFO "%s: %s NIC Link is up\n", 1454 printk(KERN_INFO "%s: %s NIC Link is up\n",
1412 netxen_nic_driver_name, netdev->name); 1455 netxen_nic_driver_name, netdev->name);
@@ -1415,6 +1458,8 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter)
1415 netif_carrier_on(netdev); 1458 netif_carrier_on(netdev);
1416 netif_wake_queue(netdev); 1459 netif_wake_queue(netdev);
1417 } 1460 }
1461
1462 netxen_nic_set_link_parameters(adapter);
1418 } 1463 }
1419} 1464}
1420 1465
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index 42021aca1ddd..e80294d8cc19 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -1956,6 +1956,7 @@ static const struct net_device_ops netdev_ops = {
1956 .ndo_change_mtu = ns83820_change_mtu, 1956 .ndo_change_mtu = ns83820_change_mtu,
1957 .ndo_set_multicast_list = ns83820_set_multicast, 1957 .ndo_set_multicast_list = ns83820_set_multicast,
1958 .ndo_validate_addr = eth_validate_addr, 1958 .ndo_validate_addr = eth_validate_addr,
1959 .ndo_set_mac_address = eth_mac_addr,
1959 .ndo_tx_timeout = ns83820_tx_timeout, 1960 .ndo_tx_timeout = ns83820_tx_timeout,
1960#ifdef NS83820_VLAN_ACCEL_SUPPORT 1961#ifdef NS83820_VLAN_ACCEL_SUPPORT
1961 .ndo_vlan_rx_register = ns83820_vlan_rx_register, 1962 .ndo_vlan_rx_register = ns83820_vlan_rx_register,
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index 5b7a574ce571..d0349e7d73ea 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -712,7 +712,7 @@ static inline void pasemi_mac_rx_error(const struct pasemi_mac *mac,
712 rcmdsta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); 712 rcmdsta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if));
713 ccmdsta = read_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(chan->chno)); 713 ccmdsta = read_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(chan->chno));
714 714
715 printk(KERN_ERR "pasemi_mac: rx error. macrx %016lx, rx status %lx\n", 715 printk(KERN_ERR "pasemi_mac: rx error. macrx %016llx, rx status %llx\n",
716 macrx, *chan->status); 716 macrx, *chan->status);
717 717
718 printk(KERN_ERR "pasemi_mac: rcmdsta %08x ccmdsta %08x\n", 718 printk(KERN_ERR "pasemi_mac: rcmdsta %08x ccmdsta %08x\n",
@@ -730,8 +730,8 @@ static inline void pasemi_mac_tx_error(const struct pasemi_mac *mac,
730 730
731 cmdsta = read_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(chan->chno)); 731 cmdsta = read_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(chan->chno));
732 732
733 printk(KERN_ERR "pasemi_mac: tx error. mactx 0x%016lx, "\ 733 printk(KERN_ERR "pasemi_mac: tx error. mactx 0x%016llx, "\
734 "tx status 0x%016lx\n", mactx, *chan->status); 734 "tx status 0x%016llx\n", mactx, *chan->status);
735 735
736 printk(KERN_ERR "pasemi_mac: tcmdsta 0x%08x\n", cmdsta); 736 printk(KERN_ERR "pasemi_mac: tcmdsta 0x%08x\n", cmdsta);
737} 737}
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index e35460165bf7..0a06e4fd37d9 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -231,15 +231,6 @@ struct phy_device * get_phy_device(struct mii_bus *bus, int addr)
231 if ((phy_id & 0x1fffffff) == 0x1fffffff) 231 if ((phy_id & 0x1fffffff) == 0x1fffffff)
232 return NULL; 232 return NULL;
233 233
234 /*
235 * Broken hardware is sometimes missing the pull-up resistor on the
236 * MDIO line, which results in reads to non-existent devices returning
237 * 0 rather than 0xffff. Catch this here and treat 0 as a non-existent
238 * device as well.
239 */
240 if (phy_id == 0)
241 return NULL;
242
243 dev = phy_device_create(bus, addr, phy_id); 234 dev = phy_device_create(bus, addr, phy_id);
244 235
245 return dev; 236 return dev;
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 06b448285eb5..7b2728b8f1b7 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -250,6 +250,7 @@ static int ppp_connect_channel(struct channel *pch, int unit);
250static int ppp_disconnect_channel(struct channel *pch); 250static int ppp_disconnect_channel(struct channel *pch);
251static void ppp_destroy_channel(struct channel *pch); 251static void ppp_destroy_channel(struct channel *pch);
252static int unit_get(struct idr *p, void *ptr); 252static int unit_get(struct idr *p, void *ptr);
253static int unit_set(struct idr *p, void *ptr, int n);
253static void unit_put(struct idr *p, int n); 254static void unit_put(struct idr *p, int n);
254static void *unit_find(struct idr *p, int n); 255static void *unit_find(struct idr *p, int n);
255 256
@@ -2432,11 +2433,18 @@ ppp_create_interface(int unit, int *retp)
2432 } else { 2433 } else {
2433 if (unit_find(&ppp_units_idr, unit)) 2434 if (unit_find(&ppp_units_idr, unit))
2434 goto out2; /* unit already exists */ 2435 goto out2; /* unit already exists */
2435 else { 2436 /*
2436 /* darn, someone is cheating us? */ 2437 * if caller need a specified unit number
2437 *retp = -EINVAL; 2438 * lets try to satisfy him, otherwise --
2439 * he should better ask us for new unit number
2440 *
2441 * NOTE: yes I know that returning EEXIST it's not
2442 * fair but at least pppd will ask us to allocate
2443 * new unit in this case so user is happy :)
2444 */
2445 unit = unit_set(&ppp_units_idr, ppp, unit);
2446 if (unit < 0)
2438 goto out2; 2447 goto out2;
2439 }
2440 } 2448 }
2441 2449
2442 /* Initialize the new ppp unit */ 2450 /* Initialize the new ppp unit */
@@ -2677,14 +2685,37 @@ static void __exit ppp_cleanup(void)
2677 * by holding all_ppp_mutex 2685 * by holding all_ppp_mutex
2678 */ 2686 */
2679 2687
2688/* associate pointer with specified number */
2689static int unit_set(struct idr *p, void *ptr, int n)
2690{
2691 int unit, err;
2692
2693again:
2694 if (!idr_pre_get(p, GFP_KERNEL)) {
2695 printk(KERN_ERR "PPP: No free memory for idr\n");
2696 return -ENOMEM;
2697 }
2698
2699 err = idr_get_new_above(p, ptr, n, &unit);
2700 if (err == -EAGAIN)
2701 goto again;
2702
2703 if (unit != n) {
2704 idr_remove(p, unit);
2705 return -EINVAL;
2706 }
2707
2708 return unit;
2709}
2710
2680/* get new free unit number and associate pointer with it */ 2711/* get new free unit number and associate pointer with it */
2681static int unit_get(struct idr *p, void *ptr) 2712static int unit_get(struct idr *p, void *ptr)
2682{ 2713{
2683 int unit, err; 2714 int unit, err;
2684 2715
2685again: 2716again:
2686 if (idr_pre_get(p, GFP_KERNEL) == 0) { 2717 if (!idr_pre_get(p, GFP_KERNEL)) {
2687 printk(KERN_ERR "Out of memory expanding drawable idr\n"); 2718 printk(KERN_ERR "PPP: No free memory for idr\n");
2688 return -ENOMEM; 2719 return -ENOMEM;
2689 } 2720 }
2690 2721
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h
index 459663a4023d..c1dadadfab18 100644
--- a/drivers/net/qlge/qlge.h
+++ b/drivers/net/qlge/qlge.h
@@ -28,11 +28,11 @@
28 } while (0) 28 } while (0)
29 29
30#define QLGE_VENDOR_ID 0x1077 30#define QLGE_VENDOR_ID 0x1077
31#define QLGE_DEVICE_ID1 0x8012 31#define QLGE_DEVICE_ID 0x8012
32#define QLGE_DEVICE_ID 0x8000
33 32
34#define MAX_RX_RINGS 128 33#define MAX_CPUS 8
35#define MAX_TX_RINGS 128 34#define MAX_TX_RINGS MAX_CPUS
35#define MAX_RX_RINGS ((MAX_CPUS * 2) + 1)
36 36
37#define NUM_TX_RING_ENTRIES 256 37#define NUM_TX_RING_ENTRIES 256
38#define NUM_RX_RING_ENTRIES 256 38#define NUM_RX_RING_ENTRIES 256
@@ -45,6 +45,7 @@
45#define MAX_SPLIT_SIZE 1023 45#define MAX_SPLIT_SIZE 1023
46#define QLGE_SB_PAD 32 46#define QLGE_SB_PAD 32
47 47
48#define MAX_CQ 128
48#define DFLT_COALESCE_WAIT 100 /* 100 usec wait for coalescing */ 49#define DFLT_COALESCE_WAIT 100 /* 100 usec wait for coalescing */
49#define MAX_INTER_FRAME_WAIT 10 /* 10 usec max interframe-wait for coalescing */ 50#define MAX_INTER_FRAME_WAIT 10 /* 10 usec max interframe-wait for coalescing */
50#define DFLT_INTER_FRAME_WAIT (MAX_INTER_FRAME_WAIT/2) 51#define DFLT_INTER_FRAME_WAIT (MAX_INTER_FRAME_WAIT/2)
@@ -961,8 +962,7 @@ struct ib_mac_iocb_rsp {
961#define IB_MAC_IOCB_RSP_DS 0x40 /* data is in small buffer */ 962#define IB_MAC_IOCB_RSP_DS 0x40 /* data is in small buffer */
962#define IB_MAC_IOCB_RSP_DL 0x80 /* data is in large buffer */ 963#define IB_MAC_IOCB_RSP_DL 0x80 /* data is in large buffer */
963 __le32 data_len; /* */ 964 __le32 data_len; /* */
964 __le32 data_addr_lo; /* */ 965 __le64 data_addr; /* */
965 __le32 data_addr_hi; /* */
966 __le32 rss; /* */ 966 __le32 rss; /* */
967 __le16 vlan_id; /* 12 bits */ 967 __le16 vlan_id; /* 12 bits */
968#define IB_MAC_IOCB_RSP_C 0x1000 /* VLAN CFI bit */ 968#define IB_MAC_IOCB_RSP_C 0x1000 /* VLAN CFI bit */
@@ -976,8 +976,7 @@ struct ib_mac_iocb_rsp {
976#define IB_MAC_IOCB_RSP_HS 0x40 976#define IB_MAC_IOCB_RSP_HS 0x40
977#define IB_MAC_IOCB_RSP_HL 0x80 977#define IB_MAC_IOCB_RSP_HL 0x80
978 __le32 hdr_len; /* */ 978 __le32 hdr_len; /* */
979 __le32 hdr_addr_lo; /* */ 979 __le64 hdr_addr; /* */
980 __le32 hdr_addr_hi; /* */
981} __attribute((packed)); 980} __attribute((packed));
982 981
983struct ib_ae_iocb_rsp { 982struct ib_ae_iocb_rsp {
@@ -1042,10 +1041,8 @@ struct wqicb {
1042 __le16 cq_id_rss; 1041 __le16 cq_id_rss;
1043#define Q_CQ_ID_RSS_RV 0x8000 1042#define Q_CQ_ID_RSS_RV 0x8000
1044 __le16 rid; 1043 __le16 rid;
1045 __le32 addr_lo; 1044 __le64 addr;
1046 __le32 addr_hi; 1045 __le64 cnsmr_idx_addr;
1047 __le32 cnsmr_idx_addr_lo;
1048 __le32 cnsmr_idx_addr_hi;
1049} __attribute((packed)); 1046} __attribute((packed));
1050 1047
1051/* 1048/*
@@ -1070,18 +1067,14 @@ struct cqicb {
1070#define LEN_CPP_64 0x0002 1067#define LEN_CPP_64 0x0002
1071#define LEN_CPP_128 0x0003 1068#define LEN_CPP_128 0x0003
1072 __le16 rid; 1069 __le16 rid;
1073 __le32 addr_lo; 1070 __le64 addr;
1074 __le32 addr_hi; 1071 __le64 prod_idx_addr;
1075 __le32 prod_idx_addr_lo;
1076 __le32 prod_idx_addr_hi;
1077 __le16 pkt_delay; 1072 __le16 pkt_delay;
1078 __le16 irq_delay; 1073 __le16 irq_delay;
1079 __le32 lbq_addr_lo; 1074 __le64 lbq_addr;
1080 __le32 lbq_addr_hi;
1081 __le16 lbq_buf_size; 1075 __le16 lbq_buf_size;
1082 __le16 lbq_len; /* entry count */ 1076 __le16 lbq_len; /* entry count */
1083 __le32 sbq_addr_lo; 1077 __le64 sbq_addr;
1084 __le32 sbq_addr_hi;
1085 __le16 sbq_buf_size; 1078 __le16 sbq_buf_size;
1086 __le16 sbq_len; /* entry count */ 1079 __le16 sbq_len; /* entry count */
1087} __attribute((packed)); 1080} __attribute((packed));
@@ -1145,7 +1138,7 @@ struct tx_ring {
1145 struct wqicb wqicb; /* structure used to inform chip of new queue */ 1138 struct wqicb wqicb; /* structure used to inform chip of new queue */
1146 void *wq_base; /* pci_alloc:virtual addr for tx */ 1139 void *wq_base; /* pci_alloc:virtual addr for tx */
1147 dma_addr_t wq_base_dma; /* pci_alloc:dma addr for tx */ 1140 dma_addr_t wq_base_dma; /* pci_alloc:dma addr for tx */
1148 u32 *cnsmr_idx_sh_reg; /* shadow copy of consumer idx */ 1141 __le32 *cnsmr_idx_sh_reg; /* shadow copy of consumer idx */
1149 dma_addr_t cnsmr_idx_sh_reg_dma; /* dma-shadow copy of consumer */ 1142 dma_addr_t cnsmr_idx_sh_reg_dma; /* dma-shadow copy of consumer */
1150 u32 wq_size; /* size in bytes of queue area */ 1143 u32 wq_size; /* size in bytes of queue area */
1151 u32 wq_len; /* number of entries in queue */ 1144 u32 wq_len; /* number of entries in queue */
@@ -1181,7 +1174,7 @@ struct rx_ring {
1181 u32 cq_size; 1174 u32 cq_size;
1182 u32 cq_len; 1175 u32 cq_len;
1183 u16 cq_id; 1176 u16 cq_id;
1184 volatile __le32 *prod_idx_sh_reg; /* Shadowed producer register. */ 1177 __le32 *prod_idx_sh_reg; /* Shadowed producer register. */
1185 dma_addr_t prod_idx_sh_reg_dma; 1178 dma_addr_t prod_idx_sh_reg_dma;
1186 void __iomem *cnsmr_idx_db_reg; /* PCI doorbell mem area + 0 */ 1179 void __iomem *cnsmr_idx_db_reg; /* PCI doorbell mem area + 0 */
1187 u32 cnsmr_idx; /* current sw idx */ 1180 u32 cnsmr_idx; /* current sw idx */
@@ -1402,9 +1395,11 @@ struct ql_adapter {
1402 int rx_ring_count; 1395 int rx_ring_count;
1403 int ring_mem_size; 1396 int ring_mem_size;
1404 void *ring_mem; 1397 void *ring_mem;
1405 struct rx_ring *rx_ring; 1398
1399 struct rx_ring rx_ring[MAX_RX_RINGS];
1400 struct tx_ring tx_ring[MAX_TX_RINGS];
1401
1406 int rx_csum; 1402 int rx_csum;
1407 struct tx_ring *tx_ring;
1408 u32 default_rx_queue; 1403 u32 default_rx_queue;
1409 1404
1410 u16 rx_coalesce_usecs; /* cqicb->int_delay */ 1405 u16 rx_coalesce_usecs; /* cqicb->int_delay */
@@ -1459,6 +1454,24 @@ static inline void ql_write_db_reg(u32 val, void __iomem *addr)
1459 mmiowb(); 1454 mmiowb();
1460} 1455}
1461 1456
1457/*
1458 * Shadow Registers:
1459 * Outbound queues have a consumer index that is maintained by the chip.
1460 * Inbound queues have a producer index that is maintained by the chip.
1461 * For lower overhead, these registers are "shadowed" to host memory
1462 * which allows the device driver to track the queue progress without
1463 * PCI reads. When an entry is placed on an inbound queue, the chip will
1464 * update the relevant index register and then copy the value to the
1465 * shadow register in host memory.
1466 */
1467static inline u32 ql_read_sh_reg(__le32 *addr)
1468{
1469 u32 reg;
1470 reg = le32_to_cpu(*addr);
1471 rmb();
1472 return reg;
1473}
1474
1462extern char qlge_driver_name[]; 1475extern char qlge_driver_name[];
1463extern const char qlge_driver_version[]; 1476extern const char qlge_driver_version[];
1464extern const struct ethtool_ops qlge_ethtool_ops; 1477extern const struct ethtool_ops qlge_ethtool_ops;
diff --git a/drivers/net/qlge/qlge_dbg.c b/drivers/net/qlge/qlge_dbg.c
index 3f5e02d2e4a9..379b895ed6e6 100644
--- a/drivers/net/qlge/qlge_dbg.c
+++ b/drivers/net/qlge/qlge_dbg.c
@@ -435,14 +435,10 @@ void ql_dump_wqicb(struct wqicb *wqicb)
435 printk(KERN_ERR PFX "wqicb->cq_id_rss = %d.\n", 435 printk(KERN_ERR PFX "wqicb->cq_id_rss = %d.\n",
436 le16_to_cpu(wqicb->cq_id_rss)); 436 le16_to_cpu(wqicb->cq_id_rss));
437 printk(KERN_ERR PFX "wqicb->rid = 0x%x.\n", le16_to_cpu(wqicb->rid)); 437 printk(KERN_ERR PFX "wqicb->rid = 0x%x.\n", le16_to_cpu(wqicb->rid));
438 printk(KERN_ERR PFX "wqicb->wq_addr_lo = 0x%.08x.\n", 438 printk(KERN_ERR PFX "wqicb->wq_addr = 0x%llx.\n",
439 le32_to_cpu(wqicb->addr_lo)); 439 (unsigned long long) le64_to_cpu(wqicb->addr));
440 printk(KERN_ERR PFX "wqicb->wq_addr_hi = 0x%.08x.\n", 440 printk(KERN_ERR PFX "wqicb->wq_cnsmr_idx_addr = 0x%llx.\n",
441 le32_to_cpu(wqicb->addr_hi)); 441 (unsigned long long) le64_to_cpu(wqicb->cnsmr_idx_addr));
442 printk(KERN_ERR PFX "wqicb->wq_cnsmr_idx_addr_lo = 0x%.08x.\n",
443 le32_to_cpu(wqicb->cnsmr_idx_addr_lo));
444 printk(KERN_ERR PFX "wqicb->wq_cnsmr_idx_addr_hi = 0x%.08x.\n",
445 le32_to_cpu(wqicb->cnsmr_idx_addr_hi));
446} 442}
447 443
448void ql_dump_tx_ring(struct tx_ring *tx_ring) 444void ql_dump_tx_ring(struct tx_ring *tx_ring)
@@ -455,10 +451,11 @@ void ql_dump_tx_ring(struct tx_ring *tx_ring)
455 printk(KERN_ERR PFX "tx_ring->base = %p.\n", tx_ring->wq_base); 451 printk(KERN_ERR PFX "tx_ring->base = %p.\n", tx_ring->wq_base);
456 printk(KERN_ERR PFX "tx_ring->base_dma = 0x%llx.\n", 452 printk(KERN_ERR PFX "tx_ring->base_dma = 0x%llx.\n",
457 (unsigned long long) tx_ring->wq_base_dma); 453 (unsigned long long) tx_ring->wq_base_dma);
458 printk(KERN_ERR PFX "tx_ring->cnsmr_idx_sh_reg = %p.\n", 454 printk(KERN_ERR PFX
459 tx_ring->cnsmr_idx_sh_reg); 455 "tx_ring->cnsmr_idx_sh_reg, addr = 0x%p, value = %d.\n",
460 printk(KERN_ERR PFX "tx_ring->cnsmr_idx_sh_reg_dma = 0x%llx.\n", 456 tx_ring->cnsmr_idx_sh_reg,
461 (unsigned long long) tx_ring->cnsmr_idx_sh_reg_dma); 457 tx_ring->cnsmr_idx_sh_reg
458 ? ql_read_sh_reg(tx_ring->cnsmr_idx_sh_reg) : 0);
462 printk(KERN_ERR PFX "tx_ring->size = %d.\n", tx_ring->wq_size); 459 printk(KERN_ERR PFX "tx_ring->size = %d.\n", tx_ring->wq_size);
463 printk(KERN_ERR PFX "tx_ring->len = %d.\n", tx_ring->wq_len); 460 printk(KERN_ERR PFX "tx_ring->len = %d.\n", tx_ring->wq_len);
464 printk(KERN_ERR PFX "tx_ring->prod_idx_db_reg = %p.\n", 461 printk(KERN_ERR PFX "tx_ring->prod_idx_db_reg = %p.\n",
@@ -510,30 +507,22 @@ void ql_dump_cqicb(struct cqicb *cqicb)
510 printk(KERN_ERR PFX "cqicb->msix_vect = %d.\n", cqicb->msix_vect); 507 printk(KERN_ERR PFX "cqicb->msix_vect = %d.\n", cqicb->msix_vect);
511 printk(KERN_ERR PFX "cqicb->flags = %x.\n", cqicb->flags); 508 printk(KERN_ERR PFX "cqicb->flags = %x.\n", cqicb->flags);
512 printk(KERN_ERR PFX "cqicb->len = %d.\n", le16_to_cpu(cqicb->len)); 509 printk(KERN_ERR PFX "cqicb->len = %d.\n", le16_to_cpu(cqicb->len));
513 printk(KERN_ERR PFX "cqicb->addr_lo = %x.\n", 510 printk(KERN_ERR PFX "cqicb->addr = 0x%llx.\n",
514 le32_to_cpu(cqicb->addr_lo)); 511 (unsigned long long) le64_to_cpu(cqicb->addr));
515 printk(KERN_ERR PFX "cqicb->addr_hi = %x.\n", 512 printk(KERN_ERR PFX "cqicb->prod_idx_addr = 0x%llx.\n",
516 le32_to_cpu(cqicb->addr_hi)); 513 (unsigned long long) le64_to_cpu(cqicb->prod_idx_addr));
517 printk(KERN_ERR PFX "cqicb->prod_idx_addr_lo = %x.\n",
518 le32_to_cpu(cqicb->prod_idx_addr_lo));
519 printk(KERN_ERR PFX "cqicb->prod_idx_addr_hi = %x.\n",
520 le32_to_cpu(cqicb->prod_idx_addr_hi));
521 printk(KERN_ERR PFX "cqicb->pkt_delay = 0x%.04x.\n", 514 printk(KERN_ERR PFX "cqicb->pkt_delay = 0x%.04x.\n",
522 le16_to_cpu(cqicb->pkt_delay)); 515 le16_to_cpu(cqicb->pkt_delay));
523 printk(KERN_ERR PFX "cqicb->irq_delay = 0x%.04x.\n", 516 printk(KERN_ERR PFX "cqicb->irq_delay = 0x%.04x.\n",
524 le16_to_cpu(cqicb->irq_delay)); 517 le16_to_cpu(cqicb->irq_delay));
525 printk(KERN_ERR PFX "cqicb->lbq_addr_lo = %x.\n", 518 printk(KERN_ERR PFX "cqicb->lbq_addr = 0x%llx.\n",
526 le32_to_cpu(cqicb->lbq_addr_lo)); 519 (unsigned long long) le64_to_cpu(cqicb->lbq_addr));
527 printk(KERN_ERR PFX "cqicb->lbq_addr_hi = %x.\n",
528 le32_to_cpu(cqicb->lbq_addr_hi));
529 printk(KERN_ERR PFX "cqicb->lbq_buf_size = 0x%.04x.\n", 520 printk(KERN_ERR PFX "cqicb->lbq_buf_size = 0x%.04x.\n",
530 le16_to_cpu(cqicb->lbq_buf_size)); 521 le16_to_cpu(cqicb->lbq_buf_size));
531 printk(KERN_ERR PFX "cqicb->lbq_len = 0x%.04x.\n", 522 printk(KERN_ERR PFX "cqicb->lbq_len = 0x%.04x.\n",
532 le16_to_cpu(cqicb->lbq_len)); 523 le16_to_cpu(cqicb->lbq_len));
533 printk(KERN_ERR PFX "cqicb->sbq_addr_lo = %x.\n", 524 printk(KERN_ERR PFX "cqicb->sbq_addr = 0x%llx.\n",
534 le32_to_cpu(cqicb->sbq_addr_lo)); 525 (unsigned long long) le64_to_cpu(cqicb->sbq_addr));
535 printk(KERN_ERR PFX "cqicb->sbq_addr_hi = %x.\n",
536 le32_to_cpu(cqicb->sbq_addr_hi));
537 printk(KERN_ERR PFX "cqicb->sbq_buf_size = 0x%.04x.\n", 526 printk(KERN_ERR PFX "cqicb->sbq_buf_size = 0x%.04x.\n",
538 le16_to_cpu(cqicb->sbq_buf_size)); 527 le16_to_cpu(cqicb->sbq_buf_size));
539 printk(KERN_ERR PFX "cqicb->sbq_len = 0x%.04x.\n", 528 printk(KERN_ERR PFX "cqicb->sbq_len = 0x%.04x.\n",
@@ -558,9 +547,10 @@ void ql_dump_rx_ring(struct rx_ring *rx_ring)
558 printk(KERN_ERR PFX "rx_ring->cq_size = %d.\n", rx_ring->cq_size); 547 printk(KERN_ERR PFX "rx_ring->cq_size = %d.\n", rx_ring->cq_size);
559 printk(KERN_ERR PFX "rx_ring->cq_len = %d.\n", rx_ring->cq_len); 548 printk(KERN_ERR PFX "rx_ring->cq_len = %d.\n", rx_ring->cq_len);
560 printk(KERN_ERR PFX 549 printk(KERN_ERR PFX
561 "rx_ring->prod_idx_sh_reg, addr = %p, value = %d.\n", 550 "rx_ring->prod_idx_sh_reg, addr = 0x%p, value = %d.\n",
562 rx_ring->prod_idx_sh_reg, 551 rx_ring->prod_idx_sh_reg,
563 rx_ring->prod_idx_sh_reg ? *(rx_ring->prod_idx_sh_reg) : 0); 552 rx_ring->prod_idx_sh_reg
553 ? ql_read_sh_reg(rx_ring->prod_idx_sh_reg) : 0);
564 printk(KERN_ERR PFX "rx_ring->prod_idx_sh_reg_dma = %llx.\n", 554 printk(KERN_ERR PFX "rx_ring->prod_idx_sh_reg_dma = %llx.\n",
565 (unsigned long long) rx_ring->prod_idx_sh_reg_dma); 555 (unsigned long long) rx_ring->prod_idx_sh_reg_dma);
566 printk(KERN_ERR PFX "rx_ring->cnsmr_idx_db_reg = %p.\n", 556 printk(KERN_ERR PFX "rx_ring->cnsmr_idx_db_reg = %p.\n",
@@ -809,10 +799,8 @@ void ql_dump_ib_mac_rsp(struct ib_mac_iocb_rsp *ib_mac_rsp)
809 799
810 printk(KERN_ERR PFX "data_len = %d\n", 800 printk(KERN_ERR PFX "data_len = %d\n",
811 le32_to_cpu(ib_mac_rsp->data_len)); 801 le32_to_cpu(ib_mac_rsp->data_len));
812 printk(KERN_ERR PFX "data_addr_hi = 0x%x\n", 802 printk(KERN_ERR PFX "data_addr = 0x%llx\n",
813 le32_to_cpu(ib_mac_rsp->data_addr_hi)); 803 (unsigned long long) le64_to_cpu(ib_mac_rsp->data_addr));
814 printk(KERN_ERR PFX "data_addr_lo = 0x%x\n",
815 le32_to_cpu(ib_mac_rsp->data_addr_lo));
816 if (ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK) 804 if (ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_RSS_MASK)
817 printk(KERN_ERR PFX "rss = %x\n", 805 printk(KERN_ERR PFX "rss = %x\n",
818 le32_to_cpu(ib_mac_rsp->rss)); 806 le32_to_cpu(ib_mac_rsp->rss));
@@ -828,10 +816,8 @@ void ql_dump_ib_mac_rsp(struct ib_mac_iocb_rsp *ib_mac_rsp)
828 if (ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV) { 816 if (ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV) {
829 printk(KERN_ERR PFX "hdr length = %d.\n", 817 printk(KERN_ERR PFX "hdr length = %d.\n",
830 le32_to_cpu(ib_mac_rsp->hdr_len)); 818 le32_to_cpu(ib_mac_rsp->hdr_len));
831 printk(KERN_ERR PFX "hdr addr_hi = 0x%x.\n", 819 printk(KERN_ERR PFX "hdr addr = 0x%llx.\n",
832 le32_to_cpu(ib_mac_rsp->hdr_addr_hi)); 820 (unsigned long long) le64_to_cpu(ib_mac_rsp->hdr_addr));
833 printk(KERN_ERR PFX "hdr addr_lo = 0x%x.\n",
834 le32_to_cpu(ib_mac_rsp->hdr_addr_lo));
835 } 821 }
836} 822}
837#endif 823#endif
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index f4c016012f18..45421c8b6010 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -76,7 +76,6 @@ MODULE_PARM_DESC(irq_type, "0 = MSI-X, 1 = MSI, 2 = Legacy.");
76 76
77static struct pci_device_id qlge_pci_tbl[] __devinitdata = { 77static struct pci_device_id qlge_pci_tbl[] __devinitdata = {
78 {PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, QLGE_DEVICE_ID)}, 78 {PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, QLGE_DEVICE_ID)},
79 {PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, QLGE_DEVICE_ID1)},
80 /* required last entry */ 79 /* required last entry */
81 {0,} 80 {0,}
82}; 81};
@@ -127,12 +126,12 @@ static int ql_sem_trylock(struct ql_adapter *qdev, u32 sem_mask)
127 126
128int ql_sem_spinlock(struct ql_adapter *qdev, u32 sem_mask) 127int ql_sem_spinlock(struct ql_adapter *qdev, u32 sem_mask)
129{ 128{
130 unsigned int seconds = 3; 129 unsigned int wait_count = 30;
131 do { 130 do {
132 if (!ql_sem_trylock(qdev, sem_mask)) 131 if (!ql_sem_trylock(qdev, sem_mask))
133 return 0; 132 return 0;
134 ssleep(1); 133 udelay(100);
135 } while (--seconds); 134 } while (--wait_count);
136 return -ETIMEDOUT; 135 return -ETIMEDOUT;
137} 136}
138 137
@@ -1545,7 +1544,7 @@ static void ql_process_chip_ae_intr(struct ql_adapter *qdev,
1545static int ql_clean_outbound_rx_ring(struct rx_ring *rx_ring) 1544static int ql_clean_outbound_rx_ring(struct rx_ring *rx_ring)
1546{ 1545{
1547 struct ql_adapter *qdev = rx_ring->qdev; 1546 struct ql_adapter *qdev = rx_ring->qdev;
1548 u32 prod = le32_to_cpu(*rx_ring->prod_idx_sh_reg); 1547 u32 prod = ql_read_sh_reg(rx_ring->prod_idx_sh_reg);
1549 struct ob_mac_iocb_rsp *net_rsp = NULL; 1548 struct ob_mac_iocb_rsp *net_rsp = NULL;
1550 int count = 0; 1549 int count = 0;
1551 1550
@@ -1571,7 +1570,7 @@ static int ql_clean_outbound_rx_ring(struct rx_ring *rx_ring)
1571 } 1570 }
1572 count++; 1571 count++;
1573 ql_update_cq(rx_ring); 1572 ql_update_cq(rx_ring);
1574 prod = le32_to_cpu(*rx_ring->prod_idx_sh_reg); 1573 prod = ql_read_sh_reg(rx_ring->prod_idx_sh_reg);
1575 } 1574 }
1576 ql_write_cq_idx(rx_ring); 1575 ql_write_cq_idx(rx_ring);
1577 if (netif_queue_stopped(qdev->ndev) && net_rsp != NULL) { 1576 if (netif_queue_stopped(qdev->ndev) && net_rsp != NULL) {
@@ -1591,7 +1590,7 @@ static int ql_clean_outbound_rx_ring(struct rx_ring *rx_ring)
1591static int ql_clean_inbound_rx_ring(struct rx_ring *rx_ring, int budget) 1590static int ql_clean_inbound_rx_ring(struct rx_ring *rx_ring, int budget)
1592{ 1591{
1593 struct ql_adapter *qdev = rx_ring->qdev; 1592 struct ql_adapter *qdev = rx_ring->qdev;
1594 u32 prod = le32_to_cpu(*rx_ring->prod_idx_sh_reg); 1593 u32 prod = ql_read_sh_reg(rx_ring->prod_idx_sh_reg);
1595 struct ql_net_rsp_iocb *net_rsp; 1594 struct ql_net_rsp_iocb *net_rsp;
1596 int count = 0; 1595 int count = 0;
1597 1596
@@ -1624,7 +1623,7 @@ static int ql_clean_inbound_rx_ring(struct rx_ring *rx_ring, int budget)
1624 } 1623 }
1625 count++; 1624 count++;
1626 ql_update_cq(rx_ring); 1625 ql_update_cq(rx_ring);
1627 prod = le32_to_cpu(*rx_ring->prod_idx_sh_reg); 1626 prod = ql_read_sh_reg(rx_ring->prod_idx_sh_reg);
1628 if (count == budget) 1627 if (count == budget)
1629 break; 1628 break;
1630 } 1629 }
@@ -1787,7 +1786,7 @@ static irqreturn_t qlge_isr(int irq, void *dev_id)
1787 * Check the default queue and wake handler if active. 1786 * Check the default queue and wake handler if active.
1788 */ 1787 */
1789 rx_ring = &qdev->rx_ring[0]; 1788 rx_ring = &qdev->rx_ring[0];
1790 if (le32_to_cpu(*rx_ring->prod_idx_sh_reg) != rx_ring->cnsmr_idx) { 1789 if (ql_read_sh_reg(rx_ring->prod_idx_sh_reg) != rx_ring->cnsmr_idx) {
1791 QPRINTK(qdev, INTR, INFO, "Waking handler for rx_ring[0].\n"); 1790 QPRINTK(qdev, INTR, INFO, "Waking handler for rx_ring[0].\n");
1792 ql_disable_completion_interrupt(qdev, intr_context->intr); 1791 ql_disable_completion_interrupt(qdev, intr_context->intr);
1793 queue_delayed_work_on(smp_processor_id(), qdev->q_workqueue, 1792 queue_delayed_work_on(smp_processor_id(), qdev->q_workqueue,
@@ -1801,7 +1800,7 @@ static irqreturn_t qlge_isr(int irq, void *dev_id)
1801 */ 1800 */
1802 for (i = 1; i < qdev->rx_ring_count; i++) { 1801 for (i = 1; i < qdev->rx_ring_count; i++) {
1803 rx_ring = &qdev->rx_ring[i]; 1802 rx_ring = &qdev->rx_ring[i];
1804 if (le32_to_cpu(*rx_ring->prod_idx_sh_reg) != 1803 if (ql_read_sh_reg(rx_ring->prod_idx_sh_reg) !=
1805 rx_ring->cnsmr_idx) { 1804 rx_ring->cnsmr_idx) {
1806 QPRINTK(qdev, INTR, INFO, 1805 QPRINTK(qdev, INTR, INFO,
1807 "Waking handler for rx_ring[%d].\n", i); 1806 "Waking handler for rx_ring[%d].\n", i);
@@ -2356,28 +2355,6 @@ static void ql_tx_ring_clean(struct ql_adapter *qdev)
2356 } 2355 }
2357} 2356}
2358 2357
2359static void ql_free_ring_cb(struct ql_adapter *qdev)
2360{
2361 kfree(qdev->ring_mem);
2362}
2363
2364static int ql_alloc_ring_cb(struct ql_adapter *qdev)
2365{
2366 /* Allocate space for tx/rx ring control blocks. */
2367 qdev->ring_mem_size =
2368 (qdev->tx_ring_count * sizeof(struct tx_ring)) +
2369 (qdev->rx_ring_count * sizeof(struct rx_ring));
2370 qdev->ring_mem = kmalloc(qdev->ring_mem_size, GFP_KERNEL);
2371 if (qdev->ring_mem == NULL) {
2372 return -ENOMEM;
2373 } else {
2374 qdev->rx_ring = qdev->ring_mem;
2375 qdev->tx_ring = qdev->ring_mem +
2376 (qdev->rx_ring_count * sizeof(struct rx_ring));
2377 }
2378 return 0;
2379}
2380
2381static void ql_free_mem_resources(struct ql_adapter *qdev) 2358static void ql_free_mem_resources(struct ql_adapter *qdev)
2382{ 2359{
2383 int i; 2360 int i;
@@ -2467,12 +2444,9 @@ static int ql_start_rx_ring(struct ql_adapter *qdev, struct rx_ring *rx_ring)
2467 bq_len = (rx_ring->cq_len == 65536) ? 0 : (u16) rx_ring->cq_len; 2444 bq_len = (rx_ring->cq_len == 65536) ? 0 : (u16) rx_ring->cq_len;
2468 cqicb->len = cpu_to_le16(bq_len | LEN_V | LEN_CPP_CONT); 2445 cqicb->len = cpu_to_le16(bq_len | LEN_V | LEN_CPP_CONT);
2469 2446
2470 cqicb->addr_lo = cpu_to_le32(rx_ring->cq_base_dma); 2447 cqicb->addr = cpu_to_le64(rx_ring->cq_base_dma);
2471 cqicb->addr_hi = cpu_to_le32((u64) rx_ring->cq_base_dma >> 32);
2472 2448
2473 cqicb->prod_idx_addr_lo = cpu_to_le32(rx_ring->prod_idx_sh_reg_dma); 2449 cqicb->prod_idx_addr = cpu_to_le64(rx_ring->prod_idx_sh_reg_dma);
2474 cqicb->prod_idx_addr_hi =
2475 cpu_to_le32((u64) rx_ring->prod_idx_sh_reg_dma >> 32);
2476 2450
2477 /* 2451 /*
2478 * Set up the control block load flags. 2452 * Set up the control block load flags.
@@ -2483,10 +2457,8 @@ static int ql_start_rx_ring(struct ql_adapter *qdev, struct rx_ring *rx_ring)
2483 if (rx_ring->lbq_len) { 2457 if (rx_ring->lbq_len) {
2484 cqicb->flags |= FLAGS_LL; /* Load lbq values */ 2458 cqicb->flags |= FLAGS_LL; /* Load lbq values */
2485 *((u64 *) rx_ring->lbq_base_indirect) = rx_ring->lbq_base_dma; 2459 *((u64 *) rx_ring->lbq_base_indirect) = rx_ring->lbq_base_dma;
2486 cqicb->lbq_addr_lo = 2460 cqicb->lbq_addr =
2487 cpu_to_le32(rx_ring->lbq_base_indirect_dma); 2461 cpu_to_le64(rx_ring->lbq_base_indirect_dma);
2488 cqicb->lbq_addr_hi =
2489 cpu_to_le32((u64) rx_ring->lbq_base_indirect_dma >> 32);
2490 bq_len = (rx_ring->lbq_buf_size == 65536) ? 0 : 2462 bq_len = (rx_ring->lbq_buf_size == 65536) ? 0 :
2491 (u16) rx_ring->lbq_buf_size; 2463 (u16) rx_ring->lbq_buf_size;
2492 cqicb->lbq_buf_size = cpu_to_le16(bq_len); 2464 cqicb->lbq_buf_size = cpu_to_le16(bq_len);
@@ -2501,10 +2473,8 @@ static int ql_start_rx_ring(struct ql_adapter *qdev, struct rx_ring *rx_ring)
2501 if (rx_ring->sbq_len) { 2473 if (rx_ring->sbq_len) {
2502 cqicb->flags |= FLAGS_LS; /* Load sbq values */ 2474 cqicb->flags |= FLAGS_LS; /* Load sbq values */
2503 *((u64 *) rx_ring->sbq_base_indirect) = rx_ring->sbq_base_dma; 2475 *((u64 *) rx_ring->sbq_base_indirect) = rx_ring->sbq_base_dma;
2504 cqicb->sbq_addr_lo = 2476 cqicb->sbq_addr =
2505 cpu_to_le32(rx_ring->sbq_base_indirect_dma); 2477 cpu_to_le64(rx_ring->sbq_base_indirect_dma);
2506 cqicb->sbq_addr_hi =
2507 cpu_to_le32((u64) rx_ring->sbq_base_indirect_dma >> 32);
2508 cqicb->sbq_buf_size = 2478 cqicb->sbq_buf_size =
2509 cpu_to_le16(((rx_ring->sbq_buf_size / 2) + 8) & 0xfffffff8); 2479 cpu_to_le16(((rx_ring->sbq_buf_size / 2) + 8) & 0xfffffff8);
2510 bq_len = (rx_ring->sbq_len == 65536) ? 0 : 2480 bq_len = (rx_ring->sbq_len == 65536) ? 0 :
@@ -2611,12 +2581,9 @@ static int ql_start_tx_ring(struct ql_adapter *qdev, struct tx_ring *tx_ring)
2611 Q_FLAGS_LB | Q_FLAGS_LI | Q_FLAGS_LO); 2581 Q_FLAGS_LB | Q_FLAGS_LI | Q_FLAGS_LO);
2612 wqicb->cq_id_rss = cpu_to_le16(tx_ring->cq_id); 2582 wqicb->cq_id_rss = cpu_to_le16(tx_ring->cq_id);
2613 wqicb->rid = 0; 2583 wqicb->rid = 0;
2614 wqicb->addr_lo = cpu_to_le32(tx_ring->wq_base_dma); 2584 wqicb->addr = cpu_to_le64(tx_ring->wq_base_dma);
2615 wqicb->addr_hi = cpu_to_le32((u64) tx_ring->wq_base_dma >> 32);
2616 2585
2617 wqicb->cnsmr_idx_addr_lo = cpu_to_le32(tx_ring->cnsmr_idx_sh_reg_dma); 2586 wqicb->cnsmr_idx_addr = cpu_to_le64(tx_ring->cnsmr_idx_sh_reg_dma);
2618 wqicb->cnsmr_idx_addr_hi =
2619 cpu_to_le32((u64) tx_ring->cnsmr_idx_sh_reg_dma >> 32);
2620 2587
2621 ql_init_tx_ring(qdev, tx_ring); 2588 ql_init_tx_ring(qdev, tx_ring);
2622 2589
@@ -2746,14 +2713,14 @@ static void ql_resolve_queues_to_irqs(struct ql_adapter *qdev)
2746 * Outbound queue is for outbound completions only. 2713 * Outbound queue is for outbound completions only.
2747 */ 2714 */
2748 intr_context->handler = qlge_msix_tx_isr; 2715 intr_context->handler = qlge_msix_tx_isr;
2749 sprintf(intr_context->name, "%s-txq-%d", 2716 sprintf(intr_context->name, "%s-tx-%d",
2750 qdev->ndev->name, i); 2717 qdev->ndev->name, i);
2751 } else { 2718 } else {
2752 /* 2719 /*
2753 * Inbound queues handle unicast frames only. 2720 * Inbound queues handle unicast frames only.
2754 */ 2721 */
2755 intr_context->handler = qlge_msix_rx_isr; 2722 intr_context->handler = qlge_msix_rx_isr;
2756 sprintf(intr_context->name, "%s-rxq-%d", 2723 sprintf(intr_context->name, "%s-rx-%d",
2757 qdev->ndev->name, i); 2724 qdev->ndev->name, i);
2758 } 2725 }
2759 } 2726 }
@@ -3247,7 +3214,6 @@ static int qlge_close(struct net_device *ndev)
3247 msleep(1); 3214 msleep(1);
3248 ql_adapter_down(qdev); 3215 ql_adapter_down(qdev);
3249 ql_release_adapter_resources(qdev); 3216 ql_release_adapter_resources(qdev);
3250 ql_free_ring_cb(qdev);
3251 return 0; 3217 return 0;
3252} 3218}
3253 3219
@@ -3273,8 +3239,8 @@ static int ql_configure_rings(struct ql_adapter *qdev)
3273 * This limitation can be removed when requested. 3239 * This limitation can be removed when requested.
3274 */ 3240 */
3275 3241
3276 if (cpu_cnt > 8) 3242 if (cpu_cnt > MAX_CPUS)
3277 cpu_cnt = 8; 3243 cpu_cnt = MAX_CPUS;
3278 3244
3279 /* 3245 /*
3280 * rx_ring[0] is always the default queue. 3246 * rx_ring[0] is always the default queue.
@@ -3294,9 +3260,6 @@ static int ql_configure_rings(struct ql_adapter *qdev)
3294 */ 3260 */
3295 qdev->rx_ring_count = qdev->tx_ring_count + qdev->rss_ring_count + 1; 3261 qdev->rx_ring_count = qdev->tx_ring_count + qdev->rss_ring_count + 1;
3296 3262
3297 if (ql_alloc_ring_cb(qdev))
3298 return -ENOMEM;
3299
3300 for (i = 0; i < qdev->tx_ring_count; i++) { 3263 for (i = 0; i < qdev->tx_ring_count; i++) {
3301 tx_ring = &qdev->tx_ring[i]; 3264 tx_ring = &qdev->tx_ring[i];
3302 memset((void *)tx_ring, 0, sizeof(tx_ring)); 3265 memset((void *)tx_ring, 0, sizeof(tx_ring));
@@ -3393,7 +3356,6 @@ static int qlge_open(struct net_device *ndev)
3393 3356
3394error_up: 3357error_up:
3395 ql_release_adapter_resources(qdev); 3358 ql_release_adapter_resources(qdev);
3396 ql_free_ring_cb(qdev);
3397 return err; 3359 return err;
3398} 3360}
3399 3361
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index cf3a082bc89d..72fd9e97c190 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -49,8 +49,8 @@
49#include <asm/processor.h> 49#include <asm/processor.h>
50 50
51#define DRV_NAME "r6040" 51#define DRV_NAME "r6040"
52#define DRV_VERSION "0.20" 52#define DRV_VERSION "0.21"
53#define DRV_RELDATE "07Jan2009" 53#define DRV_RELDATE "09Jan2009"
54 54
55/* PHY CHIP Address */ 55/* PHY CHIP Address */
56#define PHY1_ADDR 1 /* For MAC1 */ 56#define PHY1_ADDR 1 /* For MAC1 */
@@ -457,22 +457,12 @@ static void r6040_down(struct net_device *dev)
457 iowrite16(adrp[0], ioaddr + MID_0L); 457 iowrite16(adrp[0], ioaddr + MID_0L);
458 iowrite16(adrp[1], ioaddr + MID_0M); 458 iowrite16(adrp[1], ioaddr + MID_0M);
459 iowrite16(adrp[2], ioaddr + MID_0H); 459 iowrite16(adrp[2], ioaddr + MID_0H);
460 free_irq(dev->irq, dev);
461
462 /* Free RX buffer */
463 r6040_free_rxbufs(dev);
464
465 /* Free TX buffer */
466 r6040_free_txbufs(dev);
467
468 /* Free Descriptor memory */
469 pci_free_consistent(pdev, RX_DESC_SIZE, lp->rx_ring, lp->rx_ring_dma);
470 pci_free_consistent(pdev, TX_DESC_SIZE, lp->tx_ring, lp->tx_ring_dma);
471} 460}
472 461
473static int r6040_close(struct net_device *dev) 462static int r6040_close(struct net_device *dev)
474{ 463{
475 struct r6040_private *lp = netdev_priv(dev); 464 struct r6040_private *lp = netdev_priv(dev);
465 struct pci_dev *pdev = lp->pdev;
476 466
477 /* deleted timer */ 467 /* deleted timer */
478 del_timer_sync(&lp->timer); 468 del_timer_sync(&lp->timer);
@@ -481,8 +471,28 @@ static int r6040_close(struct net_device *dev)
481 napi_disable(&lp->napi); 471 napi_disable(&lp->napi);
482 netif_stop_queue(dev); 472 netif_stop_queue(dev);
483 r6040_down(dev); 473 r6040_down(dev);
474
475 free_irq(dev->irq, dev);
476
477 /* Free RX buffer */
478 r6040_free_rxbufs(dev);
479
480 /* Free TX buffer */
481 r6040_free_txbufs(dev);
482
484 spin_unlock_irq(&lp->lock); 483 spin_unlock_irq(&lp->lock);
485 484
485 /* Free Descriptor memory */
486 if (lp->rx_ring) {
487 pci_free_consistent(pdev, RX_DESC_SIZE, lp->rx_ring, lp->rx_ring_dma);
488 lp->rx_ring = 0;
489 }
490
491 if (lp->tx_ring) {
492 pci_free_consistent(pdev, TX_DESC_SIZE, lp->tx_ring, lp->tx_ring_dma);
493 lp->tx_ring = 0;
494 }
495
486 return 0; 496 return 0;
487} 497}
488 498
@@ -1049,6 +1059,7 @@ static const struct net_device_ops r6040_netdev_ops = {
1049 .ndo_set_multicast_list = r6040_multicast_list, 1059 .ndo_set_multicast_list = r6040_multicast_list,
1050 .ndo_change_mtu = eth_change_mtu, 1060 .ndo_change_mtu = eth_change_mtu,
1051 .ndo_validate_addr = eth_validate_addr, 1061 .ndo_validate_addr = eth_validate_addr,
1062 .ndo_set_mac_address = eth_mac_addr,
1052 .ndo_do_ioctl = r6040_ioctl, 1063 .ndo_do_ioctl = r6040_ioctl,
1053 .ndo_tx_timeout = r6040_tx_timeout, 1064 .ndo_tx_timeout = r6040_tx_timeout,
1054#ifdef CONFIG_NET_POLL_CONTROLLER 1065#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -1143,8 +1154,10 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
1143 1154
1144 /* Some bootloader/BIOSes do not initialize 1155 /* Some bootloader/BIOSes do not initialize
1145 * MAC address, warn about that */ 1156 * MAC address, warn about that */
1146 if (!(adrp[0] || adrp[1] || adrp[2])) 1157 if (!(adrp[0] || adrp[1] || adrp[2])) {
1147 printk(KERN_WARNING DRV_NAME ": MAC address not initialized\n"); 1158 printk(KERN_WARNING DRV_NAME ": MAC address not initialized, generating random\n");
1159 random_ether_addr(dev->dev_addr);
1160 }
1148 1161
1149 /* Link new device into r6040_root_dev */ 1162 /* Link new device into r6040_root_dev */
1150 lp->pdev = pdev; 1163 lp->pdev = pdev;
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c
index 42fd31276602..8b75bef4a841 100644
--- a/drivers/net/sc92031.c
+++ b/drivers/net/sc92031.c
@@ -1408,6 +1408,7 @@ static const struct net_device_ops sc92031_netdev_ops = {
1408 .ndo_set_multicast_list = sc92031_set_multicast_list, 1408 .ndo_set_multicast_list = sc92031_set_multicast_list,
1409 .ndo_change_mtu = eth_change_mtu, 1409 .ndo_change_mtu = eth_change_mtu,
1410 .ndo_validate_addr = eth_validate_addr, 1410 .ndo_validate_addr = eth_validate_addr,
1411 .ndo_set_mac_address = eth_mac_addr,
1411 .ndo_tx_timeout = sc92031_tx_timeout, 1412 .ndo_tx_timeout = sc92031_tx_timeout,
1412#ifdef CONFIG_NET_POLL_CONTROLLER 1413#ifdef CONFIG_NET_POLL_CONTROLLER
1413 .ndo_poll_controller = sc92031_poll_controller, 1414 .ndo_poll_controller = sc92031_poll_controller,
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c
index b9768760fae7..9ecb77da9545 100644
--- a/drivers/net/sfc/tenxpress.c
+++ b/drivers/net/sfc/tenxpress.c
@@ -636,10 +636,11 @@ static void tenxpress_phy_fini(struct efx_nic *efx)
636{ 636{
637 int reg; 637 int reg;
638 638
639 if (efx->phy_type == PHY_TYPE_SFT9001B) { 639 if (efx->phy_type == PHY_TYPE_SFT9001B)
640 device_remove_file(&efx->pci_dev->dev, 640 device_remove_file(&efx->pci_dev->dev,
641 &dev_attr_phy_short_reach); 641 &dev_attr_phy_short_reach);
642 } else { 642
643 if (efx->phy_type == PHY_TYPE_SFX7101) {
643 /* Power down the LNPGA */ 644 /* Power down the LNPGA */
644 reg = (1 << PMA_PMD_LNPGA_POWERDOWN_LBN); 645 reg = (1 << PMA_PMD_LNPGA_POWERDOWN_LBN);
645 mdio_clause45_write(efx, efx->mii.phy_id, MDIO_MMD_PMAPMD, 646 mdio_clause45_write(efx, efx->mii.phy_id, MDIO_MMD_PMAPMD,
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
index 4acd41a093ad..be4465bc0a69 100644
--- a/drivers/net/sis900.c
+++ b/drivers/net/sis900.c
@@ -389,6 +389,7 @@ static const struct net_device_ops sis900_netdev_ops = {
389 .ndo_set_multicast_list = set_rx_mode, 389 .ndo_set_multicast_list = set_rx_mode,
390 .ndo_change_mtu = eth_change_mtu, 390 .ndo_change_mtu = eth_change_mtu,
391 .ndo_validate_addr = eth_validate_addr, 391 .ndo_validate_addr = eth_validate_addr,
392 .ndo_set_mac_address = eth_mac_addr,
392 .ndo_do_ioctl = mii_ioctl, 393 .ndo_do_ioctl = mii_ioctl,
393 .ndo_tx_timeout = sis900_tx_timeout, 394 .ndo_tx_timeout = sis900_tx_timeout,
394#ifdef CONFIG_NET_POLL_CONTROLLER 395#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -508,10 +509,10 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
508 else 509 else
509 ret = sis900_get_mac_addr(pci_dev, net_dev); 510 ret = sis900_get_mac_addr(pci_dev, net_dev);
510 511
511 if (ret == 0) { 512 if (!ret || !is_valid_ether_addr(net_dev->dev_addr)) {
512 printk(KERN_WARNING "%s: Cannot read MAC address.\n", dev_name); 513 random_ether_addr(net_dev->dev_addr);
513 ret = -ENODEV; 514 printk(KERN_WARNING "%s: Unreadable or invalid MAC address,"
514 goto err_unmap_rx; 515 "using random generated one\n", dev_name);
515 } 516 }
516 517
517 /* 630ET : set the mii access mode as software-mode */ 518 /* 630ET : set the mii access mode as software-mode */
diff --git a/drivers/net/smc-mca.c b/drivers/net/smc-mca.c
index 404b80e5ba11..8d36d40649ef 100644
--- a/drivers/net/smc-mca.c
+++ b/drivers/net/smc-mca.c
@@ -192,6 +192,7 @@ static const struct net_device_ops ultramca_netdev_ops = {
192 .ndo_get_stats = ei_get_stats, 192 .ndo_get_stats = ei_get_stats,
193 .ndo_set_multicast_list = ei_set_multicast_list, 193 .ndo_set_multicast_list = ei_set_multicast_list,
194 .ndo_validate_addr = eth_validate_addr, 194 .ndo_validate_addr = eth_validate_addr,
195 .ndo_set_mac_address = eth_mac_addr,
195 .ndo_change_mtu = eth_change_mtu, 196 .ndo_change_mtu = eth_change_mtu,
196#ifdef CONFIG_NET_POLL_CONTROLLER 197#ifdef CONFIG_NET_POLL_CONTROLLER
197 .ndo_poll_controller = ei_poll, 198 .ndo_poll_controller = ei_poll,
diff --git a/drivers/net/smc-ultra.c b/drivers/net/smc-ultra.c
index b3866089a206..2033fee3143a 100644
--- a/drivers/net/smc-ultra.c
+++ b/drivers/net/smc-ultra.c
@@ -196,6 +196,7 @@ static const struct net_device_ops ultra_netdev_ops = {
196 .ndo_get_stats = ei_get_stats, 196 .ndo_get_stats = ei_get_stats,
197 .ndo_set_multicast_list = ei_set_multicast_list, 197 .ndo_set_multicast_list = ei_set_multicast_list,
198 .ndo_validate_addr = eth_validate_addr, 198 .ndo_validate_addr = eth_validate_addr,
199 .ndo_set_mac_address = eth_mac_addr,
199 .ndo_change_mtu = eth_change_mtu, 200 .ndo_change_mtu = eth_change_mtu,
200#ifdef CONFIG_NET_POLL_CONTROLLER 201#ifdef CONFIG_NET_POLL_CONTROLLER
201 .ndo_poll_controller = ei_poll, 202 .ndo_poll_controller = ei_poll,
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index dc3f1108884d..f513bdf1c887 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -144,6 +144,7 @@ static inline u32 smsc911x_reg_read(struct smsc911x_data *pdata, u32 reg)
144 } 144 }
145 145
146 BUG(); 146 BUG();
147 return 0;
147} 148}
148 149
149static inline void smsc911x_reg_write(struct smsc911x_data *pdata, u32 reg, 150static inline void smsc911x_reg_write(struct smsc911x_data *pdata, u32 reg,
@@ -1740,6 +1741,7 @@ static const struct net_device_ops smsc911x_netdev_ops = {
1740 .ndo_set_multicast_list = smsc911x_set_multicast_list, 1741 .ndo_set_multicast_list = smsc911x_set_multicast_list,
1741 .ndo_do_ioctl = smsc911x_do_ioctl, 1742 .ndo_do_ioctl = smsc911x_do_ioctl,
1742 .ndo_validate_addr = eth_validate_addr, 1743 .ndo_validate_addr = eth_validate_addr,
1744 .ndo_set_mac_address = eth_mac_addr,
1743#ifdef CONFIG_NET_POLL_CONTROLLER 1745#ifdef CONFIG_NET_POLL_CONTROLLER
1744 .ndo_poll_controller = smsc911x_poll_controller, 1746 .ndo_poll_controller = smsc911x_poll_controller,
1745#endif 1747#endif
@@ -1967,7 +1969,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
1967 smsc911x_reg_write(pdata, INT_STS, 0xFFFFFFFF); 1969 smsc911x_reg_write(pdata, INT_STS, 0xFFFFFFFF);
1968 1970
1969 retval = request_irq(dev->irq, smsc911x_irqhandler, IRQF_DISABLED, 1971 retval = request_irq(dev->irq, smsc911x_irqhandler, IRQF_DISABLED,
1970 SMSC_CHIPNAME, dev); 1972 dev->name, dev);
1971 if (retval) { 1973 if (retval) {
1972 SMSC_WARNING(PROBE, 1974 SMSC_WARNING(PROBE,
1973 "Unable to claim requested irq: %d", dev->irq); 1975 "Unable to claim requested irq: %d", dev->irq);
diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c
index 27e017d96966..c14a4c6452c7 100644
--- a/drivers/net/smsc9420.c
+++ b/drivers/net/smsc9420.c
@@ -1551,6 +1551,7 @@ static const struct net_device_ops smsc9420_netdev_ops = {
1551 .ndo_set_multicast_list = smsc9420_set_multicast_list, 1551 .ndo_set_multicast_list = smsc9420_set_multicast_list,
1552 .ndo_do_ioctl = smsc9420_do_ioctl, 1552 .ndo_do_ioctl = smsc9420_do_ioctl,
1553 .ndo_validate_addr = eth_validate_addr, 1553 .ndo_validate_addr = eth_validate_addr,
1554 .ndo_set_mac_address = eth_mac_addr,
1554#ifdef CONFIG_NET_POLL_CONTROLLER 1555#ifdef CONFIG_NET_POLL_CONTROLLER
1555 .ndo_poll_controller = smsc9420_poll_controller, 1556 .ndo_poll_controller = smsc9420_poll_controller,
1556#endif /* CONFIG_NET_POLL_CONTROLLER */ 1557#endif /* CONFIG_NET_POLL_CONTROLLER */
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 7d5a1303e30d..11441225bf41 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -442,40 +442,30 @@ static void magic_packet_detection_enable(struct ucc_geth_private *ugeth)
442{ 442{
443 struct ucc_fast_private *uccf; 443 struct ucc_fast_private *uccf;
444 struct ucc_geth __iomem *ug_regs; 444 struct ucc_geth __iomem *ug_regs;
445 u32 maccfg2, uccm;
446 445
447 uccf = ugeth->uccf; 446 uccf = ugeth->uccf;
448 ug_regs = ugeth->ug_regs; 447 ug_regs = ugeth->ug_regs;
449 448
450 /* Enable interrupts for magic packet detection */ 449 /* Enable interrupts for magic packet detection */
451 uccm = in_be32(uccf->p_uccm); 450 setbits32(uccf->p_uccm, UCC_GETH_UCCE_MPD);
452 uccm |= UCCE_MPD;
453 out_be32(uccf->p_uccm, uccm);
454 451
455 /* Enable magic packet detection */ 452 /* Enable magic packet detection */
456 maccfg2 = in_be32(&ug_regs->maccfg2); 453 setbits32(&ug_regs->maccfg2, MACCFG2_MPE);
457 maccfg2 |= MACCFG2_MPE;
458 out_be32(&ug_regs->maccfg2, maccfg2);
459} 454}
460 455
461static void magic_packet_detection_disable(struct ucc_geth_private *ugeth) 456static void magic_packet_detection_disable(struct ucc_geth_private *ugeth)
462{ 457{
463 struct ucc_fast_private *uccf; 458 struct ucc_fast_private *uccf;
464 struct ucc_geth __iomem *ug_regs; 459 struct ucc_geth __iomem *ug_regs;
465 u32 maccfg2, uccm;
466 460
467 uccf = ugeth->uccf; 461 uccf = ugeth->uccf;
468 ug_regs = ugeth->ug_regs; 462 ug_regs = ugeth->ug_regs;
469 463
470 /* Disable interrupts for magic packet detection */ 464 /* Disable interrupts for magic packet detection */
471 uccm = in_be32(uccf->p_uccm); 465 clrbits32(uccf->p_uccm, UCC_GETH_UCCE_MPD);
472 uccm &= ~UCCE_MPD;
473 out_be32(uccf->p_uccm, uccm);
474 466
475 /* Disable magic packet detection */ 467 /* Disable magic packet detection */
476 maccfg2 = in_be32(&ug_regs->maccfg2); 468 clrbits32(&ug_regs->maccfg2, MACCFG2_MPE);
477 maccfg2 &= ~MACCFG2_MPE;
478 out_be32(&ug_regs->maccfg2, maccfg2);
479} 469}
480#endif /* MAGIC_PACKET */ 470#endif /* MAGIC_PACKET */
481 471
@@ -585,7 +575,8 @@ static void get_statistics(struct ucc_geth_private *ugeth,
585 575
586 /* Hardware only if user handed pointer and driver actually 576 /* Hardware only if user handed pointer and driver actually
587 gathers hardware statistics */ 577 gathers hardware statistics */
588 if (hardware_statistics && (in_be32(&uf_regs->upsmr) & UPSMR_HSE)) { 578 if (hardware_statistics &&
579 (in_be32(&uf_regs->upsmr) & UCC_GETH_UPSMR_HSE)) {
589 hardware_statistics->tx64 = in_be32(&ug_regs->tx64); 580 hardware_statistics->tx64 = in_be32(&ug_regs->tx64);
590 hardware_statistics->tx127 = in_be32(&ug_regs->tx127); 581 hardware_statistics->tx127 = in_be32(&ug_regs->tx127);
591 hardware_statistics->tx255 = in_be32(&ug_regs->tx255); 582 hardware_statistics->tx255 = in_be32(&ug_regs->tx255);
@@ -1181,9 +1172,7 @@ int init_flow_control_params(u32 automatic_flow_control_mode,
1181 out_be32(uempr_register, value); 1172 out_be32(uempr_register, value);
1182 1173
1183 /* Set UPSMR register */ 1174 /* Set UPSMR register */
1184 value = in_be32(upsmr_register); 1175 setbits32(upsmr_register, automatic_flow_control_mode);
1185 value |= automatic_flow_control_mode;
1186 out_be32(upsmr_register, value);
1187 1176
1188 value = in_be32(maccfg1_register); 1177 value = in_be32(maccfg1_register);
1189 if (rx_flow_control_enable) 1178 if (rx_flow_control_enable)
@@ -1200,14 +1189,11 @@ static int init_hw_statistics_gathering_mode(int enable_hardware_statistics,
1200 u32 __iomem *upsmr_register, 1189 u32 __iomem *upsmr_register,
1201 u16 __iomem *uescr_register) 1190 u16 __iomem *uescr_register)
1202{ 1191{
1203 u32 upsmr_value = 0;
1204 u16 uescr_value = 0; 1192 u16 uescr_value = 0;
1193
1205 /* Enable hardware statistics gathering if requested */ 1194 /* Enable hardware statistics gathering if requested */
1206 if (enable_hardware_statistics) { 1195 if (enable_hardware_statistics)
1207 upsmr_value = in_be32(upsmr_register); 1196 setbits32(upsmr_register, UCC_GETH_UPSMR_HSE);
1208 upsmr_value |= UPSMR_HSE;
1209 out_be32(upsmr_register, upsmr_value);
1210 }
1211 1197
1212 /* Clear hardware statistics counters */ 1198 /* Clear hardware statistics counters */
1213 uescr_value = in_be16(uescr_register); 1199 uescr_value = in_be16(uescr_register);
@@ -1233,23 +1219,17 @@ static int init_firmware_statistics_gathering_mode(int
1233{ 1219{
1234 /* Note: this function does not check if */ 1220 /* Note: this function does not check if */
1235 /* the parameters it receives are NULL */ 1221 /* the parameters it receives are NULL */
1236 u16 temoder_value;
1237 u32 remoder_value;
1238 1222
1239 if (enable_tx_firmware_statistics) { 1223 if (enable_tx_firmware_statistics) {
1240 out_be32(tx_rmon_base_ptr, 1224 out_be32(tx_rmon_base_ptr,
1241 tx_firmware_statistics_structure_address); 1225 tx_firmware_statistics_structure_address);
1242 temoder_value = in_be16(temoder_register); 1226 setbits16(temoder_register, TEMODER_TX_RMON_STATISTICS_ENABLE);
1243 temoder_value |= TEMODER_TX_RMON_STATISTICS_ENABLE;
1244 out_be16(temoder_register, temoder_value);
1245 } 1227 }
1246 1228
1247 if (enable_rx_firmware_statistics) { 1229 if (enable_rx_firmware_statistics) {
1248 out_be32(rx_rmon_base_ptr, 1230 out_be32(rx_rmon_base_ptr,
1249 rx_firmware_statistics_structure_address); 1231 rx_firmware_statistics_structure_address);
1250 remoder_value = in_be32(remoder_register); 1232 setbits32(remoder_register, REMODER_RX_RMON_STATISTICS_ENABLE);
1251 remoder_value |= REMODER_RX_RMON_STATISTICS_ENABLE;
1252 out_be32(remoder_register, remoder_value);
1253 } 1233 }
1254 1234
1255 return 0; 1235 return 0;
@@ -1316,15 +1296,12 @@ static int init_check_frame_length_mode(int length_check,
1316static int init_preamble_length(u8 preamble_length, 1296static int init_preamble_length(u8 preamble_length,
1317 u32 __iomem *maccfg2_register) 1297 u32 __iomem *maccfg2_register)
1318{ 1298{
1319 u32 value = 0;
1320
1321 if ((preamble_length < 3) || (preamble_length > 7)) 1299 if ((preamble_length < 3) || (preamble_length > 7))
1322 return -EINVAL; 1300 return -EINVAL;
1323 1301
1324 value = in_be32(maccfg2_register); 1302 clrsetbits_be32(maccfg2_register, MACCFG2_PREL_MASK,
1325 value &= ~MACCFG2_PREL_MASK; 1303 preamble_length << MACCFG2_PREL_SHIFT);
1326 value |= (preamble_length << MACCFG2_PREL_SHIFT); 1304
1327 out_be32(maccfg2_register, value);
1328 return 0; 1305 return 0;
1329} 1306}
1330 1307
@@ -1337,19 +1314,19 @@ static int init_rx_parameters(int reject_broadcast,
1337 value = in_be32(upsmr_register); 1314 value = in_be32(upsmr_register);
1338 1315
1339 if (reject_broadcast) 1316 if (reject_broadcast)
1340 value |= UPSMR_BRO; 1317 value |= UCC_GETH_UPSMR_BRO;
1341 else 1318 else
1342 value &= ~UPSMR_BRO; 1319 value &= ~UCC_GETH_UPSMR_BRO;
1343 1320
1344 if (receive_short_frames) 1321 if (receive_short_frames)
1345 value |= UPSMR_RSH; 1322 value |= UCC_GETH_UPSMR_RSH;
1346 else 1323 else
1347 value &= ~UPSMR_RSH; 1324 value &= ~UCC_GETH_UPSMR_RSH;
1348 1325
1349 if (promiscuous) 1326 if (promiscuous)
1350 value |= UPSMR_PRO; 1327 value |= UCC_GETH_UPSMR_PRO;
1351 else 1328 else
1352 value &= ~UPSMR_PRO; 1329 value &= ~UCC_GETH_UPSMR_PRO;
1353 1330
1354 out_be32(upsmr_register, value); 1331 out_be32(upsmr_register, value);
1355 1332
@@ -1410,26 +1387,27 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
1410 1387
1411 /* Set UPSMR */ 1388 /* Set UPSMR */
1412 upsmr = in_be32(&uf_regs->upsmr); 1389 upsmr = in_be32(&uf_regs->upsmr);
1413 upsmr &= ~(UPSMR_RPM | UPSMR_R10M | UPSMR_TBIM | UPSMR_RMM); 1390 upsmr &= ~(UCC_GETH_UPSMR_RPM | UCC_GETH_UPSMR_R10M |
1391 UCC_GETH_UPSMR_TBIM | UCC_GETH_UPSMR_RMM);
1414 if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) || 1392 if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) ||
1415 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) || 1393 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) ||
1416 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) || 1394 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) ||
1417 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) || 1395 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
1418 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) || 1396 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) ||
1419 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { 1397 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
1420 upsmr |= UPSMR_RPM; 1398 upsmr |= UCC_GETH_UPSMR_RPM;
1421 switch (ugeth->max_speed) { 1399 switch (ugeth->max_speed) {
1422 case SPEED_10: 1400 case SPEED_10:
1423 upsmr |= UPSMR_R10M; 1401 upsmr |= UCC_GETH_UPSMR_R10M;
1424 /* FALLTHROUGH */ 1402 /* FALLTHROUGH */
1425 case SPEED_100: 1403 case SPEED_100:
1426 if (ugeth->phy_interface != PHY_INTERFACE_MODE_RTBI) 1404 if (ugeth->phy_interface != PHY_INTERFACE_MODE_RTBI)
1427 upsmr |= UPSMR_RMM; 1405 upsmr |= UCC_GETH_UPSMR_RMM;
1428 } 1406 }
1429 } 1407 }
1430 if ((ugeth->phy_interface == PHY_INTERFACE_MODE_TBI) || 1408 if ((ugeth->phy_interface == PHY_INTERFACE_MODE_TBI) ||
1431 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { 1409 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
1432 upsmr |= UPSMR_TBIM; 1410 upsmr |= UCC_GETH_UPSMR_TBIM;
1433 } 1411 }
1434 out_be32(&uf_regs->upsmr, upsmr); 1412 out_be32(&uf_regs->upsmr, upsmr);
1435 1413
@@ -1517,9 +1495,9 @@ static void adjust_link(struct net_device *dev)
1517 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) || 1495 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) ||
1518 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { 1496 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
1519 if (phydev->speed == SPEED_10) 1497 if (phydev->speed == SPEED_10)
1520 upsmr |= UPSMR_R10M; 1498 upsmr |= UCC_GETH_UPSMR_R10M;
1521 else 1499 else
1522 upsmr &= ~(UPSMR_R10M); 1500 upsmr &= ~UCC_GETH_UPSMR_R10M;
1523 } 1501 }
1524 break; 1502 break;
1525 default: 1503 default:
@@ -1602,10 +1580,8 @@ static int ugeth_graceful_stop_tx(struct ucc_geth_private *ugeth)
1602 uccf = ugeth->uccf; 1580 uccf = ugeth->uccf;
1603 1581
1604 /* Mask GRACEFUL STOP TX interrupt bit and clear it */ 1582 /* Mask GRACEFUL STOP TX interrupt bit and clear it */
1605 temp = in_be32(uccf->p_uccm); 1583 clrbits32(uccf->p_uccm, UCC_GETH_UCCE_GRA);
1606 temp &= ~UCCE_GRA; 1584 out_be32(uccf->p_ucce, UCC_GETH_UCCE_GRA); /* clear by writing 1 */
1607 out_be32(uccf->p_uccm, temp);
1608 out_be32(uccf->p_ucce, UCCE_GRA); /* clear by writing 1 */
1609 1585
1610 /* Issue host command */ 1586 /* Issue host command */
1611 cecr_subblock = 1587 cecr_subblock =
@@ -1617,7 +1593,7 @@ static int ugeth_graceful_stop_tx(struct ucc_geth_private *ugeth)
1617 do { 1593 do {
1618 msleep(10); 1594 msleep(10);
1619 temp = in_be32(uccf->p_ucce); 1595 temp = in_be32(uccf->p_ucce);
1620 } while (!(temp & UCCE_GRA) && --i); 1596 } while (!(temp & UCC_GETH_UCCE_GRA) && --i);
1621 1597
1622 uccf->stopped_tx = 1; 1598 uccf->stopped_tx = 1;
1623 1599
@@ -1975,12 +1951,9 @@ static void ucc_geth_set_multi(struct net_device *dev)
1975 uf_regs = ugeth->uccf->uf_regs; 1951 uf_regs = ugeth->uccf->uf_regs;
1976 1952
1977 if (dev->flags & IFF_PROMISC) { 1953 if (dev->flags & IFF_PROMISC) {
1978 1954 setbits32(&uf_regs->upsmr, UCC_GETH_UPSMR_PRO);
1979 out_be32(&uf_regs->upsmr, in_be32(&uf_regs->upsmr) | UPSMR_PRO);
1980
1981 } else { 1955 } else {
1982 1956 clrbits32(&uf_regs->upsmr, UCC_GETH_UPSMR_PRO);
1983 out_be32(&uf_regs->upsmr, in_be32(&uf_regs->upsmr)&~UPSMR_PRO);
1984 1957
1985 p_82xx_addr_filt = 1958 p_82xx_addr_filt =
1986 (struct ucc_geth_82xx_address_filtering_pram __iomem *) ugeth-> 1959 (struct ucc_geth_82xx_address_filtering_pram __iomem *) ugeth->
@@ -2020,7 +1993,6 @@ static void ucc_geth_stop(struct ucc_geth_private *ugeth)
2020{ 1993{
2021 struct ucc_geth __iomem *ug_regs = ugeth->ug_regs; 1994 struct ucc_geth __iomem *ug_regs = ugeth->ug_regs;
2022 struct phy_device *phydev = ugeth->phydev; 1995 struct phy_device *phydev = ugeth->phydev;
2023 u32 tempval;
2024 1996
2025 ugeth_vdbg("%s: IN", __func__); 1997 ugeth_vdbg("%s: IN", __func__);
2026 1998
@@ -2037,9 +2009,7 @@ static void ucc_geth_stop(struct ucc_geth_private *ugeth)
2037 out_be32(ugeth->uccf->p_ucce, 0xffffffff); 2009 out_be32(ugeth->uccf->p_ucce, 0xffffffff);
2038 2010
2039 /* Disable Rx and Tx */ 2011 /* Disable Rx and Tx */
2040 tempval = in_be32(&ug_regs->maccfg1); 2012 clrbits32(&ug_regs->maccfg1, MACCFG1_ENABLE_RX | MACCFG1_ENABLE_TX);
2041 tempval &= ~(MACCFG1_ENABLE_RX | MACCFG1_ENABLE_TX);
2042 out_be32(&ug_regs->maccfg1, tempval);
2043 2013
2044 ucc_geth_memclean(ugeth); 2014 ucc_geth_memclean(ugeth);
2045} 2015}
@@ -2153,10 +2123,10 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
2153 /* Generate uccm_mask for receive */ 2123 /* Generate uccm_mask for receive */
2154 uf_info->uccm_mask = ug_info->eventRegMask & UCCE_OTHER;/* Errors */ 2124 uf_info->uccm_mask = ug_info->eventRegMask & UCCE_OTHER;/* Errors */
2155 for (i = 0; i < ug_info->numQueuesRx; i++) 2125 for (i = 0; i < ug_info->numQueuesRx; i++)
2156 uf_info->uccm_mask |= (UCCE_RXBF_SINGLE_MASK << i); 2126 uf_info->uccm_mask |= (UCC_GETH_UCCE_RXF0 << i);
2157 2127
2158 for (i = 0; i < ug_info->numQueuesTx; i++) 2128 for (i = 0; i < ug_info->numQueuesTx; i++)
2159 uf_info->uccm_mask |= (UCCE_TXBF_SINGLE_MASK << i); 2129 uf_info->uccm_mask |= (UCC_GETH_UCCE_TXB0 << i);
2160 /* Initialize the general fast UCC block. */ 2130 /* Initialize the general fast UCC block. */
2161 if (ucc_fast_init(uf_info, &ugeth->uccf)) { 2131 if (ucc_fast_init(uf_info, &ugeth->uccf)) {
2162 if (netif_msg_probe(ugeth)) 2132 if (netif_msg_probe(ugeth))
@@ -2185,7 +2155,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2185 struct ucc_geth __iomem *ug_regs; 2155 struct ucc_geth __iomem *ug_regs;
2186 int ret_val = -EINVAL; 2156 int ret_val = -EINVAL;
2187 u32 remoder = UCC_GETH_REMODER_INIT; 2157 u32 remoder = UCC_GETH_REMODER_INIT;
2188 u32 init_enet_pram_offset, cecr_subblock, command, maccfg1; 2158 u32 init_enet_pram_offset, cecr_subblock, command;
2189 u32 ifstat, i, j, size, l2qt, l3qt, length; 2159 u32 ifstat, i, j, size, l2qt, l3qt, length;
2190 u16 temoder = UCC_GETH_TEMODER_INIT; 2160 u16 temoder = UCC_GETH_TEMODER_INIT;
2191 u16 test; 2161 u16 test;
@@ -2281,10 +2251,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
2281 &uf_regs->upsmr, 2251 &uf_regs->upsmr,
2282 &ug_regs->uempr, &ug_regs->maccfg1); 2252 &ug_regs->uempr, &ug_regs->maccfg1);
2283 2253
2284 maccfg1 = in_be32(&ug_regs->maccfg1); 2254 setbits32(&ug_regs->maccfg1, MACCFG1_ENABLE_RX | MACCFG1_ENABLE_TX);
2285 maccfg1 |= MACCFG1_ENABLE_RX;
2286 maccfg1 |= MACCFG1_ENABLE_TX;
2287 out_be32(&ug_regs->maccfg1, maccfg1);
2288 2255
2289 /* Set IPGIFG */ 2256 /* Set IPGIFG */
2290 /* For more details see the hardware spec. */ 2257 /* For more details see the hardware spec. */
@@ -3274,7 +3241,6 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
3274static int ucc_geth_poll(struct napi_struct *napi, int budget) 3241static int ucc_geth_poll(struct napi_struct *napi, int budget)
3275{ 3242{
3276 struct ucc_geth_private *ugeth = container_of(napi, struct ucc_geth_private, napi); 3243 struct ucc_geth_private *ugeth = container_of(napi, struct ucc_geth_private, napi);
3277 struct net_device *dev = ugeth->dev;
3278 struct ucc_geth_info *ug_info; 3244 struct ucc_geth_info *ug_info;
3279 int howmany, i; 3245 int howmany, i;
3280 3246
@@ -3285,14 +3251,8 @@ static int ucc_geth_poll(struct napi_struct *napi, int budget)
3285 howmany += ucc_geth_rx(ugeth, i, budget - howmany); 3251 howmany += ucc_geth_rx(ugeth, i, budget - howmany);
3286 3252
3287 if (howmany < budget) { 3253 if (howmany < budget) {
3288 struct ucc_fast_private *uccf;
3289 u32 uccm;
3290
3291 netif_rx_complete(napi); 3254 netif_rx_complete(napi);
3292 uccf = ugeth->uccf; 3255 setbits32(ugeth->uccf->p_uccm, UCCE_RX_EVENTS);
3293 uccm = in_be32(uccf->p_uccm);
3294 uccm |= UCCE_RX_EVENTS;
3295 out_be32(uccf->p_uccm, uccm);
3296 } 3256 }
3297 3257
3298 return howmany; 3258 return howmany;
@@ -3332,7 +3292,7 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info)
3332 /* Tx event processing */ 3292 /* Tx event processing */
3333 if (ucce & UCCE_TX_EVENTS) { 3293 if (ucce & UCCE_TX_EVENTS) {
3334 spin_lock(&ugeth->lock); 3294 spin_lock(&ugeth->lock);
3335 tx_mask = UCCE_TXBF_SINGLE_MASK; 3295 tx_mask = UCC_GETH_UCCE_TXB0;
3336 for (i = 0; i < ug_info->numQueuesTx; i++) { 3296 for (i = 0; i < ug_info->numQueuesTx; i++) {
3337 if (ucce & tx_mask) 3297 if (ucce & tx_mask)
3338 ucc_geth_tx(dev, i); 3298 ucc_geth_tx(dev, i);
@@ -3344,12 +3304,10 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info)
3344 3304
3345 /* Errors and other events */ 3305 /* Errors and other events */
3346 if (ucce & UCCE_OTHER) { 3306 if (ucce & UCCE_OTHER) {
3347 if (ucce & UCCE_BSY) { 3307 if (ucce & UCC_GETH_UCCE_BSY)
3348 dev->stats.rx_errors++; 3308 dev->stats.rx_errors++;
3349 } 3309 if (ucce & UCC_GETH_UCCE_TXE)
3350 if (ucce & UCCE_TXE) {
3351 dev->stats.tx_errors++; 3310 dev->stats.tx_errors++;
3352 }
3353 } 3311 }
3354 3312
3355 return IRQ_HANDLED; 3313 return IRQ_HANDLED;
diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h
index d74d2f7cb739..8f699cb773ee 100644
--- a/drivers/net/ucc_geth.h
+++ b/drivers/net/ucc_geth.h
@@ -162,92 +162,27 @@ struct ucc_geth {
162 boundary */ 162 boundary */
163 163
164/* UCC GETH Event Register */ 164/* UCC GETH Event Register */
165#define UCCE_MPD 0x80000000 /* Magic packet 165#define UCCE_TXB (UCC_GETH_UCCE_TXB7 | UCC_GETH_UCCE_TXB6 | \
166 detection */ 166 UCC_GETH_UCCE_TXB5 | UCC_GETH_UCCE_TXB4 | \
167#define UCCE_SCAR 0x40000000 167 UCC_GETH_UCCE_TXB3 | UCC_GETH_UCCE_TXB2 | \
168#define UCCE_GRA 0x20000000 /* Tx graceful 168 UCC_GETH_UCCE_TXB1 | UCC_GETH_UCCE_TXB0)
169 stop 169
170 complete */ 170#define UCCE_RXB (UCC_GETH_UCCE_RXB7 | UCC_GETH_UCCE_RXB6 | \
171#define UCCE_CBPR 0x10000000 171 UCC_GETH_UCCE_RXB5 | UCC_GETH_UCCE_RXB4 | \
172#define UCCE_BSY 0x08000000 172 UCC_GETH_UCCE_RXB3 | UCC_GETH_UCCE_RXB2 | \
173#define UCCE_RXC 0x04000000 173 UCC_GETH_UCCE_RXB1 | UCC_GETH_UCCE_RXB0)
174#define UCCE_TXC 0x02000000 174
175#define UCCE_TXE 0x01000000 175#define UCCE_RXF (UCC_GETH_UCCE_RXF7 | UCC_GETH_UCCE_RXF6 | \
176#define UCCE_TXB7 0x00800000 176 UCC_GETH_UCCE_RXF5 | UCC_GETH_UCCE_RXF4 | \
177#define UCCE_TXB6 0x00400000 177 UCC_GETH_UCCE_RXF3 | UCC_GETH_UCCE_RXF2 | \
178#define UCCE_TXB5 0x00200000 178 UCC_GETH_UCCE_RXF1 | UCC_GETH_UCCE_RXF0)
179#define UCCE_TXB4 0x00100000 179
180#define UCCE_TXB3 0x00080000 180#define UCCE_OTHER (UCC_GETH_UCCE_SCAR | UCC_GETH_UCCE_GRA | \
181#define UCCE_TXB2 0x00040000 181 UCC_GETH_UCCE_CBPR | UCC_GETH_UCCE_BSY | \
182#define UCCE_TXB1 0x00020000 182 UCC_GETH_UCCE_RXC | UCC_GETH_UCCE_TXC | UCC_GETH_UCCE_TXE)
183#define UCCE_TXB0 0x00010000 183
184#define UCCE_RXB7 0x00008000 184#define UCCE_RX_EVENTS (UCCE_RXF | UCC_GETH_UCCE_BSY)
185#define UCCE_RXB6 0x00004000 185#define UCCE_TX_EVENTS (UCCE_TXB | UCC_GETH_UCCE_TXE)
186#define UCCE_RXB5 0x00002000
187#define UCCE_RXB4 0x00001000
188#define UCCE_RXB3 0x00000800
189#define UCCE_RXB2 0x00000400
190#define UCCE_RXB1 0x00000200
191#define UCCE_RXB0 0x00000100
192#define UCCE_RXF7 0x00000080
193#define UCCE_RXF6 0x00000040
194#define UCCE_RXF5 0x00000020
195#define UCCE_RXF4 0x00000010
196#define UCCE_RXF3 0x00000008
197#define UCCE_RXF2 0x00000004
198#define UCCE_RXF1 0x00000002
199#define UCCE_RXF0 0x00000001
200
201#define UCCE_RXBF_SINGLE_MASK (UCCE_RXF0)
202#define UCCE_TXBF_SINGLE_MASK (UCCE_TXB0)
203
204#define UCCE_TXB (UCCE_TXB7 | UCCE_TXB6 | UCCE_TXB5 | UCCE_TXB4 |\
205 UCCE_TXB3 | UCCE_TXB2 | UCCE_TXB1 | UCCE_TXB0)
206#define UCCE_RXB (UCCE_RXB7 | UCCE_RXB6 | UCCE_RXB5 | UCCE_RXB4 |\
207 UCCE_RXB3 | UCCE_RXB2 | UCCE_RXB1 | UCCE_RXB0)
208#define UCCE_RXF (UCCE_RXF7 | UCCE_RXF6 | UCCE_RXF5 | UCCE_RXF4 |\
209 UCCE_RXF3 | UCCE_RXF2 | UCCE_RXF1 | UCCE_RXF0)
210#define UCCE_OTHER (UCCE_SCAR | UCCE_GRA | UCCE_CBPR | UCCE_BSY |\
211 UCCE_RXC | UCCE_TXC | UCCE_TXE)
212
213#define UCCE_RX_EVENTS (UCCE_RXF | UCCE_BSY)
214#define UCCE_TX_EVENTS (UCCE_TXB | UCCE_TXE)
215
216/* UCC GETH UPSMR (Protocol Specific Mode Register) */
217#define UPSMR_ECM 0x04000000 /* Enable CAM
218 Miss or
219 Enable
220 Filtering
221 Miss */
222#define UPSMR_HSE 0x02000000 /* Hardware
223 Statistics
224 Enable */
225#define UPSMR_PRO 0x00400000 /* Promiscuous*/
226#define UPSMR_CAP 0x00200000 /* CAM polarity
227 */
228#define UPSMR_RSH 0x00100000 /* Receive
229 Short Frames
230 */
231#define UPSMR_RPM 0x00080000 /* Reduced Pin
232 Mode
233 interfaces */
234#define UPSMR_R10M 0x00040000 /* RGMII/RMII
235 10 Mode */
236#define UPSMR_RLPB 0x00020000 /* RMII
237 Loopback
238 Mode */
239#define UPSMR_TBIM 0x00010000 /* Ten-bit
240 Interface
241 Mode */
242#define UPSMR_RMM 0x00001000 /* RMII/RGMII
243 Mode */
244#define UPSMR_CAM 0x00000400 /* CAM Address
245 Matching */
246#define UPSMR_BRO 0x00000200 /* Broadcast
247 Address */
248#define UPSMR_RES1 0x00002000 /* Reserved
249 feild - must
250 be 1 */
251 186
252/* UCC GETH MACCFG1 (MAC Configuration 1 Register) */ 187/* UCC GETH MACCFG1 (MAC Configuration 1 Register) */
253#define MACCFG1_FLOW_RX 0x00000020 /* Flow Control 188#define MACCFG1_FLOW_RX 0x00000020 /* Flow Control
@@ -945,9 +880,10 @@ struct ucc_geth_hardware_statistics {
945#define UCC_GETH_REMODER_INIT 0 /* bits that must be 880#define UCC_GETH_REMODER_INIT 0 /* bits that must be
946 set */ 881 set */
947#define UCC_GETH_TEMODER_INIT 0xC000 /* bits that must */ 882#define UCC_GETH_TEMODER_INIT 0xC000 /* bits that must */
948#define UCC_GETH_UPSMR_INIT (UPSMR_RES1) /* Start value 883
949 for this 884/* Initial value for UPSMR */
950 register */ 885#define UCC_GETH_UPSMR_INIT UCC_GETH_UPSMR_RES1
886
951#define UCC_GETH_MACCFG1_INIT 0 887#define UCC_GETH_MACCFG1_INIT 0
952#define UCC_GETH_MACCFG2_INIT (MACCFG2_RESERVED_1) 888#define UCC_GETH_MACCFG2_INIT (MACCFG2_RESERVED_1)
953 889
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index c4918b86ed19..0d0fa91c0251 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1297,6 +1297,7 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp)
1297 /* setup */ 1297 /* setup */
1298 spin_lock_irq(&serial->serial_lock); 1298 spin_lock_irq(&serial->serial_lock);
1299 tty->driver_data = serial; 1299 tty->driver_data = serial;
1300 tty_kref_put(serial->tty);
1300 serial->tty = tty_kref_get(tty); 1301 serial->tty = tty_kref_get(tty);
1301 spin_unlock_irq(&serial->serial_lock); 1302 spin_unlock_irq(&serial->serial_lock);
1302 1303
@@ -1792,8 +1793,8 @@ static int mux_device_request(struct hso_serial *serial, u8 type, u16 port,
1792 1793
1793 /* initialize */ 1794 /* initialize */
1794 ctrl_req->wValue = 0; 1795 ctrl_req->wValue = 0;
1795 ctrl_req->wIndex = hso_port_to_mux(port); 1796 ctrl_req->wIndex = cpu_to_le16(hso_port_to_mux(port));
1796 ctrl_req->wLength = size; 1797 ctrl_req->wLength = cpu_to_le16(size);
1797 1798
1798 if (type == USB_CDC_GET_ENCAPSULATED_RESPONSE) { 1799 if (type == USB_CDC_GET_ENCAPSULATED_RESPONSE) {
1799 /* Reading command */ 1800 /* Reading command */
@@ -2043,9 +2044,8 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial)
2043 return -2; 2044 return -2;
2044 } 2045 }
2045 2046
2046 spin_lock(&serial->serial_lock); 2047 /* All callers to put_rxbuf_data hold serial_lock */
2047 tty = tty_kref_get(serial->tty); 2048 tty = tty_kref_get(serial->tty);
2048 spin_unlock(&serial->serial_lock);
2049 2049
2050 /* Push data to tty */ 2050 /* Push data to tty */
2051 if (tty) { 2051 if (tty) {
@@ -2053,8 +2053,10 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial)
2053 serial->curr_rx_urb_offset; 2053 serial->curr_rx_urb_offset;
2054 D1("data to push to tty"); 2054 D1("data to push to tty");
2055 while (write_length_remaining) { 2055 while (write_length_remaining) {
2056 if (test_bit(TTY_THROTTLED, &tty->flags)) 2056 if (test_bit(TTY_THROTTLED, &tty->flags)) {
2057 tty_kref_put(tty);
2057 return -1; 2058 return -1;
2059 }
2058 curr_write_len = tty_insert_flip_string 2060 curr_write_len = tty_insert_flip_string
2059 (tty, urb->transfer_buffer + 2061 (tty, urb->transfer_buffer +
2060 serial->curr_rx_urb_offset, 2062 serial->curr_rx_urb_offset,
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index ac07cc6e3cb2..3b8e63254277 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -622,6 +622,7 @@ static const struct net_device_ops rhine_netdev_ops = {
622 .ndo_get_stats = rhine_get_stats, 622 .ndo_get_stats = rhine_get_stats,
623 .ndo_set_multicast_list = rhine_set_rx_mode, 623 .ndo_set_multicast_list = rhine_set_rx_mode,
624 .ndo_validate_addr = eth_validate_addr, 624 .ndo_validate_addr = eth_validate_addr,
625 .ndo_set_mac_address = eth_mac_addr,
625 .ndo_do_ioctl = netdev_ioctl, 626 .ndo_do_ioctl = netdev_ioctl,
626 .ndo_tx_timeout = rhine_tx_timeout, 627 .ndo_tx_timeout = rhine_tx_timeout,
627#ifdef CONFIG_NET_POLL_CONTROLLER 628#ifdef CONFIG_NET_POLL_CONTROLLER
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 58e25d090ae0..a75f91dc3153 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -855,6 +855,7 @@ static const struct net_device_ops velocity_netdev_ops = {
855 .ndo_start_xmit = velocity_xmit, 855 .ndo_start_xmit = velocity_xmit,
856 .ndo_get_stats = velocity_get_stats, 856 .ndo_get_stats = velocity_get_stats,
857 .ndo_validate_addr = eth_validate_addr, 857 .ndo_validate_addr = eth_validate_addr,
858 .ndo_set_mac_address = eth_mac_addr,
858 .ndo_set_multicast_list = velocity_set_multi, 859 .ndo_set_multicast_list = velocity_set_multi,
859 .ndo_change_mtu = velocity_change_mtu, 860 .ndo_change_mtu = velocity_change_mtu,
860 .ndo_do_ioctl = velocity_ioctl, 861 .ndo_do_ioctl = velocity_ioctl,
diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c
index 2dc241689d37..0dbd85b0162d 100644
--- a/drivers/net/wan/ixp4xx_hss.c
+++ b/drivers/net/wan/ixp4xx_hss.c
@@ -622,7 +622,7 @@ static void hss_hdlc_rx_irq(void *pdev)
622 printk(KERN_DEBUG "%s: hss_hdlc_rx_irq\n", dev->name); 622 printk(KERN_DEBUG "%s: hss_hdlc_rx_irq\n", dev->name);
623#endif 623#endif
624 qmgr_disable_irq(queue_ids[port->id].rx); 624 qmgr_disable_irq(queue_ids[port->id].rx);
625 netif_rx_schedule(dev, &port->napi); 625 netif_rx_schedule(&port->napi);
626} 626}
627 627
628static int hss_hdlc_poll(struct napi_struct *napi, int budget) 628static int hss_hdlc_poll(struct napi_struct *napi, int budget)
@@ -651,7 +651,7 @@ static int hss_hdlc_poll(struct napi_struct *napi, int budget)
651 printk(KERN_DEBUG "%s: hss_hdlc_poll" 651 printk(KERN_DEBUG "%s: hss_hdlc_poll"
652 " netif_rx_complete\n", dev->name); 652 " netif_rx_complete\n", dev->name);
653#endif 653#endif
654 netif_rx_complete(dev, napi); 654 netif_rx_complete(napi);
655 qmgr_enable_irq(rxq); 655 qmgr_enable_irq(rxq);
656 if (!qmgr_stat_empty(rxq) && 656 if (!qmgr_stat_empty(rxq) &&
657 netif_rx_reschedule(napi)) { 657 netif_rx_reschedule(napi)) {
@@ -1069,7 +1069,7 @@ static int hss_hdlc_open(struct net_device *dev)
1069 hss_start_hdlc(port); 1069 hss_start_hdlc(port);
1070 1070
1071 /* we may already have RX data, enables IRQ */ 1071 /* we may already have RX data, enables IRQ */
1072 netif_rx_schedule(dev, &port->napi); 1072 netif_rx_schedule(&port->napi);
1073 return 0; 1073 return 0;
1074 1074
1075err_unlock: 1075err_unlock:
diff --git a/drivers/net/wd.c b/drivers/net/wd.c
index 3c1edda08d3d..d8322d2d1e29 100644
--- a/drivers/net/wd.c
+++ b/drivers/net/wd.c
@@ -155,6 +155,7 @@ static const struct net_device_ops wd_netdev_ops = {
155 .ndo_get_stats = ei_get_stats, 155 .ndo_get_stats = ei_get_stats,
156 .ndo_set_multicast_list = ei_set_multicast_list, 156 .ndo_set_multicast_list = ei_set_multicast_list,
157 .ndo_validate_addr = eth_validate_addr, 157 .ndo_validate_addr = eth_validate_addr,
158 .ndo_set_mac_address = eth_mac_addr,
158 .ndo_change_mtu = eth_change_mtu, 159 .ndo_change_mtu = eth_change_mtu,
159#ifdef CONFIG_NET_POLL_CONTROLLER 160#ifdef CONFIG_NET_POLL_CONTROLLER
160 .ndo_poll_controller = ei_poll, 161 .ndo_poll_controller = ei_poll,
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index ea543fcf2687..e4f9f747de88 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -111,7 +111,7 @@ config WLAN_80211
111 lets you choose drivers. 111 lets you choose drivers.
112 112
113config PCMCIA_RAYCS 113config PCMCIA_RAYCS
114 tristate "Aviator/Raytheon 2.4MHz wireless support" 114 tristate "Aviator/Raytheon 2.4GHz wireless support"
115 depends on PCMCIA && WLAN_80211 115 depends on PCMCIA && WLAN_80211
116 select WIRELESS_EXT 116 select WIRELESS_EXT
117 ---help--- 117 ---help---
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 4af2607deec0..8ef87356e083 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -2644,7 +2644,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2644 if (skb_headroom(skb) < padsize) { 2644 if (skb_headroom(skb) < padsize) {
2645 ATH5K_ERR(sc, "tx hdrlen not %%4: %d not enough" 2645 ATH5K_ERR(sc, "tx hdrlen not %%4: %d not enough"
2646 " headroom to pad %d\n", hdrlen, padsize); 2646 " headroom to pad %d\n", hdrlen, padsize);
2647 return -1; 2647 return NETDEV_TX_BUSY;
2648 } 2648 }
2649 skb_push(skb, padsize); 2649 skb_push(skb, padsize);
2650 memmove(skb->data, skb->data+padsize, hdrlen); 2650 memmove(skb->data, skb->data+padsize, hdrlen);
@@ -2655,7 +2655,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2655 ATH5K_ERR(sc, "no further txbuf available, dropping packet\n"); 2655 ATH5K_ERR(sc, "no further txbuf available, dropping packet\n");
2656 spin_unlock_irqrestore(&sc->txbuflock, flags); 2656 spin_unlock_irqrestore(&sc->txbuflock, flags);
2657 ieee80211_stop_queue(hw, skb_get_queue_mapping(skb)); 2657 ieee80211_stop_queue(hw, skb_get_queue_mapping(skb));
2658 return -1; 2658 return NETDEV_TX_BUSY;
2659 } 2659 }
2660 bf = list_first_entry(&sc->txbuf, struct ath5k_buf, list); 2660 bf = list_first_entry(&sc->txbuf, struct ath5k_buf, list);
2661 list_del(&bf->list); 2661 list_del(&bf->list);
@@ -2673,10 +2673,10 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2673 sc->txbuf_len++; 2673 sc->txbuf_len++;
2674 spin_unlock_irqrestore(&sc->txbuflock, flags); 2674 spin_unlock_irqrestore(&sc->txbuflock, flags);
2675 dev_kfree_skb_any(skb); 2675 dev_kfree_skb_any(skb);
2676 return 0; 2676 return NETDEV_TX_OK;
2677 } 2677 }
2678 2678
2679 return 0; 2679 return NETDEV_TX_OK;
2680} 2680}
2681 2681
2682static int 2682static int
diff --git a/drivers/net/wireless/ath5k/pcu.c b/drivers/net/wireless/ath5k/pcu.c
index 0cac05c6a9ce..75eb9f43c741 100644
--- a/drivers/net/wireless/ath5k/pcu.c
+++ b/drivers/net/wireless/ath5k/pcu.c
@@ -65,7 +65,7 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah)
65 if (ah->ah_version == AR5K_AR5210) 65 if (ah->ah_version == AR5K_AR5210)
66 pcu_reg |= AR5K_STA_ID1_NO_PSPOLL; 66 pcu_reg |= AR5K_STA_ID1_NO_PSPOLL;
67 else 67 else
68 AR5K_REG_DISABLE_BITS(ah, AR5K_CFG, AR5K_CFG_ADHOC); 68 AR5K_REG_ENABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS);
69 break; 69 break;
70 70
71 case NL80211_IFTYPE_AP: 71 case NL80211_IFTYPE_AP:
@@ -75,7 +75,7 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah)
75 if (ah->ah_version == AR5K_AR5210) 75 if (ah->ah_version == AR5K_AR5210)
76 pcu_reg |= AR5K_STA_ID1_NO_PSPOLL; 76 pcu_reg |= AR5K_STA_ID1_NO_PSPOLL;
77 else 77 else
78 AR5K_REG_ENABLE_BITS(ah, AR5K_CFG, AR5K_CFG_ADHOC); 78 AR5K_REG_DISABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS);
79 break; 79 break;
80 80
81 case NL80211_IFTYPE_STATION: 81 case NL80211_IFTYPE_STATION:
diff --git a/drivers/net/wireless/ath5k/reg.h b/drivers/net/wireless/ath5k/reg.h
index 91aaeaf88199..9189ab13286c 100644
--- a/drivers/net/wireless/ath5k/reg.h
+++ b/drivers/net/wireless/ath5k/reg.h
@@ -73,7 +73,7 @@
73#define AR5K_CFG_SWRD 0x00000004 /* Byte-swap RX descriptor */ 73#define AR5K_CFG_SWRD 0x00000004 /* Byte-swap RX descriptor */
74#define AR5K_CFG_SWRB 0x00000008 /* Byte-swap RX buffer */ 74#define AR5K_CFG_SWRB 0x00000008 /* Byte-swap RX buffer */
75#define AR5K_CFG_SWRG 0x00000010 /* Byte-swap Register access */ 75#define AR5K_CFG_SWRG 0x00000010 /* Byte-swap Register access */
76#define AR5K_CFG_ADHOC 0x00000020 /* AP/Adhoc indication [5211+] */ 76#define AR5K_CFG_IBSS 0x00000020 /* 0-BSS, 1-IBSS [5211+] */
77#define AR5K_CFG_PHY_OK 0x00000100 /* [5211+] */ 77#define AR5K_CFG_PHY_OK 0x00000100 /* [5211+] */
78#define AR5K_CFG_EEBS 0x00000200 /* EEPROM is busy */ 78#define AR5K_CFG_EEBS 0x00000200 /* EEPROM is busy */
79#define AR5K_CFG_CLKGD 0x00000400 /* Clock gated (Disable dynamic clock) */ 79#define AR5K_CFG_CLKGD 0x00000400 /* Clock gated (Disable dynamic clock) */
diff --git a/drivers/net/wireless/ath9k/Kconfig b/drivers/net/wireless/ath9k/Kconfig
index c43bd321f97f..90a8dd873786 100644
--- a/drivers/net/wireless/ath9k/Kconfig
+++ b/drivers/net/wireless/ath9k/Kconfig
@@ -1,6 +1,7 @@
1config ATH9K 1config ATH9K
2 tristate "Atheros 802.11n wireless cards support" 2 tristate "Atheros 802.11n wireless cards support"
3 depends on PCI && MAC80211 && WLAN_80211 3 depends on PCI && MAC80211 && WLAN_80211
4 depends on RFKILL || RFKILL=n
4 select MAC80211_LEDS 5 select MAC80211_LEDS
5 select LEDS_CLASS 6 select LEDS_CLASS
6 select NEW_LEDS 7 select NEW_LEDS
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 191eec50dc75..727f067aca4f 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -2164,13 +2164,13 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
2164 conf->ht.channel_type); 2164 conf->ht.channel_type);
2165 } 2165 }
2166 2166
2167 ath_update_chainmask(sc, conf->ht.enabled);
2168
2167 if (ath_set_channel(sc, &sc->sc_ah->ah_channels[pos]) < 0) { 2169 if (ath_set_channel(sc, &sc->sc_ah->ah_channels[pos]) < 0) {
2168 DPRINTF(sc, ATH_DBG_FATAL, "Unable to set channel\n"); 2170 DPRINTF(sc, ATH_DBG_FATAL, "Unable to set channel\n");
2169 mutex_unlock(&sc->mutex); 2171 mutex_unlock(&sc->mutex);
2170 return -EINVAL; 2172 return -EINVAL;
2171 } 2173 }
2172
2173 ath_update_chainmask(sc, conf->ht.enabled);
2174 } 2174 }
2175 2175
2176 if (changed & IEEE80211_CONF_CHANGE_POWER) 2176 if (changed & IEEE80211_CONF_CHANGE_POWER)
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c
index 3bfc3b90f256..c92f0c6e4adc 100644
--- a/drivers/net/wireless/ath9k/xmit.c
+++ b/drivers/net/wireless/ath9k/xmit.c
@@ -126,15 +126,7 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
126 tx_info->flags |= IEEE80211_TX_STAT_ACK; 126 tx_info->flags |= IEEE80211_TX_STAT_ACK;
127 } 127 }
128 128
129 tx_info->status.rates[0].count = tx_status->retries; 129 tx_info->status.rates[0].count = tx_status->retries + 1;
130 if (tx_info->status.rates[0].flags & IEEE80211_TX_RC_MCS) {
131 /* Change idx from internal table index to MCS index */
132 int idx = tx_info->status.rates[0].idx;
133 struct ath_rate_table *rate_table = sc->cur_rate_table;
134 if (idx >= 0 && idx < rate_table->rate_cnt)
135 tx_info->status.rates[0].idx =
136 rate_table->info[idx].ratecode & 0x7f;
137 }
138 130
139 hdrlen = ieee80211_get_hdrlen_from_skb(skb); 131 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
140 padsize = hdrlen & 3; 132 padsize = hdrlen & 3;
@@ -264,25 +256,22 @@ static void assign_aggr_tid_seqno(struct sk_buff *skb,
264 } 256 }
265 257
266 /* Get seqno */ 258 /* Get seqno */
267 259 /* For HT capable stations, we save tidno for later use.
268 if (ieee80211_is_data(fc) && !is_pae(skb)) { 260 * We also override seqno set by upper layer with the one
269 /* For HT capable stations, we save tidno for later use. 261 * in tx aggregation state.
270 * We also override seqno set by upper layer with the one 262 *
271 * in tx aggregation state. 263 * If fragmentation is on, the sequence number is
272 * 264 * not overridden, since it has been
273 * If fragmentation is on, the sequence number is 265 * incremented by the fragmentation routine.
274 * not overridden, since it has been 266 *
275 * incremented by the fragmentation routine. 267 * FIXME: check if the fragmentation threshold exceeds
276 * 268 * IEEE80211 max.
277 * FIXME: check if the fragmentation threshold exceeds 269 */
278 * IEEE80211 max. 270 tid = ATH_AN_2_TID(an, bf->bf_tidno);
279 */ 271 hdr->seq_ctrl = cpu_to_le16(tid->seq_next <<
280 tid = ATH_AN_2_TID(an, bf->bf_tidno); 272 IEEE80211_SEQ_SEQ_SHIFT);
281 hdr->seq_ctrl = cpu_to_le16(tid->seq_next << 273 bf->bf_seqno = tid->seq_next;
282 IEEE80211_SEQ_SEQ_SHIFT); 274 INCR(tid->seq_next, IEEE80211_SEQ_MAX);
283 bf->bf_seqno = tid->seq_next;
284 INCR(tid->seq_next, IEEE80211_SEQ_MAX);
285 }
286} 275}
287 276
288static int setup_tx_flags(struct ath_softc *sc, struct sk_buff *skb, 277static int setup_tx_flags(struct ath_softc *sc, struct sk_buff *skb,
@@ -1718,11 +1707,10 @@ static int ath_tx_setup_buffer(struct ath_softc *sc, struct ath_buf *bf,
1718 1707
1719 /* Assign seqno, tidno */ 1708 /* Assign seqno, tidno */
1720 1709
1721 if (bf_isht(bf) && (sc->sc_flags & SC_OP_TXAGGR)) 1710 if (ieee80211_is_data_qos(fc) && (sc->sc_flags & SC_OP_TXAGGR))
1722 assign_aggr_tid_seqno(skb, bf); 1711 assign_aggr_tid_seqno(skb, bf);
1723 1712
1724 /* DMA setup */ 1713 /* DMA setup */
1725
1726 bf->bf_mpdu = skb; 1714 bf->bf_mpdu = skb;
1727 1715
1728 bf->bf_dmacontext = pci_map_single(sc->pdev, skb->data, 1716 bf->bf_dmacontext = pci_map_single(sc->pdev, skb->data,
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 7b31a327b24a..c788bad10661 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3261,7 +3261,7 @@ static int b43_switch_band(struct b43_wl *wl, struct ieee80211_channel *chan)
3261 struct b43_wldev *down_dev; 3261 struct b43_wldev *down_dev;
3262 struct b43_wldev *d; 3262 struct b43_wldev *d;
3263 int err; 3263 int err;
3264 bool gmode; 3264 bool uninitialized_var(gmode);
3265 int prev_status; 3265 int prev_status;
3266 3266
3267 /* Find a device and PHY which supports the band. */ 3267 /* Find a device and PHY which supports the band. */
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index c1324e31d2f6..fb996c27a19b 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -2465,7 +2465,7 @@ static void b43legacy_put_phy_into_reset(struct b43legacy_wldev *dev)
2465static int b43legacy_switch_phymode(struct b43legacy_wl *wl, 2465static int b43legacy_switch_phymode(struct b43legacy_wl *wl,
2466 unsigned int new_mode) 2466 unsigned int new_mode)
2467{ 2467{
2468 struct b43legacy_wldev *up_dev; 2468 struct b43legacy_wldev *uninitialized_var(up_dev);
2469 struct b43legacy_wldev *down_dev; 2469 struct b43legacy_wldev *down_dev;
2470 int err; 2470 int err;
2471 bool gmode = 0; 2471 bool gmode = 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 8fdb34222c0a..45cfa1cf194a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -2219,7 +2219,7 @@ int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv)
2219 /* set tx power value for all OFDM rates */ 2219 /* set tx power value for all OFDM rates */
2220 for (rate_index = 0; rate_index < IWL_OFDM_RATES; 2220 for (rate_index = 0; rate_index < IWL_OFDM_RATES;
2221 rate_index++) { 2221 rate_index++) {
2222 s32 power_idx; 2222 s32 uninitialized_var(power_idx);
2223 int rc; 2223 int rc;
2224 2224
2225 /* use channel group's clip-power table, 2225 /* use channel group's clip-power table,
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index 52966ffbef6e..ba997204c8d4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -255,7 +255,7 @@ struct iwl_cmd_header {
255 * 0x3) 54 Mbps 255 * 0x3) 54 Mbps
256 * 256 *
257 * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"): 257 * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"):
258 * 3-0: 10) 1 Mbps 258 * 6-0: 10) 1 Mbps
259 * 20) 2 Mbps 259 * 20) 2 Mbps
260 * 55) 5.5 Mbps 260 * 55) 5.5 Mbps
261 * 110) 11 Mbps 261 * 110) 11 Mbps
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c
index 01a2169cecec..8c71ad4f88c5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c
+++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c
@@ -51,6 +51,7 @@ const char *get_cmd_string(u8 cmd)
51 IWL_CMD(REPLY_REMOVE_STA); 51 IWL_CMD(REPLY_REMOVE_STA);
52 IWL_CMD(REPLY_REMOVE_ALL_STA); 52 IWL_CMD(REPLY_REMOVE_ALL_STA);
53 IWL_CMD(REPLY_WEPKEY); 53 IWL_CMD(REPLY_WEPKEY);
54 IWL_CMD(REPLY_3945_RX);
54 IWL_CMD(REPLY_TX); 55 IWL_CMD(REPLY_TX);
55 IWL_CMD(REPLY_RATE_SCALE); 56 IWL_CMD(REPLY_RATE_SCALE);
56 IWL_CMD(REPLY_LEDS_CMD); 57 IWL_CMD(REPLY_LEDS_CMD);
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 3dba83679444..4e0007d20030 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -1369,7 +1369,7 @@ EXPORT_SYMBOL_GPL(lbs_start_card);
1369 1369
1370void lbs_stop_card(struct lbs_private *priv) 1370void lbs_stop_card(struct lbs_private *priv)
1371{ 1371{
1372 struct net_device *dev = priv->dev; 1372 struct net_device *dev;
1373 struct cmd_ctrl_node *cmdnode; 1373 struct cmd_ctrl_node *cmdnode;
1374 unsigned long flags; 1374 unsigned long flags;
1375 1375
@@ -1377,9 +1377,10 @@ void lbs_stop_card(struct lbs_private *priv)
1377 1377
1378 if (!priv) 1378 if (!priv)
1379 goto out; 1379 goto out;
1380 dev = priv->dev;
1380 1381
1381 netif_stop_queue(priv->dev); 1382 netif_stop_queue(dev);
1382 netif_carrier_off(priv->dev); 1383 netif_carrier_off(dev);
1383 1384
1384 lbs_debugfs_remove_one(priv); 1385 lbs_debugfs_remove_one(priv);
1385 if (priv->mesh_tlv) { 1386 if (priv->mesh_tlv) {
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c
index d1fc305de5fe..e7289e2e7f16 100644
--- a/drivers/net/wireless/libertas_tf/main.c
+++ b/drivers/net/wireless/libertas_tf/main.c
@@ -206,7 +206,7 @@ static int lbtf_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
206 * there are no buffered multicast frames to send 206 * there are no buffered multicast frames to send
207 */ 207 */
208 ieee80211_stop_queues(priv->hw); 208 ieee80211_stop_queues(priv->hw);
209 return 0; 209 return NETDEV_TX_OK;
210} 210}
211 211
212static void lbtf_tx_work(struct work_struct *work) 212static void lbtf_tx_work(struct work_struct *work)
diff --git a/drivers/net/wireless/orinoco/orinoco.c b/drivers/net/wireless/orinoco/orinoco.c
index bc84e2792f8a..c3bb85e0251e 100644
--- a/drivers/net/wireless/orinoco/orinoco.c
+++ b/drivers/net/wireless/orinoco/orinoco.c
@@ -1610,6 +1610,16 @@ static void orinoco_rx_isr_tasklet(unsigned long data)
1610 struct orinoco_rx_data *rx_data, *temp; 1610 struct orinoco_rx_data *rx_data, *temp;
1611 struct hermes_rx_descriptor *desc; 1611 struct hermes_rx_descriptor *desc;
1612 struct sk_buff *skb; 1612 struct sk_buff *skb;
1613 unsigned long flags;
1614
1615 /* orinoco_rx requires the driver lock, and we also need to
1616 * protect priv->rx_list, so just hold the lock over the
1617 * lot.
1618 *
1619 * If orinoco_lock fails, we've unplugged the card. In this
1620 * case just abort. */
1621 if (orinoco_lock(priv, &flags) != 0)
1622 return;
1613 1623
1614 /* extract desc and skb from queue */ 1624 /* extract desc and skb from queue */
1615 list_for_each_entry_safe(rx_data, temp, &priv->rx_list, list) { 1625 list_for_each_entry_safe(rx_data, temp, &priv->rx_list, list) {
@@ -1622,6 +1632,8 @@ static void orinoco_rx_isr_tasklet(unsigned long data)
1622 1632
1623 kfree(desc); 1633 kfree(desc);
1624 } 1634 }
1635
1636 orinoco_unlock(priv, &flags);
1625} 1637}
1626 1638
1627/********************************************************************/ 1639/********************************************************************/
@@ -3645,12 +3657,22 @@ struct net_device
3645void free_orinocodev(struct net_device *dev) 3657void free_orinocodev(struct net_device *dev)
3646{ 3658{
3647 struct orinoco_private *priv = netdev_priv(dev); 3659 struct orinoco_private *priv = netdev_priv(dev);
3660 struct orinoco_rx_data *rx_data, *temp;
3648 3661
3649 /* No need to empty priv->rx_list: if the tasklet is scheduled 3662 /* If the tasklet is scheduled when we call tasklet_kill it
3650 * when we call tasklet_kill it will run one final time, 3663 * will run one final time. However the tasklet will only
3651 * emptying the list */ 3664 * drain priv->rx_list if the hw is still available. */
3652 tasklet_kill(&priv->rx_tasklet); 3665 tasklet_kill(&priv->rx_tasklet);
3653 3666
3667 /* Explicitly drain priv->rx_list */
3668 list_for_each_entry_safe(rx_data, temp, &priv->rx_list, list) {
3669 list_del(&rx_data->list);
3670
3671 dev_kfree_skb(rx_data->skb);
3672 kfree(rx_data->desc);
3673 kfree(rx_data);
3674 }
3675
3654 unregister_pm_notifier(&priv->pm_notifier); 3676 unregister_pm_notifier(&priv->pm_notifier);
3655 orinoco_uncache_fw(priv); 3677 orinoco_uncache_fw(priv);
3656 3678
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c
index f127602670ec..0b32215d3f5d 100644
--- a/drivers/net/wireless/orinoco/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco/orinoco_cs.c
@@ -435,6 +435,7 @@ static struct pcmcia_device_id orinoco_cs_ids[] = {
435 PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), /* Samsung SWL2000-N 11Mb/s WLAN Card */ 435 PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), /* Samsung SWL2000-N 11Mb/s WLAN Card */
436 PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), /* AirWay 802.11 Adapter (PCMCIA) */ 436 PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), /* AirWay 802.11 Adapter (PCMCIA) */
437 PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), /* ARtem Onair */ 437 PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), /* ARtem Onair */
438 PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0003), /* ARtem Onair Comcard 11 */
438 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), /* Buffalo WLI-PCM-S11 */ 439 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), /* Buffalo WLI-PCM-S11 */
439 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), /* Linksys WPC11 Version 2.5 */ 440 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), /* Linksys WPC11 Version 2.5 */
440 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), /* Linksys WPC11 Version 3 */ 441 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), /* Linksys WPC11 Version 3 */
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 82354b974a04..c6a370fa9bcb 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -138,6 +138,7 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw)
138 u8 *fw_version = NULL; 138 u8 *fw_version = NULL;
139 size_t len; 139 size_t len;
140 int i; 140 int i;
141 int maxlen;
141 142
142 if (priv->rx_start) 143 if (priv->rx_start)
143 return 0; 144 return 0;
@@ -195,6 +196,16 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw)
195 else 196 else
196 priv->rx_mtu = (size_t) 197 priv->rx_mtu = (size_t)
197 0x620 - priv->tx_hdr_len; 198 0x620 - priv->tx_hdr_len;
199 maxlen = priv->tx_hdr_len + /* USB devices */
200 sizeof(struct p54_rx_data) +
201 4 + /* rx alignment */
202 IEEE80211_MAX_FRAG_THRESHOLD;
203 if (priv->rx_mtu > maxlen && PAGE_SIZE == 4096) {
204 printk(KERN_INFO "p54: rx_mtu reduced from %d "
205 "to %d\n", priv->rx_mtu,
206 maxlen);
207 priv->rx_mtu = maxlen;
208 }
198 break; 209 break;
199 } 210 }
200 case BR_CODE_EXPOSED_IF: 211 case BR_CODE_EXPOSED_IF:
@@ -575,6 +586,7 @@ static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb)
575 u16 freq = le16_to_cpu(hdr->freq); 586 u16 freq = le16_to_cpu(hdr->freq);
576 size_t header_len = sizeof(*hdr); 587 size_t header_len = sizeof(*hdr);
577 u32 tsf32; 588 u32 tsf32;
589 u8 rate = hdr->rate & 0xf;
578 590
579 /* 591 /*
580 * If the device is in a unspecified state we have to 592 * If the device is in a unspecified state we have to
@@ -603,8 +615,11 @@ static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb)
603 rx_status.qual = (100 * hdr->rssi) / 127; 615 rx_status.qual = (100 * hdr->rssi) / 127;
604 if (hdr->rate & 0x10) 616 if (hdr->rate & 0x10)
605 rx_status.flag |= RX_FLAG_SHORTPRE; 617 rx_status.flag |= RX_FLAG_SHORTPRE;
606 rx_status.rate_idx = (dev->conf.channel->band == IEEE80211_BAND_2GHZ ? 618 if (dev->conf.channel->band == IEEE80211_BAND_5GHZ)
607 hdr->rate : (hdr->rate - 4)) & 0xf; 619 rx_status.rate_idx = (rate < 4) ? 0 : rate - 4;
620 else
621 rx_status.rate_idx = rate;
622
608 rx_status.freq = freq; 623 rx_status.freq = freq;
609 rx_status.band = dev->conf.channel->band; 624 rx_status.band = dev->conf.channel->band;
610 rx_status.antenna = hdr->antenna; 625 rx_status.antenna = hdr->antenna;
@@ -798,6 +813,16 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
798 info->flags |= IEEE80211_TX_STAT_TX_FILTERED; 813 info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
799 info->status.ack_signal = p54_rssi_to_dbm(dev, 814 info->status.ack_signal = p54_rssi_to_dbm(dev,
800 (int)payload->ack_rssi); 815 (int)payload->ack_rssi);
816
817 if (entry_data->key_type == P54_CRYPTO_TKIPMICHAEL) {
818 u8 *iv = (u8 *)(entry_data->align + pad +
819 entry_data->crypt_offset);
820
821 /* Restore the original TKIP IV. */
822 iv[2] = iv[0];
823 iv[0] = iv[1];
824 iv[1] = (iv[0] | 0x20) & 0x7f; /* WEPSeed - 8.3.2.2 */
825 }
801 skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data)); 826 skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data));
802 ieee80211_tx_status_irqsafe(dev, entry); 827 ieee80211_tx_status_irqsafe(dev, entry);
803 goto out; 828 goto out;
@@ -1383,7 +1408,6 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
1383 hdr->tries = ridx; 1408 hdr->tries = ridx;
1384 txhdr->rts_rate_idx = 0; 1409 txhdr->rts_rate_idx = 0;
1385 if (info->control.hw_key) { 1410 if (info->control.hw_key) {
1386 crypt_offset += info->control.hw_key->iv_len;
1387 txhdr->key_type = p54_convert_algo(info->control.hw_key->alg); 1411 txhdr->key_type = p54_convert_algo(info->control.hw_key->alg);
1388 txhdr->key_len = min((u8)16, info->control.hw_key->keylen); 1412 txhdr->key_len = min((u8)16, info->control.hw_key->keylen);
1389 memcpy(txhdr->key, info->control.hw_key->key, txhdr->key_len); 1413 memcpy(txhdr->key, info->control.hw_key->key, txhdr->key_len);
@@ -1397,6 +1421,8 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
1397 } 1421 }
1398 /* reserve some space for ICV */ 1422 /* reserve some space for ICV */
1399 len += info->control.hw_key->icv_len; 1423 len += info->control.hw_key->icv_len;
1424 memset(skb_put(skb, info->control.hw_key->icv_len), 0,
1425 info->control.hw_key->icv_len);
1400 } else { 1426 } else {
1401 txhdr->key_type = 0; 1427 txhdr->key_type = 0;
1402 txhdr->key_len = 0; 1428 txhdr->key_len = 0;
@@ -1824,7 +1850,7 @@ static void p54_remove_interface(struct ieee80211_hw *dev,
1824 1850
1825static int p54_config(struct ieee80211_hw *dev, u32 changed) 1851static int p54_config(struct ieee80211_hw *dev, u32 changed)
1826{ 1852{
1827 int ret; 1853 int ret = 0;
1828 struct p54_common *priv = dev->priv; 1854 struct p54_common *priv = dev->priv;
1829 struct ieee80211_conf *conf = &dev->conf; 1855 struct ieee80211_conf *conf = &dev->conf;
1830 1856
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index c44a200059d2..6a6a72f6f82c 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -56,6 +56,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
56 {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */ 56 {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */
57 {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */ 57 {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */
58 {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */ 58 {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */
59 {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */
59 {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ 60 {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */
60 {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ 61 {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */
61 {USB_DEVICE(0x0846, 0x4240)}, /* Netgear WG111 (v2) */ 62 {USB_DEVICE(0x0846, 0x4240)}, /* Netgear WG111 (v2) */
@@ -284,6 +285,7 @@ static void p54u_tx_lm87(struct ieee80211_hw *dev, struct sk_buff *skb)
284 usb_fill_bulk_urb(data_urb, priv->udev, 285 usb_fill_bulk_urb(data_urb, priv->udev,
285 usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), 286 usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA),
286 skb->data, skb->len, p54u_tx_cb, skb); 287 skb->data, skb->len, p54u_tx_cb, skb);
288 data_urb->transfer_flags |= URB_ZERO_PACKET;
287 289
288 usb_anchor_urb(data_urb, &priv->submitted); 290 usb_anchor_urb(data_urb, &priv->submitted);
289 if (usb_submit_urb(data_urb, GFP_ATOMIC)) { 291 if (usb_submit_urb(data_urb, GFP_ATOMIC)) {
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 30028e2422fc..af6b5847be5c 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -38,7 +38,7 @@
38/* 38/*
39 * Allow hardware encryption to be disabled. 39 * Allow hardware encryption to be disabled.
40 */ 40 */
41static int modparam_nohwcrypt = 1; 41static int modparam_nohwcrypt = 0;
42module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); 42module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);
43MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); 43MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
44 44
@@ -376,11 +376,11 @@ static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev,
376 376
377 /* 377 /*
378 * The driver does not support the IV/EIV generation 378 * The driver does not support the IV/EIV generation
379 * in hardware. However it doesn't support the IV/EIV 379 * in hardware. However it demands the data to be provided
380 * inside the ieee80211 frame either, but requires it 380 * both seperately as well as inside the frame.
381 * to be provided seperately for the descriptor. 381 * We already provided the CONFIG_CRYPTO_COPY_IV to rt2x00lib
382 * rt2x00lib will cut the IV/EIV data out of all frames 382 * to ensure rt2x00lib will not strip the data from the
383 * given to us by mac80211, but we must tell mac80211 383 * frame after the copy, now we must tell mac80211
384 * to generate the IV/EIV data. 384 * to generate the IV/EIV data.
385 */ 385 */
386 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 386 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
@@ -1181,7 +1181,7 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1181 test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)); 1181 test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags));
1182 rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs); 1182 rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs);
1183 rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, skb->len); 1183 rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, skb->len);
1184 rt2x00_set_field32(&word, TXD_W0_CIPHER, txdesc->cipher); 1184 rt2x00_set_field32(&word, TXD_W0_CIPHER, !!txdesc->cipher);
1185 rt2x00_set_field32(&word, TXD_W0_KEY_ID, txdesc->key_idx); 1185 rt2x00_set_field32(&word, TXD_W0_KEY_ID, txdesc->key_idx);
1186 rt2x00_desc_write(txd, 0, word); 1186 rt2x00_desc_write(txd, 0, word);
1187} 1187}
@@ -1334,14 +1334,7 @@ static void rt2500usb_fill_rxdone(struct queue_entry *entry,
1334 1334
1335 /* ICV is located at the end of frame */ 1335 /* ICV is located at the end of frame */
1336 1336
1337 /* 1337 rxdesc->flags |= RX_FLAG_MMIC_STRIPPED;
1338 * Hardware has stripped IV/EIV data from 802.11 frame during
1339 * decryption. It has provided the data seperately but rt2x00lib
1340 * should decide if it should be reinserted.
1341 */
1342 rxdesc->flags |= RX_FLAG_IV_STRIPPED;
1343 if (rxdesc->cipher != CIPHER_TKIP)
1344 rxdesc->flags |= RX_FLAG_MMIC_STRIPPED;
1345 if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) 1338 if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS)
1346 rxdesc->flags |= RX_FLAG_DECRYPTED; 1339 rxdesc->flags |= RX_FLAG_DECRYPTED;
1347 else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) 1340 else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC)
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 6d92542fcf0d..87c0f2c83077 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -807,13 +807,11 @@ static void rt2x00lib_rate(struct ieee80211_rate *entry,
807{ 807{
808 entry->flags = 0; 808 entry->flags = 0;
809 entry->bitrate = rate->bitrate; 809 entry->bitrate = rate->bitrate;
810 entry->hw_value = rt2x00_create_rate_hw_value(index, 0); 810 entry->hw_value =index;
811 entry->hw_value_short = entry->hw_value; 811 entry->hw_value_short = index;
812 812
813 if (rate->flags & DEV_RATE_SHORT_PREAMBLE) { 813 if (rate->flags & DEV_RATE_SHORT_PREAMBLE)
814 entry->flags |= IEEE80211_RATE_SHORT_PREAMBLE; 814 entry->flags |= IEEE80211_RATE_SHORT_PREAMBLE;
815 entry->hw_value_short |= rt2x00_create_rate_hw_value(index, 1);
816 }
817} 815}
818 816
819static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev, 817static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev,
diff --git a/drivers/net/wireless/rt2x00/rt2x00leds.c b/drivers/net/wireless/rt2x00/rt2x00leds.c
index 68f4e0fc35b9..a0cd35b6beb5 100644
--- a/drivers/net/wireless/rt2x00/rt2x00leds.c
+++ b/drivers/net/wireless/rt2x00/rt2x00leds.c
@@ -97,7 +97,7 @@ void rt2x00leds_led_assoc(struct rt2x00_dev *rt2x00dev, bool enabled)
97 97
98void rt2x00leds_led_radio(struct rt2x00_dev *rt2x00dev, bool enabled) 98void rt2x00leds_led_radio(struct rt2x00_dev *rt2x00dev, bool enabled)
99{ 99{
100 if (rt2x00dev->led_radio.type == LED_TYPE_ASSOC) 100 if (rt2x00dev->led_radio.type == LED_TYPE_RADIO)
101 rt2x00led_led_simple(&rt2x00dev->led_radio, enabled); 101 rt2x00led_led_simple(&rt2x00dev->led_radio, enabled);
102} 102}
103 103
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
index 03024327767b..86cd26fbf769 100644
--- a/drivers/net/wireless/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
@@ -52,22 +52,11 @@ struct rt2x00_rate {
52 52
53extern const struct rt2x00_rate rt2x00_supported_rates[12]; 53extern const struct rt2x00_rate rt2x00_supported_rates[12];
54 54
55static inline u16 rt2x00_create_rate_hw_value(const u16 index,
56 const u16 short_preamble)
57{
58 return (short_preamble << 8) | (index & 0xff);
59}
60
61static inline const struct rt2x00_rate *rt2x00_get_rate(const u16 hw_value) 55static inline const struct rt2x00_rate *rt2x00_get_rate(const u16 hw_value)
62{ 56{
63 return &rt2x00_supported_rates[hw_value & 0xff]; 57 return &rt2x00_supported_rates[hw_value & 0xff];
64} 58}
65 59
66static inline int rt2x00_get_rate_preamble(const u16 hw_value)
67{
68 return (hw_value & 0xff00);
69}
70
71/* 60/*
72 * Radio control handlers. 61 * Radio control handlers.
73 */ 62 */
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index eaec6bd93ed5..746a8f36b931 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -313,7 +313,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
313 * When preamble is enabled we should set the 313 * When preamble is enabled we should set the
314 * preamble bit for the signal. 314 * preamble bit for the signal.
315 */ 315 */
316 if (rt2x00_get_rate_preamble(rate->hw_value)) 316 if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
317 txdesc->signal |= 0x08; 317 txdesc->signal |= 0x08;
318 } 318 }
319} 319}
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 83df312ac56f..0b29d767a258 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -434,11 +434,11 @@ static int rt2x00usb_find_endpoints(struct rt2x00_dev *rt2x00dev)
434 434
435 if (usb_endpoint_is_bulk_in(ep_desc)) { 435 if (usb_endpoint_is_bulk_in(ep_desc)) {
436 rt2x00usb_assign_endpoint(rt2x00dev->rx, ep_desc); 436 rt2x00usb_assign_endpoint(rt2x00dev->rx, ep_desc);
437 } else if (usb_endpoint_is_bulk_out(ep_desc)) { 437 } else if (usb_endpoint_is_bulk_out(ep_desc) &&
438 (queue != queue_end(rt2x00dev))) {
438 rt2x00usb_assign_endpoint(queue, ep_desc); 439 rt2x00usb_assign_endpoint(queue, ep_desc);
440 queue = queue_next(queue);
439 441
440 if (queue != queue_end(rt2x00dev))
441 queue = queue_next(queue);
442 tx_ep_desc = ep_desc; 442 tx_ep_desc = ep_desc;
443 } 443 }
444 } 444 }
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index d638a8a59370..96a8d69f8790 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2321,6 +2321,7 @@ static struct usb_device_id rt73usb_device_table[] = {
2321 /* Linksys */ 2321 /* Linksys */
2322 { USB_DEVICE(0x13b1, 0x0020), USB_DEVICE_DATA(&rt73usb_ops) }, 2322 { USB_DEVICE(0x13b1, 0x0020), USB_DEVICE_DATA(&rt73usb_ops) },
2323 { USB_DEVICE(0x13b1, 0x0023), USB_DEVICE_DATA(&rt73usb_ops) }, 2323 { USB_DEVICE(0x13b1, 0x0023), USB_DEVICE_DATA(&rt73usb_ops) },
2324 { USB_DEVICE(0x13b1, 0x0028), USB_DEVICE_DATA(&rt73usb_ops) },
2324 /* MSI */ 2325 /* MSI */
2325 { USB_DEVICE(0x0db0, 0x6877), USB_DEVICE_DATA(&rt73usb_ops) }, 2326 { USB_DEVICE(0x0db0, 0x6877), USB_DEVICE_DATA(&rt73usb_ops) },
2326 { USB_DEVICE(0x0db0, 0x6874), USB_DEVICE_DATA(&rt73usb_ops) }, 2327 { USB_DEVICE(0x0db0, 0x6874), USB_DEVICE_DATA(&rt73usb_ops) },
diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c
index 5f887fb137a9..387c133ec0f2 100644
--- a/drivers/net/wireless/rtl818x/rtl8180_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c
@@ -897,6 +897,7 @@ static int __devinit rtl8180_probe(struct pci_dev *pdev,
897 dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | 897 dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
898 IEEE80211_HW_RX_INCLUDES_FCS | 898 IEEE80211_HW_RX_INCLUDES_FCS |
899 IEEE80211_HW_SIGNAL_UNSPEC; 899 IEEE80211_HW_SIGNAL_UNSPEC;
900 dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
900 dev->queues = 1; 901 dev->queues = 1;
901 dev->max_signal = 65; 902 dev->max_signal = 65;
902 903
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
index 00ce3ef39abe..6ad6bac37706 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -213,7 +213,7 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
213 urb = usb_alloc_urb(0, GFP_ATOMIC); 213 urb = usb_alloc_urb(0, GFP_ATOMIC);
214 if (!urb) { 214 if (!urb) {
215 kfree_skb(skb); 215 kfree_skb(skb);
216 return -ENOMEM; 216 return NETDEV_TX_OK;
217 } 217 }
218 218
219 flags = skb->len; 219 flags = skb->len;
@@ -281,7 +281,7 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
281 } 281 }
282 usb_free_urb(urb); 282 usb_free_urb(urb);
283 283
284 return rc; 284 return NETDEV_TX_OK;
285} 285}
286 286
287static void rtl8187_rx_cb(struct urb *urb) 287static void rtl8187_rx_cb(struct urb *urb)
@@ -1471,6 +1471,7 @@ static void __devexit rtl8187_disconnect(struct usb_interface *intf)
1471 ieee80211_unregister_hw(dev); 1471 ieee80211_unregister_hw(dev);
1472 1472
1473 priv = dev->priv; 1473 priv = dev->priv;
1474 usb_reset_device(priv->udev);
1474 usb_put_dev(interface_to_usbdev(intf)); 1475 usb_put_dev(interface_to_usbdev(intf));
1475 ieee80211_free_hw(dev); 1476 ieee80211_free_hw(dev);
1476} 1477}
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index cf9712922778..2f1645dcb8c8 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -362,6 +362,7 @@ static const struct net_device_ops netdev_ops = {
362 .ndo_set_multicast_list = set_rx_mode, 362 .ndo_set_multicast_list = set_rx_mode,
363 .ndo_change_mtu = eth_change_mtu, 363 .ndo_change_mtu = eth_change_mtu,
364 .ndo_validate_addr = eth_validate_addr, 364 .ndo_validate_addr = eth_validate_addr,
365 .ndo_set_mac_address = eth_mac_addr,
365 .ndo_do_ioctl = netdev_ioctl, 366 .ndo_do_ioctl = netdev_ioctl,
366 .ndo_tx_timeout = yellowfin_tx_timeout, 367 .ndo_tx_timeout = yellowfin_tx_timeout,
367}; 368};
diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c
index affd904deafc..37c84e3b8be0 100644
--- a/drivers/net/zorro8390.c
+++ b/drivers/net/zorro8390.c
@@ -147,6 +147,7 @@ static const struct net_device_ops zorro8390_netdev_ops = {
147 .ndo_get_stats = ei_get_stats, 147 .ndo_get_stats = ei_get_stats,
148 .ndo_set_multicast_list = ei_set_multicast_list, 148 .ndo_set_multicast_list = ei_set_multicast_list,
149 .ndo_validate_addr = eth_validate_addr, 149 .ndo_validate_addr = eth_validate_addr,
150 .ndo_set_mac_address = eth_mac_addr,
150 .ndo_change_mtu = eth_change_mtu, 151 .ndo_change_mtu = eth_change_mtu,
151#ifdef CONFIG_NET_POLL_CONTROLLER 152#ifdef CONFIG_NET_POLL_CONTROLLER
152 .ndo_poll_controller = ei_poll, 153 .ndo_poll_controller = ei_poll,