aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/cpmac.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-23 18:56:54 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-23 18:56:54 -0700
commit5a0e554b62dc77709ceebb6326b292bdd8d2c342 (patch)
treee3c960a526b13a27b6de33a5bc3be580ac0fa231 /drivers/net/cpmac.c
parentc09b360a2b0779e08bacb88d3fcd8458ebc49658 (diff)
parent2c800093c7375e358f28eeb132512eb57b6389e3 (diff)
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (39 commits) Remove Andrew Morton from list of net driver maintainers. bonding: Acquire correct locks in alb for promisc change bonding: Convert more locks to _bh, acquire rtnl, for new locking bonding: Convert locks to _bh, rework alb locking for new locking bonding: Convert miimon to new locking bonding: Convert balance-rr transmit to new locking Convert bonding timers to workqueues Update MAINTAINERS to reflect my (jgarzik's) current efforts. pasemi_mac: fix typo defxx.c: dfx_bus_init() is __devexit not __devinit s390 MAINTAINERS remove header_ops bug in qeth driver sky2: crash on remove MIPSnet: Delete all the useless debugging printks. AR7 ethernet: small post-merge cleanups and fixes mv643xx_eth: Hook up mv643xx_get_sset_count mv643xx_eth: Remove obsolete checksum offload comment mv643xx_eth: Merge drivers/net/mv643xx_eth.h into mv643xx_eth.c mv643xx_eth: Remove unused register defines mv643xx_eth: Clean up mv643xx_eth.h ...
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 ae419736158..57541d2d9e1 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)
struct cpmac_desc *desc;
struct cpmac_priv *priv = netdev_priv(dev);
- if (unlikely(skb_padto(skb, ETH_ZLEN))) {
- if (netif_msg_tx_err(priv) && net_ratelimit())
- printk(KERN_WARNING
- "%s: tx: padding failed, dropping\n", dev->name);
- spin_lock(&priv->lock);
- dev->stats.tx_dropped++;
- spin_unlock(&priv->lock);
- return -ENOMEM;
- }
+ if (unlikely(skb_padto(skb, ETH_ZLEN)))
+ return NETDEV_TX_OK;
len = max(skb->len, ETH_ZLEN);
- queue = skb_get_queue_mapping(skb);
+ queue = skb->queue_mapping;
#ifdef CONFIG_NETDEVICES_MULTIQUEUE
netif_stop_subqueue(dev, queue);
#else
@@ -481,13 +474,9 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
desc = &priv->desc_ring[queue];
if (unlikely(desc->dataflags & CPMAC_OWN)) {
if (netif_msg_tx_err(priv) && net_ratelimit())
- printk(KERN_WARNING "%s: tx dma ring full, dropping\n",
+ printk(KERN_WARNING "%s: tx dma ring full\n",
dev->name);
- spin_lock(&priv->lock);
- dev->stats.tx_dropped++;
- spin_unlock(&priv->lock);
- dev_kfree_skb_any(skb);
- return -ENOMEM;
+ return NETDEV_TX_BUSY;
}
spin_lock(&priv->lock);
@@ -509,7 +498,7 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
cpmac_dump_skb(dev, skb);
cpmac_write(priv->regs, CPMAC_TX_PTR(queue), (u32)desc->mapping);
- return 0;
+ return NETDEV_TX_OK;
}
static void cpmac_end_xmit(struct net_device *dev, int queue)
@@ -646,12 +635,14 @@ static void cpmac_clear_tx(struct net_device *dev)
int i;
if (unlikely(!priv->desc_ring))
return;
- for (i = 0; i < CPMAC_QUEUES; i++)
+ for (i = 0; i < CPMAC_QUEUES; i++) {
+ priv->desc_ring[i].dataflags = 0;
if (priv->desc_ring[i].skb) {
dev_kfree_skb_any(priv->desc_ring[i].skb);
if (netif_subqueue_stopped(dev, i))
netif_wake_subqueue(dev, i);
}
+ }
}
static void cpmac_hw_error(struct work_struct *work)
@@ -727,11 +718,13 @@ static void cpmac_tx_timeout(struct net_device *dev)
#ifdef CONFIG_NETDEVICES_MULTIQUEUE
for (i = 0; i < CPMAC_QUEUES; i++)
if (priv->desc_ring[i].skb) {
+ priv->desc_ring[i].dataflags = 0;
dev_kfree_skb_any(priv->desc_ring[i].skb);
netif_wake_subqueue(dev, i);
break;
}
#else
+ priv->desc_ring[0].dataflags = 0;
if (priv->desc_ring[0].skb)
dev_kfree_skb_any(priv->desc_ring[0].skb);
netif_wake_queue(dev);
@@ -794,7 +787,7 @@ static int cpmac_set_ringparam(struct net_device *dev, struct ethtool_ringparam*
{
struct cpmac_priv *priv = netdev_priv(dev);
- if (dev->flags && IFF_UP)
+ if (netif_running(dev))
return -EBUSY;
priv->ring_size = ring->rx_pending;
return 0;