Re: [PATCH net 2/4] net: sparx5: fix sleep in atomic context in MAC table access

Sebastian Andrzej Siewior
2026-05-04T16:06:56Z

On 2026-05-04 16:43:43 [+0200], Daniel Machon wrote:
> index 2bf9c5f64151..0797cfa32916 100644
> --- a/drivers/net/ethernet/microchip/sparx5/sparx5_mactable.c
> +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_mactable.c
> @@ -50,7 +50,7 @@ static int sparx5_mact_wait_for_completion(struct sparx5 *sparx5)
> {
> u32 val;
>
> - return readx_poll_timeout(sparx5_mact_get_status,
> + return readx_poll_timeout_atomic(sparx5_mact_get_status,

If you do _atomic, it becomes atomic. That means it does not sleep as in
TABLE_UPDATE_SLEEP_US for 10 us but spins via udelay(). The
TABLE_UPDATE_TIMEOUT_US is set to 100ms which _might_ be high.
This is probably just nitpicking (given that there are other drivers
doing the same with a greater timeout (READL_TIMEOUT_US)) so feel free
to ignore it.

> sparx5, val,
> LRN_COMMON_ACCESS_CTRL_MAC_TABLE_ACCESS_SHOT_GET(val) == 0,
> TABLE_UPDATE_SLEEP_US, TABLE_UPDATE_TIMEOUT_US);

Sebastian