aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorRobert Olsson <robert.olsson@its.uu.se>2008-08-05 21:44:26 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-05 21:44:26 -0400
commit1211a64554065316e02b3c62b320088ad4f63260 (patch)
tree58522cdfcd5ee11409f39f32135234a28c883095 /net
parentef647f1300d69adb8223d970554d59d7e244db6d (diff)
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>
Diffstat (limited to 'net')
-rw-r--r--net/core/pktgen.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 3284605f2ec7..9c87320fdf3f 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2085,15 +2085,19 @@ static inline int f_pick(struct pktgen_dev *pkt_dev)
2085 if (pkt_dev->flows[flow].count >= pkt_dev->lflow) { 2085 if (pkt_dev->flows[flow].count >= pkt_dev->lflow) {
2086 /* reset time */ 2086 /* reset time */
2087 pkt_dev->flows[flow].count = 0; 2087 pkt_dev->flows[flow].count = 0;
2088 pkt_dev->flows[flow].flags = 0;
2088 pkt_dev->curfl += 1; 2089 pkt_dev->curfl += 1;
2089 if (pkt_dev->curfl >= pkt_dev->cflows) 2090 if (pkt_dev->curfl >= pkt_dev->cflows)
2090 pkt_dev->curfl = 0; /*reset */ 2091 pkt_dev->curfl = 0; /*reset */
2091 } 2092 }
2092 } else { 2093 } else {
2093 flow = random32() % pkt_dev->cflows; 2094 flow = random32() % pkt_dev->cflows;
2095 pkt_dev->curfl = flow;
2094 2096
2095 if (pkt_dev->flows[flow].count > pkt_dev->lflow) 2097 if (pkt_dev->flows[flow].count > pkt_dev->lflow) {
2096 pkt_dev->flows[flow].count = 0; 2098 pkt_dev->flows[flow].count = 0;
2099 pkt_dev->flows[flow].flags = 0;
2100 }
2097 } 2101 }
2098 2102
2099 return pkt_dev->curfl; 2103 return pkt_dev->curfl;