Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 351339
b: refs/heads/master
c: 1def923
h: refs/heads/master
i:
  351337: 2ec048e
  351335: 3f1c651
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jan 10, 2013
1 parent ca59633 commit 2ee764b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3d55b323709661df34d93e4cdcc5337620e34dfd
refs/heads/master: 1def9238d4aa2146924994aa4b7dc861f03b9362
22 changes: 21 additions & 1 deletion trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2532,6 +2532,26 @@ struct netdev_queue *netdev_pick_tx(struct net_device *dev,
return netdev_get_tx_queue(dev, queue_index);
}

static void qdisc_pkt_len_init(struct sk_buff *skb)
{
const struct skb_shared_info *shinfo = skb_shinfo(skb);

qdisc_skb_cb(skb)->pkt_len = skb->len;

/* To get more precise estimation of bytes sent on wire,
* we add to pkt_len the headers size of all segments
*/
if (shinfo->gso_size) {
unsigned int hdr_len = skb_transport_offset(skb);

if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)))
hdr_len += tcp_hdrlen(skb);
else
hdr_len += sizeof(struct udphdr);
qdisc_skb_cb(skb)->pkt_len += (shinfo->gso_segs - 1) * hdr_len;
}
}

static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
struct net_device *dev,
struct netdev_queue *txq)
Expand All @@ -2540,7 +2560,7 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
bool contended;
int rc;

qdisc_skb_cb(skb)->pkt_len = skb->len;
qdisc_pkt_len_init(skb);
qdisc_calculate_pkt_len(skb, q);
/*
* Heuristic to force contended enqueues to serialize on a
Expand Down

0 comments on commit 2ee764b

Please sign in to comment.