From: Wei Fang <wei.fang@nxp.com>
To: Keisuke Tsukuda <tkdkei@outlook.jp>
Cc: Frank Li <frank.li@nxp.com>, Shenwei Wang <shenwei.wang@nxp.com>,
"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@kernel.org" <edumazet@kernel.org>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"imx@lists.linux.dev" <imx@lists.linux.dev>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: RE: [PATCH net] net: fec: fix TSO DMA mapping failure handling
Date: Fri, 27 Nov 2026 06:29:18 +0000 [thread overview]
Message-ID: <AS4PR04MB9338D0CD2F0B9C8CA941E34488412@AS4PR04MB9338.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20261127033906.9561-1-tkdkei@outlook.jp>
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -746,10 +746,9 @@ fec_enet_txq_put_data_tso(struct
> fec_enet_priv_tx_q *txq, struct sk_buff *skb,
>
> addr = dma_map_single(&fep->pdev->dev, data, size, DMA_TO_DEVICE);
> if (dma_mapping_error(&fep->pdev->dev, addr)) {
> - dev_kfree_skb_any(skb);
> if (net_ratelimit())
> netdev_err(ndev, "Tx DMA memory map failed\n");
> - return NETDEV_TX_OK;
> + return -ENOMEM;
> }
>
> bdp->cbd_datlen = cpu_to_fec16(size);
> @@ -792,8 +791,11 @@ fec_enet_txq_put_hdr_tso(struct
> fec_enet_priv_tx_q *txq,
> unsigned int estatus = 0;
>
> status = fec16_to_cpu(bdp->cbd_sc);
> - status &= ~BD_ENET_TX_STATS;
> - status |= (BD_ENET_TX_TC | BD_ENET_TX_READY);
> + status &= ~(BD_ENET_TX_STATS | BD_ENET_TX_READY);
> + status |= BD_ENET_TX_TC;
> + /* Keep the first descriptor unavailable until all mappings succeed. */
> + if (bdp != txq->bd.cur)
> + status |= BD_ENET_TX_READY;
>
> bufaddr = txq->tso_hdrs + index * TSO_HEADER_SIZE;
> dmabuf = txq->tso_hdrs_dma + index * TSO_HEADER_SIZE;
> @@ -808,10 +810,9 @@ fec_enet_txq_put_hdr_tso(struct
> fec_enet_priv_tx_q *txq,
> 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;
> + return -ENOMEM;
> }
> }
>
> @@ -901,6 +902,10 @@ static int fec_enet_txq_submit_tso(struct
> fec_enet_priv_tx_q *txq,
> txq->tx_buf[index].buf_p = skb;
>
> skb_tx_timestamp(skb);
> + dma_wmb();
> + txq->bd.cur->cbd_sc |= cpu_to_fec16(BD_ENET_TX_READY);
> + /* Make the READY update visible before advancing the ring cursor. */
> + wmb();
I think using dma_wmb() is sufficient here.
prev parent reply other threads:[~2026-11-27 6:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 3:39 Keisuke Tsukuda
2026-11-27 6:29 ` Wei Fang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AS4PR04MB9338D0CD2F0B9C8CA941E34488412@AS4PR04MB9338.eurprd04.prod.outlook.com \
--to=wei.fang@nxp.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=frank.li@nxp.com \
--cc=imx@lists.linux.dev \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shenwei.wang@nxp.com \
--cc=tkdkei@outlook.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®