public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	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>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net-next v28 4/8] eea: create/destroy rx,tx queues for netdevice open and stop
Date: Tue, 10 Mar 2026 09:38:30 +0100	[thread overview]
Message-ID: <9599a3fb-0c6f-4f60-be88-ceb65acad2b8@redhat.com> (raw)
In-Reply-To: <1773046268.140821-1-xuanzhuo@linux.alibaba.com>

On 3/9/26 9:51 AM, Xuan Zhuo wrote:
> On Thu, 5 Mar 2026 11:16:32 +0100, Paolo Abeni <pabeni@redhat.com> wrote:
>> On 3/2/26 3:46 AM, Xuan Zhuo wrote:
>>> +static int eea_netdev_open(struct net_device *netdev)
>>> +{
>>> +	struct eea_net *enet = netdev_priv(netdev);
>>> +	struct eea_net_init_ctx ctx;
>>> +	int err;
>>> +
>>> +	if (enet->link_err) {
>>> +		netdev_err(netdev, "netdev open err, because link error: %d\n",
>>> +			   enet->link_err);
>>> +		return -EBUSY;
>>> +	}
>>> +
>>> +	eea_init_ctx(enet, &ctx);
>>> +
>>> +	err = eea_alloc_rxtx_q_mem(&ctx);
>>> +	if (err)
>>> +		goto err_done;
>>> +
>>> +	eea_bind_q_and_cfg(enet, &ctx);
>>> +
>>> +	err = eea_update_queues(enet);
>>> +	if (err)
>>> +		goto err_free_q;
>>> +
>>> +	err = eea_hw_active_ring(enet);
>>> +	if (err)
>>> +		goto err_free_q;
>>> +
>>> +	eea_start_rxtx(enet);
>>> +
>>> +	return 0;
>>> +
>>> +err_free_q:
>>> +	eea_unbind_q_and_cfg(enet, &ctx);
>>> +	eea_free_rxtx_q_mem(&ctx);
>>> +
>>> +err_done:
>>> +	return err;
>>> +}
>>> +
>>> +/* resources: ring, buffers, irq */
>>> +int eea_reset_hw_resources(struct eea_net *enet, struct eea_net_init_ctx *ctx)
>>> +{
>>> +	struct eea_net_init_ctx ctx_old = {0};
>>> +	int err, error;
>>> +
>>> +	if (!netif_running(enet->netdev) || !enet->started) {
>>> +		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_stop_rxtx(enet->netdev);
>>> +	eea_hw_unactive_ring(enet);
>>> +
>>> +	eea_unbind_q_and_cfg(enet, &ctx_old);
>>> +	eea_bind_q_and_cfg(enet, ctx);
>>> +
>>> +	err = eea_update_queues(enet);
>>> +	if (err) {
>>> +		netdev_err(enet->netdev,
>>> +			   "eea reset: set real num queues failed. err %d\n",
>>> +			   err);
>>> +		goto err_bind_old;
>>> +	}
>>> +
>>> +	err = eea_hw_active_ring(enet);
>>
>> AFAICS the need for admins queue destroy and recreation on cfg change is
>> what prevents a safe configuration swap (together with irq allocation,
>> see below). Could you instead keep the admin queue always alive i.e.
>> with maximum number of erings configured, and just enable/them as needded?
>>
>> If not, please document explicitly the constraint in the commit message.
> 
> Generally, during I/O queue reconstruction, the admin queue is not rebuilt.
> However, in HA scenarios—which represent a special case—
> the DPU notifies the driver to request re-initialization. In this specific
> situation, the admin queue will also be rebuilt.

The above means that in HA scenarios the driver can't ensure to restore
the status correctly right?

At very least this info should be explicitly mentioned in the commit
message.

> 
>>
>> [...]
>>> @@ -140,14 +591,65 @@ static struct eea_net *eea_netdev_alloc(struct eea_device *edev, u32 pairs)
>>>  	enet->edev = edev;
>>>  	edev->enet = enet;
>>>
>>> +	err = eea_alloc_irq_blks(enet, pairs);
>>> +	if (err) {
>>
>> I'm likely lost, but AFAICS eea_alloc_irq_blks() is invoked only here,
>> and allocates edev->rx_num interrupts. rx_num is the number of RX
>> channel at device probe time.
>>
>> set_channels can later change such value, i.e. increasing it. But I
>> don't see other irqs allocated.
> 
> 
> No, set_channels just change enet.cfg.rx_num, edev->rx_num is readonly.

Ah, I (now) see that set_channel max is cfg_hw.rx_ring_num, which in
turn is equal to edev->rx_num.

It would be useful to explicitly mention in the commit message or in the
init code that the driver always per allocate the max possible number of
IRQs handlers.

/P


  reply	other threads:[~2026-03-10  8:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-02  2:45 [PATCH net-next v28 0/8] eea: Add basic driver framework for Alibaba Elastic Ethernet Adaptor Xuan Zhuo
2026-03-02  2:45 ` [PATCH net-next v28 1/8] eea: introduce PCI framework Xuan Zhuo
2026-03-02  2:45 ` [PATCH net-next v28 2/8] eea: introduce ring and descriptor structures Xuan Zhuo
2026-03-02  2:45 ` [PATCH net-next v28 3/8] eea: probe the netdevice and create adminq Xuan Zhuo
2026-03-06  2:44   ` [net-next,v28,3/8] " Jakub Kicinski
2026-03-02  2:46 ` [PATCH net-next v28 4/8] eea: create/destroy rx,tx queues for netdevice open and stop Xuan Zhuo
2026-03-05 10:16   ` Paolo Abeni
2026-03-09  8:51     ` Xuan Zhuo
2026-03-10  8:38       ` Paolo Abeni [this message]
2026-03-02  2:46 ` [PATCH net-next v28 5/8] eea: implement packet receive logic Xuan Zhuo
2026-03-02  2:46 ` [PATCH net-next v28 6/8] eea: implement packet transmit logic Xuan Zhuo
2026-03-02  2:46 ` [PATCH net-next v28 7/8] eea: introduce ethtool support Xuan Zhuo
2026-03-02  2:46 ` [PATCH net-next v28 8/8] 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=9599a3fb-0c6f-4f60-be88-ceb65acad2b8@redhat.com \
    --to=pabeni@redhat.com \
    --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=kuba@kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=lukas.bulwahn@redhat.com \
    --cc=lulie@linux.alibaba.com \
    --cc=netdev@vger.kernel.org \
    --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