Commit 5b8db2f5 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

pktgen: reorganize transmit loop

Handle standard (and non-standard) return values in a switch.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e470757d
...@@ -3424,27 +3424,29 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev) ...@@ -3424,27 +3424,29 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
pkt_dev->last_ok = 0; pkt_dev->last_ok = 0;
else { else {
atomic_inc(&(pkt_dev->skb->users)); atomic_inc(&(pkt_dev->skb->users));
retry_now:
retry_now:
ret = (*xmit)(pkt_dev->skb, odev); ret = (*xmit)(pkt_dev->skb, odev);
if (likely(ret == NETDEV_TX_OK)) { switch (ret) {
case NETDEV_TX_OK:
txq_trans_update(txq); txq_trans_update(txq);
pkt_dev->last_ok = 1; pkt_dev->last_ok = 1;
pkt_dev->sofar++; pkt_dev->sofar++;
pkt_dev->seq_num++; pkt_dev->seq_num++;
pkt_dev->tx_bytes += pkt_dev->cur_pkt_size; pkt_dev->tx_bytes += pkt_dev->cur_pkt_size;
break;
} else if (ret == NETDEV_TX_LOCKED case NETDEV_TX_LOCKED:
&& (odev->features & NETIF_F_LLTX)) {
cpu_relax(); cpu_relax();
goto retry_now; goto retry_now;
} else { /* Retry it next time */ default: /* Drivers are not supposed to return other values! */
if (net_ratelimit())
atomic_dec(&(pkt_dev->skb->users)); pr_info("pktgen: %s xmit error: %d\n",
odev->name, ret);
if (debug && net_ratelimit())
printk(KERN_INFO "pktgen: Hard xmit error\n");
pkt_dev->errors++; pkt_dev->errors++;
/* fallthru */
case NETDEV_TX_BUSY:
/* Retry it next time */
atomic_dec(&(pkt_dev->skb->users));
pkt_dev->last_ok = 0; pkt_dev->last_ok = 0;
} }
......
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