[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-net
Subject:    nanosec timestamps for tcpdump
From:       Molnar Ingo <mingo () kaliban ! csoma ! elte ! hu>
Date:       1996-04-27 1:46:23
[Download RAW message or body]

Summary: This small patch makes socket buffer timestamps 1 usec accurate
(could be down to 10 nsec btw.), with no ISA cycle overhead. Useful for
tcpdump packet ordering. Only on Pentiums :(

Warning: ALPHA software. And it's so dirty that if this goes into the
kernel i shoot Linus myself 8)

if you still want to try it:

i patched two files:

   arch/i386/kernel/timer.c
   net/core/dev.c

The "diff -u" patch files are MIME attached. "cd" to arch/i386/kernel and
net/core to apply the patches, they contain no path.

good luck, please tell me if it doesnt work for you. (works for me with
zero problems). (tell me if you dont like it or if it's useless)

-- mingo


["diff.1" (TEXT/PLAIN)]

--- time.c.origg	Fri Apr 26 18:57:17 1996
+++ time.c	Fri Apr 26 18:57:48 1996
@@ -376,6 +376,14 @@
 		irq0.handler = pentium_timer_interrupt;
 	}
 #endif
+#ifdef CONFIG_M586
+	do_gettimeoffset = do_fast_gettimeoffset;
+	/* read Pentium cycle counter */
+	__asm__(".byte 0x0f,0x31"
+		:"=a" (((unsigned long *) &init_timer_cc)[0]),
+		 "=d" (((unsigned long *) &init_timer_cc)[1]));
+	irq0.handler = pentium_timer_interrupt;
+#endif
 
 	setup_x86_irq(0, &irq0);
 }

["diff.2" (TEXT/PLAIN)]

--- dev.c.origg	Fri Apr 26 18:31:33 1996
+++ dev.c	Fri Apr 26 18:59:02 1996
@@ -428,6 +428,10 @@
 		/* copy outgoing packets to any sniffer packet handlers */
 		if (dev_nit) {
 			struct packet_type *ptype;
+#ifdef CONFIG_M586
+                        struct timeval dummy_tv;
+			do_gettimeofday( &dummy_tv );
+#endif
 			skb->stamp=xtime;
 			for (ptype = ptype_all; ptype!=NULL; ptype = ptype->next) 
 			{
@@ -486,7 +490,13 @@
 	skb->sk = NULL;
 	skb->free = 1;
 	if(skb->stamp.tv_sec==0)
+	{
+#ifdef CONFIG_M586
+                        struct timeval dummy_tv;
+			do_gettimeofday( &dummy_tv );
+#endif
 		skb->stamp = xtime;
+	}
 
 	/*
 	 *	Check that we aren't overdoing things.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic