diff options
author | Patrick McHardy <kaber@trash.net> | 2005-08-14 20:24:31 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-08-29 18:58:24 -0400 |
commit | a61bbcf28a8cb0ba56f8193d512f7222e711a294 (patch) | |
tree | 33ae1976ab3b08aac516debb2742d2c6696d5436 | |
parent | 25ed891019b84498c83903ecf53df7ce35e9cff6 (diff) |
[NET]: Store skb->timestamp as offset to a base timestamp
Reduces skb size by 8 bytes on 64-bit.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
39 files changed, 172 insertions, 88 deletions
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c index 73c6b85299c1..d74a7c5e75dd 100644 --- a/drivers/atm/ambassador.c +++ b/drivers/atm/ambassador.c | |||
@@ -513,7 +513,7 @@ static void rx_complete (amb_dev * dev, rx_out * rx) { | |||
513 | 513 | ||
514 | // VC layer stats | 514 | // VC layer stats |
515 | atomic_inc(&atm_vcc->stats->rx); | 515 | atomic_inc(&atm_vcc->stats->rx); |
516 | do_gettimeofday(&skb->stamp); | 516 | __net_timestamp(skb); |
517 | // end of our responsability | 517 | // end of our responsability |
518 | atm_vcc->push (atm_vcc, skb); | 518 | atm_vcc->push (atm_vcc, skb); |
519 | return; | 519 | return; |
diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c index f2f01cb82cb4..57f1810fdccd 100644 --- a/drivers/atm/atmtcp.c +++ b/drivers/atm/atmtcp.c | |||
@@ -325,7 +325,7 @@ static int atmtcp_c_send(struct atm_vcc *vcc,struct sk_buff *skb) | |||
325 | result = -ENOBUFS; | 325 | result = -ENOBUFS; |
326 | goto done; | 326 | goto done; |
327 | } | 327 | } |
328 | do_gettimeofday(&new_skb->stamp); | 328 | __net_timestamp(new_skb); |
329 | memcpy(skb_put(new_skb,skb->len),skb->data,skb->len); | 329 | memcpy(skb_put(new_skb,skb->len),skb->data,skb->len); |
330 | out_vcc->push(out_vcc,new_skb); | 330 | out_vcc->push(out_vcc,new_skb); |
331 | atomic_inc(&vcc->stats->tx); | 331 | atomic_inc(&vcc->stats->tx); |
diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c index 10da36934769..c13c4d736ef5 100644 --- a/drivers/atm/eni.c +++ b/drivers/atm/eni.c | |||
@@ -537,7 +537,7 @@ static int rx_aal0(struct atm_vcc *vcc) | |||
537 | return 0; | 537 | return 0; |
538 | } | 538 | } |
539 | skb_put(skb,length); | 539 | skb_put(skb,length); |
540 | skb->stamp = eni_vcc->timestamp; | 540 | skb_set_timestamp(skb, &eni_vcc->timestamp); |
541 | DPRINTK("got len %ld\n",length); | 541 | DPRINTK("got len %ld\n",length); |
542 | if (do_rx_dma(vcc,skb,1,length >> 2,length >> 2)) return 1; | 542 | if (do_rx_dma(vcc,skb,1,length >> 2,length >> 2)) return 1; |
543 | eni_vcc->rxing++; | 543 | eni_vcc->rxing++; |
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c index b078fa548ebf..58219744f5db 100644 --- a/drivers/atm/firestream.c +++ b/drivers/atm/firestream.c | |||
@@ -815,7 +815,7 @@ static void process_incoming (struct fs_dev *dev, struct queue *q) | |||
815 | skb_put (skb, qe->p1 & 0xffff); | 815 | skb_put (skb, qe->p1 & 0xffff); |
816 | ATM_SKB(skb)->vcc = atm_vcc; | 816 | ATM_SKB(skb)->vcc = atm_vcc; |
817 | atomic_inc(&atm_vcc->stats->rx); | 817 | atomic_inc(&atm_vcc->stats->rx); |
818 | do_gettimeofday(&skb->stamp); | 818 | __net_timestamp(skb); |
819 | fs_dprintk (FS_DEBUG_ALLOC, "Free rec-skb: %p (pushed)\n", skb); | 819 | fs_dprintk (FS_DEBUG_ALLOC, "Free rec-skb: %p (pushed)\n", skb); |
820 | atm_vcc->push (atm_vcc, skb); | 820 | atm_vcc->push (atm_vcc, skb); |
821 | fs_dprintk (FS_DEBUG_ALLOC, "Free rec-d: %p\n", pe); | 821 | fs_dprintk (FS_DEBUG_ALLOC, "Free rec-d: %p\n", pe); |
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index 5f702199543a..2bf723a7b6e6 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c | |||
@@ -1176,7 +1176,7 @@ fore200e_push_rpd(struct fore200e* fore200e, struct atm_vcc* vcc, struct rpd* rp | |||
1176 | return -ENOMEM; | 1176 | return -ENOMEM; |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | do_gettimeofday(&skb->stamp); | 1179 | __net_timestamp(skb); |
1180 | 1180 | ||
1181 | #ifdef FORE200E_52BYTE_AAL0_SDU | 1181 | #ifdef FORE200E_52BYTE_AAL0_SDU |
1182 | if (cell_header) { | 1182 | if (cell_header) { |
diff --git a/drivers/atm/he.c b/drivers/atm/he.c index 28250c9b32d6..fde9334059af 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c | |||
@@ -1886,7 +1886,7 @@ he_service_rbrq(struct he_dev *he_dev, int group) | |||
1886 | if (rx_skb_reserve > 0) | 1886 | if (rx_skb_reserve > 0) |
1887 | skb_reserve(skb, rx_skb_reserve); | 1887 | skb_reserve(skb, rx_skb_reserve); |
1888 | 1888 | ||
1889 | do_gettimeofday(&skb->stamp); | 1889 | __net_timestamp(skb); |
1890 | 1890 | ||
1891 | for (iov = he_vcc->iov_head; | 1891 | for (iov = he_vcc->iov_head; |
1892 | iov < he_vcc->iov_tail; ++iov) { | 1892 | iov < he_vcc->iov_tail; ++iov) { |
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c index 924a2c8988bd..0cded0468003 100644 --- a/drivers/atm/horizon.c +++ b/drivers/atm/horizon.c | |||
@@ -1034,7 +1034,7 @@ static void rx_schedule (hrz_dev * dev, int irq) { | |||
1034 | struct atm_vcc * vcc = ATM_SKB(skb)->vcc; | 1034 | struct atm_vcc * vcc = ATM_SKB(skb)->vcc; |
1035 | // VC layer stats | 1035 | // VC layer stats |
1036 | atomic_inc(&vcc->stats->rx); | 1036 | atomic_inc(&vcc->stats->rx); |
1037 | do_gettimeofday(&skb->stamp); | 1037 | __net_timestamp(skb); |
1038 | // end of our responsability | 1038 | // end of our responsability |
1039 | vcc->push (vcc, skb); | 1039 | vcc->push (vcc, skb); |
1040 | } | 1040 | } |
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c index 30b7e990ed0b..b4a76cade646 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c | |||
@@ -1101,7 +1101,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe) | |||
1101 | cell, ATM_CELL_PAYLOAD); | 1101 | cell, ATM_CELL_PAYLOAD); |
1102 | 1102 | ||
1103 | ATM_SKB(sb)->vcc = vcc; | 1103 | ATM_SKB(sb)->vcc = vcc; |
1104 | do_gettimeofday(&sb->stamp); | 1104 | __net_timestamp(sb); |
1105 | vcc->push(vcc, sb); | 1105 | vcc->push(vcc, sb); |
1106 | atomic_inc(&vcc->stats->rx); | 1106 | atomic_inc(&vcc->stats->rx); |
1107 | 1107 | ||
@@ -1179,7 +1179,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe) | |||
1179 | 1179 | ||
1180 | skb_trim(skb, len); | 1180 | skb_trim(skb, len); |
1181 | ATM_SKB(skb)->vcc = vcc; | 1181 | ATM_SKB(skb)->vcc = vcc; |
1182 | do_gettimeofday(&skb->stamp); | 1182 | __net_timestamp(skb); |
1183 | 1183 | ||
1184 | vcc->push(vcc, skb); | 1184 | vcc->push(vcc, skb); |
1185 | atomic_inc(&vcc->stats->rx); | 1185 | atomic_inc(&vcc->stats->rx); |
@@ -1201,7 +1201,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe) | |||
1201 | 1201 | ||
1202 | skb_trim(skb, len); | 1202 | skb_trim(skb, len); |
1203 | ATM_SKB(skb)->vcc = vcc; | 1203 | ATM_SKB(skb)->vcc = vcc; |
1204 | do_gettimeofday(&skb->stamp); | 1204 | __net_timestamp(skb); |
1205 | 1205 | ||
1206 | vcc->push(vcc, skb); | 1206 | vcc->push(vcc, skb); |
1207 | atomic_inc(&vcc->stats->rx); | 1207 | atomic_inc(&vcc->stats->rx); |
@@ -1340,7 +1340,7 @@ idt77252_rx_raw(struct idt77252_dev *card) | |||
1340 | ATM_CELL_PAYLOAD); | 1340 | ATM_CELL_PAYLOAD); |
1341 | 1341 | ||
1342 | ATM_SKB(sb)->vcc = vcc; | 1342 | ATM_SKB(sb)->vcc = vcc; |
1343 | do_gettimeofday(&sb->stamp); | 1343 | __net_timestamp(sb); |
1344 | vcc->push(vcc, sb); | 1344 | vcc->push(vcc, sb); |
1345 | atomic_inc(&vcc->stats->rx); | 1345 | atomic_inc(&vcc->stats->rx); |
1346 | 1346 | ||
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c index ffe3afa723b8..51ec14787293 100644 --- a/drivers/atm/lanai.c +++ b/drivers/atm/lanai.c | |||
@@ -1427,7 +1427,7 @@ static void vcc_rx_aal5(struct lanai_vcc *lvcc, int endptr) | |||
1427 | skb_put(skb, size); | 1427 | skb_put(skb, size); |
1428 | vcc_rx_memcpy(skb->data, lvcc, size); | 1428 | vcc_rx_memcpy(skb->data, lvcc, size); |
1429 | ATM_SKB(skb)->vcc = lvcc->rx.atmvcc; | 1429 | ATM_SKB(skb)->vcc = lvcc->rx.atmvcc; |
1430 | do_gettimeofday(&skb->stamp); | 1430 | __net_timestamp(skb); |
1431 | lvcc->rx.atmvcc->push(lvcc->rx.atmvcc, skb); | 1431 | lvcc->rx.atmvcc->push(lvcc->rx.atmvcc, skb); |
1432 | atomic_inc(&lvcc->rx.atmvcc->stats->rx); | 1432 | atomic_inc(&lvcc->rx.atmvcc->stats->rx); |
1433 | out: | 1433 | out: |
diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c index a0e3bd861f1c..c57e20dcb0f8 100644 --- a/drivers/atm/nicstar.c +++ b/drivers/atm/nicstar.c | |||
@@ -2213,7 +2213,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) | |||
2213 | memcpy(sb->tail, cell, ATM_CELL_PAYLOAD); | 2213 | memcpy(sb->tail, cell, ATM_CELL_PAYLOAD); |
2214 | skb_put(sb, ATM_CELL_PAYLOAD); | 2214 | skb_put(sb, ATM_CELL_PAYLOAD); |
2215 | ATM_SKB(sb)->vcc = vcc; | 2215 | ATM_SKB(sb)->vcc = vcc; |
2216 | do_gettimeofday(&sb->stamp); | 2216 | __net_timestamp(sb); |
2217 | vcc->push(vcc, sb); | 2217 | vcc->push(vcc, sb); |
2218 | atomic_inc(&vcc->stats->rx); | 2218 | atomic_inc(&vcc->stats->rx); |
2219 | cell += ATM_CELL_PAYLOAD; | 2219 | cell += ATM_CELL_PAYLOAD; |
@@ -2346,7 +2346,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) | |||
2346 | skb->destructor = ns_sb_destructor; | 2346 | skb->destructor = ns_sb_destructor; |
2347 | #endif /* NS_USE_DESTRUCTORS */ | 2347 | #endif /* NS_USE_DESTRUCTORS */ |
2348 | ATM_SKB(skb)->vcc = vcc; | 2348 | ATM_SKB(skb)->vcc = vcc; |
2349 | do_gettimeofday(&skb->stamp); | 2349 | __net_timestamp(skb); |
2350 | vcc->push(vcc, skb); | 2350 | vcc->push(vcc, skb); |
2351 | atomic_inc(&vcc->stats->rx); | 2351 | atomic_inc(&vcc->stats->rx); |
2352 | } | 2352 | } |
@@ -2373,7 +2373,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) | |||
2373 | sb->destructor = ns_sb_destructor; | 2373 | sb->destructor = ns_sb_destructor; |
2374 | #endif /* NS_USE_DESTRUCTORS */ | 2374 | #endif /* NS_USE_DESTRUCTORS */ |
2375 | ATM_SKB(sb)->vcc = vcc; | 2375 | ATM_SKB(sb)->vcc = vcc; |
2376 | do_gettimeofday(&sb->stamp); | 2376 | __net_timestamp(sb); |
2377 | vcc->push(vcc, sb); | 2377 | vcc->push(vcc, sb); |
2378 | atomic_inc(&vcc->stats->rx); | 2378 | atomic_inc(&vcc->stats->rx); |
2379 | } | 2379 | } |
@@ -2398,7 +2398,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) | |||
2398 | memcpy(skb->data, sb->data, NS_SMBUFSIZE); | 2398 | memcpy(skb->data, sb->data, NS_SMBUFSIZE); |
2399 | skb_put(skb, len - NS_SMBUFSIZE); | 2399 | skb_put(skb, len - NS_SMBUFSIZE); |
2400 | ATM_SKB(skb)->vcc = vcc; | 2400 | ATM_SKB(skb)->vcc = vcc; |
2401 | do_gettimeofday(&skb->stamp); | 2401 | __net_timestamp(skb); |
2402 | vcc->push(vcc, skb); | 2402 | vcc->push(vcc, skb); |
2403 | atomic_inc(&vcc->stats->rx); | 2403 | atomic_inc(&vcc->stats->rx); |
2404 | } | 2404 | } |
@@ -2505,7 +2505,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) | |||
2505 | #ifdef NS_USE_DESTRUCTORS | 2505 | #ifdef NS_USE_DESTRUCTORS |
2506 | hb->destructor = ns_hb_destructor; | 2506 | hb->destructor = ns_hb_destructor; |
2507 | #endif /* NS_USE_DESTRUCTORS */ | 2507 | #endif /* NS_USE_DESTRUCTORS */ |
2508 | do_gettimeofday(&hb->stamp); | 2508 | __net_timestamp(hb); |
2509 | vcc->push(vcc, hb); | 2509 | vcc->push(vcc, hb); |
2510 | atomic_inc(&vcc->stats->rx); | 2510 | atomic_inc(&vcc->stats->rx); |
2511 | } | 2511 | } |
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c index 85fee9530fa9..c4b75ecf9460 100644 --- a/drivers/atm/zatm.c +++ b/drivers/atm/zatm.c | |||
@@ -400,7 +400,7 @@ unsigned long *x; | |||
400 | EVENT("error code 0x%x/0x%x\n",(here[3] & uPD98401_AAL5_ES) >> | 400 | EVENT("error code 0x%x/0x%x\n",(here[3] & uPD98401_AAL5_ES) >> |
401 | uPD98401_AAL5_ES_SHIFT,error); | 401 | uPD98401_AAL5_ES_SHIFT,error); |
402 | skb = ((struct rx_buffer_head *) bus_to_virt(here[2]))->skb; | 402 | skb = ((struct rx_buffer_head *) bus_to_virt(here[2]))->skb; |
403 | do_gettimeofday(&skb->stamp); | 403 | __net_timestamp(skb); |
404 | #if 0 | 404 | #if 0 |
405 | printk("[-3..0] 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n",((unsigned *) skb->data)[-3], | 405 | printk("[-3..0] 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n",((unsigned *) skb->data)[-3], |
406 | ((unsigned *) skb->data)[-2],((unsigned *) skb->data)[-1], | 406 | ((unsigned *) skb->data)[-2],((unsigned *) skb->data)[-1], |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 60b32151f76a..32635c401d4d 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -155,13 +155,20 @@ struct skb_shared_info { | |||
155 | #define SKB_DATAREF_SHIFT 16 | 155 | #define SKB_DATAREF_SHIFT 16 |
156 | #define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1) | 156 | #define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1) |
157 | 157 | ||
158 | extern struct timeval skb_tv_base; | ||
159 | |||
160 | struct skb_timeval { | ||
161 | u32 off_sec; | ||
162 | u32 off_usec; | ||
163 | }; | ||
164 | |||
158 | /** | 165 | /** |
159 | * struct sk_buff - socket buffer | 166 | * struct sk_buff - socket buffer |
160 | * @next: Next buffer in list | 167 | * @next: Next buffer in list |
161 | * @prev: Previous buffer in list | 168 | * @prev: Previous buffer in list |
162 | * @list: List we are on | 169 | * @list: List we are on |
163 | * @sk: Socket we are owned by | 170 | * @sk: Socket we are owned by |
164 | * @stamp: Time we arrived | 171 | * @tstamp: Time we arrived stored as offset to skb_tv_base |
165 | * @dev: Device we arrived on/are leaving by | 172 | * @dev: Device we arrived on/are leaving by |
166 | * @input_dev: Device we arrived on | 173 | * @input_dev: Device we arrived on |
167 | * @h: Transport layer header | 174 | * @h: Transport layer header |
@@ -202,7 +209,7 @@ struct sk_buff { | |||
202 | struct sk_buff *prev; | 209 | struct sk_buff *prev; |
203 | 210 | ||
204 | struct sock *sk; | 211 | struct sock *sk; |
205 | struct timeval stamp; | 212 | struct skb_timeval tstamp; |
206 | struct net_device *dev; | 213 | struct net_device *dev; |
207 | struct net_device *input_dev; | 214 | struct net_device *input_dev; |
208 | 215 | ||
@@ -1213,6 +1220,42 @@ static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, | |||
1213 | extern void skb_init(void); | 1220 | extern void skb_init(void); |
1214 | extern void skb_add_mtu(int mtu); | 1221 | extern void skb_add_mtu(int mtu); |
1215 | 1222 | ||
1223 | /** | ||
1224 | * skb_get_timestamp - get timestamp from a skb | ||
1225 | * @skb: skb to get stamp from | ||
1226 | * @stamp: pointer to struct timeval to store stamp in | ||
1227 | * | ||
1228 | * Timestamps are stored in the skb as offsets to a base timestamp. | ||
1229 | * This function converts the offset back to a struct timeval and stores | ||
1230 | * it in stamp. | ||
1231 | */ | ||
1232 | static inline void skb_get_timestamp(struct sk_buff *skb, struct timeval *stamp) | ||
1233 | { | ||
1234 | stamp->tv_sec = skb->tstamp.off_sec; | ||
1235 | stamp->tv_usec = skb->tstamp.off_usec; | ||
1236 | if (skb->tstamp.off_sec) { | ||
1237 | stamp->tv_sec += skb_tv_base.tv_sec; | ||
1238 | stamp->tv_usec += skb_tv_base.tv_usec; | ||
1239 | } | ||
1240 | } | ||
1241 | |||
1242 | /** | ||
1243 | * skb_set_timestamp - set timestamp of a skb | ||
1244 | * @skb: skb to set stamp of | ||
1245 | * @stamp: pointer to struct timeval to get stamp from | ||
1246 | * | ||
1247 | * Timestamps are stored in the skb as offsets to a base timestamp. | ||
1248 | * This function converts a struct timeval to an offset and stores | ||
1249 | * it in the skb. | ||
1250 | */ | ||
1251 | static inline void skb_set_timestamp(struct sk_buff *skb, struct timeval *stamp) | ||
1252 | { | ||
1253 | skb->tstamp.off_sec = stamp->tv_sec - skb_tv_base.tv_sec; | ||
1254 | skb->tstamp.off_usec = stamp->tv_usec - skb_tv_base.tv_usec; | ||
1255 | } | ||
1256 | |||
1257 | extern void __net_timestamp(struct sk_buff *skb); | ||
1258 | |||
1216 | #ifdef CONFIG_NETFILTER | 1259 | #ifdef CONFIG_NETFILTER |
1217 | static inline void nf_conntrack_put(struct nf_conntrack *nfct) | 1260 | static inline void nf_conntrack_put(struct nf_conntrack *nfct) |
1218 | { | 1261 | { |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 6d63a47c731b..7f933f302078 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -404,7 +404,7 @@ static inline int hci_recv_frame(struct sk_buff *skb) | |||
404 | bt_cb(skb)->incoming = 1; | 404 | bt_cb(skb)->incoming = 1; |
405 | 405 | ||
406 | /* Time stamp */ | 406 | /* Time stamp */ |
407 | do_gettimeofday(&skb->stamp); | 407 | __net_timestamp(skb); |
408 | 408 | ||
409 | /* Queue frame for rx task */ | 409 | /* Queue frame for rx task */ |
410 | skb_queue_tail(&hdev->rx_q, skb); | 410 | skb_queue_tail(&hdev->rx_q, skb); |
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 89809891e5ab..34c07731933d 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
@@ -363,7 +363,14 @@ __neigh_lookup_errno(struct neigh_table *tbl, const void *pkey, | |||
363 | return neigh_create(tbl, pkey, dev); | 363 | return neigh_create(tbl, pkey, dev); |
364 | } | 364 | } |
365 | 365 | ||
366 | #define LOCALLY_ENQUEUED -2 | 366 | struct neighbour_cb { |
367 | unsigned long sched_next; | ||
368 | unsigned int flags; | ||
369 | }; | ||
370 | |||
371 | #define LOCALLY_ENQUEUED 0x1 | ||
372 | |||
373 | #define NEIGH_CB(skb) ((struct neighbour_cb *)(skb)->cb) | ||
367 | 374 | ||
368 | #endif | 375 | #endif |
369 | #endif | 376 | #endif |
diff --git a/include/net/sock.h b/include/net/sock.h index 065df67b6422..d59428877078 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1282,16 +1282,19 @@ static inline int sock_intr_errno(long timeo) | |||
1282 | static __inline__ void | 1282 | static __inline__ void |
1283 | sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) | 1283 | sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) |
1284 | { | 1284 | { |
1285 | struct timeval *stamp = &skb->stamp; | 1285 | struct timeval stamp; |
1286 | |||
1287 | skb_get_timestamp(skb, &stamp); | ||
1286 | if (sock_flag(sk, SOCK_RCVTSTAMP)) { | 1288 | if (sock_flag(sk, SOCK_RCVTSTAMP)) { |
1287 | /* Race occurred between timestamp enabling and packet | 1289 | /* Race occurred between timestamp enabling and packet |
1288 | receiving. Fill in the current time for now. */ | 1290 | receiving. Fill in the current time for now. */ |
1289 | if (stamp->tv_sec == 0) | 1291 | if (stamp.tv_sec == 0) |
1290 | do_gettimeofday(stamp); | 1292 | do_gettimeofday(&stamp); |
1293 | skb_set_timestamp(skb, &stamp); | ||
1291 | put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMP, sizeof(struct timeval), | 1294 | put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMP, sizeof(struct timeval), |
1292 | stamp); | 1295 | &stamp); |
1293 | } else | 1296 | } else |
1294 | sk->sk_stamp = *stamp; | 1297 | sk->sk_stamp = stamp; |
1295 | } | 1298 | } |
1296 | 1299 | ||
1297 | /** | 1300 | /** |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 4f9e11b533a3..55dc42eac92c 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -999,7 +999,7 @@ static int hci_send_frame(struct sk_buff *skb) | |||
999 | 999 | ||
1000 | if (atomic_read(&hdev->promisc)) { | 1000 | if (atomic_read(&hdev->promisc)) { |
1001 | /* Time stamp */ | 1001 | /* Time stamp */ |
1002 | do_gettimeofday(&skb->stamp); | 1002 | __net_timestamp(skb); |
1003 | 1003 | ||
1004 | hci_send_to_sock(hdev, skb); | 1004 | hci_send_to_sock(hdev, skb); |
1005 | } | 1005 | } |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 40b219560bb1..d6da0939216d 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -1087,7 +1087,7 @@ void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data) | |||
1087 | memcpy(ev->data, data, dlen); | 1087 | memcpy(ev->data, data, dlen); |
1088 | 1088 | ||
1089 | bt_cb(skb)->incoming = 1; | 1089 | bt_cb(skb)->incoming = 1; |
1090 | do_gettimeofday(&skb->stamp); | 1090 | __net_timestamp(skb); |
1091 | 1091 | ||
1092 | bt_cb(skb)->pkt_type = HCI_EVENT_PKT; | 1092 | bt_cb(skb)->pkt_type = HCI_EVENT_PKT; |
1093 | skb->dev = (void *) hdev; | 1093 | skb->dev = (void *) hdev; |
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index eed9090d77f1..32ef7975a139 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -332,8 +332,12 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_ | |||
332 | put_cmsg(msg, SOL_HCI, HCI_CMSG_DIR, sizeof(incoming), &incoming); | 332 | put_cmsg(msg, SOL_HCI, HCI_CMSG_DIR, sizeof(incoming), &incoming); |
333 | } | 333 | } |
334 | 334 | ||
335 | if (mask & HCI_CMSG_TSTAMP) | 335 | if (mask & HCI_CMSG_TSTAMP) { |
336 | put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(skb->stamp), &skb->stamp); | 336 | struct timeval tv; |
337 | |||
338 | skb_get_timestamp(skb, &tv); | ||
339 | put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(tv), &tv); | ||
340 | } | ||
337 | } | 341 | } |
338 | 342 | ||
339 | static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | 343 | static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock, |
diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c index 561d75c8ed5a..acb888d32587 100644 --- a/net/bridge/netfilter/ebt_ulog.c +++ b/net/bridge/netfilter/ebt_ulog.c | |||
@@ -162,7 +162,7 @@ static void ebt_ulog(const struct sk_buff *skb, unsigned int hooknr, | |||
162 | pm->version = EBT_ULOG_VERSION; | 162 | pm->version = EBT_ULOG_VERSION; |
163 | do_gettimeofday(&pm->stamp); | 163 | do_gettimeofday(&pm->stamp); |
164 | if (ub->qlen == 1) | 164 | if (ub->qlen == 1) |
165 | ub->skb->stamp = pm->stamp; | 165 | skb_set_timestamp(ub->skb, &pm->stamp); |
166 | pm->data_len = copy_len; | 166 | pm->data_len = copy_len; |
167 | pm->mark = skb->nfmark; | 167 | pm->mark = skb->nfmark; |
168 | pm->hook = hooknr; | 168 | pm->hook = hooknr; |
diff --git a/net/core/dev.c b/net/core/dev.c index 9d153eb1e8cf..a3ed53cc4af8 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1009,13 +1009,22 @@ void net_disable_timestamp(void) | |||
1009 | atomic_dec(&netstamp_needed); | 1009 | atomic_dec(&netstamp_needed); |
1010 | } | 1010 | } |
1011 | 1011 | ||
1012 | static inline void net_timestamp(struct timeval *stamp) | 1012 | void __net_timestamp(struct sk_buff *skb) |
1013 | { | ||
1014 | struct timeval tv; | ||
1015 | |||
1016 | do_gettimeofday(&tv); | ||
1017 | skb_set_timestamp(skb, &tv); | ||
1018 | } | ||
1019 | EXPORT_SYMBOL(__net_timestamp); | ||
1020 | |||
1021 | static inline void net_timestamp(struct sk_buff *skb) | ||
1013 | { | 1022 | { |
1014 | if (atomic_read(&netstamp_needed)) | 1023 | if (atomic_read(&netstamp_needed)) |
1015 | do_gettimeofday(stamp); | 1024 | __net_timestamp(skb); |
1016 | else { | 1025 | else { |
1017 | stamp->tv_sec = 0; | 1026 | skb->tstamp.off_sec = 0; |
1018 | stamp->tv_usec = 0; | 1027 | skb->tstamp.off_usec = 0; |
1019 | } | 1028 | } |
1020 | } | 1029 | } |
1021 | 1030 | ||
@@ -1027,7 +1036,8 @@ static inline void net_timestamp(struct timeval *stamp) | |||
1027 | void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev) | 1036 | void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev) |
1028 | { | 1037 | { |
1029 | struct packet_type *ptype; | 1038 | struct packet_type *ptype; |
1030 | net_timestamp(&skb->stamp); | 1039 | |
1040 | net_timestamp(skb); | ||
1031 | 1041 | ||
1032 | rcu_read_lock(); | 1042 | rcu_read_lock(); |
1033 | list_for_each_entry_rcu(ptype, &ptype_all, list) { | 1043 | list_for_each_entry_rcu(ptype, &ptype_all, list) { |
@@ -1379,8 +1389,8 @@ int netif_rx(struct sk_buff *skb) | |||
1379 | if (netpoll_rx(skb)) | 1389 | if (netpoll_rx(skb)) |
1380 | return NET_RX_DROP; | 1390 | return NET_RX_DROP; |
1381 | 1391 | ||
1382 | if (!skb->stamp.tv_sec) | 1392 | if (!skb->tstamp.off_sec) |
1383 | net_timestamp(&skb->stamp); | 1393 | net_timestamp(skb); |
1384 | 1394 | ||
1385 | /* | 1395 | /* |
1386 | * The code is rearranged so that the path is the most | 1396 | * The code is rearranged so that the path is the most |
@@ -1566,8 +1576,8 @@ int netif_receive_skb(struct sk_buff *skb) | |||
1566 | if (skb->dev->poll && netpoll_rx(skb)) | 1576 | if (skb->dev->poll && netpoll_rx(skb)) |
1567 | return NET_RX_DROP; | 1577 | return NET_RX_DROP; |
1568 | 1578 | ||
1569 | if (!skb->stamp.tv_sec) | 1579 | if (!skb->tstamp.off_sec) |
1570 | net_timestamp(&skb->stamp); | 1580 | net_timestamp(skb); |
1571 | 1581 | ||
1572 | if (!skb->input_dev) | 1582 | if (!skb->input_dev) |
1573 | skb->input_dev = skb->dev; | 1583 | skb->input_dev = skb->dev; |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 1beb782ac41b..72ee00f7b30c 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -1217,7 +1217,7 @@ static void neigh_proxy_process(unsigned long arg) | |||
1217 | 1217 | ||
1218 | while (skb != (struct sk_buff *)&tbl->proxy_queue) { | 1218 | while (skb != (struct sk_buff *)&tbl->proxy_queue) { |
1219 | struct sk_buff *back = skb; | 1219 | struct sk_buff *back = skb; |
1220 | long tdif = back->stamp.tv_usec - now; | 1220 | long tdif = NEIGH_CB(back)->sched_next - now; |
1221 | 1221 | ||
1222 | skb = skb->next; | 1222 | skb = skb->next; |
1223 | if (tdif <= 0) { | 1223 | if (tdif <= 0) { |
@@ -1248,8 +1248,9 @@ void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, | |||
1248 | kfree_skb(skb); | 1248 | kfree_skb(skb); |
1249 | return; | 1249 | return; |
1250 | } | 1250 | } |
1251 | skb->stamp.tv_sec = LOCALLY_ENQUEUED; | 1251 | |
1252 | skb->stamp.tv_usec = sched_next; | 1252 | NEIGH_CB(skb)->sched_next = sched_next; |
1253 | NEIGH_CB(skb)->flags |= LOCALLY_ENQUEUED; | ||
1253 | 1254 | ||
1254 | spin_lock(&tbl->proxy_queue.lock); | 1255 | spin_lock(&tbl->proxy_queue.lock); |
1255 | if (del_timer(&tbl->proxy_timer)) { | 1256 | if (del_timer(&tbl->proxy_timer)) { |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index ef498cb9f786..39a161dbc16d 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -70,6 +70,8 @@ | |||
70 | 70 | ||
71 | static kmem_cache_t *skbuff_head_cache; | 71 | static kmem_cache_t *skbuff_head_cache; |
72 | 72 | ||
73 | struct timeval __read_mostly skb_tv_base; | ||
74 | |||
73 | /* | 75 | /* |
74 | * Keep out-of-line to prevent kernel bloat. | 76 | * Keep out-of-line to prevent kernel bloat. |
75 | * __builtin_return_address is not used because it is not always | 77 | * __builtin_return_address is not used because it is not always |
@@ -331,7 +333,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, unsigned int __nocast gfp_mask) | |||
331 | 333 | ||
332 | n->next = n->prev = NULL; | 334 | n->next = n->prev = NULL; |
333 | n->sk = NULL; | 335 | n->sk = NULL; |
334 | C(stamp); | 336 | C(tstamp); |
335 | C(dev); | 337 | C(dev); |
336 | C(h); | 338 | C(h); |
337 | C(nh); | 339 | C(nh); |
@@ -408,7 +410,7 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) | |||
408 | memcpy(new->cb, old->cb, sizeof(old->cb)); | 410 | memcpy(new->cb, old->cb, sizeof(old->cb)); |
409 | new->local_df = old->local_df; | 411 | new->local_df = old->local_df; |
410 | new->pkt_type = old->pkt_type; | 412 | new->pkt_type = old->pkt_type; |
411 | new->stamp = old->stamp; | 413 | new->tstamp = old->tstamp; |
412 | new->destructor = NULL; | 414 | new->destructor = NULL; |
413 | #ifdef CONFIG_NETFILTER | 415 | #ifdef CONFIG_NETFILTER |
414 | new->nfmark = old->nfmark; | 416 | new->nfmark = old->nfmark; |
@@ -1645,6 +1647,7 @@ void __init skb_init(void) | |||
1645 | NULL, NULL); | 1647 | NULL, NULL); |
1646 | if (!skbuff_head_cache) | 1648 | if (!skbuff_head_cache) |
1647 | panic("cannot create skbuff cache"); | 1649 | panic("cannot create skbuff cache"); |
1650 | do_gettimeofday(&skb_tv_base); | ||
1648 | } | 1651 | } |
1649 | 1652 | ||
1650 | EXPORT_SYMBOL(___pskb_trim); | 1653 | EXPORT_SYMBOL(___pskb_trim); |
@@ -1678,3 +1681,4 @@ EXPORT_SYMBOL(skb_prepare_seq_read); | |||
1678 | EXPORT_SYMBOL(skb_seq_read); | 1681 | EXPORT_SYMBOL(skb_seq_read); |
1679 | EXPORT_SYMBOL(skb_abort_seq_read); | 1682 | EXPORT_SYMBOL(skb_abort_seq_read); |
1680 | EXPORT_SYMBOL(skb_find_text); | 1683 | EXPORT_SYMBOL(skb_find_text); |
1684 | EXPORT_SYMBOL(skb_tv_base); | ||
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index 8f0639905558..4a62093eb343 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c | |||
@@ -159,7 +159,7 @@ static int econet_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
159 | err = memcpy_toiovec(msg->msg_iov, skb->data, copied); | 159 | err = memcpy_toiovec(msg->msg_iov, skb->data, copied); |
160 | if (err) | 160 | if (err) |
161 | goto out_free; | 161 | goto out_free; |
162 | sk->sk_stamp = skb->stamp; | 162 | skb_get_timestamp(skb, &sk->sk_stamp); |
163 | 163 | ||
164 | if (msg->msg_name) | 164 | if (msg->msg_name) |
165 | memcpy(msg->msg_name, skb->cb, msg->msg_namelen); | 165 | memcpy(msg->msg_name, skb->cb, msg->msg_namelen); |
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 6eb9c549d643..8bf312bdea13 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -865,7 +865,7 @@ static int arp_process(struct sk_buff *skb) | |||
865 | if (n) | 865 | if (n) |
866 | neigh_release(n); | 866 | neigh_release(n); |
867 | 867 | ||
868 | if (skb->stamp.tv_sec == LOCALLY_ENQUEUED || | 868 | if (NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED || |
869 | skb->pkt_type == PACKET_HOST || | 869 | skb->pkt_type == PACKET_HOST || |
870 | in_dev->arp_parms->proxy_delay == 0) { | 870 | in_dev->arp_parms->proxy_delay == 0) { |
871 | arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); | 871 | arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); |
@@ -948,6 +948,8 @@ int arp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, | |||
948 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) | 948 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) |
949 | goto out_of_mem; | 949 | goto out_of_mem; |
950 | 950 | ||
951 | memset(NEIGH_CB(skb), 0, sizeof(struct neighbour_cb)); | ||
952 | |||
951 | return NF_HOOK(NF_ARP, NF_ARP_IN, skb, dev, NULL, arp_process); | 953 | return NF_HOOK(NF_ARP, NF_ARP_IN, skb, dev, NULL, arp_process); |
952 | 954 | ||
953 | freeskb: | 955 | freeskb: |
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 1ac64c0c5b37..9e6e683cc34d 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -533,7 +533,7 @@ static void ip_frag_queue(struct ipq *qp, struct sk_buff *skb) | |||
533 | if (skb->dev) | 533 | if (skb->dev) |
534 | qp->iif = skb->dev->ifindex; | 534 | qp->iif = skb->dev->ifindex; |
535 | skb->dev = NULL; | 535 | skb->dev = NULL; |
536 | qp->stamp = skb->stamp; | 536 | skb_get_timestamp(skb, &qp->stamp); |
537 | qp->meat += skb->len; | 537 | qp->meat += skb->len; |
538 | atomic_add(skb->truesize, &ip_frag_mem); | 538 | atomic_add(skb->truesize, &ip_frag_mem); |
539 | if (offset == 0) | 539 | if (offset == 0) |
@@ -615,7 +615,7 @@ static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev) | |||
615 | 615 | ||
616 | head->next = NULL; | 616 | head->next = NULL; |
617 | head->dev = dev; | 617 | head->dev = dev; |
618 | head->stamp = qp->stamp; | 618 | skb_set_timestamp(head, &qp->stamp); |
619 | 619 | ||
620 | iph = head->nh.iph; | 620 | iph = head->nh.iph; |
621 | iph->frag_off = 0; | 621 | iph->frag_off = 0; |
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c index 1c49833e00a9..7f2bcc7198fa 100644 --- a/net/ipv4/netfilter/ip_queue.c +++ b/net/ipv4/netfilter/ip_queue.c | |||
@@ -240,8 +240,8 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) | |||
240 | 240 | ||
241 | pmsg->packet_id = (unsigned long )entry; | 241 | pmsg->packet_id = (unsigned long )entry; |
242 | pmsg->data_len = data_len; | 242 | pmsg->data_len = data_len; |
243 | pmsg->timestamp_sec = entry->skb->stamp.tv_sec; | 243 | pmsg->timestamp_sec = skb_tv_base.tv_sec + entry->skb->tstamp.off_sec; |
244 | pmsg->timestamp_usec = entry->skb->stamp.tv_usec; | 244 | pmsg->timestamp_usec = skb_tv_base.tv_usec + entry->skb->tstamp.off_usec; |
245 | pmsg->mark = entry->skb->nfmark; | 245 | pmsg->mark = entry->skb->nfmark; |
246 | pmsg->hook = entry->info->hook; | 246 | pmsg->hook = entry->info->hook; |
247 | pmsg->hw_protocol = entry->skb->protocol; | 247 | pmsg->hw_protocol = entry->skb->protocol; |
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c index b86f06ec9762..1d8ac4595e17 100644 --- a/net/ipv4/netfilter/ipt_ULOG.c +++ b/net/ipv4/netfilter/ipt_ULOG.c | |||
@@ -220,13 +220,13 @@ static void ipt_ulog_packet(unsigned int hooknum, | |||
220 | pm = NLMSG_DATA(nlh); | 220 | pm = NLMSG_DATA(nlh); |
221 | 221 | ||
222 | /* We might not have a timestamp, get one */ | 222 | /* We might not have a timestamp, get one */ |
223 | if (skb->stamp.tv_sec == 0) | 223 | if (skb->tstamp.off_sec == 0) |
224 | do_gettimeofday((struct timeval *)&skb->stamp); | 224 | __net_timestamp((struct sk_buff *)skb); |
225 | 225 | ||
226 | /* copy hook, prefix, timestamp, payload, etc. */ | 226 | /* copy hook, prefix, timestamp, payload, etc. */ |
227 | pm->data_len = copy_len; | 227 | pm->data_len = copy_len; |
228 | pm->timestamp_sec = skb->stamp.tv_sec; | 228 | pm->timestamp_sec = skb_tv_base.tv_sec + skb->tstamp.off_sec; |
229 | pm->timestamp_usec = skb->stamp.tv_usec; | 229 | pm->timestamp_usec = skb_tv_base.tv_usec + skb->tstamp.off_usec; |
230 | pm->mark = skb->nfmark; | 230 | pm->mark = skb->nfmark; |
231 | pm->hook = hooknum; | 231 | pm->hook = hooknum; |
232 | if (prefix != NULL) | 232 | if (prefix != NULL) |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index fdd9547fb783..ebb8654e3dee 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -2097,9 +2097,13 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p, s32 *seq_usrtt | |||
2097 | seq_rtt = -1; | 2097 | seq_rtt = -1; |
2098 | } else if (seq_rtt < 0) | 2098 | } else if (seq_rtt < 0) |
2099 | seq_rtt = now - scb->when; | 2099 | seq_rtt = now - scb->when; |
2100 | if (seq_usrtt) | 2100 | if (seq_usrtt) { |
2101 | *seq_usrtt = (usnow.tv_sec - skb->stamp.tv_sec) * 1000000 | 2101 | struct timeval tv; |
2102 | + (usnow.tv_usec - skb->stamp.tv_usec); | 2102 | |
2103 | skb_get_timestamp(skb, &tv); | ||
2104 | *seq_usrtt = (usnow.tv_sec - tv.tv_sec) * 1000000 | ||
2105 | + (usnow.tv_usec - tv.tv_usec); | ||
2106 | } | ||
2103 | 2107 | ||
2104 | if (sacked & TCPCB_SACKED_ACKED) | 2108 | if (sacked & TCPCB_SACKED_ACKED) |
2105 | tp->sacked_out -= tcp_skb_pcount(skb); | 2109 | tp->sacked_out -= tcp_skb_pcount(skb); |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 267b0fcbfc9c..8d92ab562aed 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -282,7 +282,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb) | |||
282 | 282 | ||
283 | /* If congestion control is doing timestamping */ | 283 | /* If congestion control is doing timestamping */ |
284 | if (icsk->icsk_ca_ops->rtt_sample) | 284 | if (icsk->icsk_ca_ops->rtt_sample) |
285 | do_gettimeofday(&skb->stamp); | 285 | __net_timestamp(skb); |
286 | 286 | ||
287 | sysctl_flags = 0; | 287 | sysctl_flags = 0; |
288 | if (tcb->flags & TCPCB_FLAG_SYN) { | 288 | if (tcb->flags & TCPCB_FLAG_SYN) { |
@@ -483,7 +483,7 @@ static int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned | |||
483 | * skbs, which it never sent before. --ANK | 483 | * skbs, which it never sent before. --ANK |
484 | */ | 484 | */ |
485 | TCP_SKB_CB(buff)->when = TCP_SKB_CB(skb)->when; | 485 | TCP_SKB_CB(buff)->when = TCP_SKB_CB(skb)->when; |
486 | buff->stamp = skb->stamp; | 486 | buff->tstamp = skb->tstamp; |
487 | 487 | ||
488 | if (TCP_SKB_CB(skb)->sacked & TCPCB_LOST) { | 488 | if (TCP_SKB_CB(skb)->sacked & TCPCB_LOST) { |
489 | tp->lost_out -= tcp_skb_pcount(skb); | 489 | tp->lost_out -= tcp_skb_pcount(skb); |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 7ae72d4c9bd2..a7eae30f4554 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -812,7 +812,7 @@ static void ndisc_recv_ns(struct sk_buff *skb) | |||
812 | if (ipv6_chk_acast_addr(dev, &msg->target) || | 812 | if (ipv6_chk_acast_addr(dev, &msg->target) || |
813 | (idev->cnf.forwarding && | 813 | (idev->cnf.forwarding && |
814 | pneigh_lookup(&nd_tbl, &msg->target, dev, 0))) { | 814 | pneigh_lookup(&nd_tbl, &msg->target, dev, 0))) { |
815 | if (skb->stamp.tv_sec != LOCALLY_ENQUEUED && | 815 | if (!(NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED) && |
816 | skb->pkt_type != PACKET_HOST && | 816 | skb->pkt_type != PACKET_HOST && |
817 | inc != 0 && | 817 | inc != 0 && |
818 | idev->nd_parms->proxy_delay != 0) { | 818 | idev->nd_parms->proxy_delay != 0) { |
@@ -1487,6 +1487,8 @@ int ndisc_rcv(struct sk_buff *skb) | |||
1487 | return 0; | 1487 | return 0; |
1488 | } | 1488 | } |
1489 | 1489 | ||
1490 | memset(NEIGH_CB(skb), 0, sizeof(struct neighbour_cb)); | ||
1491 | |||
1490 | switch (msg->icmph.icmp6_type) { | 1492 | switch (msg->icmph.icmp6_type) { |
1491 | case NDISC_NEIGHBOUR_SOLICITATION: | 1493 | case NDISC_NEIGHBOUR_SOLICITATION: |
1492 | ndisc_recv_ns(skb); | 1494 | ndisc_recv_ns(skb); |
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c index 7ecb91e24a34..446764545b10 100644 --- a/net/ipv6/netfilter/ip6_queue.c +++ b/net/ipv6/netfilter/ip6_queue.c | |||
@@ -238,8 +238,8 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) | |||
238 | 238 | ||
239 | pmsg->packet_id = (unsigned long )entry; | 239 | pmsg->packet_id = (unsigned long )entry; |
240 | pmsg->data_len = data_len; | 240 | pmsg->data_len = data_len; |
241 | pmsg->timestamp_sec = entry->skb->stamp.tv_sec; | 241 | pmsg->timestamp_sec = skb_tv_base.tv_sec + entry->skb->tstamp.off_sec; |
242 | pmsg->timestamp_usec = entry->skb->stamp.tv_usec; | 242 | pmsg->timestamp_usec = skb_tv_base.tv_usec + entry->skb->tstamp.off_usec; |
243 | pmsg->mark = entry->skb->nfmark; | 243 | pmsg->mark = entry->skb->nfmark; |
244 | pmsg->hook = entry->info->hook; | 244 | pmsg->hook = entry->info->hook; |
245 | pmsg->hw_protocol = entry->skb->protocol; | 245 | pmsg->hw_protocol = entry->skb->protocol; |
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index 59e7c6317872..9d9e04344c77 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -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 | fq->stamp = skb->stamp; | 565 | skb_get_timestamp(skb, &fq->stamp); |
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 | ||
@@ -664,7 +664,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff **skb_in, | |||
664 | 664 | ||
665 | head->next = NULL; | 665 | head->next = NULL; |
666 | head->dev = dev; | 666 | head->dev = dev; |
667 | head->stamp = fq->stamp; | 667 | skb_set_timestamp(head, &fq->stamp); |
668 | head->nh.ipv6h->payload_len = htons(payload_len); | 668 | head->nh.ipv6h->payload_len = htons(payload_len); |
669 | 669 | ||
670 | *skb_in = head; | 670 | *skb_in = head; |
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 39d5939ccd6c..c54f8acc97eb 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
@@ -1796,8 +1796,8 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1796 | copied); | 1796 | copied); |
1797 | if (rc) | 1797 | if (rc) |
1798 | goto out_free; | 1798 | goto out_free; |
1799 | if (skb->stamp.tv_sec) | 1799 | if (skb->tstamp.off_sec) |
1800 | sk->sk_stamp = skb->stamp; | 1800 | skb_get_timestamp(skb, &sk->sk_stamp) |
1801 | 1801 | ||
1802 | msg->msg_namelen = sizeof(*sipx); | 1802 | msg->msg_namelen = sizeof(*sipx); |
1803 | 1803 | ||
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 464c9fa2934b..ff5601ceedcb 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -491,11 +491,11 @@ __build_packet_message(struct nfulnl_instance *inst, | |||
491 | NFA_PUT(inst->skb, NFULA_HWADDR, sizeof(phw), &phw); | 491 | NFA_PUT(inst->skb, NFULA_HWADDR, sizeof(phw), &phw); |
492 | } | 492 | } |
493 | 493 | ||
494 | if (skb->stamp.tv_sec) { | 494 | if (skb->tstamp.off_sec) { |
495 | struct nfulnl_msg_packet_timestamp ts; | 495 | struct nfulnl_msg_packet_timestamp ts; |
496 | 496 | ||
497 | ts.sec = cpu_to_be64(skb->stamp.tv_sec); | 497 | ts.sec = cpu_to_be64(skb_tv_base.tv_sec + skb->tstamp.off_sec); |
498 | ts.usec = cpu_to_be64(skb->stamp.tv_usec); | 498 | ts.usec = cpu_to_be64(skb_tv_base.tv_usec + skb->tstamp.off_usec); |
499 | 499 | ||
500 | NFA_PUT(inst->skb, NFULA_TIMESTAMP, sizeof(ts), &ts); | 500 | NFA_PUT(inst->skb, NFULA_TIMESTAMP, sizeof(ts), &ts); |
501 | } | 501 | } |
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index 741686ff71d8..e3a5285329af 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
@@ -494,11 +494,11 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, | |||
494 | NFA_PUT(skb, NFQA_HWADDR, sizeof(phw), &phw); | 494 | NFA_PUT(skb, NFQA_HWADDR, sizeof(phw), &phw); |
495 | } | 495 | } |
496 | 496 | ||
497 | if (entry->skb->stamp.tv_sec) { | 497 | if (entry->skb->tstamp.off_sec) { |
498 | struct nfqnl_msg_packet_timestamp ts; | 498 | struct nfqnl_msg_packet_timestamp ts; |
499 | 499 | ||
500 | ts.sec = htonll(entry->skb->stamp.tv_sec); | 500 | ts.sec = htonll(skb_tv_base.tv_sec + entry->skb->tstamp.off_sec); |
501 | ts.usec = htonll(entry->skb->stamp.tv_usec); | 501 | ts.usec = htonll(skb_tv_base.tv_usec + entry->skb->tstamp.off_usec); |
502 | 502 | ||
503 | NFA_PUT(skb, NFQA_TIMESTAMP, sizeof(ts), &ts); | 503 | NFA_PUT(skb, NFQA_TIMESTAMP, sizeof(ts), &ts); |
504 | } | 504 | } |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index deb5f6f7f858..ba997095f08f 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -635,12 +635,12 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe | |||
635 | h->tp_snaplen = snaplen; | 635 | h->tp_snaplen = snaplen; |
636 | h->tp_mac = macoff; | 636 | h->tp_mac = macoff; |
637 | h->tp_net = netoff; | 637 | h->tp_net = netoff; |
638 | if (skb->stamp.tv_sec == 0) { | 638 | if (skb->tstamp.off_sec == 0) { |
639 | do_gettimeofday(&skb->stamp); | 639 | __net_timestamp(skb); |
640 | sock_enable_timestamp(sk); | 640 | sock_enable_timestamp(sk); |
641 | } | 641 | } |
642 | h->tp_sec = skb->stamp.tv_sec; | 642 | h->tp_sec = skb_tv_base.tv_sec + skb->tstamp.off_sec; |
643 | h->tp_usec = skb->stamp.tv_usec; | 643 | h->tp_usec = skb_tv_base.tv_usec + skb->tstamp.off_usec; |
644 | 644 | ||
645 | sll = (struct sockaddr_ll*)((u8*)h + TPACKET_ALIGN(sizeof(*h))); | 645 | sll = (struct sockaddr_ll*)((u8*)h + TPACKET_ALIGN(sizeof(*h))); |
646 | sll->sll_halen = 0; | 646 | sll->sll_halen = 0; |
diff --git a/net/sctp/input.c b/net/sctp/input.c index 742be9171b7d..28f32243397f 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -236,8 +236,8 @@ int sctp_rcv(struct sk_buff *skb) | |||
236 | } | 236 | } |
237 | 237 | ||
238 | /* SCTP seems to always need a timestamp right now (FIXME) */ | 238 | /* SCTP seems to always need a timestamp right now (FIXME) */ |
239 | if (skb->stamp.tv_sec == 0) { | 239 | if (skb->tstamp.off_sec == 0) { |
240 | do_gettimeofday(&skb->stamp); | 240 | __net_timestamp(skb); |
241 | sock_enable_timestamp(sk); | 241 | sock_enable_timestamp(sk); |
242 | } | 242 | } |
243 | 243 | ||
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 00d32b7c8266..3868a8d70cc0 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -1362,6 +1362,7 @@ struct sctp_association *sctp_unpack_cookie( | |||
1362 | char *key; | 1362 | char *key; |
1363 | sctp_scope_t scope; | 1363 | sctp_scope_t scope; |
1364 | struct sk_buff *skb = chunk->skb; | 1364 | struct sk_buff *skb = chunk->skb; |
1365 | struct timeval tv; | ||
1365 | 1366 | ||
1366 | headersize = sizeof(sctp_chunkhdr_t) + SCTP_SECRET_SIZE; | 1367 | headersize = sizeof(sctp_chunkhdr_t) + SCTP_SECRET_SIZE; |
1367 | bodysize = ntohs(chunk->chunk_hdr->length) - headersize; | 1368 | bodysize = ntohs(chunk->chunk_hdr->length) - headersize; |
@@ -1434,7 +1435,8 @@ no_hmac: | |||
1434 | * an association, there is no need to check cookie's expiration | 1435 | * an association, there is no need to check cookie's expiration |
1435 | * for init collision case of lost COOKIE ACK. | 1436 | * for init collision case of lost COOKIE ACK. |
1436 | */ | 1437 | */ |
1437 | if (!asoc && tv_lt(bear_cookie->expiration, skb->stamp)) { | 1438 | skb_get_timestamp(skb, &tv); |
1439 | if (!asoc && tv_lt(bear_cookie->expiration, tv)) { | ||
1438 | __u16 len; | 1440 | __u16 len; |
1439 | /* | 1441 | /* |
1440 | * Section 3.3.10.3 Stale Cookie Error (3) | 1442 | * Section 3.3.10.3 Stale Cookie Error (3) |
@@ -1447,10 +1449,9 @@ no_hmac: | |||
1447 | len = ntohs(chunk->chunk_hdr->length); | 1449 | len = ntohs(chunk->chunk_hdr->length); |
1448 | *errp = sctp_make_op_error_space(asoc, chunk, len); | 1450 | *errp = sctp_make_op_error_space(asoc, chunk, len); |
1449 | if (*errp) { | 1451 | if (*errp) { |
1450 | suseconds_t usecs = (skb->stamp.tv_sec - | 1452 | suseconds_t usecs = (tv.tv_sec - |
1451 | bear_cookie->expiration.tv_sec) * 1000000L + | 1453 | bear_cookie->expiration.tv_sec) * 1000000L + |
1452 | skb->stamp.tv_usec - | 1454 | tv.tv_usec - bear_cookie->expiration.tv_usec; |
1453 | bear_cookie->expiration.tv_usec; | ||
1454 | 1455 | ||
1455 | usecs = htonl(usecs); | 1456 | usecs = htonl(usecs); |
1456 | sctp_init_cause(*errp, SCTP_ERROR_STALE_COOKIE, | 1457 | sctp_init_cause(*errp, SCTP_ERROR_STALE_COOKIE, |
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 199d3747bd42..05fe2e735538 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -584,13 +584,16 @@ svc_udp_recvfrom(struct svc_rqst *rqstp) | |||
584 | /* possibly an icmp error */ | 584 | /* possibly an icmp error */ |
585 | dprintk("svc: recvfrom returned error %d\n", -err); | 585 | dprintk("svc: recvfrom returned error %d\n", -err); |
586 | } | 586 | } |
587 | if (skb->stamp.tv_sec == 0) { | 587 | if (skb->tstamp.off_sec == 0) { |
588 | skb->stamp.tv_sec = xtime.tv_sec; | 588 | struct timeval tv; |
589 | skb->stamp.tv_usec = xtime.tv_nsec / NSEC_PER_USEC; | 589 | |
590 | tv.tv_sec = xtime.tv_sec; | ||
591 | tv.tv_usec = xtime.tv_nsec * 1000; | ||
592 | skb_set_timestamp(skb, &tv); | ||
590 | /* Don't enable netstamp, sunrpc doesn't | 593 | /* Don't enable netstamp, sunrpc doesn't |
591 | need that much accuracy */ | 594 | need that much accuracy */ |
592 | } | 595 | } |
593 | svsk->sk_sk->sk_stamp = skb->stamp; | 596 | skb_get_timestamp(skb, &svsk->sk_sk->sk_stamp); |
594 | set_bit(SK_DATA, &svsk->sk_flags); /* there may be more data... */ | 597 | set_bit(SK_DATA, &svsk->sk_flags); /* there may be more data... */ |
595 | 598 | ||
596 | /* | 599 | /* |