X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=net%2Fcore%2Fpktgen.c;h=8eb083b6041a7fae844be27a29e9082e828587cc;hb=f35279d3f713e5c97b98cbdbf47d98f79942c11f;hp=c57b06bc79f379cb63dbc00dcd9c0860a09a3800;hpb=1da177e4c3f41524e886b7f1b8a0c1fc7321cac2;p=linux-2.6 diff --git a/net/core/pktgen.c b/net/core/pktgen.c index c57b06bc79..8eb083b604 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -151,7 +151,7 @@ #include -#define VERSION "pktgen v2.61: Packet Generator for packet performance testing.\n" +#define VERSION "pktgen v2.62: Packet Generator for packet performance testing.\n" /* #define PG_DEBUG(a) a */ #define PG_DEBUG(a) @@ -363,7 +363,7 @@ struct pktgen_thread { * All Rights Reserved. * */ -inline static s64 divremdi3(s64 x, s64 y, int type) +static inline s64 divremdi3(s64 x, s64 y, int type) { u64 a = (x < 0) ? -x : x; u64 b = (y < 0) ? -y : y; @@ -1921,6 +1921,11 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, struct iphdr *iph; struct pktgen_hdr *pgh = NULL; + /* Update any of the values, used when we're incrementing various + * fields. + */ + mod_cur_headers(pkt_dev); + skb = alloc_skb(pkt_dev->cur_pkt_size + 64 + 16, GFP_ATOMIC); if (!skb) { sprintf(pkt_dev->result, "No memory"); @@ -1934,11 +1939,6 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, iph = (struct iphdr *)skb_put(skb, sizeof(struct iphdr)); udph = (struct udphdr *)skb_put(skb, sizeof(struct udphdr)); - /* Update any of the values, used when we're incrementing various - * fields. - */ - mod_cur_headers(pkt_dev); - memcpy(eth, pkt_dev->hh, 12); *(u16*)ð[12] = __constant_htons(ETH_P_IP); @@ -2192,7 +2192,12 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, int datalen; struct ipv6hdr *iph; struct pktgen_hdr *pgh = NULL; - + + /* Update any of the values, used when we're incrementing various + * fields. + */ + mod_cur_headers(pkt_dev); + skb = alloc_skb(pkt_dev->cur_pkt_size + 64 + 16, GFP_ATOMIC); if (!skb) { sprintf(pkt_dev->result, "No memory"); @@ -2206,17 +2211,9 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, iph = (struct ipv6hdr *)skb_put(skb, sizeof(struct ipv6hdr)); udph = (struct udphdr *)skb_put(skb, sizeof(struct udphdr)); - - /* Update any of the values, used when we're incrementing various - * fields. - */ - mod_cur_headers(pkt_dev); - - memcpy(eth, pkt_dev->hh, 12); *(u16*)ð[12] = __constant_htons(ETH_P_IPV6); - - + datalen = pkt_dev->cur_pkt_size-14- sizeof(struct ipv6hdr)-sizeof(struct udphdr); /* Eth + IPh + UDPh */