netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Poirier <benjamin.poirier-scC8bbJcJLCw5LPnMra/2Q@public.gmane.org>
To: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	tcpdump-workers-YE1jQ5a0g24KACXWX4p+q9i2O/JbrIOy@public.gmane.org,
	wireshark-dev-IZ8446WsY0/dtAWm4Da02A@public.gmane.org
Subject: [PATCH] net: Take GSO into account when capturing packets
Date: Mon, 06 Jul 2009 14:04:32 -0400	[thread overview]
Message-ID: <4A523CB0.8080005@polymtl.ca> (raw)

move the point where the support routine for packet capture is called to
better reflect what is transmitted on the wire when GSO is active.

At the moment, packet capture (a la tcpdump) on the transmission side happens
before GSO takes place (if it does). Therefore, even if a packet gets
segmented by GSO, the capture shows that one big packet was sent when in fact
many small packets were sent on the wire. This behavior does not reflect the
"reality" of what is transmitted and could lead to confusion, especially since
a capture on the receiving side shows the segmented packets.

Signed-off-by: Benjamin Poirier <benjamin.poirier-scC8bbJcJLCw5LPnMra/2Q@public.gmane.org>

---

I've tested that the patch does what it intends to do by taking a capture on
the sending and receiving side of a network benchmark that sends incrementally
larger chunks of data. Without the patch, Wireshark shows that frames larger
than the MTU were sent as is and it shows that they were received as many
smaller frames. With the patch it shows that many small frames were sent and
received.

I would've liked to test the performance impact of the additional
list_empty() tests in the GSO loop but unfortunately I'm already limited by
the network speed, not the cpu. Fast Ethernet, blah

 net/core/dev.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 70c27e0..e87bbaf 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1686,9 +1686,6 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
 	int rc;
 
 	if (likely(!skb->next)) {
-		if (!list_empty(&ptype_all))
-			dev_queue_xmit_nit(skb, dev);
-
 		if (netif_needs_gso(dev, skb)) {
 			if (unlikely(dev_gso_segment(skb)))
 				goto out_kfree_skb;
@@ -1696,6 +1693,9 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
 				goto gso;
 		}
 
+		if (!list_empty(&ptype_all))
+			dev_queue_xmit_nit(skb, dev);
+
 		/*
 		 * If device doesnt need skb->dst, release it right now while
 		 * its hot in this cpu cache
@@ -1729,6 +1729,10 @@ gso:
 
 		skb->next = nskb->next;
 		nskb->next = NULL;
+
+		if (!list_empty(&ptype_all))
+			dev_queue_xmit_nit(nskb, dev);
+
 		rc = ops->ndo_start_xmit(nskb, dev);
 		if (unlikely(rc)) {
 			nskb->next = skb->next;
-- 
1.6.3.3

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev-IZ8446WsY0/dtAWm4Da02A@public.gmane.org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request-IZ8446WsY0/dtAWm4Da02A@public.gmane.org?subject=unsubscribe

             reply	other threads:[~2009-07-06 18:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-06 18:04 Benjamin Poirier [this message]
2009-07-07  1:15 ` [PATCH] net: Take GSO into account when capturing packets David 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=4A523CB0.8080005@polymtl.ca \
    --to=benjamin.poirier-scc8bbjcjlcw5lpnmra/2q@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=tcpdump-workers-YE1jQ5a0g24KACXWX4p+q9i2O/JbrIOy@public.gmane.org \
    --cc=wireshark-dev-IZ8446WsY0/dtAWm4Da02A@public.gmane.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;
as well as URLs for NNTP newsgroup(s).