aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-08-27 09:55:14 -0400
committerDavid S. Miller <davem@davemloft.net>2009-08-29 02:32:07 -0400
commit5b8db2f568c4ee2a436f0e1c1416153e2878f869 (patch)
treeb662ccc7a3e599209dc2d2b2217cc80b8c66bd29
parente470757d6179eb8998881ac2706927d4d0cb0e54 (diff)
pktgen: reorganize transmit loop
Handle standard (and non-standard) return values in a switch. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/core/pktgen.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 2456bd5b086f..bce9bf4b4a62 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3424,27 +3424,29 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
3424 pkt_dev->last_ok = 0; 3424 pkt_dev->last_ok = 0;
3425 else { 3425 else {
3426 atomic_inc(&(pkt_dev->skb->users)); 3426 atomic_inc(&(pkt_dev->skb->users));
3427 retry_now: 3427
3428 retry_now:
3428 ret = (*xmit)(pkt_dev->skb, odev); 3429 ret = (*xmit)(pkt_dev->skb, odev);
3429 if (likely(ret == NETDEV_TX_OK)) { 3430 switch (ret) {
3431 case NETDEV_TX_OK:
3430 txq_trans_update(txq); 3432 txq_trans_update(txq);
3431 pkt_dev->last_ok = 1; 3433 pkt_dev->last_ok = 1;
3432 pkt_dev->sofar++; 3434 pkt_dev->sofar++;
3433 pkt_dev->seq_num++; 3435 pkt_dev->seq_num++;
3434 pkt_dev->tx_bytes += pkt_dev->cur_pkt_size; 3436 pkt_dev->tx_bytes += pkt_dev->cur_pkt_size;
3435 3437 break;
3436 } else if (ret == NETDEV_TX_LOCKED 3438 case NETDEV_TX_LOCKED:
3437 && (odev->features & NETIF_F_LLTX)) {
3438 cpu_relax(); 3439 cpu_relax();
3439 goto retry_now; 3440 goto retry_now;
3440 } else { /* Retry it next time */ 3441 default: /* Drivers are not supposed to return other values! */
3441 3442 if (net_ratelimit())
3442 atomic_dec(&(pkt_dev->skb->users)); 3443 pr_info("pktgen: %s xmit error: %d\n",
3443 3444 odev->name, ret);
3444 if (debug && net_ratelimit())
3445 printk(KERN_INFO "pktgen: Hard xmit error\n");
3446
3447 pkt_dev->errors++; 3445 pkt_dev->errors++;
3446 /* fallthru */
3447 case NETDEV_TX_BUSY:
3448 /* Retry it next time */
3449 atomic_dec(&(pkt_dev->skb->users));
3448 pkt_dev->last_ok = 0; 3450 pkt_dev->last_ok = 0;
3449 } 3451 }
3450 3452