From: john stultz <johnstul@us.ibm.com> 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 implementations. I definitely see this as a good opportunity to clean this stuff up completely. And this can even be done without breaking any platform. My suggestion is, specifically, to: 1) create an asm/pkt_tstamp.h file that net/pkt_sched.h includes 2) move the current PSCHED_JIFFIES and PSCHED_GETTIMEOFDAY 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 #define PSCHED_CLOCK_SOURCE PSCHED_JIFFIES #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? - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html