Skip to contentSkip to conversation

net: Take GSO into account when capturing packets

PATCH In review Benjamin Poirier 2 participants 2 messages Jul 6, 2009 – Jul 7, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: Take GSO into account when capturing packets

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.

---

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(-)
net/core/dev.c +7 -3
index 70c27e0..e87bbaf 100644
@@ -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;
Signature · 7 lines
1.6.3.3

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev-IZ8446WsY0/[email protected]>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request-IZ8446WsY0/[email protected]?subject=unsubscribe
maintainer
#1 lore raw

From: Benjamin Poirier <[email protected]>
Date: Mon, 06 Jul 2009 14:04:32 -0400

Quoted 11 lines

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.

TSO does the same exact thing except that the networking card chops up the packet before it hits the wire.

I really doubt there is anything seriously to gain by having GSO behave one way and TSO another, and we should just keep things as they are right now.

I'm not applying this, sorry.