aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/3c501.c16
-rw-r--r--drivers/net/Kconfig18
-rw-r--r--drivers/net/ac3200.c7
-rw-r--r--drivers/net/apne.c7
-rw-r--r--drivers/net/appletalk/ltpc.c3
-rw-r--r--drivers/net/arcnet/capmode.c6
-rw-r--r--drivers/net/atl1/atl1_main.c3
-rw-r--r--drivers/net/cxgb3/sge.c12
-rw-r--r--drivers/net/enc28j60.c3
-rw-r--r--drivers/net/epic100.c47
-rw-r--r--drivers/net/fec.c8
-rw-r--r--drivers/net/forcedeth.c118
-rw-r--r--drivers/net/ibm_newemac/core.c7
-rw-r--r--drivers/net/ibm_newemac/tah.c4
-rw-r--r--drivers/net/igb/igb_main.c21
-rw-r--r--drivers/net/ioc3-eth.c3
-rw-r--r--drivers/net/ipg.c10
-rw-r--r--drivers/net/ne2k-pci.c8
-rw-r--r--drivers/net/pppol2tp.c69
-rw-r--r--drivers/net/ps3_gelic_wireless.c29
-rw-r--r--drivers/net/r6040.c10
-rw-r--r--drivers/net/tulip/de2104x.c10
-rw-r--r--drivers/net/ucc_geth.c6
-rw-r--r--drivers/net/usb/rndis_host.c12
-rw-r--r--drivers/net/virtio_net.c22
-rw-r--r--drivers/net/wan/farsync.c17
-rw-r--r--drivers/net/wan/sbni.c2
-rw-r--r--drivers/net/wireless/ath5k/hw.c2
-rw-r--r--drivers/net/wireless/b43/phy.c2
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c2
-rw-r--r--drivers/net/wireless/p54usb.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h3
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c39
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00lib.h20
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00rfkill.c116
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c5
37 files changed, 441 insertions, 231 deletions
diff --git a/drivers/net/3c501.c b/drivers/net/3c501.c
index 7d253686ed0d..5ba4bab6d43e 100644
--- a/drivers/net/3c501.c
+++ b/drivers/net/3c501.c
@@ -485,9 +485,7 @@ static int el_start_xmit(struct sk_buff *skb, struct net_device *dev)
485 printk(KERN_DEBUG "%s: burped during tx load.\n", 485 printk(KERN_DEBUG "%s: burped during tx load.\n",
486 dev->name); 486 dev->name);
487 spin_lock_irqsave(&lp->lock, flags); 487 spin_lock_irqsave(&lp->lock, flags);
488 } 488 } while (1);
489 while (1);
490
491} 489}
492 490
493/** 491/**
@@ -612,7 +610,8 @@ static irqreturn_t el_interrupt(int irq, void *dev_id)
612 dev->stats.tx_packets++; 610 dev->stats.tx_packets++;
613 if (el_debug > 6) 611 if (el_debug > 6)
614 printk(KERN_DEBUG " Tx succeeded %s\n", 612 printk(KERN_DEBUG " Tx succeeded %s\n",
615 (txsr & TX_RDY) ? "." : "but tx is busy!"); 613 (txsr & TX_RDY) ? "." :
614 "but tx is busy!");
616 /* 615 /*
617 * This is safe the interrupt is atomic WRT itself. 616 * This is safe the interrupt is atomic WRT itself.
618 */ 617 */
@@ -693,7 +692,8 @@ static void el_receive(struct net_device *dev)
693 692
694 if (pkt_len < 60 || pkt_len > 1536) { 693 if (pkt_len < 60 || pkt_len > 1536) {
695 if (el_debug) 694 if (el_debug)
696 printk(KERN_DEBUG "%s: bogus packet, length=%d\n", dev->name, pkt_len); 695 printk(KERN_DEBUG "%s: bogus packet, length=%d\n",
696 dev->name, pkt_len);
697 dev->stats.rx_over_errors++; 697 dev->stats.rx_over_errors++;
698 return; 698 return;
699 } 699 }
@@ -711,7 +711,8 @@ static void el_receive(struct net_device *dev)
711 711
712 outw(0x00, GP_LOW); 712 outw(0x00, GP_LOW);
713 if (skb == NULL) { 713 if (skb == NULL) {
714 printk(KERN_INFO "%s: Memory squeeze, dropping packet.\n", dev->name); 714 printk(KERN_INFO "%s: Memory squeeze, dropping packet.\n",
715 dev->name);
715 dev->stats.rx_dropped++; 716 dev->stats.rx_dropped++;
716 return; 717 return;
717 } else { 718 } else {
@@ -748,7 +749,8 @@ static void el_reset(struct net_device *dev)
748 if (el_debug > 2) 749 if (el_debug > 2)
749 printk(KERN_INFO "3c501 reset..."); 750 printk(KERN_INFO "3c501 reset...");
750 outb(AX_RESET, AX_CMD); /* Reset the chip */ 751 outb(AX_RESET, AX_CMD); /* Reset the chip */
751 outb(AX_LOOP, AX_CMD); /* Aux control, irq and loopback enabled */ 752 /* Aux control, irq and loopback enabled */
753 outb(AX_LOOP, AX_CMD);
752 { 754 {
753 int i; 755 int i;
754 for (i = 0; i < 6; i++) /* Set the station address. */ 756 for (i = 0; i < 6; i++) /* Set the station address. */
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index a64bb415f10c..fe7b5ec09708 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2366,15 +2366,15 @@ config GELIC_NET
2366 module will be called ps3_gelic. 2366 module will be called ps3_gelic.
2367 2367
2368config GELIC_WIRELESS 2368config GELIC_WIRELESS
2369 bool "PS3 Wireless support" 2369 bool "PS3 Wireless support"
2370 depends on GELIC_NET 2370 depends on GELIC_NET
2371 select WIRELESS_EXT 2371 select WIRELESS_EXT
2372 help 2372 help
2373 This option adds the support for the wireless feature of PS3. 2373 This option adds the support for the wireless feature of PS3.
2374 If you have the wireless-less model of PS3 or have no plan to 2374 If you have the wireless-less model of PS3 or have no plan to
2375 use wireless feature, disabling this option saves memory. As 2375 use wireless feature, disabling this option saves memory. As
2376 the driver automatically distinguishes the models, you can 2376 the driver automatically distinguishes the models, you can
2377 safely enable this option even if you have a wireless-less model. 2377 safely enable this option even if you have a wireless-less model.
2378 2378
2379config GIANFAR 2379config GIANFAR
2380 tristate "Gianfar Ethernet" 2380 tristate "Gianfar Ethernet"
diff --git a/drivers/net/ac3200.c b/drivers/net/ac3200.c
index 5136d94923aa..b1448637107f 100644
--- a/drivers/net/ac3200.c
+++ b/drivers/net/ac3200.c
@@ -369,7 +369,7 @@ MODULE_PARM_DESC(mem, "Memory base address(es)");
369MODULE_DESCRIPTION("Ansel AC3200 EISA ethernet driver"); 369MODULE_DESCRIPTION("Ansel AC3200 EISA ethernet driver");
370MODULE_LICENSE("GPL"); 370MODULE_LICENSE("GPL");
371 371
372int __init init_module(void) 372static int __init ac3200_module_init(void)
373{ 373{
374 struct net_device *dev; 374 struct net_device *dev;
375 int this_dev, found = 0; 375 int this_dev, found = 0;
@@ -404,8 +404,7 @@ static void cleanup_card(struct net_device *dev)
404 iounmap(ei_status.mem); 404 iounmap(ei_status.mem);
405} 405}
406 406
407void __exit 407static void __exit ac3200_module_exit(void)
408cleanup_module(void)
409{ 408{
410 int this_dev; 409 int this_dev;
411 410
@@ -418,4 +417,6 @@ cleanup_module(void)
418 } 417 }
419 } 418 }
420} 419}
420module_init(ac3200_module_init);
421module_exit(ac3200_module_exit);
421#endif /* MODULE */ 422#endif /* MODULE */
diff --git a/drivers/net/apne.c b/drivers/net/apne.c
index c12cbdf368b1..47a8275d3962 100644
--- a/drivers/net/apne.c
+++ b/drivers/net/apne.c
@@ -569,7 +569,7 @@ static irqreturn_t apne_interrupt(int irq, void *dev_id)
569#ifdef MODULE 569#ifdef MODULE
570static struct net_device *apne_dev; 570static struct net_device *apne_dev;
571 571
572int __init init_module(void) 572static int __init apne_module_init(void)
573{ 573{
574 apne_dev = apne_probe(-1); 574 apne_dev = apne_probe(-1);
575 if (IS_ERR(apne_dev)) 575 if (IS_ERR(apne_dev))
@@ -577,7 +577,7 @@ int __init init_module(void)
577 return 0; 577 return 0;
578} 578}
579 579
580void __exit cleanup_module(void) 580static void __exit apne_module_exit(void)
581{ 581{
582 unregister_netdev(apne_dev); 582 unregister_netdev(apne_dev);
583 583
@@ -591,7 +591,8 @@ void __exit cleanup_module(void)
591 591
592 free_netdev(apne_dev); 592 free_netdev(apne_dev);
593} 593}
594 594module_init(apne_module_init);
595module_exit(apne_module_exit);
595#endif 596#endif
596 597
597static int init_pcmcia(void) 598static int init_pcmcia(void)
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index 6ab2c2d4d673..fef5560bc7a2 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -1252,7 +1252,7 @@ module_param(irq, int, 0);
1252module_param(dma, int, 0); 1252module_param(dma, int, 0);
1253 1253
1254 1254
1255int __init init_module(void) 1255static int __init ltpc_module_init(void)
1256{ 1256{
1257 if(io == 0) 1257 if(io == 0)
1258 printk(KERN_NOTICE 1258 printk(KERN_NOTICE
@@ -1263,6 +1263,7 @@ int __init init_module(void)
1263 return PTR_ERR(dev_ltpc); 1263 return PTR_ERR(dev_ltpc);
1264 return 0; 1264 return 0;
1265} 1265}
1266module_init(ltpc_module_init);
1266#endif 1267#endif
1267 1268
1268static void __exit ltpc_cleanup(void) 1269static void __exit ltpc_cleanup(void)
diff --git a/drivers/net/arcnet/capmode.c b/drivers/net/arcnet/capmode.c
index cc4610db6395..02cb8f1c1148 100644
--- a/drivers/net/arcnet/capmode.c
+++ b/drivers/net/arcnet/capmode.c
@@ -80,17 +80,19 @@ void arcnet_cap_init(void)
80 80
81#ifdef MODULE 81#ifdef MODULE
82 82
83int __init init_module(void) 83static int __init capmode_module_init(void)
84{ 84{
85 printk(VERSION); 85 printk(VERSION);
86 arcnet_cap_init(); 86 arcnet_cap_init();
87 return 0; 87 return 0;
88} 88}
89 89
90void cleanup_module(void) 90static void __exit capmode_module_exit(void)
91{ 91{
92 arcnet_unregister_proto(&capmode_proto); 92 arcnet_unregister_proto(&capmode_proto);
93} 93}
94module_init(capmode_module_init);
95module_exit(capmode_module_exit);
94 96
95MODULE_LICENSE("GPL"); 97MODULE_LICENSE("GPL");
96#endif /* MODULE */ 98#endif /* MODULE */
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 9200ee59d854..129b8b3aa773 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -1765,15 +1765,12 @@ static irqreturn_t atl1_intr(int irq, void *data)
1765{ 1765{
1766 struct atl1_adapter *adapter = netdev_priv(data); 1766 struct atl1_adapter *adapter = netdev_priv(data);
1767 u32 status; 1767 u32 status;
1768 u8 update_rx;
1769 int max_ints = 10; 1768 int max_ints = 10;
1770 1769
1771 status = adapter->cmb.cmb->int_stats; 1770 status = adapter->cmb.cmb->int_stats;
1772 if (!status) 1771 if (!status)
1773 return IRQ_NONE; 1772 return IRQ_NONE;
1774 1773
1775 update_rx = 0;
1776
1777 do { 1774 do {
1778 /* clear CMB interrupt status at once */ 1775 /* clear CMB interrupt status at once */
1779 adapter->cmb.cmb->int_stats = 0; 1776 adapter->cmb.cmb->int_stats = 0;
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 979f3fc5e765..db586870c5f4 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1107,9 +1107,15 @@ int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev)
1107 } 1107 }
1108 1108
1109 q->in_use += ndesc; 1109 q->in_use += ndesc;
1110 if (unlikely(credits - ndesc < q->stop_thres)) 1110 if (unlikely(credits - ndesc < q->stop_thres)) {
1111 if (USE_GTS || !should_restart_tx(q)) 1111 t3_stop_queue(dev, qs, q);
1112 t3_stop_queue(dev, qs, q); 1112
1113 if (should_restart_tx(q) &&
1114 test_and_clear_bit(TXQ_ETH, &qs->txq_stopped)) {
1115 q->restarts++;
1116 netif_wake_queue(dev);
1117 }
1118 }
1113 1119
1114 gen = q->gen; 1120 gen = q->gen;
1115 q->unacked += ndesc; 1121 q->unacked += ndesc;
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index 0809a6a5a286..46a90e9ec563 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -900,7 +900,7 @@ static void enc28j60_hw_rx(struct net_device *ndev)
900 if (RSV_GETBIT(rxstat, RSV_LENCHECKERR)) 900 if (RSV_GETBIT(rxstat, RSV_LENCHECKERR))
901 ndev->stats.rx_frame_errors++; 901 ndev->stats.rx_frame_errors++;
902 } else { 902 } else {
903 skb = dev_alloc_skb(len); 903 skb = dev_alloc_skb(len + NET_IP_ALIGN);
904 if (!skb) { 904 if (!skb) {
905 if (netif_msg_rx_err(priv)) 905 if (netif_msg_rx_err(priv))
906 dev_err(&ndev->dev, 906 dev_err(&ndev->dev,
@@ -908,6 +908,7 @@ static void enc28j60_hw_rx(struct net_device *ndev)
908 ndev->stats.rx_dropped++; 908 ndev->stats.rx_dropped++;
909 } else { 909 } else {
910 skb->dev = ndev; 910 skb->dev = ndev;
911 skb_reserve(skb, NET_IP_ALIGN);
911 /* copy the packet from the receive buffer */ 912 /* copy the packet from the receive buffer */
912 enc28j60_mem_read(priv, priv->next_pk_ptr + sizeof(rsv), 913 enc28j60_mem_read(priv, priv->next_pk_ptr + sizeof(rsv),
913 len, skb_put(skb, len)); 914 len, skb_put(skb, len));
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index 0b365b8d947b..76118ddd1042 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -131,8 +131,8 @@ IIIa. Ring buffers
131 131
132IVb. References 132IVb. References
133 133
134http://www.smsc.com/main/datasheets/83c171.pdf 134http://www.smsc.com/main/tools/discontinued/83c171.pdf
135http://www.smsc.com/main/datasheets/83c175.pdf 135http://www.smsc.com/main/tools/discontinued/83c175.pdf
136http://scyld.com/expert/NWay.html 136http://scyld.com/expert/NWay.html
137http://www.national.com/pf/DP/DP83840A.html 137http://www.national.com/pf/DP/DP83840A.html
138 138
@@ -227,7 +227,12 @@ static const u16 media2miictl[16] = {
227 0, 0x0C00, 0x0C00, 0x2000, 0x0100, 0x2100, 0, 0, 227 0, 0x0C00, 0x0C00, 0x2000, 0x0100, 0x2100, 0, 0,
228 0, 0, 0, 0, 0, 0, 0, 0 }; 228 0, 0, 0, 0, 0, 0, 0, 0 };
229 229
230/* The EPIC100 Rx and Tx buffer descriptors. */ 230/*
231 * The EPIC100 Rx and Tx buffer descriptors. Note that these
232 * really ARE host-endian; it's not a misannotation. We tell
233 * the card to byteswap them internally on big-endian hosts -
234 * look for #ifdef CONFIG_BIG_ENDIAN in epic_open().
235 */
231 236
232struct epic_tx_desc { 237struct epic_tx_desc {
233 u32 txstatus; 238 u32 txstatus;
@@ -418,7 +423,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev,
418 423
419 /* Note: the '175 does not have a serial EEPROM. */ 424 /* Note: the '175 does not have a serial EEPROM. */
420 for (i = 0; i < 3; i++) 425 for (i = 0; i < 3; i++)
421 ((u16 *)dev->dev_addr)[i] = le16_to_cpu(inw(ioaddr + LAN0 + i*4)); 426 ((__le16 *)dev->dev_addr)[i] = cpu_to_le16(inw(ioaddr + LAN0 + i*4));
422 427
423 if (debug > 2) { 428 if (debug > 2) {
424 dev_printk(KERN_DEBUG, &pdev->dev, "EEPROM contents:\n"); 429 dev_printk(KERN_DEBUG, &pdev->dev, "EEPROM contents:\n");
@@ -682,7 +687,8 @@ static int epic_open(struct net_device *dev)
682 if (ep->chip_flags & MII_PWRDWN) 687 if (ep->chip_flags & MII_PWRDWN)
683 outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL); 688 outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL);
684 689
685#if defined(__powerpc__) || defined(__sparc__) /* Big endian */ 690 /* Tell the chip to byteswap descriptors on big-endian hosts */
691#ifdef CONFIG_BIG_ENDIAN
686 outl(0x4432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); 692 outl(0x4432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL);
687 inl(ioaddr + GENCTL); 693 inl(ioaddr + GENCTL);
688 outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); 694 outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL);
@@ -695,7 +701,7 @@ static int epic_open(struct net_device *dev)
695 udelay(20); /* Looks like EPII needs that if you want reliable RX init. FIXME: pci posting bug? */ 701 udelay(20); /* Looks like EPII needs that if you want reliable RX init. FIXME: pci posting bug? */
696 702
697 for (i = 0; i < 3; i++) 703 for (i = 0; i < 3; i++)
698 outl(cpu_to_le16(((u16*)dev->dev_addr)[i]), ioaddr + LAN0 + i*4); 704 outl(le16_to_cpu(((__le16*)dev->dev_addr)[i]), ioaddr + LAN0 + i*4);
699 705
700 ep->tx_threshold = TX_FIFO_THRESH; 706 ep->tx_threshold = TX_FIFO_THRESH;
701 outl(ep->tx_threshold, ioaddr + TxThresh); 707 outl(ep->tx_threshold, ioaddr + TxThresh);
@@ -798,7 +804,7 @@ static void epic_restart(struct net_device *dev)
798 for (i = 16; i > 0; i--) 804 for (i = 16; i > 0; i--)
799 outl(0x0008, ioaddr + TEST1); 805 outl(0x0008, ioaddr + TEST1);
800 806
801#if defined(__powerpc__) || defined(__sparc__) /* Big endian */ 807#ifdef CONFIG_BIG_ENDIAN
802 outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); 808 outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL);
803#else 809#else
804 outl(0x0412 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); 810 outl(0x0412 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL);
@@ -808,7 +814,7 @@ static void epic_restart(struct net_device *dev)
808 outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL); 814 outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL);
809 815
810 for (i = 0; i < 3; i++) 816 for (i = 0; i < 3; i++)
811 outl(cpu_to_le16(((u16*)dev->dev_addr)[i]), ioaddr + LAN0 + i*4); 817 outl(le16_to_cpu(((__le16*)dev->dev_addr)[i]), ioaddr + LAN0 + i*4);
812 818
813 ep->tx_threshold = TX_FIFO_THRESH; 819 ep->tx_threshold = TX_FIFO_THRESH;
814 outl(ep->tx_threshold, ioaddr + TxThresh); 820 outl(ep->tx_threshold, ioaddr + TxThresh);
@@ -919,7 +925,7 @@ static void epic_init_ring(struct net_device *dev)
919 /* Initialize all Rx descriptors. */ 925 /* Initialize all Rx descriptors. */
920 for (i = 0; i < RX_RING_SIZE; i++) { 926 for (i = 0; i < RX_RING_SIZE; i++) {
921 ep->rx_ring[i].rxstatus = 0; 927 ep->rx_ring[i].rxstatus = 0;
922 ep->rx_ring[i].buflength = cpu_to_le32(ep->rx_buf_sz); 928 ep->rx_ring[i].buflength = ep->rx_buf_sz;
923 ep->rx_ring[i].next = ep->rx_ring_dma + 929 ep->rx_ring[i].next = ep->rx_ring_dma +
924 (i+1)*sizeof(struct epic_rx_desc); 930 (i+1)*sizeof(struct epic_rx_desc);
925 ep->rx_skbuff[i] = NULL; 931 ep->rx_skbuff[i] = NULL;
@@ -936,7 +942,7 @@ static void epic_init_ring(struct net_device *dev)
936 skb_reserve(skb, 2); /* 16 byte align the IP header. */ 942 skb_reserve(skb, 2); /* 16 byte align the IP header. */
937 ep->rx_ring[i].bufaddr = pci_map_single(ep->pci_dev, 943 ep->rx_ring[i].bufaddr = pci_map_single(ep->pci_dev,
938 skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); 944 skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE);
939 ep->rx_ring[i].rxstatus = cpu_to_le32(DescOwn); 945 ep->rx_ring[i].rxstatus = DescOwn;
940 } 946 }
941 ep->dirty_rx = (unsigned int)(i - RX_RING_SIZE); 947 ep->dirty_rx = (unsigned int)(i - RX_RING_SIZE);
942 948
@@ -974,20 +980,20 @@ static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev)
974 ep->tx_ring[entry].bufaddr = pci_map_single(ep->pci_dev, skb->data, 980 ep->tx_ring[entry].bufaddr = pci_map_single(ep->pci_dev, skb->data,
975 skb->len, PCI_DMA_TODEVICE); 981 skb->len, PCI_DMA_TODEVICE);
976 if (free_count < TX_QUEUE_LEN/2) {/* Typical path */ 982 if (free_count < TX_QUEUE_LEN/2) {/* Typical path */
977 ctrl_word = cpu_to_le32(0x100000); /* No interrupt */ 983 ctrl_word = 0x100000; /* No interrupt */
978 } else if (free_count == TX_QUEUE_LEN/2) { 984 } else if (free_count == TX_QUEUE_LEN/2) {
979 ctrl_word = cpu_to_le32(0x140000); /* Tx-done intr. */ 985 ctrl_word = 0x140000; /* Tx-done intr. */
980 } else if (free_count < TX_QUEUE_LEN - 1) { 986 } else if (free_count < TX_QUEUE_LEN - 1) {
981 ctrl_word = cpu_to_le32(0x100000); /* No Tx-done intr. */ 987 ctrl_word = 0x100000; /* No Tx-done intr. */
982 } else { 988 } else {
983 /* Leave room for an additional entry. */ 989 /* Leave room for an additional entry. */
984 ctrl_word = cpu_to_le32(0x140000); /* Tx-done intr. */ 990 ctrl_word = 0x140000; /* Tx-done intr. */
985 ep->tx_full = 1; 991 ep->tx_full = 1;
986 } 992 }
987 ep->tx_ring[entry].buflength = ctrl_word | cpu_to_le32(skb->len); 993 ep->tx_ring[entry].buflength = ctrl_word | skb->len;
988 ep->tx_ring[entry].txstatus = 994 ep->tx_ring[entry].txstatus =
989 ((skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN) << 16) 995 ((skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN) << 16)
990 | cpu_to_le32(DescOwn); 996 | DescOwn;
991 997
992 ep->cur_tx++; 998 ep->cur_tx++;
993 if (ep->tx_full) 999 if (ep->tx_full)
@@ -1041,7 +1047,7 @@ static void epic_tx(struct net_device *dev, struct epic_private *ep)
1041 for (dirty_tx = ep->dirty_tx; cur_tx - dirty_tx > 0; dirty_tx++) { 1047 for (dirty_tx = ep->dirty_tx; cur_tx - dirty_tx > 0; dirty_tx++) {
1042 struct sk_buff *skb; 1048 struct sk_buff *skb;
1043 int entry = dirty_tx % TX_RING_SIZE; 1049 int entry = dirty_tx % TX_RING_SIZE;
1044 int txstatus = le32_to_cpu(ep->tx_ring[entry].txstatus); 1050 int txstatus = ep->tx_ring[entry].txstatus;
1045 1051
1046 if (txstatus & DescOwn) 1052 if (txstatus & DescOwn)
1047 break; /* It still hasn't been Txed */ 1053 break; /* It still hasn't been Txed */
@@ -1163,8 +1169,8 @@ static int epic_rx(struct net_device *dev, int budget)
1163 rx_work_limit = budget; 1169 rx_work_limit = budget;
1164 1170
1165 /* If we own the next entry, it's a new packet. Send it up. */ 1171 /* If we own the next entry, it's a new packet. Send it up. */
1166 while ((ep->rx_ring[entry].rxstatus & cpu_to_le32(DescOwn)) == 0) { 1172 while ((ep->rx_ring[entry].rxstatus & DescOwn) == 0) {
1167 int status = le32_to_cpu(ep->rx_ring[entry].rxstatus); 1173 int status = ep->rx_ring[entry].rxstatus;
1168 1174
1169 if (debug > 4) 1175 if (debug > 4)
1170 printk(KERN_DEBUG " epic_rx() status was %8.8x.\n", status); 1176 printk(KERN_DEBUG " epic_rx() status was %8.8x.\n", status);
@@ -1238,7 +1244,8 @@ static int epic_rx(struct net_device *dev, int budget)
1238 skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); 1244 skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE);
1239 work_done++; 1245 work_done++;
1240 } 1246 }
1241 ep->rx_ring[entry].rxstatus = cpu_to_le32(DescOwn); 1247 /* AV: shouldn't we add a barrier here? */
1248 ep->rx_ring[entry].rxstatus = DescOwn;
1242 } 1249 }
1243 return work_done; 1250 return work_done;
1244} 1251}
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 0fbf1bbbaee9..d7a3ea88eddb 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -1253,7 +1253,7 @@ static void __inline__ fec_request_intrs(struct net_device *dev)
1253 1253
1254 /* Setup interrupt handlers. */ 1254 /* Setup interrupt handlers. */
1255 for (idp = id; idp->name; idp++) { 1255 for (idp = id; idp->name; idp++) {
1256 if (request_irq(idp->irq, idp->handler, 0, idp->name, dev) != 0) 1256 if (request_irq(idp->irq, idp->handler, IRQF_DISABLED, idp->name, dev) != 0)
1257 printk("FEC: Could not allocate %s IRQ(%d)!\n", idp->name, idp->irq); 1257 printk("FEC: Could not allocate %s IRQ(%d)!\n", idp->name, idp->irq);
1258 } 1258 }
1259 1259
@@ -1382,7 +1382,7 @@ static void __inline__ fec_request_intrs(struct net_device *dev)
1382 1382
1383 /* Setup interrupt handlers. */ 1383 /* Setup interrupt handlers. */
1384 for (idp = id; idp->name; idp++) { 1384 for (idp = id; idp->name; idp++) {
1385 if (request_irq(b+idp->irq, fec_enet_interrupt, 0, idp->name, dev) != 0) 1385 if (request_irq(b+idp->irq, fec_enet_interrupt, IRQF_DISABLED, idp->name, dev) != 0)
1386 printk("FEC: Could not allocate %s IRQ(%d)!\n", idp->name, b+idp->irq); 1386 printk("FEC: Could not allocate %s IRQ(%d)!\n", idp->name, b+idp->irq);
1387 } 1387 }
1388 1388
@@ -1553,7 +1553,7 @@ static void __inline__ fec_request_intrs(struct net_device *dev)
1553 1553
1554 /* Setup interrupt handlers. */ 1554 /* Setup interrupt handlers. */
1555 for (idp = id; idp->name; idp++) { 1555 for (idp = id; idp->name; idp++) {
1556 if (request_irq(b+idp->irq,fec_enet_interrupt,0,idp->name,dev)!=0) 1556 if (request_irq(b+idp->irq, fec_enet_interrupt, IRQF_DISABLED, idp->name,dev) != 0)
1557 printk("FEC: Could not allocate %s IRQ(%d)!\n", idp->name, b+idp->irq); 1557 printk("FEC: Could not allocate %s IRQ(%d)!\n", idp->name, b+idp->irq);
1558 } 1558 }
1559 1559
@@ -1680,7 +1680,7 @@ static void __inline__ fec_request_intrs(struct net_device *dev)
1680 1680
1681 /* Setup interrupt handlers. */ 1681 /* Setup interrupt handlers. */
1682 for (idp = id; idp->name; idp++) { 1682 for (idp = id; idp->name; idp++) {
1683 if (request_irq(b+idp->irq,fec_enet_interrupt,0,idp->name,dev)!=0) 1683 if (request_irq(b+idp->irq, fec_enet_interrupt, IRQF_DISABLED, idp->name,dev) != 0)
1684 printk("FEC: Could not allocate %s IRQ(%d)!\n", 1684 printk("FEC: Could not allocate %s IRQ(%d)!\n",
1685 idp->name, b+idp->irq); 1685 idp->name, b+idp->irq);
1686 } 1686 }
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 801b4d9cd972..6f7e3fde9e7c 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -184,6 +184,7 @@
184#define DEV_HAS_PAUSEFRAME_TX_V1 0x08000 /* device supports tx pause frames version 1 */ 184#define DEV_HAS_PAUSEFRAME_TX_V1 0x08000 /* device supports tx pause frames version 1 */
185#define DEV_HAS_PAUSEFRAME_TX_V2 0x10000 /* device supports tx pause frames version 2 */ 185#define DEV_HAS_PAUSEFRAME_TX_V2 0x10000 /* device supports tx pause frames version 2 */
186#define DEV_HAS_PAUSEFRAME_TX_V3 0x20000 /* device supports tx pause frames version 3 */ 186#define DEV_HAS_PAUSEFRAME_TX_V3 0x20000 /* device supports tx pause frames version 3 */
187#define DEV_NEED_TX_LIMIT 0x40000 /* device needs to limit tx */
187 188
188enum { 189enum {
189 NvRegIrqStatus = 0x000, 190 NvRegIrqStatus = 0x000,
@@ -635,6 +636,8 @@ union ring_type {
635#define NV_RESTART_TX 0x1 636#define NV_RESTART_TX 0x1
636#define NV_RESTART_RX 0x2 637#define NV_RESTART_RX 0x2
637 638
639#define NV_TX_LIMIT_COUNT 16
640
638/* statistics */ 641/* statistics */
639struct nv_ethtool_str { 642struct nv_ethtool_str {
640 char name[ETH_GSTRING_LEN]; 643 char name[ETH_GSTRING_LEN];
@@ -743,6 +746,8 @@ struct nv_skb_map {
743 struct sk_buff *skb; 746 struct sk_buff *skb;
744 dma_addr_t dma; 747 dma_addr_t dma;
745 unsigned int dma_len; 748 unsigned int dma_len;
749 struct ring_desc_ex *first_tx_desc;
750 struct nv_skb_map *next_tx_ctx;
746}; 751};
747 752
748/* 753/*
@@ -827,6 +832,10 @@ struct fe_priv {
827 union ring_type tx_ring; 832 union ring_type tx_ring;
828 u32 tx_flags; 833 u32 tx_flags;
829 int tx_ring_size; 834 int tx_ring_size;
835 int tx_limit;
836 u32 tx_pkts_in_progress;
837 struct nv_skb_map *tx_change_owner;
838 struct nv_skb_map *tx_end_flip;
830 int tx_stop; 839 int tx_stop;
831 840
832 /* vlan fields */ 841 /* vlan fields */
@@ -1707,6 +1716,9 @@ static void nv_init_tx(struct net_device *dev)
1707 np->last_tx.ex = &np->tx_ring.ex[np->tx_ring_size-1]; 1716 np->last_tx.ex = &np->tx_ring.ex[np->tx_ring_size-1];
1708 np->get_tx_ctx = np->put_tx_ctx = np->first_tx_ctx = np->tx_skb; 1717 np->get_tx_ctx = np->put_tx_ctx = np->first_tx_ctx = np->tx_skb;
1709 np->last_tx_ctx = &np->tx_skb[np->tx_ring_size-1]; 1718 np->last_tx_ctx = &np->tx_skb[np->tx_ring_size-1];
1719 np->tx_pkts_in_progress = 0;
1720 np->tx_change_owner = NULL;
1721 np->tx_end_flip = NULL;
1710 1722
1711 for (i = 0; i < np->tx_ring_size; i++) { 1723 for (i = 0; i < np->tx_ring_size; i++) {
1712 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { 1724 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) {
@@ -1720,6 +1732,9 @@ static void nv_init_tx(struct net_device *dev)
1720 } 1732 }
1721 np->tx_skb[i].skb = NULL; 1733 np->tx_skb[i].skb = NULL;
1722 np->tx_skb[i].dma = 0; 1734 np->tx_skb[i].dma = 0;
1735 np->tx_skb[i].dma_len = 0;
1736 np->tx_skb[i].first_tx_desc = NULL;
1737 np->tx_skb[i].next_tx_ctx = NULL;
1723 } 1738 }
1724} 1739}
1725 1740
@@ -1771,7 +1786,14 @@ static void nv_drain_tx(struct net_device *dev)
1771 } 1786 }
1772 if (nv_release_txskb(dev, &np->tx_skb[i])) 1787 if (nv_release_txskb(dev, &np->tx_skb[i]))
1773 dev->stats.tx_dropped++; 1788 dev->stats.tx_dropped++;
1789 np->tx_skb[i].dma = 0;
1790 np->tx_skb[i].dma_len = 0;
1791 np->tx_skb[i].first_tx_desc = NULL;
1792 np->tx_skb[i].next_tx_ctx = NULL;
1774 } 1793 }
1794 np->tx_pkts_in_progress = 0;
1795 np->tx_change_owner = NULL;
1796 np->tx_end_flip = NULL;
1775} 1797}
1776 1798
1777static void nv_drain_rx(struct net_device *dev) 1799static void nv_drain_rx(struct net_device *dev)
@@ -1948,6 +1970,7 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev)
1948 struct ring_desc_ex* start_tx; 1970 struct ring_desc_ex* start_tx;
1949 struct ring_desc_ex* prev_tx; 1971 struct ring_desc_ex* prev_tx;
1950 struct nv_skb_map* prev_tx_ctx; 1972 struct nv_skb_map* prev_tx_ctx;
1973 struct nv_skb_map* start_tx_ctx;
1951 1974
1952 /* add fragments to entries count */ 1975 /* add fragments to entries count */
1953 for (i = 0; i < fragments; i++) { 1976 for (i = 0; i < fragments; i++) {
@@ -1965,6 +1988,7 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev)
1965 } 1988 }
1966 1989
1967 start_tx = put_tx = np->put_tx.ex; 1990 start_tx = put_tx = np->put_tx.ex;
1991 start_tx_ctx = np->put_tx_ctx;
1968 1992
1969 /* setup the header buffer */ 1993 /* setup the header buffer */
1970 do { 1994 do {
@@ -2037,6 +2061,26 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev)
2037 2061
2038 spin_lock_irq(&np->lock); 2062 spin_lock_irq(&np->lock);
2039 2063
2064 if (np->tx_limit) {
2065 /* Limit the number of outstanding tx. Setup all fragments, but
2066 * do not set the VALID bit on the first descriptor. Save a pointer
2067 * to that descriptor and also for next skb_map element.
2068 */
2069
2070 if (np->tx_pkts_in_progress == NV_TX_LIMIT_COUNT) {
2071 if (!np->tx_change_owner)
2072 np->tx_change_owner = start_tx_ctx;
2073
2074 /* remove VALID bit */
2075 tx_flags &= ~NV_TX2_VALID;
2076 start_tx_ctx->first_tx_desc = start_tx;
2077 start_tx_ctx->next_tx_ctx = np->put_tx_ctx;
2078 np->tx_end_flip = np->put_tx_ctx;
2079 } else {
2080 np->tx_pkts_in_progress++;
2081 }
2082 }
2083
2040 /* set tx flags */ 2084 /* set tx flags */
2041 start_tx->flaglen |= cpu_to_le32(tx_flags | tx_flags_extra); 2085 start_tx->flaglen |= cpu_to_le32(tx_flags | tx_flags_extra);
2042 np->put_tx.ex = put_tx; 2086 np->put_tx.ex = put_tx;
@@ -2060,6 +2104,25 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev)
2060 return NETDEV_TX_OK; 2104 return NETDEV_TX_OK;
2061} 2105}
2062 2106
2107static inline void nv_tx_flip_ownership(struct net_device *dev)
2108{
2109 struct fe_priv *np = netdev_priv(dev);
2110
2111 np->tx_pkts_in_progress--;
2112 if (np->tx_change_owner) {
2113 __le32 flaglen = le32_to_cpu(np->tx_change_owner->first_tx_desc->flaglen);
2114 flaglen |= NV_TX2_VALID;
2115 np->tx_change_owner->first_tx_desc->flaglen = cpu_to_le32(flaglen);
2116 np->tx_pkts_in_progress++;
2117
2118 np->tx_change_owner = np->tx_change_owner->next_tx_ctx;
2119 if (np->tx_change_owner == np->tx_end_flip)
2120 np->tx_change_owner = NULL;
2121
2122 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
2123 }
2124}
2125
2063/* 2126/*
2064 * nv_tx_done: check for completed packets, release the skbs. 2127 * nv_tx_done: check for completed packets, release the skbs.
2065 * 2128 *
@@ -2147,6 +2210,10 @@ static void nv_tx_done_optimized(struct net_device *dev, int limit)
2147 dev->stats.tx_packets++; 2210 dev->stats.tx_packets++;
2148 dev_kfree_skb_any(np->get_tx_ctx->skb); 2211 dev_kfree_skb_any(np->get_tx_ctx->skb);
2149 np->get_tx_ctx->skb = NULL; 2212 np->get_tx_ctx->skb = NULL;
2213
2214 if (np->tx_limit) {
2215 nv_tx_flip_ownership(dev);
2216 }
2150 } 2217 }
2151 if (unlikely(np->get_tx.ex++ == np->last_tx.ex)) 2218 if (unlikely(np->get_tx.ex++ == np->last_tx.ex))
2152 np->get_tx.ex = np->first_tx.ex; 2219 np->get_tx.ex = np->first_tx.ex;
@@ -5333,6 +5400,21 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
5333 np->need_linktimer = 0; 5400 np->need_linktimer = 0;
5334 } 5401 }
5335 5402
5403 /* Limit the number of tx's outstanding for hw bug */
5404 if (id->driver_data & DEV_NEED_TX_LIMIT) {
5405 np->tx_limit = 1;
5406 if ((id->device == PCI_DEVICE_ID_NVIDIA_NVENET_32 ||
5407 id->device == PCI_DEVICE_ID_NVIDIA_NVENET_33 ||
5408 id->device == PCI_DEVICE_ID_NVIDIA_NVENET_34 ||
5409 id->device == PCI_DEVICE_ID_NVIDIA_NVENET_35 ||
5410 id->device == PCI_DEVICE_ID_NVIDIA_NVENET_36 ||
5411 id->device == PCI_DEVICE_ID_NVIDIA_NVENET_37 ||
5412 id->device == PCI_DEVICE_ID_NVIDIA_NVENET_38 ||
5413 id->device == PCI_DEVICE_ID_NVIDIA_NVENET_39) &&
5414 pci_dev->revision >= 0xA2)
5415 np->tx_limit = 0;
5416 }
5417
5336 /* clear phy state and temporarily halt phy interrupts */ 5418 /* clear phy state and temporarily halt phy interrupts */
5337 writel(0, base + NvRegMIIMask); 5419 writel(0, base + NvRegMIIMask);
5338 phystate = readl(base + NvRegAdapterControl); 5420 phystate = readl(base + NvRegAdapterControl);
@@ -5563,19 +5645,19 @@ static struct pci_device_id pci_tbl[] = {
5563 }, 5645 },
5564 { /* CK804 Ethernet Controller */ 5646 { /* CK804 Ethernet Controller */
5565 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_8), 5647 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_8),
5566 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1, 5648 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT,
5567 }, 5649 },
5568 { /* CK804 Ethernet Controller */ 5650 { /* CK804 Ethernet Controller */
5569 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_9), 5651 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_9),
5570 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1, 5652 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT,
5571 }, 5653 },
5572 { /* MCP04 Ethernet Controller */ 5654 { /* MCP04 Ethernet Controller */
5573 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_10), 5655 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_10),
5574 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1, 5656 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT,
5575 }, 5657 },
5576 { /* MCP04 Ethernet Controller */ 5658 { /* MCP04 Ethernet Controller */
5577 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_11), 5659 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_11),
5578 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1, 5660 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT,
5579 }, 5661 },
5580 { /* MCP51 Ethernet Controller */ 5662 { /* MCP51 Ethernet Controller */
5581 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_12), 5663 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_12),
@@ -5587,11 +5669,11 @@ static struct pci_device_id pci_tbl[] = {
5587 }, 5669 },
5588 { /* MCP55 Ethernet Controller */ 5670 { /* MCP55 Ethernet Controller */
5589 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14), 5671 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14),
5590 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, 5672 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_NEED_TX_LIMIT,
5591 }, 5673 },
5592 { /* MCP55 Ethernet Controller */ 5674 { /* MCP55 Ethernet Controller */
5593 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15), 5675 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15),
5594 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, 5676 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_NEED_TX_LIMIT,
5595 }, 5677 },
5596 { /* MCP61 Ethernet Controller */ 5678 { /* MCP61 Ethernet Controller */
5597 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_16), 5679 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_16),
@@ -5611,19 +5693,19 @@ static struct pci_device_id pci_tbl[] = {
5611 }, 5693 },
5612 { /* MCP65 Ethernet Controller */ 5694 { /* MCP65 Ethernet Controller */
5613 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_20), 5695 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_20),
5614 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, 5696 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_NEED_TX_LIMIT|DEV_NEED_TX_LIMIT,
5615 }, 5697 },
5616 { /* MCP65 Ethernet Controller */ 5698 { /* MCP65 Ethernet Controller */
5617 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_21), 5699 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_21),
5618 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, 5700 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_NEED_TX_LIMIT,
5619 }, 5701 },
5620 { /* MCP65 Ethernet Controller */ 5702 { /* MCP65 Ethernet Controller */
5621 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_22), 5703 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_22),
5622 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, 5704 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_NEED_TX_LIMIT,
5623 }, 5705 },
5624 { /* MCP65 Ethernet Controller */ 5706 { /* MCP65 Ethernet Controller */
5625 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_23), 5707 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_23),
5626 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, 5708 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_NEED_TX_LIMIT,
5627 }, 5709 },
5628 { /* MCP67 Ethernet Controller */ 5710 { /* MCP67 Ethernet Controller */
5629 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_24), 5711 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_24),
@@ -5659,35 +5741,35 @@ static struct pci_device_id pci_tbl[] = {
5659 }, 5741 },
5660 { /* MCP77 Ethernet Controller */ 5742 { /* MCP77 Ethernet Controller */
5661 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_32), 5743 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_32),
5662 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, 5744 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT,
5663 }, 5745 },
5664 { /* MCP77 Ethernet Controller */ 5746 { /* MCP77 Ethernet Controller */
5665 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_33), 5747 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_33),
5666 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, 5748 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT,
5667 }, 5749 },
5668 { /* MCP77 Ethernet Controller */ 5750 { /* MCP77 Ethernet Controller */
5669 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_34), 5751 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_34),
5670 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, 5752 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT,
5671 }, 5753 },
5672 { /* MCP77 Ethernet Controller */ 5754 { /* MCP77 Ethernet Controller */
5673 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35), 5755 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35),
5674 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, 5756 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT,
5675 }, 5757 },
5676 { /* MCP79 Ethernet Controller */ 5758 { /* MCP79 Ethernet Controller */
5677 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36), 5759 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36),
5678 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, 5760 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT,
5679 }, 5761 },
5680 { /* MCP79 Ethernet Controller */ 5762 { /* MCP79 Ethernet Controller */
5681 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37), 5763 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37),
5682 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, 5764 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT,
5683 }, 5765 },
5684 { /* MCP79 Ethernet Controller */ 5766 { /* MCP79 Ethernet Controller */
5685 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38), 5767 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38),
5686 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, 5768 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT,
5687 }, 5769 },
5688 { /* MCP79 Ethernet Controller */ 5770 { /* MCP79 Ethernet Controller */
5689 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39), 5771 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39),
5690 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, 5772 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT,
5691 }, 5773 },
5692 {0,}, 5774 {0,},
5693}; 5775};
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index e6c69f77259b..0789802d59ed 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -143,6 +143,10 @@ static inline void emac_report_timeout_error(struct emac_instance *dev,
143#define STOP_TIMEOUT_1000 13 143#define STOP_TIMEOUT_1000 13
144#define STOP_TIMEOUT_1000_JUMBO 73 144#define STOP_TIMEOUT_1000_JUMBO 73
145 145
146static unsigned char default_mcast_addr[] = {
147 0x01, 0x80, 0xC2, 0x00, 0x00, 0x01
148};
149
146/* Please, keep in sync with struct ibm_emac_stats/ibm_emac_error_stats */ 150/* Please, keep in sync with struct ibm_emac_stats/ibm_emac_error_stats */
147static const char emac_stats_keys[EMAC_ETHTOOL_STATS_COUNT][ETH_GSTRING_LEN] = { 151static const char emac_stats_keys[EMAC_ETHTOOL_STATS_COUNT][ETH_GSTRING_LEN] = {
148 "rx_packets", "rx_bytes", "tx_packets", "tx_bytes", "rx_packets_csum", 152 "rx_packets", "rx_bytes", "tx_packets", "tx_bytes", "rx_packets_csum",
@@ -618,6 +622,9 @@ static int emac_configure(struct emac_instance *dev)
618 if (emac_phy_gpcs(dev->phy.mode)) 622 if (emac_phy_gpcs(dev->phy.mode))
619 emac_mii_reset_phy(&dev->phy); 623 emac_mii_reset_phy(&dev->phy);
620 624
625 /* Required for Pause packet support in EMAC */
626 dev_mc_add(ndev, default_mcast_addr, sizeof(default_mcast_addr), 1);
627
621 return 0; 628 return 0;
622} 629}
623 630
diff --git a/drivers/net/ibm_newemac/tah.c b/drivers/net/ibm_newemac/tah.c
index 96417adec326..b023d10d7e1c 100644
--- a/drivers/net/ibm_newemac/tah.c
+++ b/drivers/net/ibm_newemac/tah.c
@@ -155,6 +155,10 @@ static int __devexit tah_remove(struct of_device *ofdev)
155static struct of_device_id tah_match[] = 155static struct of_device_id tah_match[] =
156{ 156{
157 { 157 {
158 .compatible = "ibm,tah",
159 },
160 /* For backward compat with old DT */
161 {
158 .type = "tah", 162 .type = "tah",
159 }, 163 },
160 {}, 164 {},
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 6a1f23092099..928ce8287e69 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -31,7 +31,6 @@
31#include <linux/vmalloc.h> 31#include <linux/vmalloc.h>
32#include <linux/pagemap.h> 32#include <linux/pagemap.h>
33#include <linux/netdevice.h> 33#include <linux/netdevice.h>
34#include <linux/tcp.h>
35#include <linux/ipv6.h> 34#include <linux/ipv6.h>
36#include <net/checksum.h> 35#include <net/checksum.h>
37#include <net/ip6_checksum.h> 36#include <net/ip6_checksum.h>
@@ -2484,10 +2483,24 @@ static inline bool igb_tx_csum_adv(struct igb_adapter *adapter,
2484 tu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT); 2483 tu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT);
2485 2484
2486 if (skb->ip_summed == CHECKSUM_PARTIAL) { 2485 if (skb->ip_summed == CHECKSUM_PARTIAL) {
2487 if (skb->protocol == htons(ETH_P_IP)) 2486 switch (skb->protocol) {
2487 case __constant_htons(ETH_P_IP):
2488 tu_cmd |= E1000_ADVTXD_TUCMD_IPV4; 2488 tu_cmd |= E1000_ADVTXD_TUCMD_IPV4;
2489 if (skb->sk && (skb->sk->sk_protocol == IPPROTO_TCP)) 2489 if (ip_hdr(skb)->protocol == IPPROTO_TCP)
2490 tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP; 2490 tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP;
2491 break;
2492 case __constant_htons(ETH_P_IPV6):
2493 /* XXX what about other V6 headers?? */
2494 if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)
2495 tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP;
2496 break;
2497 default:
2498 if (unlikely(net_ratelimit()))
2499 dev_warn(&adapter->pdev->dev,
2500 "partial checksum but proto=%x!\n",
2501 skb->protocol);
2502 break;
2503 }
2491 } 2504 }
2492 2505
2493 context_desc->type_tucmd_mlhl = cpu_to_le32(tu_cmd); 2506 context_desc->type_tucmd_mlhl = cpu_to_le32(tu_cmd);
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
index 373f72cdbe8e..1f25263dc7eb 100644
--- a/drivers/net/ioc3-eth.c
+++ b/drivers/net/ioc3-eth.c
@@ -1221,7 +1221,8 @@ static void __devinit ioc3_serial_probe(struct pci_dev *pdev, struct ioc3 *ioc3)
1221} 1221}
1222#endif 1222#endif
1223 1223
1224static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 1224static int __devinit ioc3_probe(struct pci_dev *pdev,
1225 const struct pci_device_id *ent)
1225{ 1226{
1226 unsigned int sw_physid1, sw_physid2; 1227 unsigned int sw_physid1, sw_physid2;
1227 struct net_device *dev = NULL; 1228 struct net_device *dev = NULL;
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index 5e5d9b527ed1..9b358f61ed7f 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -472,7 +472,6 @@ static int ipg_config_autoneg(struct net_device *dev)
472 unsigned int txflowcontrol; 472 unsigned int txflowcontrol;
473 unsigned int rxflowcontrol; 473 unsigned int rxflowcontrol;
474 unsigned int fullduplex; 474 unsigned int fullduplex;
475 unsigned int gig;
476 u32 mac_ctrl_val; 475 u32 mac_ctrl_val;
477 u32 asicctrl; 476 u32 asicctrl;
478 u8 phyctrl; 477 u8 phyctrl;
@@ -489,7 +488,6 @@ static int ipg_config_autoneg(struct net_device *dev)
489 fullduplex = 0; 488 fullduplex = 0;
490 txflowcontrol = 0; 489 txflowcontrol = 0;
491 rxflowcontrol = 0; 490 rxflowcontrol = 0;
492 gig = 0;
493 491
494 /* To accomodate a problem in 10Mbps operation, 492 /* To accomodate a problem in 10Mbps operation,
495 * set a global flag if PHY running in 10Mbps mode. 493 * set a global flag if PHY running in 10Mbps mode.
@@ -511,7 +509,6 @@ static int ipg_config_autoneg(struct net_device *dev)
511 break; 509 break;
512 case IPG_PC_LINK_SPEED_1000MBPS: 510 case IPG_PC_LINK_SPEED_1000MBPS:
513 printk("1000Mbps.\n"); 511 printk("1000Mbps.\n");
514 gig = 1;
515 break; 512 break;
516 default: 513 default:
517 printk("undefined!\n"); 514 printk("undefined!\n");
@@ -1900,8 +1897,13 @@ static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
1900 1897
1901 /* Specify the TFC field within the TFD. */ 1898 /* Specify the TFC field within the TFD. */
1902 txfd->tfc |= cpu_to_le64(IPG_TFC_WORDALIGNDISABLED | 1899 txfd->tfc |= cpu_to_le64(IPG_TFC_WORDALIGNDISABLED |
1903 (IPG_TFC_FRAMEID & cpu_to_le64(sp->tx_current)) | 1900 (IPG_TFC_FRAMEID & sp->tx_current) |
1904 (IPG_TFC_FRAGCOUNT & (1 << 24))); 1901 (IPG_TFC_FRAGCOUNT & (1 << 24)));
1902 /*
1903 * 16--17 (WordAlign) <- 3 (disable),
1904 * 0--15 (FrameId) <- sp->tx_current,
1905 * 24--27 (FragCount) <- 1
1906 */
1905 1907
1906 /* Request TxComplete interrupts at an interval defined 1908 /* Request TxComplete interrupts at an interval defined
1907 * by the constant IPG_FRAMESBETWEENTXCOMPLETES. 1909 * by the constant IPG_FRAMESBETWEENTXCOMPLETES.
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
index b569c90da4ba..de0de744a8fa 100644
--- a/drivers/net/ne2k-pci.c
+++ b/drivers/net/ne2k-pci.c
@@ -535,9 +535,9 @@ static void ne2k_pci_block_input(struct net_device *dev, int count,
535 if (count & 3) { 535 if (count & 3) {
536 buf += count & ~3; 536 buf += count & ~3;
537 if (count & 2) { 537 if (count & 2) {
538 u16 *b = (u16 *)buf; 538 __le16 *b = (__le16 *)buf;
539 539
540 *b++ = le16_to_cpu(inw(NE_BASE + NE_DATAPORT)); 540 *b++ = cpu_to_le16(inw(NE_BASE + NE_DATAPORT));
541 buf = (char *)b; 541 buf = (char *)b;
542 } 542 }
543 if (count & 1) 543 if (count & 1)
@@ -600,9 +600,9 @@ static void ne2k_pci_block_output(struct net_device *dev, int count,
600 if (count & 3) { 600 if (count & 3) {
601 buf += count & ~3; 601 buf += count & ~3;
602 if (count & 2) { 602 if (count & 2) {
603 u16 *b = (u16 *)buf; 603 __le16 *b = (__le16 *)buf;
604 604
605 outw(cpu_to_le16(*b++), NE_BASE + NE_DATAPORT); 605 outw(le16_to_cpu(*b++), NE_BASE + NE_DATAPORT);
606 buf = (char *)b; 606 buf = (char *)b;
607 } 607 }
608 } 608 }
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
index 86e5dba079fe..3d10ca050b79 100644
--- a/drivers/net/pppol2tp.c
+++ b/drivers/net/pppol2tp.c
@@ -302,14 +302,14 @@ pppol2tp_session_find(struct pppol2tp_tunnel *tunnel, u16 session_id)
302 struct pppol2tp_session *session; 302 struct pppol2tp_session *session;
303 struct hlist_node *walk; 303 struct hlist_node *walk;
304 304
305 read_lock(&tunnel->hlist_lock); 305 read_lock_bh(&tunnel->hlist_lock);
306 hlist_for_each_entry(session, walk, session_list, hlist) { 306 hlist_for_each_entry(session, walk, session_list, hlist) {
307 if (session->tunnel_addr.s_session == session_id) { 307 if (session->tunnel_addr.s_session == session_id) {
308 read_unlock(&tunnel->hlist_lock); 308 read_unlock_bh(&tunnel->hlist_lock);
309 return session; 309 return session;
310 } 310 }
311 } 311 }
312 read_unlock(&tunnel->hlist_lock); 312 read_unlock_bh(&tunnel->hlist_lock);
313 313
314 return NULL; 314 return NULL;
315} 315}
@@ -320,14 +320,14 @@ static struct pppol2tp_tunnel *pppol2tp_tunnel_find(u16 tunnel_id)
320{ 320{
321 struct pppol2tp_tunnel *tunnel = NULL; 321 struct pppol2tp_tunnel *tunnel = NULL;
322 322
323 read_lock(&pppol2tp_tunnel_list_lock); 323 read_lock_bh(&pppol2tp_tunnel_list_lock);
324 list_for_each_entry(tunnel, &pppol2tp_tunnel_list, list) { 324 list_for_each_entry(tunnel, &pppol2tp_tunnel_list, list) {
325 if (tunnel->stats.tunnel_id == tunnel_id) { 325 if (tunnel->stats.tunnel_id == tunnel_id) {
326 read_unlock(&pppol2tp_tunnel_list_lock); 326 read_unlock_bh(&pppol2tp_tunnel_list_lock);
327 return tunnel; 327 return tunnel;
328 } 328 }
329 } 329 }
330 read_unlock(&pppol2tp_tunnel_list_lock); 330 read_unlock_bh(&pppol2tp_tunnel_list_lock);
331 331
332 return NULL; 332 return NULL;
333} 333}
@@ -342,10 +342,11 @@ static struct pppol2tp_tunnel *pppol2tp_tunnel_find(u16 tunnel_id)
342static void pppol2tp_recv_queue_skb(struct pppol2tp_session *session, struct sk_buff *skb) 342static void pppol2tp_recv_queue_skb(struct pppol2tp_session *session, struct sk_buff *skb)
343{ 343{
344 struct sk_buff *skbp; 344 struct sk_buff *skbp;
345 struct sk_buff *tmp;
345 u16 ns = PPPOL2TP_SKB_CB(skb)->ns; 346 u16 ns = PPPOL2TP_SKB_CB(skb)->ns;
346 347
347 spin_lock(&session->reorder_q.lock); 348 spin_lock_bh(&session->reorder_q.lock);
348 skb_queue_walk(&session->reorder_q, skbp) { 349 skb_queue_walk_safe(&session->reorder_q, skbp, tmp) {
349 if (PPPOL2TP_SKB_CB(skbp)->ns > ns) { 350 if (PPPOL2TP_SKB_CB(skbp)->ns > ns) {
350 __skb_insert(skb, skbp->prev, skbp, &session->reorder_q); 351 __skb_insert(skb, skbp->prev, skbp, &session->reorder_q);
351 PRINTK(session->debug, PPPOL2TP_MSG_SEQ, KERN_DEBUG, 352 PRINTK(session->debug, PPPOL2TP_MSG_SEQ, KERN_DEBUG,
@@ -360,7 +361,7 @@ static void pppol2tp_recv_queue_skb(struct pppol2tp_session *session, struct sk_
360 __skb_queue_tail(&session->reorder_q, skb); 361 __skb_queue_tail(&session->reorder_q, skb);
361 362
362out: 363out:
363 spin_unlock(&session->reorder_q.lock); 364 spin_unlock_bh(&session->reorder_q.lock);
364} 365}
365 366
366/* Dequeue a single skb. 367/* Dequeue a single skb.
@@ -371,10 +372,9 @@ static void pppol2tp_recv_dequeue_skb(struct pppol2tp_session *session, struct s
371 int length = PPPOL2TP_SKB_CB(skb)->length; 372 int length = PPPOL2TP_SKB_CB(skb)->length;
372 struct sock *session_sock = NULL; 373 struct sock *session_sock = NULL;
373 374
374 /* We're about to requeue the skb, so unlink it and return resources 375 /* We're about to requeue the skb, so return resources
375 * to its current owner (a socket receive buffer). 376 * to its current owner (a socket receive buffer).
376 */ 377 */
377 skb_unlink(skb, &session->reorder_q);
378 skb_orphan(skb); 378 skb_orphan(skb);
379 379
380 tunnel->stats.rx_packets++; 380 tunnel->stats.rx_packets++;
@@ -442,7 +442,7 @@ static void pppol2tp_recv_dequeue(struct pppol2tp_session *session)
442 * expect to send up next, dequeue it and any other 442 * expect to send up next, dequeue it and any other
443 * in-sequence packets behind it. 443 * in-sequence packets behind it.
444 */ 444 */
445 spin_lock(&session->reorder_q.lock); 445 spin_lock_bh(&session->reorder_q.lock);
446 skb_queue_walk_safe(&session->reorder_q, skb, tmp) { 446 skb_queue_walk_safe(&session->reorder_q, skb, tmp) {
447 if (time_after(jiffies, PPPOL2TP_SKB_CB(skb)->expires)) { 447 if (time_after(jiffies, PPPOL2TP_SKB_CB(skb)->expires)) {
448 session->stats.rx_seq_discards++; 448 session->stats.rx_seq_discards++;
@@ -470,13 +470,18 @@ static void pppol2tp_recv_dequeue(struct pppol2tp_session *session)
470 goto out; 470 goto out;
471 } 471 }
472 } 472 }
473 spin_unlock(&session->reorder_q.lock); 473 __skb_unlink(skb, &session->reorder_q);
474
475 /* Process the skb. We release the queue lock while we
476 * do so to let other contexts process the queue.
477 */
478 spin_unlock_bh(&session->reorder_q.lock);
474 pppol2tp_recv_dequeue_skb(session, skb); 479 pppol2tp_recv_dequeue_skb(session, skb);
475 spin_lock(&session->reorder_q.lock); 480 spin_lock_bh(&session->reorder_q.lock);
476 } 481 }
477 482
478out: 483out:
479 spin_unlock(&session->reorder_q.lock); 484 spin_unlock_bh(&session->reorder_q.lock);
480} 485}
481 486
482/* Internal receive frame. Do the real work of receiving an L2TP data frame 487/* Internal receive frame. Do the real work of receiving an L2TP data frame
@@ -1059,7 +1064,7 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
1059 1064
1060 /* Get routing info from the tunnel socket */ 1065 /* Get routing info from the tunnel socket */
1061 dst_release(skb->dst); 1066 dst_release(skb->dst);
1062 skb->dst = sk_dst_get(sk_tun); 1067 skb->dst = dst_clone(__sk_dst_get(sk_tun));
1063 skb_orphan(skb); 1068 skb_orphan(skb);
1064 skb->sk = sk_tun; 1069 skb->sk = sk_tun;
1065 1070
@@ -1107,7 +1112,7 @@ static void pppol2tp_tunnel_closeall(struct pppol2tp_tunnel *tunnel)
1107 PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1112 PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO,
1108 "%s: closing all sessions...\n", tunnel->name); 1113 "%s: closing all sessions...\n", tunnel->name);
1109 1114
1110 write_lock(&tunnel->hlist_lock); 1115 write_lock_bh(&tunnel->hlist_lock);
1111 for (hash = 0; hash < PPPOL2TP_HASH_SIZE; hash++) { 1116 for (hash = 0; hash < PPPOL2TP_HASH_SIZE; hash++) {
1112again: 1117again:
1113 hlist_for_each_safe(walk, tmp, &tunnel->session_hlist[hash]) { 1118 hlist_for_each_safe(walk, tmp, &tunnel->session_hlist[hash]) {
@@ -1129,7 +1134,7 @@ again:
1129 * disappear as we're jumping between locks. 1134 * disappear as we're jumping between locks.
1130 */ 1135 */
1131 sock_hold(sk); 1136 sock_hold(sk);
1132 write_unlock(&tunnel->hlist_lock); 1137 write_unlock_bh(&tunnel->hlist_lock);
1133 lock_sock(sk); 1138 lock_sock(sk);
1134 1139
1135 if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { 1140 if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) {
@@ -1154,11 +1159,11 @@ again:
1154 * list so we are guaranteed to make forward 1159 * list so we are guaranteed to make forward
1155 * progress. 1160 * progress.
1156 */ 1161 */
1157 write_lock(&tunnel->hlist_lock); 1162 write_lock_bh(&tunnel->hlist_lock);
1158 goto again; 1163 goto again;
1159 } 1164 }
1160 } 1165 }
1161 write_unlock(&tunnel->hlist_lock); 1166 write_unlock_bh(&tunnel->hlist_lock);
1162} 1167}
1163 1168
1164/* Really kill the tunnel. 1169/* Really kill the tunnel.
@@ -1167,9 +1172,9 @@ again:
1167static void pppol2tp_tunnel_free(struct pppol2tp_tunnel *tunnel) 1172static void pppol2tp_tunnel_free(struct pppol2tp_tunnel *tunnel)
1168{ 1173{
1169 /* Remove from socket list */ 1174 /* Remove from socket list */
1170 write_lock(&pppol2tp_tunnel_list_lock); 1175 write_lock_bh(&pppol2tp_tunnel_list_lock);
1171 list_del_init(&tunnel->list); 1176 list_del_init(&tunnel->list);
1172 write_unlock(&pppol2tp_tunnel_list_lock); 1177 write_unlock_bh(&pppol2tp_tunnel_list_lock);
1173 1178
1174 atomic_dec(&pppol2tp_tunnel_count); 1179 atomic_dec(&pppol2tp_tunnel_count);
1175 kfree(tunnel); 1180 kfree(tunnel);
@@ -1245,9 +1250,9 @@ static void pppol2tp_session_destruct(struct sock *sk)
1245 /* Delete the session socket from the 1250 /* Delete the session socket from the
1246 * hash 1251 * hash
1247 */ 1252 */
1248 write_lock(&tunnel->hlist_lock); 1253 write_lock_bh(&tunnel->hlist_lock);
1249 hlist_del_init(&session->hlist); 1254 hlist_del_init(&session->hlist);
1250 write_unlock(&tunnel->hlist_lock); 1255 write_unlock_bh(&tunnel->hlist_lock);
1251 1256
1252 atomic_dec(&pppol2tp_session_count); 1257 atomic_dec(&pppol2tp_session_count);
1253 } 1258 }
@@ -1392,9 +1397,9 @@ static struct sock *pppol2tp_prepare_tunnel_socket(int fd, u16 tunnel_id,
1392 1397
1393 /* Add tunnel to our list */ 1398 /* Add tunnel to our list */
1394 INIT_LIST_HEAD(&tunnel->list); 1399 INIT_LIST_HEAD(&tunnel->list);
1395 write_lock(&pppol2tp_tunnel_list_lock); 1400 write_lock_bh(&pppol2tp_tunnel_list_lock);
1396 list_add(&tunnel->list, &pppol2tp_tunnel_list); 1401 list_add(&tunnel->list, &pppol2tp_tunnel_list);
1397 write_unlock(&pppol2tp_tunnel_list_lock); 1402 write_unlock_bh(&pppol2tp_tunnel_list_lock);
1398 atomic_inc(&pppol2tp_tunnel_count); 1403 atomic_inc(&pppol2tp_tunnel_count);
1399 1404
1400 /* Bump the reference count. The tunnel context is deleted 1405 /* Bump the reference count. The tunnel context is deleted
@@ -1599,11 +1604,11 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
1599 sk->sk_user_data = session; 1604 sk->sk_user_data = session;
1600 1605
1601 /* Add session to the tunnel's hash list */ 1606 /* Add session to the tunnel's hash list */
1602 write_lock(&tunnel->hlist_lock); 1607 write_lock_bh(&tunnel->hlist_lock);
1603 hlist_add_head(&session->hlist, 1608 hlist_add_head(&session->hlist,
1604 pppol2tp_session_id_hash(tunnel, 1609 pppol2tp_session_id_hash(tunnel,
1605 session->tunnel_addr.s_session)); 1610 session->tunnel_addr.s_session));
1606 write_unlock(&tunnel->hlist_lock); 1611 write_unlock_bh(&tunnel->hlist_lock);
1607 1612
1608 atomic_inc(&pppol2tp_session_count); 1613 atomic_inc(&pppol2tp_session_count);
1609 1614
@@ -2205,7 +2210,7 @@ static struct pppol2tp_session *next_session(struct pppol2tp_tunnel *tunnel, str
2205 int next = 0; 2210 int next = 0;
2206 int i; 2211 int i;
2207 2212
2208 read_lock(&tunnel->hlist_lock); 2213 read_lock_bh(&tunnel->hlist_lock);
2209 for (i = 0; i < PPPOL2TP_HASH_SIZE; i++) { 2214 for (i = 0; i < PPPOL2TP_HASH_SIZE; i++) {
2210 hlist_for_each_entry(session, walk, &tunnel->session_hlist[i], hlist) { 2215 hlist_for_each_entry(session, walk, &tunnel->session_hlist[i], hlist) {
2211 if (curr == NULL) { 2216 if (curr == NULL) {
@@ -2223,7 +2228,7 @@ static struct pppol2tp_session *next_session(struct pppol2tp_tunnel *tunnel, str
2223 } 2228 }
2224 } 2229 }
2225out: 2230out:
2226 read_unlock(&tunnel->hlist_lock); 2231 read_unlock_bh(&tunnel->hlist_lock);
2227 if (!found) 2232 if (!found)
2228 session = NULL; 2233 session = NULL;
2229 2234
@@ -2234,13 +2239,13 @@ static struct pppol2tp_tunnel *next_tunnel(struct pppol2tp_tunnel *curr)
2234{ 2239{
2235 struct pppol2tp_tunnel *tunnel = NULL; 2240 struct pppol2tp_tunnel *tunnel = NULL;
2236 2241
2237 read_lock(&pppol2tp_tunnel_list_lock); 2242 read_lock_bh(&pppol2tp_tunnel_list_lock);
2238 if (list_is_last(&curr->list, &pppol2tp_tunnel_list)) { 2243 if (list_is_last(&curr->list, &pppol2tp_tunnel_list)) {
2239 goto out; 2244 goto out;
2240 } 2245 }
2241 tunnel = list_entry(curr->list.next, struct pppol2tp_tunnel, list); 2246 tunnel = list_entry(curr->list.next, struct pppol2tp_tunnel, list);
2242out: 2247out:
2243 read_unlock(&pppol2tp_tunnel_list_lock); 2248 read_unlock_bh(&pppol2tp_tunnel_list_lock);
2244 2249
2245 return tunnel; 2250 return tunnel;
2246} 2251}
diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c
index daf5abab9534..ddbc6e475e28 100644
--- a/drivers/net/ps3_gelic_wireless.c
+++ b/drivers/net/ps3_gelic_wireless.c
@@ -1644,13 +1644,24 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl)
1644 } 1644 }
1645 1645
1646 /* put them in the newtork_list */ 1646 /* put them in the newtork_list */
1647 scan_info = wl->buf; 1647 for (i = 0, scan_info_size = 0, scan_info = wl->buf;
1648 scan_info_size = 0; 1648 scan_info_size < data_len;
1649 i = 0; 1649 i++, scan_info_size += be16_to_cpu(scan_info->size),
1650 while (scan_info_size < data_len) { 1650 scan_info = (void *)scan_info + be16_to_cpu(scan_info->size)) {
1651 pr_debug("%s:size=%d bssid=%s scan_info=%p\n", __func__, 1651 pr_debug("%s:size=%d bssid=%s scan_info=%p\n", __func__,
1652 be16_to_cpu(scan_info->size), 1652 be16_to_cpu(scan_info->size),
1653 print_mac(mac, &scan_info->bssid[2]), scan_info); 1653 print_mac(mac, &scan_info->bssid[2]), scan_info);
1654
1655 /*
1656 * The wireless firmware may return invalid channel 0 and/or
1657 * invalid rate if the AP emits zero length SSID ie. As this
1658 * scan information is useless, ignore it
1659 */
1660 if (!be16_to_cpu(scan_info->channel) || !scan_info->rate[0]) {
1661 pr_debug("%s: invalid scan info\n", __func__);
1662 continue;
1663 }
1664
1654 found = 0; 1665 found = 0;
1655 oldest = NULL; 1666 oldest = NULL;
1656 list_for_each_entry(target, &wl->network_list, list) { 1667 list_for_each_entry(target, &wl->network_list, list) {
@@ -1687,10 +1698,6 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl)
1687 GFP_KERNEL); 1698 GFP_KERNEL);
1688 if (!target->hwinfo) { 1699 if (!target->hwinfo) {
1689 pr_info("%s: kzalloc failed\n", __func__); 1700 pr_info("%s: kzalloc failed\n", __func__);
1690 i++;
1691 scan_info_size += be16_to_cpu(scan_info->size);
1692 scan_info = (void *)scan_info +
1693 be16_to_cpu(scan_info->size);
1694 continue; 1701 continue;
1695 } 1702 }
1696 /* copy hw scan info */ 1703 /* copy hw scan info */
@@ -1709,10 +1716,6 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl)
1709 if (scan_info->ext_rate[r]) 1716 if (scan_info->ext_rate[r])
1710 target->rate_ext_len++; 1717 target->rate_ext_len++;
1711 list_move_tail(&target->list, &wl->network_list); 1718 list_move_tail(&target->list, &wl->network_list);
1712 /* bump pointer */
1713 i++;
1714 scan_info_size += be16_to_cpu(scan_info->size);
1715 scan_info = (void *)scan_info + be16_to_cpu(scan_info->size);
1716 } 1719 }
1717 memset(&data, 0, sizeof(data)); 1720 memset(&data, 0, sizeof(data));
1718 wireless_send_event(port_to_netdev(wl_port(wl)), SIOCGIWSCAN, &data, 1721 wireless_send_event(port_to_netdev(wl_port(wl)), SIOCGIWSCAN, &data,
@@ -2389,6 +2392,8 @@ static struct net_device *gelic_wl_alloc(struct gelic_card *card)
2389 if (!netdev) 2392 if (!netdev)
2390 return NULL; 2393 return NULL;
2391 2394
2395 strcpy(netdev->name, "wlan%d");
2396
2392 port = netdev_priv(netdev); 2397 port = netdev_priv(netdev);
2393 port->netdev = netdev; 2398 port->netdev = netdev;
2394 port->card = card; 2399 port->card = card;
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 19184e486ae9..169edc154928 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -239,7 +239,8 @@ static void r6040_free_txbufs(struct net_device *dev)
239 239
240 for (i = 0; i < TX_DCNT; i++) { 240 for (i = 0; i < TX_DCNT; i++) {
241 if (lp->tx_insert_ptr->skb_ptr) { 241 if (lp->tx_insert_ptr->skb_ptr) {
242 pci_unmap_single(lp->pdev, lp->tx_insert_ptr->buf, 242 pci_unmap_single(lp->pdev,
243 le32_to_cpu(lp->tx_insert_ptr->buf),
243 MAX_BUF_SIZE, PCI_DMA_TODEVICE); 244 MAX_BUF_SIZE, PCI_DMA_TODEVICE);
244 dev_kfree_skb(lp->tx_insert_ptr->skb_ptr); 245 dev_kfree_skb(lp->tx_insert_ptr->skb_ptr);
245 lp->rx_insert_ptr->skb_ptr = NULL; 246 lp->rx_insert_ptr->skb_ptr = NULL;
@@ -255,7 +256,8 @@ static void r6040_free_rxbufs(struct net_device *dev)
255 256
256 for (i = 0; i < RX_DCNT; i++) { 257 for (i = 0; i < RX_DCNT; i++) {
257 if (lp->rx_insert_ptr->skb_ptr) { 258 if (lp->rx_insert_ptr->skb_ptr) {
258 pci_unmap_single(lp->pdev, lp->rx_insert_ptr->buf, 259 pci_unmap_single(lp->pdev,
260 le32_to_cpu(lp->rx_insert_ptr->buf),
259 MAX_BUF_SIZE, PCI_DMA_FROMDEVICE); 261 MAX_BUF_SIZE, PCI_DMA_FROMDEVICE);
260 dev_kfree_skb(lp->rx_insert_ptr->skb_ptr); 262 dev_kfree_skb(lp->rx_insert_ptr->skb_ptr);
261 lp->rx_insert_ptr->skb_ptr = NULL; 263 lp->rx_insert_ptr->skb_ptr = NULL;
@@ -542,7 +544,7 @@ static int r6040_rx(struct net_device *dev, int limit)
542 skb_ptr->dev = priv->dev; 544 skb_ptr->dev = priv->dev;
543 /* Do not count the CRC */ 545 /* Do not count the CRC */
544 skb_put(skb_ptr, descptr->len - 4); 546 skb_put(skb_ptr, descptr->len - 4);
545 pci_unmap_single(priv->pdev, descptr->buf, 547 pci_unmap_single(priv->pdev, le32_to_cpu(descptr->buf),
546 MAX_BUF_SIZE, PCI_DMA_FROMDEVICE); 548 MAX_BUF_SIZE, PCI_DMA_FROMDEVICE);
547 skb_ptr->protocol = eth_type_trans(skb_ptr, priv->dev); 549 skb_ptr->protocol = eth_type_trans(skb_ptr, priv->dev);
548 /* Send to upper layer */ 550 /* Send to upper layer */
@@ -585,7 +587,7 @@ static void r6040_tx(struct net_device *dev)
585 if (descptr->status & 0x8000) 587 if (descptr->status & 0x8000)
586 break; /* Not complete */ 588 break; /* Not complete */
587 skb_ptr = descptr->skb_ptr; 589 skb_ptr = descptr->skb_ptr;
588 pci_unmap_single(priv->pdev, descptr->buf, 590 pci_unmap_single(priv->pdev, le32_to_cpu(descptr->buf),
589 skb_ptr->len, PCI_DMA_TODEVICE); 591 skb_ptr->len, PCI_DMA_TODEVICE);
590 /* Free buffer */ 592 /* Free buffer */
591 dev_kfree_skb_irq(skb_ptr); 593 dev_kfree_skb_irq(skb_ptr);
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index 567c62757e9d..1b5edd646a8c 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -842,7 +842,7 @@ static inline int de_is_running (struct de_private *de)
842static void de_stop_rxtx (struct de_private *de) 842static void de_stop_rxtx (struct de_private *de)
843{ 843{
844 u32 macmode; 844 u32 macmode;
845 unsigned int work = 1000; 845 unsigned int i = 1300/100;
846 846
847 macmode = dr32(MacMode); 847 macmode = dr32(MacMode);
848 if (macmode & RxTx) { 848 if (macmode & RxTx) {
@@ -850,10 +850,14 @@ static void de_stop_rxtx (struct de_private *de)
850 dr32(MacMode); 850 dr32(MacMode);
851 } 851 }
852 852
853 while (--work > 0) { 853 /* wait until in-flight frame completes.
854 * Max time @ 10BT: 1500*8b/10Mbps == 1200us (+ 100us margin)
855 * Typically expect this loop to end in < 50 us on 100BT.
856 */
857 while (--i) {
854 if (!de_is_running(de)) 858 if (!de_is_running(de))
855 return; 859 return;
856 cpu_relax(); 860 udelay(100);
857 } 861 }
858 862
859 printk(KERN_WARNING "%s: timeout expired stopping DMA\n", de->dev->name); 863 printk(KERN_WARNING "%s: timeout expired stopping DMA\n", de->dev->name);
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index fba0811d2608..8cc316653a39 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -154,8 +154,8 @@ static struct ucc_geth_info ugeth_primary_info = {
154 .rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT, 154 .rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT,
155 .aufc = UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_NONE, 155 .aufc = UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_NONE,
156 .padAndCrc = MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC, 156 .padAndCrc = MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC,
157 .numThreadsTx = UCC_GETH_NUM_OF_THREADS_4, 157 .numThreadsTx = UCC_GETH_NUM_OF_THREADS_1,
158 .numThreadsRx = UCC_GETH_NUM_OF_THREADS_4, 158 .numThreadsRx = UCC_GETH_NUM_OF_THREADS_1,
159 .riscTx = QE_RISC_ALLOCATION_RISC1_AND_RISC2, 159 .riscTx = QE_RISC_ALLOCATION_RISC1_AND_RISC2,
160 .riscRx = QE_RISC_ALLOCATION_RISC1_AND_RISC2, 160 .riscRx = QE_RISC_ALLOCATION_RISC1_AND_RISC2,
161}; 161};
@@ -3975,6 +3975,8 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3975 ug_info->uf_info.utfs = UCC_GETH_UTFS_GIGA_INIT; 3975 ug_info->uf_info.utfs = UCC_GETH_UTFS_GIGA_INIT;
3976 ug_info->uf_info.utfet = UCC_GETH_UTFET_GIGA_INIT; 3976 ug_info->uf_info.utfet = UCC_GETH_UTFET_GIGA_INIT;
3977 ug_info->uf_info.utftt = UCC_GETH_UTFTT_GIGA_INIT; 3977 ug_info->uf_info.utftt = UCC_GETH_UTFTT_GIGA_INIT;
3978 ug_info->numThreadsTx = UCC_GETH_NUM_OF_THREADS_4;
3979 ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_4;
3978 } 3980 }
3979 3981
3980 /* Set the bus id */ 3982 /* Set the bus id */
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index a61324757b17..727547a28992 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -16,10 +16,6 @@
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19
20// #define DEBUG // error path messages, extra info
21// #define VERBOSE // more; success messages
22
23#include <linux/module.h> 19#include <linux/module.h>
24#include <linux/init.h> 20#include <linux/init.h>
25#include <linux/netdevice.h> 21#include <linux/netdevice.h>
@@ -318,6 +314,14 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
318 net->hard_header_len += sizeof (struct rndis_data_hdr); 314 net->hard_header_len += sizeof (struct rndis_data_hdr);
319 dev->hard_mtu = net->mtu + net->hard_header_len; 315 dev->hard_mtu = net->mtu + net->hard_header_len;
320 316
317 dev->maxpacket = usb_maxpacket(dev->udev, dev->out, 1);
318 if (dev->maxpacket == 0) {
319 if (netif_msg_probe(dev))
320 dev_dbg(&intf->dev, "dev->maxpacket can't be 0\n");
321 retval = -EINVAL;
322 goto fail_and_release;
323 }
324
321 dev->rx_urb_size = dev->hard_mtu + (dev->maxpacket + 1); 325 dev->rx_urb_size = dev->hard_mtu + (dev->maxpacket + 1);
322 dev->rx_urb_size &= ~(dev->maxpacket - 1); 326 dev->rx_urb_size &= ~(dev->maxpacket - 1);
323 u.init->max_transfer_size = cpu_to_le32(dev->rx_urb_size); 327 u.init->max_transfer_size = cpu_to_le32(dev->rx_urb_size);
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 19fd4cb0ddf8..b58472cf76f8 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -203,8 +203,11 @@ again:
203 if (received < budget) { 203 if (received < budget) {
204 netif_rx_complete(vi->dev, napi); 204 netif_rx_complete(vi->dev, napi);
205 if (unlikely(!vi->rvq->vq_ops->enable_cb(vi->rvq)) 205 if (unlikely(!vi->rvq->vq_ops->enable_cb(vi->rvq))
206 && netif_rx_reschedule(vi->dev, napi)) 206 && napi_schedule_prep(napi)) {
207 vi->rvq->vq_ops->disable_cb(vi->rvq);
208 __netif_rx_schedule(vi->dev, napi);
207 goto again; 209 goto again;
210 }
208 } 211 }
209 212
210 return received; 213 return received;
@@ -278,10 +281,11 @@ again:
278 pr_debug("%s: virtio not prepared to send\n", dev->name); 281 pr_debug("%s: virtio not prepared to send\n", dev->name);
279 netif_stop_queue(dev); 282 netif_stop_queue(dev);
280 283
281 /* Activate callback for using skbs: if this fails it 284 /* Activate callback for using skbs: if this returns false it
282 * means some were used in the meantime. */ 285 * means some were used in the meantime. */
283 if (unlikely(!vi->svq->vq_ops->enable_cb(vi->svq))) { 286 if (unlikely(!vi->svq->vq_ops->enable_cb(vi->svq))) {
284 printk("Unlikely: restart svq failed\n"); 287 printk("Unlikely: restart svq race\n");
288 vi->svq->vq_ops->disable_cb(vi->svq);
285 netif_start_queue(dev); 289 netif_start_queue(dev);
286 goto again; 290 goto again;
287 } 291 }
@@ -294,6 +298,15 @@ again:
294 return 0; 298 return 0;
295} 299}
296 300
301#ifdef CONFIG_NET_POLL_CONTROLLER
302static void virtnet_netpoll(struct net_device *dev)
303{
304 struct virtnet_info *vi = netdev_priv(dev);
305
306 napi_schedule(&vi->napi);
307}
308#endif
309
297static int virtnet_open(struct net_device *dev) 310static int virtnet_open(struct net_device *dev)
298{ 311{
299 struct virtnet_info *vi = netdev_priv(dev); 312 struct virtnet_info *vi = netdev_priv(dev);
@@ -336,6 +349,9 @@ static int virtnet_probe(struct virtio_device *vdev)
336 dev->stop = virtnet_close; 349 dev->stop = virtnet_close;
337 dev->hard_start_xmit = start_xmit; 350 dev->hard_start_xmit = start_xmit;
338 dev->features = NETIF_F_HIGHDMA; 351 dev->features = NETIF_F_HIGHDMA;
352#ifdef CONFIG_NET_POLL_CONTROLLER
353 dev->poll_controller = virtnet_netpoll;
354#endif
339 SET_NETDEV_DEV(dev, &vdev->dev); 355 SET_NETDEV_DEV(dev, &vdev->dev);
340 356
341 /* Do we support "hardware" checksums? */ 357 /* Do we support "hardware" checksums? */
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c
index cf27bf40d36e..547368e9633d 100644
--- a/drivers/net/wan/farsync.c
+++ b/drivers/net/wan/farsync.c
@@ -2024,6 +2024,7 @@ fst_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2024 struct fstioc_write wrthdr; 2024 struct fstioc_write wrthdr;
2025 struct fstioc_info info; 2025 struct fstioc_info info;
2026 unsigned long flags; 2026 unsigned long flags;
2027 void *buf;
2027 2028
2028 dbg(DBG_IOCTL, "ioctl: %x, %p\n", cmd, ifr->ifr_data); 2029 dbg(DBG_IOCTL, "ioctl: %x, %p\n", cmd, ifr->ifr_data);
2029 2030
@@ -2065,16 +2066,22 @@ fst_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2065 return -ENXIO; 2066 return -ENXIO;
2066 } 2067 }
2067 2068
2068 /* Now copy the data to the card. 2069 /* Now copy the data to the card. */
2069 * This will probably break on some architectures. 2070
2070 * I'll fix it when I have something to test on. 2071 buf = kmalloc(wrthdr.size, GFP_KERNEL);
2071 */ 2072 if (!buf)
2072 if (copy_from_user(card->mem + wrthdr.offset, 2073 return -ENOMEM;
2074
2075 if (copy_from_user(buf,
2073 ifr->ifr_data + sizeof (struct fstioc_write), 2076 ifr->ifr_data + sizeof (struct fstioc_write),
2074 wrthdr.size)) { 2077 wrthdr.size)) {
2078 kfree(buf);
2075 return -EFAULT; 2079 return -EFAULT;
2076 } 2080 }
2077 2081
2082 memcpy_toio(card->mem + wrthdr.offset, buf, wrthdr.size);
2083 kfree(buf);
2084
2078 /* Writes to the memory of a card in the reset state constitute 2085 /* Writes to the memory of a card in the reset state constitute
2079 * a download 2086 * a download
2080 */ 2087 */
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index 15d5c58e57bc..e59255a155a9 100644
--- a/drivers/net/wan/sbni.c
+++ b/drivers/net/wan/sbni.c
@@ -751,7 +751,7 @@ upload_data( struct net_device *dev, unsigned framelen, unsigned frameno,
751} 751}
752 752
753 753
754static __inline void 754static inline void
755send_complete( struct net_local *nl ) 755send_complete( struct net_local *nl )
756{ 756{
757#ifdef CONFIG_SBNI_MULTILINE 757#ifdef CONFIG_SBNI_MULTILINE
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
index 677600b302d9..ff579a223621 100644
--- a/drivers/net/wireless/ath5k/hw.c
+++ b/drivers/net/wireless/ath5k/hw.c
@@ -458,6 +458,8 @@ void ath5k_hw_detach(struct ath5k_hw *ah)
458{ 458{
459 ATH5K_TRACE(ah->ah_sc); 459 ATH5K_TRACE(ah->ah_sc);
460 460
461 __set_bit(ATH_STAT_INVALID, ah->ah_sc->status);
462
461 if (ah->ah_rf_banks != NULL) 463 if (ah->ah_rf_banks != NULL)
462 kfree(ah->ah_rf_banks); 464 kfree(ah->ah_rf_banks);
463 465
diff --git a/drivers/net/wireless/b43/phy.c b/drivers/net/wireless/b43/phy.c
index 71507b260b6d..575c5436ebdf 100644
--- a/drivers/net/wireless/b43/phy.c
+++ b/drivers/net/wireless/b43/phy.c
@@ -860,7 +860,7 @@ static void b43_phy_ww(struct b43_wldev *dev)
860 b43_phy_write(dev, B43_PHY_OFDM(0xBB), 860 b43_phy_write(dev, B43_PHY_OFDM(0xBB),
861 (b43_phy_read(dev, B43_PHY_OFDM(0xBB)) & 0xF000) | 0x0053); 861 (b43_phy_read(dev, B43_PHY_OFDM(0xBB)) & 0xF000) | 0x0053);
862 b43_phy_write(dev, B43_PHY_OFDM61, 862 b43_phy_write(dev, B43_PHY_OFDM61,
863 (b43_phy_read(dev, B43_PHY_OFDM61 & 0xFE1F)) | 0x0120); 863 (b43_phy_read(dev, B43_PHY_OFDM61) & 0xFE1F) | 0x0120);
864 b43_phy_write(dev, B43_PHY_OFDM(0x13), 864 b43_phy_write(dev, B43_PHY_OFDM(0x13),
865 (b43_phy_read(dev, B43_PHY_OFDM(0x13)) & 0x0FFF) | 0x3000); 865 (b43_phy_read(dev, B43_PHY_OFDM(0x13)) & 0x0FFF) | 0x3000);
866 b43_phy_write(dev, B43_PHY_OFDM(0x14), 866 b43_phy_write(dev, B43_PHY_OFDM(0x14),
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index 15e4ebdcd477..63aa884b18f2 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -515,7 +515,7 @@ int lbs_process_rx_command(struct lbs_private *priv)
515 goto done; 515 goto done;
516 } 516 }
517 if (respcmd != CMD_RET(curcmd) && 517 if (respcmd != CMD_RET(curcmd) &&
518 respcmd != CMD_802_11_ASSOCIATE && curcmd != CMD_RET_802_11_ASSOCIATE) { 518 respcmd != CMD_RET_802_11_ASSOCIATE && curcmd != CMD_802_11_ASSOCIATE) {
519 lbs_pr_info("Invalid CMD_RESP %x to command %x!\n", respcmd, curcmd); 519 lbs_pr_info("Invalid CMD_RESP %x to command %x!\n", respcmd, curcmd);
520 spin_unlock_irqrestore(&priv->driver_lock, flags); 520 spin_unlock_irqrestore(&priv->driver_lock, flags);
521 ret = -1; 521 ret = -1;
diff --git a/drivers/net/wireless/p54usb.c b/drivers/net/wireless/p54usb.c
index e7d4aee8799e..98ddbb3b3273 100644
--- a/drivers/net/wireless/p54usb.c
+++ b/drivers/net/wireless/p54usb.c
@@ -63,6 +63,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
63 {USB_DEVICE(0x0cde, 0x0008)}, /* Sagem XG703A */ 63 {USB_DEVICE(0x0cde, 0x0008)}, /* Sagem XG703A */
64 {USB_DEVICE(0x0d8e, 0x3762)}, /* DLink DWL-G120 Cohiba */ 64 {USB_DEVICE(0x0d8e, 0x3762)}, /* DLink DWL-G120 Cohiba */
65 {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ 65 {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */
66 {USB_DEVICE(0x124a, 0x4025)}, /* IOGear GWU513 (GW3887IK chip) */
66 {USB_DEVICE(0x13b1, 0x000a)}, /* Linksys WUSB54G ver 2 */ 67 {USB_DEVICE(0x13b1, 0x000a)}, /* Linksys WUSB54G ver 2 */
67 {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ 68 {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */
68 {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ 69 {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index dfd0af0e0a16..c016bfe1defd 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -671,6 +671,9 @@ struct rt2x00_dev {
671 * This will only be compiled in when required. 671 * This will only be compiled in when required.
672 */ 672 */
673#ifdef CONFIG_RT2X00_LIB_RFKILL 673#ifdef CONFIG_RT2X00_LIB_RFKILL
674unsigned long rfkill_state;
675#define RFKILL_STATE_ALLOCATED 1
676#define RFKILL_STATE_REGISTERED 2
674 struct rfkill *rfkill; 677 struct rfkill *rfkill;
675 struct input_polled_dev *poll_dev; 678 struct input_polled_dev *poll_dev;
676#endif /* CONFIG_RT2X00_LIB_RFKILL */ 679#endif /* CONFIG_RT2X00_LIB_RFKILL */
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index b81efc9b058d..acf4d67ba43d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -994,7 +994,7 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev)
994 return; 994 return;
995 995
996 /* 996 /*
997 * Unregister rfkill. 997 * Unregister extra components.
998 */ 998 */
999 rt2x00rfkill_unregister(rt2x00dev); 999 rt2x00rfkill_unregister(rt2x00dev);
1000 1000
@@ -1033,11 +1033,9 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev)
1033 __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags); 1033 __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags);
1034 1034
1035 /* 1035 /*
1036 * Register the rfkill handler. 1036 * Register the extra components.
1037 */ 1037 */
1038 status = rt2x00rfkill_register(rt2x00dev); 1038 rt2x00rfkill_register(rt2x00dev);
1039 if (status)
1040 goto exit;
1041 1039
1042 return 0; 1040 return 0;
1043 1041
@@ -1151,20 +1149,10 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
1151 } 1149 }
1152 1150
1153 /* 1151 /*
1154 * Register LED. 1152 * Register extra components.
1155 */ 1153 */
1156 rt2x00leds_register(rt2x00dev); 1154 rt2x00leds_register(rt2x00dev);
1157 1155 rt2x00rfkill_allocate(rt2x00dev);
1158 /*
1159 * Allocatie rfkill.
1160 */
1161 retval = rt2x00rfkill_allocate(rt2x00dev);
1162 if (retval)
1163 goto exit;
1164
1165 /*
1166 * Open the debugfs entry.
1167 */
1168 rt2x00debug_register(rt2x00dev); 1156 rt2x00debug_register(rt2x00dev);
1169 1157
1170 __set_bit(DEVICE_PRESENT, &rt2x00dev->flags); 1158 __set_bit(DEVICE_PRESENT, &rt2x00dev->flags);
@@ -1193,13 +1181,9 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
1193 rt2x00lib_uninitialize(rt2x00dev); 1181 rt2x00lib_uninitialize(rt2x00dev);
1194 1182
1195 /* 1183 /*
1196 * Close debugfs entry. 1184 * Free extra components
1197 */ 1185 */
1198 rt2x00debug_deregister(rt2x00dev); 1186 rt2x00debug_deregister(rt2x00dev);
1199
1200 /*
1201 * Free rfkill
1202 */
1203 rt2x00rfkill_free(rt2x00dev); 1187 rt2x00rfkill_free(rt2x00dev);
1204 1188
1205 /* 1189 /*
@@ -1243,12 +1227,16 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state)
1243 __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags); 1227 __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags);
1244 1228
1245 /* 1229 /*
1246 * Disable radio and unitialize all items 1230 * Disable radio.
1247 * that must be recreated on resume.
1248 */ 1231 */
1249 rt2x00lib_stop(rt2x00dev); 1232 rt2x00lib_stop(rt2x00dev);
1250 rt2x00lib_uninitialize(rt2x00dev); 1233 rt2x00lib_uninitialize(rt2x00dev);
1234
1235 /*
1236 * Suspend/disable extra components.
1237 */
1251 rt2x00leds_suspend(rt2x00dev); 1238 rt2x00leds_suspend(rt2x00dev);
1239 rt2x00rfkill_suspend(rt2x00dev);
1252 rt2x00debug_deregister(rt2x00dev); 1240 rt2x00debug_deregister(rt2x00dev);
1253 1241
1254exit: 1242exit:
@@ -1292,9 +1280,10 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev)
1292 NOTICE(rt2x00dev, "Waking up.\n"); 1280 NOTICE(rt2x00dev, "Waking up.\n");
1293 1281
1294 /* 1282 /*
1295 * Open the debugfs entry and restore led handling. 1283 * Restore/enable extra components.
1296 */ 1284 */
1297 rt2x00debug_register(rt2x00dev); 1285 rt2x00debug_register(rt2x00dev);
1286 rt2x00rfkill_resume(rt2x00dev);
1298 rt2x00leds_resume(rt2x00dev); 1287 rt2x00leds_resume(rt2x00dev);
1299 1288
1300 /* 1289 /*
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
index e4b4dd23d611..64fae7e3f73b 100644
--- a/drivers/net/wireless/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
@@ -148,28 +148,36 @@ static inline void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
148 * RFkill handlers. 148 * RFkill handlers.
149 */ 149 */
150#ifdef CONFIG_RT2X00_LIB_RFKILL 150#ifdef CONFIG_RT2X00_LIB_RFKILL
151int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev); 151void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev);
152void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev); 152void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev);
153int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev); 153void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev);
154void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev); 154void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev);
155void rt2x00rfkill_suspend(struct rt2x00_dev *rt2x00dev);
156void rt2x00rfkill_resume(struct rt2x00_dev *rt2x00dev);
155#else 157#else
156static inline int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) 158static inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
157{ 159{
158 return 0;
159} 160}
160 161
161static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) 162static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev)
162{ 163{
163} 164}
164 165
165static inline int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) 166static inline void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev)
166{ 167{
167 return 0;
168} 168}
169 169
170static inline void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) 170static inline void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev)
171{ 171{
172} 172}
173
174static inline void rt2x00rfkill_suspend(struct rt2x00_dev *rt2x00dev)
175{
176}
177
178static inline void rt2x00rfkill_resume(struct rt2x00_dev *rt2x00dev)
179{
180}
173#endif /* CONFIG_RT2X00_LIB_RFKILL */ 181#endif /* CONFIG_RT2X00_LIB_RFKILL */
174 182
175/* 183/*
diff --git a/drivers/net/wireless/rt2x00/rt2x00rfkill.c b/drivers/net/wireless/rt2x00/rt2x00rfkill.c
index 67121427a5bd..fcef9885ab5e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00rfkill.c
+++ b/drivers/net/wireless/rt2x00/rt2x00rfkill.c
@@ -69,56 +69,81 @@ static void rt2x00rfkill_poll(struct input_polled_dev *poll_dev)
69 } 69 }
70} 70}
71 71
72int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) 72void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
73{ 73{
74 int retval; 74 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) ||
75 75 !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state))
76 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) 76 return;
77 return 0;
78 77
79 retval = rfkill_register(rt2x00dev->rfkill); 78 if (rfkill_register(rt2x00dev->rfkill)) {
80 if (retval) {
81 ERROR(rt2x00dev, "Failed to register rfkill handler.\n"); 79 ERROR(rt2x00dev, "Failed to register rfkill handler.\n");
82 return retval; 80 return;
83 } 81 }
84 82
85 retval = input_register_polled_device(rt2x00dev->poll_dev); 83 if (input_register_polled_device(rt2x00dev->poll_dev)) {
86 if (retval) {
87 ERROR(rt2x00dev, "Failed to register polled device.\n"); 84 ERROR(rt2x00dev, "Failed to register polled device.\n");
88 rfkill_unregister(rt2x00dev->rfkill); 85 rfkill_unregister(rt2x00dev->rfkill);
89 return retval; 86 return;
90 } 87 }
91 88
89 __set_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state);
90
92 /* 91 /*
93 * Force initial poll which will detect the initial device state, 92 * Force initial poll which will detect the initial device state,
94 * and correctly sends the signal to the rfkill layer about this 93 * and correctly sends the signal to the rfkill layer about this
95 * state. 94 * state.
96 */ 95 */
97 rt2x00rfkill_poll(rt2x00dev->poll_dev); 96 rt2x00rfkill_poll(rt2x00dev->poll_dev);
98
99 return 0;
100} 97}
101 98
102void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) 99void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev)
103{ 100{
104 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) 101 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) ||
102 !test_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state))
105 return; 103 return;
106 104
107 input_unregister_polled_device(rt2x00dev->poll_dev); 105 input_unregister_polled_device(rt2x00dev->poll_dev);
108 rfkill_unregister(rt2x00dev->rfkill); 106 rfkill_unregister(rt2x00dev->rfkill);
107
108 __clear_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state);
109} 109}
110 110
111int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) 111static struct input_polled_dev *
112rt2x00rfkill_allocate_polldev(struct rt2x00_dev *rt2x00dev)
112{ 113{
113 struct device *device = wiphy_dev(rt2x00dev->hw->wiphy); 114 struct input_polled_dev *poll_dev;
115
116 poll_dev = input_allocate_polled_device();
117 if (!poll_dev)
118 return NULL;
119
120 poll_dev->private = rt2x00dev;
121 poll_dev->poll = rt2x00rfkill_poll;
122 poll_dev->poll_interval = RFKILL_POLL_INTERVAL;
123
124 poll_dev->input->name = rt2x00dev->ops->name;
125 poll_dev->input->phys = wiphy_name(rt2x00dev->hw->wiphy);
126 poll_dev->input->id.bustype = BUS_HOST;
127 poll_dev->input->id.vendor = 0x1814;
128 poll_dev->input->id.product = rt2x00dev->chip.rt;
129 poll_dev->input->id.version = rt2x00dev->chip.rev;
130 poll_dev->input->dev.parent = wiphy_dev(rt2x00dev->hw->wiphy);
131 poll_dev->input->evbit[0] = BIT(EV_KEY);
132 set_bit(KEY_WLAN, poll_dev->input->keybit);
133
134 return poll_dev;
135}
114 136
137void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev)
138{
115 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) 139 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags))
116 return 0; 140 return;
117 141
118 rt2x00dev->rfkill = rfkill_allocate(device, RFKILL_TYPE_WLAN); 142 rt2x00dev->rfkill =
143 rfkill_allocate(wiphy_dev(rt2x00dev->hw->wiphy), RFKILL_TYPE_WLAN);
119 if (!rt2x00dev->rfkill) { 144 if (!rt2x00dev->rfkill) {
120 ERROR(rt2x00dev, "Failed to allocate rfkill handler.\n"); 145 ERROR(rt2x00dev, "Failed to allocate rfkill handler.\n");
121 goto exit; 146 return;
122 } 147 }
123 148
124 rt2x00dev->rfkill->name = rt2x00dev->ops->name; 149 rt2x00dev->rfkill->name = rt2x00dev->ops->name;
@@ -126,40 +151,49 @@ int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev)
126 rt2x00dev->rfkill->state = -1; 151 rt2x00dev->rfkill->state = -1;
127 rt2x00dev->rfkill->toggle_radio = rt2x00rfkill_toggle_radio; 152 rt2x00dev->rfkill->toggle_radio = rt2x00rfkill_toggle_radio;
128 153
129 rt2x00dev->poll_dev = input_allocate_polled_device(); 154 rt2x00dev->poll_dev = rt2x00rfkill_allocate_polldev(rt2x00dev);
130 if (!rt2x00dev->poll_dev) { 155 if (!rt2x00dev->poll_dev) {
131 ERROR(rt2x00dev, "Failed to allocate polled device.\n"); 156 ERROR(rt2x00dev, "Failed to allocate polled device.\n");
132 goto exit_free_rfkill; 157 rfkill_free(rt2x00dev->rfkill);
158 rt2x00dev->rfkill = NULL;
159 return;
133 } 160 }
134 161
135 rt2x00dev->poll_dev->private = rt2x00dev; 162 return;
136 rt2x00dev->poll_dev->poll = rt2x00rfkill_poll; 163}
137 rt2x00dev->poll_dev->poll_interval = RFKILL_POLL_INTERVAL;
138 164
139 rt2x00dev->poll_dev->input->name = rt2x00dev->ops->name; 165void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev)
140 rt2x00dev->poll_dev->input->phys = wiphy_name(rt2x00dev->hw->wiphy); 166{
141 rt2x00dev->poll_dev->input->id.bustype = BUS_HOST; 167 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) ||
142 rt2x00dev->poll_dev->input->id.vendor = 0x1814; 168 !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state))
143 rt2x00dev->poll_dev->input->id.product = rt2x00dev->chip.rt; 169 return;
144 rt2x00dev->poll_dev->input->id.version = rt2x00dev->chip.rev;
145 rt2x00dev->poll_dev->input->dev.parent = device;
146 rt2x00dev->poll_dev->input->evbit[0] = BIT(EV_KEY);
147 set_bit(KEY_WLAN, rt2x00dev->poll_dev->input->keybit);
148 170
149 return 0; 171 input_free_polled_device(rt2x00dev->poll_dev);
172 rt2x00dev->poll_dev = NULL;
150 173
151exit_free_rfkill:
152 rfkill_free(rt2x00dev->rfkill); 174 rfkill_free(rt2x00dev->rfkill);
153 175 rt2x00dev->rfkill = NULL;
154exit:
155 return -ENOMEM;
156} 176}
157 177
158void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) 178void rt2x00rfkill_suspend(struct rt2x00_dev *rt2x00dev)
159{ 179{
160 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) 180 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) ||
181 !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state))
161 return; 182 return;
162 183
163 input_free_polled_device(rt2x00dev->poll_dev); 184 input_free_polled_device(rt2x00dev->poll_dev);
164 rfkill_free(rt2x00dev->rfkill); 185 rt2x00dev->poll_dev = NULL;
186}
187
188void rt2x00rfkill_resume(struct rt2x00_dev *rt2x00dev)
189{
190 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) ||
191 !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state))
192 return;
193
194 rt2x00dev->poll_dev = rt2x00rfkill_allocate_polldev(rt2x00dev);
195 if (!rt2x00dev->poll_dev) {
196 ERROR(rt2x00dev, "Failed to allocate polled device.\n");
197 return;
198 }
165} 199}
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 4baa916b80cf..babb240cef3d 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2306,9 +2306,9 @@ static void rt61pci_configure_filter(struct ieee80211_hw *hw,
2306 * Apply some rules to the filters: 2306 * Apply some rules to the filters:
2307 * - Some filters imply different filters to be set. 2307 * - Some filters imply different filters to be set.
2308 * - Some things we can't filter out at all. 2308 * - Some things we can't filter out at all.
2309 * - Multicast filter seems to kill broadcast traffic so never use it.
2309 */ 2310 */
2310 if (mc_count) 2311 *total_flags |= FIF_ALLMULTI;
2311 *total_flags |= FIF_ALLMULTI;
2312 if (*total_flags & FIF_OTHER_BSS || 2312 if (*total_flags & FIF_OTHER_BSS ||
2313 *total_flags & FIF_PROMISC_IN_BSS) 2313 *total_flags & FIF_PROMISC_IN_BSS)
2314 *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; 2314 *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 48938819ee2f..46b040bf62de 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -1906,9 +1906,9 @@ static void rt73usb_configure_filter(struct ieee80211_hw *hw,
1906 * Apply some rules to the filters: 1906 * Apply some rules to the filters:
1907 * - Some filters imply different filters to be set. 1907 * - Some filters imply different filters to be set.
1908 * - Some things we can't filter out at all. 1908 * - Some things we can't filter out at all.
1909 * - Multicast filter seems to kill broadcast traffic so never use it.
1909 */ 1910 */
1910 if (mc_count) 1911 *total_flags |= FIF_ALLMULTI;
1911 *total_flags |= FIF_ALLMULTI;
1912 if (*total_flags & FIF_OTHER_BSS || 1912 if (*total_flags & FIF_OTHER_BSS ||
1913 *total_flags & FIF_PROMISC_IN_BSS) 1913 *total_flags & FIF_PROMISC_IN_BSS)
1914 *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; 1914 *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
@@ -2163,6 +2163,7 @@ static struct usb_device_id rt73usb_device_table[] = {
2163 /* D-Link */ 2163 /* D-Link */
2164 { USB_DEVICE(0x07d1, 0x3c03), USB_DEVICE_DATA(&rt73usb_ops) }, 2164 { USB_DEVICE(0x07d1, 0x3c03), USB_DEVICE_DATA(&rt73usb_ops) },
2165 { USB_DEVICE(0x07d1, 0x3c04), USB_DEVICE_DATA(&rt73usb_ops) }, 2165 { USB_DEVICE(0x07d1, 0x3c04), USB_DEVICE_DATA(&rt73usb_ops) },
2166 { USB_DEVICE(0x07d1, 0x3c07), USB_DEVICE_DATA(&rt73usb_ops) },
2166 /* Gemtek */ 2167 /* Gemtek */
2167 { USB_DEVICE(0x15a9, 0x0004), USB_DEVICE_DATA(&rt73usb_ops) }, 2168 { USB_DEVICE(0x15a9, 0x0004), USB_DEVICE_DATA(&rt73usb_ops) },
2168 /* Gigabyte */ 2169 /* Gigabyte */