提交 7d7bb1cf 编写于 作者: S Stephen Hemminger 提交者: David S. Miller

pktgen: cleanup clone count test

The if statement to test for "should a new packet be used"
can be simplified.
Signed-off-by: NStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 3791decb
...@@ -3395,23 +3395,22 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev) ...@@ -3395,23 +3395,22 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
return; return;
} }
if (pkt_dev->last_ok || !pkt_dev->skb) { if (!pkt_dev->skb || (pkt_dev->last_ok &&
if ((++pkt_dev->clone_count >= pkt_dev->clone_skb) ++pkt_dev->clone_count >= pkt_dev->clone_skb)) {
|| (!pkt_dev->skb)) { /* build a new pkt */
/* build a new pkt */ kfree_skb(pkt_dev->skb);
kfree_skb(pkt_dev->skb);
pkt_dev->skb = fill_packet(odev, pkt_dev);
pkt_dev->skb = fill_packet(odev, pkt_dev); if (pkt_dev->skb == NULL) {
if (pkt_dev->skb == NULL) { printk(KERN_ERR "pktgen: ERROR: couldn't "
printk(KERN_ERR "pktgen: ERROR: couldn't " "allocate skb in fill_packet.\n");
"allocate skb in fill_packet.\n"); schedule();
schedule(); pkt_dev->clone_count--; /* back out increment, OOM */
pkt_dev->clone_count--; /* back out increment, OOM */ return;
return;
}
pkt_dev->allocated_skbs++;
pkt_dev->clone_count = 0; /* reset counter */
} }
pkt_dev->allocated_skbs++;
pkt_dev->clone_count = 0; /* reset counter */
} }
/* fill_packet() might have changed the queue */ /* fill_packet() might have changed the queue */
...@@ -3476,7 +3475,6 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev) ...@@ -3476,7 +3475,6 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
/* Done with this */ /* Done with this */
pktgen_stop_device(pkt_dev); pktgen_stop_device(pkt_dev);
} }
out:;
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册