Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 298762
b: refs/heads/master
c: 857504d
h: refs/heads/master
v: v3
  • Loading branch information
stephen hemminger authored and David S. Miller committed Apr 4, 2012
1 parent 88c2b0d commit 9942bfe
Show file tree
Hide file tree
Showing 2 changed files with 13 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: 234bcf8a499ee206145c7007d12d9706a254f790
refs/heads/master: 857504d06d565ad5b401d505937932775ddf1c47
13 changes: 12 additions & 1 deletion trunk/drivers/net/ethernet/marvell/sky2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2469,6 +2469,17 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
return err;
}

static inline bool needs_copy(const struct rx_ring_info *re,
unsigned length)
{
#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
/* Some architectures need the IP header to be aligned */
if (!IS_ALIGNED(re->data_addr + ETH_HLEN, sizeof(u32)))
return true;
#endif
return length < copybreak;
}

/* For small just reuse existing skb for next receive */
static struct sk_buff *receive_copy(struct sky2_port *sky2,
const struct rx_ring_info *re,
Expand Down Expand Up @@ -2599,7 +2610,7 @@ static struct sk_buff *sky2_receive(struct net_device *dev,
goto error;

okay:
if (length < copybreak)
if (needs_copy(re, length))
skb = receive_copy(sky2, re, length);
else
skb = receive_new(sky2, re, length);
Expand Down

0 comments on commit 9942bfe

Please sign in to comment.