>From a8574f7e8e9aa01047f0e72a960209534a8257e8 Mon Sep 17 00:00:00 2001 From: Ioana Ciornei Date: Fri, 13 Oct 2023 17:19:31 +0300 Subject: [PATCH 1/2] dpaa2-eth: increase the needed headroom to account for alignment Increase the needed headroom to account for a 64 byte alignment restriction which, with this patch, we make mandatory on the Tx path. The case in which the amount of headroom needed is not available is already handled by the driver which instead sends the a S/G frame with the first buffer only holding the SW and HW annotation areas. Signed-off-by: Ioana Ciornei --- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index 15bab41cee48..5442d0e5fd66 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -1081,6 +1081,8 @@ static int dpaa2_eth_build_single_fd(struct dpaa2_eth_priv *priv, DPAA2_ETH_TX_BUF_ALIGN); if (aligned_start >= skb->head) buffer_start = aligned_start; + else + return -ENOMEM; /* Store a backpointer to the skb at the beginning of the buffer * (in the private data area) such that we can release it @@ -1412,7 +1414,7 @@ static netdev_tx_t __dpaa2_eth_tx(struct sk_buff *skb, percpu_extras = this_cpu_ptr(priv->percpu_extras); fd = (this_cpu_ptr(priv->fd))->array; - needed_headroom = dpaa2_eth_needed_headroom(skb); + needed_headroom = dpaa2_eth_needed_headroom(skb) + DPAA2_ETH_TX_BUF_ALIGN; /* We'll be holding a back-reference to the skb until Tx Confirmation; * we don't want that overwritten by a concurrent Tx with a cloned skb. -- 2.25.1