Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 194287
b: refs/heads/master
c: fc6055a
h: refs/heads/master
i:
  194285: 72cc227
  194283: b3ce6dc
  194279: 399f210
  194271: 4fe50bb
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Apr 18, 2010
1 parent f2e048b commit 8df643e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 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: 9958da0501fced47c1ac5c5a3a7731c87e45472c
refs/heads/master: fc6055a5ba31e2c14e36e8939f9bf2b6d586a7f5
27 changes: 13 additions & 14 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1880,6 +1880,17 @@ static int dev_gso_segment(struct sk_buff *skb)
return 0;
}

/*
* Try to orphan skb early, right before transmission by the device.
* We cannot orphan skb if tx timestamp is requested, since
* drivers need to call skb_tstamp_tx() to send the timestamp.
*/
static inline void skb_orphan_try(struct sk_buff *skb)
{
if (!skb_tx(skb)->flags)
skb_orphan(skb);
}

int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
struct netdev_queue *txq)
{
Expand All @@ -1904,23 +1915,10 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
if (dev->priv_flags & IFF_XMIT_DST_RELEASE)
skb_dst_drop(skb);

skb_orphan_try(skb);
rc = ops->ndo_start_xmit(skb, dev);
if (rc == NETDEV_TX_OK)
txq_trans_update(txq);
/*
* TODO: if skb_orphan() was called by
* dev->hard_start_xmit() (for example, the unmodified
* igb driver does that; bnx2 doesn't), then
* skb_tx_software_timestamp() will be unable to send
* back the time stamp.
*
* How can this be prevented? Always create another
* reference to the socket before calling
* dev->hard_start_xmit()? Prevent that skb_orphan()
* does anything in dev->hard_start_xmit() by clearing
* the skb destructor before the call and restoring it
* afterwards, then doing the skb_orphan() ourselves?
*/
return rc;
}

Expand All @@ -1938,6 +1936,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
if (dev->priv_flags & IFF_XMIT_DST_RELEASE)
skb_dst_drop(nskb);

skb_orphan_try(nskb);
rc = ops->ndo_start_xmit(nskb, dev);
if (unlikely(rc != NETDEV_TX_OK)) {
if (rc & ~NETDEV_TX_MASK)
Expand Down

0 comments on commit 8df643e

Please sign in to comment.