Netdev List
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Dong Yibo <dong100@mucse.com>,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, danishanwar@ti.com,
	horms@kernel.org
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, yaojun@mucse.com
Subject: Re: [PATCH net-next v3 1/4] net: rnpgbe: Add interrupt handling
Date: Thu, 7 May 2026 13:30:55 +0100	[thread overview]
Message-ID: <5e9b15c7-5db4-408e-a5bc-75fe5752ed74@linux.dev> (raw)
In-Reply-To: <20260507081539.171844-2-dong100@mucse.com>

On 07/05/2026 09:15, Dong Yibo wrote:
> Add comprehensive interrupt handling for the RNPGBE driver:
> - Implement msi-x/msi interrupt configuration and management
> - Create library functions for interrupt registration and cleanup
> 
> This infrastructure enables proper interrupt handling for the
> RNPGBE driver.
> 

[...]

> +/**
> + * rnpgbe_set_interrupt_capability - Set MSI-X or MSI if supported
> + * @mucse: pointer to private structure
> + *
> + * Attempt to configure the interrupts using the best available
> + * capabilities of the hardware.
> + *
> + * @return: 0 on success, negative on failure
> + **/
> +static int rnpgbe_set_interrupt_capability(struct mucse *mucse)
> +{
> +	int v_budget;
> +
> +	v_budget = min_t(int, mucse->num_tx_queues, mucse->num_rx_queues);
> +	v_budget = min_t(int, v_budget, MAX_Q_VECTORS);

these 2 lines can be simplified to

min3(mucse->num_tx_queues, mucse->num_rx_queues, MAX_Q_VECTORS);

> +	v_budget = min_t(int, v_budget, num_online_cpus());
 > +	/* add one vector for mbx */> +	v_budget += 1;
> +	v_budget = pci_alloc_irq_vectors(mucse->pdev, 1, v_budget,
> +					 PCI_IRQ_MSI | PCI_IRQ_MSIX);
> +	if (v_budget < 0)
> +		return v_budget;
> +
> +	if (mucse->pdev->msix_enabled) {
> +		/* q_vector not include mbx */
> +		if (v_budget > 1) {
> +			mucse->flags |= M_FLAG_MSIX_EN;
> +			mucse->num_q_vectors = v_budget - 1;
> +		} else {
> +			mucse->flags |= M_FLAG_MSIX_SINGLE_EN;
> +			mucse->num_q_vectors = 1;
> +		}
> +	} else {
> +		/* msi use only 1 irq */
> +		mucse->num_q_vectors = 1;
> +		mucse->flags |= M_FLAG_MSI_EN;
> +	}

How will it work in case it's only 1 vector allocated? AFAIU, you need 
at least 2 irq vectors - 1 for queue processing, another one for mbx.

> +
> +	return 0;
> +}

  reply	other threads:[~2026-05-07 12:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07  8:15 [PATCH net-next v3 0/4] net: rnpgbe: Add TX/RX and link status support Dong Yibo
2026-05-07  8:15 ` [PATCH net-next v3 1/4] net: rnpgbe: Add interrupt handling Dong Yibo
2026-05-07 12:30   ` Vadim Fedorenko [this message]
2026-05-08  3:06     ` Yibo Dong
2026-05-07  8:15 ` [PATCH net-next v3 2/4] net: rnpgbe: Add basic TX packet transmission support Dong Yibo
2026-05-07  8:15 ` [PATCH net-next v3 3/4] net: rnpgbe: Add RX packet reception support Dong Yibo
2026-05-07  8:15 ` [PATCH net-next v3 4/4] net: rnpgbe: Add link status handling support Dong Yibo

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=5e9b15c7-5db4-408e-a5bc-75fe5752ed74@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=danishanwar@ti.com \
    --cc=davem@davemloft.net \
    --cc=dong100@mucse.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=yaojun@mucse.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