diff options
author | Paul Mackerras <paulus@samba.org> | 2008-03-25 17:44:18 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-03-25 17:44:18 -0400 |
commit | 54f53f2b94feb72622bec7a8563fc487d9f97720 (patch) | |
tree | ab0c4e1dcadd25a00fa7a4febf41bc43b864cf73 /drivers/net | |
parent | f61fb8a52cdf8b9b6a6badde84aefe58cb35d315 (diff) | |
parent | a4083c9271e0a697278e089f2c0b9a95363ada0a (diff) |
Merge branch 'linux-2.6'
Diffstat (limited to 'drivers/net')
31 files changed, 392 insertions, 209 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/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/bnx2x.c b/drivers/net/bnx2x.c index 8af142ccf373..de32b3fba322 100644 --- a/drivers/net/bnx2x.c +++ b/drivers/net/bnx2x.c | |||
@@ -63,8 +63,8 @@ | |||
63 | #include "bnx2x.h" | 63 | #include "bnx2x.h" |
64 | #include "bnx2x_init.h" | 64 | #include "bnx2x_init.h" |
65 | 65 | ||
66 | #define DRV_MODULE_VERSION "1.40.22" | 66 | #define DRV_MODULE_VERSION "1.42.3" |
67 | #define DRV_MODULE_RELDATE "2007/11/27" | 67 | #define DRV_MODULE_RELDATE "2008/3/9" |
68 | #define BNX2X_BC_VER 0x040200 | 68 | #define BNX2X_BC_VER 0x040200 |
69 | 69 | ||
70 | /* Time in jiffies before concluding the transmitter is hung. */ | 70 | /* Time in jiffies before concluding the transmitter is hung. */ |
@@ -8008,38 +8008,6 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
8008 | cmd->duplex, cmd->port, cmd->phy_address, cmd->transceiver, | 8008 | cmd->duplex, cmd->port, cmd->phy_address, cmd->transceiver, |
8009 | cmd->autoneg, cmd->maxtxpkt, cmd->maxrxpkt); | 8009 | cmd->autoneg, cmd->maxtxpkt, cmd->maxrxpkt); |
8010 | 8010 | ||
8011 | switch (cmd->port) { | ||
8012 | case PORT_TP: | ||
8013 | if (!(bp->supported & SUPPORTED_TP)) { | ||
8014 | DP(NETIF_MSG_LINK, "TP not supported\n"); | ||
8015 | return -EINVAL; | ||
8016 | } | ||
8017 | |||
8018 | if (bp->phy_flags & PHY_XGXS_FLAG) { | ||
8019 | bnx2x_link_reset(bp); | ||
8020 | bnx2x_link_settings_supported(bp, SWITCH_CFG_1G); | ||
8021 | bnx2x_phy_deassert(bp); | ||
8022 | } | ||
8023 | break; | ||
8024 | |||
8025 | case PORT_FIBRE: | ||
8026 | if (!(bp->supported & SUPPORTED_FIBRE)) { | ||
8027 | DP(NETIF_MSG_LINK, "FIBRE not supported\n"); | ||
8028 | return -EINVAL; | ||
8029 | } | ||
8030 | |||
8031 | if (!(bp->phy_flags & PHY_XGXS_FLAG)) { | ||
8032 | bnx2x_link_reset(bp); | ||
8033 | bnx2x_link_settings_supported(bp, SWITCH_CFG_10G); | ||
8034 | bnx2x_phy_deassert(bp); | ||
8035 | } | ||
8036 | break; | ||
8037 | |||
8038 | default: | ||
8039 | DP(NETIF_MSG_LINK, "Unknown port type\n"); | ||
8040 | return -EINVAL; | ||
8041 | } | ||
8042 | |||
8043 | if (cmd->autoneg == AUTONEG_ENABLE) { | 8011 | if (cmd->autoneg == AUTONEG_ENABLE) { |
8044 | if (!(bp->supported & SUPPORTED_Autoneg)) { | 8012 | if (!(bp->supported & SUPPORTED_Autoneg)) { |
8045 | DP(NETIF_MSG_LINK, "Aotoneg not supported\n"); | 8013 | DP(NETIF_MSG_LINK, "Aotoneg not supported\n"); |
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/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 | ||
132 | IVb. References | 132 | IVb. References |
133 | 133 | ||
134 | http://www.smsc.com/main/datasheets/83c171.pdf | 134 | http://www.smsc.com/main/tools/discontinued/83c171.pdf |
135 | http://www.smsc.com/main/datasheets/83c175.pdf | 135 | http://www.smsc.com/main/tools/discontinued/83c175.pdf |
136 | http://scyld.com/expert/NWay.html | 136 | http://scyld.com/expert/NWay.html |
137 | http://www.national.com/pf/DP/DP83840A.html | 137 | http://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 | ||
232 | struct epic_tx_desc { | 237 | struct 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_mpc52xx_phy.c b/drivers/net/fec_mpc52xx_phy.c index 1837584c4504..6a3ac4ea97e9 100644 --- a/drivers/net/fec_mpc52xx_phy.c +++ b/drivers/net/fec_mpc52xx_phy.c | |||
@@ -109,7 +109,8 @@ static int mpc52xx_fec_mdio_probe(struct of_device *of, const struct of_device_i | |||
109 | int irq = irq_of_parse_and_map(child, 0); | 109 | int irq = irq_of_parse_and_map(child, 0); |
110 | if (irq != NO_IRQ) { | 110 | if (irq != NO_IRQ) { |
111 | const u32 *id = of_get_property(child, "reg", NULL); | 111 | const u32 *id = of_get_property(child, "reg", NULL); |
112 | bus->irq[*id] = irq; | 112 | if (id) |
113 | bus->irq[*id] = irq; | ||
113 | } | 114 | } |
114 | } | 115 | } |
115 | 116 | ||
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 | ||
188 | enum { | 189 | enum { |
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 */ |
639 | struct nv_ethtool_str { | 642 | struct 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 | ||
1777 | static void nv_drain_rx(struct net_device *dev) | 1799 | static 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 | ||
2107 | static 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 | ||
146 | static 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 */ |
147 | static const char emac_stats_keys[EMAC_ETHTOOL_STATS_COUNT][ETH_GSTRING_LEN] = { | 151 | static 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) | |||
155 | static struct of_device_id tah_match[] = | 155 | static 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/ifb.c b/drivers/net/ifb.c index 15949d3df17e..af233b591534 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/moduleparam.h> | 35 | #include <linux/moduleparam.h> |
36 | #include <net/pkt_sched.h> | 36 | #include <net/pkt_sched.h> |
37 | #include <net/net_namespace.h> | 37 | #include <net/net_namespace.h> |
38 | #include <linux/lockdep.h> | ||
38 | 39 | ||
39 | #define TX_TIMEOUT (2*HZ) | 40 | #define TX_TIMEOUT (2*HZ) |
40 | 41 | ||
@@ -227,6 +228,16 @@ static struct rtnl_link_ops ifb_link_ops __read_mostly = { | |||
227 | module_param(numifbs, int, 0); | 228 | module_param(numifbs, int, 0); |
228 | MODULE_PARM_DESC(numifbs, "Number of ifb devices"); | 229 | MODULE_PARM_DESC(numifbs, "Number of ifb devices"); |
229 | 230 | ||
231 | /* | ||
232 | * dev_ifb->queue_lock is usually taken after dev->ingress_lock, | ||
233 | * reversely to e.g. qdisc_lock_tree(). It should be safe until | ||
234 | * ifb doesn't take dev->queue_lock with dev_ifb->ingress_lock. | ||
235 | * But lockdep should know that ifb has different locks from dev. | ||
236 | */ | ||
237 | static struct lock_class_key ifb_queue_lock_key; | ||
238 | static struct lock_class_key ifb_ingress_lock_key; | ||
239 | |||
240 | |||
230 | static int __init ifb_init_one(int index) | 241 | static int __init ifb_init_one(int index) |
231 | { | 242 | { |
232 | struct net_device *dev_ifb; | 243 | struct net_device *dev_ifb; |
@@ -246,6 +257,10 @@ static int __init ifb_init_one(int index) | |||
246 | err = register_netdevice(dev_ifb); | 257 | err = register_netdevice(dev_ifb); |
247 | if (err < 0) | 258 | if (err < 0) |
248 | goto err; | 259 | goto err; |
260 | |||
261 | lockdep_set_class(&dev_ifb->queue_lock, &ifb_queue_lock_key); | ||
262 | lockdep_set_class(&dev_ifb->ingress_lock, &ifb_ingress_lock_key); | ||
263 | |||
249 | return 0; | 264 | return 0; |
250 | 265 | ||
251 | err: | 266 | err: |
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 | ||
1224 | static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 1224 | static 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/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/sungem.c b/drivers/net/sungem.c index 97212799c513..4291458955ef 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
@@ -912,7 +912,7 @@ static int gem_poll(struct napi_struct *napi, int budget) | |||
912 | * rx ring - must call napi_disable(), which | 912 | * rx ring - must call napi_disable(), which |
913 | * schedule_timeout()'s if polling is already disabled. | 913 | * schedule_timeout()'s if polling is already disabled. |
914 | */ | 914 | */ |
915 | work_done += gem_rx(gp, budget); | 915 | work_done += gem_rx(gp, budget - work_done); |
916 | 916 | ||
917 | if (work_done >= budget) | 917 | if (work_done >= budget) |
918 | return work_done; | 918 | return work_done; |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 26ffb67f1da2..f9ef8bd8b11e 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -64,8 +64,8 @@ | |||
64 | 64 | ||
65 | #define DRV_MODULE_NAME "tg3" | 65 | #define DRV_MODULE_NAME "tg3" |
66 | #define PFX DRV_MODULE_NAME ": " | 66 | #define PFX DRV_MODULE_NAME ": " |
67 | #define DRV_MODULE_VERSION "3.87" | 67 | #define DRV_MODULE_VERSION "3.88" |
68 | #define DRV_MODULE_RELDATE "December 20, 2007" | 68 | #define DRV_MODULE_RELDATE "March 20, 2008" |
69 | 69 | ||
70 | #define TG3_DEF_MAC_MODE 0 | 70 | #define TG3_DEF_MAC_MODE 0 |
71 | #define TG3_DEF_RX_MODE 0 | 71 | #define TG3_DEF_RX_MODE 0 |
@@ -11841,7 +11841,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp) | |||
11841 | } | 11841 | } |
11842 | 11842 | ||
11843 | if (!is_valid_ether_addr(&dev->dev_addr[0])) { | 11843 | if (!is_valid_ether_addr(&dev->dev_addr[0])) { |
11844 | #ifdef CONFIG_SPARC64 | 11844 | #ifdef CONFIG_SPARC |
11845 | if (!tg3_get_default_macaddr_sparc(tp)) | 11845 | if (!tg3_get_default_macaddr_sparc(tp)) |
11846 | return 0; | 11846 | return 0; |
11847 | #endif | 11847 | #endif |
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) | |||
842 | static void de_stop_rxtx (struct de_private *de) | 842 | static 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/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index 7e1f00131f91..df56a518691c 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c | |||
@@ -376,7 +376,7 @@ static int alloc_all_urbs(rtl8150_t * dev) | |||
376 | return 0; | 376 | return 0; |
377 | } | 377 | } |
378 | dev->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL); | 378 | dev->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL); |
379 | if (!dev->intr_urb) { | 379 | if (!dev->ctrl_urb) { |
380 | usb_free_urb(dev->rx_urb); | 380 | usb_free_urb(dev->rx_urb); |
381 | usb_free_urb(dev->tx_urb); | 381 | usb_free_urb(dev->tx_urb); |
382 | usb_free_urb(dev->intr_urb); | 382 | usb_free_urb(dev->intr_urb); |
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 | ||
302 | static 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 | |||
297 | static int virtnet_open(struct net_device *dev) | 310 | static 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/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c index c2de2d958e8e..01757436353d 100644 --- a/drivers/net/wireless/ath5k/hw.c +++ b/drivers/net/wireless/ath5k/hw.c | |||
@@ -427,6 +427,8 @@ void ath5k_hw_detach(struct ath5k_hw *ah) | |||
427 | { | 427 | { |
428 | ATH5K_TRACE(ah->ah_sc); | 428 | ATH5K_TRACE(ah->ah_sc); |
429 | 429 | ||
430 | __set_bit(ATH_STAT_INVALID, ah->ah_sc->status); | ||
431 | |||
430 | if (ah->ah_rf_banks != NULL) | 432 | if (ah->ah_rf_banks != NULL) |
431 | kfree(ah->ah_rf_banks); | 433 | kfree(ah->ah_rf_banks); |
432 | 434 | ||
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/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 05927b908f80..6c725422af5a 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -620,6 +620,9 @@ struct rt2x00_dev { | |||
620 | * This will only be compiled in when required. | 620 | * This will only be compiled in when required. |
621 | */ | 621 | */ |
622 | #ifdef CONFIG_RT2X00_LIB_RFKILL | 622 | #ifdef CONFIG_RT2X00_LIB_RFKILL |
623 | unsigned long rfkill_state; | ||
624 | #define RFKILL_STATE_ALLOCATED 1 | ||
625 | #define RFKILL_STATE_REGISTERED 2 | ||
623 | struct rfkill *rfkill; | 626 | struct rfkill *rfkill; |
624 | struct input_polled_dev *poll_dev; | 627 | struct input_polled_dev *poll_dev; |
625 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | 628 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 0d51f478bcdf..bd305f7f3efd 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -1098,7 +1098,7 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev) | |||
1098 | return; | 1098 | return; |
1099 | 1099 | ||
1100 | /* | 1100 | /* |
1101 | * Unregister rfkill. | 1101 | * Unregister extra components. |
1102 | */ | 1102 | */ |
1103 | rt2x00rfkill_unregister(rt2x00dev); | 1103 | rt2x00rfkill_unregister(rt2x00dev); |
1104 | 1104 | ||
@@ -1139,17 +1139,12 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev) | |||
1139 | __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags); | 1139 | __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags); |
1140 | 1140 | ||
1141 | /* | 1141 | /* |
1142 | * Register the rfkill handler. | 1142 | * Register the extra components. |
1143 | */ | 1143 | */ |
1144 | status = rt2x00rfkill_register(rt2x00dev); | 1144 | rt2x00rfkill_register(rt2x00dev); |
1145 | if (status) | ||
1146 | goto exit_unitialize; | ||
1147 | 1145 | ||
1148 | return 0; | 1146 | return 0; |
1149 | 1147 | ||
1150 | exit_unitialize: | ||
1151 | rt2x00lib_uninitialize(rt2x00dev); | ||
1152 | |||
1153 | exit: | 1148 | exit: |
1154 | rt2x00lib_free_ring_entries(rt2x00dev); | 1149 | rt2x00lib_free_ring_entries(rt2x00dev); |
1155 | 1150 | ||
@@ -1313,15 +1308,9 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
1313 | } | 1308 | } |
1314 | 1309 | ||
1315 | /* | 1310 | /* |
1316 | * Allocatie rfkill. | 1311 | * Register extra components. |
1317 | */ | ||
1318 | retval = rt2x00rfkill_allocate(rt2x00dev); | ||
1319 | if (retval) | ||
1320 | goto exit; | ||
1321 | |||
1322 | /* | ||
1323 | * Open the debugfs entry. | ||
1324 | */ | 1312 | */ |
1313 | rt2x00rfkill_allocate(rt2x00dev); | ||
1325 | rt2x00debug_register(rt2x00dev); | 1314 | rt2x00debug_register(rt2x00dev); |
1326 | 1315 | ||
1327 | __set_bit(DEVICE_PRESENT, &rt2x00dev->flags); | 1316 | __set_bit(DEVICE_PRESENT, &rt2x00dev->flags); |
@@ -1350,13 +1339,9 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) | |||
1350 | rt2x00lib_uninitialize(rt2x00dev); | 1339 | rt2x00lib_uninitialize(rt2x00dev); |
1351 | 1340 | ||
1352 | /* | 1341 | /* |
1353 | * Close debugfs entry. | 1342 | * Free extra components |
1354 | */ | 1343 | */ |
1355 | rt2x00debug_deregister(rt2x00dev); | 1344 | rt2x00debug_deregister(rt2x00dev); |
1356 | |||
1357 | /* | ||
1358 | * Free rfkill | ||
1359 | */ | ||
1360 | rt2x00rfkill_free(rt2x00dev); | 1345 | rt2x00rfkill_free(rt2x00dev); |
1361 | 1346 | ||
1362 | /* | 1347 | /* |
@@ -1395,11 +1380,15 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state) | |||
1395 | __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags); | 1380 | __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags); |
1396 | 1381 | ||
1397 | /* | 1382 | /* |
1398 | * Disable radio and unitialize all items | 1383 | * Disable radio. |
1399 | * that must be recreated on resume. | ||
1400 | */ | 1384 | */ |
1401 | rt2x00lib_stop(rt2x00dev); | 1385 | rt2x00lib_stop(rt2x00dev); |
1402 | rt2x00lib_uninitialize(rt2x00dev); | 1386 | rt2x00lib_uninitialize(rt2x00dev); |
1387 | |||
1388 | /* | ||
1389 | * Suspend/disable extra components. | ||
1390 | */ | ||
1391 | rt2x00rfkill_suspend(rt2x00dev); | ||
1403 | rt2x00debug_deregister(rt2x00dev); | 1392 | rt2x00debug_deregister(rt2x00dev); |
1404 | 1393 | ||
1405 | exit: | 1394 | exit: |
@@ -1422,9 +1411,10 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev) | |||
1422 | NOTICE(rt2x00dev, "Waking up.\n"); | 1411 | NOTICE(rt2x00dev, "Waking up.\n"); |
1423 | 1412 | ||
1424 | /* | 1413 | /* |
1425 | * Open the debugfs entry. | 1414 | * Restore/enable extra components. |
1426 | */ | 1415 | */ |
1427 | rt2x00debug_register(rt2x00dev); | 1416 | rt2x00debug_register(rt2x00dev); |
1417 | rt2x00rfkill_resume(rt2x00dev); | ||
1428 | 1418 | ||
1429 | /* | 1419 | /* |
1430 | * Only continue if mac80211 had open interfaces. | 1420 | * Only continue if mac80211 had open interfaces. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h index 1adbd28e0973..ce58c654ade1 100644 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h | |||
@@ -100,28 +100,36 @@ static inline void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev, | |||
100 | * RFkill handlers. | 100 | * RFkill handlers. |
101 | */ | 101 | */ |
102 | #ifdef CONFIG_RT2X00_LIB_RFKILL | 102 | #ifdef CONFIG_RT2X00_LIB_RFKILL |
103 | int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev); | 103 | void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev); |
104 | void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev); | 104 | void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev); |
105 | int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev); | 105 | void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev); |
106 | void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev); | 106 | void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev); |
107 | void rt2x00rfkill_suspend(struct rt2x00_dev *rt2x00dev); | ||
108 | void rt2x00rfkill_resume(struct rt2x00_dev *rt2x00dev); | ||
107 | #else | 109 | #else |
108 | static inline int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) | 110 | static inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) |
109 | { | 111 | { |
110 | return 0; | ||
111 | } | 112 | } |
112 | 113 | ||
113 | static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) | 114 | static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) |
114 | { | 115 | { |
115 | } | 116 | } |
116 | 117 | ||
117 | static inline int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) | 118 | static inline void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) |
118 | { | 119 | { |
119 | return 0; | ||
120 | } | 120 | } |
121 | 121 | ||
122 | static inline void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) | 122 | static inline void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) |
123 | { | 123 | { |
124 | } | 124 | } |
125 | |||
126 | static inline void rt2x00rfkill_suspend(struct rt2x00_dev *rt2x00dev) | ||
127 | { | ||
128 | } | ||
129 | |||
130 | static inline void rt2x00rfkill_resume(struct rt2x00_dev *rt2x00dev) | ||
131 | { | ||
132 | } | ||
125 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | 133 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ |
126 | 134 | ||
127 | #endif /* RT2X00LIB_H */ | 135 | #endif /* RT2X00LIB_H */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00rfkill.c b/drivers/net/wireless/rt2x00/rt2x00rfkill.c index 34a96d44e306..f95577596206 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 | ||
72 | int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) | 72 | void 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 | ||
102 | void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) | 99 | void 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 | ||
111 | int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) | 111 | static struct input_polled_dev * |
112 | rt2x00rfkill_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 | ||
137 | void 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; | 165 | void 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 | ||
151 | exit_free_rfkill: | ||
152 | rfkill_free(rt2x00dev->rfkill); | 174 | rfkill_free(rt2x00dev->rfkill); |
153 | 175 | rt2x00dev->rfkill = NULL; | |
154 | exit: | ||
155 | return -ENOMEM; | ||
156 | } | 176 | } |
157 | 177 | ||
158 | void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) | 178 | void 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 | |||
188 | void 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 | } |