The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Yibo Dong <dong100@mucse.com>
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, vadim.fedorenko@linux.dev,
	u.kleine-koenig@baylibre.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, yaojun@mucse.com
Subject: Re: [PATCH net-next v9 2/4] net: rnpgbe: Add basic TX packet transmission support
Date: Wed, 19 Aug 2026 12:09:16 +0100	[thread overview]
Message-ID: <20260819110916.GQ265046@horms.kernel.org> (raw)
In-Reply-To: <5DC7ADB456BE9777+20260819084904.GB2730731@nic-Precision-5820-Tower>

On Wed, Aug 19, 2026 at 04:49:04PM +0800, Yibo Dong wrote:

...

> > > @@ -633,13 +758,144 @@ static void rnpgbe_napi_disable_all(struct mucse *mucse)
> > > +static void rnpgbe_stop_tx_ring(struct mucse_ring *tx_ring)
> > > +{
> > > +	if (!tx_ring->tx_buffer_info)
> > > +		return;
> > > +
> > > +	/* Stop hw. No new descriptors are fetched after TX_START=0.
> > > +	 * DMA for descriptors fetched before the stop may still be in flight.
> > > +	 */
> > > +	mucse_ring_wr32(tx_ring, RNPGBE_TX_START, 0);
> > > +	/* Flush posted write to ensure hardware sees TX_START=0 */
> > > +	(void)mucse_ring_rd32(tx_ring, RNPGBE_TX_START);
> > > +}
> > > +
> > > +static void rnpgbe_wait_tx_dma_idle(struct mucse *mucse)
> > > +{
> > > +	struct mucse_hw *hw = &mucse->hw;
> > > +	u32 dma_status;
> > > +	int err;
> > > +
> > > +	err = readl_poll_timeout(hw->hw_addr + RNPGBE_DMA_STATUS,
> > > +				 dma_status,
> > > +				 (dma_status & RNPGBE_DMA_TX_STATUS) ==
> > > +				 RNPGBE_DMA_TX_STATUS,
> > > +				 10, 100000);
> > > +	if (err)
> > > +		dev_warn(&mucse->pdev->dev,
> > > +			 "Timed out waiting for TX DMA to quiesce, status %#x\n",
> > > +			 dma_status);
> > > +}
> > 
> > [Severity: Medium]
> > [Finding: gpt-5-6-sol-4-6]
> > [Sources: gpt-5-6-sol, opus-5]
> > Should the timeout here be propagated to the callers?
> > 
> > rnpgbe_wait_tx_dma_idle() returns void, so a timeout is only logged and
> > both callers continue as if the engine had confirmed idle. On the ifdown
> > side that means rnpgbe_clean_all_tx_rings() clears TX_AXI_RW_EN and then
> > rnpgbe_clean_tx_ring() calls dma_unmap_single()/dma_unmap_page() on every
> > in-flight TX buffer, and rnpgbe_close() -> rnpgbe_free_all_tx_resources()
> > -> rnpgbe_free_tx_resources() then dma_free_coherent()s the descriptor
> > ring.
> > 
> > The comment in rnpgbe_stop_tx_ring() states that DMA for descriptors
> > fetched before the stop may still be in flight, which is what this poll
> > is guarding. If the poll times out, can the device still be reading the
> > mapped buffers or writing back into the descriptor ring after they are
> > released?
> > 
> > The same unchecked wait sits at the head of rnpgbe_configure_tx(), where
> > RNPGBE_TX_BASE_ADDR_LO/HI, RNPGBE_TX_LEN and TAIL are reprogrammed and
> > TX_START is set to 1 again. Is a device reset or an error return needed
> > when the engine never reports idle?
> > 
> After TX_START has been cleared for all TX rings, normal outstanding
> DMA transactions reach idle well within 100 ms. If DMA_STATUS still does
> not report idle after that timeout, the hardware has entered an
> unrecoverable AXI fault state. In this state, the EP will not issue any
> further DMA accesses to RC memory, so teardown can safely release the DMA
> mappings. Recovery requires a chip-level reset.
> I will make the helper return an error. On this error, the driver will
> report it with dev_err() and will not enable or reprogram TX DMA again;
> the configuration/open path will fail instead. Does this approach sound
> reasonable?

Yes, sounds good.
Thanks.

  reply	other threads:[~2026-08-19 11:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 11:13 [PATCH net-next v9 0/4] net: rnpgbe: Add TX/RX and link status support Dong Yibo
2026-08-14 11:13 ` [PATCH net-next v9 1/4] net: rnpgbe: Add interrupt handling Dong Yibo
2026-08-18 10:59   ` Simon Horman
2026-08-19  6:42     ` Yibo Dong
2026-08-14 11:13 ` [PATCH net-next v9 2/4] net: rnpgbe: Add basic TX packet transmission support Dong Yibo
2026-08-18 11:03   ` Simon Horman
2026-08-19  8:49     ` Yibo Dong
2026-08-19 11:09       ` Simon Horman [this message]
2026-08-14 11:13 ` [PATCH net-next v9 3/4] net: rnpgbe: Add RX packet reception support Dong Yibo
2026-08-18 11:15   ` Simon Horman
2026-08-19  9:42     ` Yibo Dong
2026-08-14 11:13 ` [PATCH net-next v9 4/4] net: rnpgbe: Add link status handling support Dong Yibo
2026-08-18 12:04   ` Simon Horman

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=20260819110916.GQ265046@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dong100@mucse.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=vadim.fedorenko@linux.dev \
    --cc=yaojun@mucse.com \
    /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