diff options
author | Jesper Dangaard Brouer <brouer@redhat.com> | 2014-08-28 12:14:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-01 21:06:59 -0400 |
commit | afb84b6261841f8ab387e267e748236fa805bea0 (patch) | |
tree | deb07ffc7c37287974233be17f49da1a459da757 /net/core | |
parent | 05f8461bf746660ea725f922cfae9af66be1f79f (diff) |
pktgen: add flag NO_TIMESTAMP to disable timestamping
Then testing the TX limits of the stack, then it is useful to
be-able to disable the do_gettimeofday() timetamping on every packet.
This implements a pktgen flag NO_TIMESTAMP which will disable this
call to do_gettimeofday().
The performance change on (my system E5-2695) with skb_clone=0, goes
from TX 2,423,751 pps to 2,567,165 pps with flag NO_TIMESTAMP. Thus,
the cost of do_gettimeofday() or saving is approx 23 nanosec.
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/pktgen.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 5b36a9428c59..21cb4839bc97 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -202,6 +202,7 @@ | |||
202 | #define F_QUEUE_MAP_CPU (1<<14) /* queue map mirrors smp_processor_id() */ | 202 | #define F_QUEUE_MAP_CPU (1<<14) /* queue map mirrors smp_processor_id() */ |
203 | #define F_NODE (1<<15) /* Node memory alloc*/ | 203 | #define F_NODE (1<<15) /* Node memory alloc*/ |
204 | #define F_UDPCSUM (1<<16) /* Include UDP checksum */ | 204 | #define F_UDPCSUM (1<<16) /* Include UDP checksum */ |
205 | #define F_NO_TIMESTAMP (1<<17) /* Don't timestamp packets (default TS) */ | ||
205 | 206 | ||
206 | /* Thread control flag bits */ | 207 | /* Thread control flag bits */ |
207 | #define T_STOP (1<<0) /* Stop run */ | 208 | #define T_STOP (1<<0) /* Stop run */ |
@@ -638,6 +639,9 @@ static int pktgen_if_show(struct seq_file *seq, void *v) | |||
638 | if (pkt_dev->flags & F_UDPCSUM) | 639 | if (pkt_dev->flags & F_UDPCSUM) |
639 | seq_puts(seq, "UDPCSUM "); | 640 | seq_puts(seq, "UDPCSUM "); |
640 | 641 | ||
642 | if (pkt_dev->flags & F_NO_TIMESTAMP) | ||
643 | seq_puts(seq, "NO_TIMESTAMP "); | ||
644 | |||
641 | if (pkt_dev->flags & F_MPLS_RND) | 645 | if (pkt_dev->flags & F_MPLS_RND) |
642 | seq_puts(seq, "MPLS_RND "); | 646 | seq_puts(seq, "MPLS_RND "); |
643 | 647 | ||
@@ -1243,6 +1247,9 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1243 | else if (strcmp(f, "!UDPCSUM") == 0) | 1247 | else if (strcmp(f, "!UDPCSUM") == 0) |
1244 | pkt_dev->flags &= ~F_UDPCSUM; | 1248 | pkt_dev->flags &= ~F_UDPCSUM; |
1245 | 1249 | ||
1250 | else if (strcmp(f, "NO_TIMESTAMP") == 0) | ||
1251 | pkt_dev->flags |= F_NO_TIMESTAMP; | ||
1252 | |||
1246 | else { | 1253 | else { |
1247 | sprintf(pg_result, | 1254 | sprintf(pg_result, |
1248 | "Flag -:%s:- unknown\nAvailable flags, (prepend ! to un-set flag):\n%s", | 1255 | "Flag -:%s:- unknown\nAvailable flags, (prepend ! to un-set flag):\n%s", |
@@ -1251,6 +1258,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1251 | "MACSRC_RND, MACDST_RND, TXSIZE_RND, IPV6, " | 1258 | "MACSRC_RND, MACDST_RND, TXSIZE_RND, IPV6, " |
1252 | "MPLS_RND, VID_RND, SVID_RND, FLOW_SEQ, " | 1259 | "MPLS_RND, VID_RND, SVID_RND, FLOW_SEQ, " |
1253 | "QUEUE_MAP_RND, QUEUE_MAP_CPU, UDPCSUM, " | 1260 | "QUEUE_MAP_RND, QUEUE_MAP_CPU, UDPCSUM, " |
1261 | "NO_TIMESTAMP, " | ||
1254 | #ifdef CONFIG_XFRM | 1262 | #ifdef CONFIG_XFRM |
1255 | "IPSEC, " | 1263 | "IPSEC, " |
1256 | #endif | 1264 | #endif |
@@ -2685,9 +2693,14 @@ static void pktgen_finalize_skb(struct pktgen_dev *pkt_dev, struct sk_buff *skb, | |||
2685 | pgh->pgh_magic = htonl(PKTGEN_MAGIC); | 2693 | pgh->pgh_magic = htonl(PKTGEN_MAGIC); |
2686 | pgh->seq_num = htonl(pkt_dev->seq_num); | 2694 | pgh->seq_num = htonl(pkt_dev->seq_num); |
2687 | 2695 | ||
2688 | do_gettimeofday(×tamp); | 2696 | if (pkt_dev->flags & F_NO_TIMESTAMP) { |
2689 | pgh->tv_sec = htonl(timestamp.tv_sec); | 2697 | pgh->tv_sec = 0; |
2690 | pgh->tv_usec = htonl(timestamp.tv_usec); | 2698 | pgh->tv_usec = 0; |
2699 | } else { | ||
2700 | do_gettimeofday(×tamp); | ||
2701 | pgh->tv_sec = htonl(timestamp.tv_sec); | ||
2702 | pgh->tv_usec = htonl(timestamp.tv_usec); | ||
2703 | } | ||
2691 | } | 2704 | } |
2692 | 2705 | ||
2693 | static struct sk_buff *pktgen_alloc_skb(struct net_device *dev, | 2706 | static struct sk_buff *pktgen_alloc_skb(struct net_device *dev, |