netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tcpdump may trace some outbound packets twice.
@ 2006-05-10 20:17 Ranjit Manomohan
  2006-05-14 10:10 ` Andrew Morton
  0 siblings, 1 reply; 17+ messages in thread
From: Ranjit Manomohan @ 2006-05-10 20:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev

This patch fixes the problem where tcpdump shows duplicate packets
while tracing outbound packets on drivers which support lockless
transmit. The patch changes the current behaviour to tracing the
packets only on a successful transmit.

Signed-off-by: Ranjit Manomohan <ranjitm@google.com>

--- linux-2.6/net/sched/sch_generic.c	2006-05-10 12:34:52.000000000 -0700
+++ linux/net/sched/sch_generic.c	2006-05-10 12:39:38.000000000 -0700
@@ -136,8 +136,12 @@
 
 			if (!netif_queue_stopped(dev)) {
 				int ret;
+				struct sk_buff *skbc = NULL;
+				/* Clone the skb so that we hold a reference
+				 * to its data and we can trace it after a
+				 * successful transmit. */
 				if (netdev_nit)
-					dev_queue_xmit_nit(skb, dev);
+					skbc = skb_clone(skb, GFP_ATOMIC);
 
 				ret = dev->hard_start_xmit(skb, dev);
 				if (ret == NETDEV_TX_OK) { 
@@ -145,6 +149,15 @@
 						dev->xmit_lock_owner = -1;
 						spin_unlock(&dev->xmit_lock);
 					}
+					if(skbc) {
+						/* transmit succeeded, 
+						 * trace the clone. */
+						dev_queue_xmit_nit(skbc,dev);
+						kfree_skb(skbc);
+					}
+					/* Free clone if it exists */
+					if(skbc)
+						kfree_skb(skbc);
 					spin_lock(&dev->queue_lock);
 					return -1;
 				}

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2006-05-16  4:18 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-10 20:17 [PATCH] tcpdump may trace some outbound packets twice Ranjit Manomohan
2006-05-14 10:10 ` Andrew Morton
2006-05-14 15:58   ` Ranjit Manomohan
2006-05-14 20:42   ` David S. Miller
2006-05-15 21:19     ` Ranjit Manomohan
2006-05-15 21:26       ` David S. Miller
2006-05-15 21:41         ` Patrick McHardy
2006-05-15 23:11         ` Ranjit Manomohan
2006-05-15 23:41           ` Stephen Hemminger
2006-05-16  0:08             ` David S. Miller
2006-05-16  0:21               ` Patrick McHardy
2006-05-16  0:48                 ` Tom Young
2006-05-16  0:37               ` Herbert Xu
2006-05-16  1:17                 ` Patrick McHardy
2006-05-16  1:20                   ` Herbert Xu
2006-05-16  1:22                   ` Patrick McHardy
2006-05-16  4:18                     ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).