diff options
author | Felix Fietkau <nbd@openwrt.org> | 2015-04-14 12:07:56 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-04-14 14:57:10 -0400 |
commit | 4b62dce450e2447146ff6924a1ce8ad1a6592107 (patch) | |
tree | 118cff26acaebcfe3fdb2918b1dbc9e43f71c049 /drivers/net/ethernet/broadcom/bgmac.c | |
parent | eb64e2923a886441c7b322f138b36029f3fa6a36 (diff) | |
download | op-kernel-dev-4b62dce450e2447146ff6924a1ce8ad1a6592107.zip op-kernel-dev-4b62dce450e2447146ff6924a1ce8ad1a6592107.tar.gz |
bgmac: set received skb headroom to NET_SKB_PAD
A packet buffer offset of 30 bytes is inefficient, because the first 2
bytes end up in a different cacheline.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bgmac.c')
-rw-r--r-- | drivers/net/ethernet/broadcom/bgmac.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c index 9c3b2ff..424a68c 100644 --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c @@ -346,13 +346,13 @@ static int bgmac_dma_rx_skb_for_slot(struct bgmac *bgmac, return -ENOMEM; /* Poison - if everything goes fine, hardware will overwrite it */ - rx = buf; + rx = buf + BGMAC_RX_BUF_OFFSET; rx->len = cpu_to_le16(0xdead); rx->flags = cpu_to_le16(0xbeef); /* Map skb for the DMA */ - dma_addr = dma_map_single(dma_dev, buf, BGMAC_RX_BUF_SIZE, - DMA_FROM_DEVICE); + dma_addr = dma_map_single(dma_dev, buf + BGMAC_RX_BUF_OFFSET, + BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); if (dma_mapping_error(dma_dev, dma_addr)) { bgmac_err(bgmac, "DMA mapping error\n"); put_page(virt_to_head_page(buf)); @@ -403,7 +403,7 @@ static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring, while (ring->start != ring->end) { struct device *dma_dev = bgmac->core->dma_dev; struct bgmac_slot_info *slot = &ring->slots[ring->start]; - struct bgmac_rx_header *rx = slot->buf; + struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; struct sk_buff *skb; void *buf = slot->buf; u16 len, flags; @@ -454,8 +454,10 @@ static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring, BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); skb = build_skb(buf, BGMAC_RX_ALLOC_SIZE); - skb_put(skb, BGMAC_RX_FRAME_OFFSET + len); - skb_pull(skb, BGMAC_RX_FRAME_OFFSET); + skb_put(skb, BGMAC_RX_FRAME_OFFSET + + BGMAC_RX_BUF_OFFSET + len); + skb_pull(skb, BGMAC_RX_FRAME_OFFSET + + BGMAC_RX_BUF_OFFSET); skb_checksum_none_assert(skb); skb->protocol = eth_type_trans(skb, bgmac->net_dev); |