aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cpmac.c
diff options
context:
space:
mode:
authorMatteo Croce <technoboy85@gmail.com>2007-10-23 13:12:22 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-23 20:18:12 -0400
commit6cd043d99dcf5d252fcc682958541f449113f7b3 (patch)
tree6810ec9e3903b0efbe69be386cb4a37eb80ecaf2 /drivers/net/cpmac.c
parent02bae2129710018883f9536969de7e6acf9304ca (diff)
AR7 ethernet: small post-merge cleanups and fixes
Signed-off-by: Matteo Croce <technoboy85@gmail.com> Signed-off-by: Eugene Konev <ejka@imfi.kspu.ru> Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/cpmac.c')
-rw-r--r--drivers/net/cpmac.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index ae419736158e..57541d2d9e1e 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -460,18 +460,11 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
460 struct cpmac_desc *desc; 460 struct cpmac_desc *desc;
461 struct cpmac_priv *priv = netdev_priv(dev); 461 struct cpmac_priv *priv = netdev_priv(dev);
462 462
463 if (unlikely(skb_padto(skb, ETH_ZLEN))) { 463 if (unlikely(skb_padto(skb, ETH_ZLEN)))
464 if (netif_msg_tx_err(priv) && net_ratelimit()) 464 return NETDEV_TX_OK;
465 printk(KERN_WARNING
466 "%s: tx: padding failed, dropping\n", dev->name);
467 spin_lock(&priv->lock);
468 dev->stats.tx_dropped++;
469 spin_unlock(&priv->lock);
470 return -ENOMEM;
471 }
472 465
473 len = max(skb->len, ETH_ZLEN); 466 len = max(skb->len, ETH_ZLEN);
474 queue = skb_get_queue_mapping(skb); 467 queue = skb->queue_mapping;
475#ifdef CONFIG_NETDEVICES_MULTIQUEUE 468#ifdef CONFIG_NETDEVICES_MULTIQUEUE
476 netif_stop_subqueue(dev, queue); 469 netif_stop_subqueue(dev, queue);
477#else 470#else
@@ -481,13 +474,9 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
481 desc = &priv->desc_ring[queue]; 474 desc = &priv->desc_ring[queue];
482 if (unlikely(desc->dataflags & CPMAC_OWN)) { 475 if (unlikely(desc->dataflags & CPMAC_OWN)) {
483 if (netif_msg_tx_err(priv) && net_ratelimit()) 476 if (netif_msg_tx_err(priv) && net_ratelimit())
484 printk(KERN_WARNING "%s: tx dma ring full, dropping\n", 477 printk(KERN_WARNING "%s: tx dma ring full\n",
485 dev->name); 478 dev->name);
486 spin_lock(&priv->lock); 479 return NETDEV_TX_BUSY;
487 dev->stats.tx_dropped++;
488 spin_unlock(&priv->lock);
489 dev_kfree_skb_any(skb);
490 return -ENOMEM;
491 } 480 }
492 481
493 spin_lock(&priv->lock); 482 spin_lock(&priv->lock);
@@ -509,7 +498,7 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
509 cpmac_dump_skb(dev, skb); 498 cpmac_dump_skb(dev, skb);
510 cpmac_write(priv->regs, CPMAC_TX_PTR(queue), (u32)desc->mapping); 499 cpmac_write(priv->regs, CPMAC_TX_PTR(queue), (u32)desc->mapping);
511 500
512 return 0; 501 return NETDEV_TX_OK;
513} 502}
514 503
515static void cpmac_end_xmit(struct net_device *dev, int queue) 504static void cpmac_end_xmit(struct net_device *dev, int queue)
@@ -646,12 +635,14 @@ static void cpmac_clear_tx(struct net_device *dev)
646 int i; 635 int i;
647 if (unlikely(!priv->desc_ring)) 636 if (unlikely(!priv->desc_ring))
648 return; 637 return;
649 for (i = 0; i < CPMAC_QUEUES; i++) 638 for (i = 0; i < CPMAC_QUEUES; i++) {
639 priv->desc_ring[i].dataflags = 0;
650 if (priv->desc_ring[i].skb) { 640 if (priv->desc_ring[i].skb) {
651 dev_kfree_skb_any(priv->desc_ring[i].skb); 641 dev_kfree_skb_any(priv->desc_ring[i].skb);
652 if (netif_subqueue_stopped(dev, i)) 642 if (netif_subqueue_stopped(dev, i))
653 netif_wake_subqueue(dev, i); 643 netif_wake_subqueue(dev, i);
654 } 644 }
645 }
655} 646}
656 647
657static void cpmac_hw_error(struct work_struct *work) 648static void cpmac_hw_error(struct work_struct *work)
@@ -727,11 +718,13 @@ static void cpmac_tx_timeout(struct net_device *dev)
727#ifdef CONFIG_NETDEVICES_MULTIQUEUE 718#ifdef CONFIG_NETDEVICES_MULTIQUEUE
728 for (i = 0; i < CPMAC_QUEUES; i++) 719 for (i = 0; i < CPMAC_QUEUES; i++)
729 if (priv->desc_ring[i].skb) { 720 if (priv->desc_ring[i].skb) {
721 priv->desc_ring[i].dataflags = 0;
730 dev_kfree_skb_any(priv->desc_ring[i].skb); 722 dev_kfree_skb_any(priv->desc_ring[i].skb);
731 netif_wake_subqueue(dev, i); 723 netif_wake_subqueue(dev, i);
732 break; 724 break;
733 } 725 }
734#else 726#else
727 priv->desc_ring[0].dataflags = 0;
735 if (priv->desc_ring[0].skb) 728 if (priv->desc_ring[0].skb)
736 dev_kfree_skb_any(priv->desc_ring[0].skb); 729 dev_kfree_skb_any(priv->desc_ring[0].skb);
737 netif_wake_queue(dev); 730 netif_wake_queue(dev);
@@ -794,7 +787,7 @@ static int cpmac_set_ringparam(struct net_device *dev, struct ethtool_ringparam*
794{ 787{
795 struct cpmac_priv *priv = netdev_priv(dev); 788 struct cpmac_priv *priv = netdev_priv(dev);
796 789
797 if (dev->flags && IFF_UP) 790 if (netif_running(dev))
798 return -EBUSY; 791 return -EBUSY;
799 priv->ring_size = ring->rx_pending; 792 priv->ring_size = ring->rx_pending;
800 return 0; 793 return 0;