···155155#define SKB_DATAREF_SHIFT 16156156#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1)157157158158+extern struct timeval skb_tv_base;159159+160160+struct skb_timeval {161161+ u32 off_sec;162162+ u32 off_usec;163163+};164164+158165/** 159166 * struct sk_buff - socket buffer160167 * @next: Next buffer in list161168 * @prev: Previous buffer in list162169 * @list: List we are on163170 * @sk: Socket we are owned by164164- * @stamp: Time we arrived171171+ * @tstamp: Time we arrived stored as offset to skb_tv_base165172 * @dev: Device we arrived on/are leaving by166173 * @input_dev: Device we arrived on167174 * @h: Transport layer header···209202 struct sk_buff *prev;210203211204 struct sock *sk;212212- struct timeval stamp;205205+ struct skb_timeval tstamp;213206 struct net_device *dev;214207 struct net_device *input_dev;215208···1219121212201213extern void skb_init(void);12211214extern void skb_add_mtu(int mtu);12151215+12161216+/**12171217+ * skb_get_timestamp - get timestamp from a skb12181218+ * @skb: skb to get stamp from12191219+ * @stamp: pointer to struct timeval to store stamp in12201220+ *12211221+ * Timestamps are stored in the skb as offsets to a base timestamp.12221222+ * This function converts the offset back to a struct timeval and stores12231223+ * it in stamp.12241224+ */12251225+static inline void skb_get_timestamp(struct sk_buff *skb, struct timeval *stamp)12261226+{12271227+ stamp->tv_sec = skb->tstamp.off_sec;12281228+ stamp->tv_usec = skb->tstamp.off_usec;12291229+ if (skb->tstamp.off_sec) {12301230+ stamp->tv_sec += skb_tv_base.tv_sec;12311231+ stamp->tv_usec += skb_tv_base.tv_usec;12321232+ }12331233+}12341234+12351235+/**12361236+ * skb_set_timestamp - set timestamp of a skb12371237+ * @skb: skb to set stamp of12381238+ * @stamp: pointer to struct timeval to get stamp from12391239+ *12401240+ * Timestamps are stored in the skb as offsets to a base timestamp.12411241+ * This function converts a struct timeval to an offset and stores12421242+ * it in the skb.12431243+ */12441244+static inline void skb_set_timestamp(struct sk_buff *skb, struct timeval *stamp)12451245+{12461246+ skb->tstamp.off_sec = stamp->tv_sec - skb_tv_base.tv_sec;12471247+ skb->tstamp.off_usec = stamp->tv_usec - skb_tv_base.tv_usec;12481248+}12491249+12501250+extern void __net_timestamp(struct sk_buff *skb);1222125112231252#ifdef CONFIG_NETFILTER12241253static inline void nf_conntrack_put(struct nf_conntrack *nfct)
+1-1
include/net/bluetooth/hci_core.h
···404404 bt_cb(skb)->incoming = 1;405405406406 /* Time stamp */407407- do_gettimeofday(&skb->stamp);407407+ __net_timestamp(skb);408408409409 /* Queue frame for rx task */410410 skb_queue_tail(&hdev->rx_q, skb);
···282282283283 /* If congestion control is doing timestamping */284284 if (icsk->icsk_ca_ops->rtt_sample)285285- do_gettimeofday(&skb->stamp);285285+ __net_timestamp(skb);286286287287 sysctl_flags = 0;288288 if (tcb->flags & TCPCB_FLAG_SYN) {···483483 * skbs, which it never sent before. --ANK484484 */485485 TCP_SKB_CB(buff)->when = TCP_SKB_CB(skb)->when;486486- buff->stamp = skb->stamp;486486+ buff->tstamp = skb->tstamp;487487488488 if (TCP_SKB_CB(skb)->sacked & TCPCB_LOST) {489489 tp->lost_out -= tcp_skb_pcount(skb);
···236236 }237237238238 /* SCTP seems to always need a timestamp right now (FIXME) */239239- if (skb->stamp.tv_sec == 0) {240240- do_gettimeofday(&skb->stamp);239239+ if (skb->tstamp.off_sec == 0) {240240+ __net_timestamp(skb);241241 sock_enable_timestamp(sk); 242242 }243243
+5-4
net/sctp/sm_make_chunk.c
···13621362 char *key;13631363 sctp_scope_t scope;13641364 struct sk_buff *skb = chunk->skb;13651365+ struct timeval tv;1365136613661367 headersize = sizeof(sctp_chunkhdr_t) + SCTP_SECRET_SIZE;13671368 bodysize = ntohs(chunk->chunk_hdr->length) - headersize;···14351434 * an association, there is no need to check cookie's expiration14361435 * for init collision case of lost COOKIE ACK.14371436 */14381438- if (!asoc && tv_lt(bear_cookie->expiration, skb->stamp)) {14371437+ skb_get_timestamp(skb, &tv);14381438+ if (!asoc && tv_lt(bear_cookie->expiration, tv)) {14391439 __u16 len;14401440 /*14411441 * Section 3.3.10.3 Stale Cookie Error (3)···14491447 len = ntohs(chunk->chunk_hdr->length);14501448 *errp = sctp_make_op_error_space(asoc, chunk, len);14511449 if (*errp) {14521452- suseconds_t usecs = (skb->stamp.tv_sec -14501450+ suseconds_t usecs = (tv.tv_sec -14531451 bear_cookie->expiration.tv_sec) * 1000000L +14541454- skb->stamp.tv_usec -14551455- bear_cookie->expiration.tv_usec;14521452+ tv.tv_usec - bear_cookie->expiration.tv_usec;1456145314571454 usecs = htonl(usecs);14581455 sctp_init_cause(*errp, SCTP_ERROR_STALE_COOKIE,
+7-4
net/sunrpc/svcsock.c
···584584 /* possibly an icmp error */585585 dprintk("svc: recvfrom returned error %d\n", -err);586586 }587587- if (skb->stamp.tv_sec == 0) {588588- skb->stamp.tv_sec = xtime.tv_sec; 589589- skb->stamp.tv_usec = xtime.tv_nsec / NSEC_PER_USEC; 587587+ if (skb->tstamp.off_sec == 0) {588588+ struct timeval tv;589589+590590+ tv.tv_sec = xtime.tv_sec;591591+ tv.tv_usec = xtime.tv_nsec * 1000;592592+ skb_set_timestamp(skb, &tv);590593 /* Don't enable netstamp, sunrpc doesn't 591594 need that much accuracy */592595 }593593- svsk->sk_sk->sk_stamp = skb->stamp;596596+ skb_get_timestamp(skb, &svsk->sk_sk->sk_stamp);594597 set_bit(SK_DATA, &svsk->sk_flags); /* there may be more data... */595598596599 /*