Commit ddb27524 authored by Ingo Molnar's avatar Ingo Molnar Committed by Thomas Gleixner

net: clean up dev_queue_xmit() code flow

Flatten out the dev_queue_xmit() code flow. This keeps the
fall-through fast-path free for the compiler, and also helps code
readability.
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 543a589a
...@@ -1887,45 +1887,52 @@ gso: ...@@ -1887,45 +1887,52 @@ gso:
Check this and shot the lock. It is not prone from deadlocks. Check this and shot the lock. It is not prone from deadlocks.
Either shot noqueue qdisc, it is even simpler 8) Either shot noqueue qdisc, it is even simpler 8)
*/ */
if (dev->flags & IFF_UP) { if (!(dev->flags & IFF_UP))
int cpu = raw_smp_processor_id(); /* ok because BHs are off */ goto err;
/* /* Recursion is detected! It is possible, unfortunately: */
* No need to check for recursion with threaded interrupts: if (netif_tx_lock_recursion(txq))
*/ goto err_recursion;
if (!netif_tx_lock_recursion(txq)) {
HARD_TX_LOCK(dev, txq); HARD_TX_LOCK(dev, txq);
if (!netif_tx_queue_stopped(txq)) { if (netif_tx_queue_stopped(txq))
goto err_tx_unlock;
if (dev_hard_start_xmit(skb, dev, txq))
goto err_tx_unlock;
rc = 0; rc = 0;
if (!dev_hard_start_xmit(skb, dev, txq)) {
HARD_TX_UNLOCK(dev, txq); HARD_TX_UNLOCK(dev, txq);
goto out;
} out:
rcu_read_unlock_bh();
return rc;
err_recursion:
if (net_ratelimit()) {
printk(KERN_CRIT
"Dead loop on virtual device %s, fix it urgently!\n",
dev->name);
} }
goto err;
err_tx_unlock:
HARD_TX_UNLOCK(dev, txq); HARD_TX_UNLOCK(dev, txq);
if (net_ratelimit())
printk(KERN_CRIT "Virtual device %s asks to " if (net_ratelimit()) {
"queue packet!\n", dev->name); printk(KERN_CRIT "Virtual device %s asks to queue packet!\n",
} else { dev->name);
/* Recursion is detected! It is possible,
* unfortunately */
if (net_ratelimit())
printk(KERN_CRIT "Dead loop on virtual device "
"%s, fix it urgently!\n", dev->name);
}
} }
/* Fall through: */
err:
rc = -ENETDOWN; rc = -ENETDOWN;
rcu_read_unlock_bh(); rcu_read_unlock_bh();
out_kfree_skb: out_kfree_skb:
kfree_skb(skb); kfree_skb(skb);
return rc; return rc;
out:
rcu_read_unlock_bh();
return rc;
} }
......
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