diff mbox

[net-next] net_sched: fix qdisc_pkt_len_init()

Message ID 1358313261.19956.12.camel@edumazet-glaptop
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet Jan. 16, 2013, 5:14 a.m. UTC
From: Eric Dumazet <edumazet@google.com>

commit 1def9238d4aa2 (net_sched: more precise pkt_len computation)
does a wrong computation of mac + network headers length, as it includes
the padding before the frame.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Yuval Mintz <yuvalmin@broadcom.com>
---
 net/core/dev.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller Jan. 16, 2013, 5:41 a.m. UTC | #1
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 15 Jan 2013 21:14:21 -0800

> From: Eric Dumazet <edumazet@google.com>
> 
> commit 1def9238d4aa2 (net_sched: more precise pkt_len computation)
> does a wrong computation of mac + network headers length, as it includes
> the padding before the frame.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Yuval Mintz <yuvalmin@broadcom.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
index 862eaa7..b6d2b32 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2776,8 +2776,12 @@  static void qdisc_pkt_len_init(struct sk_buff *skb)
 	 * we add to pkt_len the headers size of all segments
 	 */
 	if (shinfo->gso_size)  {
-		unsigned int hdr_len = skb_transport_offset(skb);
+		unsigned int hdr_len;
 
+		/* mac layer + network layer */
+		hdr_len = skb_transport_header(skb) - skb_mac_header(skb);
+
+		/* + transport layer */
 		if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)))
 			hdr_len += tcp_hdrlen(skb);
 		else