[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260108081748.GF345651@kernel.org>
Date: Thu, 8 Jan 2026 08:17:48 +0000
From: Simon Horman <horms@...nel.org>
To: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
Cc: netdev@...r.kernel.org, Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Wen Gu <guwen@...ux.alibaba.com>,
Philo Lu <lulie@...ux.alibaba.com>,
Vadim Fedorenko <vadim.fedorenko@...ux.dev>,
Lorenzo Bianconi <lorenzo@...nel.org>,
Lukas Bulwahn <lukas.bulwahn@...hat.com>,
Dong Yibo <dong100@...se.com>,
Vivian Wang <wangruikang@...as.ac.cn>,
MD Danish Anwar <danishanwar@...com>,
Dust Li <dust.li@...ux.alibaba.com>
Subject: Re: [PATCH net-next v18 4/6] eea: create/destroy rx,tx queues for
netdevice open and stop
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 <dust.li@...ux.alibaba.com>
> Reviewed-by: Philo Lu <lulie@...ux.alibaba.com>
> Signed-off-by: Wen Gu <guwen@...ux.alibaba.com>
> Signed-off-by: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
...
> 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;
> +}
...
Powered by blists - more mailing lists