Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 183713
b: refs/heads/master
c: 4b25846
h: refs/heads/master
i:
  183711: ea0c693
v: v3
  • Loading branch information
Krishna Kumar authored and David S. Miller committed Jan 21, 2010
1 parent e977e2e commit 9b566c4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 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: 5f8cbc13225eadd981c817f7d14b8deab61ebfaa
refs/heads/master: 4b258461c0b31ded170a1a56b944b0fded1c887b
29 changes: 17 additions & 12 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1982,6 +1982,21 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
return rc;
}

/*
* Returns true if either:
* 1. skb has frag_list and the device doesn't support FRAGLIST, or
* 2. skb is fragmented and the device does not support SG, or if
* at least one of fragments is in highmem and device does not
* support DMA from it.
*/
static inline int skb_needs_linearize(struct sk_buff *skb,
struct net_device *dev)
{
return (skb_has_frags(skb) && !(dev->features & NETIF_F_FRAGLIST)) ||
(skb_shinfo(skb)->nr_frags && (!(dev->features & NETIF_F_SG) ||
illegal_highdma(dev, skb)));
}

/**
* dev_queue_xmit - transmit a buffer
* @skb: buffer to transmit
Expand Down Expand Up @@ -2018,18 +2033,8 @@ int dev_queue_xmit(struct sk_buff *skb)
if (netif_needs_gso(dev, skb))
goto gso;

if (skb_has_frags(skb) &&
!(dev->features & NETIF_F_FRAGLIST) &&
__skb_linearize(skb))
goto out_kfree_skb;

/* Fragmented skb is linearized if device does not support SG,
* or if at least one of fragments is in highmem and device
* does not support DMA from it.
*/
if (skb_shinfo(skb)->nr_frags &&
(!(dev->features & NETIF_F_SG) || illegal_highdma(dev, skb)) &&
__skb_linearize(skb))
/* Convert a paged skb to linear, if required */
if (skb_needs_linearize(skb, dev) && __skb_linearize(skb))
goto out_kfree_skb;

/* If packet is not checksummed and device does not support
Expand Down

0 comments on commit 9b566c4

Please sign in to comment.