pktgen: random flow
Random flow generation has not worked. This fixes it. Signed-off-by: Robert Olsson <robert.olsson@its.uu.se> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ef647f1300
commit
1211a64554
|
@ -2085,15 +2085,19 @@ static inline int f_pick(struct pktgen_dev *pkt_dev)
|
||||||
if (pkt_dev->flows[flow].count >= pkt_dev->lflow) {
|
if (pkt_dev->flows[flow].count >= pkt_dev->lflow) {
|
||||||
/* reset time */
|
/* reset time */
|
||||||
pkt_dev->flows[flow].count = 0;
|
pkt_dev->flows[flow].count = 0;
|
||||||
|
pkt_dev->flows[flow].flags = 0;
|
||||||
pkt_dev->curfl += 1;
|
pkt_dev->curfl += 1;
|
||||||
if (pkt_dev->curfl >= pkt_dev->cflows)
|
if (pkt_dev->curfl >= pkt_dev->cflows)
|
||||||
pkt_dev->curfl = 0; /*reset */
|
pkt_dev->curfl = 0; /*reset */
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
flow = random32() % pkt_dev->cflows;
|
flow = random32() % pkt_dev->cflows;
|
||||||
|
pkt_dev->curfl = flow;
|
||||||
|
|
||||||
if (pkt_dev->flows[flow].count > pkt_dev->lflow)
|
if (pkt_dev->flows[flow].count > pkt_dev->lflow) {
|
||||||
pkt_dev->flows[flow].count = 0;
|
pkt_dev->flows[flow].count = 0;
|
||||||
|
pkt_dev->flows[flow].flags = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pkt_dev->curfl;
|
return pkt_dev->curfl;
|
||||||
|
|
Loading…
Reference in New Issue