[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PAXPR04MB85106CE97288D52A04EB685388E02@PAXPR04MB8510.eurprd04.prod.outlook.com>
Date: Thu, 23 Jan 2025 02:58:32 +0000
From: Wei Fang <wei.fang@....com>
To: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@...il.com>, Shenwei Wang
<shenwei.wang@....com>, Clark Wang <xiaoning.wang@....com>
CC: "andrew+netdev@...n.ch" <andrew+netdev@...n.ch>, "davem@...emloft.net"
<davem@...emloft.net>, "edumazet@...gle.com" <edumazet@...gle.com>,
"kuba@...nel.org" <kuba@...nel.org>, "pabeni@...hat.com" <pabeni@...hat.com>,
"imx@...ts.linux.dev" <imx@...ts.linux.dev>, "netdev@...r.kernel.org"
<netdev@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH net] net: fec: remove unnecessary DMA mapping of TSO
header
> The TSO header buffer is pre-allocated DMA memory, so there's no need to
> map it again with dma_map_single() in fec_enet_txq_put_hdr_tso(). Remove
> this redundant mapping operation.
>
> Fixes: 79f339125ea3 ("net: fec: Add software TSO support")
> Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@...il.com>
> ---
> drivers/net/ethernet/freescale/fec_main.c | 9 ---------
> 1 file changed, 9 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index 68725506a095..039de4c5044e 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -805,15 +805,6 @@ fec_enet_txq_put_hdr_tso(struct fec_enet_priv_tx_q
> *txq,
>
> if (fep->quirks & FEC_QUIRK_SWAP_FRAME)
> swap_buffer(bufaddr, hdr_len);
> -
> - dmabuf = dma_map_single(&fep->pdev->dev, bufaddr,
> - hdr_len, DMA_TO_DEVICE);
> - if (dma_mapping_error(&fep->pdev->dev, dmabuf)) {
> - dev_kfree_skb_any(skb);
> - if (net_ratelimit())
> - netdev_err(ndev, "Tx DMA memory map failed\n");
> - return NETDEV_TX_OK;
> - }
> }
>
> bdp->cbd_bufaddr = cpu_to_fec32(dmabuf);
> --
> 2.34.1
Hi Dheeraj,
I must admit that I misread it too. There is another case in the TSO
header where txq->tx_bounce may be used in some cases. I think
the most correct fix is to make txq->tso_hdrs aligned to 32/64 bytes
when allocating tso_hdrs, then we do not need to use txq->tx_bounce
in fec_enet_txq_put_hdr_tso(), because (bufaddr) & fep->tx_align)
will not be true. This way we can safely remove dma_map_single()
from fec_enet_txq_put_hdr_tso().
Powered by blists - more mailing lists