Subject: Re: [PATCH net-next v18 4/6] eea: create/destroy rx,tx queues for netdevice open and stop

From: Simon Horman <[email-masked]>
Date: Thu, 8 Jan 2026 08:17:48 +0000

On Mon, Jan 05, 2026 at 07:07:10PM +0800, Xuan Zhuo wrote:
> Add basic driver framework for the Alibaba Elastic Ethernet Adapter(EEA).
> 
> This commit introduces the implementation for the netdevice open and
> stop.
> 
> Reviewed-by: Dust Li <[email-masked]>
> Reviewed-by: Philo Lu <[email-masked]>
> Signed-off-by: Wen Gu <[email-masked]>
> Signed-off-by: Xuan Zhuo <[email-masked]>

...

> diff --git a/drivers/net/ethernet/alibaba/eea/eea_net.c b/drivers/net/ethernet/alibaba/eea/eea_net.c

...

> +/* resources: ring, buffers, irq */
> +int eea_reset_hw_resources(struct eea_net *enet, struct eea_net_init_ctx *ctx)
> +{
> +	int err;
> +
> +	if (!netif_running(enet->netdev)) {
> +		enet->cfg = ctx->cfg;
> +		return 0;
> +	}
> +
> +	err = eea_alloc_rxtx_q_mem(ctx);
> +	if (err) {
> +		netdev_warn(enet->netdev,
> +			    "eea reset: alloc q failed. stop reset. err %d\n",
> +			    err);
> +		return err;
> +	}
> +
> +	eea_netdev_stop(enet->netdev);
> +
> +	enet_bind_new_q_and_cfg(enet, ctx);
> +
> +	err = eea_active_ring_and_irq(enet);
> +	if (err) {
> +		netdev_warn(enet->netdev,
> +			    "eea reset: active new ring and irq failed. err %d\n",
> +			    err);
> +		return err;
> +	}

I think that some unwinding of resources is needed if
eea_active_ring_and_irq() or eea_start_rxtx() fail.
Similar to what appears in eea_netdev_open().

Also flagged by Claude Code with Review Prompts.

> +
> +	err = eea_start_rxtx(enet->netdev);
> +	if (err)
> +		netdev_warn(enet->netdev,
> +			    "eea reset: start queue failed. err %d\n", err);
> +
> +	return err;
> +}

...

> diff --git a/drivers/net/ethernet/alibaba/eea/eea_tx.c b/drivers/net/ethernet/alibaba/eea/eea_tx.c

...

> +static void eea_free_meta(struct eea_net_tx *tx, struct eea_net_cfg *cfg)
> +{
> +	struct eea_sq_free_stats stats;
> +	struct eea_tx_meta *meta;
> +	int i;
> +
> +	while ((meta = eea_tx_meta_get(tx)))
> +		meta->skb = NULL;
> +
> +	for (i = 0; i < cfg->tx_ring_num; i++) {
> +		meta = &tx->meta[i];
> +
> +		if (!meta->skb)
> +			continue;
> +
> +		eea_meta_free_xmit(tx, meta, false, NULL, &stats);
> +
> +		meta->skb = NULL;
> +	}

Claude Code running with Review Prompts [1] flags that
in the loop above cfg->tx_ring_num is used as the bounds
for access to tx->meta. But elsewhere, including in the
allocation of tx->meta, ctx->cfg.tx_ring_depth is used.

[1] https://github.com/masoncl/review-prompts/

> +
> +	kvfree(tx->meta);
> +	tx->meta = NULL;
> +}

...