summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-08-27 13:55:12 +0000
committerDavid S. Miller <davem@davemloft.net>2009-08-28 23:32:00 -0700
commit7d7bb1cf0ea7434230b3e3de49c24ff68666a72e (patch)
treed7bd35cdd36da505c005944e5c199b52f6d031d9 /net/core
parent3791decb5aa0202d2a2473d6cf4947d98e846c7a (diff)
downloadblackbird-op-linux-7d7bb1cf0ea7434230b3e3de49c24ff68666a72e.tar.gz
blackbird-op-linux-7d7bb1cf0ea7434230b3e3de49c24ff68666a72e.zip
pktgen: cleanup clone count test
The if statement to test for "should a new packet be used" can be simplified. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/pktgen.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 89fd232a234b..90d48ccf651d 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3395,23 +3395,22 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
return;
}
- if (pkt_dev->last_ok || !pkt_dev->skb) {
- if ((++pkt_dev->clone_count >= pkt_dev->clone_skb)
- || (!pkt_dev->skb)) {
- /* build a new pkt */
- kfree_skb(pkt_dev->skb);
-
- pkt_dev->skb = fill_packet(odev, pkt_dev);
- if (pkt_dev->skb == NULL) {
- printk(KERN_ERR "pktgen: ERROR: couldn't "
- "allocate skb in fill_packet.\n");
- schedule();
- pkt_dev->clone_count--; /* back out increment, OOM */
- return;
- }
- pkt_dev->allocated_skbs++;
- pkt_dev->clone_count = 0; /* reset counter */
+ if (!pkt_dev->skb || (pkt_dev->last_ok &&
+ ++pkt_dev->clone_count >= pkt_dev->clone_skb)) {
+ /* build a new pkt */
+ kfree_skb(pkt_dev->skb);
+
+ pkt_dev->skb = fill_packet(odev, pkt_dev);
+ if (pkt_dev->skb == NULL) {
+ printk(KERN_ERR "pktgen: ERROR: couldn't "
+ "allocate skb in fill_packet.\n");
+ schedule();
+ pkt_dev->clone_count--; /* back out increment, OOM */
+ return;
}
+
+ pkt_dev->allocated_skbs++;
+ pkt_dev->clone_count = 0; /* reset counter */
}
/* fill_packet() might have changed the queue */
@@ -3476,7 +3475,6 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
/* Done with this */
pktgen_stop_device(pkt_dev);
}
-out:;
}
/*
OpenPOWER on IntegriCloud