Commit 94ca8643 authored by Jamal Hadi Salim's avatar Jamal Hadi Salim Committed by David S. Miller

[NET]: Use NETDEV_TX_* macros instead of magic numbers.

Signed-off-by: default avatarJamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 39cdeef7
...@@ -1778,7 +1778,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -1778,7 +1778,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
if(unlikely(skb->len <= 0)) { if(unlikely(skb->len <= 0)) {
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
return 0; return NETDEV_TX_OK;
} }
#ifdef NETIF_F_TSO #ifdef NETIF_F_TSO
...@@ -1817,7 +1817,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -1817,7 +1817,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
if (!spin_trylock(&adapter->tx_lock)) { if (!spin_trylock(&adapter->tx_lock)) {
/* Collision - tell upper layer to requeue */ /* Collision - tell upper layer to requeue */
local_irq_restore(flags); local_irq_restore(flags);
return -1; return NETDEV_TX_LOCKED;
} }
/* need: count + 2 desc gap to keep tail from touching /* need: count + 2 desc gap to keep tail from touching
...@@ -1825,7 +1825,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -1825,7 +1825,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
if(E1000_DESC_UNUSED(&adapter->tx_ring) < count + 2) { if(E1000_DESC_UNUSED(&adapter->tx_ring) < count + 2) {
netif_stop_queue(netdev); netif_stop_queue(netdev);
spin_unlock_irqrestore(&adapter->tx_lock, flags); spin_unlock_irqrestore(&adapter->tx_lock, flags);
return 1; return NETDEV_TX_BUSY;
} }
if(unlikely(adapter->hw.mac_type == e1000_82547)) { if(unlikely(adapter->hw.mac_type == e1000_82547)) {
...@@ -1833,7 +1833,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -1833,7 +1833,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
netif_stop_queue(netdev); netif_stop_queue(netdev);
mod_timer(&adapter->tx_fifo_stall_timer, jiffies); mod_timer(&adapter->tx_fifo_stall_timer, jiffies);
spin_unlock_irqrestore(&adapter->tx_lock, flags); spin_unlock_irqrestore(&adapter->tx_lock, flags);
return 1; return NETDEV_TX_BUSY;
} }
} }
...@@ -1856,7 +1856,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -1856,7 +1856,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
netdev->trans_start = jiffies; netdev->trans_start = jiffies;
spin_unlock_irqrestore(&adapter->tx_lock, flags); spin_unlock_irqrestore(&adapter->tx_lock, flags);
return 0; return NETDEV_TX_OK;
} }
/** /**
......
...@@ -3016,7 +3016,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -3016,7 +3016,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
local_irq_save(flags); local_irq_save(flags);
if (!spin_trylock(&tp->tx_lock)) { if (!spin_trylock(&tp->tx_lock)) {
local_irq_restore(flags); local_irq_restore(flags);
return -1; return NETDEV_TX_LOCKED;
} }
/* This is a hard error, log it. */ /* This is a hard error, log it. */
...@@ -3025,7 +3025,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -3025,7 +3025,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
spin_unlock_irqrestore(&tp->tx_lock, flags); spin_unlock_irqrestore(&tp->tx_lock, flags);
printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n", printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n",
dev->name); dev->name);
return 1; return NETDEV_TX_BUSY;
} }
entry = tp->tx_prod; entry = tp->tx_prod;
...@@ -3176,7 +3176,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -3176,7 +3176,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
dev->trans_start = jiffies; dev->trans_start = jiffies;
return 0; return NETDEV_TX_OK;
} }
static inline void tg3_set_mtu(struct net_device *dev, struct tg3 *tp, static inline void tg3_set_mtu(struct net_device *dev, struct tg3 *tp,
......
...@@ -73,6 +73,11 @@ struct ethtool_ops; ...@@ -73,6 +73,11 @@ struct ethtool_ops;
#define MAX_ADDR_LEN 32 /* Largest hardware address length */ #define MAX_ADDR_LEN 32 /* Largest hardware address length */
/* Driver transmit return codes */
#define NETDEV_TX_OK 0 /* driver took care of packet */
#define NETDEV_TX_BUSY 1 /* driver tx path was busy*/
#define NETDEV_TX_LOCKED -1 /* driver tx lock was already taken */
/* /*
* Compute the worst case header length according to the protocols * Compute the worst case header length according to the protocols
* used. * used.
......
...@@ -139,13 +139,8 @@ int qdisc_restart(struct net_device *dev) ...@@ -139,13 +139,8 @@ int qdisc_restart(struct net_device *dev)
if (netdev_nit) if (netdev_nit)
dev_queue_xmit_nit(skb, dev); dev_queue_xmit_nit(skb, dev);
/* hard_start_xmit returns:
0 device not ready
1 everything ok
-1 didn't get device lock (for LLTX)
*/
ret = dev->hard_start_xmit(skb, dev); ret = dev->hard_start_xmit(skb, dev);
if (ret == 0) { if (ret == NETDEV_TX_OK) {
if (!nolock) { if (!nolock) {
dev->xmit_lock_owner = -1; dev->xmit_lock_owner = -1;
spin_unlock(&dev->xmit_lock); spin_unlock(&dev->xmit_lock);
...@@ -153,10 +148,11 @@ int qdisc_restart(struct net_device *dev) ...@@ -153,10 +148,11 @@ int qdisc_restart(struct net_device *dev)
spin_lock(&dev->queue_lock); spin_lock(&dev->queue_lock);
return -1; return -1;
} }
if (ret == -1 && nolock) if (ret == NETDEV_TX_LOCKED && nolock)
goto collision; goto collision;
} }
/* NETDEV_TX_BUSY - we need to requeue */
/* Release the driver */ /* Release the driver */
if (!nolock) { if (!nolock) {
dev->xmit_lock_owner = -1; dev->xmit_lock_owner = -1;
...@@ -176,7 +172,7 @@ int qdisc_restart(struct net_device *dev) ...@@ -176,7 +172,7 @@ int qdisc_restart(struct net_device *dev)
3. device is buggy (ppp) 3. device is buggy (ppp)
*/ */
requeue: requeue:
q->ops->requeue(skb, q); q->ops->requeue(skb, q);
netif_schedule(dev); netif_schedule(dev);
return 1; return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment