diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-08-27 09:55:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-29 02:32:00 -0400 |
commit | 7d7bb1cf0ea7434230b3e3de49c24ff68666a72e (patch) | |
tree | d7bd35cdd36da505c005944e5c199b52f6d031d9 /net/core/pktgen.c | |
parent | 3791decb5aa0202d2a2473d6cf4947d98e846c7a (diff) |
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/pktgen.c')
-rw-r--r-- | net/core/pktgen.c | 32 |
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) | |||
3395 | return; | 3395 | return; |
3396 | } | 3396 | } |
3397 | 3397 | ||
3398 | if (pkt_dev->last_ok || !pkt_dev->skb) { | 3398 | if (!pkt_dev->skb || (pkt_dev->last_ok && |
3399 | if ((++pkt_dev->clone_count >= pkt_dev->clone_skb) | 3399 | ++pkt_dev->clone_count >= pkt_dev->clone_skb)) { |
3400 | || (!pkt_dev->skb)) { | 3400 | /* build a new pkt */ |
3401 | /* build a new pkt */ | 3401 | kfree_skb(pkt_dev->skb); |
3402 | kfree_skb(pkt_dev->skb); | 3402 | |
3403 | 3403 | pkt_dev->skb = fill_packet(odev, pkt_dev); | |
3404 | pkt_dev->skb = fill_packet(odev, pkt_dev); | 3404 | if (pkt_dev->skb == NULL) { |
3405 | if (pkt_dev->skb == NULL) { | 3405 | printk(KERN_ERR "pktgen: ERROR: couldn't " |
3406 | printk(KERN_ERR "pktgen: ERROR: couldn't " | 3406 | "allocate skb in fill_packet.\n"); |
3407 | "allocate skb in fill_packet.\n"); | 3407 | schedule(); |
3408 | schedule(); | 3408 | pkt_dev->clone_count--; /* back out increment, OOM */ |
3409 | pkt_dev->clone_count--; /* back out increment, OOM */ | 3409 | return; |
3410 | return; | ||
3411 | } | ||
3412 | pkt_dev->allocated_skbs++; | ||
3413 | pkt_dev->clone_count = 0; /* reset counter */ | ||
3414 | } | 3410 | } |
3411 | |||
3412 | pkt_dev->allocated_skbs++; | ||
3413 | pkt_dev->clone_count = 0; /* reset counter */ | ||
3415 | } | 3414 | } |
3416 | 3415 | ||
3417 | /* fill_packet() might have changed the queue */ | 3416 | /* fill_packet() might have changed the queue */ |
@@ -3476,7 +3475,6 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev) | |||
3476 | /* Done with this */ | 3475 | /* Done with this */ |
3477 | pktgen_stop_device(pkt_dev); | 3476 | pktgen_stop_device(pkt_dev); |
3478 | } | 3477 | } |
3479 | out:; | ||
3480 | } | 3478 | } |
3481 | 3479 | ||
3482 | /* | 3480 | /* |