summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-08-27 13:55:14 +0000
committerDavid S. Miller <davem@davemloft.net>2009-08-28 23:32:07 -0700
commit5b8db2f568c4ee2a436f0e1c1416153e2878f869 (patch)
treeb662ccc7a3e599209dc2d2b2217cc80b8c66bd29 /net
parente470757d6179eb8998881ac2706927d4d0cb0e54 (diff)
downloadlinux-5b8db2f568c4ee2a436f0e1c1416153e2878f869.tar.bz2
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>
Diffstat (limited to '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)
pkt_dev->last_ok = 0;
else {
atomic_inc(&(pkt_dev->skb->users));
- retry_now:
+
+ retry_now:
ret = (*xmit)(pkt_dev->skb, odev);
- if (likely(ret == NETDEV_TX_OK)) {
+ switch (ret) {
+ case NETDEV_TX_OK:
txq_trans_update(txq);
pkt_dev->last_ok = 1;
pkt_dev->sofar++;
pkt_dev->seq_num++;
pkt_dev->tx_bytes += pkt_dev->cur_pkt_size;
-
- } else if (ret == NETDEV_TX_LOCKED
- && (odev->features & NETIF_F_LLTX)) {
+ break;
+ case NETDEV_TX_LOCKED:
cpu_relax();
goto retry_now;
- } else { /* Retry it next time */
-
- atomic_dec(&(pkt_dev->skb->users));
-
- if (debug && net_ratelimit())
- printk(KERN_INFO "pktgen: Hard xmit error\n");
-
+ default: /* Drivers are not supposed to return other values! */
+ if (net_ratelimit())
+ pr_info("pktgen: %s xmit error: %d\n",
+ odev->name, ret);
pkt_dev->errors++;
+ /* fallthru */
+ case NETDEV_TX_BUSY:
+ /* Retry it next time */
+ atomic_dec(&(pkt_dev->skb->users));
pkt_dev->last_ok = 0;
}