diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/net/bcm63xx_enet.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/net/bcm63xx_enet.c')
-rw-r--r-- | drivers/net/bcm63xx_enet.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/net/bcm63xx_enet.c b/drivers/net/bcm63xx_enet.c index ba29dc319b34..17460aba3bae 100644 --- a/drivers/net/bcm63xx_enet.c +++ b/drivers/net/bcm63xx_enet.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
23 | #include <linux/etherdevice.h> | 23 | #include <linux/etherdevice.h> |
24 | #include <linux/slab.h> | ||
24 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
25 | #include <linux/ethtool.h> | 26 | #include <linux/ethtool.h> |
26 | #include <linux/crc32.h> | 27 | #include <linux/crc32.h> |
@@ -320,16 +321,13 @@ static int bcm_enet_receive_queue(struct net_device *dev, int budget) | |||
320 | if (len < copybreak) { | 321 | if (len < copybreak) { |
321 | struct sk_buff *nskb; | 322 | struct sk_buff *nskb; |
322 | 323 | ||
323 | nskb = netdev_alloc_skb(dev, len + NET_IP_ALIGN); | 324 | nskb = netdev_alloc_skb_ip_align(dev, len); |
324 | if (!nskb) { | 325 | if (!nskb) { |
325 | /* forget packet, just rearm desc */ | 326 | /* forget packet, just rearm desc */ |
326 | priv->stats.rx_dropped++; | 327 | priv->stats.rx_dropped++; |
327 | continue; | 328 | continue; |
328 | } | 329 | } |
329 | 330 | ||
330 | /* since we're copying the data, we can align | ||
331 | * them properly */ | ||
332 | skb_reserve(nskb, NET_IP_ALIGN); | ||
333 | dma_sync_single_for_cpu(kdev, desc->address, | 331 | dma_sync_single_for_cpu(kdev, desc->address, |
334 | len, DMA_FROM_DEVICE); | 332 | len, DMA_FROM_DEVICE); |
335 | memcpy(nskb->data, skb->data, len); | 333 | memcpy(nskb->data, skb->data, len); |
@@ -622,7 +620,7 @@ static void bcm_enet_set_multicast_list(struct net_device *dev) | |||
622 | 620 | ||
623 | /* only 3 perfect match registers left, first one is used for | 621 | /* only 3 perfect match registers left, first one is used for |
624 | * own mac address */ | 622 | * own mac address */ |
625 | if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > 3) | 623 | if ((dev->flags & IFF_ALLMULTI) || netdev_mc_count(dev) > 3) |
626 | val |= ENET_RXCFG_ALLMCAST_MASK; | 624 | val |= ENET_RXCFG_ALLMCAST_MASK; |
627 | else | 625 | else |
628 | val &= ~ENET_RXCFG_ALLMCAST_MASK; | 626 | val &= ~ENET_RXCFG_ALLMCAST_MASK; |
@@ -634,16 +632,13 @@ static void bcm_enet_set_multicast_list(struct net_device *dev) | |||
634 | return; | 632 | return; |
635 | } | 633 | } |
636 | 634 | ||
637 | for (i = 0, mc_list = dev->mc_list; | 635 | i = 0; |
638 | (mc_list != NULL) && (i < dev->mc_count) && (i < 3); | 636 | netdev_for_each_mc_addr(mc_list, dev) { |
639 | i++, mc_list = mc_list->next) { | ||
640 | u8 *dmi_addr; | 637 | u8 *dmi_addr; |
641 | u32 tmp; | 638 | u32 tmp; |
642 | 639 | ||
643 | /* filter non ethernet address */ | 640 | if (i == 3) |
644 | if (mc_list->dmi_addrlen != 6) | 641 | break; |
645 | continue; | ||
646 | |||
647 | /* update perfect match registers */ | 642 | /* update perfect match registers */ |
648 | dmi_addr = mc_list->dmi_addr; | 643 | dmi_addr = mc_list->dmi_addr; |
649 | tmp = (dmi_addr[2] << 24) | (dmi_addr[3] << 16) | | 644 | tmp = (dmi_addr[2] << 24) | (dmi_addr[3] << 16) | |
@@ -652,7 +647,7 @@ static void bcm_enet_set_multicast_list(struct net_device *dev) | |||
652 | 647 | ||
653 | tmp = (dmi_addr[0] << 8 | dmi_addr[1]); | 648 | tmp = (dmi_addr[0] << 8 | dmi_addr[1]); |
654 | tmp |= ENET_PMH_DATAVALID_MASK; | 649 | tmp |= ENET_PMH_DATAVALID_MASK; |
655 | enet_writel(priv, tmp, ENET_PMH_REG(i + 1)); | 650 | enet_writel(priv, tmp, ENET_PMH_REG(i++ + 1)); |
656 | } | 651 | } |
657 | 652 | ||
658 | for (; i < 3; i++) { | 653 | for (; i < 3; i++) { |
@@ -1248,9 +1243,15 @@ static void bcm_enet_get_drvinfo(struct net_device *netdev, | |||
1248 | drvinfo->n_stats = BCM_ENET_STATS_LEN; | 1243 | drvinfo->n_stats = BCM_ENET_STATS_LEN; |
1249 | } | 1244 | } |
1250 | 1245 | ||
1251 | static int bcm_enet_get_stats_count(struct net_device *netdev) | 1246 | static int bcm_enet_get_sset_count(struct net_device *netdev, |
1247 | int string_set) | ||
1252 | { | 1248 | { |
1253 | return BCM_ENET_STATS_LEN; | 1249 | switch (string_set) { |
1250 | case ETH_SS_STATS: | ||
1251 | return BCM_ENET_STATS_LEN; | ||
1252 | default: | ||
1253 | return -EINVAL; | ||
1254 | } | ||
1254 | } | 1255 | } |
1255 | 1256 | ||
1256 | static void bcm_enet_get_strings(struct net_device *netdev, | 1257 | static void bcm_enet_get_strings(struct net_device *netdev, |
@@ -1476,7 +1477,7 @@ static int bcm_enet_set_pauseparam(struct net_device *dev, | |||
1476 | 1477 | ||
1477 | static struct ethtool_ops bcm_enet_ethtool_ops = { | 1478 | static struct ethtool_ops bcm_enet_ethtool_ops = { |
1478 | .get_strings = bcm_enet_get_strings, | 1479 | .get_strings = bcm_enet_get_strings, |
1479 | .get_stats_count = bcm_enet_get_stats_count, | 1480 | .get_sset_count = bcm_enet_get_sset_count, |
1480 | .get_ethtool_stats = bcm_enet_get_ethtool_stats, | 1481 | .get_ethtool_stats = bcm_enet_get_ethtool_stats, |
1481 | .get_settings = bcm_enet_get_settings, | 1482 | .get_settings = bcm_enet_get_settings, |
1482 | .set_settings = bcm_enet_set_settings, | 1483 | .set_settings = bcm_enet_set_settings, |