aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/marvell/sky2.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index b806d9b4def..c9b504e2dfc 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -2469,6 +2469,17 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
2469 return err; 2469 return err;
2470} 2470}
2471 2471
2472static inline bool needs_copy(const struct rx_ring_info *re,
2473 unsigned length)
2474{
2475#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
2476 /* Some architectures need the IP header to be aligned */
2477 if (!IS_ALIGNED(re->data_addr + ETH_HLEN, sizeof(u32)))
2478 return true;
2479#endif
2480 return length < copybreak;
2481}
2482
2472/* For small just reuse existing skb for next receive */ 2483/* For small just reuse existing skb for next receive */
2473static struct sk_buff *receive_copy(struct sky2_port *sky2, 2484static struct sk_buff *receive_copy(struct sky2_port *sky2,
2474 const struct rx_ring_info *re, 2485 const struct rx_ring_info *re,
@@ -2599,7 +2610,7 @@ static struct sk_buff *sky2_receive(struct net_device *dev,
2599 goto error; 2610 goto error;
2600 2611
2601okay: 2612okay:
2602 if (length < copybreak) 2613 if (needs_copy(re, length))
2603 skb = receive_copy(sky2, re, length); 2614 skb = receive_copy(sky2, re, length);
2604 else 2615 else
2605 skb = receive_new(sky2, re, length); 2616 skb = receive_new(sky2, re, length);