Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 214799
b: refs/heads/master
c: 745e20f
h: refs/heads/master
i:
  214797: 195c6a1
  214795: f7c2716
  214791: 6ad6af4
  214783: 3774622
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Sep 29, 2010
1 parent 75c4a7f commit 25d3c31
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ab79ad14a2d51e95f0ac3cef7cd116a57089ba82
refs/heads/master: 745e20f1b626b1be4b100af5d4bf7b3439392f8f
12 changes: 11 additions & 1 deletion trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2177,6 +2177,9 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
return rc;
}

static DEFINE_PER_CPU(int, xmit_recursion);
#define RECURSION_LIMIT 3

/**
* dev_queue_xmit - transmit a buffer
* @skb: buffer to transmit
Expand Down Expand Up @@ -2242,10 +2245,15 @@ int dev_queue_xmit(struct sk_buff *skb)

if (txq->xmit_lock_owner != cpu) {

if (__this_cpu_read(xmit_recursion) > RECURSION_LIMIT)
goto recursion_alert;

HARD_TX_LOCK(dev, txq, cpu);

if (!netif_tx_queue_stopped(txq)) {
__this_cpu_inc(xmit_recursion);
rc = dev_hard_start_xmit(skb, dev, txq);
__this_cpu_dec(xmit_recursion);
if (dev_xmit_complete(rc)) {
HARD_TX_UNLOCK(dev, txq);
goto out;
Expand All @@ -2257,7 +2265,9 @@ int dev_queue_xmit(struct sk_buff *skb)
"queue packet!\n", dev->name);
} else {
/* Recursion is detected! It is possible,
* unfortunately */
* unfortunately
*/
recursion_alert:
if (net_ratelimit())
printk(KERN_CRIT "Dead loop on virtual device "
"%s, fix it urgently!\n", dev->name);
Expand Down

0 comments on commit 25d3c31

Please sign in to comment.