提交 f0d3459d 编写于 作者: M Matt Mackall 提交者: David S. Miller

[NETPOLL]: netpoll_send_skb simplify

Minor netpoll_send_skb restructuring

Restructure to avoid confusing goto and move some bits out of the
retry loop.
Signed-off-by: NMatt Mackall <mpm@selenic.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 6b0b3157
...@@ -248,14 +248,14 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) ...@@ -248,14 +248,14 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
int status; int status;
struct netpoll_info *npinfo; struct netpoll_info *npinfo;
repeat: if (!np || !np->dev || !netif_running(np->dev)) {
if(!np || !np->dev || !netif_running(np->dev)) {
__kfree_skb(skb); __kfree_skb(skb);
return; return;
} }
/* avoid recursion */
npinfo = np->dev->npinfo; npinfo = np->dev->npinfo;
/* avoid recursion */
if (npinfo->poll_owner == smp_processor_id() || if (npinfo->poll_owner == smp_processor_id() ||
np->dev->xmit_lock_owner == smp_processor_id()) { np->dev->xmit_lock_owner == smp_processor_id()) {
if (np->drop) if (np->drop)
...@@ -265,29 +265,31 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) ...@@ -265,29 +265,31 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
return; return;
} }
spin_lock(&np->dev->xmit_lock); while (1) {
np->dev->xmit_lock_owner = smp_processor_id(); spin_lock(&np->dev->xmit_lock);
np->dev->xmit_lock_owner = smp_processor_id();
/* /*
* network drivers do not expect to be called if the queue is * network drivers do not expect to be called if the queue is
* stopped. * stopped.
*/ */
if (netif_queue_stopped(np->dev)) { if (netif_queue_stopped(np->dev)) {
np->dev->xmit_lock_owner = -1;
spin_unlock(&np->dev->xmit_lock);
netpoll_poll(np);
continue;
}
status = np->dev->hard_start_xmit(skb, np->dev);
np->dev->xmit_lock_owner = -1; np->dev->xmit_lock_owner = -1;
spin_unlock(&np->dev->xmit_lock); spin_unlock(&np->dev->xmit_lock);
netpoll_poll(np); /* success */
goto repeat; if(!status)
} return;
status = np->dev->hard_start_xmit(skb, np->dev);
np->dev->xmit_lock_owner = -1;
spin_unlock(&np->dev->xmit_lock);
/* transmit busy */ /* transmit busy */
if(status) {
netpoll_poll(np); netpoll_poll(np);
goto repeat;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册