diff options
author | Bogdan Hamciuc <bogdan.hamciuc@freescale.com> | 2013-06-09 11:49:20 (GMT) |
---|---|---|
committer | Fleming Andrew-AFLEMING <AFLEMING@freescale.com> | 2013-07-30 20:47:22 (GMT) |
commit | d494b39ec0782f765f9c733140a906fa9ad17973 (patch) | |
tree | f99010133155c8bf1ab9dd9ff9edd3e819a68703 /drivers/net/ethernet | |
parent | 4a77b70e6cb8d791233179fdc37777a278673e9d (diff) | |
download | linux-fsl-qoriq-d494b39ec0782f765f9c733140a906fa9ad17973.tar.xz |
dpaa_eth: Simplify computation of skb headroom
Make it clear that on Rx the needed headroom is precisely fd.offset.
Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@freescale.com>
Change-Id: I62bf538c1dcb7a8f4a4feadc403e8bddd0707ef7
Reviewed-on: http://git.am.freescale.net:8181/3475
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c index 7f0e870..9aa28ee 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c @@ -289,6 +289,7 @@ static struct sk_buff *__hot contig_fd_to_skb(const struct dpa_priv_s *priv, const struct qm_fd *fd, int *use_gro) { dma_addr_t addr = qm_fd_addr(fd); + ssize_t fd_off = dpa_fd_offset(fd); void *vaddr; struct dpa_bp *dpa_bp = priv->dpa_bp; const t_FmPrsResult *parse_results; @@ -310,7 +311,8 @@ static struct sk_buff *__hot contig_fd_to_skb(const struct dpa_priv_s *priv, /* Make sure forwarded skbs will have enough space on Tx, * if extra headers are added. */ - skb_reserve(skb, priv->tx_headroom + dpa_get_rx_extra_headroom()); + BUG_ON(fd_off != priv->tx_headroom + dpa_get_rx_extra_headroom()); + skb_reserve(skb, fd_off); skb_put(skb, dpa_fd_length(fd)); /* Peek at the parse results for csum validation */ @@ -337,6 +339,7 @@ static struct sk_buff *__hot sg_fd_to_skb(const struct dpa_priv_s *priv, { const struct qm_sg_entry *sgt; dma_addr_t addr = qm_fd_addr(fd); + ssize_t fd_off = dpa_fd_offset(fd); dma_addr_t sg_addr; void *vaddr, *sg_vaddr; struct dpa_bp *dpa_bp; @@ -360,7 +363,7 @@ static struct sk_buff *__hot sg_fd_to_skb(const struct dpa_priv_s *priv, #endif /* CONFIG_FSL_DPAA_TS */ /* Iterate through the SGT entries and add data buffers to the skb */ - sgt = vaddr + dpa_fd_offset(fd); + sgt = vaddr + fd_off; for (i = 0; i < DPA_SGT_MAX_ENTRIES; i++) { /* Extension bit is not supported */ BUG_ON(sgt[i].extension); @@ -406,8 +409,9 @@ static struct sk_buff *__hot sg_fd_to_skb(const struct dpa_priv_s *priv, /* Make sure forwarded skbs will have enough space * on Tx, if extra headers are added. */ - skb_reserve(skb, priv->tx_headroom + + BUG_ON(fd_off != priv->tx_headroom + dpa_get_rx_extra_headroom()); + skb_reserve(skb, fd_off); skb_put(skb, sgt[i].length); } else { dma_unmap_single(dpa_bp->dev, sg_addr, dpa_bp->size, |