Subject: Re: [PATCH net-next,v2] net: mana: Support HW link state events

From: Jakub Kicinski <[email-masked]>
Date: Fri, 17 Oct 2025 16:05:41 -0700

On Tue, 14 Oct 2025 14:26:49 -0700 Haiyang Zhang wrote:
> From: Haiyang Zhang <[email-masked]>
> 
> Handle the HW link state events received from HW channel, and
> set the proper link state, also stop/wake queues accordingly.

Why do you have to stop / start the queues? I think it's unusual.
Let the packets get dropped, sending out potentially old packets
when link comes back is not going to make anyone happier.

> +static void mana_link_state_handle(struct work_struct *w)
> +{
> +	struct mana_port_context *apc;
> +	struct mana_context *ac;
> +	struct net_device *ndev;
> +	bool link_up;
> +	int i;
> +
> +	ac = container_of(w, struct mana_context, link_change_work);
> +
> +	if (ac->mana_removing)
> +		return;
> +
> +	rtnl_lock();
> +

> @@ -3500,6 +3556,10 @@ void mana_remove(struct gdma_dev *gd, bool suspending)
>  	int err;
>  	int i;
>  
> +	ac->mana_removing = true;
> +
> +	cancel_work_sync(&ac->link_change_work);

Looks racy, the work needs @ac to check the ->mana_removing but
mana_remove() frees @ac. Just use disable_work_sync() please.
-- 
pw-bot: cr