aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2007-04-19 19:16:32 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:23:34 -0400
commitb7aa0bf70c4afb9e38be25f5c0922498d0f8684c (patch)
tree4bc9d61031f4eb40d73887d6bde09e7d6bf2b259 /net
parent3927f2e8f9afa3424bb51ca81f7abac01ffd0005 (diff)
[NET]: convert network timestamps to ktime_t
We currently use a special structure (struct skb_timeval) and plain 'struct timeval' to store packet timestamps in sk_buffs and struct sock. This has some drawbacks : - Fixed resolution of micro second. - Waste of space on 64bit platforms where sizeof(struct timeval)=16 I suggest using ktime_t that is a nice abstraction of high resolution time services, currently capable of nanosecond resolution. As sizeof(ktime_t) is 8 bytes, using ktime_t in 'struct sock' permits a 8 byte shrink of this structure on 64bit architectures. Some other structures also benefit from this size reduction (struct ipq in ipv4/ip_fragment.c, struct frag_queue in ipv6/reassembly.c, ...) Once this ktime infrastructure adopted, we can more easily provide nanosecond resolution on top of it. (ioctl SIOCGSTAMPNS and/or SO_TIMESTAMPNS/SCM_TIMESTAMPNS) Note : this patch includes a bug correction in compat_sock_get_timestamp() where a "err = 0;" was missing (so this syscall returned -ENOENT instead of 0) Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> CC: Stephen Hemminger <shemminger@linux-foundation.org> CC: John find <linux.kernel@free.fr> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/bridge/netfilter/ebt_ulog.c6
-rw-r--r--net/compat.c15
-rw-r--r--net/core/dev.c19
-rw-r--r--net/core/sock.c16
-rw-r--r--net/econet/af_econet.c2
-rw-r--r--net/ipv4/ip_fragment.c8
-rw-r--r--net/ipv4/netfilter/ip_queue.c6
-rw-r--r--net/ipv4/netfilter/ipt_ULOG.c8
-rw-r--r--net/ipv6/exthdrs.c2
-rw-r--r--net/ipv6/netfilter/ip6_queue.c6
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c6
-rw-r--r--net/ipv6/reassembly.c6
-rw-r--r--net/ipx/af_ipx.c4
-rw-r--r--net/netfilter/nfnetlink_log.c8
-rw-r--r--net/netfilter/nfnetlink_queue.c8
-rw-r--r--net/packet/af_packet.c8
-rw-r--r--net/sunrpc/svcsock.c10
17 files changed, 70 insertions, 68 deletions
diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c
index 8e15cc47f6c0..259f5c370f3c 100644
--- a/net/bridge/netfilter/ebt_ulog.c
+++ b/net/bridge/netfilter/ebt_ulog.c
@@ -130,6 +130,7 @@ static void ebt_ulog_packet(unsigned int hooknr, const struct sk_buff *skb,
130 unsigned int group = uloginfo->nlgroup; 130 unsigned int group = uloginfo->nlgroup;
131 ebt_ulog_buff_t *ub = &ulog_buffers[group]; 131 ebt_ulog_buff_t *ub = &ulog_buffers[group];
132 spinlock_t *lock = &ub->lock; 132 spinlock_t *lock = &ub->lock;
133 ktime_t kt;
133 134
134 if ((uloginfo->cprange == 0) || 135 if ((uloginfo->cprange == 0) ||
135 (uloginfo->cprange > skb->len + ETH_HLEN)) 136 (uloginfo->cprange > skb->len + ETH_HLEN))
@@ -164,9 +165,10 @@ static void ebt_ulog_packet(unsigned int hooknr, const struct sk_buff *skb,
164 165
165 /* Fill in the ulog data */ 166 /* Fill in the ulog data */
166 pm->version = EBT_ULOG_VERSION; 167 pm->version = EBT_ULOG_VERSION;
167 do_gettimeofday(&pm->stamp); 168 kt = ktime_get_real();
169 pm->stamp = ktime_to_timeval(kt);
168 if (ub->qlen == 1) 170 if (ub->qlen == 1)
169 skb_set_timestamp(ub->skb, &pm->stamp); 171 ub->skb->tstamp = kt;
170 pm->data_len = copy_len; 172 pm->data_len = copy_len;
171 pm->mark = skb->mark; 173 pm->mark = skb->mark;
172 pm->hook = hooknr; 174 pm->hook = hooknr;
diff --git a/net/compat.c b/net/compat.c
index 1f32866d09b7..17c2710b2b93 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -545,15 +545,20 @@ int compat_sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp)
545 struct compat_timeval __user *ctv = 545 struct compat_timeval __user *ctv =
546 (struct compat_timeval __user*) userstamp; 546 (struct compat_timeval __user*) userstamp;
547 int err = -ENOENT; 547 int err = -ENOENT;
548 struct timeval tv;
548 549
549 if (!sock_flag(sk, SOCK_TIMESTAMP)) 550 if (!sock_flag(sk, SOCK_TIMESTAMP))
550 sock_enable_timestamp(sk); 551 sock_enable_timestamp(sk);
551 if (sk->sk_stamp.tv_sec == -1) 552 tv = ktime_to_timeval(sk->sk_stamp);
553 if (tv.tv_sec == -1)
552 return err; 554 return err;
553 if (sk->sk_stamp.tv_sec == 0) 555 if (tv.tv_sec == 0) {
554 do_gettimeofday(&sk->sk_stamp); 556 sk->sk_stamp = ktime_get_real();
555 if (put_user(sk->sk_stamp.tv_sec, &ctv->tv_sec) || 557 tv = ktime_to_timeval(sk->sk_stamp);
556 put_user(sk->sk_stamp.tv_usec, &ctv->tv_usec)) 558 }
559 err = 0;
560 if (put_user(tv.tv_sec, &ctv->tv_sec) ||
561 put_user(tv.tv_usec, &ctv->tv_usec))
557 err = -EFAULT; 562 err = -EFAULT;
558 return err; 563 return err;
559} 564}
diff --git a/net/core/dev.c b/net/core/dev.c
index 4dc93cc4d5b7..582db646cc54 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1031,23 +1031,12 @@ void net_disable_timestamp(void)
1031 atomic_dec(&netstamp_needed); 1031 atomic_dec(&netstamp_needed);
1032} 1032}
1033 1033
1034void __net_timestamp(struct sk_buff *skb)
1035{
1036 struct timeval tv;
1037
1038 do_gettimeofday(&tv);
1039 skb_set_timestamp(skb, &tv);
1040}
1041EXPORT_SYMBOL(__net_timestamp);
1042
1043static inline void net_timestamp(struct sk_buff *skb) 1034static inline void net_timestamp(struct sk_buff *skb)
1044{ 1035{
1045 if (atomic_read(&netstamp_needed)) 1036 if (atomic_read(&netstamp_needed))
1046 __net_timestamp(skb); 1037 __net_timestamp(skb);
1047 else { 1038 else
1048 skb->tstamp.off_sec = 0; 1039 skb->tstamp.tv64 = 0;
1049 skb->tstamp.off_usec = 0;
1050 }
1051} 1040}
1052 1041
1053/* 1042/*
@@ -1577,7 +1566,7 @@ int netif_rx(struct sk_buff *skb)
1577 if (netpoll_rx(skb)) 1566 if (netpoll_rx(skb))
1578 return NET_RX_DROP; 1567 return NET_RX_DROP;
1579 1568
1580 if (!skb->tstamp.off_sec) 1569 if (!skb->tstamp.tv64)
1581 net_timestamp(skb); 1570 net_timestamp(skb);
1582 1571
1583 /* 1572 /*
@@ -1769,7 +1758,7 @@ int netif_receive_skb(struct sk_buff *skb)
1769 if (skb->dev->poll && netpoll_rx(skb)) 1758 if (skb->dev->poll && netpoll_rx(skb))
1770 return NET_RX_DROP; 1759 return NET_RX_DROP;
1771 1760
1772 if (!skb->tstamp.off_sec) 1761 if (!skb->tstamp.tv64)
1773 net_timestamp(skb); 1762 net_timestamp(skb);
1774 1763
1775 if (!skb->iif) 1764 if (!skb->iif)
diff --git a/net/core/sock.c b/net/core/sock.c
index 6d35d5775ba8..6ddb3664b993 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1512,8 +1512,7 @@ void sock_init_data(struct socket *sock, struct sock *sk)
1512 sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT; 1512 sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT;
1513 sk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT; 1513 sk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT;
1514 1514
1515 sk->sk_stamp.tv_sec = -1L; 1515 sk->sk_stamp = ktime_set(-1L, -1L);
1516 sk->sk_stamp.tv_usec = -1L;
1517 1516
1518 atomic_set(&sk->sk_refcnt, 1); 1517 atomic_set(&sk->sk_refcnt, 1);
1519} 1518}
@@ -1554,14 +1553,17 @@ EXPORT_SYMBOL(release_sock);
1554 1553
1555int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp) 1554int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp)
1556{ 1555{
1556 struct timeval tv;
1557 if (!sock_flag(sk, SOCK_TIMESTAMP)) 1557 if (!sock_flag(sk, SOCK_TIMESTAMP))
1558 sock_enable_timestamp(sk); 1558 sock_enable_timestamp(sk);
1559 if (sk->sk_stamp.tv_sec == -1) 1559 tv = ktime_to_timeval(sk->sk_stamp);
1560 if (tv.tv_sec == -1)
1560 return -ENOENT; 1561 return -ENOENT;
1561 if (sk->sk_stamp.tv_sec == 0) 1562 if (tv.tv_sec == 0) {
1562 do_gettimeofday(&sk->sk_stamp); 1563 sk->sk_stamp = ktime_get_real();
1563 return copy_to_user(userstamp, &sk->sk_stamp, sizeof(struct timeval)) ? 1564 tv = ktime_to_timeval(sk->sk_stamp);
1564 -EFAULT : 0; 1565 }
1566 return copy_to_user(userstamp, &tv, sizeof(tv)) ? -EFAULT : 0;
1565} 1567}
1566EXPORT_SYMBOL(sock_get_timestamp); 1568EXPORT_SYMBOL(sock_get_timestamp);
1567 1569
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index bc12e36263f0..f573eddc6034 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -162,7 +162,7 @@ static int econet_recvmsg(struct kiocb *iocb, struct socket *sock,
162 err = memcpy_toiovec(msg->msg_iov, skb->data, copied); 162 err = memcpy_toiovec(msg->msg_iov, skb->data, copied);
163 if (err) 163 if (err)
164 goto out_free; 164 goto out_free;
165 skb_get_timestamp(skb, &sk->sk_stamp); 165 sk->sk_stamp = skb->tstamp;
166 166
167 if (msg->msg_name) 167 if (msg->msg_name)
168 memcpy(msg->msg_name, skb->cb, msg->msg_namelen); 168 memcpy(msg->msg_name, skb->cb, msg->msg_namelen);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index b6f055380373..e10be7d7752d 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -92,7 +92,7 @@ struct ipq {
92 spinlock_t lock; 92 spinlock_t lock;
93 atomic_t refcnt; 93 atomic_t refcnt;
94 struct timer_list timer; /* when will this queue expire? */ 94 struct timer_list timer; /* when will this queue expire? */
95 struct timeval stamp; 95 ktime_t stamp;
96 int iif; 96 int iif;
97 unsigned int rid; 97 unsigned int rid;
98 struct inet_peer *peer; 98 struct inet_peer *peer;
@@ -592,7 +592,7 @@ static void ip_frag_queue(struct ipq *qp, struct sk_buff *skb)
592 if (skb->dev) 592 if (skb->dev)
593 qp->iif = skb->dev->ifindex; 593 qp->iif = skb->dev->ifindex;
594 skb->dev = NULL; 594 skb->dev = NULL;
595 skb_get_timestamp(skb, &qp->stamp); 595 qp->stamp = skb->tstamp;
596 qp->meat += skb->len; 596 qp->meat += skb->len;
597 atomic_add(skb->truesize, &ip_frag_mem); 597 atomic_add(skb->truesize, &ip_frag_mem);
598 if (offset == 0) 598 if (offset == 0)
@@ -674,7 +674,7 @@ static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev)
674 674
675 head->next = NULL; 675 head->next = NULL;
676 head->dev = dev; 676 head->dev = dev;
677 skb_set_timestamp(head, &qp->stamp); 677 head->tstamp = qp->stamp;
678 678
679 iph = head->nh.iph; 679 iph = head->nh.iph;
680 iph->frag_off = 0; 680 iph->frag_off = 0;
@@ -734,7 +734,7 @@ struct sk_buff *ip_defrag(struct sk_buff *skb, u32 user)
734 return NULL; 734 return NULL;
735} 735}
736 736
737void ipfrag_init(void) 737void __init ipfrag_init(void)
738{ 738{
739 ipfrag_hash_rnd = (u32) ((num_physpages ^ (num_physpages>>7)) ^ 739 ipfrag_hash_rnd = (u32) ((num_physpages ^ (num_physpages>>7)) ^
740 (jiffies ^ (jiffies >> 6))); 740 (jiffies ^ (jiffies >> 6)));
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index a14798a850d7..5842f1aa973a 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -197,6 +197,7 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
197 struct sk_buff *skb; 197 struct sk_buff *skb;
198 struct ipq_packet_msg *pmsg; 198 struct ipq_packet_msg *pmsg;
199 struct nlmsghdr *nlh; 199 struct nlmsghdr *nlh;
200 struct timeval tv;
200 201
201 read_lock_bh(&queue_lock); 202 read_lock_bh(&queue_lock);
202 203
@@ -241,8 +242,9 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
241 242
242 pmsg->packet_id = (unsigned long )entry; 243 pmsg->packet_id = (unsigned long )entry;
243 pmsg->data_len = data_len; 244 pmsg->data_len = data_len;
244 pmsg->timestamp_sec = entry->skb->tstamp.off_sec; 245 tv = ktime_to_timeval(entry->skb->tstamp);
245 pmsg->timestamp_usec = entry->skb->tstamp.off_usec; 246 pmsg->timestamp_sec = tv.tv_sec;
247 pmsg->timestamp_usec = tv.tv_usec;
246 pmsg->mark = entry->skb->mark; 248 pmsg->mark = entry->skb->mark;
247 pmsg->hook = entry->info->hook; 249 pmsg->hook = entry->info->hook;
248 pmsg->hw_protocol = entry->skb->protocol; 250 pmsg->hw_protocol = entry->skb->protocol;
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index 9acc018766f2..9718b666a380 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -187,6 +187,7 @@ static void ipt_ulog_packet(unsigned int hooknum,
187 ulog_packet_msg_t *pm; 187 ulog_packet_msg_t *pm;
188 size_t size, copy_len; 188 size_t size, copy_len;
189 struct nlmsghdr *nlh; 189 struct nlmsghdr *nlh;
190 struct timeval tv;
190 191
191 /* ffs == find first bit set, necessary because userspace 192 /* ffs == find first bit set, necessary because userspace
192 * is already shifting groupnumber, but we need unshifted. 193 * is already shifting groupnumber, but we need unshifted.
@@ -232,13 +233,14 @@ static void ipt_ulog_packet(unsigned int hooknum,
232 pm = NLMSG_DATA(nlh); 233 pm = NLMSG_DATA(nlh);
233 234
234 /* We might not have a timestamp, get one */ 235 /* We might not have a timestamp, get one */
235 if (skb->tstamp.off_sec == 0) 236 if (skb->tstamp.tv64 == 0)
236 __net_timestamp((struct sk_buff *)skb); 237 __net_timestamp((struct sk_buff *)skb);
237 238
238 /* copy hook, prefix, timestamp, payload, etc. */ 239 /* copy hook, prefix, timestamp, payload, etc. */
239 pm->data_len = copy_len; 240 pm->data_len = copy_len;
240 put_unaligned(skb->tstamp.off_sec, &pm->timestamp_sec); 241 tv = ktime_to_timeval(skb->tstamp);
241 put_unaligned(skb->tstamp.off_usec, &pm->timestamp_usec); 242 put_unaligned(tv.tv_sec, &pm->timestamp_sec);
243 put_unaligned(tv.tv_usec, &pm->timestamp_usec);
242 put_unaligned(skb->mark, &pm->mark); 244 put_unaligned(skb->mark, &pm->mark);
243 pm->hook = hooknum; 245 pm->hook = hooknum;
244 if (prefix != NULL) 246 if (prefix != NULL)
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index fb39604c3d09..a963a31e5fb6 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -255,7 +255,7 @@ static int ipv6_dest_hao(struct sk_buff **skbp, int optoff)
255 ipv6_addr_copy(&ipv6h->saddr, &hao->addr); 255 ipv6_addr_copy(&ipv6h->saddr, &hao->addr);
256 ipv6_addr_copy(&hao->addr, &tmp_addr); 256 ipv6_addr_copy(&hao->addr, &tmp_addr);
257 257
258 if (skb->tstamp.off_sec == 0) 258 if (skb->tstamp.tv64 == 0)
259 __net_timestamp(skb); 259 __net_timestamp(skb);
260 260
261 return 1; 261 return 1;
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index fdb30a5916e5..66a2c4135251 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -195,6 +195,7 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
195 struct sk_buff *skb; 195 struct sk_buff *skb;
196 struct ipq_packet_msg *pmsg; 196 struct ipq_packet_msg *pmsg;
197 struct nlmsghdr *nlh; 197 struct nlmsghdr *nlh;
198 struct timeval tv;
198 199
199 read_lock_bh(&queue_lock); 200 read_lock_bh(&queue_lock);
200 201
@@ -239,8 +240,9 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
239 240
240 pmsg->packet_id = (unsigned long )entry; 241 pmsg->packet_id = (unsigned long )entry;
241 pmsg->data_len = data_len; 242 pmsg->data_len = data_len;
242 pmsg->timestamp_sec = entry->skb->tstamp.off_sec; 243 tv = ktime_to_timeval(entry->skb->tstamp);
243 pmsg->timestamp_usec = entry->skb->tstamp.off_usec; 244 pmsg->timestamp_sec = tv.tv_sec;
245 pmsg->timestamp_usec = tv.tv_usec;
244 pmsg->mark = entry->skb->mark; 246 pmsg->mark = entry->skb->mark;
245 pmsg->hook = entry->info->hook; 247 pmsg->hook = entry->info->hook;
246 pmsg->hw_protocol = entry->skb->protocol; 248 pmsg->hw_protocol = entry->skb->protocol;
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 15ab1e3e8b56..c311b9a12ca6 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -82,7 +82,7 @@ struct nf_ct_frag6_queue
82 struct sk_buff *fragments; 82 struct sk_buff *fragments;
83 int len; 83 int len;
84 int meat; 84 int meat;
85 struct timeval stamp; 85 ktime_t stamp;
86 unsigned int csum; 86 unsigned int csum;
87 __u8 last_in; /* has first/last segment arrived? */ 87 __u8 last_in; /* has first/last segment arrived? */
88#define COMPLETE 4 88#define COMPLETE 4
@@ -542,7 +542,7 @@ static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb,
542 fq->fragments = skb; 542 fq->fragments = skb;
543 543
544 skb->dev = NULL; 544 skb->dev = NULL;
545 skb_get_timestamp(skb, &fq->stamp); 545 fq->stamp = skb->tstamp;
546 fq->meat += skb->len; 546 fq->meat += skb->len;
547 atomic_add(skb->truesize, &nf_ct_frag6_mem); 547 atomic_add(skb->truesize, &nf_ct_frag6_mem);
548 548
@@ -648,7 +648,7 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev)
648 648
649 head->next = NULL; 649 head->next = NULL;
650 head->dev = dev; 650 head->dev = dev;
651 skb_set_timestamp(head, &fq->stamp); 651 head->tstamp = fq->stamp;
652 head->nh.ipv6h->payload_len = htons(payload_len); 652 head->nh.ipv6h->payload_len = htons(payload_len);
653 653
654 /* Yes, and fold redundant checksum back. 8) */ 654 /* Yes, and fold redundant checksum back. 8) */
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 7034c54e5010..1dde449379fb 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -88,7 +88,7 @@ struct frag_queue
88 int len; 88 int len;
89 int meat; 89 int meat;
90 int iif; 90 int iif;
91 struct timeval stamp; 91 ktime_t stamp;
92 unsigned int csum; 92 unsigned int csum;
93 __u8 last_in; /* has first/last segment arrived? */ 93 __u8 last_in; /* has first/last segment arrived? */
94#define COMPLETE 4 94#define COMPLETE 4
@@ -562,7 +562,7 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
562 if (skb->dev) 562 if (skb->dev)
563 fq->iif = skb->dev->ifindex; 563 fq->iif = skb->dev->ifindex;
564 skb->dev = NULL; 564 skb->dev = NULL;
565 skb_get_timestamp(skb, &fq->stamp); 565 fq->stamp = skb->tstamp;
566 fq->meat += skb->len; 566 fq->meat += skb->len;
567 atomic_add(skb->truesize, &ip6_frag_mem); 567 atomic_add(skb->truesize, &ip6_frag_mem);
568 568
@@ -663,7 +663,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff **skb_in,
663 663
664 head->next = NULL; 664 head->next = NULL;
665 head->dev = dev; 665 head->dev = dev;
666 skb_set_timestamp(head, &fq->stamp); 666 head->tstamp = fq->stamp;
667 head->nh.ipv6h->payload_len = htons(payload_len); 667 head->nh.ipv6h->payload_len = htons(payload_len);
668 IP6CB(head)->nhoff = nhoff; 668 IP6CB(head)->nhoff = nhoff;
669 669
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index cac35a77f069..6c6c0a3a0ab5 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -1807,8 +1807,8 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock,
1807 copied); 1807 copied);
1808 if (rc) 1808 if (rc)
1809 goto out_free; 1809 goto out_free;
1810 if (skb->tstamp.off_sec) 1810 if (skb->tstamp.tv64)
1811 skb_get_timestamp(skb, &sk->sk_stamp); 1811 sk->sk_stamp = skb->tstamp;
1812 1812
1813 msg->msg_namelen = sizeof(*sipx); 1813 msg->msg_namelen = sizeof(*sipx);
1814 1814
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 5cb30ebba0f4..5eeebd2efa7a 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -509,11 +509,11 @@ __build_packet_message(struct nfulnl_instance *inst,
509 NFA_PUT(inst->skb, NFULA_HWADDR, sizeof(phw), &phw); 509 NFA_PUT(inst->skb, NFULA_HWADDR, sizeof(phw), &phw);
510 } 510 }
511 511
512 if (skb->tstamp.off_sec) { 512 if (skb->tstamp.tv64) {
513 struct nfulnl_msg_packet_timestamp ts; 513 struct nfulnl_msg_packet_timestamp ts;
514 514 struct timeval tv = ktime_to_timeval(skb->tstamp);
515 ts.sec = cpu_to_be64(skb->tstamp.off_sec); 515 ts.sec = cpu_to_be64(tv.tv_sec);
516 ts.usec = cpu_to_be64(skb->tstamp.off_usec); 516 ts.usec = cpu_to_be64(tv.tv_usec);
517 517
518 NFA_PUT(inst->skb, NFULA_TIMESTAMP, sizeof(ts), &ts); 518 NFA_PUT(inst->skb, NFULA_TIMESTAMP, sizeof(ts), &ts);
519 } 519 }
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index d9ce4a71d0f3..cfbee39f61d6 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -495,11 +495,11 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
495 NFA_PUT(skb, NFQA_HWADDR, sizeof(phw), &phw); 495 NFA_PUT(skb, NFQA_HWADDR, sizeof(phw), &phw);
496 } 496 }
497 497
498 if (entskb->tstamp.off_sec) { 498 if (entskb->tstamp.tv64) {
499 struct nfqnl_msg_packet_timestamp ts; 499 struct nfqnl_msg_packet_timestamp ts;
500 500 struct timeval tv = ktime_to_timeval(entskb->tstamp);
501 ts.sec = cpu_to_be64(entskb->tstamp.off_sec); 501 ts.sec = cpu_to_be64(tv.tv_sec);
502 ts.usec = cpu_to_be64(entskb->tstamp.off_usec); 502 ts.usec = cpu_to_be64(tv.tv_usec);
503 503
504 NFA_PUT(skb, NFQA_TIMESTAMP, sizeof(ts), &ts); 504 NFA_PUT(skb, NFQA_TIMESTAMP, sizeof(ts), &ts);
505 } 505 }
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 28d47e8f2873..f9866a8456a1 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -582,6 +582,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
582 unsigned long status = TP_STATUS_LOSING|TP_STATUS_USER; 582 unsigned long status = TP_STATUS_LOSING|TP_STATUS_USER;
583 unsigned short macoff, netoff; 583 unsigned short macoff, netoff;
584 struct sk_buff *copy_skb = NULL; 584 struct sk_buff *copy_skb = NULL;
585 struct timeval tv;
585 586
586 if (skb->pkt_type == PACKET_LOOPBACK) 587 if (skb->pkt_type == PACKET_LOOPBACK)
587 goto drop; 588 goto drop;
@@ -656,12 +657,13 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
656 h->tp_snaplen = snaplen; 657 h->tp_snaplen = snaplen;
657 h->tp_mac = macoff; 658 h->tp_mac = macoff;
658 h->tp_net = netoff; 659 h->tp_net = netoff;
659 if (skb->tstamp.off_sec == 0) { 660 if (skb->tstamp.tv64 == 0) {
660 __net_timestamp(skb); 661 __net_timestamp(skb);
661 sock_enable_timestamp(sk); 662 sock_enable_timestamp(sk);
662 } 663 }
663 h->tp_sec = skb->tstamp.off_sec; 664 tv = ktime_to_timeval(skb->tstamp);
664 h->tp_usec = skb->tstamp.off_usec; 665 h->tp_sec = tv.tv_sec;
666 h->tp_usec = tv.tv_usec;
665 667
666 sll = (struct sockaddr_ll*)((u8*)h + TPACKET_ALIGN(sizeof(*h))); 668 sll = (struct sockaddr_ll*)((u8*)h + TPACKET_ALIGN(sizeof(*h)));
667 sll->sll_halen = 0; 669 sll->sll_halen = 0;
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 2772fee93881..22f61aee4824 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -798,16 +798,12 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
798 dprintk("svc: recvfrom returned error %d\n", -err); 798 dprintk("svc: recvfrom returned error %d\n", -err);
799 } 799 }
800 rqstp->rq_addrlen = sizeof(rqstp->rq_addr); 800 rqstp->rq_addrlen = sizeof(rqstp->rq_addr);
801 if (skb->tstamp.off_sec == 0) { 801 if (skb->tstamp.tv64 == 0) {
802 struct timeval tv; 802 skb->tstamp = ktime_get_real();
803
804 tv.tv_sec = xtime.tv_sec;
805 tv.tv_usec = xtime.tv_nsec / NSEC_PER_USEC;
806 skb_set_timestamp(skb, &tv);
807 /* Don't enable netstamp, sunrpc doesn't 803 /* Don't enable netstamp, sunrpc doesn't
808 need that much accuracy */ 804 need that much accuracy */
809 } 805 }
810 skb_get_timestamp(skb, &svsk->sk_sk->sk_stamp); 806 svsk->sk_sk->sk_stamp = skb->tstamp;
811 set_bit(SK_DATA, &svsk->sk_flags); /* there may be more data... */ 807 set_bit(SK_DATA, &svsk->sk_flags); /* there may be more data... */
812 808
813 /* 809 /*