aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ipg.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/net/ipg.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/net/ipg.c')
-rw-r--r--drivers/net/ipg.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index 9f7b5d4172b8..639bf9fb0279 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -22,6 +22,7 @@
22 */ 22 */
23#include <linux/crc32.h> 23#include <linux/crc32.h>
24#include <linux/ethtool.h> 24#include <linux/ethtool.h>
25#include <linux/gfp.h>
25#include <linux/mii.h> 26#include <linux/mii.h>
26#include <linux/mutex.h> 27#include <linux/mutex.h>
27 28
@@ -88,17 +89,15 @@ static const char *ipg_brand_name[] = {
88 "Sundance Technology ST2021 based NIC", 89 "Sundance Technology ST2021 based NIC",
89 "Tamarack Microelectronics TC9020/9021 based NIC", 90 "Tamarack Microelectronics TC9020/9021 based NIC",
90 "Tamarack Microelectronics TC9020/9021 based NIC", 91 "Tamarack Microelectronics TC9020/9021 based NIC",
91 "D-Link NIC",
92 "D-Link NIC IP1000A" 92 "D-Link NIC IP1000A"
93}; 93};
94 94
95static struct pci_device_id ipg_pci_tbl[] __devinitdata = { 95static DEFINE_PCI_DEVICE_TABLE(ipg_pci_tbl) = {
96 { PCI_VDEVICE(SUNDANCE, 0x1023), 0 }, 96 { PCI_VDEVICE(SUNDANCE, 0x1023), 0 },
97 { PCI_VDEVICE(SUNDANCE, 0x2021), 1 }, 97 { PCI_VDEVICE(SUNDANCE, 0x2021), 1 },
98 { PCI_VDEVICE(SUNDANCE, 0x1021), 2 }, 98 { PCI_VDEVICE(SUNDANCE, 0x1021), 2 },
99 { PCI_VDEVICE(DLINK, 0x9021), 3 }, 99 { PCI_VDEVICE(DLINK, 0x9021), 3 },
100 { PCI_VDEVICE(DLINK, 0x4000), 4 }, 100 { PCI_VDEVICE(DLINK, 0x4020), 4 },
101 { PCI_VDEVICE(DLINK, 0x4020), 5 },
102 { 0, } 101 { 0, }
103}; 102};
104 103
@@ -585,11 +584,11 @@ static void ipg_nic_set_multicast_list(struct net_device *dev)
585 receivemode = IPG_RM_RECEIVEALLFRAMES; 584 receivemode = IPG_RM_RECEIVEALLFRAMES;
586 } else if ((dev->flags & IFF_ALLMULTI) || 585 } else if ((dev->flags & IFF_ALLMULTI) ||
587 ((dev->flags & IFF_MULTICAST) && 586 ((dev->flags & IFF_MULTICAST) &&
588 (dev->mc_count > IPG_MULTICAST_HASHTABLE_SIZE))) { 587 (netdev_mc_count(dev) > IPG_MULTICAST_HASHTABLE_SIZE))) {
589 /* NIC to be configured to receive all multicast 588 /* NIC to be configured to receive all multicast
590 * frames. */ 589 * frames. */
591 receivemode |= IPG_RM_RECEIVEMULTICAST; 590 receivemode |= IPG_RM_RECEIVEMULTICAST;
592 } else if ((dev->flags & IFF_MULTICAST) && (dev->mc_count > 0)) { 591 } else if ((dev->flags & IFF_MULTICAST) && !netdev_mc_empty(dev)) {
593 /* NIC to be configured to receive selected 592 /* NIC to be configured to receive selected
594 * multicast addresses. */ 593 * multicast addresses. */
595 receivemode |= IPG_RM_RECEIVEMULTICASTHASH; 594 receivemode |= IPG_RM_RECEIVEMULTICASTHASH;
@@ -610,8 +609,7 @@ static void ipg_nic_set_multicast_list(struct net_device *dev)
610 hashtable[1] = 0x00000000; 609 hashtable[1] = 0x00000000;
611 610
612 /* Cycle through all multicast addresses to filter. */ 611 /* Cycle through all multicast addresses to filter. */
613 for (mc_list_ptr = dev->mc_list; 612 netdev_for_each_mc_addr(mc_list_ptr, dev) {
614 mc_list_ptr != NULL; mc_list_ptr = mc_list_ptr->next) {
615 /* Calculate CRC result for each multicast address. */ 613 /* Calculate CRC result for each multicast address. */
616 hashindex = crc32_le(0xffffffff, mc_list_ptr->dmi_addr, 614 hashindex = crc32_le(0xffffffff, mc_list_ptr->dmi_addr,
617 ETH_ALEN); 615 ETH_ALEN);
@@ -738,17 +736,12 @@ static int ipg_get_rxbuff(struct net_device *dev, int entry)
738 736
739 IPG_DEBUG_MSG("_get_rxbuff\n"); 737 IPG_DEBUG_MSG("_get_rxbuff\n");
740 738
741 skb = netdev_alloc_skb(dev, sp->rxsupport_size + NET_IP_ALIGN); 739 skb = netdev_alloc_skb_ip_align(dev, sp->rxsupport_size);
742 if (!skb) { 740 if (!skb) {
743 sp->rx_buff[entry] = NULL; 741 sp->rx_buff[entry] = NULL;
744 return -ENOMEM; 742 return -ENOMEM;
745 } 743 }
746 744
747 /* Adjust the data start location within the buffer to
748 * align IP address field to a 16 byte boundary.
749 */
750 skb_reserve(skb, NET_IP_ALIGN);
751
752 /* Associate the receive buffer with the IPG NIC. */ 745 /* Associate the receive buffer with the IPG NIC. */
753 skb->dev = dev; 746 skb->dev = dev;
754 747
@@ -1756,7 +1749,7 @@ static int ipg_nic_open(struct net_device *dev)
1756 /* Register the interrupt line to be used by the IPG within 1749 /* Register the interrupt line to be used by the IPG within
1757 * the Linux system. 1750 * the Linux system.
1758 */ 1751 */
1759 rc = request_irq(pdev->irq, &ipg_interrupt_handler, IRQF_SHARED, 1752 rc = request_irq(pdev->irq, ipg_interrupt_handler, IRQF_SHARED,
1760 dev->name, dev); 1753 dev->name, dev);
1761 if (rc < 0) { 1754 if (rc < 0) {
1762 printk(KERN_INFO "%s: Error when requesting interrupt.\n", 1755 printk(KERN_INFO "%s: Error when requesting interrupt.\n",