Patrick McHardy wrote:
David S. Miller wrote:
I just double-checked, and I didn't lose it during the
recent rebasing, as the tree I started with didn't have
the skb->stamp patch either.
Are you sure I did apply it at some point?
Yes, I know it was in your tree before the first rebasing.
Either way, please resend it if you can, sorry about this.
Here it is. I've renamed skb->stamp to skb->tstamp in this
version so unconverted users break at compilation time.
------------------------------------------------------------------------
[NET]: Store skb->timestamp as offset to a base timestamp
Reduces skb size by 8 bytes.
Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
@@ -1213,6 +1220,24 @@ static inline void *skb_header_pointer(c
extern void skb_init(void);
extern void skb_add_mtu(int mtu);
+static inline void skb_get_timestamp(struct sk_buff *skb, struct timeval *stamp)
+{
+ stamp->tv_sec = skb->tstamp.off_sec;
+ stamp->tv_usec = skb->tstamp.off_usec;
+ if (skb->tstamp.off_sec) {
+ stamp->tv_sec += skb_tv_base.tv_sec;
+ stamp->tv_usec += skb_tv_base.tv_usec;
A quick read leads me to believe you should check for overflow
in tv_usec here, but maybe that cannot happen? Might be worth
a comment in the code...
+ }
+}
+
+static inline void skb_set_timestamp(struct sk_buff *skb, struct timeval
*stamp)
+{
+ skb->tstamp.off_sec = stamp->tv_sec - skb_tv_base.tv_sec;
+ skb->tstamp.off_usec = stamp->tv_usec - skb_tv_base.tv_usec;
+}
+
+extern void __net_timestamp(struct sk_buff *skb);
+
#ifdef CONFIG_NETFILTER
static inline void nf_conntrack_put(struct nf_conntrack *nfct)
{
diff --git a/include/net/sock.h b/include/net/sock.h
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1277,16 +1277,18 @@ static inline int sock_intr_errno(long t
static __inline__ void
sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
{
- struct timeval *stamp = &skb->stamp;
+ struct timeval stamp;
+
+ skb_get_timestamp(skb, &stamp);
if (sock_flag(sk, SOCK_RCVTSTAMP)) {
/* Race occurred between timestamp enabling and packet
receiving. Fill in the current time for now. */
- if (stamp->tv_sec == 0)
- do_gettimeofday(stamp);
+ if (stamp.tv_sec == 0)
+ do_gettimeofday(&stamp);
Since we go to the effort to calculate the timestamp here, should we
maybe go ahead and set it in the skb in case something else wants to
use it later? It appears to me that the old code did this.
put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMP, sizeof(struct timeval),
- stamp);
+ &stamp);
} else
- sk->sk_stamp = *stamp;
+ sk->sk_stamp = stamp;
}
/**
--
Ben Greear <[EMAIL PROTECTED]>
Candela Technologies Inc http://www.candelatech.com
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html