From 98a80ca70105a4f9df06a80318d0297119fc07bf Mon Sep 17 00:00:00 2001 From: Ioana Radulescu Date: Thu, 6 Jun 2013 11:30:20 +0300 Subject: dpaa_eth: Fix computation of cache padding When computing the padding between the beginning of a FD buffer and the head of the skb associated to it, we wrongly assume that this padding is always lower than PAGE_SIZE. In ip forward scenarios with jumbo frames support enabled and Rx extra headroom not zero, the above assumption is proven incorrect. Properly compute the padding size in order to avoid skb corruption. Signed-off-by: Ioana Radulescu Change-Id: I219dfc11d81639a94fc10cbf70d5fbbe365d3b07 Reviewed-on: http://git.am.freescale.net:8181/3329 Reviewed-by: Hamciuc Bogdan-BHAMCIU1 Reviewed-by: Fleming Andrew-AFLEMING Tested-by: Fleming Andrew-AFLEMING diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_non_sg.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_non_sg.c index fd6fca2..8b5e945 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_non_sg.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_non_sg.c @@ -261,10 +261,9 @@ struct sk_buff *_dpa_cleanup_tx_fd(const struct dpa_priv_s *priv, static int dpa_process_one(struct dpa_percpu_priv_s *percpu_priv, struct sk_buff *skb, struct dpa_bp *bp, const struct qm_fd *fd) { - dma_addr_t addr = qm_fd_addr(fd); - u32 addrlo = lower_32_bits(addr); - u32 skblo = lower_32_bits((unsigned long)skb->head); - u32 pad = (addrlo - skblo) & (PAGE_SIZE - 1); + dma_addr_t fd_addr = qm_fd_addr(fd); + unsigned long skb_addr = virt_to_phys(skb->head); + u32 pad = fd_addr - skb_addr; unsigned int data_start; (*percpu_priv->dpa_bp_count)--; -- cgit v0.10.2