diff options
author | Madalin Bucur <madalin.bucur@freescale.com> | 2014-05-13 13:41:59 (GMT) |
---|---|---|
committer | Jose Rivera <German.Rivera@freescale.com> | 2014-05-13 21:20:47 (GMT) |
commit | c70e05663176da93021b8a3626f3fc5c9f8ef5c3 (patch) | |
tree | 6cf9c64eb3abacadde9b6e9a1cbb679234e407fe | |
parent | 2c9b0831786a0436502d37440f1bdea688cfc90b (diff) | |
download | linux-fsl-qoriq-c70e05663176da93021b8a3626f3fc5c9f8ef5c3.tar.xz |
dpa_eth: set skb->data for recycled frames
Set skb->data to point towards the origin of the mapped area
for recycled frames. The skb->data value is adjusted with the
fd offset on reception so it needs to point towards the origin
of the buffer as seen by hardware.
Signed-off-by: Madalin Bucur <madalin.bucur@freescale.com>
Change-Id: I33d96a6c56cc3c05a2331368c375ff0ce8431ae8
Reviewed-on: http://git.am.freescale.net:8181/12293
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Ruxandra Ioana Radulescu <ruxandra.radulescu@freescale.com>
Reviewed-by: Bogdan Hamciuc <bogdan.hamciuc@freescale.com>
Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
-rw-r--r-- | drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c index 7e15013..91be76f 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c @@ -615,7 +615,7 @@ _release_frame: static int __hot skb_to_contig_fd(struct dpa_priv_s *priv, struct sk_buff *skb, struct qm_fd *fd, - int *count_ptr) + int *count_ptr, int *offset) { struct sk_buff **skbh; dma_addr_t addr; @@ -649,6 +649,7 @@ static int __hot skb_to_contig_fd(struct dpa_priv_s *priv, dma_dir = DMA_BIDIRECTIONAL; DPA_WRITE_SKB_PTR(skb, skbh, buffer_start, -1); + *offset = skb_headroom(skb) - fd->offset; } else #endif { @@ -822,7 +823,7 @@ int __hot dpa_tx(struct sk_buff *skb, struct net_device *net_dev) int err = 0; const int queue_mapping = dpa_get_queue_mapping(skb); const bool nonlinear = skb_is_nonlinear(skb); - int *countptr; + int *countptr, offset = 0; #if defined(CONFIG_AS_FASTPATH) || defined(CONFIG_FSL_FMAN_TEST) /* If there is a Tx hook, run it. */ if (dpaa_eth_hooks.tx && @@ -899,7 +900,7 @@ int __hot dpa_tx(struct sk_buff *skb, struct net_device *net_dev) goto enomem; /* Finally, create a contig FD from this skb */ - err = skb_to_contig_fd(priv, skb, &fd, countptr); + err = skb_to_contig_fd(priv, skb, &fd, countptr, &offset); } if (unlikely(err < 0)) goto skb_to_fd_failed; @@ -910,7 +911,7 @@ int __hot dpa_tx(struct sk_buff *skb, struct net_device *net_dev) * but we need the skb to look as if returned by build_skb(). * We need to manually adjust the tailptr as well. */ - skb->data = skb->head; + skb->data = skb->head + offset; skb_reset_tail_pointer(skb); (*countptr)++; |