Skip to content

Commit

Permalink
[NETPOLL]: netpoll_send_skb simplify
Browse files Browse the repository at this point in the history
Minor netpoll_send_skb restructuring

Restructure to avoid confusing goto and move some bits out of the
retry loop.

Signed-off-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Matt Mackall authored and David S. Miller committed Aug 12, 2005
1 parent 6b0b315 commit f0d3459
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions net/core/netpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,14 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
int status;
struct netpoll_info *npinfo;

repeat:
if(!np || !np->dev || !netif_running(np->dev)) {
if (!np || !np->dev || !netif_running(np->dev)) {
__kfree_skb(skb);
return;
}

/* avoid recursion */
npinfo = np->dev->npinfo;

/* avoid recursion */
if (npinfo->poll_owner == smp_processor_id() ||
np->dev->xmit_lock_owner == smp_processor_id()) {
if (np->drop)
Expand All @@ -265,29 +265,31 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
return;
}

spin_lock(&np->dev->xmit_lock);
np->dev->xmit_lock_owner = smp_processor_id();
while (1) {
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
* stopped.
*/
if (netif_queue_stopped(np->dev)) {
/*
* network drivers do not expect to be called if the queue is
* stopped.
*/
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;
spin_unlock(&np->dev->xmit_lock);

netpoll_poll(np);
goto repeat;
}

status = np->dev->hard_start_xmit(skb, np->dev);
np->dev->xmit_lock_owner = -1;
spin_unlock(&np->dev->xmit_lock);
/* success */
if(!status)
return;

/* transmit busy */
if(status) {
/* transmit busy */
netpoll_poll(np);
goto repeat;
}
}

Expand Down

0 comments on commit f0d3459

Please sign in to comment.