Patchwork [v2] bgmac: fix unaligned accesses to network headers

login
register
mail settings
Submitter Hauke Mehrtens
Date Feb. 16, 2013, 9:10 p.m.
Message ID <1361049038-25924-1-git-send-email-hauke@hauke-m.de>
Download mbox | patch
Permalink /patch/221035/
State Accepted
Delegated to: David Miller
Headers show

Comments

Hauke Mehrtens - Feb. 16, 2013, 9:10 p.m.
Without this patch I get many unaligned access warnings per packet,
this patches fixes them all. This should improve performance on some
systems like mips.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/ethernet/broadcom/bgmac.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
David Miller - Feb. 18, 2013, 5:45 p.m.
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sat, 16 Feb 2013 22:10:38 +0100

> Without this patch I get many unaligned access warnings per packet,
> this patches fixes them all. This should improve performance on some
> systems like mips.
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index d341090..3fd3288 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -301,7 +301,7 @@  static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
 			bgmac_err(bgmac, "Found poisoned packet at slot %d, DMA issue!\n",
 				  ring->start);
 		} else {
-			new_skb = netdev_alloc_skb(bgmac->net_dev, len);
+			new_skb = netdev_alloc_skb_ip_align(bgmac->net_dev, len);
 			if (new_skb) {
 				skb_put(new_skb, len);
 				skb_copy_from_linear_data_offset(skb, BGMAC_RX_FRAME_OFFSET,