BPF List
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Wei Fang <wei.fang@nxp.com>
Cc: claudiu.manoil@nxp.com, xiaoning.wang@nxp.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, ast@kernel.org,
	daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
	sdf@fomichev.me, frank.li@nxp.com, imx@lists.linux.dev,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org
Subject: Re: [PATCH v3 net] net: enetc: do not transmit redirected XDP frames when the link is down
Date: Thu, 11 Dec 2025 13:40:25 +0200	[thread overview]
Message-ID: <20251211114025.3gqkeh4drdcp2tv5@skbuf> (raw)
In-Reply-To: <20251211020919.121113-1-wei.fang@nxp.com>

On Thu, Dec 11, 2025 at 10:09:19AM +0800, Wei Fang wrote:
> In the current implementation, the enetc_xdp_xmit() always transmits
> redirected XDP frames even if the link is down, but the frames cannot
> be transmitted from TX BD rings when the link is down, so the frames
> are still kept in the TX BD rings. If the XDP program is uninstalled,
> users will see the following warning logs.
> 
> fsl_enetc 0000:00:00.0 eno0: timeout for tx ring #6 clear
> 
> More worse, the TX BD ring cannot work properly anymore, because the
> HW PIR and CIR are not equal after the re-initialization of the TX
> BD ring. At this point, the BDs between CIR and PIR are invalid,
> which will cause a hardware malfunction.
> 
> Another reason is that there is internal context in the ring prefetch
> logic that will retain the state from the first incarnation of the ring
> and continue prefetching from the stale location when we re-initialize
> the ring. The internal context is only reset by an FLR. That is to say,
> for LS1028A ENETC, software cannot set the HW CIR and PIR when
> initializing the TX BD ring.
> 
> It does not make sense to transmit redirected XDP frames when the link is
> down. Add a link status check to prevent transmission in this condition.
> This fixes part of the issue, but more complex cases remain. For example,
> the TX BD ring may still contain unsent frames when the link goes down.
> Those situations require additional patches, which will build on this
> one.
> 
> Fixes: 9d2b68cc108d ("net: enetc: add support for XDP_REDIRECT")
> Signed-off-by: Wei Fang <wei.fang@nxp.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> 
> ---

More patches to fix the other conditions are coming. I can confirm that
they do not render this one useless. xdp_ok_fwd_dev() only tests that
the device is administratively up.

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>

  parent reply	other threads:[~2025-12-11 11:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-11  2:09 [PATCH v3 net] net: enetc: do not transmit redirected XDP frames when the link is down Wei Fang
2025-12-11 11:00 ` Hariprasad Kelam
2025-12-11 11:40 ` Vladimir Oltean [this message]
2025-12-18 15:50 ` patchwork-bot+netdevbpf

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=20251211114025.3gqkeh4drdcp2tv5@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=claudiu.manoil@nxp.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=frank.li@nxp.com \
    --cc=hawk@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=wei.fang@nxp.com \
    --cc=xiaoning.wang@nxp.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