summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIoana Radulescu <ruxandra.radulescu@freescale.com>2013-06-06 08:30:20 (GMT)
committerFleming Andrew-AFLEMING <AFLEMING@freescale.com>2013-07-22 21:14:18 (GMT)
commit98a80ca70105a4f9df06a80318d0297119fc07bf (patch)
tree96b27a047c4e7ad30f1a79704e429174d2d0188c
parent4b47747094aaf8a4308f59a2370b6c21a3a56476 (diff)
downloadlinux-fsl-qoriq-98a80ca70105a4f9df06a80318d0297119fc07bf.tar.xz
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 <ruxandra.radulescu@freescale.com> Change-Id: I219dfc11d81639a94fc10cbf70d5fbbe365d3b07 Reviewed-on: http://git.am.freescale.net:8181/3329 Reviewed-by: Hamciuc Bogdan-BHAMCIU1 <bogdan.hamciuc@freescale.com> Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com> Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
-rw-r--r--drivers/net/ethernet/freescale/dpa/dpaa_eth_non_sg.c7
1 files changed, 3 insertions, 4 deletions
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)--;