public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Wen Gu <guwen@linux.alibaba.com>,
	Philo Lu <lulie@linux.alibaba.com>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Vadim Fedorenko <vadim.fedorenko@linux.dev>,
	Dong Yibo <dong100@mucse.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@redhat.com>,
	Dust Li <dust.li@linux.alibaba.com>
Subject: Re: [PATCH net-next v22 4/6] eea: create/destroy rx,tx queues for netdevice open and stop
Date: Mon, 26 Jan 2026 20:44:42 -0800	[thread overview]
Message-ID: <20260126204442.4ae27de4@kernel.org> (raw)
In-Reply-To: <20260122120508.17452-5-xuanzhuo@linux.alibaba.com>

On Thu, 22 Jan 2026 20:05:06 +0800 Xuan Zhuo wrote:
> +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);

[1]

> +	enet_bind_new_q_and_cfg(enet, ctx);
> +
> +	err = eea_active_ring_and_irq(enet);
> +	if (err) {
> +		/* Although the notification to hardware or the initial IRQ
> +		 * setup has failed (which is, of course, a very low-probability
> +		 * event), we do not immediately free the queues resources here.
> +		 * Instead, we defer their release until the normal NIC cleanup,
> +		 * or until the user or hardware triggers a reset operation.
> +		 * Because that the dev is running.
> +		 */
> +		netdev_err(enet->netdev,
> +			   "eea reset: active new ring and irq failed. err %d\n",
> +			   err);
> +		return err;
> +	}
> +
> +	err = eea_start_rxtx(enet->netdev);
> +	if (err)
> +		netdev_err(enet->netdev,
> +			   "eea reset: start queue failed. err %d\n", err);

This looks questionable, eea_start_rxtx() can only fail if
netif_set_real_num_queues() failed, which in turn may fail 
for sysfs-related reasons. So we're not talking about "rare
HW fail" scenarios in this case. Memory pressure or name collision
would be enough. Seems like this is easy to address. 
Move netif_set_real_num_queues() out of eea_start_rxtx().
This way eea_start_rxtx() can start returning void (can't fail).
In this function you can move the netif_set_real_num_queues()
call where I placed the [1] marker, before any changes were
actually made to the adapter.

Looking closer eea_active_ring_and_irq() is also calling kernel
registration functions which may fail, like request_irq().
You should do all of that before you actually shut down the adapter.

> +	return err;
> +}
-- 
pw-bot: cr

  reply	other threads:[~2026-01-27  4:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-22 12:05 [PATCH net-next v22 0/6] eea: Add basic driver framework for Alibaba Elastic Ethernet Adaptor Xuan Zhuo
2026-01-22 12:05 ` [PATCH net-next v22 1/6] eea: introduce PCI framework Xuan Zhuo
2026-01-22 12:05 ` [PATCH net-next v22 2/6] eea: introduce ring and descriptor structures Xuan Zhuo
2026-01-22 12:05 ` [PATCH net-next v22 3/6] eea: probe the netdevice and create adminq Xuan Zhuo
2026-01-22 12:05 ` [PATCH net-next v22 4/6] eea: create/destroy rx,tx queues for netdevice open and stop Xuan Zhuo
2026-01-27  4:44   ` Jakub Kicinski [this message]
2026-01-22 12:05 ` [PATCH net-next v22 5/6] eea: introduce ethtool support Xuan Zhuo
2026-01-22 12:05 ` [PATCH net-next v22 6/6] eea: introduce callback for ndo_get_stats64 Xuan Zhuo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260126204442.4ae27de4@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dong100@mucse.com \
    --cc=dust.li@linux.alibaba.com \
    --cc=edumazet@google.com \
    --cc=guwen@linux.alibaba.com \
    --cc=hkallweit1@gmail.com \
    --cc=lorenzo@kernel.org \
    --cc=lukas.bulwahn@redhat.com \
    --cc=lulie@linux.alibaba.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vadim.fedorenko@linux.dev \
    --cc=xuanzhuo@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox