On Thu, Oct 10, 2024 at 05:20:55PM +0800, Wei Fang wrote: > The Tx BD rings are disabled first in enetc_stop() and the driver > waits for them to become empty. This operation is not safe while > the ring is actively transmitting frames, and will cause the ring > to not be empty and hardware exception. As described in the NETC > block guide, software should only disable an active Tx ring after > all pending ring entries have been consumed (i.e. when PI = CI). > Disabling a transmit ring that is actively processing BDs risks > a HW-SW race hazard whereby a hardware resource becomes assigned > to work on one or more ring entries only to have those entries be > removed due to the ring becoming disabled. > > When testing XDP_REDIRECT feautre, although all frames were blocked > from being put into Tx rings during ring reconfiguration, the similar > warning log was still encountered: > > fsl_enetc 0000:00:00.2 eno2: timeout for tx ring #6 clear > fsl_enetc 0000:00:00.2 eno2: timeout for tx ring #7 clear > > The reason is that when there are still unsent frames in the Tx ring, > disabling the Tx ring causes the remaining frames to be unable to be > sent out. And the Tx ring cannot be restored, which means that even > if the xdp program is uninstalled, the Tx frames cannot be sent out > anymore. Therefore, correct the operation order in enect_start() and > enect_stop(). Typos, no need to resend for this: enect -> enetc. > > Fixes: ff58fda09096 ("net: enetc: prioritize ability to go down over packet processing") > Cc: stable@xxxxxxxxxxxxxxx > Signed-off-by: Wei Fang <wei.fang@xxxxxxx> > --- Reviewed-by: Vladimir Oltean <vladimir.oltean@xxxxxxx>