From 9d039899453ec385f1b0949457800d15b25d95ee Mon Sep 17 00:00:00 2001 From: Marian-Cristian Rotariu Date: Fri, 31 Oct 2014 17:26:46 +0200 Subject: dpaa_eth: make the S/G rx routine endian portable This patch modifies the shared S/G rx routine used by shared and macless driver to properly receive the S/G frames from FMan. Signed-off-by: Marian-Cristian Rotariu Change-Id: Icc467cb9ced12db75db28876e606e23fd3ee7788 Reviewed-on: http://git.am.freescale.net:8181/22852 Reviewed-by: Madalin-Cristian Bucur Reviewed-on: http://git.am.freescale.net:8181/32502 diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c index ea88db2..1ac0007 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c @@ -269,18 +269,19 @@ shared_rx_dqrr(struct qman_portal *portal, struct qman_fq *fq, if (fd->format == qm_fd_sg) { if (dpa_bp->vaddr) { - sgt = dpa_phys2virt(dpa_bp, - qm_fd_addr(fd)) + dpa_fd_offset(fd); + sgt = dpa_phys2virt(dpa_bp, qm_fd_addr(fd)) + + dpa_fd_offset(fd); for (i = 0; i < DPA_SGT_MAX_ENTRIES; i++) { + void *frag_addr = dpa_phys2virt(dpa_bp, + qm_sg_addr(&sgt[i]) + + be16_to_cpu(sgt[i].offset)); + u32 frag_length = be32_to_cpu(sgt[i].length); BUG_ON(sgt[i].extension); /* copy from sgt[i] */ - memcpy(skb_put(skb, sgt[i].length), - dpa_phys2virt(dpa_bp, - qm_sg_addr(&sgt[i]) + - sgt[i].offset), - sgt[i].length); + memcpy(skb_put(skb, frag_length), frag_addr, + frag_length); if (sgt[i].final) break; } @@ -300,12 +301,13 @@ shared_rx_dqrr(struct qman_portal *portal, struct qman_fq *fq, dpa_bp->size)); for (i = 0; i < DPA_SGT_MAX_ENTRIES; i++) { + u32 frag_length = be32_to_cpu(sgt[i].length); BUG_ON(sgt[i].extension); - copy_from_unmapped_area( - skb_put(skb, sgt[i].length), - qm_sg_addr(&sgt[i]) + sgt[i].offset, - sgt[i].length); + skb_put(skb, frag_length), + qm_sg_addr(&sgt[i]) + + be16_to_cpu(sgt[i].offset), + frag_length); if (sgt[i].final) break; -- cgit v0.10.2