From: Alexei Starovoitov Date: Mon, 11 May 2015 22:19:48 +0000 (-0700) Subject: pktgen: fix packet generation X-Git-Tag: firefly_0821_release~176^2~1587^2~316 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9eea92226407e7a117ef1ceef45380ebd000a0e2;p=firefly-linux-kernel-4.4.55.git pktgen: fix packet generation pkt_gen->last_ok was not set properly, so after the first burst pktgen instead of allocating new packet, will reuse old one, advance eth_type_trans further, which would mean the stack will be seeing very short bogus packets. Fixes: 62f64aed622b ("pktgen: introduce xmit_mode ''") Signed-off-by: Alexei Starovoitov Acked-by: Jesper Dangaard Brouer Signed-off-by: David S. Miller --- diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 8f2687da058e..62f979984a23 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -1189,6 +1189,16 @@ static ssize_t pktgen_if_write(struct file *file, return -ENOTSUPP; pkt_dev->xmit_mode = M_NETIF_RECEIVE; + + /* make sure new packet is allocated every time + * pktgen_xmit() is called + */ + pkt_dev->last_ok = 1; + + /* override clone_skb if user passed default value + * at module loading time + */ + pkt_dev->clone_skb = 0; } else { sprintf(pg_result, "xmit_mode -:%s:- unknown\nAvailable modes: %s", @@ -3415,7 +3425,6 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev) /* get out of the loop and wait * until skb is consumed */ - pkt_dev->last_ok = 1; break; } /* skb was 'freed' by stack, so clean few