* [net-next PATCH] pktgen: add flag NO_TIMESTAMP to disable timestamping
@ 2014-08-28 16:14 Jesper Dangaard Brouer
2014-08-29 16:17 ` Eric Dumazet
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Jesper Dangaard Brouer @ 2014-08-28 16:14 UTC (permalink / raw)
To: Jesper Dangaard Brouer, David S. Miller, netdev; +Cc: Ben Greear, Robert Olsson
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>
---
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 83e2b4b..d9acc16 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -202,6 +202,7 @@
#define F_QUEUE_MAP_CPU (1<<14) /* queue map mirrors smp_processor_id() */
#define F_NODE (1<<15) /* Node memory alloc*/
#define F_UDPCSUM (1<<16) /* Include UDP checksum */
+#define F_NO_TIMESTAMP (1<<17) /* Don't timestamp packets (default TS) */
/* Thread control flag bits */
#define T_STOP (1<<0) /* Stop run */
@@ -638,6 +639,9 @@ static int pktgen_if_show(struct seq_file *seq, void *v)
if (pkt_dev->flags & F_UDPCSUM)
seq_puts(seq, "UDPCSUM ");
+ if (pkt_dev->flags & F_NO_TIMESTAMP)
+ seq_puts(seq, "NO_TIMESTAMP ");
+
if (pkt_dev->flags & F_MPLS_RND)
seq_puts(seq, "MPLS_RND ");
@@ -1243,6 +1247,9 @@ static ssize_t pktgen_if_write(struct file *file,
else if (strcmp(f, "!UDPCSUM") == 0)
pkt_dev->flags &= ~F_UDPCSUM;
+ else if (strcmp(f, "NO_TIMESTAMP") == 0)
+ pkt_dev->flags |= F_NO_TIMESTAMP;
+
else {
sprintf(pg_result,
"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,
"MACSRC_RND, MACDST_RND, TXSIZE_RND, IPV6, "
"MPLS_RND, VID_RND, SVID_RND, FLOW_SEQ, "
"QUEUE_MAP_RND, QUEUE_MAP_CPU, UDPCSUM, "
+ "NO_TIMESTAMP, "
#ifdef CONFIG_XFRM
"IPSEC, "
#endif
@@ -2685,9 +2693,14 @@ static void pktgen_finalize_skb(struct pktgen_dev *pkt_dev, struct sk_buff *skb,
pgh->pgh_magic = htonl(PKTGEN_MAGIC);
pgh->seq_num = htonl(pkt_dev->seq_num);
- do_gettimeofday(×tamp);
- pgh->tv_sec = htonl(timestamp.tv_sec);
- pgh->tv_usec = htonl(timestamp.tv_usec);
+ if (pkt_dev->flags & F_NO_TIMESTAMP) {
+ pgh->tv_sec = 0;
+ pgh->tv_usec = 0;
+ } else {
+ do_gettimeofday(×tamp);
+ pgh->tv_sec = htonl(timestamp.tv_sec);
+ pgh->tv_usec = htonl(timestamp.tv_usec);
+ }
}
static struct sk_buff *pktgen_alloc_skb(struct net_device *dev,
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [net-next PATCH] pktgen: add flag NO_TIMESTAMP to disable timestamping
2014-08-28 16:14 [net-next PATCH] pktgen: add flag NO_TIMESTAMP to disable timestamping Jesper Dangaard Brouer
@ 2014-08-29 16:17 ` Eric Dumazet
2014-08-29 19:02 ` Jesper Dangaard Brouer
2014-09-02 1:07 ` David Miller
2015-04-01 16:48 ` Ben Greear
2 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2014-08-29 16:17 UTC (permalink / raw)
To: Jesper Dangaard Brouer; +Cc: David S. Miller, netdev, Ben Greear, Robert Olsson
On Thu, 2014-08-28 at 18:14 +0200, Jesper Dangaard Brouer wrote:
> 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.
I guess using local_clock() would provide an accurate and less expensive
timestamp, if a timestamp is needed.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [net-next PATCH] pktgen: add flag NO_TIMESTAMP to disable timestamping
2014-08-29 16:17 ` Eric Dumazet
@ 2014-08-29 19:02 ` Jesper Dangaard Brouer
0 siblings, 0 replies; 5+ messages in thread
From: Jesper Dangaard Brouer @ 2014-08-29 19:02 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David S. Miller, netdev, Ben Greear, Robert Olsson, brouer
On Fri, 29 Aug 2014 09:17:06 -0700
Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Thu, 2014-08-28 at 18:14 +0200, Jesper Dangaard Brouer wrote:
> > 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.
>
> I guess using local_clock() would provide an accurate and less expensive
> timestamp, if a timestamp is needed.
Sure, but I don't need this timestamp, thus I added an option to disable it.
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Sr. Network Kernel Developer at Red Hat
Author of http://www.iptv-analyzer.org
LinkedIn: http://www.linkedin.com/in/brouer
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [net-next PATCH] pktgen: add flag NO_TIMESTAMP to disable timestamping
2014-08-28 16:14 [net-next PATCH] pktgen: add flag NO_TIMESTAMP to disable timestamping Jesper Dangaard Brouer
2014-08-29 16:17 ` Eric Dumazet
@ 2014-09-02 1:07 ` David Miller
2015-04-01 16:48 ` Ben Greear
2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2014-09-02 1:07 UTC (permalink / raw)
To: brouer; +Cc: netdev, greearb, robert
From: Jesper Dangaard Brouer <brouer@redhat.com>
Date: Thu, 28 Aug 2014 18:14:47 +0200
> 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>
This is fine, applied, thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [net-next PATCH] pktgen: add flag NO_TIMESTAMP to disable timestamping
2014-08-28 16:14 [net-next PATCH] pktgen: add flag NO_TIMESTAMP to disable timestamping Jesper Dangaard Brouer
2014-08-29 16:17 ` Eric Dumazet
2014-09-02 1:07 ` David Miller
@ 2015-04-01 16:48 ` Ben Greear
2 siblings, 0 replies; 5+ messages in thread
From: Ben Greear @ 2015-04-01 16:48 UTC (permalink / raw)
To: Jesper Dangaard Brouer; +Cc: David S. Miller, netdev, Robert Olsson
On 08/28/2014 09:14 AM, Jesper Dangaard Brouer wrote:
> 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>
> + else if (strcmp(f, "NO_TIMESTAMP") == 0)
> + pkt_dev->flags |= F_NO_TIMESTAMP;
> +
While porting pktgen changes into my own modified pktgen logic, I noticed
that there is no handling for !NO_TIMESTAMP, so it seems you cannot
disable this once it is enabled?
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-04-01 16:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-28 16:14 [net-next PATCH] pktgen: add flag NO_TIMESTAMP to disable timestamping Jesper Dangaard Brouer
2014-08-29 16:17 ` Eric Dumazet
2014-08-29 19:02 ` Jesper Dangaard Brouer
2014-09-02 1:07 ` David Miller
2015-04-01 16:48 ` Ben Greear
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.