summaryrefslogtreecommitdiff
path: root/drivers/net
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-06-07 21:29:11 (GMT)
commita3b310dbe6d25132698a88618e7ef52bc6749177 (patch)
tree241bb3685e4bd9f38238b32b6c273b89931eafae /drivers/net
parent0438b27e56de4107f4582898f3bebfedfccd418c (diff)
downloadlinux-fsl-qoriq-a3b310dbe6d25132698a88618e7ef52bc6749177.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: I24f08e3cc782a73cbd12d99445c326c530e3d8f2 Reviewed-on: http://git.am.freescale.net:8181/2898 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Bucur Madalin-Cristian-B32716 <madalin.bucur@freescale.com> Reviewed-by: Sovaiala Cristian-Constantin-B39531 <Cristian.Sovaiala@freescale.com> 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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/freescale/dpa/dpaa_eth.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth.c
index 68d70f7..2106553 100644
--- a/drivers/net/ethernet/freescale/dpa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth.c
@@ -1271,10 +1271,9 @@ static int dpa_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
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)--;