Re: [Question] Use of CONFIG_X86_TSC in pkt_sched.h and profile.h

From: David S. Miller (
Date: Sun Jan 26 2003 - 01:57:32 EST

   From: john stultz <>
   Date: 25 Jan 2003 19:36:26 -0800
   Now, since it looks like you don't want any references to arch specific
   code, switching on cpu_has_tsc may not be the way to go. Maybe we need
   some alternate abstraction which would return the proper value on the
   right arch? That way there wouldn't be the need for the duplicated

I definitely see this as a good opportunity to clean this stuff
up completely. And this can even be done without breaking any

My suggestion is, specifically, to:

1) create an asm/pkt_tstamp.h file that net/pkt_sched.h

   implementation into asm-generic/pkt_tstamp.h

3) "for i in include/asm-*/" create ${i}/pkt_tstamp.h which
   simply says:

        #ifndef _${i}_PKT_TSTAMP_H
        #define _${i}_PKT_TSTAMP_H

        #include <asm-generic/pkt_tstamp.h>

        #endif /* _${i}_PKT_TSTAMP_H */

That is step 1, then x86 et al. can implement their own
PSCHED_CPU implementations as appropriate.

This would also be a good opportunity to clean up and fix
the comments currently present in pkt_sched.h, for example
those comments talk about fastgettimeofday which was killed
some time ago :-)

Afterwards, I'd like this asm/pkt_tstamp.h thing to allow
platforms to implement more efficient versions of the
do_gettimeofday(&skb->stamp) calls we make in net/core/dev.c
This would involve the following:

1) Add "typedef XXX skb_stamp_t" to asm/pkt_tstamp.h, use skb_stamp_t
   for 'stamp' member of struct sk_buff in linux/skbuff.h

2) Add "skb_gettimeofday(skb, tvalp)" interface to asm/pkt_tstamp.h
   It's purpose is to convert whatever skb_stamp_t is into a
   struct timeval (which is stored in the 'tvalp' argument)

As above, default implementations go into asm-generic/pkt_tstamp.h
therefore not breaking any platforms.

This could all even be done safely in 2.4.x, and I would appreciate it
if whoever did this kind of work submitted to Alexey and myself
patches for both trees.

Alexey, what do you think about this?
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to
More majordomo info at

This archive was generated by hypermail 2b29 : Fri Jan 31 2003 - 22:00:01 EST