aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-12-20 16:22:51 -0500
committerDavid S. Miller <davem@davemloft.net>2010-12-21 13:50:38 -0500
commit70978182d431e0348e6ef711d0f962d12c03bc46 (patch)
tree7da5bba73363087ade7aa031f937d08666f8e0ee /net/core/dev.c
parent356f039822b8d802138f7121c80d2a9286976dbd (diff)
net: timestamp cloned packet in dev_queue_xmit_nit
Le vendredi 17 décembre 2010 à 10:26 +0100, Eric Dumazet a écrit : > > I think we can add this after latest Changli patch : > > He does one skb_clone() before calling the sniffers. > We could set timestamp on this clone, instead of original skb. > > Problem solved. > [PATCH net-next-2.6] net: timestamp cloned packet in dev_queue_xmit_nit Now we do one clone of skb if at least one sniffer might take packet, we also can do the skb timestamping on the clone and let original packet unchanged. This is a generalization of commit 8caf153974f2 (net: sch_netem: Fix an inconsistency in ingress netem timestamps.) This way, we can have a good idea when packets are delivered to our stack (tcpdump -i ifb0), while a tcpdump on original device gives timestamps right before ingressing. This also speedup our stack, avoiding taking timestamps if not needed. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Cc: Changli Gao <xiaosuo@gmail.com> Cc: Patrick McHardy <kaber@trash.net> Cc: Jarek Poplawski <jarkao2@gmail.com> Acked-by: Changli Gao <xiaosuo@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 59877290bca7..a215269d2e35 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1547,13 +1547,6 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
1547 struct sk_buff *skb2 = NULL; 1547 struct sk_buff *skb2 = NULL;
1548 struct packet_type *pt_prev = NULL; 1548 struct packet_type *pt_prev = NULL;
1549 1549
1550#ifdef CONFIG_NET_CLS_ACT
1551 if (!(skb->tstamp.tv64 && (G_TC_FROM(skb->tc_verd) & AT_INGRESS)))
1552 net_timestamp_set(skb);
1553#else
1554 net_timestamp_set(skb);
1555#endif
1556
1557 rcu_read_lock(); 1550 rcu_read_lock();
1558 list_for_each_entry_rcu(ptype, &ptype_all, list) { 1551 list_for_each_entry_rcu(ptype, &ptype_all, list) {
1559 /* Never send packets back to the socket 1552 /* Never send packets back to the socket
@@ -1572,6 +1565,8 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
1572 if (!skb2) 1565 if (!skb2)
1573 break; 1566 break;
1574 1567
1568 net_timestamp_set(skb2);
1569
1575 /* skb->nh should be correctly 1570 /* skb->nh should be correctly
1576 set by sender, so that the second statement is 1571 set by sender, so that the second statement is
1577 just protection against buggy protocols. 1572 just protection against buggy protocols.