diff options
author | Ioana Radulescu <ruxandra.radulescu@nxp.com> | 2017-12-08 06:47:57 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-12-08 16:33:29 +0100 |
commit | 18c21467b2162107891f15ce1da4350b4e7016a3 (patch) | |
tree | ddab8f032c98930ae88a60eebf3474517eea0d42 /drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | |
parent | 2b7c86eb7bf3174a108de4ed808f5b48c3a55972 (diff) |
staging: fsl-dpaa2/eth: Compute needed headroom per frame
For non-linear skbs we build scatter-gather frames and allocate
a new buffer for the S/G table in which we reserve the required
headroom, so the actual skb headroom size doesn't matter.
Rather than use a one-size-fits-all approach, decide when to
enforce headroom requirements on a frame by frame basis.
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h')
-rw-r--r-- | drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h index 546a8624ac2f..4ea41d85c231 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h @@ -364,9 +364,13 @@ static inline unsigned int dpaa2_eth_buf_raw_size(struct dpaa2_eth_priv *priv) } static inline -unsigned int dpaa2_eth_needed_headroom(struct dpaa2_eth_priv *priv) +unsigned int dpaa2_eth_needed_headroom(struct dpaa2_eth_priv *priv, + struct sk_buff *skb) { - return priv->tx_data_offset + DPAA2_ETH_TX_BUF_ALIGN; + if (skb_is_nonlinear(skb)) + return 0; + + return DPAA2_ETH_SWA_SIZE + DPAA2_ETH_TX_BUF_ALIGN; } /* Extra headroom space requested to hardware, in order to make sure there's @@ -374,7 +378,8 @@ unsigned int dpaa2_eth_needed_headroom(struct dpaa2_eth_priv *priv) */ static inline unsigned int dpaa2_eth_rx_head_room(struct dpaa2_eth_priv *priv) { - return dpaa2_eth_needed_headroom(priv) - DPAA2_ETH_RX_HWA_SIZE; + return priv->tx_data_offset + DPAA2_ETH_TX_BUF_ALIGN - + DPAA2_ETH_RX_HWA_SIZE; } static int dpaa2_eth_queue_count(struct dpaa2_eth_priv *priv) |