aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2005-08-14 20:24:31 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2005-08-29 18:58:24 -0400
commita61bbcf28a8cb0ba56f8193d512f7222e711a294 (patch)
tree33ae1976ab3b08aac516debb2742d2c6696d5436 /net/core
parent25ed891019b84498c83903ecf53df7ce35e9cff6 (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>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c28
-rw-r--r--net/core/neighbour.c7
-rw-r--r--net/core/skbuff.c8
3 files changed, 29 insertions, 14 deletions
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
1012static inline void net_timestamp(struct timeval *stamp) 1012void __net_timestamp(struct sk_buff *skb)
1013{
1014 struct timeval tv;
1015
1016 do_gettimeofday(&tv);
1017 skb_set_timestamp(skb, &tv);
1018}
1019EXPORT_SYMBOL(__net_timestamp);
1020
1021static 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)
1027void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev) 1036void 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
71static kmem_cache_t *skbuff_head_cache; 71static kmem_cache_t *skbuff_head_cache;
72 72
73struct 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
1650EXPORT_SYMBOL(___pskb_trim); 1653EXPORT_SYMBOL(___pskb_trim);
@@ -1678,3 +1681,4 @@ EXPORT_SYMBOL(skb_prepare_seq_read);
1678EXPORT_SYMBOL(skb_seq_read); 1681EXPORT_SYMBOL(skb_seq_read);
1679EXPORT_SYMBOL(skb_abort_seq_read); 1682EXPORT_SYMBOL(skb_abort_seq_read);
1680EXPORT_SYMBOL(skb_find_text); 1683EXPORT_SYMBOL(skb_find_text);
1684EXPORT_SYMBOL(skb_tv_base);