mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ranjit Manomohan <ranjitm@google.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: akpm@osdl.org, ranjitm@google.com, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH] tcpdump may trace some outbound packets twice.
Date: Mon, 15 May 2006 14:19:06 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.56.0605151409110.25064@ranjit.corp.google.com> (raw)
In-Reply-To: <20060514.134231.101346572.davem@davemloft.net>

On Sun, 14 May 2006, David S. Miller wrote:

> From: Andrew Morton <akpm@osdl.org>
> Date: Sun, 14 May 2006 03:10:34 -0700
> 
> > It's a bit sad to be taking a clone of a clone like this.
> > Avoidable?
> 
> Besides, clones of clones are illegal, if it's already a clone
> you must make a copy.
> 

Heres a new version which does a copy instead of the clone to avoid
the double cloning issue.

-Thanks,
Ranjit

--- linux-2.6/net/sched/sch_generic.c	2006-05-10 12:34:52.000000000 -0700
+++ linux/net/sched/sch_generic.c	2006-05-15 13:49:09.000000000 -0700
@@ -136,8 +136,11 @@
 
 			if (!netif_queue_stopped(dev)) {
 				int ret;
+				struct sk_buff *skbc = NULL;
+				/* Copy the skb so that we can trace it after
+				 * a successful transmit. */
 				if (netdev_nit)
-					dev_queue_xmit_nit(skb, dev);
+					skbc = skb_copy(skb, GFP_ATOMIC);
 
 				ret = dev->hard_start_xmit(skb, dev);
 				if (ret == NETDEV_TX_OK) { 
@@ -145,9 +148,20 @@
 						dev->xmit_lock_owner = -1;
 						spin_unlock(&dev->xmit_lock);
 					}
+					if (skbc) {
+						/* transmit succeeded, 
+						 * trace the copy. */
+						dev_queue_xmit_nit(skbc,dev);
+						kfree_skb(skbc);
+					}
 					spin_lock(&dev->queue_lock);
 					return -1;
 				}
+
+				/* Free copy if it exists */
+				if (skbc)
+					kfree_skb(skbc);
+
 				if (ret == NETDEV_TX_LOCKED && nolock) {
 					spin_lock(&dev->queue_lock);
 					goto collision; 
 

  reply	other threads:[~2006-05-15 21:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-10 20:17 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.56.0605151409110.25064@ranjit.corp.google.com \
    --to=ranjitm@google.com \
    --cc=akpm@osdl.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®